@webbio/strapi-plugin-page-builder 0.12.2-platform → 0.12.4-platform
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +166 -166
- package/admin/src/api/collection-type.ts +111 -111
- package/admin/src/api/entity-relation.ts +42 -42
- package/admin/src/api/has-page-relation.ts +37 -37
- package/admin/src/api/has-platform-relation.ts +40 -40
- package/admin/src/api/page-type-relation.ts +41 -41
- package/admin/src/api/platform-page-types.ts +45 -45
- package/admin/src/api/platform-relation.ts +42 -42
- package/admin/src/api/platform.ts +35 -35
- package/admin/src/api/search-filtered-entity.ts +114 -114
- package/admin/src/api/template.ts +39 -39
- package/admin/src/components/Combobox/index.tsx +83 -83
- package/admin/src/components/Combobox/react-select-custom-styles.tsx +121 -121
- package/admin/src/components/Combobox/styles.ts +46 -46
- package/admin/src/components/ConfirmModal/index.tsx +90 -90
- package/admin/src/components/EditView/CollectionTypeSearch/index.tsx +127 -127
- package/admin/src/components/EditView/CollectionTypeSettings/CreatePageButton/index.tsx +149 -149
- package/admin/src/components/EditView/CollectionTypeSettings/CreatePageButton/styles.ts +19 -19
- package/admin/src/components/EditView/CollectionTypeSettings/index.tsx +82 -82
- package/admin/src/components/EditView/Details/index.tsx +48 -48
- package/admin/src/components/EditView/Details/styles.ts +51 -51
- package/admin/src/components/EditView/PageSettings/index.tsx +124 -124
- package/admin/src/components/EditView/Platform/platform-select.tsx +30 -30
- package/admin/src/components/EditView/Template/TemplateConfirmModal/index.tsx +36 -36
- package/admin/src/components/EditView/Template/TemplateSelect/index.tsx +70 -70
- package/admin/src/components/EditView/Template/TemplateSelect/use-template-modules.ts +41 -41
- package/admin/src/components/EditView/index.tsx +35 -35
- package/admin/src/components/EditView/page-type-select.tsx +32 -32
- package/admin/src/components/EditView/wrapper.tsx +41 -41
- package/admin/src/components/GlobalPlatformSelect/index.tsx +40 -40
- package/admin/src/components/GlobalPlatformSelect/styles.ts +27 -27
- package/admin/src/components/Initializer/index.tsx +24 -24
- package/admin/src/components/PageFilters/PageTypeFilter/index.tsx +39 -39
- package/admin/src/components/PageFilters/PlatformFilter/index.tsx +32 -32
- package/admin/src/components/PageFilters/filters.tsx +189 -189
- package/admin/src/components/PageFilters/index.tsx +35 -35
- package/admin/src/components/PageTypeEditView/TemplatePlatformSelect/index.tsx +76 -76
- package/admin/src/components/PageTypeEditView/index.tsx +53 -53
- package/admin/src/components/PlatformFilteredSelectField/InputIcon/index.tsx +23 -23
- package/admin/src/components/PlatformFilteredSelectField/Multi/index.tsx +210 -210
- package/admin/src/components/PlatformFilteredSelectField/Single/index.tsx +197 -197
- package/admin/src/components/PlatformFilteredSelectField/hooks/useRelationLoad.tsx +128 -128
- package/admin/src/components/PlatformFilteredSelectField/index.tsx +85 -85
- package/admin/src/components/PlatformFilteredSelectField/styles.tsx +77 -77
- package/admin/src/components/PlatformFilteredSelectField/utils/get-translations.ts +3 -3
- package/admin/src/components/PlatformFilteredSelectField/utils/relation-helper.ts +147 -147
- package/admin/src/components/PluginIcon/index.tsx +94 -94
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/components/Relations/RelationInput.tsx +689 -689
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/components/Relations/RelationInputDataManager.tsx +6 -6
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/components/Relations/useRelation.ts +170 -170
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/components/Relations/utils/getRelationLink.ts +5 -5
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/components/Relations/utils/normalizeRelations.ts +52 -52
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/constants/attributes.ts +3 -3
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/hooks/useDragAndDrop.ts +253 -253
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/hooks/useKeyboardDragAndDrop.ts +96 -96
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/hooks/usePrev.ts +11 -11
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/utils/dragAndDrop.ts +8 -8
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/utils/paths.ts +29 -29
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/utils/refs.ts +19 -19
- package/admin/src/components/StrapiCore/admin/admin/src/content-manager/utils/translations.ts +3 -3
- package/admin/src/components/StrapiCore/content-manager/shared/contracts/collection-types.ts +300 -300
- package/admin/src/components/StrapiCore/content-manager/shared/contracts/components.ts +72 -72
- package/admin/src/components/StrapiCore/content-manager/shared/contracts/content-types.ts +116 -116
- package/admin/src/components/StrapiCore/content-manager/shared/contracts/index.ts +8 -8
- package/admin/src/components/StrapiCore/content-manager/shared/contracts/init.ts +22 -22
- package/admin/src/components/StrapiCore/content-manager/shared/contracts/relations.ts +80 -80
- package/admin/src/components/StrapiCore/content-manager/shared/contracts/review-workflows.ts +88 -88
- package/admin/src/components/StrapiCore/content-manager/shared/contracts/single-types.ts +112 -112
- package/admin/src/components/StrapiCore/content-manager/shared/contracts/uid.ts +48 -48
- package/admin/src/components/StrapiCore/content-manager/shared/index.ts +1 -1
- package/admin/src/constants.ts +3 -3
- package/admin/src/index.tsx +101 -101
- package/admin/src/middlewares/index.tsx +37 -37
- package/admin/src/pages/app/index.tsx +14 -14
- package/admin/src/pluginId.ts +5 -5
- package/admin/src/translations/en.json +9 -9
- package/admin/src/translations/nl.json +9 -9
- package/admin/src/utils/findDomElement.ts +6 -6
- package/admin/src/utils/findElementParent.ts +20 -20
- package/admin/src/utils/getObjectFromFormName.ts +42 -42
- package/admin/src/utils/getRequestUrl.ts +11 -11
- package/admin/src/utils/getTrad.ts +5 -5
- package/admin/src/utils/hooks/useDebounce.ts +17 -17
- package/admin/src/utils/hooks/useDefaultPlatformFromLocalStorage.ts +61 -61
- package/admin/src/utils/hooks/useGetLocaleFromUrl.ts +9 -9
- package/admin/src/utils/hooks/useHideOverviewFilterTags.ts +34 -34
- package/admin/src/utils/hooks/usePlatformFormData.ts +64 -64
- package/admin/src/utils/hooks/usePrevious.ts +12 -12
- package/admin/src/utils/sanitizeModules.ts +93 -93
- package/custom.d.ts +6 -6
- package/dist/package.json +1 -1
- package/dist/server/bootstrap/collection-type-lifecycles.js +1 -1
- package/dist/server/bootstrap.js +1 -1
- package/dist/server/graphql/page-by-path.js +20 -17
- package/dist/server/graphql/page-by-slug.js +9 -9
- package/dist/server/graphql/pages-by-uid.js +5 -5
- package/dist/server/services/private-content/graphql/index.js +27 -27
- package/dist/server/services/private-content/graphql/types/index.js +74 -74
- package/dist/server/utils/graphql.js +18 -18
- package/dist/tsconfig.server.tsbuildinfo +1 -1
- package/package.json +78 -78
- package/server/bootstrap/collection-type-lifecycles.ts +47 -47
- package/server/bootstrap/permissions.ts +161 -161
- package/server/bootstrap.ts +261 -261
- package/server/config/index.ts +4 -4
- package/server/content-types/index.ts +7 -7
- package/server/content-types/user-category/schema.json +23 -23
- package/server/controllers/collection-types.ts +32 -32
- package/server/controllers/index.ts +19 -19
- package/server/controllers/page-type.ts +18 -18
- package/server/controllers/page.ts +9 -9
- package/server/controllers/platform.ts +21 -21
- package/server/controllers/private-content.ts +17 -17
- package/server/controllers/sitemap.ts +32 -32
- package/server/controllers/template.ts +16 -16
- package/server/controllers/user-category.ts +3 -3
- package/server/destroy.ts +5 -5
- package/server/graphql/index.ts +9 -9
- package/server/graphql/page-by-path.ts +135 -132
- package/server/graphql/page-type.ts +67 -67
- package/server/graphql/pages-by-uid.ts +89 -89
- package/server/index.ts +23 -23
- package/server/middlewares/index.ts +1 -1
- package/server/policies/index.ts +5 -5
- package/server/policies/isAuthorizedPage.ts +11 -11
- package/server/register.ts +22 -22
- package/server/routes/index.ts +115 -115
- package/server/routes/user-category.ts +3 -3
- package/server/schema/page-end.json +96 -96
- package/server/schema/page-start.json +87 -87
- package/server/schema/page-type-end.json +53 -53
- package/server/schema/page-type-start.json +38 -38
- package/server/schema/platform-start.json +21 -21
- package/server/schema/template-end.json +40 -40
- package/server/schema/template-start.json +35 -35
- package/server/services/builder.ts +232 -232
- package/server/services/collection-types.ts +95 -95
- package/server/services/email.ts +127 -127
- package/server/services/index.ts +23 -23
- package/server/services/page-type.ts +30 -30
- package/server/services/page.ts +24 -24
- package/server/services/platform.ts +30 -30
- package/server/services/private-content/components/admin-email.json +22 -22
- package/server/services/private-content/components/email.json +22 -22
- package/server/services/private-content/components/platform-email.json +30 -30
- package/server/services/private-content/constants/index.ts +13 -13
- package/server/services/private-content/graphql/index.ts +88 -88
- package/server/services/private-content/graphql/resolvers/findOnePage.ts +40 -40
- package/server/services/private-content/graphql/resolvers/findPage.ts +45 -45
- package/server/services/private-content/graphql/resolvers/forgot-password.ts +34 -34
- package/server/services/private-content/graphql/resolvers/login.ts +56 -56
- package/server/services/private-content/graphql/resolvers/register.ts +78 -78
- package/server/services/private-content/graphql/resolvers/reset-password.ts +44 -44
- package/server/services/private-content/graphql/types/index.ts +96 -96
- package/server/services/private-content/index.ts +95 -95
- package/server/services/private-content/mail-template/txtMail.email.template.text.ts +6 -6
- package/server/services/private-content/page.ts +20 -20
- package/server/services/private-content/platform.ts +19 -19
- package/server/services/private-content/schemas/index.ts +28 -28
- package/server/services/private-content/user.ts +197 -197
- package/server/services/sitemap.ts +83 -83
- package/server/services/template.ts +13 -13
- package/server/services/user-category.ts +3 -3
- package/server/utils/filter-underscore-arguments.ts +12 -12
- package/server/utils/reload-strapi-on-load.ts +13 -13
- package/server/utils/strapi.ts +50 -50
- package/shared/utils/constants.ts +8 -8
- package/shared/utils/sleep.ts +1 -1
- package/strapi-admin.js +3 -3
- package/strapi-server.js +3 -3
- package/tsconfig.json +20 -20
- package/tsconfig.server.json +25 -25
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
import React, { useEffect, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import { useCMEditViewDataManager } from '@strapi/helper-plugin';
|
|
4
|
-
import { Flex } from '@strapi/design-system';
|
|
5
|
-
import { Link } from '@strapi/icons';
|
|
6
|
-
|
|
7
|
-
import { Wrapper } from '../wrapper';
|
|
8
|
-
import { CreatePageButton } from './CreatePageButton';
|
|
9
|
-
import { PAGE_TYPE_PAGE, PAGE_UID } from '../../../../../shared/utils/constants';
|
|
10
|
-
import { usePlatformFormData } from '../../../utils/hooks/usePlatformFormData';
|
|
11
|
-
import S from '../Details/styles';
|
|
12
|
-
|
|
13
|
-
interface CollectionTypeSettingsProps {
|
|
14
|
-
onlyPlatform?: boolean;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const CollectionTypeSettings = ({ onlyPlatform }: CollectionTypeSettingsProps) => {
|
|
18
|
-
const form = (useCMEditViewDataManager() || {}) as Record<string, any>;
|
|
19
|
-
const { selectedPlatform, isLoadingPlatform } = usePlatformFormData(form);
|
|
20
|
-
const { layout, isCreatingEntry, initialData, modifiedData, onChange } = form;
|
|
21
|
-
const isUserCreatedContentType = layout.uid.startsWith('api::');
|
|
22
|
-
const [linkedPage, setLinkedPage] = useState<Record<string, any> | undefined>(initialData.page?.[0]);
|
|
23
|
-
|
|
24
|
-
const showCreatePageButton = isUserCreatedContentType && !isCreatingEntry && !linkedPage && !isLoadingPlatform;
|
|
25
|
-
const url = generateLink(linkedPage?.id, initialData?.locale);
|
|
26
|
-
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
if (modifiedData.page?.[0]) {
|
|
29
|
-
setLinkedPage(modifiedData.page?.[0]);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (modifiedData.page === null) {
|
|
33
|
-
setLinkedPage(undefined);
|
|
34
|
-
}
|
|
35
|
-
}, [modifiedData.page?.[0]]);
|
|
36
|
-
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
if (isCreatingEntry) {
|
|
39
|
-
onChange({
|
|
40
|
-
target: {
|
|
41
|
-
name: 'page',
|
|
42
|
-
value: null
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}, []);
|
|
47
|
-
|
|
48
|
-
return (
|
|
49
|
-
<>
|
|
50
|
-
{!isCreatingEntry && !onlyPlatform && (
|
|
51
|
-
<Wrapper title="Gekoppelde pagina">
|
|
52
|
-
<Flex direction="column" gap={4} width="100%" alignItems="start">
|
|
53
|
-
{showCreatePageButton && selectedPlatform && (
|
|
54
|
-
<CreatePageButton onCreatedPage={(page) => setLinkedPage(page)} selectedPlatform={selectedPlatform} />
|
|
55
|
-
)}
|
|
56
|
-
|
|
57
|
-
{url && (
|
|
58
|
-
<Flex direction="column" alignItems="start" width="100%" gap={1}>
|
|
59
|
-
<S.SubtleType variant="omega" fontWeight="bold" textColor="neutral800">
|
|
60
|
-
{PAGE_TYPE_PAGE}
|
|
61
|
-
</S.SubtleType>
|
|
62
|
-
<S.EntityLinkWrapper variant="pi" textColor="neutral800">
|
|
63
|
-
<S.EntityLink title={linkedPage?.title || '-'} to={url} variant="pi">
|
|
64
|
-
<Link />
|
|
65
|
-
{linkedPage?.title || '-'}
|
|
66
|
-
</S.EntityLink>
|
|
67
|
-
</S.EntityLinkWrapper>
|
|
68
|
-
</Flex>
|
|
69
|
-
)}
|
|
70
|
-
</Flex>
|
|
71
|
-
</Wrapper>
|
|
72
|
-
)}
|
|
73
|
-
</>
|
|
74
|
-
);
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
const generateLink = (entityId?: string, locale?: string) => {
|
|
78
|
-
if (!entityId) {
|
|
79
|
-
return '';
|
|
80
|
-
}
|
|
81
|
-
return `/content-manager/collectionType/${PAGE_UID}/${entityId}?plugins[i18n][locale]=${locale}`;
|
|
82
|
-
};
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { useCMEditViewDataManager } from '@strapi/helper-plugin';
|
|
4
|
+
import { Flex } from '@strapi/design-system';
|
|
5
|
+
import { Link } from '@strapi/icons';
|
|
6
|
+
|
|
7
|
+
import { Wrapper } from '../wrapper';
|
|
8
|
+
import { CreatePageButton } from './CreatePageButton';
|
|
9
|
+
import { PAGE_TYPE_PAGE, PAGE_UID } from '../../../../../shared/utils/constants';
|
|
10
|
+
import { usePlatformFormData } from '../../../utils/hooks/usePlatformFormData';
|
|
11
|
+
import S from '../Details/styles';
|
|
12
|
+
|
|
13
|
+
interface CollectionTypeSettingsProps {
|
|
14
|
+
onlyPlatform?: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const CollectionTypeSettings = ({ onlyPlatform }: CollectionTypeSettingsProps) => {
|
|
18
|
+
const form = (useCMEditViewDataManager() || {}) as Record<string, any>;
|
|
19
|
+
const { selectedPlatform, isLoadingPlatform } = usePlatformFormData(form);
|
|
20
|
+
const { layout, isCreatingEntry, initialData, modifiedData, onChange } = form;
|
|
21
|
+
const isUserCreatedContentType = layout.uid.startsWith('api::');
|
|
22
|
+
const [linkedPage, setLinkedPage] = useState<Record<string, any> | undefined>(initialData.page?.[0]);
|
|
23
|
+
|
|
24
|
+
const showCreatePageButton = isUserCreatedContentType && !isCreatingEntry && !linkedPage && !isLoadingPlatform;
|
|
25
|
+
const url = generateLink(linkedPage?.id, initialData?.locale);
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (modifiedData.page?.[0]) {
|
|
29
|
+
setLinkedPage(modifiedData.page?.[0]);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (modifiedData.page === null) {
|
|
33
|
+
setLinkedPage(undefined);
|
|
34
|
+
}
|
|
35
|
+
}, [modifiedData.page?.[0]]);
|
|
36
|
+
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
if (isCreatingEntry) {
|
|
39
|
+
onChange({
|
|
40
|
+
target: {
|
|
41
|
+
name: 'page',
|
|
42
|
+
value: null
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
}, []);
|
|
47
|
+
|
|
48
|
+
return (
|
|
49
|
+
<>
|
|
50
|
+
{!isCreatingEntry && !onlyPlatform && (
|
|
51
|
+
<Wrapper title="Gekoppelde pagina">
|
|
52
|
+
<Flex direction="column" gap={4} width="100%" alignItems="start">
|
|
53
|
+
{showCreatePageButton && selectedPlatform && (
|
|
54
|
+
<CreatePageButton onCreatedPage={(page) => setLinkedPage(page)} selectedPlatform={selectedPlatform} />
|
|
55
|
+
)}
|
|
56
|
+
|
|
57
|
+
{url && (
|
|
58
|
+
<Flex direction="column" alignItems="start" width="100%" gap={1}>
|
|
59
|
+
<S.SubtleType variant="omega" fontWeight="bold" textColor="neutral800">
|
|
60
|
+
{PAGE_TYPE_PAGE}
|
|
61
|
+
</S.SubtleType>
|
|
62
|
+
<S.EntityLinkWrapper variant="pi" textColor="neutral800">
|
|
63
|
+
<S.EntityLink title={linkedPage?.title || '-'} to={url} variant="pi">
|
|
64
|
+
<Link />
|
|
65
|
+
{linkedPage?.title || '-'}
|
|
66
|
+
</S.EntityLink>
|
|
67
|
+
</S.EntityLinkWrapper>
|
|
68
|
+
</Flex>
|
|
69
|
+
)}
|
|
70
|
+
</Flex>
|
|
71
|
+
</Wrapper>
|
|
72
|
+
)}
|
|
73
|
+
</>
|
|
74
|
+
);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const generateLink = (entityId?: string, locale?: string) => {
|
|
78
|
+
if (!entityId) {
|
|
79
|
+
return '';
|
|
80
|
+
}
|
|
81
|
+
return `/content-manager/collectionType/${PAGE_UID}/${entityId}?plugins[i18n][locale]=${locale}`;
|
|
82
|
+
};
|
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import { Flex } from '@strapi/design-system';
|
|
4
|
-
import { Link } from '@strapi/icons';
|
|
5
|
-
|
|
6
|
-
import { PageType } from '../../../api/platform-page-types';
|
|
7
|
-
import { PAGE_TYPE_PAGE } from '../../../../../shared/utils/constants';
|
|
8
|
-
import S from './styles';
|
|
9
|
-
|
|
10
|
-
interface Props {
|
|
11
|
-
pageType?: PageType | null;
|
|
12
|
-
entityId?: number;
|
|
13
|
-
entityTitle?: string;
|
|
14
|
-
locale?: string;
|
|
15
|
-
platformTitle?: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const Details = (props: Props) => {
|
|
19
|
-
const { entityTitle, pageType } = props;
|
|
20
|
-
|
|
21
|
-
const url = generateLink(props);
|
|
22
|
-
|
|
23
|
-
return (
|
|
24
|
-
<Flex gap={4} width="100%" direction="column">
|
|
25
|
-
<Flex direction="column" alignItems="start" width="100%" gap={1}>
|
|
26
|
-
<S.SubtleType variant="omega" fontWeight="bold" textColor="neutral800">
|
|
27
|
-
{pageType?.title || PAGE_TYPE_PAGE}
|
|
28
|
-
</S.SubtleType>
|
|
29
|
-
<S.EntityLinkWrapper variant="pi" textColor="neutral800">
|
|
30
|
-
<S.EntityLink title={entityTitle} to={url} variant="pi">
|
|
31
|
-
<Link />
|
|
32
|
-
{entityTitle}
|
|
33
|
-
</S.EntityLink>
|
|
34
|
-
</S.EntityLinkWrapper>
|
|
35
|
-
</Flex>
|
|
36
|
-
</Flex>
|
|
37
|
-
);
|
|
38
|
-
};
|
|
39
|
-
|
|
40
|
-
export { Details };
|
|
41
|
-
|
|
42
|
-
const generateLink = ({ locale, pageType, entityId }: Props) => {
|
|
43
|
-
if (!pageType?.uid || !entityId) {
|
|
44
|
-
return '';
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return `/content-manager/collectionType/${pageType.uid}/${entityId}?plugins[i18n][locale]=${locale}`;
|
|
48
|
-
};
|
|
1
|
+
import React from 'react';
|
|
2
|
+
|
|
3
|
+
import { Flex } from '@strapi/design-system';
|
|
4
|
+
import { Link } from '@strapi/icons';
|
|
5
|
+
|
|
6
|
+
import { PageType } from '../../../api/platform-page-types';
|
|
7
|
+
import { PAGE_TYPE_PAGE } from '../../../../../shared/utils/constants';
|
|
8
|
+
import S from './styles';
|
|
9
|
+
|
|
10
|
+
interface Props {
|
|
11
|
+
pageType?: PageType | null;
|
|
12
|
+
entityId?: number;
|
|
13
|
+
entityTitle?: string;
|
|
14
|
+
locale?: string;
|
|
15
|
+
platformTitle?: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const Details = (props: Props) => {
|
|
19
|
+
const { entityTitle, pageType } = props;
|
|
20
|
+
|
|
21
|
+
const url = generateLink(props);
|
|
22
|
+
|
|
23
|
+
return (
|
|
24
|
+
<Flex gap={4} width="100%" direction="column">
|
|
25
|
+
<Flex direction="column" alignItems="start" width="100%" gap={1}>
|
|
26
|
+
<S.SubtleType variant="omega" fontWeight="bold" textColor="neutral800">
|
|
27
|
+
{pageType?.title || PAGE_TYPE_PAGE}
|
|
28
|
+
</S.SubtleType>
|
|
29
|
+
<S.EntityLinkWrapper variant="pi" textColor="neutral800">
|
|
30
|
+
<S.EntityLink title={entityTitle} to={url} variant="pi">
|
|
31
|
+
<Link />
|
|
32
|
+
{entityTitle}
|
|
33
|
+
</S.EntityLink>
|
|
34
|
+
</S.EntityLinkWrapper>
|
|
35
|
+
</Flex>
|
|
36
|
+
</Flex>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export { Details };
|
|
41
|
+
|
|
42
|
+
const generateLink = ({ locale, pageType, entityId }: Props) => {
|
|
43
|
+
if (!pageType?.uid || !entityId) {
|
|
44
|
+
return '';
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return `/content-manager/collectionType/${pageType.uid}/${entityId}?plugins[i18n][locale]=${locale}`;
|
|
48
|
+
};
|
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
import styled, { css } from 'styled-components';
|
|
2
|
-
|
|
3
|
-
import { Typography, Link, Button } from '@strapi/design-system';
|
|
4
|
-
|
|
5
|
-
const SubtleType = styled(Typography)`
|
|
6
|
-
${({ _theme }) => css`
|
|
7
|
-
text-transform: capitalize;
|
|
8
|
-
`}
|
|
9
|
-
`;
|
|
10
|
-
|
|
11
|
-
const EntityLinkWrapper = styled(Typography)`
|
|
12
|
-
${({ _theme }) => css`
|
|
13
|
-
display: flex;
|
|
14
|
-
`}
|
|
15
|
-
`;
|
|
16
|
-
|
|
17
|
-
const EntityLink = styled(Link)`
|
|
18
|
-
${({ _theme }) => css`
|
|
19
|
-
span {
|
|
20
|
-
line-height: 1.2;
|
|
21
|
-
font-size: inherit;
|
|
22
|
-
display: flex;
|
|
23
|
-
gap: 4px;
|
|
24
|
-
align-items: center;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
svg {
|
|
28
|
-
width: 0.7rem;
|
|
29
|
-
height: 0.7rem;
|
|
30
|
-
}
|
|
31
|
-
`}
|
|
32
|
-
`;
|
|
33
|
-
|
|
34
|
-
const EditLink = styled(Button)`
|
|
35
|
-
${({ _theme }) => css`
|
|
36
|
-
text-decoration: none;
|
|
37
|
-
|
|
38
|
-
svg {
|
|
39
|
-
flex-shrink: 0;
|
|
40
|
-
}
|
|
41
|
-
`}
|
|
42
|
-
`;
|
|
43
|
-
|
|
44
|
-
const DetailsStyles = {
|
|
45
|
-
SubtleType,
|
|
46
|
-
EntityLink,
|
|
47
|
-
EntityLinkWrapper,
|
|
48
|
-
EditLink
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export default DetailsStyles;
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
|
|
3
|
+
import { Typography, Link, Button } from '@strapi/design-system';
|
|
4
|
+
|
|
5
|
+
const SubtleType = styled(Typography)`
|
|
6
|
+
${({ _theme }) => css`
|
|
7
|
+
text-transform: capitalize;
|
|
8
|
+
`}
|
|
9
|
+
`;
|
|
10
|
+
|
|
11
|
+
const EntityLinkWrapper = styled(Typography)`
|
|
12
|
+
${({ _theme }) => css`
|
|
13
|
+
display: flex;
|
|
14
|
+
`}
|
|
15
|
+
`;
|
|
16
|
+
|
|
17
|
+
const EntityLink = styled(Link)`
|
|
18
|
+
${({ _theme }) => css`
|
|
19
|
+
span {
|
|
20
|
+
line-height: 1.2;
|
|
21
|
+
font-size: inherit;
|
|
22
|
+
display: flex;
|
|
23
|
+
gap: 4px;
|
|
24
|
+
align-items: center;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
svg {
|
|
28
|
+
width: 0.7rem;
|
|
29
|
+
height: 0.7rem;
|
|
30
|
+
}
|
|
31
|
+
`}
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
const EditLink = styled(Button)`
|
|
35
|
+
${({ _theme }) => css`
|
|
36
|
+
text-decoration: none;
|
|
37
|
+
|
|
38
|
+
svg {
|
|
39
|
+
flex-shrink: 0;
|
|
40
|
+
}
|
|
41
|
+
`}
|
|
42
|
+
`;
|
|
43
|
+
|
|
44
|
+
const DetailsStyles = {
|
|
45
|
+
SubtleType,
|
|
46
|
+
EntityLink,
|
|
47
|
+
EntityLinkWrapper,
|
|
48
|
+
EditLink
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export default DetailsStyles;
|
|
@@ -1,124 +1,124 @@
|
|
|
1
|
-
import React, { useEffect, useMemo, useState } from 'react';
|
|
2
|
-
|
|
3
|
-
import { useCMEditViewDataManager } from '@strapi/helper-plugin';
|
|
4
|
-
import { Stack, Flex } from '@strapi/design-system';
|
|
5
|
-
import { Cog, Cross } from '@strapi/icons';
|
|
6
|
-
import { TemplateSelect } from '../Template/TemplateSelect';
|
|
7
|
-
import { PageTypeSelect } from '../page-type-select';
|
|
8
|
-
import { CollectionTypeSearch } from '../CollectionTypeSearch';
|
|
9
|
-
import { Wrapper } from '../wrapper';
|
|
10
|
-
import { Details } from '../Details';
|
|
11
|
-
import { usePlatformFormData } from '../../../utils/hooks/usePlatformFormData';
|
|
12
|
-
import { useGetPageTypesForPlatform } from '../../../api/platform-page-types';
|
|
13
|
-
import S from '../Details/styles';
|
|
14
|
-
import { useGetPageTypeRelation } from '../../../api/page-type-relation';
|
|
15
|
-
|
|
16
|
-
export const PageSettings = () => {
|
|
17
|
-
const form = (useCMEditViewDataManager() || {}) as Record<string, any>;
|
|
18
|
-
const { isCreatingEntry, initialData, onChange, modifiedData, layout } = form;
|
|
19
|
-
const { selectedPlatform, isLoadingPlatform } = usePlatformFormData(form);
|
|
20
|
-
const { data: pageTypeRelation } = useGetPageTypeRelation({
|
|
21
|
-
id: initialData?.id,
|
|
22
|
-
uid: layout.uid
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const { data: pageTypesForPlatform } = useGetPageTypesForPlatform({
|
|
26
|
-
id: selectedPlatform?.id
|
|
27
|
-
});
|
|
28
|
-
const selectedPageType = pageTypesForPlatform?.find(
|
|
29
|
-
(pageType) => pageType.id === Number(modifiedData?.pageType?.[0]?.id || pageTypeRelation?.id)
|
|
30
|
-
);
|
|
31
|
-
|
|
32
|
-
const noPlatformSelected = useMemo(() => !Boolean(selectedPlatform), [selectedPlatform]);
|
|
33
|
-
const [isEditting, setIsEditting] = useState(false);
|
|
34
|
-
const showEditFields = useMemo(
|
|
35
|
-
() => isCreatingEntry || !initialData?.initialPageType?.id || !initialData.collectionTypeTitle || isEditting,
|
|
36
|
-
[isCreatingEntry, isEditting, initialData?.initialPageType, initialData]
|
|
37
|
-
);
|
|
38
|
-
|
|
39
|
-
const setFormValue = (name: string, value?: string | Record<string, any>[]) => {
|
|
40
|
-
onChange({
|
|
41
|
-
target: {
|
|
42
|
-
name,
|
|
43
|
-
value
|
|
44
|
-
},
|
|
45
|
-
shouldSetInitialValue: true
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
useEffect(() => {
|
|
50
|
-
if (!isLoadingPlatform) {
|
|
51
|
-
setIsEditting(false);
|
|
52
|
-
}
|
|
53
|
-
}, [isLoadingPlatform]);
|
|
54
|
-
|
|
55
|
-
const cancelEdit = () => {
|
|
56
|
-
setIsEditting(false);
|
|
57
|
-
setFormValue('pageType', initialData?.initialPageType || []);
|
|
58
|
-
setFormValue('collectionTypeTitle', initialData?.collectionTypeTitle);
|
|
59
|
-
setFormValue('collectionTypeId', initialData?.collectionTypeId);
|
|
60
|
-
setFormValue('platform', modifiedData?.platform);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const removePageType = () => {
|
|
64
|
-
setFormValue('pageType', []);
|
|
65
|
-
setFormValue('collectionTypeTitle', undefined);
|
|
66
|
-
setFormValue('collectionTypeId', undefined);
|
|
67
|
-
};
|
|
68
|
-
|
|
69
|
-
const handleSelectPageType = (pageTypeId: string) => {
|
|
70
|
-
const pageType = pageTypesForPlatform?.find((pageType) => pageType.id === Number(pageTypeId));
|
|
71
|
-
|
|
72
|
-
if (pageType) {
|
|
73
|
-
const formPageType = {
|
|
74
|
-
...pageType,
|
|
75
|
-
mainField: pageType.uid,
|
|
76
|
-
label: pageType.uid,
|
|
77
|
-
value: pageType.id
|
|
78
|
-
};
|
|
79
|
-
setFormValue('pageType', [formPageType]);
|
|
80
|
-
} else {
|
|
81
|
-
removePageType();
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
return (
|
|
86
|
-
<Wrapper title="Gekoppelde type">
|
|
87
|
-
<Flex direction="column" gap={4} width="100%">
|
|
88
|
-
{showEditFields ? (
|
|
89
|
-
<Stack spacing={4} width="100%">
|
|
90
|
-
<PageTypeSelect
|
|
91
|
-
pageTypes={pageTypesForPlatform}
|
|
92
|
-
selectedPageType={selectedPageType}
|
|
93
|
-
onChange={handleSelectPageType}
|
|
94
|
-
disabled={noPlatformSelected}
|
|
95
|
-
/>
|
|
96
|
-
<TemplateSelect disabled={noPlatformSelected} />
|
|
97
|
-
{selectedPageType?.uid && (
|
|
98
|
-
<CollectionTypeSearch uid={selectedPageType.uid} platformTitle={selectedPlatform?.title} />
|
|
99
|
-
)}
|
|
100
|
-
</Stack>
|
|
101
|
-
) : (
|
|
102
|
-
<Details
|
|
103
|
-
locale={initialData?.locale}
|
|
104
|
-
pageType={selectedPageType}
|
|
105
|
-
entityId={modifiedData.collectionTypeId}
|
|
106
|
-
entityTitle={modifiedData.collectionTypeTitle}
|
|
107
|
-
platformTitle={selectedPlatform?.title}
|
|
108
|
-
/>
|
|
109
|
-
)}
|
|
110
|
-
{(!showEditFields || isEditting) && (
|
|
111
|
-
<S.EditLink
|
|
112
|
-
onClick={() => (isEditting ? cancelEdit() : setIsEditting(true))}
|
|
113
|
-
size="S"
|
|
114
|
-
variant={isEditting ? 'danger-light' : 'secondary'}
|
|
115
|
-
startIcon={isEditting ? <Cross /> : <Cog />}
|
|
116
|
-
width="100%"
|
|
117
|
-
>
|
|
118
|
-
{isEditting ? 'Annuleer bewerking' : 'Bewerk koppeling'}
|
|
119
|
-
</S.EditLink>
|
|
120
|
-
)}
|
|
121
|
-
</Flex>
|
|
122
|
-
</Wrapper>
|
|
123
|
-
);
|
|
124
|
-
};
|
|
1
|
+
import React, { useEffect, useMemo, useState } from 'react';
|
|
2
|
+
|
|
3
|
+
import { useCMEditViewDataManager } from '@strapi/helper-plugin';
|
|
4
|
+
import { Stack, Flex } from '@strapi/design-system';
|
|
5
|
+
import { Cog, Cross } from '@strapi/icons';
|
|
6
|
+
import { TemplateSelect } from '../Template/TemplateSelect';
|
|
7
|
+
import { PageTypeSelect } from '../page-type-select';
|
|
8
|
+
import { CollectionTypeSearch } from '../CollectionTypeSearch';
|
|
9
|
+
import { Wrapper } from '../wrapper';
|
|
10
|
+
import { Details } from '../Details';
|
|
11
|
+
import { usePlatformFormData } from '../../../utils/hooks/usePlatformFormData';
|
|
12
|
+
import { useGetPageTypesForPlatform } from '../../../api/platform-page-types';
|
|
13
|
+
import S from '../Details/styles';
|
|
14
|
+
import { useGetPageTypeRelation } from '../../../api/page-type-relation';
|
|
15
|
+
|
|
16
|
+
export const PageSettings = () => {
|
|
17
|
+
const form = (useCMEditViewDataManager() || {}) as Record<string, any>;
|
|
18
|
+
const { isCreatingEntry, initialData, onChange, modifiedData, layout } = form;
|
|
19
|
+
const { selectedPlatform, isLoadingPlatform } = usePlatformFormData(form);
|
|
20
|
+
const { data: pageTypeRelation } = useGetPageTypeRelation({
|
|
21
|
+
id: initialData?.id,
|
|
22
|
+
uid: layout.uid
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const { data: pageTypesForPlatform } = useGetPageTypesForPlatform({
|
|
26
|
+
id: selectedPlatform?.id
|
|
27
|
+
});
|
|
28
|
+
const selectedPageType = pageTypesForPlatform?.find(
|
|
29
|
+
(pageType) => pageType.id === Number(modifiedData?.pageType?.[0]?.id || pageTypeRelation?.id)
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
const noPlatformSelected = useMemo(() => !Boolean(selectedPlatform), [selectedPlatform]);
|
|
33
|
+
const [isEditting, setIsEditting] = useState(false);
|
|
34
|
+
const showEditFields = useMemo(
|
|
35
|
+
() => isCreatingEntry || !initialData?.initialPageType?.id || !initialData.collectionTypeTitle || isEditting,
|
|
36
|
+
[isCreatingEntry, isEditting, initialData?.initialPageType, initialData]
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
const setFormValue = (name: string, value?: string | Record<string, any>[]) => {
|
|
40
|
+
onChange({
|
|
41
|
+
target: {
|
|
42
|
+
name,
|
|
43
|
+
value
|
|
44
|
+
},
|
|
45
|
+
shouldSetInitialValue: true
|
|
46
|
+
});
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
useEffect(() => {
|
|
50
|
+
if (!isLoadingPlatform) {
|
|
51
|
+
setIsEditting(false);
|
|
52
|
+
}
|
|
53
|
+
}, [isLoadingPlatform]);
|
|
54
|
+
|
|
55
|
+
const cancelEdit = () => {
|
|
56
|
+
setIsEditting(false);
|
|
57
|
+
setFormValue('pageType', initialData?.initialPageType || []);
|
|
58
|
+
setFormValue('collectionTypeTitle', initialData?.collectionTypeTitle);
|
|
59
|
+
setFormValue('collectionTypeId', initialData?.collectionTypeId);
|
|
60
|
+
setFormValue('platform', modifiedData?.platform);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const removePageType = () => {
|
|
64
|
+
setFormValue('pageType', []);
|
|
65
|
+
setFormValue('collectionTypeTitle', undefined);
|
|
66
|
+
setFormValue('collectionTypeId', undefined);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const handleSelectPageType = (pageTypeId: string) => {
|
|
70
|
+
const pageType = pageTypesForPlatform?.find((pageType) => pageType.id === Number(pageTypeId));
|
|
71
|
+
|
|
72
|
+
if (pageType) {
|
|
73
|
+
const formPageType = {
|
|
74
|
+
...pageType,
|
|
75
|
+
mainField: pageType.uid,
|
|
76
|
+
label: pageType.uid,
|
|
77
|
+
value: pageType.id
|
|
78
|
+
};
|
|
79
|
+
setFormValue('pageType', [formPageType]);
|
|
80
|
+
} else {
|
|
81
|
+
removePageType();
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
return (
|
|
86
|
+
<Wrapper title="Gekoppelde type">
|
|
87
|
+
<Flex direction="column" gap={4} width="100%">
|
|
88
|
+
{showEditFields ? (
|
|
89
|
+
<Stack spacing={4} width="100%">
|
|
90
|
+
<PageTypeSelect
|
|
91
|
+
pageTypes={pageTypesForPlatform}
|
|
92
|
+
selectedPageType={selectedPageType}
|
|
93
|
+
onChange={handleSelectPageType}
|
|
94
|
+
disabled={noPlatformSelected}
|
|
95
|
+
/>
|
|
96
|
+
<TemplateSelect disabled={noPlatformSelected} />
|
|
97
|
+
{selectedPageType?.uid && (
|
|
98
|
+
<CollectionTypeSearch uid={selectedPageType.uid} platformTitle={selectedPlatform?.title} />
|
|
99
|
+
)}
|
|
100
|
+
</Stack>
|
|
101
|
+
) : (
|
|
102
|
+
<Details
|
|
103
|
+
locale={initialData?.locale}
|
|
104
|
+
pageType={selectedPageType}
|
|
105
|
+
entityId={modifiedData.collectionTypeId}
|
|
106
|
+
entityTitle={modifiedData.collectionTypeTitle}
|
|
107
|
+
platformTitle={selectedPlatform?.title}
|
|
108
|
+
/>
|
|
109
|
+
)}
|
|
110
|
+
{(!showEditFields || isEditting) && (
|
|
111
|
+
<S.EditLink
|
|
112
|
+
onClick={() => (isEditting ? cancelEdit() : setIsEditting(true))}
|
|
113
|
+
size="S"
|
|
114
|
+
variant={isEditting ? 'danger-light' : 'secondary'}
|
|
115
|
+
startIcon={isEditting ? <Cross /> : <Cog />}
|
|
116
|
+
width="100%"
|
|
117
|
+
>
|
|
118
|
+
{isEditting ? 'Annuleer bewerking' : 'Bewerk koppeling'}
|
|
119
|
+
</S.EditLink>
|
|
120
|
+
)}
|
|
121
|
+
</Flex>
|
|
122
|
+
</Wrapper>
|
|
123
|
+
);
|
|
124
|
+
};
|