@webbio/strapi-plugin-page-builder 0.8.4-platform → 0.9.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.
Files changed (27) hide show
  1. package/admin/src/components/Combobox/react-select-custom-styles.tsx +1 -0
  2. package/admin/src/components/PlatformFilteredSelectField/Multi/index.tsx +21 -10
  3. package/admin/src/components/StrapiCore/admin/admin/src/content-manager/components/Relations/RelationInput.tsx +690 -0
  4. package/admin/src/components/StrapiCore/admin/admin/src/content-manager/components/Relations/RelationInputDataManager.tsx +6 -0
  5. package/admin/src/components/StrapiCore/admin/admin/src/content-manager/constants/attributes.ts +3 -0
  6. package/admin/src/components/StrapiCore/admin/admin/src/content-manager/hooks/useDragAndDrop.ts +253 -0
  7. package/admin/src/components/StrapiCore/admin/admin/src/content-manager/hooks/useKeyboardDragAndDrop.ts +96 -0
  8. package/admin/src/components/StrapiCore/admin/admin/src/content-manager/hooks/usePrev.ts +11 -0
  9. package/admin/src/components/StrapiCore/admin/admin/src/content-manager/utils/dragAndDrop.ts +8 -0
  10. package/admin/src/components/StrapiCore/admin/admin/src/content-manager/utils/normalizeRelations.ts +7 -0
  11. package/admin/src/components/StrapiCore/admin/admin/src/content-manager/utils/paths.ts +36 -0
  12. package/admin/src/components/StrapiCore/admin/admin/src/content-manager/utils/refs.ts +19 -0
  13. package/admin/src/components/StrapiCore/admin/admin/src/content-manager/utils/translations.ts +3 -0
  14. package/admin/src/components/StrapiCore/content-manager/shared/contracts/collection-types.ts +300 -0
  15. package/admin/src/components/StrapiCore/content-manager/shared/contracts/components.ts +72 -0
  16. package/admin/src/components/StrapiCore/content-manager/shared/contracts/content-types.ts +116 -0
  17. package/admin/src/components/StrapiCore/content-manager/shared/contracts/index.ts +8 -0
  18. package/admin/src/components/StrapiCore/content-manager/shared/contracts/init.ts +22 -0
  19. package/admin/src/components/StrapiCore/content-manager/shared/contracts/relations.ts +80 -0
  20. package/admin/src/components/StrapiCore/content-manager/shared/contracts/review-workflows.ts +88 -0
  21. package/admin/src/components/StrapiCore/content-manager/shared/contracts/single-types.ts +112 -0
  22. package/admin/src/components/StrapiCore/content-manager/shared/contracts/uid.ts +48 -0
  23. package/admin/src/components/StrapiCore/content-manager/shared/index.ts +1 -0
  24. package/custom.d.ts +1 -0
  25. package/dist/package.json +1 -1
  26. package/dist/tsconfig.server.tsbuildinfo +1 -1
  27. package/package.json +1 -1
