@firecms/collection_editor 3.0.0-3.0.0-beta.4.pre.1.0

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 (140) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1 -0
  3. package/dist/ConfigControllerProvider.d.ts +37 -0
  4. package/dist/index.d.ts +11 -0
  5. package/dist/index.es.js +5454 -0
  6. package/dist/index.es.js.map +1 -0
  7. package/dist/index.umd.js +4 -0
  8. package/dist/index.umd.js.map +1 -0
  9. package/dist/types/collection_editor_controller.d.ts +36 -0
  10. package/dist/types/collection_inference.d.ts +2 -0
  11. package/dist/types/config_controller.d.ts +51 -0
  12. package/dist/types/config_permissions.d.ts +19 -0
  13. package/dist/types/persisted_collection.d.ts +6 -0
  14. package/dist/ui/CollectionViewHeaderAction.d.ts +10 -0
  15. package/dist/ui/EditorCollectionAction.d.ts +2 -0
  16. package/dist/ui/HomePageEditorCollectionAction.d.ts +2 -0
  17. package/dist/ui/MissingReferenceWidget.d.ts +3 -0
  18. package/dist/ui/NewCollectionButton.d.ts +1 -0
  19. package/dist/ui/NewCollectionCard.d.ts +2 -0
  20. package/dist/ui/PropertyAddColumnComponent.d.ts +6 -0
  21. package/dist/ui/RootCollectionSuggestions.d.ts +3 -0
  22. package/dist/ui/collection_editor/CollectionDetailsForm.d.ts +10 -0
  23. package/dist/ui/collection_editor/CollectionEditorDialog.d.ts +36 -0
  24. package/dist/ui/collection_editor/CollectionEditorWelcomeView.d.ts +15 -0
  25. package/dist/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +19 -0
  26. package/dist/ui/collection_editor/CollectionYupValidation.d.ts +14 -0
  27. package/dist/ui/collection_editor/EntityCustomViewsSelectDialog.d.ts +4 -0
  28. package/dist/ui/collection_editor/EnumForm.d.ts +12 -0
  29. package/dist/ui/collection_editor/GetCodeDialog.d.ts +5 -0
  30. package/dist/ui/collection_editor/PropertyEditView.d.ts +40 -0
  31. package/dist/ui/collection_editor/PropertyFieldPreview.d.ts +15 -0
  32. package/dist/ui/collection_editor/PropertySelectItem.d.ts +8 -0
  33. package/dist/ui/collection_editor/PropertyTree.d.ts +33 -0
  34. package/dist/ui/collection_editor/SubcollectionsEditTab.d.ts +12 -0
  35. package/dist/ui/collection_editor/SwitchControl.d.ts +8 -0
  36. package/dist/ui/collection_editor/UnsavedChangesDialog.d.ts +9 -0
  37. package/dist/ui/collection_editor/import/CollectionEditorImportDataPreview.d.ts +7 -0
  38. package/dist/ui/collection_editor/import/CollectionEditorImportMapping.d.ts +7 -0
  39. package/dist/ui/collection_editor/import/clean_import_data.d.ts +7 -0
  40. package/dist/ui/collection_editor/properties/BlockPropertyField.d.ts +8 -0
  41. package/dist/ui/collection_editor/properties/BooleanPropertyField.d.ts +3 -0
  42. package/dist/ui/collection_editor/properties/CommonPropertyFields.d.ts +10 -0
  43. package/dist/ui/collection_editor/properties/DateTimePropertyField.d.ts +3 -0
  44. package/dist/ui/collection_editor/properties/EnumPropertyField.d.ts +8 -0
  45. package/dist/ui/collection_editor/properties/KeyValuePropertyField.d.ts +3 -0
  46. package/dist/ui/collection_editor/properties/MapPropertyField.d.ts +8 -0
  47. package/dist/ui/collection_editor/properties/NumberPropertyField.d.ts +3 -0
  48. package/dist/ui/collection_editor/properties/ReferencePropertyField.d.ts +13 -0
  49. package/dist/ui/collection_editor/properties/RepeatPropertyField.d.ts +10 -0
  50. package/dist/ui/collection_editor/properties/StoragePropertyField.d.ts +5 -0
  51. package/dist/ui/collection_editor/properties/StringPropertyField.d.ts +5 -0
  52. package/dist/ui/collection_editor/properties/UrlPropertyField.d.ts +4 -0
  53. package/dist/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.d.ts +3 -0
  54. package/dist/ui/collection_editor/properties/validation/ArrayPropertyValidation.d.ts +5 -0
  55. package/dist/ui/collection_editor/properties/validation/GeneralPropertyValidation.d.ts +4 -0
  56. package/dist/ui/collection_editor/properties/validation/NumberPropertyValidation.d.ts +3 -0
  57. package/dist/ui/collection_editor/properties/validation/StringPropertyValidation.d.ts +11 -0
  58. package/dist/ui/collection_editor/properties/validation/ValidationPanel.d.ts +2 -0
  59. package/dist/ui/collection_editor/templates/blog_template.d.ts +2 -0
  60. package/dist/ui/collection_editor/templates/pages_template.d.ts +2 -0
  61. package/dist/ui/collection_editor/templates/products_template.d.ts +2 -0
  62. package/dist/ui/collection_editor/templates/users_template.d.ts +2 -0
  63. package/dist/ui/collection_editor/util.d.ts +5 -0
  64. package/dist/ui/collection_editor/utils/strings.d.ts +1 -0
  65. package/dist/ui/collection_editor/utils/supported_fields.d.ts +3 -0
  66. package/dist/ui/collection_editor/utils/update_property_for_widget.d.ts +2 -0
  67. package/dist/ui/collection_editor/utils/useTraceUpdate.d.ts +1 -0
  68. package/dist/useCollectionEditorController.d.ts +6 -0
  69. package/dist/useCollectionEditorPlugin.d.ts +49 -0
  70. package/dist/useCollectionsConfigController.d.ts +6 -0
  71. package/dist/utils/arrays.d.ts +1 -0
  72. package/dist/utils/entities.d.ts +3 -0
  73. package/package.json +85 -0
  74. package/src/ConfigControllerProvider.tsx +338 -0
  75. package/src/index.ts +35 -0
  76. package/src/types/collection_editor_controller.tsx +43 -0
  77. package/src/types/collection_inference.ts +3 -0
  78. package/src/types/config_controller.tsx +60 -0
  79. package/src/types/config_permissions.ts +20 -0
  80. package/src/types/persisted_collection.ts +9 -0
  81. package/src/ui/CollectionViewHeaderAction.tsx +43 -0
  82. package/src/ui/EditorCollectionAction.tsx +109 -0
  83. package/src/ui/HomePageEditorCollectionAction.tsx +84 -0
  84. package/src/ui/MissingReferenceWidget.tsx +37 -0
  85. package/src/ui/NewCollectionButton.tsx +16 -0
  86. package/src/ui/NewCollectionCard.tsx +48 -0
  87. package/src/ui/PropertyAddColumnComponent.tsx +42 -0
  88. package/src/ui/RootCollectionSuggestions.tsx +63 -0
  89. package/src/ui/collection_editor/CollectionDetailsForm.tsx +365 -0
  90. package/src/ui/collection_editor/CollectionEditorDialog.tsx +801 -0
  91. package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +213 -0
  92. package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +506 -0
  93. package/src/ui/collection_editor/CollectionYupValidation.tsx +7 -0
  94. package/src/ui/collection_editor/EntityCustomViewsSelectDialog.tsx +37 -0
  95. package/src/ui/collection_editor/EnumForm.tsx +357 -0
  96. package/src/ui/collection_editor/GetCodeDialog.tsx +110 -0
  97. package/src/ui/collection_editor/PropertyEditView.tsx +615 -0
  98. package/src/ui/collection_editor/PropertyFieldPreview.tsx +207 -0
  99. package/src/ui/collection_editor/PropertySelectItem.tsx +32 -0
  100. package/src/ui/collection_editor/PropertyTree.tsx +252 -0
  101. package/src/ui/collection_editor/SubcollectionsEditTab.tsx +262 -0
  102. package/src/ui/collection_editor/SwitchControl.tsx +39 -0
  103. package/src/ui/collection_editor/UnsavedChangesDialog.tsx +47 -0
  104. package/src/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +37 -0
  105. package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +268 -0
  106. package/src/ui/collection_editor/import/clean_import_data.ts +53 -0
  107. package/src/ui/collection_editor/properties/BlockPropertyField.tsx +138 -0
  108. package/src/ui/collection_editor/properties/BooleanPropertyField.tsx +40 -0
  109. package/src/ui/collection_editor/properties/CommonPropertyFields.tsx +110 -0
  110. package/src/ui/collection_editor/properties/DateTimePropertyField.tsx +86 -0
  111. package/src/ui/collection_editor/properties/EnumPropertyField.tsx +114 -0
  112. package/src/ui/collection_editor/properties/KeyValuePropertyField.tsx +20 -0
  113. package/src/ui/collection_editor/properties/MapPropertyField.tsx +150 -0
  114. package/src/ui/collection_editor/properties/NumberPropertyField.tsx +38 -0
  115. package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +160 -0
  116. package/src/ui/collection_editor/properties/RepeatPropertyField.tsx +109 -0
  117. package/src/ui/collection_editor/properties/StoragePropertyField.tsx +200 -0
  118. package/src/ui/collection_editor/properties/StringPropertyField.tsx +79 -0
  119. package/src/ui/collection_editor/properties/UrlPropertyField.tsx +89 -0
  120. package/src/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx +45 -0
  121. package/src/ui/collection_editor/properties/validation/ArrayPropertyValidation.tsx +50 -0
  122. package/src/ui/collection_editor/properties/validation/GeneralPropertyValidation.tsx +61 -0
  123. package/src/ui/collection_editor/properties/validation/NumberPropertyValidation.tsx +115 -0
  124. package/src/ui/collection_editor/properties/validation/StringPropertyValidation.tsx +150 -0
  125. package/src/ui/collection_editor/properties/validation/ValidationPanel.tsx +28 -0
  126. package/src/ui/collection_editor/templates/blog_template.ts +115 -0
  127. package/src/ui/collection_editor/templates/pages_template.ts +188 -0
  128. package/src/ui/collection_editor/templates/products_template.ts +88 -0
  129. package/src/ui/collection_editor/templates/users_template.ts +42 -0
  130. package/src/ui/collection_editor/util.ts +28 -0
  131. package/src/ui/collection_editor/utils/strings.ts +9 -0
  132. package/src/ui/collection_editor/utils/supported_fields.tsx +29 -0
  133. package/src/ui/collection_editor/utils/update_property_for_widget.ts +271 -0
  134. package/src/ui/collection_editor/utils/useTraceUpdate.tsx +23 -0
  135. package/src/useCollectionEditorController.tsx +9 -0
  136. package/src/useCollectionEditorPlugin.tsx +154 -0
  137. package/src/useCollectionsConfigController.tsx +9 -0
  138. package/src/utils/arrays.ts +3 -0
  139. package/src/utils/entities.ts +38 -0
  140. package/src/vite-env.d.ts +1 -0
