@strapi/content-type-builder 5.0.0-rc.0 → 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/dist/_chunks/{ListView-CY9uKqop.mjs → ListView-CYfzT9Ss.mjs} +2 -2
- package/dist/_chunks/{ListView-CY9uKqop.mjs.map → ListView-CYfzT9Ss.mjs.map} +1 -1
- package/dist/_chunks/{ListView-g9V7g_tv.js → ListView-DVskSF0B.js} +2 -2
- package/dist/_chunks/{ListView-g9V7g_tv.js.map → ListView-DVskSF0B.js.map} +1 -1
- package/dist/_chunks/{index-BLvlfjLT.mjs → index-4pWiYAr9.mjs} +7 -7
- package/dist/_chunks/{index-BLvlfjLT.mjs.map → index-4pWiYAr9.mjs.map} +1 -1
- package/dist/_chunks/{index-Z-KG7c7n.js → index-DcOZkn-n.js} +90 -82
- package/dist/_chunks/index-DcOZkn-n.js.map +1 -0
- package/dist/_chunks/{index-BpIP_u5V.mjs → index-KxDs8xjD.mjs} +90 -82
- package/dist/_chunks/index-KxDs8xjD.mjs.map +1 -0
- package/dist/_chunks/{index-hlyv9EE3.js → index-vzttgmyT.js} +7 -7
- package/dist/_chunks/{index-hlyv9EE3.js.map → index-vzttgmyT.js.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/ContentTypeBuilderNav/useContentTypeBuilderMenu.d.ts +1 -0
- package/dist/admin/src/components/SelectCategory.d.ts +2 -1
- package/package.json +6 -6
- package/dist/_chunks/index-BpIP_u5V.mjs.map +0 -1
- package/dist/_chunks/index-Z-KG7c7n.js.map +0 -1
|
@@ -10,7 +10,7 @@ import { ArrowClockwise, Clock, Plus, Sparkle, ArrowLeft, Search, Trash, Eye, Ey
|
|
|
10
10
|
import { createPortal } from "react-dom";
|
|
11
11
|
import { keyframes, styled } from "styled-components";
|
|
12
12
|
import upperFirst from "lodash/upperFirst";
|
|
13
|
-
import { p as pluginId, n as nameToSlug, O as ON_CHANGE_RELATION_TARGET, a as ON_CHANGE_RELATION_TYPE, g as getRelationType, M as MAX_COMPONENT_DEPTH, c as createComponentUid, b as createUid, i as initialState, S as SET_DATA_TO_EDIT, d as SET_DYNAMIC_ZONE_DATA_SCHEMA, e as SET_CUSTOM_FIELD_DATA_SCHEMA, f as SET_ATTRIBUTE_DATA_SCHEMA, R as RESET_PROPS, h as SET_ERRORS, j as ON_CHANGE, k as RESET_PROPS_AND_SET_THE_FORM_FOR_ADDING_A_COMPO_TO_A_DZ, l as RESET_PROPS_AND_SET_FORM_FOR_ADDING_AN_EXISTING_COMPO, m as RESET_PROPS_AND_SAVE_CURRENT_DATA, o as initialState$1, q as makeUnique, G as GET_DATA_SUCCEEDED, r as RELOAD_PLUGIN, s as retrieveComponentsFromSchema, t as SET_MODIFIED_DATA, A as ADD_CUSTOM_FIELD_ATTRIBUTE, E as EDIT_CUSTOM_FIELD_ATTRIBUTE, u as ADD_CREATED_COMPONENT_TO_DYNAMIC_ZONE, C as CHANGE_DYNAMIC_ZONE_COMPONENTS, D as DELETE_NOT_SAVED_TYPE, v as REMOVE_COMPONENT_FROM_DYNAMIC_ZONE, U as UPDATE_INITIAL_STATE, w as UPDATE_SCHEMA, x as EDIT_ATTRIBUTE, y as ADD_ATTRIBUTE, z as CREATE_SCHEMA, B as CREATE_COMPONENT_SCHEMA, F as REMOVE_FIELD_FROM_DISPLAYED_COMPONENT, H as REMOVE_FIELD, P as PERMISSIONS } from "./index-
|
|
13
|
+
import { p as pluginId, n as nameToSlug, O as ON_CHANGE_RELATION_TARGET, a as ON_CHANGE_RELATION_TYPE, g as getRelationType, M as MAX_COMPONENT_DEPTH, c as createComponentUid, b as createUid, i as initialState, S as SET_DATA_TO_EDIT, d as SET_DYNAMIC_ZONE_DATA_SCHEMA, e as SET_CUSTOM_FIELD_DATA_SCHEMA, f as SET_ATTRIBUTE_DATA_SCHEMA, R as RESET_PROPS, h as SET_ERRORS, j as ON_CHANGE, k as RESET_PROPS_AND_SET_THE_FORM_FOR_ADDING_A_COMPO_TO_A_DZ, l as RESET_PROPS_AND_SET_FORM_FOR_ADDING_AN_EXISTING_COMPO, m as RESET_PROPS_AND_SAVE_CURRENT_DATA, o as initialState$1, q as makeUnique, G as GET_DATA_SUCCEEDED, r as RELOAD_PLUGIN, s as retrieveComponentsFromSchema, t as SET_MODIFIED_DATA, A as ADD_CUSTOM_FIELD_ATTRIBUTE, E as EDIT_CUSTOM_FIELD_ATTRIBUTE, u as ADD_CREATED_COMPONENT_TO_DYNAMIC_ZONE, C as CHANGE_DYNAMIC_ZONE_COMPONENTS, D as DELETE_NOT_SAVED_TYPE, v as REMOVE_COMPONENT_FROM_DYNAMIC_ZONE, U as UPDATE_INITIAL_STATE, w as UPDATE_SCHEMA, x as EDIT_ATTRIBUTE, y as ADD_ATTRIBUTE, z as CREATE_SCHEMA, B as CREATE_COMPONENT_SCHEMA, F as REMOVE_FIELD_FROM_DISPLAYED_COMPONENT, H as REMOVE_FIELD, P as PERMISSIONS } from "./index-4pWiYAr9.mjs";
|
|
14
14
|
import isEqual from "lodash/isEqual";
|
|
15
15
|
import get from "lodash/get";
|
|
16
16
|
import groupBy from "lodash/groupBy";
|
|
@@ -308,23 +308,28 @@ const useContentTypeBuilderMenu = () => {
|
|
|
308
308
|
].map((section) => {
|
|
309
309
|
const hasChild = section.links.some((l) => Array.isArray(l.links));
|
|
310
310
|
if (hasChild) {
|
|
311
|
+
let filteredLinksCount = 0;
|
|
311
312
|
return {
|
|
312
313
|
...section,
|
|
313
314
|
links: section.links.map((link) => {
|
|
314
|
-
const
|
|
315
|
-
if (
|
|
315
|
+
const filteredLinks2 = link.links.filter((link2) => startsWith(link2.title, search));
|
|
316
|
+
if (filteredLinks2.length === 0) {
|
|
316
317
|
return null;
|
|
317
318
|
}
|
|
319
|
+
filteredLinksCount += filteredLinks2.length;
|
|
318
320
|
return {
|
|
319
321
|
...link,
|
|
320
|
-
links:
|
|
322
|
+
links: filteredLinks2.sort((a, b) => formatter.compare(a.title, b.title))
|
|
321
323
|
};
|
|
322
|
-
}).filter(Boolean)
|
|
324
|
+
}).filter(Boolean),
|
|
325
|
+
linksCount: filteredLinksCount
|
|
323
326
|
};
|
|
324
327
|
}
|
|
328
|
+
const filteredLinks = section.links.filter((link) => startsWith(link.title, search)).sort((a, b) => formatter.compare(a.title, b.title));
|
|
325
329
|
return {
|
|
326
330
|
...section,
|
|
327
|
-
links:
|
|
331
|
+
links: filteredLinks,
|
|
332
|
+
linksCount: filteredLinks.length
|
|
328
333
|
};
|
|
329
334
|
});
|
|
330
335
|
return {
|
|
@@ -336,78 +341,70 @@ const useContentTypeBuilderMenu = () => {
|
|
|
336
341
|
const ContentTypeBuilderNav = () => {
|
|
337
342
|
const { menu, searchValue, onSearchChange } = useContentTypeBuilderMenu();
|
|
338
343
|
const { formatMessage } = useIntl();
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
{
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
children: upperFirst(
|
|
384
|
-
formatMessage({ id: subLink.name, defaultMessage: subLink.title })
|
|
385
|
-
)
|
|
386
|
-
},
|
|
387
|
-
subLink.name
|
|
388
|
-
)) }, link.name);
|
|
389
|
-
}
|
|
390
|
-
return /* @__PURE__ */ jsx(SubNavLink, { tag: NavLink, to: link.to, active: link.active, children: upperFirst(formatMessage({ id: link.name, defaultMessage: link.title })) }, link.name);
|
|
391
|
-
})
|
|
392
|
-
}
|
|
393
|
-
),
|
|
394
|
-
section.customLink && /* @__PURE__ */ jsx(Box, { paddingLeft: 7, children: /* @__PURE__ */ jsx(
|
|
395
|
-
TextButton,
|
|
396
|
-
{
|
|
397
|
-
onClick: section.customLink.onClick,
|
|
398
|
-
startIcon: /* @__PURE__ */ jsx(Plus, { width: "0.8rem", height: "0.8rem" }),
|
|
399
|
-
marginTop: 2,
|
|
400
|
-
cursor: "pointer",
|
|
401
|
-
children: formatMessage({
|
|
402
|
-
id: section.customLink.id,
|
|
403
|
-
defaultMessage: section.customLink.defaultMessage
|
|
404
|
-
})
|
|
344
|
+
const pluginName = formatMessage({
|
|
345
|
+
id: getTrad("plugin.name"),
|
|
346
|
+
defaultMessage: "Content-Type Builder"
|
|
347
|
+
});
|
|
348
|
+
return /* @__PURE__ */ jsxs(SubNav, { "aria-label": pluginName, children: [
|
|
349
|
+
/* @__PURE__ */ jsx(
|
|
350
|
+
SubNavHeader,
|
|
351
|
+
{
|
|
352
|
+
searchable: true,
|
|
353
|
+
value: searchValue,
|
|
354
|
+
onClear: () => onSearchChange(""),
|
|
355
|
+
onChange: (e) => onSearchChange(e.target.value),
|
|
356
|
+
label: pluginName,
|
|
357
|
+
searchLabel: formatMessage({
|
|
358
|
+
id: "global.search",
|
|
359
|
+
defaultMessage: "Search"
|
|
360
|
+
})
|
|
361
|
+
}
|
|
362
|
+
),
|
|
363
|
+
/* @__PURE__ */ jsx(SubNavSections, { children: menu.map((section) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
364
|
+
/* @__PURE__ */ jsx(
|
|
365
|
+
SubNavSection,
|
|
366
|
+
{
|
|
367
|
+
label: formatMessage({
|
|
368
|
+
id: section.title.id,
|
|
369
|
+
defaultMessage: section.title.defaultMessage
|
|
370
|
+
}),
|
|
371
|
+
collapsable: true,
|
|
372
|
+
badgeLabel: section.linksCount.toString(),
|
|
373
|
+
children: section.links.map((link) => {
|
|
374
|
+
if (link.links) {
|
|
375
|
+
return /* @__PURE__ */ jsx(SubNavLinkSection, { label: upperFirst(link.title), children: link.links.map((subLink) => /* @__PURE__ */ jsx(
|
|
376
|
+
SubNavLink,
|
|
377
|
+
{
|
|
378
|
+
tag: NavLink,
|
|
379
|
+
to: subLink.to,
|
|
380
|
+
active: subLink.active,
|
|
381
|
+
isSubSectionChild: true,
|
|
382
|
+
children: upperFirst(
|
|
383
|
+
formatMessage({ id: subLink.name, defaultMessage: subLink.title })
|
|
384
|
+
)
|
|
385
|
+
},
|
|
386
|
+
subLink.name
|
|
387
|
+
)) }, link.name);
|
|
405
388
|
}
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
389
|
+
return /* @__PURE__ */ jsx(SubNavLink, { tag: NavLink, to: link.to, active: link.active, children: upperFirst(formatMessage({ id: link.name, defaultMessage: link.title })) }, link.name);
|
|
390
|
+
})
|
|
391
|
+
}
|
|
392
|
+
),
|
|
393
|
+
section.customLink && /* @__PURE__ */ jsx(Box, { paddingLeft: 7, children: /* @__PURE__ */ jsx(
|
|
394
|
+
TextButton,
|
|
395
|
+
{
|
|
396
|
+
onClick: section.customLink.onClick,
|
|
397
|
+
startIcon: /* @__PURE__ */ jsx(Plus, { width: "0.8rem", height: "0.8rem" }),
|
|
398
|
+
marginTop: 2,
|
|
399
|
+
cursor: "pointer",
|
|
400
|
+
children: formatMessage({
|
|
401
|
+
id: section.customLink.id,
|
|
402
|
+
defaultMessage: section.customLink.defaultMessage
|
|
403
|
+
})
|
|
404
|
+
}
|
|
405
|
+
) })
|
|
406
|
+
] }, section.name)) })
|
|
407
|
+
] });
|
|
411
408
|
};
|
|
412
409
|
const isAllowedContentTypesForRelations = (contentType) => {
|
|
413
410
|
return contentType.kind === "collectionType" && (contentType.restrictRelationsTo === null || Array.isArray(contentType.restrictRelationsTo) && contentType.restrictRelationsTo.length > 0);
|
|
@@ -2459,7 +2456,8 @@ const SelectCategory = ({
|
|
|
2459
2456
|
intlLabel,
|
|
2460
2457
|
name,
|
|
2461
2458
|
onChange,
|
|
2462
|
-
value = void 0
|
|
2459
|
+
value = void 0,
|
|
2460
|
+
isCreating
|
|
2463
2461
|
}) => {
|
|
2464
2462
|
const { formatMessage } = useIntl();
|
|
2465
2463
|
const { allComponentsCategories } = useDataManager();
|
|
@@ -2475,7 +2473,17 @@ const SelectCategory = ({
|
|
|
2475
2473
|
};
|
|
2476
2474
|
return /* @__PURE__ */ jsxs(Field.Root, { error: errorMessage, name, children: [
|
|
2477
2475
|
/* @__PURE__ */ jsx(Field.Label, { children: label }),
|
|
2478
|
-
/* @__PURE__ */ jsx(
|
|
2476
|
+
/* @__PURE__ */ jsx(
|
|
2477
|
+
Combobox,
|
|
2478
|
+
{
|
|
2479
|
+
disabled: !isCreating,
|
|
2480
|
+
onChange: handleChange,
|
|
2481
|
+
onCreateOption: handleCreateOption,
|
|
2482
|
+
value,
|
|
2483
|
+
creatable: true,
|
|
2484
|
+
children: categories.map((category) => /* @__PURE__ */ jsx(ComboboxOption, { value: category, children: category }, category))
|
|
2485
|
+
}
|
|
2486
|
+
),
|
|
2479
2487
|
/* @__PURE__ */ jsx(Field.Error, {})
|
|
2480
2488
|
] });
|
|
2481
2489
|
};
|
|
@@ -6674,11 +6682,11 @@ const FormModalNavigationProvider = ({ children }) => {
|
|
|
6674
6682
|
}
|
|
6675
6683
|
);
|
|
6676
6684
|
};
|
|
6677
|
-
const ListView$1 = lazy(() => import("./ListView-
|
|
6685
|
+
const ListView$1 = lazy(() => import("./ListView-CYfzT9Ss.mjs"));
|
|
6678
6686
|
const RecursivePath = () => {
|
|
6679
6687
|
return /* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(Page.Loading, {}), children: /* @__PURE__ */ jsx(Routes, { children: /* @__PURE__ */ jsx(Route, { path: `/:componentUid`, element: /* @__PURE__ */ jsx(ListView$1, {}) }) }) });
|
|
6680
6688
|
};
|
|
6681
|
-
const ListView = lazy(() => import("./ListView-
|
|
6689
|
+
const ListView = lazy(() => import("./ListView-CYfzT9Ss.mjs"));
|
|
6682
6690
|
const App = () => {
|
|
6683
6691
|
const { formatMessage } = useIntl();
|
|
6684
6692
|
const title = formatMessage({
|
|
@@ -6712,4 +6720,4 @@ export {
|
|
|
6712
6720
|
index as i,
|
|
6713
6721
|
useDataManager as u
|
|
6714
6722
|
};
|
|
6715
|
-
//# sourceMappingURL=index-
|
|
6723
|
+
//# sourceMappingURL=index-KxDs8xjD.mjs.map
|