@firecms/collection_editor 3.0.0-canary.35 → 3.0.0-canary.37
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/package.json
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@firecms/collection_editor",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "3.0.0-canary.
|
|
4
|
+
"version": "3.0.0-canary.37",
|
|
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-canary.
|
|
11
|
-
"@firecms/formex": "^3.0.0-canary.
|
|
12
|
-
"@firecms/schema_inference": "^3.0.0-canary.
|
|
13
|
-
"@firecms/ui": "^3.0.0-canary.
|
|
10
|
+
"@firecms/data_import_export": "^3.0.0-canary.37",
|
|
11
|
+
"@firecms/formex": "^3.0.0-canary.37",
|
|
12
|
+
"@firecms/schema_inference": "^3.0.0-canary.37",
|
|
13
|
+
"@firecms/ui": "^3.0.0-canary.37",
|
|
14
14
|
"json5": "^2.2.3",
|
|
15
15
|
"prism-react-renderer": "^2.3.1"
|
|
16
16
|
},
|
|
@@ -81,5 +81,5 @@
|
|
|
81
81
|
"publishConfig": {
|
|
82
82
|
"access": "public"
|
|
83
83
|
},
|
|
84
|
-
"gitHead": "
|
|
84
|
+
"gitHead": "241b56d35ecc9c8155a2ea0d387974a41a231bb7"
|
|
85
85
|
}
|
|
@@ -5,11 +5,17 @@ import JSON5 from "json5";
|
|
|
5
5
|
import { Highlight, themes } from "prism-react-renderer"
|
|
6
6
|
import { camelCase } from "./utils/strings";
|
|
7
7
|
|
|
8
|
-
export function GetCodeDialog({
|
|
8
|
+
export function GetCodeDialog({
|
|
9
|
+
collection,
|
|
10
|
+
onOpenChange,
|
|
11
|
+
open
|
|
12
|
+
}: { onOpenChange: (open: boolean) => void, collection: any, open: any }) {
|
|
9
13
|
|
|
10
14
|
const snackbarController = useSnackbarController();
|
|
11
15
|
|
|
12
|
-
const code =
|
|
16
|
+
const code = collection
|
|
17
|
+
? "import { EntityCollection } from \"firecms\";\n\nconst " + (collection?.name ? camelCase(collection.name) : "my") + "Collection:EntityCollection = " + JSON5.stringify(collectionToCode(collection), null, "\t")
|
|
18
|
+
: "No collection selected";
|
|
13
19
|
return <Dialog open={open}
|
|
14
20
|
onOpenChange={onOpenChange}
|
|
15
21
|
maxWidth={"4xl"}>
|
|
@@ -29,7 +35,13 @@ export function GetCodeDialog({ collection, onOpenChange, open }: { onOpenChange
|
|
|
29
35
|
code={code}
|
|
30
36
|
language="typescript"
|
|
31
37
|
>
|
|
32
|
-
{({
|
|
38
|
+
{({
|
|
39
|
+
className,
|
|
40
|
+
style,
|
|
41
|
+
tokens,
|
|
42
|
+
getLineProps,
|
|
43
|
+
getTokenProps
|
|
44
|
+
}) => (
|
|
33
45
|
<pre style={style} className={"p-4 rounded text-sm"}>
|
|
34
46
|
{tokens.map((line, i) => (
|
|
35
47
|
<div key={i} {...getLineProps({ line })}>
|