@@ -0,0 +1,115 @@
1
+ import { EntityCollection, makePropertiesEditable } from "@firecms/core";
2
+
3
+ export const blogCollectionTemplate:EntityCollection = {
4
+ id: "blog",
5
+ path: "blog",
6
+ name: "Blog",
7
+ singularName: "Blog entry",
8
+ icon: "article",
9
+ description: "A collection of blog entries",
10
+ defaultSize: "l",
11
+ properties: makePropertiesEditable({
12
+ name: {
13
+ name: "Name",
14
+ validation: { required: true },
15
+ dataType: "string"
16
+ },
17
+ header_image: {
18
+ name: "Header image",
19
+ dataType: "string",
20
+ storage: {
21
+ storagePath: "images",
22
+ acceptedFiles: ["image/*"],
23
+ metadata: {
24
+ cacheControl: "max-age=1000000"
25
+ }
26
+ }
27
+ },
28
+ content: {
29
+ name: "Content",
30
+ description: "Content blocks for the blog entry",
31
+ validation: { required: true },
32
+ dataType: "array",
33
+ oneOf: {
34
+ typeField: "type",
35
+ valueField: "value",
36
+ properties: {
37
+ text: {
38
+ dataType: "string",
39
+ name: "Text",
40
+ markdown: true
41
+ },
42
+ quote: {
43
+ dataType: "string",
44
+ name: "Quote",
45
+ multiline: true
46
+ },
47
+ images: {
48
+ name: "Images",
49
+ dataType: "array",
50
+ of: {
51
+ dataType: "string",
52
+ storage: {
53
+ storagePath: "images",
54
+ acceptedFiles: ["image/*"],
55
+ metadata: {
56
+ cacheControl: "max-age=1000000"
57
+ }
58
+ }
59
+ },
60
+ description: "This fields allows uploading multiple images at once and reordering"
61
+ },
62
+ products: {
63
+ name: "Products",
64
+ dataType: "array",
65
+ of: {
66
+ dataType: "reference",
67
+ path: "products",
68
+ previewProperties: ["name", "main_image"]
69
+ }
70
+ }
71
+ },
72
+ propertiesOrder: ["text", "quote", "images", "products"]
73
+ }
74
+ },
75
+ created_on: {
76
+ name: "Created on",
77
+ dataType: "date",
78
+ autoValue: "on_create"
79
+ },
80
+ status: {
81
+ name: "Status",
82
+ validation: { required: true },
83
+ dataType: "string",
84
+ enumValues: {
85
+ published: {
86
+ id: "published",
87
+ label: "Published",
88
+ },
89
+ draft: "Draft"
90
+ },
91
+ defaultValue: "draft"
92
+ },
93
+ publish_date: {
94
+ name: "Publish date",
95
+ dataType: "date",
96
+ clearable: true
97
+ },
98
+ reviewed: {
99
+ name: "Reviewed",
100
+ dataType: "boolean"
101
+ },
102
+ tags: {
103
+ name: "Tags",
104
+ description: "Example of generic array",
105
+ dataType: "array",
106
+ of: {
107
+ dataType: "string",
108
+ previewAsTag: true
109
+ }
110
+ }
111
+ }),
112
+ initialFilter: {
113
+ status: ["==", "published"]
114
+ }
115
+ };
@@ -0,0 +1,188 @@
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
+ matchesMessage: "Must be lowercase, alphanumeric, and hyphenated"
24
+ }
25
+ },
26
+ hero_section: {
27
+ dataType: "map",
28
+ name: "Hero Section",
29
+ properties: {
30
+ headline: {
31
+ dataType: "string",
32
+ name: "Headline",
33
+ validation: { required: true }
34
+ },
35
+ subhead: {
36
+ dataType: "string",
37
+ name: "Subheadline"
38
+ },
39
+ background_image: {
40
+ dataType: "string",
41
+ name: "Background Image",
42
+ storage: {
43
+ storagePath: "page_hero/images",
44
+ acceptedFiles: ["image/*"],
45
+ }
46
+ },
47
+ call_to_action: {
48
+ dataType: "string",
49
+ name: "Call to Action"
50
+ },
51
+ call_to_action_link: {
52
+ dataType: "string",
53
+ name: "CTA Link",
54
+ url: true
55
+ }
56
+ }
57
+ },
58
+ content: {
59
+ dataType: "array",
60
+ name: "Content",
61
+ oneOf: {
62
+ properties: {
63
+ section: {
64
+ dataType: "map",
65
+ name: "Section",
66
+ properties: {
67
+ title: {
68
+ dataType: "string",
69
+ name: "Section Title",
70
+ validation: { required: true }
71
+ },
72
+ content: {
73
+ dataType: "string",
74
+ name: "Section Content",
75
+ markdown: true
76
+ },
77
+ image: {
78
+ dataType: "string",
79
+ name: "Section Image",
80
+ storage: {
81
+ storagePath: "page_sections/images",
82
+ acceptedFiles: ["image/*"]
83
+ }
84
+ },
85
+ link: {
86
+ dataType: "string",
87
+ name: "Section Link",
88
+ url: true
89
+ }
90
+ }
91
+ },
92
+ image: {
93
+ dataType: "string",
94
+ name: "Image",
95
+ storage: {
96
+ storagePath: "page_sections/images",
97
+ acceptedFiles: ["image/*"]
98
+ }
99
+ },
100
+ slider: {
101
+ dataType: "array",
102
+ name: "Slider",
103
+ of: {
104
+ dataType: "map",
105
+ properties: {
106
+ title: {
107
+ dataType: "string",
108
+ name: "Title",
109
+ validation: { required: true }
110
+ },
111
+ image: {
112
+ dataType: "string",
113
+ storage: {
114
+ storagePath: "page_sections/images",
115
+ acceptedFiles: ["image/*"]
116
+ }
117
+ }
118
+ }
119
+ }
120
+ },
121
+ }
122
+ }
123
+ },
124
+ sidebar: {
125
+ dataType: "map",
126
+ name: "Sidebar",
127
+ properties: {
128
+ title: {
129
+ dataType: "string",
130
+ name: "Sidebar Title",
131
+ validation: { required: false }
132
+ },
133
+ content: {
134
+ dataType: "string",
135
+ name: "Sidebar Content",
136
+ markdown: true
137
+ }
138
+ }
139
+ },
140
+ seo_metadata: {
141
+ dataType: "map",
142
+ name: "SEO Metadata",
143
+ properties: {
144
+ meta_title: {
145
+ dataType: "string",
146
+ name: "Meta Title"
147
+ },
148
+ meta_description: {
149
+ dataType: "string",
150
+ name: "Meta Description"
151
+ },
152
+ focus_keywords: {
153
+ dataType: "array",
154
+ name: "Focus Keywords",
155
+ of: {
156
+ dataType: "string"
157
+ }
158
+ }
159
+ }
160
+ },
161
+ footer_override: {
162
+ dataType: "string",
163
+ name: "Footer Override",
164
+ markdown: true
165
+ },
166
+ publish_date: {
167
+ dataType: "date",
168
+ name: "Publish Date",
169
+ validation: { required: true }
170
+ },
171
+ last_updated: {
172
+ dataType: "date",
173
+ name: "Last Updated",
174
+ autoValue: "on_update"
175
+ },
176
+ is_published: {
177
+ dataType: "boolean",
178
+ name: "Is Published",
179
+ columnWidth: 100,
180
+ description: "Should this page be live on the site?"
181
+ },
182
+ author_uid: {
183
+ dataType: "reference",
184
+ name: "Author",
185
+ path: "users"
186
+ }
187
+ }
188
+ };
@@ -0,0 +1,88 @@
1
+ import { EntityCollection, makePropertiesEditable } from "@firecms/core";
2
+
3
+ export const productsCollectionTemplate: EntityCollection = {
4
+ id: "products",
5
+ path: "products",
6
+ name: "Products",
7
+ singularName: "Product",
8
+ icon: "shopping_cart",
9
+ description: "List of the products currently sold in your shop",
10
+ properties: makePropertiesEditable({
11
+ name: {
12
+ dataType: "string",
13
+ name: "Name",
14
+ description: "Name of this product",
15
+ validation: {
16
+ required: true
17
+ }
18
+ },
19
+ brand: {
20
+ dataType: "string",
21
+ name: "Brand",
22
+ validation: {
23
+ required: true
24
+ }
25
+ },
26
+ description: {
27
+ dataType: "string",
28
+ name: "Description",
29
+ description: "Description of this product, supports markdown",
30
+ markdown: true
31
+ },
32
+ main_image: {
33
+ dataType: "string",
34
+ name: "Image",
35
+ storage: {
36
+ storagePath: "images",
37
+ acceptedFiles: ["image/*"],
38
+ },
39
+ description: "Upload field for images"
40
+ },
41
+ available: {
42
+ dataType: "boolean",
43
+ name: "Available",
44
+ columnWidth: 100,
45
+ description: "Is this product available in the website"
46
+ },
47
+ price: {
48
+ dataType: "number",
49
+ name: "Price",
50
+ validation: {
51
+ requiredMessage: "You must set a positive price",
52
+ min: 0
53
+ }
54
+ },
55
+ images: {
56
+ dataType: "array",
57
+ name: "Images",
58
+ hideFromCollection: true,
59
+ of: {
60
+ dataType: "string",
61
+ storage: {
62
+ storagePath: "images",
63
+ acceptedFiles: ["image/*"]
64
+ }
65
+ }
66
+ },
67
+ related_products: {
68
+ dataType: "array",
69
+ name: "Related products",
70
+ description: "Products related to this one",
71
+ of: {
72
+ dataType: "reference",
73
+ path: "products"
74
+ }
75
+ },
76
+ metadata: {
77
+ name: "Metadata",
78
+ description: "This is an example of a map property",
79
+ dataType: "map",
80
+ keyValue: true
81
+ },
82
+ added_on: {
83
+ dataType: "date",
84
+ name: "Added on",
85
+ autoValue: "on_create"
86
+ }
87
+ })
88
+ };
@@ -0,0 +1,42 @@
1
+ import { EntityCollection, makePropertiesEditable } from "@firecms/core";
2
+
3
+ export const usersCollectionTemplate: EntityCollection = {
4
+ id: "users",
5
+ path: "users",
6
+ name: "Users",
7
+ singularName: "User",
8
+ description: "Registered users in the app/web",
9
+ icon: "person",
10
+ properties: makePropertiesEditable({
11
+ displayName: {
12
+ name: "Display name",
13
+ dataType: "string"
14
+ },
15
+ email: {
16
+ name: "Email",
17
+ dataType: "string",
18
+ email: true
19
+ },
20
+ emailVerified: {
21
+ name: "Email verified",
22
+ dataType: "boolean"
23
+ },
24
+ phone: {
25
+ name: "Phone",
26
+ dataType: "string"
27
+ },
28
+ favourite_products: {
29
+ name: "Favourite products",
30
+ dataType: "array",
31
+ of: {
32
+ dataType: "reference",
33
+ path: "products"
34
+ }
35
+ },
36
+ photoURL: {
37
+ name: "Photo URL",
38
+ dataType: "string",
39
+ url: "image"
40
+ }
41
+ }),
42
+ };
@@ -0,0 +1,28 @@
1
+ export function idToPropertiesPath(id: string): string {
2
+ return "properties." + id.replaceAll(".", ".properties.");
3
+ }
4
+
5
+ export function namespaceToPropertiesPath(namespace?: string): string {
6
+ return namespace
7
+ ? "properties." + namespace.replaceAll(".", ".properties.") + ".properties"
8
+ : "properties";
9
+ }
10
+
11
+ export function namespaceToPropertiesOrderPath(namespace?: string): string {
12
+ return namespace
13
+ ? "properties." + namespace.replaceAll(".", ".properties.") + ".propertiesOrder"
14
+ : "propertiesOrder";
15
+ }
16
+
17
+ export function getFullId(propertyKey: string, propertyNamespace?: string): string {
18
+ return propertyNamespace
19
+ ? `${propertyNamespace}.${propertyKey}`
20
+ : propertyKey;
21
+ }
22
+
23
+ export function getFullIdPath(propertyKey: string, propertyNamespace?: string): string {
24
+ const keyWithNamespace = propertyNamespace
25
+ ? `${propertyNamespace}.${propertyKey}`
26
+ : propertyKey;
27
+ return idToPropertiesPath(keyWithNamespace);
28
+ }
@@ -0,0 +1,9 @@
1
+ export function camelCase(str: string): string {
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
+ }, "");
9
+ }
@@ -0,0 +1,29 @@
1
+ import { DEFAULT_FIELD_CONFIGS, PropertyConfigId, PropertyConfig } from "@firecms/core";
2
+
3
+ export const supportedFieldsIds: PropertyConfigId[] = [
4
+ "text_field",
5
+ "multiline",
6
+ "markdown",
7
+ "url",
8
+ "email",
9
+ "select",
10
+ "multi_select",
11
+ "number_input",
12
+ "number_select",
13
+ "multi_number_select",
14
+ "file_upload",
15
+ "multi_file_upload",
16
+ "reference",
17
+ "multi_references",
18
+ "switch",
19
+ "date_time",
20
+ "group",
21
+ "key_value",
22
+ "repeat",
23
+ "block"
24
+ ];
25
+
26
+ export const supportedFields: Record<string, PropertyConfig> = Object.entries(DEFAULT_FIELD_CONFIGS)
27
+ .filter(([id]) => supportedFieldsIds.includes(id as PropertyConfigId))
28
+ .map(([id, config]) => ({ [id]: config }))
29
+ .reduce((a, b) => ({ ...a, ...b }), {});