@webbio/strapi-plugin-page-builder 0.6.0-platform → 0.8.0-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/admin/src/api/has-page-relation.ts +1 -1
- package/admin/src/api/has-platform-relation.ts +1 -1
- package/admin/src/api/platform-page-types.ts +17 -19
- package/admin/src/api/platform.ts +2 -2
- package/admin/src/api/search-filtered-entity.ts +111 -0
- package/admin/src/api/template.ts +10 -7
- package/admin/src/components/Combobox/index.tsx +8 -6
- package/admin/src/components/Combobox/styles.ts +13 -1
- package/admin/src/components/EditView/CollectionTypeSettings/CreatePageButton/index.tsx +6 -2
- package/admin/src/components/EditView/Details/index.tsx +1 -1
- package/admin/src/components/EditView/PageSettings/index.tsx +1 -1
- package/admin/src/components/EditView/Template/TemplateSelect/index.tsx +3 -2
- package/admin/src/components/EditView/Template/TemplateSelect/use-template-modules.ts +5 -2
- package/admin/src/components/EditView/page-type-select.tsx +1 -1
- package/admin/src/components/EditView/wrapper.tsx +13 -7
- package/admin/src/components/GlobalPlatformSelect/index.tsx +0 -1
- package/admin/src/components/PageFilters/PageTypeFilter/index.tsx +1 -1
- package/admin/src/components/PageFilters/filters.tsx +1 -1
- package/admin/src/components/PageFilters/index.tsx +6 -1
- package/admin/src/components/PageTypeEditView/PageByPlatformSelect/index.tsx +112 -0
- package/admin/src/components/PageTypeEditView/TemplatePlatformSelect/index.tsx +55 -0
- package/admin/src/components/PageTypeEditView/index.tsx +28 -0
- package/admin/src/components/PlatformFilteredSelectField/InputIcon/index.tsx +23 -0
- package/admin/src/components/PlatformFilteredSelectField/Multi/index.tsx +191 -0
- package/admin/src/components/PlatformFilteredSelectField/Single/index.tsx +184 -0
- package/admin/src/components/PlatformFilteredSelectField/hooks/useRelationLoad.tsx +124 -0
- package/admin/src/components/PlatformFilteredSelectField/index.tsx +43 -0
- package/admin/src/components/PlatformFilteredSelectField/styles.tsx +77 -0
- package/admin/src/components/PlatformFilteredSelectField/utils/get-translations.ts +3 -0
- package/admin/src/components/PlatformFilteredSelectField/utils/relation-helper.ts +76 -0
- package/admin/src/index.tsx +26 -0
- package/admin/src/translations/en.json +4 -1
- package/admin/src/translations/nl.json +4 -1
- package/admin/src/utils/getObjectFromFormName.ts +31 -0
- package/admin/src/utils/hooks/usePlatformFormData.ts +1 -0
- package/dist/package.json +3 -3
- package/dist/server/controllers/page-type.js +6 -2
- package/dist/server/register.js +5 -0
- package/dist/server/routes/index.js +1 -1
- package/dist/server/schema/page-type-end.json +15 -5
- package/dist/server/schema/platform-start.json +0 -10
- package/dist/server/schema/template-end.json +40 -0
- package/dist/server/services/builder.js +4 -3
- package/dist/server/services/page-type.js +7 -3
- package/dist/tsconfig.server.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/server/controllers/page-type.ts +6 -1
- package/server/register.ts +6 -0
- package/server/routes/index.ts +1 -1
- package/server/schema/page-type-end.json +15 -5
- package/server/schema/platform-start.json +0 -10
- package/server/schema/template-end.json +40 -0
- package/server/services/builder.ts +4 -3
- package/server/services/page-type.ts +7 -3
- package/admin/src/api/page-type.ts +0 -32
- package/dist/server/graphql/page-by-slug.js +0 -82
- package/dist/server/utils/graphql.js +0 -100
- package/dist/server/utils/paginationValidation.js +0 -31
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import styled, { css } from 'styled-components';
|
|
2
|
+
import { Box, Link, Typography } from '@strapi/design-system';
|
|
3
|
+
|
|
4
|
+
const EntityLinkWrapper = styled(Typography)`
|
|
5
|
+
${({ _theme }) => css`
|
|
6
|
+
margin-top: 4px;
|
|
7
|
+
display: flex;
|
|
8
|
+
`}
|
|
9
|
+
`;
|
|
10
|
+
|
|
11
|
+
const EntityLink = styled(Link)`
|
|
12
|
+
${({ _theme }) => css`
|
|
13
|
+
span {
|
|
14
|
+
line-height: 1.2;
|
|
15
|
+
font-size: inherit;
|
|
16
|
+
display: flex;
|
|
17
|
+
gap: 6px;
|
|
18
|
+
align-items: center;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
svg {
|
|
22
|
+
width: 0.7rem;
|
|
23
|
+
height: 0.7rem;
|
|
24
|
+
}
|
|
25
|
+
`}
|
|
26
|
+
`;
|
|
27
|
+
|
|
28
|
+
const CustomOption = styled(Box)`
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
gap: 8px;
|
|
32
|
+
`;
|
|
33
|
+
|
|
34
|
+
const CustomOptionStatus = styled(Box)`
|
|
35
|
+
background: ${({ theme, publicationState }) =>
|
|
36
|
+
publicationState === 'published' ? theme.colors.success600 : theme.colors.secondary600};
|
|
37
|
+
width: 6px;
|
|
38
|
+
height: 6px;
|
|
39
|
+
border-radius: 100px;
|
|
40
|
+
`;
|
|
41
|
+
|
|
42
|
+
const FieldWrapper = styled(Box)`
|
|
43
|
+
display: flex;
|
|
44
|
+
gap: 4px;
|
|
45
|
+
`;
|
|
46
|
+
|
|
47
|
+
const LinkToPage = styled(Link)`
|
|
48
|
+
${({ theme, disabled }) => css`
|
|
49
|
+
height: 40px;
|
|
50
|
+
width: 40px;
|
|
51
|
+
display: flex;
|
|
52
|
+
align-items: center;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
align-self: flex-end;
|
|
55
|
+
flex-shrink: 0;
|
|
56
|
+
border: ${`1px solid ${theme.colors.neutral200}`};
|
|
57
|
+
border-radius: ${theme.borderRadius};
|
|
58
|
+
opacity: ${disabled ? 0.5 : 1};
|
|
59
|
+
> span {
|
|
60
|
+
display: flex;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
svg {
|
|
64
|
+
width: ${theme.fontSizes[2]};
|
|
65
|
+
height: ${theme.fontSizes[2]};
|
|
66
|
+
}
|
|
67
|
+
`}
|
|
68
|
+
`;
|
|
69
|
+
|
|
70
|
+
export default {
|
|
71
|
+
FieldWrapper,
|
|
72
|
+
EntityLinkWrapper,
|
|
73
|
+
EntityLink,
|
|
74
|
+
CustomOptionStatus,
|
|
75
|
+
CustomOption,
|
|
76
|
+
LinkToPage
|
|
77
|
+
};
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { IntlFormatters, MessageDescriptor } from '@formatjs/intl';
|
|
2
|
+
import { getObjectFromFormName } from '../../../utils/getObjectFromFormName';
|
|
3
|
+
|
|
4
|
+
export interface GetTargetAttributesResult {
|
|
5
|
+
targetAttributes?: {
|
|
6
|
+
relation: string;
|
|
7
|
+
relationType: string;
|
|
8
|
+
target: string;
|
|
9
|
+
targetModel: string;
|
|
10
|
+
type: string;
|
|
11
|
+
};
|
|
12
|
+
targetFieldValue?: any;
|
|
13
|
+
targetField: string;
|
|
14
|
+
targetFieldName: string;
|
|
15
|
+
componentUid?: string;
|
|
16
|
+
componentId?: number;
|
|
17
|
+
relationMainFieldName?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface IPlatformFilteredSelectFieldProps {
|
|
21
|
+
intlLabel?: MessageDescriptor & Parameters<IntlFormatters['formatMessage']>;
|
|
22
|
+
onChange?: any;
|
|
23
|
+
attribute?: {
|
|
24
|
+
pluginOptions?: { filteredSelect?: { targetUid?: string; targetField?: string } };
|
|
25
|
+
required?: boolean;
|
|
26
|
+
};
|
|
27
|
+
name?: string;
|
|
28
|
+
description?: MessageDescriptor & Parameters<IntlFormatters['formatMessage']>;
|
|
29
|
+
disabled?: boolean;
|
|
30
|
+
error?: any;
|
|
31
|
+
labelAction?: any;
|
|
32
|
+
required?: boolean;
|
|
33
|
+
value?: string;
|
|
34
|
+
contentTypeUID?: string;
|
|
35
|
+
placeholder?: MessageDescriptor & Parameters<IntlFormatters['formatMessage']>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const RelationHelper = {
|
|
39
|
+
getTargetAttributes: (
|
|
40
|
+
fieldName?: string,
|
|
41
|
+
attribute?: IPlatformFilteredSelectFieldProps['attribute'],
|
|
42
|
+
modifiedData?: Record<string, any>,
|
|
43
|
+
layout?: Record<string, any>,
|
|
44
|
+
allLayoutData?: Record<string, any>
|
|
45
|
+
) => {
|
|
46
|
+
const targetField = attribute?.pluginOptions?.filteredSelect?.targetField || '';
|
|
47
|
+
const mainObject = getObjectFromFormName(modifiedData, fieldName || '');
|
|
48
|
+
const result: GetTargetAttributesResult = {
|
|
49
|
+
targetAttributes: undefined,
|
|
50
|
+
targetFieldValue: undefined,
|
|
51
|
+
targetField,
|
|
52
|
+
componentUid: '',
|
|
53
|
+
componentId: undefined,
|
|
54
|
+
targetFieldName: targetField,
|
|
55
|
+
relationMainFieldName: ''
|
|
56
|
+
};
|
|
57
|
+
if (mainObject?.__component) {
|
|
58
|
+
const lastFieldName = fieldName?.split('.')?.[fieldName?.split('.')?.length - 1];
|
|
59
|
+
result.targetAttributes = allLayoutData?.components?.[mainObject.__component]?.attributes?.[targetField];
|
|
60
|
+
result.relationMainFieldName =
|
|
61
|
+
allLayoutData?.components?.[mainObject.__component]?.metadatas?.[targetField]?.list?.mainField?.name;
|
|
62
|
+
result.targetFieldValue = mainObject?.[targetField];
|
|
63
|
+
result.targetField = (fieldName || '')?.replace(lastFieldName || '', targetField);
|
|
64
|
+
result.componentUid = mainObject?.__component;
|
|
65
|
+
result.componentId = mainObject?.id;
|
|
66
|
+
} else {
|
|
67
|
+
result.targetAttributes = layout?.attributes?.[targetField];
|
|
68
|
+
result.relationMainFieldName = layout?.metadatas?.[targetField]?.list?.mainField?.name;
|
|
69
|
+
result.targetFieldValue = modifiedData?.[targetField];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return result;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export default RelationHelper;
|
package/admin/src/index.tsx
CHANGED
|
@@ -5,8 +5,11 @@ import pluginId from './pluginId';
|
|
|
5
5
|
import Initializer from './components/Initializer';
|
|
6
6
|
import PageFiltersContainer from './components/PageFilters';
|
|
7
7
|
import { EditView } from './components/EditView';
|
|
8
|
+
import { PageTypeEditView } from './components/PageTypeEditView';
|
|
8
9
|
import middlewares from './middlewares';
|
|
9
10
|
import PluginIcon from './components/PluginIcon';
|
|
11
|
+
import getTrad from './utils/getTrad';
|
|
12
|
+
import PlatformFilteredSelectFieldIcon from './components/PlatformFilteredSelectField/InputIcon';
|
|
10
13
|
|
|
11
14
|
const name = pluginPkg.strapi.name;
|
|
12
15
|
|
|
@@ -20,6 +23,25 @@ export default {
|
|
|
20
23
|
name
|
|
21
24
|
};
|
|
22
25
|
|
|
26
|
+
app.customFields.register({
|
|
27
|
+
name: 'filtered-select',
|
|
28
|
+
pluginId,
|
|
29
|
+
type: 'string',
|
|
30
|
+
icon: PlatformFilteredSelectFieldIcon,
|
|
31
|
+
intlLabel: {
|
|
32
|
+
id: getTrad('platformFilteredSelect.builder.label'),
|
|
33
|
+
defaultMessage: name
|
|
34
|
+
},
|
|
35
|
+
intlDescription: {
|
|
36
|
+
id: getTrad('platformFilteredSelect.builder.description'),
|
|
37
|
+
defaultMessage: 'Add a filtered select to a page'
|
|
38
|
+
},
|
|
39
|
+
components: {
|
|
40
|
+
Input: async () =>
|
|
41
|
+
import(/* webpackChunkName: "filtered-select-component" */ './components/PlatformFilteredSelectField')
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
|
|
23
45
|
app.addMenuLink({
|
|
24
46
|
to: '/plugins/strapi-plugin-page-builder',
|
|
25
47
|
icon: PluginIcon, // This really is a plugin icon, I promise!
|
|
@@ -43,6 +65,10 @@ export default {
|
|
|
43
65
|
name: 'collection-type-picker',
|
|
44
66
|
Component: EditView
|
|
45
67
|
});
|
|
68
|
+
app.injectContentManagerComponent('editView', 'right-links', {
|
|
69
|
+
name: 'page-type-edit-view',
|
|
70
|
+
Component: PageTypeEditView
|
|
71
|
+
});
|
|
46
72
|
app.injectContentManagerComponent('listView', 'actions', {
|
|
47
73
|
name: 'page-filters',
|
|
48
74
|
Component: PageFiltersContainer
|
|
@@ -2,5 +2,8 @@
|
|
|
2
2
|
"template.confirmModal.title": "Replace all page modules",
|
|
3
3
|
"template.confirmModal.body": "You are about to replace all modules on this page. Are you sure you want to continue?",
|
|
4
4
|
"template.confirmModal.buttons.cancel": "No, cancel",
|
|
5
|
-
"template.confirmModal.buttons.submit": "Yes, replace all"
|
|
5
|
+
"template.confirmModal.buttons.submit": "Yes, replace all",
|
|
6
|
+
"platformFilteredSelect.builder.label": "Platform filtered select",
|
|
7
|
+
"platformFilteredSelect.builder.description": "Enables filtering relations by platform",
|
|
8
|
+
"platformFilteredSelect.linkToEntity.label": "Go to page"
|
|
6
9
|
}
|
|
@@ -2,5 +2,8 @@
|
|
|
2
2
|
"template.confirmModal.title": "Pagina modules vervangen",
|
|
3
3
|
"template.confirmModal.body": "Weet je zeker dat je alle modules op deze pagina wilt vervangen?",
|
|
4
4
|
"template.confirmModal.buttons.cancel": "Nee, annuleer",
|
|
5
|
-
"template.confirmModal.buttons.submit": "Ja, vervang modules"
|
|
5
|
+
"template.confirmModal.buttons.submit": "Ja, vervang modules",
|
|
6
|
+
"platformFilteredSelect.builder.label": "Platform filtered select",
|
|
7
|
+
"platformFilteredSelect.builder.description": "Filtert relaties op basis van een platform",
|
|
8
|
+
"platformFilteredSelect.linkToEntity.label": "Ga naar pagina"
|
|
6
9
|
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import get from 'lodash/get';
|
|
2
|
+
|
|
3
|
+
const getObjectFromFormName = (modifiedData?: Record<string, any>, name?: string) => {
|
|
4
|
+
const split = (name || '')?.split('.');
|
|
5
|
+
let newPath = '';
|
|
6
|
+
|
|
7
|
+
for (let index = 0; index < split.length; index++) {
|
|
8
|
+
let value = split?.[index];
|
|
9
|
+
|
|
10
|
+
if (index + 1 === split.length) {
|
|
11
|
+
break;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
if (index === 0) {
|
|
15
|
+
newPath += value;
|
|
16
|
+
continue;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
if (!isNaN(Number(value))) {
|
|
20
|
+
value = `[${value}]`;
|
|
21
|
+
newPath += value;
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
newPath += `.${value}`;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return get(modifiedData, newPath);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
export { getObjectFromFormName };
|
|
@@ -6,6 +6,7 @@ import { useGetPlatformRelation } from '../../api/platform-relation';
|
|
|
6
6
|
const usePlatformFormData = (form?: Record<string, any>, onPlatformChange?: (platform: Platform) => void) => {
|
|
7
7
|
const { onChange, initialData, layout } = form || {};
|
|
8
8
|
const { isLoading } = useGetPlatformRelation({ id: initialData?.id, uid: layout.uid });
|
|
9
|
+
|
|
9
10
|
const { selectedPlatform: defaultPlatform, setSelectedPlatform: setDefaultPlatform } =
|
|
10
11
|
useDefaultPlatformFromLocalStorage();
|
|
11
12
|
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webbio/strapi-plugin-page-builder",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0-platform",
|
|
4
4
|
"description": "This is the description of the plugin.",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"develop": "tsc -p tsconfig.server.json -w",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@strapi/strapi": "^4.15.0",
|
|
45
|
-
"@webbio/strapi-plugin-slug": "^
|
|
45
|
+
"@webbio/strapi-plugin-slug": "^3.0.0",
|
|
46
46
|
"react": "^17.0.0 || ^18.0.0",
|
|
47
47
|
"react-dom": "^17.0.0 || ^18.0.0",
|
|
48
48
|
"react-router-dom": "^5.3.4",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
}
|
|
62
62
|
],
|
|
63
63
|
"engines": {
|
|
64
|
-
"node": ">=14.19.1 <=
|
|
64
|
+
"node": ">=14.19.1 <=20.x.x",
|
|
65
65
|
"npm": ">=6.0.0"
|
|
66
66
|
},
|
|
67
67
|
"license": "MIT",
|
|
@@ -2,11 +2,15 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.default = {
|
|
4
4
|
async findOneByUid(ctx) {
|
|
5
|
-
var _a;
|
|
5
|
+
var _a, _b;
|
|
6
6
|
const uid = (_a = ctx === null || ctx === void 0 ? void 0 : ctx.params) === null || _a === void 0 ? void 0 : _a.uid;
|
|
7
|
+
const platformId = (_b = ctx === null || ctx === void 0 ? void 0 : ctx.params) === null || _b === void 0 ? void 0 : _b.platformId;
|
|
7
8
|
if (!uid) {
|
|
8
9
|
return ctx.badRequest('uid is missing.');
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
+
if (!platformId) {
|
|
12
|
+
return ctx.badRequest('PlatformId is missing.');
|
|
13
|
+
}
|
|
14
|
+
return await strapi.service('plugin::page-builder.page-type').findOneByUid(uid, platformId);
|
|
11
15
|
}
|
|
12
16
|
};
|
package/dist/server/register.js
CHANGED
|
@@ -8,6 +8,11 @@ const page_type_1 = __importDefault(require("./graphql/page-type"));
|
|
|
8
8
|
const pages_by_uid_1 = __importDefault(require("./graphql/pages-by-uid"));
|
|
9
9
|
exports.default = async ({ strapi }) => {
|
|
10
10
|
var _a, _b;
|
|
11
|
+
strapi.customFields.register({
|
|
12
|
+
name: 'filtered-select',
|
|
13
|
+
plugin: 'page-builder',
|
|
14
|
+
type: 'string'
|
|
15
|
+
});
|
|
11
16
|
const extensionService = strapi.plugin('graphql').service('extension');
|
|
12
17
|
extensionService.use(page_type_1.default);
|
|
13
18
|
extensionService.use((0, page_by_path_1.default)(strapi));
|
|
@@ -25,6 +25,21 @@
|
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
|
+
"template": {
|
|
29
|
+
"type": "relation",
|
|
30
|
+
"relation": "oneToOne",
|
|
31
|
+
"target": "api::template.template"
|
|
32
|
+
},
|
|
33
|
+
"platform": {
|
|
34
|
+
"type": "relation",
|
|
35
|
+
"relation": "oneToOne",
|
|
36
|
+
"target": "api::platform.platform"
|
|
37
|
+
},
|
|
38
|
+
"defaultParent": {
|
|
39
|
+
"type": "relation",
|
|
40
|
+
"relation": "oneToOne",
|
|
41
|
+
"target": "api::page.page"
|
|
42
|
+
},
|
|
28
43
|
"modules": {
|
|
29
44
|
"type": "dynamiczone",
|
|
30
45
|
"components": [],
|
|
@@ -33,11 +48,6 @@
|
|
|
33
48
|
"localized": true
|
|
34
49
|
}
|
|
35
50
|
}
|
|
36
|
-
},
|
|
37
|
-
"template": {
|
|
38
|
-
"type": "relation",
|
|
39
|
-
"relation": "oneToOne",
|
|
40
|
-
"target": "api::template.template"
|
|
41
51
|
}
|
|
42
52
|
}
|
|
43
53
|
}
|
|
@@ -16,16 +16,6 @@
|
|
|
16
16
|
},
|
|
17
17
|
"domain": {
|
|
18
18
|
"type": "string"
|
|
19
|
-
},
|
|
20
|
-
"template": {
|
|
21
|
-
"type": "relation",
|
|
22
|
-
"relation": "oneToMany",
|
|
23
|
-
"target": "api::template.template"
|
|
24
|
-
},
|
|
25
|
-
"pageTypes": {
|
|
26
|
-
"type": "relation",
|
|
27
|
-
"relation": "oneToMany",
|
|
28
|
-
"target": "api::page-type.page-type"
|
|
29
19
|
}
|
|
30
20
|
}
|
|
31
21
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"draftAndPublish": false,
|
|
3
|
+
"displayName": "Templates",
|
|
4
|
+
"singularName": "template",
|
|
5
|
+
"pluralName": "templates",
|
|
6
|
+
"description": "",
|
|
7
|
+
"plugin": "page-builder",
|
|
8
|
+
"pluginOptions": {
|
|
9
|
+
"i18n": {
|
|
10
|
+
"localized": true
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"kind": "collectionType",
|
|
14
|
+
"collectionName": "templates",
|
|
15
|
+
"attributes": {
|
|
16
|
+
"title": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"required": true,
|
|
19
|
+
"pluginOptions": {
|
|
20
|
+
"i18n": {
|
|
21
|
+
"localized": true
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
"platform": {
|
|
26
|
+
"type": "relation",
|
|
27
|
+
"relation": "oneToOne",
|
|
28
|
+
"target": "api::platform.platform"
|
|
29
|
+
},
|
|
30
|
+
"modules": {
|
|
31
|
+
"type": "dynamiczone",
|
|
32
|
+
"components": [],
|
|
33
|
+
"pluginOptions": {
|
|
34
|
+
"i18n": {
|
|
35
|
+
"localized": true
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -12,6 +12,7 @@ const reload_strapi_on_load_1 = require("../utils/reload-strapi-on-load");
|
|
|
12
12
|
const page_type_start_json_1 = __importDefault(require("../schema/page-type-start.json"));
|
|
13
13
|
const page_type_end_json_1 = __importDefault(require("../schema/page-type-end.json"));
|
|
14
14
|
const template_start_json_1 = __importDefault(require("../schema/template-start.json"));
|
|
15
|
+
const template_end_json_1 = __importDefault(require("../schema/template-end.json"));
|
|
15
16
|
const platform_start_json_1 = __importDefault(require("../schema/platform-start.json"));
|
|
16
17
|
const UIDS = [constants_1.TEMPLATE_UID, constants_1.PAGE_TYPE_UID, constants_1.PLATFORM_UID, constants_1.PAGE_UID];
|
|
17
18
|
exports.default = {
|
|
@@ -71,7 +72,7 @@ exports.default = {
|
|
|
71
72
|
update: this.getPageTypeContentType()
|
|
72
73
|
},
|
|
73
74
|
[constants_1.TEMPLATE_UID]: {
|
|
74
|
-
create: this.getTemplateContentType(),
|
|
75
|
+
create: this.getTemplateContentType(true),
|
|
75
76
|
update: this.getTemplateContentType()
|
|
76
77
|
},
|
|
77
78
|
[constants_1.PLATFORM_UID]: {
|
|
@@ -91,8 +92,8 @@ exports.default = {
|
|
|
91
92
|
const contentType = this.mergeCollectionTypeWithOld(pageType, constants_1.PAGE_TYPE_UID);
|
|
92
93
|
return { uid: constants_1.PAGE_TYPE_UID, contentType };
|
|
93
94
|
},
|
|
94
|
-
getTemplateContentType() {
|
|
95
|
-
const template = template_start_json_1.default;
|
|
95
|
+
getTemplateContentType(create) {
|
|
96
|
+
const template = create ? template_start_json_1.default : template_end_json_1.default;
|
|
96
97
|
const contentType = this.mergeCollectionTypeWithOld(template, constants_1.TEMPLATE_UID);
|
|
97
98
|
return { uid: constants_1.TEMPLATE_UID, contentType };
|
|
98
99
|
},
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const constants_1 = require("../../shared/utils/constants");
|
|
4
4
|
exports.default = {
|
|
5
|
-
async findOneByUid(uid) {
|
|
5
|
+
async findOneByUid(uid, platformId) {
|
|
6
6
|
var _a;
|
|
7
7
|
const results = await ((_a = strapi.entityService) === null || _a === void 0 ? void 0 : _a.findMany(constants_1.PAGE_TYPE_UID, {
|
|
8
8
|
populate: {
|
|
@@ -10,10 +10,14 @@ exports.default = {
|
|
|
10
10
|
populate: {
|
|
11
11
|
modules: true
|
|
12
12
|
}
|
|
13
|
-
}
|
|
13
|
+
},
|
|
14
|
+
defaultParent: true
|
|
14
15
|
},
|
|
15
16
|
filters: {
|
|
16
|
-
uid
|
|
17
|
+
uid,
|
|
18
|
+
platform: {
|
|
19
|
+
id: platformId
|
|
20
|
+
}
|
|
17
21
|
}
|
|
18
22
|
}));
|
|
19
23
|
const result = results.length > 0 ? results === null || results === void 0 ? void 0 : results[0] : undefined;
|