@firecms/collection_editor 3.0.0-canary.98 → 3.0.0-rc.1

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 (79) hide show
  1. package/README.md +165 -1
  2. package/dist/ConfigControllerProvider.d.ts +0 -1
  3. package/dist/index.es.js +9920 -4958
  4. package/dist/index.es.js.map +1 -1
  5. package/dist/index.umd.js +9912 -4954
  6. package/dist/index.umd.js.map +1 -1
  7. package/dist/types/collection_editor_controller.d.ts +0 -1
  8. package/dist/types/collection_inference.d.ts +4 -1
  9. package/dist/types/config_controller.d.ts +3 -1
  10. package/dist/types/config_permissions.d.ts +2 -2
  11. package/dist/types/persisted_collection.d.ts +1 -1
  12. package/dist/ui/EditorEntityAction.d.ts +2 -0
  13. package/dist/ui/collection_editor/CollectionDetailsForm.d.ts +3 -1
  14. package/dist/ui/collection_editor/CollectionEditorWelcomeView.d.ts +1 -1
  15. package/dist/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +1 -1
  16. package/dist/ui/collection_editor/EntityActionsEditTab.d.ts +4 -0
  17. package/dist/ui/collection_editor/EntityActionsSelectDialog.d.ts +4 -0
  18. package/dist/ui/collection_editor/LayoutModeSwitch.d.ts +5 -0
  19. package/dist/ui/collection_editor/PropertyEditView.d.ts +8 -0
  20. package/dist/ui/collection_editor/PropertyTree.d.ts +2 -3
  21. package/dist/ui/collection_editor/import/CollectionEditorImportDataPreview.d.ts +1 -1
  22. package/dist/ui/collection_editor/import/CollectionEditorImportMapping.d.ts +8 -1
  23. package/dist/ui/collection_editor/import/clean_import_data.d.ts +1 -1
  24. package/dist/ui/collection_editor/properties/MarkdownPropertyField.d.ts +4 -0
  25. package/dist/ui/collection_editor/properties/ReferencePropertyField.d.ts +2 -1
  26. package/dist/ui/collection_editor/properties/StringPropertyField.d.ts +1 -1
  27. package/dist/useCollectionEditorPlugin.d.ts +6 -6
  28. package/dist/utils/collections.d.ts +1 -1
  29. package/package.json +25 -23
  30. package/src/ConfigControllerProvider.tsx +2 -7
  31. package/src/types/collection_editor_controller.tsx +1 -2
  32. package/src/types/collection_inference.ts +4 -1
  33. package/src/types/config_controller.tsx +4 -1
  34. package/src/types/config_permissions.ts +1 -1
  35. package/src/types/persisted_collection.ts +2 -3
  36. package/src/ui/CollectionViewHeaderAction.tsx +4 -2
  37. package/src/ui/EditorCollectionAction.tsx +3 -7
  38. package/src/ui/EditorCollectionActionStart.tsx +1 -1
  39. package/src/ui/EditorEntityAction.tsx +51 -0
  40. package/src/ui/HomePageEditorCollectionAction.tsx +5 -3
  41. package/src/ui/NewCollectionButton.tsx +1 -1
  42. package/src/ui/PropertyAddColumnComponent.tsx +5 -3
  43. package/src/ui/collection_editor/CollectionDetailsForm.tsx +126 -49
  44. package/src/ui/collection_editor/CollectionEditorDialog.tsx +71 -16
  45. package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +20 -29
  46. package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +19 -17
  47. package/src/ui/collection_editor/EntityActionsEditTab.tsx +163 -0
  48. package/src/ui/collection_editor/EntityActionsSelectDialog.tsx +41 -0
  49. package/src/ui/collection_editor/EntityCustomViewsSelectDialog.tsx +11 -7
  50. package/src/ui/collection_editor/EnumForm.tsx +11 -7
  51. package/src/ui/collection_editor/GetCodeDialog.tsx +46 -26
  52. package/src/ui/collection_editor/LayoutModeSwitch.tsx +54 -0
  53. package/src/ui/collection_editor/PropertyEditView.tsx +260 -75
  54. package/src/ui/collection_editor/PropertyFieldPreview.tsx +5 -4
  55. package/src/ui/collection_editor/PropertyTree.tsx +184 -138
  56. package/src/ui/collection_editor/SubcollectionsEditTab.tsx +24 -17
  57. package/src/ui/collection_editor/UnsavedChangesDialog.tsx +9 -7
  58. package/src/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +11 -3
  59. package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +34 -3
  60. package/src/ui/collection_editor/import/clean_import_data.ts +1 -1
  61. package/src/ui/collection_editor/properties/BlockPropertyField.tsx +18 -12
  62. package/src/ui/collection_editor/properties/DateTimePropertyField.tsx +54 -47
  63. package/src/ui/collection_editor/properties/EnumPropertyField.tsx +2 -0
  64. package/src/ui/collection_editor/properties/MapPropertyField.tsx +3 -2
  65. package/src/ui/collection_editor/properties/MarkdownPropertyField.tsx +139 -0
  66. package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +7 -3
  67. package/src/ui/collection_editor/properties/StoragePropertyField.tsx +13 -18
  68. package/src/ui/collection_editor/properties/StringPropertyField.tsx +1 -10
  69. package/src/ui/collection_editor/properties/UrlPropertyField.tsx +1 -0
  70. package/src/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx +2 -0
  71. package/src/ui/collection_editor/properties/validation/ValidationPanel.tsx +2 -2
  72. package/src/ui/collection_editor/templates/pages_template.ts +1 -6
  73. package/src/ui/collection_editor/utils/strings.ts +13 -6
  74. package/src/ui/collection_editor/utils/supported_fields.tsx +1 -0
  75. package/src/ui/collection_editor/utils/update_property_for_widget.ts +9 -0
  76. package/src/useCollectionEditorPlugin.tsx +20 -15
  77. package/src/utils/collections.ts +23 -7
  78. package/dist/ui/collection_editor/PropertySelectItem.d.ts +0 -8
  79. package/src/ui/collection_editor/PropertySelectItem.tsx +0 -32
