@firecms/collection_editor 3.0.0-alpha.72 → 3.0.0-alpha.73
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/index.es.js +600 -594
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +2 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/ui/collection_editor/templates/pages_template.d.ts +2 -0
- package/package.json +5 -5
- package/src/ui/EditorCollectionAction.tsx +2 -2
- package/src/ui/PropertyAddColumnComponent.tsx +1 -1
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +11 -3
- package/src/ui/collection_editor/PropertyEditView.tsx +1 -1
- package/src/ui/collection_editor/templates/pages_template.ts +153 -0
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firecms/collection_editor",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.0-alpha.
|
|
4
|
+
"version": "3.0.0-alpha.73",
|
|
5
5
|
"main": "./dist/index.umd.js",
|
|
6
6
|
"module": "./dist/index.es.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"source": "src/index.ts",
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@firecms/data_import_export": "^3.0.0-alpha.
|
|
11
|
-
"@firecms/schema_inference": "^3.0.0-alpha.
|
|
12
|
-
"@firecms/ui": "^3.0.0-alpha.
|
|
10
|
+
"@firecms/data_import_export": "^3.0.0-alpha.73",
|
|
11
|
+
"@firecms/schema_inference": "^3.0.0-alpha.73",
|
|
12
|
+
"@firecms/ui": "^3.0.0-alpha.73",
|
|
13
13
|
"json5": "^2.2.3",
|
|
14
14
|
"prism-react-renderer": "^2.3.0"
|
|
15
15
|
},
|
|
@@ -72,5 +72,5 @@
|
|
|
72
72
|
"publishConfig": {
|
|
73
73
|
"access": "public"
|
|
74
74
|
},
|
|
75
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "df625cc7bd6af087b7012d1c9ae77d3a6c17a320"
|
|
76
76
|
}
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
useNavigationController,
|
|
8
8
|
useSnackbarController
|
|
9
9
|
} from "@firecms/core";
|
|
10
|
-
import { Button, IconButton, SaveIcon, SettingsIcon, Tooltip, } from "@firecms/ui";
|
|
10
|
+
import { Button, IconButton, SaveIcon, SettingsIcon, Tooltip, UndoIcon, } from "@firecms/ui";
|
|
11
11
|
|
|
12
12
|
import { useCollectionEditorController } from "../useCollectionEditorController";
|
|
13
13
|
import { useCollectionsConfigController } from "../useCollectionsConfigController";
|
|
@@ -52,7 +52,7 @@ export function EditorCollectionAction({
|
|
|
52
52
|
if (collection?.initialSort)
|
|
53
53
|
tableController.setSortBy?.(collection?.initialSort);
|
|
54
54
|
}}>
|
|
55
|
-
<
|
|
55
|
+
<UndoIcon/>
|
|
56
56
|
</Button>
|
|
57
57
|
</Tooltip>}
|
|
58
58
|
|
|
@@ -25,7 +25,7 @@ export function PropertyAddColumnComponent({
|
|
|
25
25
|
return (
|
|
26
26
|
<Tooltip title={canEditCollection ? "Add new property" : "You don't have permission to add new properties"}>
|
|
27
27
|
<div
|
|
28
|
-
className={"p-0.5 w-20 h-full flex items-center justify-center cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-950"}
|
|
28
|
+
className={"p-0.5 w-20 h-full flex items-center justify-center cursor-pointer bg-gray-100 bg-opacity-40 hover:bg-gray-100 dark:bg-gray-950 dark:bg-opacity-40 dark:hover:bg-gray-950"}
|
|
29
29
|
// className={onHover ? "bg-white dark:bg-gray-950" : undefined}
|
|
30
30
|
onClick={() => {
|
|
31
31
|
collectionEditorController.editProperty({
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useMemo, useState } from "react";
|
|
1
|
+
import React, { useCallback, useEffect, useMemo, useState } from "react";
|
|
2
2
|
|
|
3
3
|
import { Field, FormikErrors, getIn, useFormikContext } from "formik";
|
|
4
4
|
import {
|
|
@@ -248,6 +248,14 @@ export function CollectionPropertiesEditorForm({
|
|
|
248
248
|
setFieldTouched(previousPropertyPath, false, false);
|
|
249
249
|
}
|
|
250
250
|
|
|
251
|
+
console.debug("onPropertyChanged", {
|
|
252
|
+
id,
|
|
253
|
+
property,
|
|
254
|
+
previousId,
|
|
255
|
+
namespace,
|
|
256
|
+
propertyPath
|
|
257
|
+
})
|
|
258
|
+
|
|
251
259
|
if (propertyPath) {
|
|
252
260
|
setFieldValue(propertyPath, property, false);
|
|
253
261
|
setFieldTouched(propertyPath, true, false);
|
|
@@ -255,7 +263,7 @@ export function CollectionPropertiesEditorForm({
|
|
|
255
263
|
|
|
256
264
|
};
|
|
257
265
|
|
|
258
|
-
const onPropertyErrorInternal = (id: string, namespace?: string, error?: FormikErrors<any>) => {
|
|
266
|
+
const onPropertyErrorInternal = useCallback((id: string, namespace?: string, error?: FormikErrors<any>) => {
|
|
259
267
|
const propertyPath = id ? getFullId(id, namespace) : undefined;
|
|
260
268
|
console.warn("onPropertyErrorInternal", {
|
|
261
269
|
id,
|
|
@@ -268,7 +276,7 @@ export function CollectionPropertiesEditorForm({
|
|
|
268
276
|
onPropertyError(id, namespace, hasError ? error : undefined);
|
|
269
277
|
setFieldError(idToPropertiesPath(propertyPath), hasError ? "Property error" : undefined);
|
|
270
278
|
}
|
|
271
|
-
}
|
|
279
|
+
}, [])
|
|
272
280
|
|
|
273
281
|
const closePropertyDialog = () => {
|
|
274
282
|
setSelectedPropertyIndex(undefined);
|
|
@@ -137,7 +137,7 @@ export const PropertyForm = React.memo(
|
|
|
137
137
|
? { id: propertyKey, ...property } as PropertyWithId
|
|
138
138
|
: initialValue}
|
|
139
139
|
onSubmit={(newPropertyWithId: PropertyWithId, helpers) => {
|
|
140
|
-
console.
|
|
140
|
+
console.debug("onSubmit", newPropertyWithId);
|
|
141
141
|
const {
|
|
142
142
|
id,
|
|
143
143
|
...property
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { EntityCollection } from "@firecms/core";
|
|
2
|
+
|
|
3
|
+
export const pagesCollectionTemplate: EntityCollection = {
|
|
4
|
+
id: "pages",
|
|
5
|
+
path: "pages",
|
|
6
|
+
name: "Pages",
|
|
7
|
+
singularName: "Page",
|
|
8
|
+
icon: "insert_drive_file",
|
|
9
|
+
description: "List of website pages that can be edited here",
|
|
10
|
+
properties: {
|
|
11
|
+
title: {
|
|
12
|
+
dataType: "string",
|
|
13
|
+
name: "Page Title",
|
|
14
|
+
validation: { required: true }
|
|
15
|
+
},
|
|
16
|
+
slug: {
|
|
17
|
+
dataType: "string",
|
|
18
|
+
name: "URL Slug",
|
|
19
|
+
validation: {
|
|
20
|
+
required: true,
|
|
21
|
+
unique: true,
|
|
22
|
+
matches: /^[a-z0-9]+(?:-[a-z0-9]+)*$/
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
hero_section: {
|
|
26
|
+
dataType: "map",
|
|
27
|
+
name: "Hero Section",
|
|
28
|
+
properties: {
|
|
29
|
+
headline: {
|
|
30
|
+
dataType: "string",
|
|
31
|
+
name: "Headline",
|
|
32
|
+
validation: { required: true }
|
|
33
|
+
},
|
|
34
|
+
subhead: {
|
|
35
|
+
dataType: "string",
|
|
36
|
+
name: "Subheadline"
|
|
37
|
+
},
|
|
38
|
+
background_image: {
|
|
39
|
+
dataType: "string",
|
|
40
|
+
name: "Background Image",
|
|
41
|
+
storage: {
|
|
42
|
+
storagePath: "page_hero/images",
|
|
43
|
+
acceptedFiles: ["image/*"],
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
call_to_action: {
|
|
47
|
+
dataType: "string",
|
|
48
|
+
name: "Call to Action"
|
|
49
|
+
},
|
|
50
|
+
call_to_action_link: {
|
|
51
|
+
dataType: "string",
|
|
52
|
+
name: "CTA Link",
|
|
53
|
+
url: true
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
sections: {
|
|
58
|
+
dataType: "array",
|
|
59
|
+
name: "Content Sections",
|
|
60
|
+
of: {
|
|
61
|
+
dataType: "map",
|
|
62
|
+
properties: {
|
|
63
|
+
title: {
|
|
64
|
+
dataType: "string",
|
|
65
|
+
name: "Section Title",
|
|
66
|
+
validation: { required: true }
|
|
67
|
+
},
|
|
68
|
+
content: {
|
|
69
|
+
dataType: "string",
|
|
70
|
+
name: "Section Content",
|
|
71
|
+
markdown: true
|
|
72
|
+
},
|
|
73
|
+
image: {
|
|
74
|
+
dataType: "string",
|
|
75
|
+
name: "Section Image",
|
|
76
|
+
storage: {
|
|
77
|
+
storagePath: "page_sections/images",
|
|
78
|
+
acceptedFiles: ["image/*"],
|
|
79
|
+
}
|
|
80
|
+
},
|
|
81
|
+
link: {
|
|
82
|
+
dataType: "string",
|
|
83
|
+
name: "Section Link",
|
|
84
|
+
url: true
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
sidebar: {
|
|
90
|
+
dataType: "map",
|
|
91
|
+
name: "Sidebar",
|
|
92
|
+
properties: {
|
|
93
|
+
title: {
|
|
94
|
+
dataType: "string",
|
|
95
|
+
name: "Sidebar Title",
|
|
96
|
+
validation: { required: false }
|
|
97
|
+
},
|
|
98
|
+
content: {
|
|
99
|
+
dataType: "string",
|
|
100
|
+
name: "Sidebar Content",
|
|
101
|
+
markdown: true
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
seo_metadata: {
|
|
106
|
+
dataType: "map",
|
|
107
|
+
name: "SEO Metadata",
|
|
108
|
+
properties: {
|
|
109
|
+
meta_title: {
|
|
110
|
+
dataType: "string",
|
|
111
|
+
name: "Meta Title"
|
|
112
|
+
},
|
|
113
|
+
meta_description: {
|
|
114
|
+
dataType: "string",
|
|
115
|
+
name: "Meta Description"
|
|
116
|
+
},
|
|
117
|
+
focus_keywords: {
|
|
118
|
+
dataType: "array",
|
|
119
|
+
name: "Focus Keywords",
|
|
120
|
+
of: {
|
|
121
|
+
dataType: "string"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
footer_override: {
|
|
127
|
+
dataType: "string",
|
|
128
|
+
name: "Footer Override",
|
|
129
|
+
markdown: true
|
|
130
|
+
},
|
|
131
|
+
publish_date: {
|
|
132
|
+
dataType: "date",
|
|
133
|
+
name: "Publish Date",
|
|
134
|
+
validation: { required: true }
|
|
135
|
+
},
|
|
136
|
+
last_updated: {
|
|
137
|
+
dataType: "date",
|
|
138
|
+
name: "Last Updated",
|
|
139
|
+
autoValue: "on_update"
|
|
140
|
+
},
|
|
141
|
+
is_published: {
|
|
142
|
+
dataType: "boolean",
|
|
143
|
+
name: "Is Published",
|
|
144
|
+
columnWidth: 100,
|
|
145
|
+
description: "Should this page be live on the site?"
|
|
146
|
+
},
|
|
147
|
+
author_uid: {
|
|
148
|
+
dataType: "reference",
|
|
149
|
+
name: "Author",
|
|
150
|
+
path: "users"
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
};
|