multi-content-type-relation 0.1.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/en-Bk9okOMP.js +32 -0
- package/dist/_chunks/en-Cj4T04Z2.mjs +32 -0
- package/dist/_chunks/fr-KHPiQOFP.mjs +32 -0
- package/dist/_chunks/fr-ZS3aTnjj.js +32 -0
- package/dist/_chunks/index-BHcolZ4N.mjs +333 -0
- package/dist/_chunks/index-CktBIBSM.js +332 -0
- package/dist/_chunks/index-CxWt3llJ.js +3566 -0
- package/dist/_chunks/index-D6nv39Fp.mjs +3564 -0
- package/dist/admin/index.js +3 -0
- package/dist/admin/index.mjs +4 -0
- package/dist/admin/src/components/Input/InputContentSuggestions.d.ts +13 -0
- package/dist/admin/src/components/Input/MainInput.d.ts +16 -0
- package/dist/admin/src/components/Input/PublicationState.d.ts +6 -0
- package/dist/admin/src/components/Input/TableItem.d.ts +12 -0
- package/dist/admin/src/components/Input/index.d.ts +2 -0
- package/dist/admin/src/components/PluginIcon/index.d.ts +2 -0
- package/dist/admin/src/components/SidePanel/SidePanel.d.ts +7 -0
- package/dist/admin/src/helpers/content.d.ts +5 -0
- package/dist/admin/src/helpers/storage.d.ts +15 -0
- package/dist/admin/src/hooks/useSearchedEntries.d.ts +6 -0
- package/dist/admin/src/hooks/useTranslate.d.ts +4 -0
- package/dist/admin/src/index.d.ts +9 -0
- package/dist/admin/src/interface.d.ts +33 -0
- package/dist/admin/src/pluginId.d.ts +2 -0
- package/dist/server/index.js +506 -25
- package/dist/server/index.mjs +509 -0
- package/dist/server/src/bootstrap.d.ts +5 -0
- package/dist/server/src/config/index.d.ts +13 -0
- package/dist/server/src/content-types/index.d.ts +35 -0
- package/dist/server/src/content-types/mctr-relation/index.d.ts +33 -0
- package/dist/server/src/content-types/mctr-relation/schema.d.ts +31 -0
- package/dist/server/src/controllers/controller.d.ts +27 -0
- package/dist/server/src/controllers/index.d.ts +28 -0
- package/dist/server/src/destroy.d.ts +5 -0
- package/dist/server/src/helpers/index.d.ts +2 -0
- package/dist/server/src/index.d.ts +113 -0
- package/dist/server/src/interface.d.ts +42 -0
- package/dist/server/src/middlewares/index.d.ts +4 -0
- package/dist/server/src/middlewares/middleware.d.ts +2 -0
- package/dist/server/src/policies/index.d.ts +2 -0
- package/dist/server/src/register.d.ts +5 -0
- package/dist/server/src/routes/index.d.ts +18 -0
- package/dist/server/src/services/index.d.ts +8 -0
- package/dist/server/src/services/service.d.ts +7 -0
- package/dist/server/src/utils.d.ts +3 -0
- package/package.json +55 -27
- package/TODO.md +0 -4
- package/admin/src/components/Input/InputContentSuggestions.tsx +0 -162
- package/admin/src/components/Input/MainInput.tsx +0 -135
- package/admin/src/components/Input/PublicationState.tsx +0 -28
- package/admin/src/components/Input/TableItem.tsx +0 -109
- package/admin/src/components/Input/index.tsx +0 -27
- package/admin/src/components/PluginIcon/index.tsx +0 -12
- package/admin/src/helpers/content.ts +0 -60
- package/admin/src/helpers/storage.ts +0 -32
- package/admin/src/hooks/useSearchedEntries.ts +0 -41
- package/admin/src/index.tsx +0 -140
- package/admin/src/interface.ts +0 -37
- package/admin/src/pluginId.ts +0 -5
- package/admin/src/translations/en.json +0 -1
- package/admin/src/translations/fr.json +0 -1
- package/admin/src/utils/getTrad.ts +0 -5
- package/dist/server/bootstrap.js +0 -5
- package/dist/server/config/index.js +0 -27
- package/dist/server/content-types/index.js +0 -3
- package/dist/server/controllers/controller.js +0 -92
- package/dist/server/controllers/index.js +0 -9
- package/dist/server/destroy.js +0 -5
- package/dist/server/interface.js +0 -2
- package/dist/server/middlewares/index.js +0 -9
- package/dist/server/middlewares/middleware.js +0 -163
- package/dist/server/policies/index.js +0 -3
- package/dist/server/register.js +0 -15
- package/dist/server/routes/index.js +0 -29
- package/dist/server/services/index.js +0 -9
- package/dist/server/services/service.js +0 -8
- package/dist/server/utils.js +0 -15
- package/dist/tsconfig.server.tsbuildinfo +0 -1
- package/server/bootstrap.ts +0 -5
- package/server/config/index.ts +0 -28
- package/server/content-types/index.ts +0 -1
- package/server/controllers/controller.ts +0 -107
- package/server/controllers/index.ts +0 -5
- package/server/destroy.ts +0 -5
- package/server/index.ts +0 -23
- package/server/interface.ts +0 -50
- package/server/middlewares/index.ts +0 -5
- package/server/middlewares/middleware.ts +0 -197
- package/server/policies/index.ts +0 -1
- package/server/register.ts +0 -14
- package/server/routes/index.ts +0 -27
- package/server/services/index.ts +0 -5
- package/server/services/service.ts +0 -11
- package/server/utils.ts +0 -14
- package/strapi-admin.js +0 -3
- package/strapi-server.js +0 -3
- package/tsconfig.json +0 -20
- package/tsconfig.server.json +0 -25
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const en = {
|
|
4
|
+
"input.placeholder": "Type a term to search",
|
|
5
|
+
"input.hint.min": "min.",
|
|
6
|
+
"input.hint.max": "max.",
|
|
7
|
+
"input.hint.entries": "entries",
|
|
8
|
+
"input.hint.entry": "entry",
|
|
9
|
+
"input.hint.separator": " - ",
|
|
10
|
+
"input.hint.selected": "selected",
|
|
11
|
+
"input.error.min": "A minimum of",
|
|
12
|
+
"input.error.max": "A maximum of",
|
|
13
|
+
"input.error.required": "item(s) is required",
|
|
14
|
+
"tableItem.goToEntry": "Go to entry",
|
|
15
|
+
"tableItem.add": "Add",
|
|
16
|
+
"tableItem.delete": "Delete",
|
|
17
|
+
"tableItem.error": "An error occurred, please try to refresh the page",
|
|
18
|
+
"publicationState.na": "N.A.",
|
|
19
|
+
"publicationState.published": "Published",
|
|
20
|
+
"publicationState.draft": "Draft",
|
|
21
|
+
"contentSuggestions.title": "Title",
|
|
22
|
+
"contentSuggestions.id": "ID",
|
|
23
|
+
"contentSuggestions.contentType": "Content type",
|
|
24
|
+
"contentSuggestions.state": "State",
|
|
25
|
+
"sidePanel.linkedContent": "Linked content",
|
|
26
|
+
"sidePanel.referencedIn": "This content is referenced in",
|
|
27
|
+
"sidePanel.otherContents": "other content(s)",
|
|
28
|
+
"sidePanel.notReferenced": "This content is not referenced in other content",
|
|
29
|
+
"sidePanel.field": "Field:",
|
|
30
|
+
"common.locale": "en"
|
|
31
|
+
};
|
|
32
|
+
exports.default = en;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const en = {
|
|
2
|
+
"input.placeholder": "Type a term to search",
|
|
3
|
+
"input.hint.min": "min.",
|
|
4
|
+
"input.hint.max": "max.",
|
|
5
|
+
"input.hint.entries": "entries",
|
|
6
|
+
"input.hint.entry": "entry",
|
|
7
|
+
"input.hint.separator": " - ",
|
|
8
|
+
"input.hint.selected": "selected",
|
|
9
|
+
"input.error.min": "A minimum of",
|
|
10
|
+
"input.error.max": "A maximum of",
|
|
11
|
+
"input.error.required": "item(s) is required",
|
|
12
|
+
"tableItem.goToEntry": "Go to entry",
|
|
13
|
+
"tableItem.add": "Add",
|
|
14
|
+
"tableItem.delete": "Delete",
|
|
15
|
+
"tableItem.error": "An error occurred, please try to refresh the page",
|
|
16
|
+
"publicationState.na": "N.A.",
|
|
17
|
+
"publicationState.published": "Published",
|
|
18
|
+
"publicationState.draft": "Draft",
|
|
19
|
+
"contentSuggestions.title": "Title",
|
|
20
|
+
"contentSuggestions.id": "ID",
|
|
21
|
+
"contentSuggestions.contentType": "Content type",
|
|
22
|
+
"contentSuggestions.state": "State",
|
|
23
|
+
"sidePanel.linkedContent": "Linked content",
|
|
24
|
+
"sidePanel.referencedIn": "This content is referenced in",
|
|
25
|
+
"sidePanel.otherContents": "other content(s)",
|
|
26
|
+
"sidePanel.notReferenced": "This content is not referenced in other content",
|
|
27
|
+
"sidePanel.field": "Field:",
|
|
28
|
+
"common.locale": "en"
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
en as default
|
|
32
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const fr = {
|
|
2
|
+
"input.placeholder": "Tapez un terme pour rechercher",
|
|
3
|
+
"input.hint.min": "min.",
|
|
4
|
+
"input.hint.max": "max.",
|
|
5
|
+
"input.hint.entries": "entrées",
|
|
6
|
+
"input.hint.entry": "entrée",
|
|
7
|
+
"input.hint.separator": " - ",
|
|
8
|
+
"input.hint.selected": "sélectionné(s)",
|
|
9
|
+
"input.error.min": "Un minimum de",
|
|
10
|
+
"input.error.max": "Un maximum de",
|
|
11
|
+
"input.error.required": "élément(s) requis",
|
|
12
|
+
"tableItem.goToEntry": "Aller à l'entrée",
|
|
13
|
+
"tableItem.add": "Ajouter",
|
|
14
|
+
"tableItem.delete": "Supprimer",
|
|
15
|
+
"tableItem.error": "Une erreur s'est produite, veuillez rafraîchir la page",
|
|
16
|
+
"publicationState.na": "N.A.",
|
|
17
|
+
"publicationState.published": "Publié",
|
|
18
|
+
"publicationState.draft": "Brouillon",
|
|
19
|
+
"contentSuggestions.title": "Titre",
|
|
20
|
+
"contentSuggestions.id": "ID",
|
|
21
|
+
"contentSuggestions.contentType": "Type de contenu",
|
|
22
|
+
"contentSuggestions.state": "État",
|
|
23
|
+
"sidePanel.linkedContent": "Contenus liés",
|
|
24
|
+
"sidePanel.referencedIn": "Ce contenu est référencé dans",
|
|
25
|
+
"sidePanel.otherContents": "autre(s) contenu(s)",
|
|
26
|
+
"sidePanel.notReferenced": "Ce contenu n'est pas référencé dans d'autres contenus",
|
|
27
|
+
"sidePanel.field": "Champ :",
|
|
28
|
+
"common.locale": "fr"
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
fr as default
|
|
32
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const fr = {
|
|
4
|
+
"input.placeholder": "Tapez un terme pour rechercher",
|
|
5
|
+
"input.hint.min": "min.",
|
|
6
|
+
"input.hint.max": "max.",
|
|
7
|
+
"input.hint.entries": "entrées",
|
|
8
|
+
"input.hint.entry": "entrée",
|
|
9
|
+
"input.hint.separator": " - ",
|
|
10
|
+
"input.hint.selected": "sélectionné(s)",
|
|
11
|
+
"input.error.min": "Un minimum de",
|
|
12
|
+
"input.error.max": "Un maximum de",
|
|
13
|
+
"input.error.required": "élément(s) requis",
|
|
14
|
+
"tableItem.goToEntry": "Aller à l'entrée",
|
|
15
|
+
"tableItem.add": "Ajouter",
|
|
16
|
+
"tableItem.delete": "Supprimer",
|
|
17
|
+
"tableItem.error": "Une erreur s'est produite, veuillez rafraîchir la page",
|
|
18
|
+
"publicationState.na": "N.A.",
|
|
19
|
+
"publicationState.published": "Publié",
|
|
20
|
+
"publicationState.draft": "Brouillon",
|
|
21
|
+
"contentSuggestions.title": "Titre",
|
|
22
|
+
"contentSuggestions.id": "ID",
|
|
23
|
+
"contentSuggestions.contentType": "Type de contenu",
|
|
24
|
+
"contentSuggestions.state": "État",
|
|
25
|
+
"sidePanel.linkedContent": "Contenus liés",
|
|
26
|
+
"sidePanel.referencedIn": "Ce contenu est référencé dans",
|
|
27
|
+
"sidePanel.otherContents": "autre(s) contenu(s)",
|
|
28
|
+
"sidePanel.notReferenced": "Ce contenu n'est pas référencé dans d'autres contenus",
|
|
29
|
+
"sidePanel.field": "Champ :",
|
|
30
|
+
"common.locale": "fr"
|
|
31
|
+
};
|
|
32
|
+
exports.default = fr;
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { PuzzlePiece } from "@strapi/icons";
|
|
3
|
+
import { getFetchClient, unstable_useContentManagerContext } from "@strapi/strapi/admin";
|
|
4
|
+
import { useState, useEffect } from "react";
|
|
5
|
+
import { Box, Loader, Divider, Flex, Typography, CardBadge } from "@strapi/design-system";
|
|
6
|
+
import { useIntl } from "react-intl";
|
|
7
|
+
const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
|
8
|
+
const v = glob[path];
|
|
9
|
+
if (v) {
|
|
10
|
+
return typeof v === "function" ? v() : Promise.resolve(v);
|
|
11
|
+
}
|
|
12
|
+
return new Promise((_, reject) => {
|
|
13
|
+
(typeof queueMicrotask === "function" ? queueMicrotask : setTimeout)(
|
|
14
|
+
reject.bind(
|
|
15
|
+
null,
|
|
16
|
+
new Error(
|
|
17
|
+
"Unknown variable dynamic import: " + path + (path.split("/").length !== segs ? ". Note that variables only represent file names one level deep." : "")
|
|
18
|
+
)
|
|
19
|
+
)
|
|
20
|
+
);
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
const name$1 = "multi-content-type-relation";
|
|
24
|
+
const strapi = {
|
|
25
|
+
name: "multi-content-type-relation"
|
|
26
|
+
};
|
|
27
|
+
const pluginPkg = {
|
|
28
|
+
name: name$1,
|
|
29
|
+
strapi
|
|
30
|
+
};
|
|
31
|
+
const PluginIcon = () => /* @__PURE__ */ jsx(PuzzlePiece, {});
|
|
32
|
+
const pluginId = pluginPkg.name.replace(
|
|
33
|
+
/^(@[^-,.][\w,-]+\/|strapi-)plugin-/i,
|
|
34
|
+
""
|
|
35
|
+
);
|
|
36
|
+
const fetchMatchingContent = async (keyword, contentTypes, locale) => {
|
|
37
|
+
const { post } = getFetchClient();
|
|
38
|
+
const response = await post(`/${pluginId}/get-content`, {
|
|
39
|
+
contentTypes: contentTypes.split(","),
|
|
40
|
+
keyword,
|
|
41
|
+
locale
|
|
42
|
+
});
|
|
43
|
+
const data = response.data;
|
|
44
|
+
if (!data) throw new Error("No data returned from API");
|
|
45
|
+
const total = data.reduce((accumulator, option) => {
|
|
46
|
+
if (!option.results) return accumulator;
|
|
47
|
+
return accumulator + option.results.length;
|
|
48
|
+
}, 0);
|
|
49
|
+
return {
|
|
50
|
+
data,
|
|
51
|
+
total
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
const formatToStrapiField = (entries) => {
|
|
55
|
+
if (entries.length === 0) return "";
|
|
56
|
+
return JSON.stringify(
|
|
57
|
+
entries.map((entry) => ({
|
|
58
|
+
uid: entry.uid,
|
|
59
|
+
documentId: entry.item.documentId,
|
|
60
|
+
MRCT: true
|
|
61
|
+
})).filter(Boolean)
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
const validateCurrentRelations = async (entries) => {
|
|
65
|
+
const { post } = getFetchClient();
|
|
66
|
+
const response = await post(`/${pluginId}/validate-relations`, {
|
|
67
|
+
entries
|
|
68
|
+
});
|
|
69
|
+
return response.data;
|
|
70
|
+
};
|
|
71
|
+
const listContentTypes = async () => {
|
|
72
|
+
try {
|
|
73
|
+
const { get } = getFetchClient();
|
|
74
|
+
const response = await get(`/${pluginId}/list-content-types`);
|
|
75
|
+
return response.data;
|
|
76
|
+
} catch (error) {
|
|
77
|
+
console.error(error);
|
|
78
|
+
return [];
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const STORAGE_KEY = "mctr::content_types";
|
|
82
|
+
function getContentTypes() {
|
|
83
|
+
const raw = sessionStorage.getItem(STORAGE_KEY);
|
|
84
|
+
return raw ? JSON.parse(raw) : void 0;
|
|
85
|
+
}
|
|
86
|
+
function getContentTypeForUid(uid) {
|
|
87
|
+
const contentTypes = getContentTypes();
|
|
88
|
+
if (!Array.isArray(contentTypes)) return;
|
|
89
|
+
return contentTypes.find((contentType) => contentType.uid === uid);
|
|
90
|
+
}
|
|
91
|
+
function setContentTypes(contentTypes) {
|
|
92
|
+
const stringified = JSON.stringify(contentTypes);
|
|
93
|
+
sessionStorage.setItem(STORAGE_KEY, stringified);
|
|
94
|
+
}
|
|
95
|
+
const useTranslate = () => {
|
|
96
|
+
const { formatMessage } = useIntl();
|
|
97
|
+
const translate = (key, values) => {
|
|
98
|
+
return formatMessage({ id: key }, values);
|
|
99
|
+
};
|
|
100
|
+
return {
|
|
101
|
+
translate
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
const SidePanel = () => {
|
|
105
|
+
const { translate } = useTranslate();
|
|
106
|
+
const {
|
|
107
|
+
id: documentId,
|
|
108
|
+
model: uid,
|
|
109
|
+
isSingleType
|
|
110
|
+
} = unstable_useContentManagerContext();
|
|
111
|
+
const [linkedContent, setLinkedContent] = useState([]);
|
|
112
|
+
const [loading, setLoading] = useState(false);
|
|
113
|
+
useEffect(() => {
|
|
114
|
+
const fetchRevertRelations = async () => {
|
|
115
|
+
const { post } = getFetchClient();
|
|
116
|
+
const response = await post(`/${pluginId}/fetch-revert-relations`, {
|
|
117
|
+
documentId,
|
|
118
|
+
uid,
|
|
119
|
+
isSingleType
|
|
120
|
+
});
|
|
121
|
+
setLinkedContent(Array.isArray(response.data) ? response.data.filter(Boolean) : []);
|
|
122
|
+
setLoading(false);
|
|
123
|
+
};
|
|
124
|
+
fetchRevertRelations();
|
|
125
|
+
}, []);
|
|
126
|
+
if (loading)
|
|
127
|
+
return /* @__PURE__ */ jsx(Box, { width: "100%", children: /* @__PURE__ */ jsx(Loader, {}) });
|
|
128
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
129
|
+
/* @__PURE__ */ jsx(Divider, {}),
|
|
130
|
+
/* @__PURE__ */ jsxs(Box, { width: "100%", marginTop: 4, children: [
|
|
131
|
+
/* @__PURE__ */ jsx(Flex, { children: /* @__PURE__ */ jsx(
|
|
132
|
+
Typography,
|
|
133
|
+
{
|
|
134
|
+
variant: "sigma",
|
|
135
|
+
fontWeight: "bold",
|
|
136
|
+
textTransform: "uppercase",
|
|
137
|
+
marginBottom: 1,
|
|
138
|
+
textColor: "neutral600",
|
|
139
|
+
children: translate("sidePanel.linkedContent")
|
|
140
|
+
}
|
|
141
|
+
) }),
|
|
142
|
+
linkedContent.length > 0 ? /* @__PURE__ */ jsx(Flex, { children: /* @__PURE__ */ jsxs(Typography, { variant: "omega", textColor: "neutral600", marginBottom: 3, children: [
|
|
143
|
+
translate("sidePanel.referencedIn"),
|
|
144
|
+
" ",
|
|
145
|
+
linkedContent.length,
|
|
146
|
+
" ",
|
|
147
|
+
translate("sidePanel.otherContents")
|
|
148
|
+
] }) }) : /* @__PURE__ */ jsx(Flex, { children: /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral600", marginBottom: 3, children: translate("sidePanel.notReferenced") }) }),
|
|
149
|
+
/* @__PURE__ */ jsx(Box, { marginTop: 2, children: linkedContent.map((content, idx) => /* @__PURE__ */ jsxs(
|
|
150
|
+
Box,
|
|
151
|
+
{
|
|
152
|
+
marginBottom: idx < linkedContent.length - 1 ? 3 : 0,
|
|
153
|
+
children: [
|
|
154
|
+
/* @__PURE__ */ jsxs(
|
|
155
|
+
Flex,
|
|
156
|
+
{
|
|
157
|
+
direction: "row",
|
|
158
|
+
justifyContent: "space-between",
|
|
159
|
+
alignItems: "flex-start",
|
|
160
|
+
paddingY: 2,
|
|
161
|
+
paddingX: 3,
|
|
162
|
+
children: [
|
|
163
|
+
/* @__PURE__ */ jsxs(Box, { children: [
|
|
164
|
+
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(
|
|
165
|
+
"a",
|
|
166
|
+
{
|
|
167
|
+
href: content.isSingleType ? `/admin/content-manager/single-types/${content.uid}` : `/admin/content-manager/collection-types/${content.uid}/${content.documentId}`,
|
|
168
|
+
target: "_blank",
|
|
169
|
+
style: { textDecoration: "none" },
|
|
170
|
+
children: /* @__PURE__ */ jsx(
|
|
171
|
+
Typography,
|
|
172
|
+
{
|
|
173
|
+
children: content.title ?? content.documentId
|
|
174
|
+
}
|
|
175
|
+
)
|
|
176
|
+
}
|
|
177
|
+
) }),
|
|
178
|
+
/* @__PURE__ */ jsx(Box, { marginTop: 1, children: /* @__PURE__ */ jsxs(
|
|
179
|
+
Typography,
|
|
180
|
+
{
|
|
181
|
+
variant: "pi",
|
|
182
|
+
textColor: "neutral600",
|
|
183
|
+
style: { lineHeight: 1.2 },
|
|
184
|
+
children: [
|
|
185
|
+
translate("sidePanel.field"),
|
|
186
|
+
" ",
|
|
187
|
+
content.field
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
) })
|
|
191
|
+
] }),
|
|
192
|
+
/* @__PURE__ */ jsx(Box, { marginLeft: 2, children: /* @__PURE__ */ jsx(CardBadge, { children: content.type }) })
|
|
193
|
+
]
|
|
194
|
+
}
|
|
195
|
+
),
|
|
196
|
+
idx < linkedContent.length - 1 && /* @__PURE__ */ jsx(Box, { marginY: 1, children: /* @__PURE__ */ jsx(Divider, {}) })
|
|
197
|
+
]
|
|
198
|
+
},
|
|
199
|
+
content.documentId
|
|
200
|
+
)) })
|
|
201
|
+
] })
|
|
202
|
+
] });
|
|
203
|
+
};
|
|
204
|
+
const name = pluginPkg.strapi.name;
|
|
205
|
+
const index = {
|
|
206
|
+
async register(app) {
|
|
207
|
+
const contentTypes = await listContentTypes();
|
|
208
|
+
setContentTypes(contentTypes);
|
|
209
|
+
app.customFields.register({
|
|
210
|
+
name,
|
|
211
|
+
pluginId,
|
|
212
|
+
type: "richtext",
|
|
213
|
+
intlLabel: {
|
|
214
|
+
id: "multi-content-type-relation.text-ai.label",
|
|
215
|
+
defaultMessage: "Multi Content Type Relation"
|
|
216
|
+
},
|
|
217
|
+
intlDescription: {
|
|
218
|
+
id: "multi-content-type-relation.text-ai.description",
|
|
219
|
+
defaultMessage: "Write content types separated by commas"
|
|
220
|
+
},
|
|
221
|
+
icon: PluginIcon,
|
|
222
|
+
// don't forget to create/import your icon component
|
|
223
|
+
components: {
|
|
224
|
+
Input: () => import(
|
|
225
|
+
/* webpackChunkName: "input-component" */
|
|
226
|
+
"./index-D6nv39Fp.mjs"
|
|
227
|
+
)
|
|
228
|
+
},
|
|
229
|
+
inputSize: {
|
|
230
|
+
default: 12,
|
|
231
|
+
isResizable: false
|
|
232
|
+
},
|
|
233
|
+
options: {
|
|
234
|
+
base: [
|
|
235
|
+
/*
|
|
236
|
+
Declare settings to be added to the "Base settings" section
|
|
237
|
+
of the field in the Content-Type Builder
|
|
238
|
+
*/
|
|
239
|
+
{
|
|
240
|
+
sectionTitle: {
|
|
241
|
+
id: "multi-content-type-relation.text-ai.length",
|
|
242
|
+
defaultMessage: "Content types"
|
|
243
|
+
},
|
|
244
|
+
items: contentTypes.map((contentType) => {
|
|
245
|
+
const value = contentType.info.singularName;
|
|
246
|
+
return {
|
|
247
|
+
intlLabel: {
|
|
248
|
+
id: `multi-content-type-relation.options.${contentType.uid}`,
|
|
249
|
+
defaultMessage: contentType.info.displayName
|
|
250
|
+
},
|
|
251
|
+
type: "checkbox",
|
|
252
|
+
name: `options.contentTypes.${value}`
|
|
253
|
+
};
|
|
254
|
+
})
|
|
255
|
+
}
|
|
256
|
+
],
|
|
257
|
+
advanced: [
|
|
258
|
+
{
|
|
259
|
+
sectionTitle: {
|
|
260
|
+
id: "global.settings",
|
|
261
|
+
defaultMessage: "Settings"
|
|
262
|
+
},
|
|
263
|
+
items: [
|
|
264
|
+
{
|
|
265
|
+
name: "required",
|
|
266
|
+
type: "checkbox",
|
|
267
|
+
intlLabel: {
|
|
268
|
+
id: "content-type-relation-select.options.advanced.requiredField",
|
|
269
|
+
defaultMessage: "Required field"
|
|
270
|
+
},
|
|
271
|
+
description: {
|
|
272
|
+
id: "content-type-relation-select.options.advanced.requiredField.description",
|
|
273
|
+
defaultMessage: "You won't be able to create an entry if this field is empty"
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
{
|
|
277
|
+
name: "options.min",
|
|
278
|
+
type: "number",
|
|
279
|
+
intlLabel: {
|
|
280
|
+
id: "content-type-relation-select.options.advanced.minField",
|
|
281
|
+
defaultMessage: "Minimum values"
|
|
282
|
+
},
|
|
283
|
+
description: {
|
|
284
|
+
id: "content-type-relation-select.options.advanced.minField.description",
|
|
285
|
+
defaultMessage: "Minimum number of entries"
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
name: "options.max",
|
|
290
|
+
type: "number",
|
|
291
|
+
intlLabel: {
|
|
292
|
+
id: "content-type-relation-select.options.advanced.maxField",
|
|
293
|
+
defaultMessage: "Maximum values"
|
|
294
|
+
},
|
|
295
|
+
description: {
|
|
296
|
+
id: "content-type-relation-select.options.advanced.maxField.description",
|
|
297
|
+
defaultMessage: "Maximum number of entries"
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
]
|
|
301
|
+
}
|
|
302
|
+
]
|
|
303
|
+
}
|
|
304
|
+
});
|
|
305
|
+
},
|
|
306
|
+
bootstrap(app) {
|
|
307
|
+
app.getPlugin("content-manager").injectComponent("editView", "right-links", {
|
|
308
|
+
name: "side-panel",
|
|
309
|
+
Component: SidePanel
|
|
310
|
+
});
|
|
311
|
+
},
|
|
312
|
+
async registerTrads(app) {
|
|
313
|
+
const { locales } = app;
|
|
314
|
+
const importedTrads = await Promise.all(
|
|
315
|
+
locales.map(async (locale) => {
|
|
316
|
+
const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/en.json": () => import("./en-Cj4T04Z2.mjs"), "./translations/fr.json": () => import("./fr-KHPiQOFP.mjs") }), `./translations/${locale}.json`, 3);
|
|
317
|
+
return {
|
|
318
|
+
data,
|
|
319
|
+
locale
|
|
320
|
+
};
|
|
321
|
+
})
|
|
322
|
+
);
|
|
323
|
+
return Promise.resolve(importedTrads);
|
|
324
|
+
}
|
|
325
|
+
};
|
|
326
|
+
export {
|
|
327
|
+
formatToStrapiField as a,
|
|
328
|
+
fetchMatchingContent as f,
|
|
329
|
+
getContentTypeForUid as g,
|
|
330
|
+
index as i,
|
|
331
|
+
useTranslate as u,
|
|
332
|
+
validateCurrentRelations as v
|
|
333
|
+
};
|