@@ -1,5 +1,5 @@
1
1
  import { Properties, slugify } from "@firecms/core";
2
- import { ImportConfig } from "@firecms/data_import_export";
2
+ import { ImportConfig } from "@firecms/data_import";
3
3
 
4
4
  export function cleanPropertiesFromImport(properties: Properties, parentSlug = ""): {
5
5
  headersMapping: ImportConfig["headersMapping"],
@@ -1,10 +1,16 @@
1
1
  import React, { useState } from "react";
2
2
  import { AddIcon, Button, Paper, Typography } from "@firecms/ui";
3
3
  import { getIn, useFormex } from "@firecms/formex";
4
- import { PropertyFormDialog } from "../PropertyEditView";
5
- import { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath, namespaceToPropertiesPath } from "../util";
4
+ import { OnPropertyChangedParams, PropertyFormDialog } from "../PropertyEditView";
5
+ import {
6
+ getFullId,
7
+ getFullIdPath,
8
+ idToPropertiesPath,
9
+ namespaceToPropertiesOrderPath,
10
+ namespaceToPropertiesPath
11
+ } from "../util";
6
12
  import { PropertyTree } from "../PropertyTree";
7
- import { ArrayProperty, Property, PropertyConfig } from "@firecms/core";
13
+ import { ArrayProperty, PropertyConfig } from "@firecms/core";
8
14
 
9
15
  export function BlockPropertyField({
10
16
  disabled,
@@ -31,18 +37,17 @@ export function BlockPropertyField({
31
37
 
32
38
  const onPropertyChanged = ({
33
39
  id,
40
+ namespace,
34
41
  property
35
- }: { id?: string, property: Property }) => {
42
+ }: OnPropertyChangedParams) => {
36
43
  if (!id)
37
44
  throw Error();
38
45
 
39
- setFieldValue("oneOf.properties", {
40
- ...(values.oneOf?.properties ?? {}),
41
- [id]: property
42
- }, false);
46
+ setFieldValue("oneOf." + getFullIdPath(id, namespace), property, false);
47
+
43
48
  const currentPropertiesOrder = values.oneOf?.propertiesOrder ?? Object.keys(values.oneOf?.properties ?? {});
44
49
  const newPropertiesOrder = currentPropertiesOrder.includes(id) ? currentPropertiesOrder : [...currentPropertiesOrder, id];
45
- setFieldValue("oneOf.propertiesOrder", newPropertiesOrder, false);
50
+ setFieldValue("oneOf." + namespaceToPropertiesOrderPath(namespace), newPropertiesOrder, false);
46
51
  setPropertyDialogOpen(false);
47
52
  };
48
53
 
@@ -82,8 +87,9 @@ export function BlockPropertyField({
82
87
  <>
83
88
  <div className={"col-span-12"}>
84
89
  <div className={"flex justify-between items-end mt-8 mb-4"}>
85
- <Typography variant={"subtitle2"}>Properties in this
86
- block</Typography>
90
+ <Typography variant={"subtitle2"}>
91
+ Properties in this block
92
+ </Typography>
87
93
  {addChildButton}
88
94
  </div>
89
95
  <Paper className="p-2 pl-8">
@@ -104,7 +110,7 @@ export function BlockPropertyField({
104
110
  ? undefined
105
111
  : onPropertyMove}/>
106
112
 
107
- {!disabled && !values.oneOf?.propertiesOrder?.length &&
113
+ {!disabled && (values.oneOf?.propertiesOrder?.length === 0)&&
108
114
  <div className="h-full flex items-center justify-center p-4">
109
115
  Add the first property to this block
110
116
  </div>}
@@ -26,53 +26,60 @@ export function DateTimePropertyField({ disabled }: {
26
26
 
27
27
  return (
28
28
  <>
29
- <div className={"flex flex-col col-span-12"}>
30
- <Select name={modePath}
31
- value={modeValue ?? "date"}
32
- error={Boolean(modeError)}
33
- onValueChange={(v) => setFieldValue(modePath, v)}
34
- label={"Mode"}
35
- renderValue={(v) => {
36
- switch (v) {
37
- case "date_time":
38
- return "Date/Time";
39
- case "date":
40
- return "Date";
41
- default:
42
- return "";
43
- }
44
- }}
45
- disabled={disabled}>
46
- <SelectItem value={"date_time"}> Date/Time </SelectItem>
47
- <SelectItem value={"date"}> Date </SelectItem>
48
- </Select>
49
- <FieldCaption error={Boolean(modeError)}>
50
- {modeError}
51
- </FieldCaption>
52
-
53
- <Select name={autoValuePath}
54
- disabled={disabled}
55
- value={autoValueValue ?? ""}
56
- onValueChange={(v) => setFieldValue(autoValuePath, v === "none" ? null : v)}
57
- renderValue={(v) => {
58
- switch (v) {
59
- case "on_create":
60
- return "On create";
61
- case "on_update":
62
- return "On any update";
63
- default:
64
- return "None";
65
- }
66
- }}
67
- error={Boolean(autoValueError)}
68
- label={"Automatic value"}>
69
- <SelectItem value={"none"}> None </SelectItem>
70
- <SelectItem value={"on_create"}> On create </SelectItem>
71
- <SelectItem value={"on_update"}> On any update </SelectItem>
72
- </Select>
73
- <FieldCaption error={Boolean(autoValueError)}>
74
- {autoValueError ?? "Update this field automatically when creating or updating the entity"}
75
- </FieldCaption>
29
+ <div className={"flex flex-col col-span-12 gap-2"}>
30
+ <div>
31
+ <Select name={modePath}
32
+ value={modeValue ?? "date"}
33
+ error={Boolean(modeError)}
34
+ size={"large"}
35
+ onValueChange={(v) => setFieldValue(modePath, v)}
36
+ label={"Mode"}
37
+ fullWidth={true}
38
+ renderValue={(v) => {
39
+ switch (v) {
40
+ case "date_time":
41
+ return "Date/Time";
42
+ case "date":
43
+ return "Date";
44
+ default:
45
+ return "";
46
+ }
47
+ }}
48
+ disabled={disabled}>
49
+ <SelectItem value={"date_time"}> Date/Time </SelectItem>
50
+ <SelectItem value={"date"}> Date </SelectItem>
51
+ </Select>
52
+ <FieldCaption error={Boolean(modeError)}>
53
+ {modeError}
54
+ </FieldCaption>
55
+ </div>
56
+ <div>
57
+ <Select name={autoValuePath}
58
+ disabled={disabled}
59
+ size={"large"}
60
+ fullWidth={true}
61
+ value={autoValueValue ?? ""}
62
+ onValueChange={(v) => setFieldValue(autoValuePath, v === "none" ? null : v)}
63
+ renderValue={(v) => {
64
+ switch (v) {
65
+ case "on_create":
66
+ return "On create";
67
+ case "on_update":
68
+ return "On any update";
69
+ default:
70
+ return "None";
71
+ }
72
+ }}
73
+ error={Boolean(autoValueError)}
74
+ label={"Automatic value"}>
75
+ <SelectItem value={"none"}> None </SelectItem>
76
+ <SelectItem value={"on_create"}> On create </SelectItem>
77
+ <SelectItem value={"on_update"}> On any update </SelectItem>
78
+ </Select>
79
+ <FieldCaption error={Boolean(autoValueError)}>
80
+ {autoValueError ?? "Update this field automatically when creating or updating the entity"}
81
+ </FieldCaption>
82
+ </div>
76
83
 
77
84
  </div>
78
85
 
@@ -93,9 +93,11 @@ export function EnumPropertyField({
93
93
  <Select
94
94
  disabled={disabled}
95
95
  position={"item-aligned"}
96
+ fullWidth={true}
96
97
  onValueChange={(value: string) => {
97
98
  setFieldValue("defaultValue", value);
98
99
  }}
100
+ size={"large"}
99
101
  label={"Default value"}
100
102
  value={defaultValue ?? ""}>
101
103
  {enumValues
@@ -107,13 +107,14 @@ export function MapPropertyField({ disabled, getData, allowDataInference, proper
107
107
  <div className={"col-span-12"}>
108
108
  <BooleanSwitchWithLabel
109
109
  position={"start"}
110
- size={"small"}
110
+ size={"medium"}
111
111
  label="Spread children as columns"
112
112
  onValueChange={(v) => setFieldValue("spreadChildren", v)}
113
113
  value={values.spreadChildren ?? false}
114
114
  />
115
115
  <FieldCaption>
116
- Set this flag to true if you want to display the children of this group as individual columns.
116
+ Set this flag to true if you want to display the children of this group as individual columns. This
117
+ will only work for top level groups.
117
118
  </FieldCaption>
118
119
  </div>
119
120
 
@@ -0,0 +1,139 @@
1
+ import React from "react";
2
+ import { StringPropertyValidation } from "./validation/StringPropertyValidation";
3
+ import { ValidationPanel } from "./validation/ValidationPanel";
4
+ import { Field, getIn, useFormex } from "@firecms/formex";
5
+
6
+ import { CloudUploadIcon, DebouncedTextField, ExpandablePanel, TextField, Typography } from "@firecms/ui";
7
+
8
+ export function MarkdownPropertyField({
9
+ disabled,
10
+ showErrors
11
+ }: {
12
+ disabled: boolean;
13
+ showErrors: boolean;
14
+ }) {
15
+
16
+ const {
17
+ values,
18
+ setFieldValue
19
+ } = useFormex();
20
+
21
+ const baseStoragePath = "storage";
22
+
23
+ const metadata = `${baseStoragePath}.metadata`;
24
+ const fileName = `${baseStoragePath}.fileName`;
25
+ const maxSize = `${baseStoragePath}.maxSize`;
26
+ const storagePath = `${baseStoragePath}.storagePath`;
27
+
28
+ const fileNameValue = getIn(values, fileName) ?? "{rand}_{file}";
29
+ const storagePathValue = getIn(values, storagePath) ?? "/";
30
+ const maxSizeValue = getIn(values, maxSize);
31
+
32
+ const hasFilenameCallback = typeof fileNameValue === "function";
33
+ const hasStoragePathCallback = typeof storagePathValue === "function";
34
+
35
+ return (
36
+ <>
37
+ <div className={"col-span-12"}>
38
+
39
+ <ValidationPanel>
40
+
41
+ <StringPropertyValidation disabled={disabled}
42
+ length={true}
43
+ lowercase={true}
44
+ max={true}
45
+ min={true}
46
+ trim={true}
47
+ uppercase={true}
48
+ showErrors={showErrors}/>
49
+
50
+ </ValidationPanel>
51
+
52
+ </div>
53
+
54
+ <div className={"col-span-12"}>
55
+ <ExpandablePanel
56
+ title={
57
+ <div className="flex flex-row text-surface-500">
58
+ <CloudUploadIcon/>
59
+ <Typography variant={"subtitle2"}
60
+ className="ml-2">
61
+ File upload config
62
+ </Typography>
63
+ </div>
64
+ }>
65
+
66
+ <div className={"grid grid-cols-12 gap-2 p-4"}>
67
+
68
+
69
+ <div className={"col-span-12"}>
70
+ <Field name={fileName}
71
+ as={DebouncedTextField}
72
+ label={"File name"}
73
+ size={"small"}
74
+ disabled={hasFilenameCallback || disabled}
75
+ value={hasFilenameCallback ? "-" : fileNameValue}
76
+ />
77
+ </div>
78
+ <div className={"col-span-12"}>
79
+ <Field name={storagePath}
80
+ as={DebouncedTextField}
81
+ label={"Storage path"}
82
+ disabled={hasStoragePathCallback || disabled}
83
+ size={"small"}
84
+ value={hasStoragePathCallback ? "-" : storagePathValue}
85
+ />
86
+ <Typography variant={"caption"} className={"ml-3.5 mt-1 mb-2"}>
87
+ <p>You can use the following placeholders in
88
+ the file name
89
+ and storage path values:</p>
90
+ <ul>
91
+ <li>{"{file} - Full name of the uploaded file"}</li>
92
+ <li>{"{file.name} - Name of the uploaded file without extension"}</li>
93
+ <li>{"{file.ext} - Extension of the uploaded file"}</li>
94
+ <li>{"{entityId} - ID of the entity"}</li>
95
+ <li>{"{propertyKey} - ID of this field"}</li>
96
+ <li>{"{path} - Path of this entity"}</li>
97
+ <li>{"{rand} - Random value used to avoid name collisions"}</li>
98
+ </ul>
99
+ </Typography>
100
+
101
+ <Typography variant={"caption"} className={"ml-3.5 mt-1 mb-2"}>
102
+ When using Markdown, the URL of the uploaded files are always saved in the text value
103
+ (not
104
+ the path).
105
+ </Typography>
106
+ </div>
107
+
108
+ <div className={"col-span-12"}>
109
+ <DebouncedTextField name={maxSize}
110
+ type={"number"}
111
+ label={"Max size (in bytes)"}
112
+ size={"small"}
113
+ value={maxSizeValue !== undefined && maxSizeValue !== null ? maxSizeValue.toString() : ""}
114
+ onChange={(e) => {
115
+ const value = e.target.value;
116
+ if (value === "") setFieldValue(maxSize, undefined);
117
+ else setFieldValue(maxSize, parseInt(value));
118
+ }}
119
+ />
120
+ </div>
121
+
122
+ </div>
123
+ </ExpandablePanel>
124
+ </div>
125
+
126
+ <div className={"col-span-12"}>
127
+
128
+ <TextField name={"defaultValue"}
129
+ disabled={disabled}
130
+ onChange={(e: any) => {
131
+ setFieldValue("defaultValue", e.target.value === "" ? undefined : e.target.value);
132
+ }}
133
+ label={"Default value"}
134
+ value={getIn(values, "defaultValue") ?? ""}/>
135
+
136
+ </div>
137
+ </>
138
+ );
139
+ }
@@ -7,12 +7,14 @@ export function ReferencePropertyField({
7
7
  existing,
8
8
  multiple,
9
9
  disabled,
10
- showErrors
10
+ showErrors,
11
+ asString
11
12
  }: {
12
13
  existing: boolean,
13
14
  multiple: boolean,
14
15
  disabled: boolean,
15
- showErrors: boolean
16
+ showErrors: boolean,
17
+ asString?: boolean
16
18
  }) {
17
19
 
18
20
  const {
@@ -28,7 +30,7 @@ export function ReferencePropertyField({
28
30
  <CircularProgress/>
29
31
  </div>;
30
32
 
31
- const pathPath = multiple ? "of.path" : "path";
33
+ const pathPath = asString ? "reference.path" : (multiple ? "of.path" : "path") ;
32
34
  const pathValue: string | undefined = getIn(values, pathPath);
33
35
  const pathError: string | undefined = showErrors && getIn(errors, pathPath);
34
36
 
@@ -89,6 +91,8 @@ export function CollectionsSelect({
89
91
  value={value ?? ""}
90
92
  position={"item-aligned"}
91
93
  name={pathPath}
94
+ size={"large"}
95
+ fullWidth={true}
92
96
  onChange={handleChange}
93
97
  label={"Target collection"}
94
98
  renderValue={(selected) => {
@@ -1,10 +1,9 @@
1
1
  import React from "react";
2
2
  import {
3
3
  Button,
4
- Checkbox,
4
+ CloudUploadIcon,
5
5
  DebouncedTextField,
6
6
  ExpandablePanel,
7
- FileUploadIcon,
8
7
  MultiSelect,
9
8
  MultiSelectItem,
10
9
  Typography
@@ -58,10 +57,10 @@ export function StoragePropertyField({
58
57
 
59
58
  const handleTypesChange = (value: string[]) => {
60
59
  if (!value) setFieldValue(acceptedFiles, undefined);
61
- else if (value.includes("all")) setFieldValue(acceptedFiles, undefined);
62
- else if (value.length >= Object.keys(fileTypes).length) setFieldValue(acceptedFiles, undefined);
63
- else if (allFileTypesSelected)
64
- setFieldValue(acceptedFiles, Object.keys(fileTypes).filter((v) => !value.includes(v)));
60
+ // else if (value.includes("all")) setFieldValue(acceptedFiles, undefined);
61
+ // else if (value.length >= Object.keys(fileTypes).length) setFieldValue(acceptedFiles, undefined);
62
+ // else if (allFileTypesSelected)
63
+ // setFieldValue(acceptedFiles, Object.keys(fileTypes).filter((v) => !value.includes(v)));
65
64
  else setFieldValue(acceptedFiles, value);
66
65
  };
67
66
 
@@ -75,8 +74,8 @@ export function StoragePropertyField({
75
74
 
76
75
  <ExpandablePanel
77
76
  title={
78
- <div className="flex flex-row text-gray-500">
79
- <FileUploadIcon/>
77
+ <div className="flex flex-row text-surface-500">
78
+ <CloudUploadIcon/>
80
79
  <Typography variant={"subtitle2"}
81
80
  className="ml-2">
82
81
  File upload config
@@ -89,10 +88,12 @@ export function StoragePropertyField({
89
88
  <div className={"col-span-12"}>
90
89
 
91
90
  <MultiSelect
91
+ className={"w-full"}
92
+ placeholder={"All file types allowed"}
92
93
  disabled={disabled}
93
94
  name={acceptedFiles}
94
95
  value={fileTypesValue ?? []}
95
- onMultiValueChange={handleTypesChange}
96
+ onValueChange={handleTypesChange}
96
97
  label={allFileTypesSelected ? undefined : "Allowed file types"}
97
98
  renderValues={(selected) => {
98
99
  if (!selected || selected.length === 0) return "All file types allowed";
@@ -101,21 +102,15 @@ export function StoragePropertyField({
101
102
  .join(", ");
102
103
  }}>
103
104
 
104
- <MultiSelectItem key={"all"} value={"all"} className={"flex items-center gap-2"}>
105
- <Checkbox
106
- checked={!fileTypesValue}/>
107
- All
108
- </MultiSelectItem>
109
-
110
105
  {Object.entries(fileTypes).map(([value, label]) => (
111
106
  <MultiSelectItem key={value} value={value} className={"flex items-center gap-2"}>
112
- <Checkbox
113
- checked={allFileTypesSelected || fileTypesValue.indexOf(value) > -1}/>
107
+ {/*<Checkbox*/}
108
+ {/* checked={allFileTypesSelected || fileTypesValue.indexOf(value) > -1}/>*/}
114
109
  <div className={"flex-grow"}>
115
110
  {label}
116
111
  </div>
117
112
  <Button size={"small"}
118
- variant={"outlined"}
113
+ variant={"text"}
119
114
  onClick={(e) => {
120
115
  e.preventDefault();
121
116
  e.stopPropagation();
@@ -10,7 +10,7 @@ export function StringPropertyField({
10
10
  disabled,
11
11
  showErrors
12
12
  }: {
13
- widgetId: "text_field" | "multiline" | "markdown" | "email";
13
+ widgetId: "text_field" | "multiline" | "email";
14
14
  disabled: boolean;
15
15
  showErrors: boolean;
16
16
  }) {
@@ -42,15 +42,6 @@ export function StringPropertyField({
42
42
  trim={true}
43
43
  uppercase={true}
44
44
  showErrors={showErrors}/>}
45
- {widgetId === "markdown" &&
46
- <StringPropertyValidation disabled={disabled}
47
- length={true}
48
- lowercase={true}
49
- max={true}
50
- min={true}
51
- trim={true}
52
- uppercase={true}
53
- showErrors={showErrors}/>}
54
45
 
55
46
  {widgetId === "email" &&
56
47
  <StringPropertyValidation disabled={disabled}
@@ -24,6 +24,7 @@ export function UrlPropertyField({
24
24
  <Select
25
25
  disabled={disabled}
26
26
  position={"item-aligned"}
27
+ fullWidth={true}
27
28
  onValueChange={(value: string) => {
28
29
  if (value === "[NONE]")
29
30
  setFieldValue("url", true);
@@ -19,6 +19,7 @@ export function AdvancedPropertyValidation({ disabled }: {
19
19
  {({ field, form }: FormexFieldProps) => {
20
20
  return <SwitchControl
21
21
  label={"Hide from collection"}
22
+ size={"medium"}
22
23
  disabled={disabled}
23
24
  form={form}
24
25
  tooltip={"Hide this field from the collection view. It will still be visible in the form view"}
@@ -33,6 +34,7 @@ export function AdvancedPropertyValidation({ disabled }: {
33
34
  {({ field, form }: FormexFieldProps) => {
34
35
  return <SwitchControl
35
36
  label={"Read only"}
37
+ size={"medium"}
36
38
  disabled={disabled}
37
39
  tooltip={"Is this a read only field. Display only as a preview"}
38
40
  form={form}
@@ -10,9 +10,9 @@ export function ValidationPanel({
10
10
  <ExpandablePanel
11
11
  initiallyExpanded={false}
12
12
  asField={true}
13
- className="p-4"
13
+ innerClassName="p-4"
14
14
  title={
15
- <div className="flex flex-row text-gray-500">
15
+ <div className="flex flex-row text-surface-500">
16
16
  <RuleIcon/>
17
17
  <Typography variant={"subtitle2"}
18
18
  className="ml-2">
@@ -19,7 +19,7 @@ export const pagesCollectionTemplate: EntityCollection = {
19
19
  validation: {
20
20
  required: true,
21
21
  unique: true,
22
- matches: /^[a-z0-9]+(?:-[a-z0-9]+)*$/,
22
+ matches: "^[a-z0-9]+(?:-[a-z0-9]+)*$",
23
23
  matchesMessage: "Must be lowercase, alphanumeric, and hyphenated"
24
24
  }
25
25
  },
@@ -178,11 +178,6 @@ export const pagesCollectionTemplate: EntityCollection = {
178
178
  name: "Is Published",
179
179
  columnWidth: 100,
180
180
  description: "Should this page be live on the site?"
181
- },
182
- author_uid: {
183
- dataType: "reference",
184
- name: "Author",
185
- path: "users"
186
181
  }
187
182
  }
188
183
  };
@@ -1,9 +1,16 @@
1
1
  export function camelCase(str: string): string {
2
2
  if (!str) return "";
3
- return (str.slice(0, 1).toLowerCase() + str.slice(1))
4
- .replace(/([-_ ]){1,}/g, " ")
5
- .split(/[-_ ]/)
6
- .reduce((cur, acc) => {
7
- return cur + acc[0].toUpperCase() + acc.substring(1);
8
- }, "");
3
+ if (str.length === 1) return str.toLowerCase();
4
+
5
+ // Split by hyphens, underscores, or spaces and filter out empty strings
6
+ const parts = str.split(/[-_ ]+/).filter(Boolean);
7
+
8
+ if (parts.length === 0) return "";
9
+
10
+ // Start with first part in lowercase
11
+ return parts[0].toLowerCase() +
12
+ // Transform remaining parts to have first letter uppercase
13
+ parts.slice(1)
14
+ .map(part => part.charAt(0).toUpperCase() + part.substring(1).toLowerCase())
15
+ .join('');
9
16
  }
@@ -14,6 +14,7 @@ export const supportedFieldsIds: PropertyConfigId[] = [
14
14
  "file_upload",
15
15
  "multi_file_upload",
16
16
  "reference",
17
+ "reference_as_string",
17
18
  "multi_references",
18
19
  "switch",
19
20
  "date_time",
@@ -208,6 +208,15 @@ export function updatePropertyFromWidget(propertyData: any,
208
208
  editable: propertyData.editable !== undefined ? propertyData.editable : true
209
209
  } satisfies Property
210
210
  );
211
+ } else if (selectedWidgetId === "reference_as_string") {
212
+ updatedProperty = mergeDeep(
213
+ propertyData,
214
+ {
215
+ dataType: "string",
216
+ propertyConfig: "reference_as_string",
217
+ editable: propertyData.editable !== undefined ? propertyData.editable : true
218
+ } satisfies Property
219
+ );
211
220
  } else if (selectedWidgetId === "multi_references") {
212
221
  updatedProperty = mergeDeep(
213
222
  propertyData,