@strapi/content-type-builder 5.0.0-beta.9 → 5.0.0-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +18 -3
- package/dist/_chunks/{ListView-Cno8sA_Y.mjs → ListView-CYfzT9Ss.mjs} +2 -2
- package/dist/_chunks/{ListView-Cno8sA_Y.mjs.map → ListView-CYfzT9Ss.mjs.map} +1 -1
- package/dist/_chunks/{ListView-ox2gEeAO.js → ListView-DVskSF0B.js} +2 -2
- package/dist/_chunks/{ListView-ox2gEeAO.js.map → ListView-DVskSF0B.js.map} +1 -1
- package/dist/_chunks/{en-BnToboMV.js → en-CXG5y_vo.js} +2 -2
- package/dist/_chunks/{en-BnToboMV.js.map → en-CXG5y_vo.js.map} +1 -1
- package/dist/_chunks/{en-BbczxQBr.mjs → en-jBwb53yg.mjs} +2 -2
- package/dist/_chunks/{en-BbczxQBr.mjs.map → en-jBwb53yg.mjs.map} +1 -1
- package/dist/_chunks/{index-BvIMb5nJ.mjs → index-4pWiYAr9.mjs} +12 -14
- package/dist/_chunks/index-4pWiYAr9.mjs.map +1 -0
- package/dist/_chunks/{index-DT8SxJEc.js → index-DcOZkn-n.js} +342 -319
- package/dist/_chunks/index-DcOZkn-n.js.map +1 -0
- package/dist/_chunks/{index-V_IPu6ZX.mjs → index-KxDs8xjD.mjs} +344 -321
- package/dist/_chunks/index-KxDs8xjD.mjs.map +1 -0
- package/dist/_chunks/{index-CafZdqdd.js → index-vzttgmyT.js} +12 -14
- package/dist/_chunks/index-vzttgmyT.js.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/AttributeOptions/OptionBoxWrapper.d.ts +7 -3
- package/dist/admin/src/components/BoxWrapper.d.ts +7 -3
- package/dist/admin/src/components/ContentTypeBuilderNav/useContentTypeBuilderMenu.d.ts +1 -0
- package/dist/admin/src/components/DataManagerProvider/utils/retrieveComponentsThatHaveComponents.d.ts +11 -3
- package/dist/admin/src/components/DataManagerProvider/utils/retrieveNestedComponents.d.ts +8 -1
- package/dist/admin/src/components/FormModal/utils/getAttributesToDisplay.d.ts +2 -1
- package/dist/admin/src/components/ListRow.d.ts +7 -3
- package/dist/admin/src/components/Relation/RelationNaturePicker/Components.d.ts +12 -4
- package/dist/admin/src/components/SelectCategory.d.ts +2 -1
- package/dist/admin/src/components/SelectComponent.d.ts +2 -1
- package/dist/admin/src/constants.d.ts +1 -0
- package/dist/admin/src/utils/getMaxDepth.d.ts +23 -0
- package/dist/server/index.js +3 -22
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +3 -22
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/controllers/validation/types.d.ts.map +1 -1
- package/dist/server/src/utils/attributes.d.ts +1 -2
- package/dist/server/src/utils/attributes.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/_chunks/index-BvIMb5nJ.mjs.map +0 -1
- package/dist/_chunks/index-CafZdqdd.js.map +0 -1
- package/dist/_chunks/index-DT8SxJEc.js.map +0 -1
- package/dist/_chunks/index-V_IPu6ZX.mjs.map +0 -1
|
@@ -9,7 +9,7 @@ const Icons = require("@strapi/icons");
|
|
|
9
9
|
const reactDom = require("react-dom");
|
|
10
10
|
const styledComponents = require("styled-components");
|
|
11
11
|
const upperFirst = require("lodash/upperFirst");
|
|
12
|
-
const index$1 = require("./index-
|
|
12
|
+
const index$1 = require("./index-vzttgmyT.js");
|
|
13
13
|
const isEqual = require("lodash/isEqual");
|
|
14
14
|
const get = require("lodash/get");
|
|
15
15
|
const groupBy = require("lodash/groupBy");
|
|
@@ -102,7 +102,7 @@ const AutoReloadOverlayBlockerProvider = ({ children }) => {
|
|
|
102
102
|
let displayedIcon = config?.icon || "reload";
|
|
103
103
|
let description = {
|
|
104
104
|
id: config?.description || "components.OverlayBlocker.description",
|
|
105
|
-
defaultMessage: "You're using a feature that needs the server to restart.
|
|
105
|
+
defaultMessage: "You're using a feature that needs the server to restart. The page will reload automatically."
|
|
106
106
|
};
|
|
107
107
|
let title = {
|
|
108
108
|
id: config?.title || "components.OverlayBlocker.title",
|
|
@@ -347,23 +347,28 @@ const useContentTypeBuilderMenu = () => {
|
|
|
347
347
|
].map((section) => {
|
|
348
348
|
const hasChild = section.links.some((l) => Array.isArray(l.links));
|
|
349
349
|
if (hasChild) {
|
|
350
|
+
let filteredLinksCount = 0;
|
|
350
351
|
return {
|
|
351
352
|
...section,
|
|
352
353
|
links: section.links.map((link) => {
|
|
353
|
-
const
|
|
354
|
-
if (
|
|
354
|
+
const filteredLinks2 = link.links.filter((link2) => startsWith(link2.title, search));
|
|
355
|
+
if (filteredLinks2.length === 0) {
|
|
355
356
|
return null;
|
|
356
357
|
}
|
|
358
|
+
filteredLinksCount += filteredLinks2.length;
|
|
357
359
|
return {
|
|
358
360
|
...link,
|
|
359
|
-
links:
|
|
361
|
+
links: filteredLinks2.sort((a, b) => formatter.compare(a.title, b.title))
|
|
360
362
|
};
|
|
361
|
-
}).filter(Boolean)
|
|
363
|
+
}).filter(Boolean),
|
|
364
|
+
linksCount: filteredLinksCount
|
|
362
365
|
};
|
|
363
366
|
}
|
|
367
|
+
const filteredLinks = section.links.filter((link) => startsWith(link.title, search)).sort((a, b) => formatter.compare(a.title, b.title));
|
|
364
368
|
return {
|
|
365
369
|
...section,
|
|
366
|
-
links:
|
|
370
|
+
links: filteredLinks,
|
|
371
|
+
linksCount: filteredLinks.length
|
|
367
372
|
};
|
|
368
373
|
});
|
|
369
374
|
return {
|
|
@@ -375,77 +380,70 @@ const useContentTypeBuilderMenu = () => {
|
|
|
375
380
|
const ContentTypeBuilderNav = () => {
|
|
376
381
|
const { menu, searchValue, onSearchChange } = useContentTypeBuilderMenu();
|
|
377
382
|
const { formatMessage } = reactIntl.useIntl();
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
{
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
children: upperFirst__default.default(
|
|
423
|
-
formatMessage({ id: subLink.name, defaultMessage: subLink.title })
|
|
424
|
-
)
|
|
425
|
-
},
|
|
426
|
-
subLink.name
|
|
427
|
-
)) }, link.name);
|
|
428
|
-
}
|
|
429
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.SubNavLink, { tag: reactRouterDom.NavLink, to: link.to, active: link.active, children: upperFirst__default.default(formatMessage({ id: link.name, defaultMessage: link.title })) }, link.name);
|
|
430
|
-
})
|
|
431
|
-
}
|
|
432
|
-
),
|
|
433
|
-
section.customLink && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingLeft: 7, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
434
|
-
designSystem.TextButton,
|
|
435
|
-
{
|
|
436
|
-
onClick: section.customLink.onClick,
|
|
437
|
-
startIcon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Plus, { width: "0.8rem", height: "0.8rem" }),
|
|
438
|
-
marginTop: 2,
|
|
439
|
-
children: formatMessage({
|
|
440
|
-
id: section.customLink.id,
|
|
441
|
-
defaultMessage: section.customLink.defaultMessage
|
|
442
|
-
})
|
|
383
|
+
const pluginName = formatMessage({
|
|
384
|
+
id: getTrad("plugin.name"),
|
|
385
|
+
defaultMessage: "Content-Type Builder"
|
|
386
|
+
});
|
|
387
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.SubNav, { "aria-label": pluginName, children: [
|
|
388
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
389
|
+
designSystem.SubNavHeader,
|
|
390
|
+
{
|
|
391
|
+
searchable: true,
|
|
392
|
+
value: searchValue,
|
|
393
|
+
onClear: () => onSearchChange(""),
|
|
394
|
+
onChange: (e) => onSearchChange(e.target.value),
|
|
395
|
+
label: pluginName,
|
|
396
|
+
searchLabel: formatMessage({
|
|
397
|
+
id: "global.search",
|
|
398
|
+
defaultMessage: "Search"
|
|
399
|
+
})
|
|
400
|
+
}
|
|
401
|
+
),
|
|
402
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SubNavSections, { children: menu.map((section) => /* @__PURE__ */ jsxRuntime.jsxs(React.Fragment, { children: [
|
|
403
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
404
|
+
designSystem.SubNavSection,
|
|
405
|
+
{
|
|
406
|
+
label: formatMessage({
|
|
407
|
+
id: section.title.id,
|
|
408
|
+
defaultMessage: section.title.defaultMessage
|
|
409
|
+
}),
|
|
410
|
+
collapsable: true,
|
|
411
|
+
badgeLabel: section.linksCount.toString(),
|
|
412
|
+
children: section.links.map((link) => {
|
|
413
|
+
if (link.links) {
|
|
414
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.SubNavLinkSection, { label: upperFirst__default.default(link.title), children: link.links.map((subLink) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
415
|
+
designSystem.SubNavLink,
|
|
416
|
+
{
|
|
417
|
+
tag: reactRouterDom.NavLink,
|
|
418
|
+
to: subLink.to,
|
|
419
|
+
active: subLink.active,
|
|
420
|
+
isSubSectionChild: true,
|
|
421
|
+
children: upperFirst__default.default(
|
|
422
|
+
formatMessage({ id: subLink.name, defaultMessage: subLink.title })
|
|
423
|
+
)
|
|
424
|
+
},
|
|
425
|
+
subLink.name
|
|
426
|
+
)) }, link.name);
|
|
443
427
|
}
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
428
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.SubNavLink, { tag: reactRouterDom.NavLink, to: link.to, active: link.active, children: upperFirst__default.default(formatMessage({ id: link.name, defaultMessage: link.title })) }, link.name);
|
|
429
|
+
})
|
|
430
|
+
}
|
|
431
|
+
),
|
|
432
|
+
section.customLink && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingLeft: 7, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
433
|
+
designSystem.TextButton,
|
|
434
|
+
{
|
|
435
|
+
onClick: section.customLink.onClick,
|
|
436
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(Icons.Plus, { width: "0.8rem", height: "0.8rem" }),
|
|
437
|
+
marginTop: 2,
|
|
438
|
+
cursor: "pointer",
|
|
439
|
+
children: formatMessage({
|
|
440
|
+
id: section.customLink.id,
|
|
441
|
+
defaultMessage: section.customLink.defaultMessage
|
|
442
|
+
})
|
|
443
|
+
}
|
|
444
|
+
) })
|
|
445
|
+
] }, section.name)) })
|
|
446
|
+
] });
|
|
449
447
|
};
|
|
450
448
|
const isAllowedContentTypesForRelations = (contentType) => {
|
|
451
449
|
return contentType.kind === "collectionType" && (contentType.restrictRelationsTo === null || Array.isArray(contentType.restrictRelationsTo) && contentType.restrictRelationsTo.length > 0);
|
|
@@ -569,6 +567,7 @@ const OptionBoxWrapper = styledComponents.styled(designSystem.Box)`
|
|
|
569
567
|
border: 1px solid ${({ theme }) => theme.colors.neutral200};
|
|
570
568
|
text-align: left;
|
|
571
569
|
&:hover {
|
|
570
|
+
cursor: pointer;
|
|
572
571
|
background: ${({ theme }) => theme.colors.primary100};
|
|
573
572
|
border: 1px solid ${({ theme }) => theme.colors.primary200};
|
|
574
573
|
}
|
|
@@ -592,7 +591,7 @@ const AttributeOption = ({ type = "text" }) => {
|
|
|
592
591
|
/* @__PURE__ */ jsxRuntime.jsx(AttributeIcon, { type }),
|
|
593
592
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { paddingLeft: 4, width: "100%", children: [
|
|
594
593
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", children: [
|
|
595
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: formatMessage({ id: getTrad(`attribute.${type}`), defaultMessage: type }) }),
|
|
594
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", textColor: "neutral800", children: formatMessage({ id: getTrad(`attribute.${type}`), defaultMessage: type }) }),
|
|
596
595
|
newAttributes.includes(type) && /* @__PURE__ */ jsxRuntime.jsx(NewBadge, {})
|
|
597
596
|
] }),
|
|
598
597
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: formatMessage({
|
|
@@ -605,7 +604,7 @@ const AttributeOption = ({ type = "text" }) => {
|
|
|
605
604
|
const AttributeList = ({ attributes }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.KeyboardNavigable, { tagName: "button", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 8, children: attributes.map((attributeRow, index2) => {
|
|
606
605
|
return (
|
|
607
606
|
// eslint-disable-next-line react/no-array-index-key
|
|
608
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 3, children: attributeRow.map((attribute) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
607
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 3, children: attributeRow.map((attribute) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(AttributeOption, { type: attribute }) }, attribute)) }, index2)
|
|
609
608
|
);
|
|
610
609
|
}) }) });
|
|
611
610
|
const CustomFieldOption = ({ customFieldUid, customField }) => {
|
|
@@ -686,7 +685,7 @@ const CustomFieldsList = () => {
|
|
|
686
685
|
(a, b) => a[1].name > b[1].name ? 1 : -1
|
|
687
686
|
);
|
|
688
687
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.KeyboardNavigable, { tagName: "button", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 3, children: [
|
|
689
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 3, children: sortedCustomFields.map(([uid, customField]) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
688
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 3, children: sortedCustomFields.map(([uid, customField]) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 6, children: /* @__PURE__ */ jsxRuntime.jsx(CustomFieldOption, { customFieldUid: uid, customField }, uid) }, uid)) }),
|
|
690
689
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
691
690
|
designSystem.Link,
|
|
692
691
|
{
|
|
@@ -706,31 +705,18 @@ const AttributeOptions = ({ attributes, forTarget, kind }) => {
|
|
|
706
705
|
const customTabId = getTrad("modalForm.tabs.custom");
|
|
707
706
|
const titleIdSuffix = forTarget.includes("component") ? "component" : kind;
|
|
708
707
|
const titleId = getTrad(`modalForm.sub-header.chooseAttribute.${titleIdSuffix}`);
|
|
709
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
710
|
-
designSystem.
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
})
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs, { children: [
|
|
722
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tab, { children: formatMessage({ id: defaultTabId, defaultMessage: "Default" }) }),
|
|
723
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tab, { children: formatMessage({ id: customTabId, defaultMessage: "Custom" }) })
|
|
724
|
-
] })
|
|
725
|
-
] }),
|
|
726
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 6, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, {}) }),
|
|
727
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.TabPanels, { children: [
|
|
728
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.TabPanel, { children: /* @__PURE__ */ jsxRuntime.jsx(AttributeList, { attributes }) }),
|
|
729
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.TabPanel, { children: /* @__PURE__ */ jsxRuntime.jsx(CustomFieldsList, {}) })
|
|
730
|
-
] })
|
|
731
|
-
]
|
|
732
|
-
}
|
|
733
|
-
) });
|
|
708
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Body, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs.Root, { variant: "simple", defaultValue: "default", children: [
|
|
709
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", children: [
|
|
710
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", tag: "h2", children: formatMessage({ id: titleId, defaultMessage: "Select a field" }) }),
|
|
711
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs.List, { children: [
|
|
712
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "default", children: formatMessage({ id: defaultTabId, defaultMessage: "Default" }) }),
|
|
713
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "custom", children: formatMessage({ id: customTabId, defaultMessage: "Custom" }) })
|
|
714
|
+
] })
|
|
715
|
+
] }),
|
|
716
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, { marginBottom: 6 }),
|
|
717
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "default", children: /* @__PURE__ */ jsxRuntime.jsx(AttributeList, { attributes }) }),
|
|
718
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "custom", children: /* @__PURE__ */ jsxRuntime.jsx(CustomFieldsList, {}) })
|
|
719
|
+
] }) });
|
|
734
720
|
};
|
|
735
721
|
const BooleanDefaultValueSelect = ({
|
|
736
722
|
intlLabel,
|
|
@@ -886,7 +872,6 @@ const CheckboxWithNumberField = ({
|
|
|
886
872
|
value = null
|
|
887
873
|
}) => {
|
|
888
874
|
const { formatMessage } = reactIntl.useIntl();
|
|
889
|
-
const [showInput, setShowInput] = React.useState(!!value || value === 0);
|
|
890
875
|
const label = intlLabel.id ? formatMessage(
|
|
891
876
|
{ id: intlLabel.id, defaultMessage: intlLabel.defaultMessage },
|
|
892
877
|
{ ...intlLabel.values }
|
|
@@ -900,17 +885,16 @@ const CheckboxWithNumberField = ({
|
|
|
900
885
|
{
|
|
901
886
|
id: name,
|
|
902
887
|
name,
|
|
903
|
-
|
|
888
|
+
onCheckedChange: (value2) => {
|
|
904
889
|
const initValue = type === "text" ? "0" : 0;
|
|
905
890
|
const nextValue = value2 ? initValue : null;
|
|
906
891
|
onChange({ target: { name, value: nextValue } });
|
|
907
|
-
setShowInput((prev) => !prev);
|
|
908
892
|
},
|
|
909
|
-
|
|
893
|
+
checked: value !== null,
|
|
910
894
|
children: label
|
|
911
895
|
}
|
|
912
896
|
),
|
|
913
|
-
|
|
897
|
+
value !== null && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingLeft: 6, style: { maxWidth: "200px" }, children: type === "text" ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { error: errorMessage, name, children: [
|
|
914
898
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
915
899
|
designSystem.TextInput,
|
|
916
900
|
{
|
|
@@ -928,7 +912,7 @@ const CheckboxWithNumberField = ({
|
|
|
928
912
|
"aria-label": label,
|
|
929
913
|
disabled,
|
|
930
914
|
onValueChange: (value2) => {
|
|
931
|
-
onChange({ target: { name, value: value2, type } });
|
|
915
|
+
onChange({ target: { name, value: value2 ?? 0, type } });
|
|
932
916
|
},
|
|
933
917
|
value: value || 0
|
|
934
918
|
}
|
|
@@ -971,27 +955,26 @@ const DraftAndPublishToggle = ({
|
|
|
971
955
|
{ id: description.id, defaultMessage: description.defaultMessage },
|
|
972
956
|
{ ...description.values }
|
|
973
957
|
) : "";
|
|
974
|
-
const handleToggle = () => setShowWarning((prev) => !prev);
|
|
975
958
|
const handleConfirm = () => {
|
|
976
959
|
onChange({ target: { name, value: false } });
|
|
977
|
-
|
|
960
|
+
setShowWarning(false);
|
|
978
961
|
};
|
|
979
|
-
const handleChange = (
|
|
962
|
+
const handleChange = (checked) => {
|
|
980
963
|
if (!checked && !isCreating) {
|
|
981
|
-
|
|
964
|
+
setShowWarning(true);
|
|
982
965
|
return;
|
|
983
966
|
}
|
|
984
|
-
onChange({ target: { name, value: checked } });
|
|
967
|
+
onChange({ target: { name, value: !!checked } });
|
|
985
968
|
};
|
|
986
969
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
987
970
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { hint, name, children: [
|
|
988
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Checkbox, { checked: value, disabled,
|
|
971
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Checkbox, { checked: value, disabled, onCheckedChange: handleChange, children: label }),
|
|
989
972
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
|
|
990
973
|
] }),
|
|
991
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
974
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: showWarning, onOpenChange: (isOpen) => setShowWarning(isOpen), children: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.ConfirmDialog, { onConfirm: handleConfirm, children: formatMessage({
|
|
992
975
|
id: getTrad("popUpWarning.draft-publish.message"),
|
|
993
976
|
defaultMessage: "If you disable the draft & publish, your drafts will be deleted."
|
|
994
|
-
}) })
|
|
977
|
+
}) }) })
|
|
995
978
|
] });
|
|
996
979
|
};
|
|
997
980
|
const FormModalEndActions = ({
|
|
@@ -1121,7 +1104,7 @@ const FormModalEndActions = ({
|
|
|
1121
1104
|
}
|
|
1122
1105
|
);
|
|
1123
1106
|
}
|
|
1124
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1107
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
1125
1108
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1126
1109
|
designSystem.Button,
|
|
1127
1110
|
{
|
|
@@ -1160,7 +1143,7 @@ const FormModalEndActions = ({
|
|
|
1160
1143
|
] });
|
|
1161
1144
|
}
|
|
1162
1145
|
if (isAttributeModal && !isComponentAttribute && !isDzAttribute) {
|
|
1163
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1146
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
1164
1147
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1165
1148
|
designSystem.Button,
|
|
1166
1149
|
{
|
|
@@ -1196,7 +1179,7 @@ const FormModalEndActions = ({
|
|
|
1196
1179
|
] });
|
|
1197
1180
|
}
|
|
1198
1181
|
if (isContentTypeModal) {
|
|
1199
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1182
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
1200
1183
|
!isCreatingContentType && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1201
1184
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1202
1185
|
designSystem.Button,
|
|
@@ -1247,7 +1230,7 @@ const FormModalEndActions = ({
|
|
|
1247
1230
|
] });
|
|
1248
1231
|
}
|
|
1249
1232
|
if (isComponentModal) {
|
|
1250
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1233
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
1251
1234
|
!isCreatingComponent && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
1252
1235
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1253
1236
|
designSystem.Button,
|
|
@@ -1298,7 +1281,7 @@ const FormModalEndActions = ({
|
|
|
1298
1281
|
] });
|
|
1299
1282
|
}
|
|
1300
1283
|
if (isEditingCategory) {
|
|
1301
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1284
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
1302
1285
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1303
1286
|
designSystem.Button,
|
|
1304
1287
|
{
|
|
@@ -1334,7 +1317,7 @@ const FormModalEndActions = ({
|
|
|
1334
1317
|
] });
|
|
1335
1318
|
}
|
|
1336
1319
|
if (isCustomFieldModal) {
|
|
1337
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
1320
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
|
|
1338
1321
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1339
1322
|
designSystem.Button,
|
|
1340
1323
|
{
|
|
@@ -1406,9 +1389,9 @@ const FormModalHeader = ({
|
|
|
1406
1389
|
if (actionType === "edit") {
|
|
1407
1390
|
headerId = getTrad(`modalForm.header-edit`);
|
|
1408
1391
|
}
|
|
1409
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
1392
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Header, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { children: [
|
|
1410
1393
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(AttributeIcon, { type: icon }) }),
|
|
1411
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingLeft: 3, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
1394
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingLeft: 3, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Title, { children: formatMessage({ id: headerId }, { name: displayName }) }) })
|
|
1412
1395
|
] }) });
|
|
1413
1396
|
}
|
|
1414
1397
|
headers = [
|
|
@@ -1435,7 +1418,7 @@ const FormModalHeader = ({
|
|
|
1435
1418
|
});
|
|
1436
1419
|
headers = [{ label }, { label: categoryName }];
|
|
1437
1420
|
}
|
|
1438
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
1421
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Header, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 3, children: [
|
|
1439
1422
|
showBackLink && // This is a workaround and should use the LinkButton with a variant that currently doesn't exist
|
|
1440
1423
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1441
1424
|
designSystem.Link,
|
|
@@ -1502,7 +1485,7 @@ const FormModalSubHeader = ({
|
|
|
1502
1485
|
}) => {
|
|
1503
1486
|
const { formatMessage } = reactIntl.useIntl();
|
|
1504
1487
|
const intlLabel = modalType === "customField" ? customField?.intlLabel : { id: getTrad(`attribute.${attributeType}`) };
|
|
1505
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", paddingBottom:
|
|
1488
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", paddingBottom: 1, gap: 1, children: [
|
|
1506
1489
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "h2", variant: "beta", children: formatMessage(
|
|
1507
1490
|
{
|
|
1508
1491
|
id: getModalTitleSubHeader({
|
|
@@ -1662,18 +1645,20 @@ const IconPickerWrapper = styledComponents.styled(designSystem.Flex)`
|
|
|
1662
1645
|
`;
|
|
1663
1646
|
const IconPick = ({ iconKey, name, onChange, isSelected, ariaLabel }) => {
|
|
1664
1647
|
const Icon = COMPONENT_ICONS[iconKey];
|
|
1665
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
1666
|
-
/* @__PURE__ */ jsxRuntime.
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1648
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { name, required: false, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Label, { children: [
|
|
1649
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.VisuallyHidden, { children: [
|
|
1650
|
+
ariaLabel,
|
|
1651
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1652
|
+
designSystem.Field.Input,
|
|
1653
|
+
{
|
|
1654
|
+
type: "radio",
|
|
1655
|
+
checked: isSelected,
|
|
1656
|
+
onChange,
|
|
1657
|
+
value: iconKey,
|
|
1658
|
+
"aria-checked": isSelected
|
|
1659
|
+
}
|
|
1660
|
+
)
|
|
1661
|
+
] }),
|
|
1677
1662
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1678
1663
|
designSystem.Flex,
|
|
1679
1664
|
{
|
|
@@ -1684,7 +1669,7 @@ const IconPick = ({ iconKey, name, onChange, isSelected, ariaLabel }) => {
|
|
|
1684
1669
|
children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { fill: isSelected ? "primary600" : "neutral300" })
|
|
1685
1670
|
}
|
|
1686
1671
|
)
|
|
1687
|
-
] });
|
|
1672
|
+
] }) });
|
|
1688
1673
|
};
|
|
1689
1674
|
const IconPicker = ({ intlLabel, name, onChange, value = "" }) => {
|
|
1690
1675
|
const { formatMessage } = reactIntl.useIntl();
|
|
@@ -1997,10 +1982,10 @@ const GenericInput = ({
|
|
|
1997
1982
|
designSystem.Checkbox,
|
|
1998
1983
|
{
|
|
1999
1984
|
disabled,
|
|
2000
|
-
|
|
1985
|
+
onCheckedChange: (value2) => {
|
|
2001
1986
|
onChange({ target: { name, value: value2 } });
|
|
2002
1987
|
},
|
|
2003
|
-
|
|
1988
|
+
checked: Boolean(value),
|
|
2004
1989
|
children: label
|
|
2005
1990
|
}
|
|
2006
1991
|
);
|
|
@@ -2176,7 +2161,7 @@ const GenericInput = ({
|
|
|
2176
2161
|
}
|
|
2177
2162
|
};
|
|
2178
2163
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { error: errorMessage, name, hint, required, children: [
|
|
2179
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { action: labelAction, children: label }),
|
|
2164
|
+
type !== "checkbox" ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { action: labelAction, children: label }) : null,
|
|
2180
2165
|
getComponent(),
|
|
2181
2166
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {}),
|
|
2182
2167
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
|
|
@@ -2294,7 +2279,7 @@ const RelationTargetPicker = ({
|
|
|
2294
2279
|
};
|
|
2295
2280
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Root, { children: [
|
|
2296
2281
|
/* @__PURE__ */ jsxRuntime.jsx(MenuTrigger, { children: `${displayName} ${plugin ? `(from: ${plugin})` : ""}` }),
|
|
2297
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Menu.Content, { zIndex:
|
|
2282
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Menu.Content, { zIndex: "popover", children: allowedContentTypesForRelation.map(({ uid, title, restrictRelationsTo, plugin: plugin2 }) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Menu.Item, { onSelect: handleSelect({ uid, plugin: plugin2, title, restrictRelationsTo }), children: [
|
|
2298
2283
|
title,
|
|
2299
2284
|
" ",
|
|
2300
2285
|
plugin2 && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
@@ -2367,9 +2352,11 @@ const IconWrapper = styledComponents.styled(designSystem.Box)`
|
|
|
2367
2352
|
${({ theme, $isSelected }) => theme.colors[$isSelected ? "primary700" : "neutral200"]};
|
|
2368
2353
|
border-radius: ${({ theme }) => theme.borderRadius};
|
|
2369
2354
|
z-index: 1;
|
|
2355
|
+
flex: 0 0 2.4rem;
|
|
2370
2356
|
svg {
|
|
2371
2357
|
width: 2.4rem;
|
|
2372
|
-
height:
|
|
2358
|
+
height: 2.4rem;
|
|
2359
|
+
max-width: unset;
|
|
2373
2360
|
path {
|
|
2374
2361
|
fill: ${({ theme, $isSelected }) => theme.colors[$isSelected ? "primary700" : "neutral500"]};
|
|
2375
2362
|
}
|
|
@@ -2508,7 +2495,8 @@ const SelectCategory = ({
|
|
|
2508
2495
|
intlLabel,
|
|
2509
2496
|
name,
|
|
2510
2497
|
onChange,
|
|
2511
|
-
value = void 0
|
|
2498
|
+
value = void 0,
|
|
2499
|
+
isCreating
|
|
2512
2500
|
}) => {
|
|
2513
2501
|
const { formatMessage } = reactIntl.useIntl();
|
|
2514
2502
|
const { allComponentsCategories } = useDataManager();
|
|
@@ -2524,10 +2512,59 @@ const SelectCategory = ({
|
|
|
2524
2512
|
};
|
|
2525
2513
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { error: errorMessage, name, children: [
|
|
2526
2514
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: label }),
|
|
2527
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2515
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2516
|
+
designSystem.Combobox,
|
|
2517
|
+
{
|
|
2518
|
+
disabled: !isCreating,
|
|
2519
|
+
onChange: handleChange,
|
|
2520
|
+
onCreateOption: handleCreateOption,
|
|
2521
|
+
value,
|
|
2522
|
+
creatable: true,
|
|
2523
|
+
children: categories.map((category) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.ComboboxOption, { value: category, children: category }, category))
|
|
2524
|
+
}
|
|
2525
|
+
),
|
|
2528
2526
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
|
|
2529
2527
|
] });
|
|
2530
2528
|
};
|
|
2529
|
+
const findComponent = (componentUid, components) => {
|
|
2530
|
+
return components.find((c) => c.component === componentUid);
|
|
2531
|
+
};
|
|
2532
|
+
const getChildrenMaxDepth = (componentUid, components, currentDepth = 0) => {
|
|
2533
|
+
const component = findComponent(componentUid, components);
|
|
2534
|
+
if (!component || !component.childComponents || component.childComponents.length === 0) {
|
|
2535
|
+
return currentDepth;
|
|
2536
|
+
}
|
|
2537
|
+
let maxDepth = currentDepth;
|
|
2538
|
+
component.childComponents.forEach((child) => {
|
|
2539
|
+
const depth = getChildrenMaxDepth(child.component, components, currentDepth + 1);
|
|
2540
|
+
if (depth > maxDepth) {
|
|
2541
|
+
maxDepth = depth;
|
|
2542
|
+
}
|
|
2543
|
+
});
|
|
2544
|
+
return maxDepth;
|
|
2545
|
+
};
|
|
2546
|
+
const getComponentDepth = (component, components) => {
|
|
2547
|
+
const getDepth = (currentComponent, currentLevel) => {
|
|
2548
|
+
const levels = [];
|
|
2549
|
+
levels.push(currentLevel);
|
|
2550
|
+
if (!currentComponent.uidsOfAllParents) {
|
|
2551
|
+
return levels;
|
|
2552
|
+
}
|
|
2553
|
+
for (const parentUid of currentComponent.uidsOfAllParents) {
|
|
2554
|
+
const parentComponent = findComponent(parentUid, components);
|
|
2555
|
+
if (parentComponent) {
|
|
2556
|
+
levels.push(...getDepth(parentComponent, currentLevel + 1));
|
|
2557
|
+
}
|
|
2558
|
+
}
|
|
2559
|
+
return levels;
|
|
2560
|
+
};
|
|
2561
|
+
const nestedCompo = findComponent(component, components);
|
|
2562
|
+
if (!nestedCompo) {
|
|
2563
|
+
return 0;
|
|
2564
|
+
}
|
|
2565
|
+
const compoDepth = Math.max(...getDepth(nestedCompo, 1));
|
|
2566
|
+
return compoDepth;
|
|
2567
|
+
};
|
|
2531
2568
|
const SelectComponent = ({
|
|
2532
2569
|
error = null,
|
|
2533
2570
|
intlLabel,
|
|
@@ -2544,7 +2581,11 @@ const SelectComponent = ({
|
|
|
2544
2581
|
const { formatMessage } = reactIntl.useIntl();
|
|
2545
2582
|
const errorMessage = error ? formatMessage({ id: error, defaultMessage: error }) : "";
|
|
2546
2583
|
const label = formatMessage(intlLabel);
|
|
2547
|
-
const {
|
|
2584
|
+
const {
|
|
2585
|
+
componentsGroupedByCategory,
|
|
2586
|
+
componentsThatHaveOtherComponentInTheirAttributes,
|
|
2587
|
+
nestedComponents
|
|
2588
|
+
} = useDataManager();
|
|
2548
2589
|
const isTargetAComponent = ["component", "components"].includes(forTarget);
|
|
2549
2590
|
let options2 = Object.entries(componentsGroupedByCategory).reduce(
|
|
2550
2591
|
(acc, current) => {
|
|
@@ -2561,8 +2602,11 @@ const SelectComponent = ({
|
|
|
2561
2602
|
[]
|
|
2562
2603
|
);
|
|
2563
2604
|
if (isAddingAComponentToAnotherComponent) {
|
|
2564
|
-
options2 = options2.filter((
|
|
2565
|
-
|
|
2605
|
+
options2 = options2.filter(({ uid }) => {
|
|
2606
|
+
const maxDepth = getChildrenMaxDepth(uid, componentsThatHaveOtherComponentInTheirAttributes);
|
|
2607
|
+
const componentDepth = getComponentDepth(targetUid, nestedComponents);
|
|
2608
|
+
const totalDepth = maxDepth + componentDepth;
|
|
2609
|
+
return totalDepth <= index$1.MAX_COMPONENT_DEPTH;
|
|
2566
2610
|
});
|
|
2567
2611
|
}
|
|
2568
2612
|
if (isTargetAComponent) {
|
|
@@ -2787,7 +2831,7 @@ const TabForm = ({
|
|
|
2787
2831
|
}
|
|
2788
2832
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
2789
2833
|
section.sectionTitle && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", tag: "h3", children: formatMessage(section.sectionTitle) }) }),
|
|
2790
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid, { gap: 4, children: section.items.map((input, i) => {
|
|
2834
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { gap: 4, children: section.items.map((input, i) => {
|
|
2791
2835
|
const key = `${sectionIndex}.${i}`;
|
|
2792
2836
|
const value = get__default.default(modifiedData, input.name, void 0);
|
|
2793
2837
|
const pluginOptionError = Object.keys(formErrors).find((key2) => key2 === input.name);
|
|
@@ -2800,9 +2844,9 @@ const TabForm = ({
|
|
|
2800
2844
|
null
|
|
2801
2845
|
);
|
|
2802
2846
|
if (input.type === "pushRight") {
|
|
2803
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
2847
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: input.size || 6, children: /* @__PURE__ */ jsxRuntime.jsx("div", {}) }, input.name || key);
|
|
2804
2848
|
}
|
|
2805
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
2849
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: input.size || 6, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2806
2850
|
MemoizedGenericInput,
|
|
2807
2851
|
{
|
|
2808
2852
|
...input,
|
|
@@ -3890,8 +3934,6 @@ const alreadyUsedAttributeNames = (usedNames) => {
|
|
|
3890
3934
|
}
|
|
3891
3935
|
const snakeCaseKey = fp.snakeCase(value);
|
|
3892
3936
|
return !usedNames.some((existingKey) => {
|
|
3893
|
-
if (existingKey === value)
|
|
3894
|
-
return false;
|
|
3895
3937
|
return fp.snakeCase(existingKey) === snakeCaseKey;
|
|
3896
3938
|
});
|
|
3897
3939
|
}
|
|
@@ -3922,7 +3964,7 @@ const validators = {
|
|
|
3922
3964
|
return schema;
|
|
3923
3965
|
}).nullable(),
|
|
3924
3966
|
maxLength: () => yup__namespace.number().integer().positive(getTrad("error.validation.positive")).nullable(),
|
|
3925
|
-
minLength: () => yup__namespace.number().integer().min(
|
|
3967
|
+
minLength: () => yup__namespace.number().integer().min(1).when("maxLength", (maxLength, schema) => {
|
|
3926
3968
|
if (maxLength) {
|
|
3927
3969
|
return schema.max(maxLength, getTrad("error.validation.minSupMax"));
|
|
3928
3970
|
}
|
|
@@ -3948,7 +3990,11 @@ const createTextShape = (usedAttributeNames, reservedNames) => {
|
|
|
3948
3990
|
name: "isValidRegExpPattern",
|
|
3949
3991
|
message: getTrad("error.validation.regex"),
|
|
3950
3992
|
test(value) {
|
|
3951
|
-
|
|
3993
|
+
try {
|
|
3994
|
+
return new RegExp(value || "") !== null;
|
|
3995
|
+
} catch (e) {
|
|
3996
|
+
return false;
|
|
3997
|
+
}
|
|
3952
3998
|
}
|
|
3953
3999
|
}).nullable()
|
|
3954
4000
|
};
|
|
@@ -4770,42 +4816,7 @@ const forms = {
|
|
|
4770
4816
|
form: {
|
|
4771
4817
|
advanced({ data, type, step, extensions, ...rest }) {
|
|
4772
4818
|
try {
|
|
4773
|
-
const
|
|
4774
|
-
let baseForm2;
|
|
4775
|
-
if (isComponentTarget) {
|
|
4776
|
-
const isUniqueEnabled = data?.unique ?? false;
|
|
4777
|
-
baseForm2 = attributesForm.advanced[type](data, step).sections.map((section) => {
|
|
4778
|
-
const filteredItems = section.items.map((item) => {
|
|
4779
|
-
if (item.name !== "unique") {
|
|
4780
|
-
return item;
|
|
4781
|
-
}
|
|
4782
|
-
if (isUniqueEnabled) {
|
|
4783
|
-
return {
|
|
4784
|
-
...item,
|
|
4785
|
-
description: {
|
|
4786
|
-
id: "content-type-builder.form.attribute.item.uniqueField.v5.willBeDisabled",
|
|
4787
|
-
defaultMessage: "Currently unique fields don't work correctly in components. If you disable this feature, the field will be disabled until this is fixed."
|
|
4788
|
-
}
|
|
4789
|
-
};
|
|
4790
|
-
}
|
|
4791
|
-
return {
|
|
4792
|
-
...item,
|
|
4793
|
-
disabled: true,
|
|
4794
|
-
description: {
|
|
4795
|
-
id: "content-type-builder.form.attribute.item.uniqueField.v5.disabled",
|
|
4796
|
-
defaultMessage: "Currently unique fields don't work correctly in components. This field has been disabled until it's fixed."
|
|
4797
|
-
}
|
|
4798
|
-
};
|
|
4799
|
-
});
|
|
4800
|
-
return {
|
|
4801
|
-
//@ts-expect-error temporary measure
|
|
4802
|
-
sectionTitle: section?.sectionTitle ?? null,
|
|
4803
|
-
items: filteredItems
|
|
4804
|
-
};
|
|
4805
|
-
});
|
|
4806
|
-
} else {
|
|
4807
|
-
baseForm2 = attributesForm.advanced[type](data, step).sections;
|
|
4808
|
-
}
|
|
4819
|
+
const baseForm2 = attributesForm.advanced[type](data, step).sections;
|
|
4809
4820
|
const itemsToAdd = extensions.getAdvancedForm(["attribute", type], {
|
|
4810
4821
|
data,
|
|
4811
4822
|
type,
|
|
@@ -4991,8 +5002,6 @@ const getAttributesToDisplay = (dataTarget = "", targetUid, nestedComponents) =>
|
|
|
4991
5002
|
"richtext"
|
|
4992
5003
|
];
|
|
4993
5004
|
const isPickingAttributeForAContentType = dataTarget === "contentType";
|
|
4994
|
-
const isNestedInAnotherComponent = nestedComponents.includes(targetUid);
|
|
4995
|
-
const canAddComponentInAnotherComponent = !isPickingAttributeForAContentType && !isNestedInAnotherComponent;
|
|
4996
5005
|
if (isPickingAttributeForAContentType) {
|
|
4997
5006
|
return [
|
|
4998
5007
|
// Insert UID before the last item (richtext)
|
|
@@ -5000,8 +5009,13 @@ const getAttributesToDisplay = (dataTarget = "", targetUid, nestedComponents) =>
|
|
|
5000
5009
|
["component", "dynamiczone"]
|
|
5001
5010
|
];
|
|
5002
5011
|
}
|
|
5003
|
-
if (
|
|
5004
|
-
|
|
5012
|
+
if (dataTarget) {
|
|
5013
|
+
const componentDepth = getComponentDepth(targetUid, nestedComponents);
|
|
5014
|
+
const isNestedInAnotherComponent = componentDepth >= index$1.MAX_COMPONENT_DEPTH;
|
|
5015
|
+
const canAddComponentInAnotherComponent = !isPickingAttributeForAContentType && !isNestedInAnotherComponent;
|
|
5016
|
+
if (canAddComponentInAnotherComponent) {
|
|
5017
|
+
return [defaultAttributes, ["component"]];
|
|
5018
|
+
}
|
|
5005
5019
|
}
|
|
5006
5020
|
return [defaultAttributes];
|
|
5007
5021
|
};
|
|
@@ -5034,11 +5048,11 @@ const FormModal = () => {
|
|
|
5034
5048
|
targetUid,
|
|
5035
5049
|
showBackLink
|
|
5036
5050
|
} = useFormModalNavigation();
|
|
5051
|
+
const [activeTab, setActiveTab] = React__namespace.useState("basic");
|
|
5037
5052
|
const getPlugin = strapiAdmin.useStrapiApp("FormModal", (state) => state.getPlugin);
|
|
5038
5053
|
const getCustomField = strapiAdmin.useStrapiApp("FormModal", (state) => state.customFields.get);
|
|
5039
5054
|
const customField = getCustomField(customFieldUid);
|
|
5040
|
-
const
|
|
5041
|
-
const formModalSelector = React.useMemo(makeSelectFormModal, []);
|
|
5055
|
+
const formModalSelector = React__namespace.useMemo(makeSelectFormModal, []);
|
|
5042
5056
|
const dispatch = reactRedux.useDispatch();
|
|
5043
5057
|
const { toggleNotification } = strapiAdmin.useNotification();
|
|
5044
5058
|
const reducerState = reactRedux.useSelector((state) => formModalSelector(state), reactRedux.shallowEqual);
|
|
@@ -5077,7 +5091,7 @@ const FormModal = () => {
|
|
|
5077
5091
|
modifiedData
|
|
5078
5092
|
} = reducerState;
|
|
5079
5093
|
const pathToSchema = forTarget === "contentType" || forTarget === "component" ? [forTarget] : [forTarget, targetUid];
|
|
5080
|
-
|
|
5094
|
+
React__namespace.useEffect(() => {
|
|
5081
5095
|
if (isOpen) {
|
|
5082
5096
|
const collectionTypesForRelation = sortedContentTypesList.filter(
|
|
5083
5097
|
isAllowedContentTypesForRelations
|
|
@@ -5320,7 +5334,7 @@ const FormModal = () => {
|
|
|
5320
5334
|
}
|
|
5321
5335
|
await schema.validate(dataToValidate, { abortEarly: false });
|
|
5322
5336
|
};
|
|
5323
|
-
const handleChange =
|
|
5337
|
+
const handleChange = React__namespace.useCallback(
|
|
5324
5338
|
({
|
|
5325
5339
|
target: { name, value, type, ...rest }
|
|
5326
5340
|
}) => {
|
|
@@ -5377,7 +5391,7 @@ const FormModal = () => {
|
|
|
5377
5391
|
} else {
|
|
5378
5392
|
if (canEditContentType(allDataSchema, modifiedData)) {
|
|
5379
5393
|
onCloseModal();
|
|
5380
|
-
submitData(modifiedData);
|
|
5394
|
+
await submitData(modifiedData);
|
|
5381
5395
|
} else {
|
|
5382
5396
|
toggleNotification({
|
|
5383
5397
|
type: "danger",
|
|
@@ -5439,9 +5453,7 @@ const FormModal = () => {
|
|
|
5439
5453
|
dispatch({
|
|
5440
5454
|
type: index$1.RESET_PROPS_AND_SET_THE_FORM_FOR_ADDING_A_COMPO_TO_A_DZ
|
|
5441
5455
|
});
|
|
5442
|
-
|
|
5443
|
-
tabGroupRef.current._handlers.setSelectedTabIndex(0);
|
|
5444
|
-
}
|
|
5456
|
+
setActiveTab("basic");
|
|
5445
5457
|
onNavigateToAddCompoToDZModal({ dynamicZoneTarget: modifiedData.name });
|
|
5446
5458
|
} else {
|
|
5447
5459
|
onCloseModal();
|
|
@@ -5626,9 +5638,6 @@ const FormModal = () => {
|
|
|
5626
5638
|
// We need the nested components so we know when to remove the component option
|
|
5627
5639
|
nestedComponents
|
|
5628
5640
|
);
|
|
5629
|
-
if (!isOpen) {
|
|
5630
|
-
return null;
|
|
5631
|
-
}
|
|
5632
5641
|
if (!modalType) {
|
|
5633
5642
|
return null;
|
|
5634
5643
|
}
|
|
@@ -5711,7 +5720,7 @@ const FormModal = () => {
|
|
|
5711
5720
|
trackUsage("didEditFieldNameOnContentType");
|
|
5712
5721
|
}
|
|
5713
5722
|
};
|
|
5714
|
-
return /* @__PURE__ */ jsxRuntime.
|
|
5723
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Root, { open: isOpen, onOpenChange: handleClosed, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Content, { children: [
|
|
5715
5724
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5716
5725
|
FormModalHeader,
|
|
5717
5726
|
{
|
|
@@ -5737,18 +5746,16 @@ const FormModal = () => {
|
|
|
5737
5746
|
}
|
|
5738
5747
|
),
|
|
5739
5748
|
!isPickingAttribute && /* @__PURE__ */ jsxRuntime.jsxs("form", { onSubmit: handleSubmit, children: [
|
|
5740
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
5741
|
-
designSystem.
|
|
5749
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Body, { children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5750
|
+
designSystem.Tabs.Root,
|
|
5742
5751
|
{
|
|
5743
|
-
label: "todo",
|
|
5744
|
-
id: "tabs",
|
|
5745
5752
|
variant: "simple",
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
|
|
5749
|
-
|
|
5750
|
-
}
|
|
5753
|
+
value: activeTab,
|
|
5754
|
+
onValueChange: (value) => {
|
|
5755
|
+
setActiveTab(value);
|
|
5756
|
+
sendAdvancedTabEvent(value);
|
|
5751
5757
|
},
|
|
5758
|
+
hasError: doesBaseFormHasError ? "basic" : doesAdvancedFormHasError ? "advanced" : void 0,
|
|
5752
5759
|
children: [
|
|
5753
5760
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", children: [
|
|
5754
5761
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5764,95 +5771,83 @@ const FormModal = () => {
|
|
|
5764
5771
|
customField
|
|
5765
5772
|
}
|
|
5766
5773
|
),
|
|
5767
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs, { children: [
|
|
5768
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
5774
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs.List, { children: [
|
|
5775
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "basic", children: formatMessage({
|
|
5769
5776
|
id: getTrad("popUpForm.navContainer.base"),
|
|
5770
5777
|
defaultMessage: "Basic settings"
|
|
5771
5778
|
}) }),
|
|
5772
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5773
|
-
|
|
5774
|
-
|
|
5775
|
-
|
|
5776
|
-
disabled: shouldDisableAdvancedTab(),
|
|
5777
|
-
children: formatMessage({
|
|
5778
|
-
id: getTrad("popUpForm.navContainer.advanced"),
|
|
5779
|
-
defaultMessage: "Advanced settings"
|
|
5780
|
-
})
|
|
5781
|
-
}
|
|
5782
|
-
)
|
|
5779
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "advanced", disabled: shouldDisableAdvancedTab(), children: formatMessage({
|
|
5780
|
+
id: getTrad("popUpForm.navContainer.advanced"),
|
|
5781
|
+
defaultMessage: "Advanced settings"
|
|
5782
|
+
}) })
|
|
5783
5783
|
] })
|
|
5784
5784
|
] }),
|
|
5785
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, {}),
|
|
5786
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
5787
|
-
|
|
5788
|
-
|
|
5789
|
-
|
|
5790
|
-
|
|
5791
|
-
|
|
5792
|
-
|
|
5793
|
-
|
|
5794
|
-
|
|
5795
|
-
|
|
5796
|
-
|
|
5797
|
-
|
|
5798
|
-
|
|
5799
|
-
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
|
|
5805
|
-
|
|
5806
|
-
) }) })
|
|
5807
|
-
] }) })
|
|
5785
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, { marginBottom: 6 }),
|
|
5786
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "basic", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5787
|
+
TabForm,
|
|
5788
|
+
{
|
|
5789
|
+
form: baseForm2,
|
|
5790
|
+
formErrors,
|
|
5791
|
+
genericInputProps,
|
|
5792
|
+
modifiedData,
|
|
5793
|
+
onChange: handleChange
|
|
5794
|
+
}
|
|
5795
|
+
) }) }),
|
|
5796
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "advanced", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5797
|
+
TabForm,
|
|
5798
|
+
{
|
|
5799
|
+
form: advancedForm2,
|
|
5800
|
+
formErrors,
|
|
5801
|
+
genericInputProps,
|
|
5802
|
+
modifiedData,
|
|
5803
|
+
onChange: handleChange
|
|
5804
|
+
}
|
|
5805
|
+
) }) })
|
|
5808
5806
|
]
|
|
5809
5807
|
}
|
|
5810
5808
|
) }),
|
|
5811
|
-
/* @__PURE__ */ jsxRuntime.
|
|
5812
|
-
designSystem.
|
|
5813
|
-
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5817
|
-
|
|
5818
|
-
|
|
5819
|
-
|
|
5820
|
-
|
|
5821
|
-
|
|
5822
|
-
|
|
5823
|
-
|
|
5824
|
-
|
|
5825
|
-
|
|
5826
|
-
|
|
5827
|
-
|
|
5828
|
-
|
|
5829
|
-
|
|
5830
|
-
|
|
5831
|
-
|
|
5832
|
-
|
|
5833
|
-
|
|
5834
|
-
|
|
5835
|
-
|
|
5836
|
-
|
|
5837
|
-
|
|
5838
|
-
|
|
5839
|
-
|
|
5840
|
-
|
|
5841
|
-
|
|
5842
|
-
|
|
5843
|
-
|
|
5844
|
-
|
|
5845
|
-
|
|
5846
|
-
|
|
5847
|
-
|
|
5848
|
-
|
|
5849
|
-
|
|
5850
|
-
|
|
5851
|
-
startActions: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", onClick: handleClosed, children: formatMessage({ id: "app.components.Button.cancel", defaultMessage: "Cancel" }) })
|
|
5852
|
-
}
|
|
5853
|
-
)
|
|
5809
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Footer, { children: [
|
|
5810
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", onClick: handleClosed, children: formatMessage({ id: "app.components.Button.cancel", defaultMessage: "Cancel" }) }),
|
|
5811
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5812
|
+
FormModalEndActions,
|
|
5813
|
+
{
|
|
5814
|
+
deleteCategory,
|
|
5815
|
+
deleteContentType: deleteData,
|
|
5816
|
+
deleteComponent: deleteData,
|
|
5817
|
+
categoryName: initialData.name,
|
|
5818
|
+
isAttributeModal: modalType === "attribute",
|
|
5819
|
+
isCustomFieldModal: modalType === "customField",
|
|
5820
|
+
isComponentToDzModal: modalType === "addComponentToDynamicZone",
|
|
5821
|
+
isComponentAttribute: attributeType === "component",
|
|
5822
|
+
isComponentModal: modalType === "component",
|
|
5823
|
+
isContentTypeModal: modalType === "contentType",
|
|
5824
|
+
isCreatingComponent: actionType === "create",
|
|
5825
|
+
isCreatingDz: actionType === "create",
|
|
5826
|
+
isCreatingComponentAttribute: modifiedData.createComponent || false,
|
|
5827
|
+
isCreatingComponentInDz: modifiedData.createComponent || false,
|
|
5828
|
+
isCreatingComponentWhileAddingAField,
|
|
5829
|
+
isCreatingContentType: actionType === "create",
|
|
5830
|
+
isEditingAttribute: actionType === "edit",
|
|
5831
|
+
isDzAttribute: attributeType === "dynamiczone",
|
|
5832
|
+
isEditingCategory: modalType === "editCategory",
|
|
5833
|
+
isInFirstComponentStep: step === "1",
|
|
5834
|
+
onSubmitAddComponentAttribute: handleSubmit,
|
|
5835
|
+
onSubmitAddComponentToDz: handleSubmit,
|
|
5836
|
+
onSubmitCreateComponent: handleSubmit,
|
|
5837
|
+
onSubmitCreateContentType: handleSubmit,
|
|
5838
|
+
onSubmitCreateDz: handleSubmit,
|
|
5839
|
+
onSubmitEditAttribute: handleSubmit,
|
|
5840
|
+
onSubmitEditCategory: handleSubmit,
|
|
5841
|
+
onSubmitEditComponent: handleSubmit,
|
|
5842
|
+
onSubmitEditContentType: handleSubmit,
|
|
5843
|
+
onSubmitEditCustomFieldAttribute: handleSubmit,
|
|
5844
|
+
onSubmitEditDz: handleSubmit,
|
|
5845
|
+
onClickFinish: handleClickFinish
|
|
5846
|
+
}
|
|
5847
|
+
)
|
|
5848
|
+
] })
|
|
5854
5849
|
] })
|
|
5855
|
-
] });
|
|
5850
|
+
] }) });
|
|
5856
5851
|
};
|
|
5857
5852
|
const dataManagerProviderDomain = () => (state) => state[`${index$1.pluginId}_dataManagerProvider`] || index$1.initialState$1;
|
|
5858
5853
|
const makeSelectDataManagerProvider = () => toolkit.createSelector(dataManagerProviderDomain(), (substate) => {
|
|
@@ -5995,40 +5990,69 @@ const retrieveComponentsThatHaveComponents = (allComponents) => {
|
|
|
5995
5990
|
const componentsThatHaveNestedComponents = Object.keys(allComponents).reduce(
|
|
5996
5991
|
(acc, current) => {
|
|
5997
5992
|
const currentComponent = get__default.default(allComponents, [current]);
|
|
5998
|
-
const
|
|
5999
|
-
if (
|
|
6000
|
-
acc.push(
|
|
5993
|
+
const compoWithChildren = getComponentWithChildComponents(currentComponent);
|
|
5994
|
+
if (compoWithChildren.childComponents.length > 0) {
|
|
5995
|
+
acc.push(compoWithChildren);
|
|
6001
5996
|
}
|
|
6002
5997
|
return acc;
|
|
6003
5998
|
},
|
|
6004
5999
|
[]
|
|
6005
6000
|
);
|
|
6006
|
-
return
|
|
6001
|
+
return componentsThatHaveNestedComponents;
|
|
6007
6002
|
};
|
|
6008
|
-
const
|
|
6003
|
+
const getComponentWithChildComponents = (component) => {
|
|
6009
6004
|
const attributes = get__default.default(component, ["schema", "attributes"], []);
|
|
6010
|
-
return
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6005
|
+
return {
|
|
6006
|
+
component: component.uid,
|
|
6007
|
+
childComponents: attributes.filter((attribute) => {
|
|
6008
|
+
const { type } = attribute;
|
|
6009
|
+
return type === "component";
|
|
6010
|
+
}).map((attribute) => {
|
|
6011
|
+
return {
|
|
6012
|
+
component: attribute.component
|
|
6013
|
+
};
|
|
6014
|
+
})
|
|
6015
|
+
};
|
|
6014
6016
|
};
|
|
6015
6017
|
const retrieveNestedComponents = (appComponents) => {
|
|
6016
6018
|
const nestedComponents = Object.keys(appComponents).reduce((acc, current) => {
|
|
6017
6019
|
const componentAttributes = appComponents?.[current]?.schema?.attributes ?? [];
|
|
6018
|
-
const currentComponentNestedCompos =
|
|
6020
|
+
const currentComponentNestedCompos = getComponentsNestedWithinComponent(
|
|
6021
|
+
componentAttributes,
|
|
6022
|
+
current
|
|
6023
|
+
);
|
|
6019
6024
|
return [...acc, ...currentComponentNestedCompos];
|
|
6020
6025
|
}, []);
|
|
6021
|
-
return
|
|
6026
|
+
return mergeComponents(nestedComponents);
|
|
6022
6027
|
};
|
|
6023
|
-
const
|
|
6028
|
+
const getComponentsNestedWithinComponent = (componentAttributes, parentCompoUid) => {
|
|
6024
6029
|
return componentAttributes.reduce((acc, current) => {
|
|
6025
6030
|
const { type, component } = current;
|
|
6026
6031
|
if (type === "component") {
|
|
6027
|
-
acc.push(
|
|
6032
|
+
acc.push({
|
|
6033
|
+
component,
|
|
6034
|
+
parentCompoUid
|
|
6035
|
+
});
|
|
6028
6036
|
}
|
|
6029
6037
|
return acc;
|
|
6030
6038
|
}, []);
|
|
6031
6039
|
};
|
|
6040
|
+
const mergeComponents = (originalComponents) => {
|
|
6041
|
+
const componentMap = /* @__PURE__ */ new Map();
|
|
6042
|
+
originalComponents.forEach(({ component, parentCompoUid }) => {
|
|
6043
|
+
if (!componentMap.has(component)) {
|
|
6044
|
+
componentMap.set(component, /* @__PURE__ */ new Set());
|
|
6045
|
+
}
|
|
6046
|
+
componentMap.get(component).add(parentCompoUid);
|
|
6047
|
+
});
|
|
6048
|
+
const transformedComponents = Array.from(componentMap.entries()).map(
|
|
6049
|
+
([component, parentCompoUidSet]) => ({
|
|
6050
|
+
component,
|
|
6051
|
+
uidsOfAllParents: Array.from(parentCompoUidSet)
|
|
6052
|
+
})
|
|
6053
|
+
);
|
|
6054
|
+
return transformedComponents;
|
|
6055
|
+
};
|
|
6032
6056
|
const retrieveSpecificInfoFromComponents = (allComponents, keysToRetrieve) => {
|
|
6033
6057
|
const allData = Object.keys(allComponents).map((compo) => {
|
|
6034
6058
|
return get__default.default(allComponents, [compo, ...keysToRetrieve], "");
|
|
@@ -6321,12 +6345,11 @@ const DataManagerProvider = ({ children }) => {
|
|
|
6321
6345
|
set__default.default(allCompos, get__default.default(currentEditedCompo, ["uid"], ""), currentEditedCompo);
|
|
6322
6346
|
}
|
|
6323
6347
|
const composWithCompos = retrieveComponentsThatHaveComponents(allCompos);
|
|
6324
|
-
return
|
|
6348
|
+
return composWithCompos;
|
|
6325
6349
|
};
|
|
6326
6350
|
const getAllNestedComponents = () => {
|
|
6327
6351
|
const appNestedCompo = retrieveNestedComponents(components);
|
|
6328
|
-
|
|
6329
|
-
return index$1.makeUnique([...editingDataNestedCompos, ...appNestedCompo]);
|
|
6352
|
+
return appNestedCompo;
|
|
6330
6353
|
};
|
|
6331
6354
|
const removeComponentFromDynamicZone = (dzName, componentToRemoveIndex) => {
|
|
6332
6355
|
dispatch({
|
|
@@ -6698,11 +6721,11 @@ const FormModalNavigationProvider = ({ children }) => {
|
|
|
6698
6721
|
}
|
|
6699
6722
|
);
|
|
6700
6723
|
};
|
|
6701
|
-
const ListView$1 = React.lazy(() => Promise.resolve().then(() => require("./ListView-
|
|
6724
|
+
const ListView$1 = React.lazy(() => Promise.resolve().then(() => require("./ListView-DVskSF0B.js")));
|
|
6702
6725
|
const RecursivePath = () => {
|
|
6703
6726
|
return /* @__PURE__ */ jsxRuntime.jsx(React.Suspense, { fallback: /* @__PURE__ */ jsxRuntime.jsx(strapiAdmin.Page.Loading, {}), children: /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Routes, { children: /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: `/:componentUid`, element: /* @__PURE__ */ jsxRuntime.jsx(ListView$1, {}) }) }) });
|
|
6704
6727
|
};
|
|
6705
|
-
const ListView = React.lazy(() => Promise.resolve().then(() => require("./ListView-
|
|
6728
|
+
const ListView = React.lazy(() => Promise.resolve().then(() => require("./ListView-DVskSF0B.js")));
|
|
6706
6729
|
const App = () => {
|
|
6707
6730
|
const { formatMessage } = reactIntl.useIntl();
|
|
6708
6731
|
const title = formatMessage({
|
|
@@ -6734,4 +6757,4 @@ exports.getTrad = getTrad;
|
|
|
6734
6757
|
exports.index = index;
|
|
6735
6758
|
exports.useDataManager = useDataManager;
|
|
6736
6759
|
exports.useFormModalNavigation = useFormModalNavigation;
|
|
6737
|
-
//# sourceMappingURL=index-
|
|
6760
|
+
//# sourceMappingURL=index-DcOZkn-n.js.map
|