strapi-plugin-navigation 3.0.0-beta.3 → 3.0.0-beta.4
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 +1 -1
- package/dist/admin/index.js +423 -281
- package/dist/admin/index.mjs +423 -281
- package/dist/admin/src/api/client.d.ts +1 -1
- package/dist/admin/src/api/validators.d.ts +7 -7
- package/dist/admin/src/pages/HomePage/components/NavigationItemForm/utils/form.d.ts +78 -0
- package/dist/admin/src/pages/HomePage/hooks/index.d.ts +1 -1
- package/dist/admin/src/pages/HomePage/utils/parsers.d.ts +2 -2
- package/dist/server/index.js +20 -14
- package/dist/server/index.mjs +20 -14
- package/package.json +7 -7
package/dist/admin/index.js
CHANGED
|
@@ -8568,7 +8568,8 @@ const SvgCog = ({
|
|
|
8568
8568
|
const stroke = strokeProp && strokeProp in colors ? colors[strokeProp] : strokeProp;
|
|
8569
8569
|
return /* @__PURE__ */ jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 32 32", width: 16, height: 16, fill, stroke, ref, ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M29.743 13.401a1 1 0 0 0-.487-.675l-3.729-2.125-.015-4.202a1 1 0 0 0-.353-.76 14 14 0 0 0-4.59-2.584 1 1 0 0 0-.808.074L16 5.23l-3.765-2.106a1 1 0 0 0-.809-.075 14 14 0 0 0-4.585 2.594 1 1 0 0 0-.354.758L6.47 10.61 2.74 12.734a1 1 0 0 0-.486.675 13.3 13.3 0 0 0 0 5.195 1 1 0 0 0 .486.675l3.729 2.125.015 4.204a1 1 0 0 0 .353.76 14 14 0 0 0 4.59 2.583 1 1 0 0 0 .808-.073L16 26.768l3.765 2.107a1.013 1.013 0 0 0 .809.073 14 14 0 0 0 4.585-2.592 1 1 0 0 0 .354-.759l.018-4.206 3.729-2.125a1 1 0 0 0 .486-.675c.34-1.713.338-3.477-.003-5.19M16 21a5 5 0 1 1 0-10 5 5 0 0 1 0 10" }) });
|
|
8570
8570
|
};
|
|
8571
|
-
React.forwardRef(SvgCog);
|
|
8571
|
+
const ForwardRef$40 = React.forwardRef(SvgCog);
|
|
8572
|
+
const ForwardRef$41 = ForwardRef$40;
|
|
8572
8573
|
const SvgCollapse = ({
|
|
8573
8574
|
fill: fillProp = "currentColor",
|
|
8574
8575
|
stroke: strokeProp,
|
|
@@ -31922,6 +31923,8 @@ function selectedLineRanges(state) {
|
|
|
31922
31923
|
for (let r of state.selection.ranges) {
|
|
31923
31924
|
let fromLine = state.doc.lineAt(r.from);
|
|
31924
31925
|
let toLine = r.to <= fromLine.to ? fromLine : state.doc.lineAt(r.to);
|
|
31926
|
+
if (toLine.from > fromLine.from && toLine.from == r.to)
|
|
31927
|
+
toLine = r.to == fromLine.to + 1 ? fromLine : state.doc.lineAt(r.to - 1);
|
|
31925
31928
|
let last = ranges.length - 1;
|
|
31926
31929
|
if (last >= 0 && ranges[last].to > fromLine.from)
|
|
31927
31930
|
ranges[last].to = toLine.to;
|
|
@@ -50372,9 +50375,13 @@ const prefixPluginTranslations = (trad, pluginId) => {
|
|
|
50372
50375
|
}, {});
|
|
50373
50376
|
};
|
|
50374
50377
|
const usePluginTheme = () => {
|
|
50378
|
+
const getSystemTheme = () => window.matchMedia("(prefers-color-scheme: dark)").matches;
|
|
50375
50379
|
const [theme2, setTheme] = React.useState();
|
|
50376
50380
|
React.useEffect(() => {
|
|
50377
|
-
|
|
50381
|
+
const isDarkSystemTheme = getSystemTheme();
|
|
50382
|
+
const systemTheme = isDarkSystemTheme ? "dark" : "light";
|
|
50383
|
+
const strapiTheme = window.localStorage?.STRAPI_THEME;
|
|
50384
|
+
setTheme(strapiTheme === "system" ? systemTheme : strapiTheme);
|
|
50378
50385
|
}, []);
|
|
50379
50386
|
return {
|
|
50380
50387
|
theme: theme2 === "dark" ? darkTheme : lightTheme,
|
|
@@ -50494,7 +50501,7 @@ const audienceDBSchema = z__namespace.object({
|
|
|
50494
50501
|
name: z__namespace.string(),
|
|
50495
50502
|
key: z__namespace.string()
|
|
50496
50503
|
});
|
|
50497
|
-
const navigationItemTypeSchema = z__namespace.enum(["INTERNAL", "EXTERNAL"]);
|
|
50504
|
+
const navigationItemTypeSchema = z__namespace.enum(["INTERNAL", "EXTERNAL", "WRAPPER"]);
|
|
50498
50505
|
const navigationItemBaseSchema = z__namespace.object({
|
|
50499
50506
|
id: z__namespace.number(),
|
|
50500
50507
|
documentId: z__namespace.string(),
|
|
@@ -51109,7 +51116,7 @@ const toNavigationItem = (payload, config2) => {
|
|
|
51109
51116
|
structureId: payload.structureId,
|
|
51110
51117
|
removed: payload.removed,
|
|
51111
51118
|
updated: payload.updated
|
|
51112
|
-
} : {
|
|
51119
|
+
} : payload.type === "EXTERNAL" ? {
|
|
51113
51120
|
type: "EXTERNAL",
|
|
51114
51121
|
collapsed: !!payload.collapsed,
|
|
51115
51122
|
id: payload.id,
|
|
@@ -51131,6 +51138,27 @@ const toNavigationItem = (payload, config2) => {
|
|
|
51131
51138
|
audience: payload.audience?.map(
|
|
51132
51139
|
(documentId) => config2.availableAudience.find((audience) => audience.documentId === documentId)
|
|
51133
51140
|
) ?? []
|
|
51141
|
+
} : {
|
|
51142
|
+
type: "WRAPPER",
|
|
51143
|
+
collapsed: !!payload.collapsed,
|
|
51144
|
+
id: payload.id,
|
|
51145
|
+
documentId: payload.documentId,
|
|
51146
|
+
menuAttached: !!payload.menuAttached,
|
|
51147
|
+
order: payload.order ?? 0,
|
|
51148
|
+
path: payload.path ?? "",
|
|
51149
|
+
title: payload.title,
|
|
51150
|
+
uiRouterKey: payload.uiRouterKey,
|
|
51151
|
+
additionalFields: payload.additionalFields,
|
|
51152
|
+
audience: payload.audience?.map(
|
|
51153
|
+
(documentId) => config2.availableAudience.find((audience) => audience.documentId === documentId)
|
|
51154
|
+
) ?? [],
|
|
51155
|
+
autoSync: payload.autoSync,
|
|
51156
|
+
items: payload.items?.length ? transformItemToViewPayload(payload, payload.items, config2) : payload.items,
|
|
51157
|
+
viewId: payload.viewId,
|
|
51158
|
+
viewParentId: payload.viewParentId,
|
|
51159
|
+
structureId: payload.structureId,
|
|
51160
|
+
removed: payload.removed,
|
|
51161
|
+
updated: payload.updated
|
|
51134
51162
|
};
|
|
51135
51163
|
};
|
|
51136
51164
|
const transformItemToViewPayload = (payload, items = [], config2) => {
|
|
@@ -51192,8 +51220,15 @@ const extractRelatedItemLabel = (item, config2) => {
|
|
|
51192
51220
|
if (contentType2?.isSingle) {
|
|
51193
51221
|
return contentType2.labelSingular;
|
|
51194
51222
|
}
|
|
51195
|
-
const defaultFieldsWithCapitalizedOptions = [
|
|
51196
|
-
|
|
51223
|
+
const defaultFieldsWithCapitalizedOptions = [
|
|
51224
|
+
...defaultFields,
|
|
51225
|
+
...defaultFields.map((_) => lodash$1.capitalize(_))
|
|
51226
|
+
];
|
|
51227
|
+
const labelFields = lodash$1.get(
|
|
51228
|
+
fields,
|
|
51229
|
+
`${contentType2 ? contentType2.uid : __collectionUid}`,
|
|
51230
|
+
defaultFieldsWithCapitalizedOptions
|
|
51231
|
+
);
|
|
51197
51232
|
const itemLabels = (lodash$1.isEmpty(labelFields) ? defaultFieldsWithCapitalizedOptions : labelFields).map((_) => item[_]).filter((_) => _);
|
|
51198
51233
|
return lodash$1.first(itemLabels) || "";
|
|
51199
51234
|
};
|
|
@@ -51237,7 +51272,7 @@ const mapServerNavigationItem = (item, stopAtFirstLevel = false) => {
|
|
|
51237
51272
|
removed: item.removed,
|
|
51238
51273
|
updated: item.updated,
|
|
51239
51274
|
isSearchActive: item.isSearchActive
|
|
51240
|
-
} : {
|
|
51275
|
+
} : item.type === "EXTERNAL" ? {
|
|
51241
51276
|
type: "EXTERNAL",
|
|
51242
51277
|
id: item.id,
|
|
51243
51278
|
documentId: item.documentId,
|
|
@@ -51255,6 +51290,24 @@ const mapServerNavigationItem = (item, stopAtFirstLevel = false) => {
|
|
|
51255
51290
|
removed: item.removed,
|
|
51256
51291
|
updated: item.updated,
|
|
51257
51292
|
isSearchActive: item.isSearchActive
|
|
51293
|
+
} : {
|
|
51294
|
+
type: "WRAPPER",
|
|
51295
|
+
id: item.id,
|
|
51296
|
+
documentId: item.documentId,
|
|
51297
|
+
additionalFields: item.additionalFields ?? {},
|
|
51298
|
+
title: item.title,
|
|
51299
|
+
uiRouterKey: item.uiRouterKey,
|
|
51300
|
+
autoSync: item.autoSync ?? void 0,
|
|
51301
|
+
collapsed: item.collapsed,
|
|
51302
|
+
order: item.order ?? 0,
|
|
51303
|
+
menuAttached: item.menuAttached,
|
|
51304
|
+
viewId: item.viewId,
|
|
51305
|
+
viewParentId: item.viewParentId,
|
|
51306
|
+
items: stopAtFirstLevel ? item.items : item.items?.map((_) => mapServerNavigationItem(_)) ?? void 0,
|
|
51307
|
+
removed: item.removed,
|
|
51308
|
+
updated: item.updated,
|
|
51309
|
+
isSearchActive: item.isSearchActive,
|
|
51310
|
+
path: item.path ?? ""
|
|
51258
51311
|
};
|
|
51259
51312
|
};
|
|
51260
51313
|
const getPendingAction = (actions) => actions.find(({ isPending }) => isPending);
|
|
@@ -52387,34 +52440,28 @@ const Item = ({
|
|
|
52387
52440
|
viewParentId,
|
|
52388
52441
|
locale
|
|
52389
52442
|
}) => {
|
|
52390
|
-
const
|
|
52391
|
-
viewId,
|
|
52392
|
-
type,
|
|
52393
|
-
path,
|
|
52394
|
-
removed,
|
|
52395
|
-
externalPath,
|
|
52396
|
-
menuAttached,
|
|
52397
|
-
collapsed,
|
|
52398
|
-
items = [],
|
|
52399
|
-
isSearchActive,
|
|
52400
|
-
related,
|
|
52401
|
-
relatedType
|
|
52402
|
-
} = mapServerNavigationItem(item, true);
|
|
52443
|
+
const mappedItem = mapServerNavigationItem(item, true);
|
|
52403
52444
|
const { formatMessage } = reactIntl.useIntl();
|
|
52404
52445
|
const configQuery = useConfig$1();
|
|
52405
|
-
const isExternal = type === "EXTERNAL";
|
|
52446
|
+
const isExternal = mappedItem.type === "EXTERNAL";
|
|
52447
|
+
const isWrapper = mappedItem.type === "WRAPPER";
|
|
52406
52448
|
const isNextMenuAllowedLevel = lodash$1.isNumber(configQuery.data?.allowedLevels) ? level < configQuery.data.allowedLevels - 1 : true;
|
|
52407
52449
|
const isMenuAllowedLevel = lodash$1.isNumber(configQuery.data?.allowedLevels) ? level < configQuery.data.allowedLevels : true;
|
|
52408
52450
|
const hasChildren = !lodash$1.isEmpty(item.items) && !isExternal && !displayChildren;
|
|
52409
|
-
const absolutePath = isExternal ? void 0 : `${levelPath === "/" ? "" : levelPath}/${path === "/" ? "" : path}`.replace(
|
|
52451
|
+
const absolutePath = isExternal ? void 0 : `${levelPath === "/" ? "" : levelPath}/${mappedItem.path === "/" ? "" : mappedItem.path}`.replace(
|
|
52452
|
+
"//",
|
|
52453
|
+
"/"
|
|
52454
|
+
);
|
|
52410
52455
|
const contentTypeItemsQuery = useContentTypeItems({
|
|
52411
|
-
uid: relatedType ?? "",
|
|
52456
|
+
uid: mappedItem.type === "INTERNAL" ? mappedItem.relatedType ?? "" : "",
|
|
52412
52457
|
locale
|
|
52413
52458
|
});
|
|
52414
52459
|
const contentTypesQuery = useContentTypes$1();
|
|
52415
|
-
const contentType2 = contentTypesQuery.data?.find(
|
|
52460
|
+
const contentType2 = contentTypesQuery.data?.find(
|
|
52461
|
+
(_) => mappedItem.type === "INTERNAL" ? _.uid === mappedItem.relatedType : false
|
|
52462
|
+
);
|
|
52416
52463
|
const relatedItem = contentTypeItemsQuery.data?.find(
|
|
52417
|
-
(contentTypeItem) => contentTypeItem.documentId === related
|
|
52464
|
+
(contentTypeItem) => mappedItem.type === "INTERNAL" ? contentTypeItem.documentId === mappedItem.related : false
|
|
52418
52465
|
) ?? { documentId: "", id: 0 };
|
|
52419
52466
|
const isPublished = !!relatedItem?.publishedAt;
|
|
52420
52467
|
const relatedItemLabel = !isExternal ? extractRelatedItemLabel(relatedItem, configQuery.data) : "";
|
|
@@ -52476,24 +52523,32 @@ const Item = ({
|
|
|
52476
52523
|
const onNewItemClick = React.useCallback(
|
|
52477
52524
|
(event) => canUpdate && onItemLevelAdd(
|
|
52478
52525
|
event,
|
|
52479
|
-
viewId,
|
|
52526
|
+
mappedItem.viewId,
|
|
52480
52527
|
isNextMenuAllowedLevel,
|
|
52481
52528
|
absolutePath,
|
|
52482
|
-
menuAttached,
|
|
52483
|
-
`${structureId}.${items
|
|
52484
|
-
Math.max(...items
|
|
52529
|
+
mappedItem.menuAttached,
|
|
52530
|
+
`${structureId}.${mappedItem.items?.length ?? 0}`,
|
|
52531
|
+
Math.max(...mappedItem.items?.map(({ order }) => order) ?? [])
|
|
52485
52532
|
),
|
|
52486
|
-
[
|
|
52533
|
+
[
|
|
52534
|
+
mappedItem.viewId,
|
|
52535
|
+
isNextMenuAllowedLevel,
|
|
52536
|
+
absolutePath,
|
|
52537
|
+
mappedItem.menuAttached,
|
|
52538
|
+
structureId,
|
|
52539
|
+
mappedItem.items,
|
|
52540
|
+
canUpdate
|
|
52541
|
+
]
|
|
52487
52542
|
);
|
|
52488
52543
|
React.useEffect(() => {
|
|
52489
|
-
if (isSearchActive) {
|
|
52544
|
+
if (mappedItem.isSearchActive) {
|
|
52490
52545
|
refs.dropRef?.current?.scrollIntoView?.({
|
|
52491
52546
|
behavior: "smooth",
|
|
52492
52547
|
block: "center",
|
|
52493
52548
|
inline: "center"
|
|
52494
52549
|
});
|
|
52495
52550
|
}
|
|
52496
|
-
}, [isSearchActive, refs.dropRef.current]);
|
|
52551
|
+
}, [mappedItem.isSearchActive, refs.dropRef.current]);
|
|
52497
52552
|
const theme2 = styled.useTheme();
|
|
52498
52553
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
52499
52554
|
Wrapper$1,
|
|
@@ -52511,23 +52566,23 @@ const Item = ({
|
|
|
52511
52566
|
zIndex: 1,
|
|
52512
52567
|
position: "relative",
|
|
52513
52568
|
overflow: "hidden",
|
|
52514
|
-
backgroundColor: isSearchActive ? theme2.colors.secondary100 : void 0,
|
|
52515
|
-
borderColor: isSearchActive ? theme2.colors.secondary200 : void 0,
|
|
52569
|
+
backgroundColor: mappedItem.isSearchActive ? theme2.colors.secondary100 : void 0,
|
|
52570
|
+
borderColor: mappedItem.isSearchActive ? theme2.colors.secondary200 : void 0,
|
|
52516
52571
|
transition: "background-color 0.3s ease-in"
|
|
52517
52572
|
},
|
|
52518
52573
|
children: [
|
|
52519
|
-
removed && /* @__PURE__ */ jsxRuntime.jsx(ItemCardRemovedOverlay, {}),
|
|
52574
|
+
mappedItem.removed && /* @__PURE__ */ jsxRuntime.jsx(ItemCardRemovedOverlay, {}),
|
|
52520
52575
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { ref: refs.previewRef, children: [
|
|
52521
52576
|
/* @__PURE__ */ jsxRuntime.jsx(CardBody, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
52522
52577
|
ItemCardHeader,
|
|
52523
52578
|
{
|
|
52524
52579
|
title: item.title ?? "",
|
|
52525
|
-
path: isExternal ? externalPath : absolutePath,
|
|
52526
|
-
icon: isExternal ? /* @__PURE__ */ jsxRuntime.jsx(ForwardRef$3D, {}) : /* @__PURE__ */ jsxRuntime.jsx(ForwardRef$2l, {}),
|
|
52580
|
+
path: isExternal ? mappedItem.externalPath : absolutePath,
|
|
52581
|
+
icon: isExternal ? /* @__PURE__ */ jsxRuntime.jsx(ForwardRef$3D, {}) : isWrapper ? /* @__PURE__ */ jsxRuntime.jsx(ForwardRef$41, {}) : /* @__PURE__ */ jsxRuntime.jsx(ForwardRef$2l, {}),
|
|
52527
52582
|
onItemRemove: () => onItemRemove({ ...item, viewParentId }),
|
|
52528
52583
|
onItemEdit: () => {
|
|
52529
|
-
const [
|
|
52530
|
-
if (item.type !== "EXTERNAL" && item.type !== "INTERNAL") {
|
|
52584
|
+
const [relatedType, related] = item.related?.split(RELATED_ITEM_SEPARATOR) ?? [];
|
|
52585
|
+
if (item.type !== "EXTERNAL" && item.type !== "INTERNAL" && item.type !== "WRAPPER") {
|
|
52531
52586
|
return;
|
|
52532
52587
|
}
|
|
52533
52588
|
onItemEdit({
|
|
@@ -52537,15 +52592,15 @@ const Item = ({
|
|
|
52537
52592
|
isMenuAllowedLevel,
|
|
52538
52593
|
isParentAttachedToMenu,
|
|
52539
52594
|
isSearchActive: false,
|
|
52540
|
-
relatedType
|
|
52541
|
-
related
|
|
52595
|
+
relatedType,
|
|
52596
|
+
related,
|
|
52542
52597
|
additionalFields: item.additionalFields ?? {},
|
|
52543
52598
|
items: item.items ?? [],
|
|
52544
52599
|
autoSync: item.autoSync ?? true,
|
|
52545
52600
|
externalPath: void 0,
|
|
52546
52601
|
viewParentId,
|
|
52547
52602
|
audience: item.audience?.map(({ documentId }) => documentId) ?? []
|
|
52548
|
-
} : {
|
|
52603
|
+
} : item.type === "EXTERNAL" ? {
|
|
52549
52604
|
...item,
|
|
52550
52605
|
type: "EXTERNAL",
|
|
52551
52606
|
isMenuAllowedLevel,
|
|
@@ -52559,6 +52614,17 @@ const Item = ({
|
|
|
52559
52614
|
externalPath: item.externalPath ?? "",
|
|
52560
52615
|
viewParentId,
|
|
52561
52616
|
audience: item.audience?.map(({ documentId }) => documentId) ?? []
|
|
52617
|
+
} : {
|
|
52618
|
+
...item,
|
|
52619
|
+
type: "WRAPPER",
|
|
52620
|
+
isMenuAllowedLevel,
|
|
52621
|
+
isParentAttachedToMenu,
|
|
52622
|
+
isSearchActive: false,
|
|
52623
|
+
additionalFields: item.additionalFields ?? {},
|
|
52624
|
+
items: item.items ?? [],
|
|
52625
|
+
autoSync: item.autoSync ?? true,
|
|
52626
|
+
viewParentId,
|
|
52627
|
+
audience: item.audience?.map(({ documentId }) => documentId) ?? []
|
|
52562
52628
|
},
|
|
52563
52629
|
levelPath,
|
|
52564
52630
|
isParentAttachedToMenu
|
|
@@ -52566,9 +52632,9 @@ const Item = ({
|
|
|
52566
52632
|
},
|
|
52567
52633
|
onItemRestore: () => onItemRestore({ ...item, viewParentId }),
|
|
52568
52634
|
dragRef: refs.dragRef,
|
|
52569
|
-
removed,
|
|
52635
|
+
removed: mappedItem.removed,
|
|
52570
52636
|
canUpdate,
|
|
52571
|
-
isSearchActive
|
|
52637
|
+
isSearchActive: mappedItem.isSearchActive
|
|
52572
52638
|
}
|
|
52573
52639
|
) }),
|
|
52574
52640
|
/* @__PURE__ */ jsxRuntime.jsx(Divider, {}),
|
|
@@ -52585,21 +52651,29 @@ const Item = ({
|
|
|
52585
52651
|
CollapseButton,
|
|
52586
52652
|
{
|
|
52587
52653
|
toggle: () => onItemToggleCollapse({ ...item, viewParentId }),
|
|
52588
|
-
collapsed,
|
|
52654
|
+
collapsed: mappedItem.collapsed,
|
|
52589
52655
|
itemsCount: item.items?.length ?? 0
|
|
52590
52656
|
}
|
|
52591
52657
|
),
|
|
52592
|
-
canUpdate && isNextMenuAllowedLevel && /* @__PURE__ */ jsxRuntime.jsx(
|
|
52593
|
-
|
|
52658
|
+
canUpdate && isNextMenuAllowedLevel && /* @__PURE__ */ jsxRuntime.jsx(
|
|
52659
|
+
TextButton,
|
|
52594
52660
|
{
|
|
52595
|
-
|
|
52596
|
-
|
|
52597
|
-
|
|
52598
|
-
children:
|
|
52661
|
+
disabled: mappedItem.removed,
|
|
52662
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(ForwardRef$1d, {}),
|
|
52663
|
+
onClick: onNewItemClick,
|
|
52664
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
52665
|
+
Typography,
|
|
52666
|
+
{
|
|
52667
|
+
variant: "pi",
|
|
52668
|
+
fontWeight: "bold",
|
|
52669
|
+
textColor: mappedItem.removed ? "neutral600" : "primary600",
|
|
52670
|
+
children: formatMessage(getTrad("components.navigationItem.action.newItem"))
|
|
52671
|
+
}
|
|
52672
|
+
)
|
|
52599
52673
|
}
|
|
52600
|
-
)
|
|
52674
|
+
)
|
|
52601
52675
|
] }),
|
|
52602
|
-
related && !relatedItem.id ? /* @__PURE__ */ jsxRuntime.jsxs(Flex, { justifyContent: "center", alignItems: "center", children: [
|
|
52676
|
+
mappedItem.type === "INTERNAL" && mappedItem.related && !relatedItem.id ? /* @__PURE__ */ jsxRuntime.jsxs(Flex, { justifyContent: "center", alignItems: "center", children: [
|
|
52603
52677
|
/* @__PURE__ */ jsxRuntime.jsxs(Typography, { variant: "omega", textColor: "neutral600", children: [
|
|
52604
52678
|
relatedTypeLabel,
|
|
52605
52679
|
" / "
|
|
@@ -52643,7 +52717,7 @@ const Item = ({
|
|
|
52643
52717
|
]
|
|
52644
52718
|
}
|
|
52645
52719
|
),
|
|
52646
|
-
hasChildren && !removed && !collapsed && /* @__PURE__ */ jsxRuntime.jsx(
|
|
52720
|
+
hasChildren && !mappedItem.removed && !mappedItem.collapsed && /* @__PURE__ */ jsxRuntime.jsx(
|
|
52647
52721
|
List,
|
|
52648
52722
|
{
|
|
52649
52723
|
onItemLevelAdd,
|
|
@@ -52652,13 +52726,13 @@ const Item = ({
|
|
|
52652
52726
|
onItemRestore,
|
|
52653
52727
|
onItemReOrder,
|
|
52654
52728
|
onItemToggleCollapse,
|
|
52655
|
-
isParentAttachedToMenu: menuAttached,
|
|
52729
|
+
isParentAttachedToMenu: mappedItem.menuAttached,
|
|
52656
52730
|
items: item.items ?? [],
|
|
52657
52731
|
level: level + 1,
|
|
52658
52732
|
levelPath: absolutePath,
|
|
52659
52733
|
permissions,
|
|
52660
52734
|
structurePrefix: structureId,
|
|
52661
|
-
viewParentId: viewId,
|
|
52735
|
+
viewParentId: mappedItem.viewId,
|
|
52662
52736
|
locale
|
|
52663
52737
|
}
|
|
52664
52738
|
)
|
|
@@ -52916,9 +52990,20 @@ const navigationExternalItemFormSchema = ({
|
|
|
52916
52990
|
relatedType: z.z.string().optional(),
|
|
52917
52991
|
related: z.z.string().optional()
|
|
52918
52992
|
});
|
|
52993
|
+
const navigationWrapperItemFormSchema = ({
|
|
52994
|
+
isSingleSelected,
|
|
52995
|
+
additionalFields
|
|
52996
|
+
}) => navigationItemCommon({
|
|
52997
|
+
additionalFields,
|
|
52998
|
+
isSingleSelected
|
|
52999
|
+
}).extend({
|
|
53000
|
+
type: z.z.literal("WRAPPER"),
|
|
53001
|
+
path: z.z.string().or(z.z.null()).optional()
|
|
53002
|
+
});
|
|
52919
53003
|
const navigationItemFormSchema = (input) => z.z.discriminatedUnion("type", [
|
|
52920
53004
|
navigationExternalItemFormSchema(input),
|
|
52921
|
-
navigationInternalItemFormSchema(input)
|
|
53005
|
+
navigationInternalItemFormSchema(input),
|
|
53006
|
+
navigationWrapperItemFormSchema(input)
|
|
52922
53007
|
]);
|
|
52923
53008
|
const fallbackDefaultValues = {
|
|
52924
53009
|
autoSync: true,
|
|
@@ -53029,7 +53114,9 @@ const NavigationItemForm = ({
|
|
|
53029
53114
|
const { canUpdate } = permissions;
|
|
53030
53115
|
const [isSingleSelected, setIsSingleSelected] = React.useState(false);
|
|
53031
53116
|
const [itemLocaleCopyValue, setItemLocaleCopyValue] = React.useState();
|
|
53032
|
-
const [formValue, setFormValue] = React.useState(
|
|
53117
|
+
const [formValue, setFormValue] = React.useState(
|
|
53118
|
+
{}
|
|
53119
|
+
);
|
|
53033
53120
|
const [formError, setFormError] = React.useState();
|
|
53034
53121
|
const configQuery = useConfig$1();
|
|
53035
53122
|
const availableAudiences = configQuery.data?.availableAudience ?? [];
|
|
@@ -53053,13 +53140,19 @@ const NavigationItemForm = ({
|
|
|
53053
53140
|
}
|
|
53054
53141
|
};
|
|
53055
53142
|
const setFormValueItem = (path, value) => {
|
|
53056
|
-
setFormValue(
|
|
53057
|
-
|
|
53058
|
-
|
|
53059
|
-
|
|
53060
|
-
|
|
53061
|
-
|
|
53062
|
-
|
|
53143
|
+
setFormValue(
|
|
53144
|
+
lodash$1.set(
|
|
53145
|
+
{
|
|
53146
|
+
...formValue,
|
|
53147
|
+
additionalFields: {
|
|
53148
|
+
...formValue.additionalFields
|
|
53149
|
+
},
|
|
53150
|
+
updated: true
|
|
53151
|
+
},
|
|
53152
|
+
path,
|
|
53153
|
+
value
|
|
53154
|
+
)
|
|
53155
|
+
);
|
|
53063
53156
|
};
|
|
53064
53157
|
const encodePayload = (values) => {
|
|
53065
53158
|
return {
|
|
@@ -53112,19 +53205,25 @@ const NavigationItemForm = ({
|
|
|
53112
53205
|
const submit = async (e, values) => {
|
|
53113
53206
|
e.preventDefault();
|
|
53114
53207
|
const sanitizedValues = encodePayload(values);
|
|
53115
|
-
const {
|
|
53208
|
+
const {
|
|
53209
|
+
success,
|
|
53210
|
+
data: payload,
|
|
53211
|
+
error
|
|
53212
|
+
} = navigationItemFormSchema({
|
|
53116
53213
|
isSingleSelected,
|
|
53117
53214
|
additionalFields: configQuery.data?.additionalFields ?? FALLBACK_ADDITIONAL_FIELDS
|
|
53118
53215
|
}).safeParse(sanitizedValues);
|
|
53119
53216
|
if (success) {
|
|
53120
|
-
const title = !!payload.title.trim() ? payload.title : getDefaultTitle(payload?.related?.toString(), payload.relatedType, isSingleSelected);
|
|
53217
|
+
const title = !!payload.title.trim() ? payload.title.trim() : payload.type === "INTERNAL" ? getDefaultTitle(payload?.related?.toString(), payload.relatedType, isSingleSelected) : "";
|
|
53121
53218
|
setIsLoading(true);
|
|
53122
|
-
const uiRouterKey = await generateUiRouterKey(
|
|
53123
|
-
|
|
53124
|
-
|
|
53125
|
-
|
|
53126
|
-
|
|
53127
|
-
|
|
53219
|
+
const uiRouterKey = await generateUiRouterKey(
|
|
53220
|
+
payload.type === "INTERNAL" ? {
|
|
53221
|
+
slugify: slugifyMutation.mutateAsync,
|
|
53222
|
+
title,
|
|
53223
|
+
related: payload.related,
|
|
53224
|
+
relatedType: payload.relatedType
|
|
53225
|
+
} : { slugify: slugifyMutation.mutateAsync, title }
|
|
53226
|
+
);
|
|
53128
53227
|
slugifyMutation.reset();
|
|
53129
53228
|
setIsLoading(false);
|
|
53130
53229
|
if (!uiRouterKey) {
|
|
@@ -53146,12 +53245,14 @@ const NavigationItemForm = ({
|
|
|
53146
53245
|
}
|
|
53147
53246
|
);
|
|
53148
53247
|
} else if (error) {
|
|
53149
|
-
setFormError(
|
|
53150
|
-
|
|
53151
|
-
|
|
53152
|
-
|
|
53153
|
-
|
|
53154
|
-
|
|
53248
|
+
setFormError(
|
|
53249
|
+
error.issues.reduce((acc, err) => {
|
|
53250
|
+
return {
|
|
53251
|
+
...acc,
|
|
53252
|
+
[err.path.join(".")]: err.message
|
|
53253
|
+
};
|
|
53254
|
+
}, {})
|
|
53255
|
+
);
|
|
53155
53256
|
}
|
|
53156
53257
|
};
|
|
53157
53258
|
const renderError = (error) => {
|
|
@@ -53161,18 +53262,21 @@ const NavigationItemForm = ({
|
|
|
53161
53262
|
}
|
|
53162
53263
|
return void 0;
|
|
53163
53264
|
};
|
|
53164
|
-
const initialRelatedTypeSelected = current.relatedType;
|
|
53265
|
+
const initialRelatedTypeSelected = current.type === "INTERNAL" ? current.relatedType : void 0;
|
|
53165
53266
|
const {
|
|
53166
|
-
relatedType: currentRelatedType,
|
|
53167
|
-
related: currentRelated,
|
|
53168
53267
|
path: currentPath,
|
|
53169
53268
|
type: currentType,
|
|
53170
53269
|
title: currentTitle,
|
|
53171
53270
|
autoSync: autoSyncEnabled
|
|
53172
53271
|
} = formValue;
|
|
53272
|
+
const { relatedType: currentRelatedType, related: currentRelated } = formValue.type === "INTERNAL" ? formValue : {
|
|
53273
|
+
related: void 0,
|
|
53274
|
+
relatedType: void 0
|
|
53275
|
+
};
|
|
53173
53276
|
const isExternal = currentType === "EXTERNAL";
|
|
53277
|
+
const isInternal = currentType === "INTERNAL";
|
|
53174
53278
|
const pathSourceName = isExternal ? "externalPath" : "path";
|
|
53175
|
-
const submitDisabled =
|
|
53279
|
+
const submitDisabled = isInternal && !isSingleSelected && lodash$1.isNil(currentRelated) || isLoading;
|
|
53176
53280
|
const contentTypeItemsQuery = useContentTypeItems({
|
|
53177
53281
|
uid: currentRelatedType ?? "",
|
|
53178
53282
|
locale
|
|
@@ -53216,7 +53320,7 @@ const NavigationItemForm = ({
|
|
|
53216
53320
|
},
|
|
53217
53321
|
[contentTypeItemsQuery.data, configQuery.data, contentTypes]
|
|
53218
53322
|
);
|
|
53219
|
-
const navigationItemTypeOptions = ["INTERNAL", "EXTERNAL"].map((key) => {
|
|
53323
|
+
const navigationItemTypeOptions = ["INTERNAL", "EXTERNAL", "WRAPPER"].map((key) => {
|
|
53220
53324
|
return {
|
|
53221
53325
|
key,
|
|
53222
53326
|
value: key,
|
|
@@ -53267,9 +53371,7 @@ const NavigationItemForm = ({
|
|
|
53267
53371
|
async (event) => {
|
|
53268
53372
|
event.preventDefault();
|
|
53269
53373
|
event.stopPropagation();
|
|
53270
|
-
const source = navigationsQuery.data?.find(
|
|
53271
|
-
({ locale: locale2 }) => locale2 === itemLocaleCopyValue
|
|
53272
|
-
);
|
|
53374
|
+
const source = navigationsQuery.data?.find(({ locale: locale2 }) => locale2 === itemLocaleCopyValue);
|
|
53273
53375
|
if (source) {
|
|
53274
53376
|
setIsLoading(true);
|
|
53275
53377
|
copyItemFromLocaleMutation.mutate(
|
|
@@ -53303,10 +53405,12 @@ const NavigationItemForm = ({
|
|
|
53303
53405
|
[setIsLoading, copyItemFromLocaleMutation, navigationsQuery]
|
|
53304
53406
|
);
|
|
53305
53407
|
React.useEffect(() => {
|
|
53306
|
-
setFormValue(
|
|
53307
|
-
|
|
53308
|
-
|
|
53309
|
-
|
|
53408
|
+
setFormValue(
|
|
53409
|
+
decodePayload({
|
|
53410
|
+
...fallbackDefaultValues,
|
|
53411
|
+
...current
|
|
53412
|
+
})
|
|
53413
|
+
);
|
|
53310
53414
|
}, [current]);
|
|
53311
53415
|
React.useEffect(() => {
|
|
53312
53416
|
if (currentRelatedType) {
|
|
@@ -53365,51 +53469,60 @@ const NavigationItemForm = ({
|
|
|
53365
53469
|
contentTypeItemsQuery.data
|
|
53366
53470
|
]);
|
|
53367
53471
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
53368
|
-
/* @__PURE__ */ jsxRuntime.jsx(Modal.Body, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53369
|
-
|
|
53370
|
-
|
|
53371
|
-
|
|
53372
|
-
|
|
53373
|
-
|
|
53374
|
-
|
|
53375
|
-
|
|
53376
|
-
|
|
53377
|
-
|
|
53378
|
-
|
|
53379
|
-
|
|
53380
|
-
|
|
53381
|
-
|
|
53382
|
-
|
|
53383
|
-
|
|
53384
|
-
|
|
53385
|
-
|
|
53386
|
-
|
|
53387
|
-
|
|
53388
|
-
|
|
53472
|
+
/* @__PURE__ */ jsxRuntime.jsx(Modal.Body, { children: /* @__PURE__ */ jsxRuntime.jsx(admin.Form, { method: "POST", initialValues: formValue, children: ({ values, onChange }) => {
|
|
53473
|
+
const internalValues = values.type === "INTERNAL" ? values : {
|
|
53474
|
+
related: void 0,
|
|
53475
|
+
relatedType: void 0
|
|
53476
|
+
};
|
|
53477
|
+
const pathDefault = generatePreviewPath({
|
|
53478
|
+
currentPath: values.path,
|
|
53479
|
+
isExternal: values.type === "EXTERNAL",
|
|
53480
|
+
current,
|
|
53481
|
+
currentType: values.type,
|
|
53482
|
+
config: configQuery.data,
|
|
53483
|
+
contentTypeItems: contentTypeItemsQuery.data,
|
|
53484
|
+
currentRelated: internalValues.related,
|
|
53485
|
+
currentRelatedType: internalValues.relatedType,
|
|
53486
|
+
isSingleSelected
|
|
53487
|
+
});
|
|
53488
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
53489
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Grid.Root, { gap: 5, children: [
|
|
53490
|
+
/* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53491
|
+
Field,
|
|
53492
|
+
{
|
|
53493
|
+
name: "title",
|
|
53494
|
+
label: formatMessage(getTrad("popup.item.form.title.label", "Title")),
|
|
53495
|
+
error: renderError("title"),
|
|
53496
|
+
hint: formatMessage(
|
|
53497
|
+
getTrad("popup.item.form.title.placeholder", "e.g. Blog")
|
|
53498
|
+
),
|
|
53499
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53500
|
+
TextInput,
|
|
53389
53501
|
{
|
|
53502
|
+
type: "string",
|
|
53503
|
+
disabled: !canUpdate || values.autoSync && values.type === "INTERNAL",
|
|
53390
53504
|
name: "title",
|
|
53391
|
-
|
|
53392
|
-
|
|
53393
|
-
hint: formatMessage(getTrad("popup.item.form.title.placeholder", "e.g. Blog")),
|
|
53394
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53395
|
-
TextInput,
|
|
53396
|
-
{
|
|
53397
|
-
type: "string",
|
|
53398
|
-
disabled: !canUpdate || values.autoSync && values.type === "INTERNAL",
|
|
53399
|
-
name: "title",
|
|
53400
|
-
onChange: (eventOrPath, value) => handleChange(eventOrPath, value, onChange),
|
|
53401
|
-
value: values.title
|
|
53402
|
-
}
|
|
53403
|
-
)
|
|
53505
|
+
onChange: (eventOrPath, value) => handleChange(eventOrPath, value, onChange),
|
|
53506
|
+
value: values.title
|
|
53404
53507
|
}
|
|
53405
|
-
)
|
|
53406
|
-
|
|
53508
|
+
)
|
|
53509
|
+
}
|
|
53510
|
+
) }, "title"),
|
|
53511
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
53512
|
+
Grid.Item,
|
|
53513
|
+
{
|
|
53514
|
+
alignItems: "flex-start",
|
|
53515
|
+
col: values.type === "INTERNAL" ? 4 : 7,
|
|
53516
|
+
lg: 12,
|
|
53517
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53407
53518
|
Field,
|
|
53408
53519
|
{
|
|
53409
53520
|
name: "type",
|
|
53410
53521
|
label: formatMessage(getTrad("popup.item.form.type.label", "Internal link")),
|
|
53411
53522
|
error: renderError("type"),
|
|
53412
|
-
hint: formatMessage(
|
|
53523
|
+
hint: formatMessage(
|
|
53524
|
+
getTrad("popup.item.form.title.placeholder", "e.g. Blog")
|
|
53525
|
+
),
|
|
53413
53526
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53414
53527
|
SingleSelect,
|
|
53415
53528
|
{
|
|
@@ -53422,12 +53535,23 @@ const NavigationItemForm = ({
|
|
|
53422
53535
|
}
|
|
53423
53536
|
)
|
|
53424
53537
|
}
|
|
53425
|
-
)
|
|
53426
|
-
|
|
53538
|
+
)
|
|
53539
|
+
},
|
|
53540
|
+
"type"
|
|
53541
|
+
),
|
|
53542
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
53543
|
+
Grid.Item,
|
|
53544
|
+
{
|
|
53545
|
+
alignItems: "flex-start",
|
|
53546
|
+
col: values.type === "INTERNAL" ? 4 : 5,
|
|
53547
|
+
lg: 12,
|
|
53548
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53427
53549
|
Field,
|
|
53428
53550
|
{
|
|
53429
53551
|
name: "menuAttached",
|
|
53430
|
-
label: formatMessage(
|
|
53552
|
+
label: formatMessage(
|
|
53553
|
+
getTrad("popup.item.form.menuAttached.label", "MenuAttached")
|
|
53554
|
+
),
|
|
53431
53555
|
error: renderError("menuAttached"),
|
|
53432
53556
|
hint: formatMessage(
|
|
53433
53557
|
getTrad(
|
|
@@ -53449,134 +53573,149 @@ const NavigationItemForm = ({
|
|
|
53449
53573
|
}
|
|
53450
53574
|
)
|
|
53451
53575
|
}
|
|
53452
|
-
)
|
|
53453
|
-
|
|
53454
|
-
|
|
53576
|
+
)
|
|
53577
|
+
},
|
|
53578
|
+
"menuAttached"
|
|
53579
|
+
),
|
|
53580
|
+
values.type === "INTERNAL" && /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 4, lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53581
|
+
Field,
|
|
53582
|
+
{
|
|
53583
|
+
name: "autoSync",
|
|
53584
|
+
label: formatMessage(
|
|
53585
|
+
getTrad("popup.item.form.autoSync.label", "Read fields from related")
|
|
53586
|
+
),
|
|
53587
|
+
error: renderError("autoSync"),
|
|
53588
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53589
|
+
Toggle,
|
|
53455
53590
|
{
|
|
53456
53591
|
name: "autoSync",
|
|
53457
|
-
|
|
53458
|
-
|
|
53459
|
-
|
|
53460
|
-
|
|
53461
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53462
|
-
Toggle,
|
|
53463
|
-
{
|
|
53464
|
-
name: "autoSync",
|
|
53465
|
-
checked: values.autoSync,
|
|
53466
|
-
onChange: (eventOrPath) => handleChange(eventOrPath, !values.autoSync, onChange),
|
|
53467
|
-
onLabel: "Enabled",
|
|
53468
|
-
offLabel: "Disabled"
|
|
53469
|
-
}
|
|
53470
|
-
)
|
|
53592
|
+
checked: values.autoSync,
|
|
53593
|
+
onChange: (eventOrPath) => handleChange(eventOrPath, !values.autoSync, onChange),
|
|
53594
|
+
onLabel: "Enabled",
|
|
53595
|
+
offLabel: "Disabled"
|
|
53471
53596
|
}
|
|
53472
|
-
)
|
|
53473
|
-
|
|
53474
|
-
|
|
53597
|
+
)
|
|
53598
|
+
}
|
|
53599
|
+
) }, "autoSync"),
|
|
53600
|
+
/* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53601
|
+
Field,
|
|
53602
|
+
{
|
|
53603
|
+
name: pathSourceName,
|
|
53604
|
+
label: formatMessage(
|
|
53605
|
+
getTrad(`popup.item.form.${pathSourceName}.label`, "Path")
|
|
53606
|
+
),
|
|
53607
|
+
error: renderError(pathSourceName),
|
|
53608
|
+
hint: [
|
|
53609
|
+
formatMessage(
|
|
53610
|
+
getTrad(`popup.item.form.${pathSourceName}.placeholder`, "e.g. Blog")
|
|
53611
|
+
),
|
|
53612
|
+
pathDefault ? formatMessage(getTrad("popup.item.form.type.external.description"), {
|
|
53613
|
+
value: pathDefault
|
|
53614
|
+
}) : ""
|
|
53615
|
+
].join(" "),
|
|
53616
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53617
|
+
TextInput,
|
|
53475
53618
|
{
|
|
53619
|
+
disabled: !canUpdate,
|
|
53476
53620
|
name: pathSourceName,
|
|
53477
|
-
|
|
53478
|
-
|
|
53479
|
-
|
|
53480
|
-
formatMessage(
|
|
53481
|
-
getTrad(`popup.item.form.${pathSourceName}.placeholder`, "e.g. Blog")
|
|
53482
|
-
),
|
|
53483
|
-
pathDefault ? formatMessage(getTrad("popup.item.form.type.external.description"), {
|
|
53484
|
-
value: pathDefault
|
|
53485
|
-
}) : ""
|
|
53486
|
-
].join(" "),
|
|
53487
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53488
|
-
TextInput,
|
|
53489
|
-
{
|
|
53490
|
-
disabled: !canUpdate,
|
|
53491
|
-
name: pathSourceName,
|
|
53492
|
-
onChange: (eventOrPath, value) => handleChange(eventOrPath, value, onChange),
|
|
53493
|
-
value: values[pathSourceName],
|
|
53494
|
-
width: "100%"
|
|
53495
|
-
}
|
|
53496
|
-
)
|
|
53621
|
+
onChange: (eventOrPath, value) => handleChange(eventOrPath, value, onChange),
|
|
53622
|
+
value: values[pathSourceName],
|
|
53623
|
+
width: "100%"
|
|
53497
53624
|
}
|
|
53498
|
-
)
|
|
53499
|
-
|
|
53500
|
-
|
|
53501
|
-
|
|
53625
|
+
)
|
|
53626
|
+
}
|
|
53627
|
+
) }, pathSourceName),
|
|
53628
|
+
values.type === "INTERNAL" && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
53629
|
+
/* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53630
|
+
Field,
|
|
53631
|
+
{
|
|
53632
|
+
name: "relatedType",
|
|
53633
|
+
label: formatMessage(
|
|
53634
|
+
getTrad("popup.item.form.relatedType.label", "Related Type")
|
|
53635
|
+
),
|
|
53636
|
+
error: renderError("relatedType"),
|
|
53637
|
+
hint: !isLoading && lodash$1.isEmpty(relatedTypeSelectOptions) ? formatMessage(
|
|
53638
|
+
getTrad(
|
|
53639
|
+
"popup.item.form.relatedType.empty",
|
|
53640
|
+
"There are no more content types"
|
|
53641
|
+
)
|
|
53642
|
+
) : void 0,
|
|
53643
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53644
|
+
SingleSelect,
|
|
53502
53645
|
{
|
|
53503
53646
|
name: "relatedType",
|
|
53504
|
-
|
|
53505
|
-
|
|
53506
|
-
|
|
53507
|
-
|
|
53508
|
-
|
|
53509
|
-
"There are no more content types"
|
|
53510
|
-
)
|
|
53511
|
-
) : void 0,
|
|
53512
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53513
|
-
SingleSelect,
|
|
53514
|
-
{
|
|
53515
|
-
name: "relatedType",
|
|
53516
|
-
onChange: (eventOrPath) => handleChange("relatedType", eventOrPath, onChange),
|
|
53517
|
-
value: values.relatedType,
|
|
53518
|
-
disabled: !configQuery.data?.contentTypes.length || !canUpdate,
|
|
53519
|
-
width: "100%",
|
|
53520
|
-
children: configQuery.data?.contentTypes.map((contentType2) => /* @__PURE__ */ jsxRuntime.jsx(SingleSelectOption, { value: contentType2.uid, children: contentType2.contentTypeName }, contentType2.uid))
|
|
53521
|
-
}
|
|
53522
|
-
)
|
|
53647
|
+
onChange: (eventOrPath) => handleChange("relatedType", eventOrPath, onChange),
|
|
53648
|
+
value: values.relatedType,
|
|
53649
|
+
disabled: !configQuery.data?.contentTypes.length || !canUpdate,
|
|
53650
|
+
width: "100%",
|
|
53651
|
+
children: configQuery.data?.contentTypes.map((contentType2) => /* @__PURE__ */ jsxRuntime.jsx(SingleSelectOption, { value: contentType2.uid, children: contentType2.contentTypeName }, contentType2.uid))
|
|
53523
53652
|
}
|
|
53524
|
-
)
|
|
53525
|
-
|
|
53526
|
-
|
|
53653
|
+
)
|
|
53654
|
+
}
|
|
53655
|
+
) }),
|
|
53656
|
+
values.relatedType && !isSingleSelected && /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53657
|
+
Field,
|
|
53658
|
+
{
|
|
53659
|
+
name: "related",
|
|
53660
|
+
label: formatMessage(
|
|
53661
|
+
getTrad("popup.item.form.related.label", "Related")
|
|
53662
|
+
),
|
|
53663
|
+
error: renderError("related"),
|
|
53664
|
+
hint: !isLoading && thereAreNoMoreContentTypes ? formatMessage(
|
|
53665
|
+
getTrad(
|
|
53666
|
+
"popup.item.form.related.empty",
|
|
53667
|
+
"There are no more entities"
|
|
53668
|
+
),
|
|
53669
|
+
{ contentTypeName: values.relatedType }
|
|
53670
|
+
) : void 0,
|
|
53671
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53672
|
+
SingleSelect,
|
|
53527
53673
|
{
|
|
53528
53674
|
name: "related",
|
|
53529
|
-
|
|
53530
|
-
|
|
53531
|
-
|
|
53532
|
-
|
|
53533
|
-
|
|
53534
|
-
|
|
53535
|
-
|
|
53536
|
-
|
|
53675
|
+
onChange: (eventOrPath) => handleChange("related", eventOrPath, onChange),
|
|
53676
|
+
value: values.related,
|
|
53677
|
+
options: relatedSelectOptions,
|
|
53678
|
+
disabled: isLoading || thereAreNoMoreContentTypes || !canUpdate,
|
|
53679
|
+
width: "100%",
|
|
53680
|
+
children: relatedSelectOptions.map(({ key, label, value }) => /* @__PURE__ */ jsxRuntime.jsx(SingleSelectOption, { value, children: label }, key))
|
|
53681
|
+
}
|
|
53682
|
+
)
|
|
53683
|
+
}
|
|
53684
|
+
) })
|
|
53685
|
+
] }),
|
|
53686
|
+
!lodash$1.isEmpty(configQuery.data?.additionalFields) && /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { col: 12, lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(Divider, { width: "100%" }) }),
|
|
53687
|
+
configQuery.data?.additionalFields.map(
|
|
53688
|
+
(additionalField, index2) => {
|
|
53689
|
+
if (additionalField === "audience") {
|
|
53690
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53691
|
+
Field,
|
|
53692
|
+
{
|
|
53693
|
+
name: "audience",
|
|
53694
|
+
label: formatMessage(getTrad("popup.item.form.audience.label")),
|
|
53695
|
+
error: renderError("audience"),
|
|
53696
|
+
hint: !isLoading && lodash$1.isEmpty(audienceOptions) ? formatMessage(
|
|
53697
|
+
getTrad("popup.item.form.title.placeholder", "e.g. Blog")
|
|
53537
53698
|
) : void 0,
|
|
53538
53699
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53539
|
-
|
|
53700
|
+
MultiSelect,
|
|
53540
53701
|
{
|
|
53541
|
-
name: "
|
|
53542
|
-
|
|
53543
|
-
|
|
53544
|
-
options: relatedSelectOptions,
|
|
53545
|
-
disabled: isLoading || thereAreNoMoreContentTypes || !canUpdate,
|
|
53702
|
+
name: "audience",
|
|
53703
|
+
value: values.audience,
|
|
53704
|
+
onChange: (eventOrPath) => handleChange("audience", eventOrPath, onChange),
|
|
53546
53705
|
width: "100%",
|
|
53547
|
-
children:
|
|
53706
|
+
children: audienceOptions.map(({ value, label }) => /* @__PURE__ */ jsxRuntime.jsx(MultiSelectOption, { value, children: label }, value))
|
|
53548
53707
|
}
|
|
53549
53708
|
)
|
|
53550
53709
|
}
|
|
53551
|
-
) })
|
|
53552
|
-
|
|
53553
|
-
|
|
53554
|
-
|
|
53555
|
-
|
|
53556
|
-
|
|
53557
|
-
|
|
53558
|
-
|
|
53559
|
-
|
|
53560
|
-
name: "audience",
|
|
53561
|
-
label: formatMessage(getTrad("popup.item.form.audience.label")),
|
|
53562
|
-
error: renderError("audience"),
|
|
53563
|
-
hint: !isLoading && lodash$1.isEmpty(audienceOptions) ? formatMessage(
|
|
53564
|
-
getTrad("popup.item.form.title.placeholder", "e.g. Blog")
|
|
53565
|
-
) : void 0,
|
|
53566
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53567
|
-
MultiSelect,
|
|
53568
|
-
{
|
|
53569
|
-
name: "audience",
|
|
53570
|
-
value: values.audience,
|
|
53571
|
-
onChange: (eventOrPath) => handleChange("audience", eventOrPath, onChange),
|
|
53572
|
-
width: "100%",
|
|
53573
|
-
children: audienceOptions.map(({ value, label }) => /* @__PURE__ */ jsxRuntime.jsx(MultiSelectOption, { value, children: label }, value))
|
|
53574
|
-
}
|
|
53575
|
-
)
|
|
53576
|
-
}
|
|
53577
|
-
) }, "audience");
|
|
53578
|
-
} else {
|
|
53579
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53710
|
+
) }, "audience");
|
|
53711
|
+
} else {
|
|
53712
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
53713
|
+
Grid.Item,
|
|
53714
|
+
{
|
|
53715
|
+
alignItems: "flex-start",
|
|
53716
|
+
col: 6,
|
|
53717
|
+
lg: 12,
|
|
53718
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53580
53719
|
Field,
|
|
53581
53720
|
{
|
|
53582
53721
|
name: `additionalFields.${additionalField.name}`,
|
|
@@ -53595,49 +53734,52 @@ const NavigationItemForm = ({
|
|
|
53595
53734
|
}
|
|
53596
53735
|
)
|
|
53597
53736
|
}
|
|
53598
|
-
) }, additionalField.name);
|
|
53599
|
-
}
|
|
53600
|
-
}
|
|
53601
|
-
)
|
|
53602
|
-
] }),
|
|
53603
|
-
availableLocaleOptions && availableLocaleOptions.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
53604
|
-
/* @__PURE__ */ jsxRuntime.jsx(Divider, { marginTop: 5, marginBottom: 5 }),
|
|
53605
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Grid.Root, { gap: 5, children: [
|
|
53606
|
-
/* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53607
|
-
Field,
|
|
53608
|
-
{
|
|
53609
|
-
name: "i18n.locale",
|
|
53610
|
-
label: formatMessage(getTrad("popup.item.form.i18n.locale.label", "Copy details from")),
|
|
53611
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53612
|
-
SingleSelect,
|
|
53613
|
-
{
|
|
53614
|
-
name: "i18n.locale",
|
|
53615
|
-
onChange: setItemLocaleCopyValue,
|
|
53616
|
-
value: itemLocaleCopyValue,
|
|
53617
|
-
disabled: isLoading || !canUpdate,
|
|
53618
|
-
placeholder: formatMessage(
|
|
53619
|
-
getTrad("popup.item.form.i18n.locale.placeholder", "locale")
|
|
53620
|
-
),
|
|
53621
|
-
children: availableLocaleOptions.map(({ key, label, value }) => /* @__PURE__ */ jsxRuntime.jsx(SingleSelectOption, { value, children: label }, key))
|
|
53622
|
-
}
|
|
53623
53737
|
)
|
|
53624
|
-
}
|
|
53625
|
-
|
|
53626
|
-
|
|
53627
|
-
|
|
53738
|
+
},
|
|
53739
|
+
additionalField.name
|
|
53740
|
+
);
|
|
53741
|
+
}
|
|
53742
|
+
}
|
|
53743
|
+
)
|
|
53744
|
+
] }),
|
|
53745
|
+
availableLocaleOptions && availableLocaleOptions.length > 1 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
53746
|
+
/* @__PURE__ */ jsxRuntime.jsx(Divider, { marginTop: 5, marginBottom: 5 }),
|
|
53747
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Grid.Root, { gap: 5, children: [
|
|
53748
|
+
/* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53749
|
+
Field,
|
|
53750
|
+
{
|
|
53751
|
+
name: "i18n.locale",
|
|
53752
|
+
label: formatMessage(
|
|
53753
|
+
getTrad("popup.item.form.i18n.locale.label", "Copy details from")
|
|
53754
|
+
),
|
|
53755
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53756
|
+
SingleSelect,
|
|
53628
53757
|
{
|
|
53629
|
-
|
|
53630
|
-
|
|
53631
|
-
|
|
53632
|
-
|
|
53758
|
+
name: "i18n.locale",
|
|
53759
|
+
onChange: setItemLocaleCopyValue,
|
|
53760
|
+
value: itemLocaleCopyValue,
|
|
53761
|
+
disabled: isLoading || !canUpdate,
|
|
53762
|
+
placeholder: formatMessage(
|
|
53763
|
+
getTrad("popup.item.form.i18n.locale.placeholder", "locale")
|
|
53764
|
+
),
|
|
53765
|
+
children: availableLocaleOptions.map(({ key, label, value }) => /* @__PURE__ */ jsxRuntime.jsx(SingleSelectOption, { value, children: label }, key))
|
|
53633
53766
|
}
|
|
53634
|
-
)
|
|
53635
|
-
|
|
53636
|
-
|
|
53637
|
-
|
|
53638
|
-
|
|
53639
|
-
|
|
53640
|
-
|
|
53767
|
+
)
|
|
53768
|
+
}
|
|
53769
|
+
) }),
|
|
53770
|
+
canUpdate && /* @__PURE__ */ jsxRuntime.jsx(Grid.Item, { alignItems: "flex-start", col: 6, lg: 12, paddingTop: 6, children: /* @__PURE__ */ jsxRuntime.jsx(Box, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
53771
|
+
Button,
|
|
53772
|
+
{
|
|
53773
|
+
variant: "tertiary",
|
|
53774
|
+
onClick: onCopyFromLocale,
|
|
53775
|
+
disabled: isLoading || !itemLocaleCopyValue,
|
|
53776
|
+
children: formatMessage(getTrad("popup.item.form.i18n.locale.button"))
|
|
53777
|
+
}
|
|
53778
|
+
) }) })
|
|
53779
|
+
] })
|
|
53780
|
+
] })
|
|
53781
|
+
] });
|
|
53782
|
+
} }) }),
|
|
53641
53783
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
53642
53784
|
NavigationItemPopupFooter,
|
|
53643
53785
|
{
|