@@ -0,0 +1,300 @@
1
+ import { errors } from '@strapi/utils';
2
+ import { Schema, Common, EntityService } from '@strapi/types';
3
+
4
+ // Admin entity response follows the same format as the entity service
5
+ type Entity = EntityService.Result<Common.UID.Schema>;
6
+ type PaginatedEntities = EntityService.PaginatedResult<Common.UID.Schema>;
7
+
8
+ type PaginationQuery = EntityService.Params.Pagination.PageNotation;
9
+ type SortQuery = EntityService.Params.Sort.StringNotation<Common.UID.Schema> & string;
10
+
11
+ /**
12
+ * GET /collection-types/:model
13
+ */
14
+ export declare namespace Find {
15
+ export interface Request {
16
+ body: {};
17
+ query: {
18
+ page: PaginationQuery['page'];
19
+ pageSize: PaginationQuery['pageSize'];
20
+ sort: SortQuery;
21
+ };
22
+ }
23
+
24
+ export interface Params {
25
+ model: string;
26
+ }
27
+
28
+ export interface Response {
29
+ results: PaginatedEntities['results'];
30
+ pagination: PaginatedEntities['pagination'];
31
+ error?: errors.ApplicationError;
32
+ }
33
+ }
34
+
35
+ /**
36
+ * GET /collection-types/:model/:id
37
+ */
38
+ export declare namespace FindOne {
39
+ export interface Request {
40
+ body: {};
41
+ query: {};
42
+ }
43
+
44
+ export interface Params {
45
+ model: string;
46
+ id: number;
47
+ }
48
+
49
+ export interface Response {
50
+ data: Entity;
51
+ error?: errors.ApplicationError;
52
+ }
53
+ }
54
+
55
+ /**
56
+ * POST /collection-types/:model
57
+ */
58
+ export declare namespace Create {
59
+ export interface Request {
60
+ body: Schema.Attributes;
61
+ query: {};
62
+ }
63
+
64
+ export interface Params {
65
+ model: string;
66
+ }
67
+
68
+ export interface Response {
69
+ data: Entity;
70
+ error?: errors.ApplicationError;
71
+ }
72
+ }
73
+
74
+ /**
75
+ * POST /collection-types/:model/auto-clone/:sourceId
76
+ */
77
+ export declare namespace AutoClone {
78
+ export interface Request {
79
+ body: {};
80
+ query: {};
81
+ }
82
+
83
+ export interface Params {
84
+ model: string;
85
+ sourceId: Entity['id'];
86
+ }
87
+
88
+ export type Response =
89
+ | Entity
90
+ | {
91
+ error?: errors.ApplicationError;
92
+ };
93
+ }
94
+
95
+ /**
96
+ * POST /collection-types/:model/clone/:sourceId
97
+ */
98
+ export declare namespace Clone {
99
+ export interface Request {
100
+ body: Schema.Attributes;
101
+ query: {};
102
+ }
103
+
104
+ export interface Params {
105
+ model: string;
106
+ sourceId: number;
107
+ }
108
+
109
+ export interface Response {
110
+ data: Entity;
111
+ error?: errors.ApplicationError;
112
+ }
113
+ }
114
+
115
+ /**
116
+ * POST /collection-types/:model/:id
117
+ */
118
+ export declare namespace Update {
119
+ export interface Request {
120
+ body: Entity;
121
+ query: {};
122
+ }
123
+
124
+ export interface Params {
125
+ model: string;
126
+ id: number;
127
+ }
128
+
129
+ export interface Response {
130
+ data: Entity;
131
+ error?: errors.ApplicationError;
132
+ }
133
+ }
134
+
135
+ /**
136
+ * DELETE /collection-types/:model/:id
137
+ */
138
+ export declare namespace Delete {
139
+ export interface Request {
140
+ body: {};
141
+ query: {};
142
+ }
143
+
144
+ export interface Params {
145
+ model: string;
146
+ id: Entity['id'];
147
+ }
148
+
149
+ export interface Response {
150
+ data: Entity;
151
+ error?: errors.ApplicationError;
152
+ }
153
+ }
154
+
155
+ /**
156
+ * POST /collection-types/:model/:id/actions/publish
157
+ */
158
+ export declare namespace Publish {
159
+ export interface Request {
160
+ body: {};
161
+ query: {};
162
+ }
163
+
164
+ export interface Params {
165
+ model: string;
166
+ id: number;
167
+ }
168
+
169
+ export interface Response {
170
+ data: Entity;
171
+ error?: errors.ApplicationError;
172
+ }
173
+ }
174
+
175
+ /**
176
+ * POST /collection-types/:model/:id/actions/unpublish
177
+ */
178
+ export declare namespace Unpublish {
179
+ export interface Request {
180
+ body: {};
181
+ query: {};
182
+ }
183
+
184
+ export interface Params {
185
+ model: string;
186
+ id: Entity['id'];
187
+ }
188
+
189
+ export interface Response {
190
+ data: Entity;
191
+ error?: errors.ApplicationError;
192
+ }
193
+ }
194
+
195
+ /**
196
+ * POST /collection-types/:model/actions/bulkDelete
197
+ */
198
+ export declare namespace BulkDelete {
199
+ export interface Request {
200
+ body: {
201
+ ids: Entity['id'][];
202
+ };
203
+ query: {};
204
+ }
205
+
206
+ export interface Params {
207
+ model: string;
208
+ }
209
+
210
+ export interface Response {
211
+ data: {
212
+ count: number;
213
+ };
214
+ error?: errors.ApplicationError | errors.YupValidationError;
215
+ }
216
+ }
217
+
218
+ /**
219
+ * POST /collection-types/:model/actions/bulkPublish
220
+ */
221
+ export declare namespace BulkPublish {
222
+ export interface Request {
223
+ body: {
224
+ ids: Entity['id'][];
225
+ };
226
+ query: {};
227
+ }
228
+
229
+ export interface Params {
230
+ model: string;
231
+ }
232
+
233
+ export interface Response {
234
+ count: number;
235
+ error?: errors.ApplicationError | errors.YupValidationError;
236
+ }
237
+ }
238
+
239
+ /**
240
+ * POST /collection-types/:model/actions/bulkUnpublish
241
+ */
242
+ export declare namespace BulkUnpublish {
243
+ export interface Request {
244
+ body: {
245
+ ids: Entity['id'][];
246
+ };
247
+ query: {};
248
+ }
249
+
250
+ export interface Params {
251
+ model: string;
252
+ }
253
+
254
+ export interface Response {
255
+ data: {
256
+ count: number;
257
+ };
258
+ error?: errors.ApplicationError | errors.YupValidationError;
259
+ }
260
+ }
261
+
262
+ /**
263
+ * GET /collection-types/:model/:id/actions/countDraftRelations
264
+ */
265
+ export declare namespace CountDraftRelations {
266
+ export interface Request {
267
+ body: {};
268
+ query: {};
269
+ }
270
+
271
+ export interface Params {
272
+ model: string;
273
+ }
274
+
275
+ export interface Response {
276
+ data: number;
277
+ error?: errors.ApplicationError;
278
+ }
279
+ }
280
+
281
+ /**
282
+ * GET /collection-types/:model/actions/countManyEntriesDraftRelations
283
+ */
284
+ export declare namespace CountManyEntriesDraftRelations {
285
+ export interface Request {
286
+ body: {
287
+ ids: number[];
288
+ };
289
+ query: {};
290
+ }
291
+
292
+ export interface Params {
293
+ model: string;
294
+ }
295
+
296
+ export interface Response {
297
+ data: number;
298
+ error?: errors.ApplicationError;
299
+ }
300
+ }
@@ -0,0 +1,72 @@
1
+ import { Schema } from '@strapi/types';
2
+ import { errors } from '@strapi/utils';
3
+ import { Configuration, Settings, Metadatas, Layouts } from './content-types';
4
+
5
+ export interface Component extends Schema.Component {
6
+ isDisplayed: boolean;
7
+ info: Schema.Info;
8
+ apiID: string;
9
+ }
10
+
11
+ export interface ComponentConfiguration extends Configuration {
12
+ category: string;
13
+ isComponent: boolean;
14
+ }
15
+
16
+ /**
17
+ * GET /components
18
+ */
19
+ export declare namespace FindComponents {
20
+ export interface Request {
21
+ body: {};
22
+ query: {};
23
+ }
24
+ export interface Response {
25
+ data: Component[];
26
+ error?: errors.ApplicationError;
27
+ }
28
+ }
29
+
30
+ /**
31
+ * GET /components/:uid/configuration
32
+ */
33
+ export declare namespace FindComponentConfiguration {
34
+ export interface Request {
35
+ body: {};
36
+ query: {};
37
+ }
38
+
39
+ export interface Params {
40
+ uid: string;
41
+ }
42
+ export interface Response {
43
+ data: {
44
+ component: ComponentConfiguration;
45
+ components: Record<string, ComponentConfiguration>;
46
+ };
47
+ error?: errors.ApplicationError;
48
+ }
49
+ }
50
+
51
+ /**
52
+ * PUT /components/:uid/configuration
53
+ */
54
+ export declare namespace UpdateComponentConfiguration {
55
+ export interface Request {
56
+ body: {
57
+ layouts: Layouts;
58
+ metadatas: Metadatas;
59
+ settings: Settings;
60
+ };
61
+ query: {};
62
+ }
63
+
64
+ export interface Params {
65
+ uid: string;
66
+ }
67
+
68
+ export interface Response {
69
+ data: ComponentConfiguration;
70
+ error?: errors.ApplicationError | errors.YupValidationError;
71
+ }
72
+ }
@@ -0,0 +1,116 @@
1
+ import { Schema } from '@strapi/types';
2
+ import { errors } from '@strapi/utils';
3
+ import { ComponentConfiguration } from './components';
4
+
5
+ export type Settings = {
6
+ bulkable: boolean;
7
+ filterable: boolean;
8
+ searchable: boolean;
9
+ pageSize: number;
10
+ mainField: string;
11
+ defaultSortBy: string;
12
+ defaultSortOrder: string;
13
+ };
14
+
15
+ export type Metadatas = {
16
+ [key: string]: {
17
+ edit: {
18
+ label?: string;
19
+ description?: string;
20
+ placeholder?: string;
21
+ visible?: boolean;
22
+ editable?: boolean;
23
+ };
24
+ list: {
25
+ label?: string;
26
+ searchable?: boolean;
27
+ sortable?: boolean;
28
+ };
29
+ };
30
+ };
31
+
32
+ export type Layouts = {
33
+ list: string[];
34
+ edit: { name: string; size: number }[][];
35
+ };
36
+
37
+ export type Configuration = {
38
+ uid?: string;
39
+ settings: Settings;
40
+ metadatas: Metadatas;
41
+ layouts: Layouts;
42
+ };
43
+
44
+ export interface ContentType extends Schema.ContentType {
45
+ isDisplayed: boolean;
46
+ apiID: string;
47
+ }
48
+
49
+ /**
50
+ * GET /content-types
51
+ */
52
+ export declare namespace FindContentTypes {
53
+ export interface Request {
54
+ body: {};
55
+ query: {};
56
+ }
57
+ export interface Response {
58
+ data: ContentType[];
59
+ error?: errors.ApplicationError | errors.YupValidationError;
60
+ }
61
+ }
62
+
63
+ /**
64
+ * GET /content-types-settings
65
+ */
66
+ export declare namespace FindContentTypesSettings {
67
+ export interface Request {
68
+ body: {};
69
+ query: {};
70
+ }
71
+ export interface Response {
72
+ data: Array<{
73
+ uid: string;
74
+ settings: Settings;
75
+ }>;
76
+ error?: errors.ApplicationError;
77
+ }
78
+ }
79
+
80
+ /**
81
+ * GET /content-types/:uid/configuration
82
+ */
83
+ export declare namespace FindContentTypeConfiguration {
84
+ export interface Request {
85
+ body: {};
86
+ query: {};
87
+ }
88
+ export interface Response {
89
+ data: {
90
+ contentType: Configuration;
91
+ components: Record<string, ComponentConfiguration>;
92
+ };
93
+ error?: errors.ApplicationError;
94
+ }
95
+ }
96
+
97
+ /**
98
+ * PUT /content-types/:uid/configuration
99
+ */
100
+ export declare namespace UpdateContentTypeConfiguration {
101
+ export interface Request {
102
+ body: {
103
+ layouts: Layouts;
104
+ metadatas: Metadatas;
105
+ settings: Settings;
106
+ };
107
+ query: {};
108
+ }
109
+ export interface Response {
110
+ data: {
111
+ contentType: Configuration;
112
+ components: Record<string, ComponentConfiguration>;
113
+ };
114
+ error?: errors.ApplicationError | errors.YupValidationError;
115
+ }
116
+ }
@@ -0,0 +1,8 @@
1
+ export * as CollectionTypes from './collection-types';
2
+ export * as Components from './components';
3
+ export * as ContentTypes from './content-types';
4
+ export * as Init from './init';
5
+ export * as Relations from './relations';
6
+ export * as SingleTypes from './single-types';
7
+ export * as UID from './uid';
8
+ export * as ReviewWorkflows from './review-workflows';
@@ -0,0 +1,22 @@
1
+ import { errors } from '@strapi/utils';
2
+ import { Component } from './components';
3
+ import { ContentType } from './content-types';
4
+
5
+ /**
6
+ * GET /init
7
+ */
8
+ export declare namespace GetInitData {
9
+ export interface Request {
10
+ body: {};
11
+ query: {};
12
+ }
13
+
14
+ export interface Response {
15
+ data: {
16
+ fieldSizes: Record<string, { default: number; isResizeable: boolean }>;
17
+ components: Component[];
18
+ contentTypes: ContentType[];
19
+ };
20
+ error?: errors.ApplicationError;
21
+ }
22
+ }
@@ -0,0 +1,80 @@
1
+ import { Entity, EntityService } from '@strapi/types';
2
+ import { errors } from '@strapi/utils';
3
+
4
+ type PaginationQuery = EntityService.Params.Pagination.PageNotation;
5
+
6
+ export interface RelationResult {
7
+ id: Entity.ID;
8
+ publishedAt: string | null;
9
+ }
10
+
11
+ /**
12
+ * GET /relations/:model/:targetField
13
+ */
14
+ export declare namespace FindAvailable {
15
+ export interface Request {
16
+ body: {};
17
+ query: {
18
+ pageSize: PaginationQuery['pageSize'];
19
+ page: PaginationQuery['page'];
20
+ };
21
+ }
22
+
23
+ export interface Params {
24
+ model: string;
25
+ targetField: string;
26
+ }
27
+
28
+ export type Response =
29
+ | {
30
+ results: RelationResult[];
31
+ pagination: {
32
+ page: NonNullable<PaginationQuery['page']>;
33
+ pageSize: NonNullable<PaginationQuery['pageSize']>;
34
+ pageCount: number;
35
+ total: number;
36
+ };
37
+ error?: never;
38
+ }
39
+ | {
40
+ results?: never;
41
+ pagination?: never;
42
+ error?: errors.ApplicationError | errors.YupValidationError;
43
+ };
44
+ }
45
+
46
+ /**
47
+ * GET /relations/:model/:id/:targetField
48
+ */
49
+ export declare namespace FindExisting {
50
+ export interface Request {
51
+ body: {};
52
+ query: {};
53
+ }
54
+
55
+ export interface Params {
56
+ model: string;
57
+ targetField: string;
58
+ id: number;
59
+ }
60
+
61
+ export type Response =
62
+ | {
63
+ results: RelationResult[];
64
+ pagination: {
65
+ page: NonNullable<PaginationQuery['page']>;
66
+ pageSize: NonNullable<PaginationQuery['pageSize']>;
67
+ pageCount: number;
68
+ total: number;
69
+ };
70
+ error?: never;
71
+ }
72
+ | {
73
+ data: RelationResult;
74
+ error?: never;
75
+ }
76
+ | {
77
+ data?: never;
78
+ error: errors.ApplicationError | errors.YupValidationError;
79
+ };
80
+ }
@@ -0,0 +1,88 @@
1
+ import type { Common, EntityService } from '@strapi/types';
2
+ import type { errors } from '@strapi/utils';
3
+
4
+ type Entity = EntityService.Result<Common.UID.Schema>;
5
+
6
+ /**
7
+ * /content-manager/<collection-type | single-type>/:model/:id/assignee
8
+ */
9
+ namespace UpdateAssignee {
10
+ export interface Request {
11
+ body: {
12
+ data: {
13
+ id: Entity['id'] | null;
14
+ };
15
+ };
16
+ query: {};
17
+ }
18
+
19
+ export interface Params {
20
+ model: string;
21
+ id: Entity['id'];
22
+ }
23
+
24
+ export interface Response {
25
+ data: Entity;
26
+ error?: errors.ApplicationError;
27
+ }
28
+ }
29
+
30
+ interface StagePermission extends Omit<Entity, 'createdAt' | 'updatedAt'> {
31
+ action: string;
32
+ actionParameters: object;
33
+ subject?: string | null;
34
+ role: number;
35
+ }
36
+
37
+ interface Stage extends Entity {
38
+ color: string;
39
+ name: string;
40
+ permissions?: StagePermission[];
41
+ }
42
+
43
+ /**
44
+ * GET /content-manager/<collection-type | single-type>/:model/:id/stages
45
+ */
46
+ namespace GetStages {
47
+ export interface Request {
48
+ body: {};
49
+ query: {};
50
+ }
51
+
52
+ export interface Params {
53
+ model: string;
54
+ id: Entity['id'];
55
+ }
56
+
57
+ export interface Response {
58
+ data: Stage[];
59
+ meta?: { workflowCount: number };
60
+ error?: errors.ApplicationError;
61
+ }
62
+ }
63
+
64
+ /**
65
+ * PUT /content-manager/<collection-type | single-type>/:model/:id/stage
66
+ */
67
+ namespace UpdateStage {
68
+ export interface Request {
69
+ body: {
70
+ data: {
71
+ id: Entity['id'];
72
+ };
73
+ };
74
+ query: {};
75
+ }
76
+
77
+ export interface Params {
78
+ model: string;
79
+ id: Entity['id'];
80
+ }
81
+
82
+ export interface Response {
83
+ data: Entity;
84
+ error?: errors.ApplicationError;
85
+ }
86
+ }
87
+
88
+ export type { UpdateAssignee, UpdateStage, GetStages, Stage, StagePermission };