@firecms/collection_editor 3.0.1 → 3.1.0-canary.02232f4

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 (119) hide show
  1. package/dist/ConfigControllerProvider.d.ts +6 -0
  2. package/dist/api/generateCollectionApi.d.ts +71 -0
  3. package/dist/api/index.d.ts +1 -0
  4. package/dist/index.d.ts +5 -1
  5. package/dist/index.es.js +15260 -8173
  6. package/dist/index.es.js.map +1 -1
  7. package/dist/index.umd.js +15257 -8170
  8. package/dist/index.umd.js.map +1 -1
  9. package/dist/locales/de.d.ts +120 -0
  10. package/dist/locales/en.d.ts +120 -0
  11. package/dist/locales/es.d.ts +120 -0
  12. package/dist/locales/fr.d.ts +120 -0
  13. package/dist/locales/hi.d.ts +120 -0
  14. package/dist/locales/it.d.ts +120 -0
  15. package/dist/locales/pt.d.ts +120 -0
  16. package/dist/types/collection_editor_controller.d.ts +14 -0
  17. package/dist/types/collection_inference.d.ts +8 -2
  18. package/dist/types/config_controller.d.ts +23 -2
  19. package/dist/ui/AddKanbanColumnAction.d.ts +11 -0
  20. package/dist/ui/KanbanSetupAction.d.ts +10 -0
  21. package/dist/ui/collection_editor/AICollectionGeneratorPopover.d.ts +37 -0
  22. package/dist/ui/collection_editor/AIModifiedPathsContext.d.ts +20 -0
  23. package/dist/ui/collection_editor/CollectionDetailsForm.d.ts +2 -3
  24. package/dist/ui/collection_editor/CollectionEditorDialog.d.ts +24 -0
  25. package/dist/ui/collection_editor/CollectionEditorWelcomeView.d.ts +4 -1
  26. package/dist/ui/collection_editor/CollectionJsonImportDialog.d.ts +7 -0
  27. package/dist/ui/collection_editor/CollectionYupValidation.d.ts +9 -13
  28. package/dist/ui/collection_editor/DisplaySettingsForm.d.ts +3 -0
  29. package/dist/ui/collection_editor/EntityActionsEditTab.d.ts +2 -1
  30. package/dist/ui/collection_editor/ExtendSettingsForm.d.ts +14 -0
  31. package/dist/ui/collection_editor/GeneralSettingsForm.d.ts +7 -0
  32. package/dist/ui/collection_editor/KanbanConfigSection.d.ts +4 -0
  33. package/dist/ui/collection_editor/PropertyEditView.d.ts +6 -1
  34. package/dist/ui/collection_editor/PropertyTree.d.ts +2 -1
  35. package/dist/ui/collection_editor/SubcollectionsEditTab.d.ts +2 -1
  36. package/dist/ui/collection_editor/ViewModeSwitch.d.ts +6 -0
  37. package/dist/ui/collection_editor/properties/EnumPropertyField.d.ts +2 -1
  38. package/dist/ui/collection_editor/properties/conditions/ConditionsEditor.d.ts +10 -0
  39. package/dist/ui/collection_editor/properties/conditions/ConditionsPanel.d.ts +2 -0
  40. package/dist/ui/collection_editor/properties/conditions/EnumConditionsEditor.d.ts +6 -0
  41. package/dist/ui/collection_editor/properties/conditions/index.d.ts +6 -0
  42. package/dist/ui/collection_editor/properties/conditions/property_paths.d.ts +19 -0
  43. package/dist/useCollectionEditorPlugin.d.ts +7 -1
  44. package/dist/utils/validateCollectionJson.d.ts +22 -0
  45. package/package.json +15 -15
  46. package/src/ConfigControllerProvider.tsx +82 -47
  47. package/src/api/generateCollectionApi.ts +119 -0
  48. package/src/api/index.ts +1 -0
  49. package/src/index.ts +28 -1
  50. package/src/locales/de.ts +125 -0
  51. package/src/locales/en.ts +145 -0
  52. package/src/locales/es.ts +125 -0
  53. package/src/locales/fr.ts +125 -0
  54. package/src/locales/hi.ts +125 -0
  55. package/src/locales/it.ts +125 -0
  56. package/src/locales/pt.ts +125 -0
  57. package/src/types/collection_editor_controller.tsx +16 -3
  58. package/src/types/collection_inference.ts +15 -2
  59. package/src/types/config_controller.tsx +27 -2
  60. package/src/ui/AddKanbanColumnAction.tsx +203 -0
  61. package/src/ui/EditorCollectionAction.tsx +3 -3
  62. package/src/ui/EditorCollectionActionStart.tsx +1 -2
  63. package/src/ui/EditorEntityAction.tsx +3 -2
  64. package/src/ui/HomePageEditorCollectionAction.tsx +41 -13
  65. package/src/ui/KanbanSetupAction.tsx +38 -0
  66. package/src/ui/MissingReferenceWidget.tsx +1 -1
  67. package/src/ui/NewCollectionButton.tsx +4 -2
  68. package/src/ui/NewCollectionCard.tsx +7 -4
  69. package/src/ui/PropertyAddColumnComponent.tsx +4 -3
  70. package/src/ui/collection_editor/AICollectionGeneratorPopover.tsx +243 -0
  71. package/src/ui/collection_editor/AIModifiedPathsContext.tsx +88 -0
  72. package/src/ui/collection_editor/CollectionDetailsForm.tsx +222 -267
  73. package/src/ui/collection_editor/CollectionEditorDialog.tsx +270 -198
  74. package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +138 -71
  75. package/src/ui/collection_editor/CollectionJsonImportDialog.tsx +171 -0
  76. package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +202 -101
  77. package/src/ui/collection_editor/DisplaySettingsForm.tsx +335 -0
  78. package/src/ui/collection_editor/EntityActionsEditTab.tsx +106 -97
  79. package/src/ui/collection_editor/EntityActionsSelectDialog.tsx +8 -10
  80. package/src/ui/collection_editor/EntityCustomViewsSelectDialog.tsx +5 -7
  81. package/src/ui/collection_editor/EnumForm.tsx +153 -102
  82. package/src/ui/collection_editor/ExtendSettingsForm.tsx +94 -0
  83. package/src/ui/collection_editor/GeneralSettingsForm.tsx +335 -0
  84. package/src/ui/collection_editor/GetCodeDialog.tsx +63 -41
  85. package/src/ui/collection_editor/KanbanConfigSection.tsx +209 -0
  86. package/src/ui/collection_editor/LayoutModeSwitch.tsx +27 -43
  87. package/src/ui/collection_editor/PropertyEditView.tsx +272 -199
  88. package/src/ui/collection_editor/PropertyFieldPreview.tsx +1 -1
  89. package/src/ui/collection_editor/PropertyTree.tsx +130 -58
  90. package/src/ui/collection_editor/SubcollectionsEditTab.tsx +169 -163
  91. package/src/ui/collection_editor/UnsavedChangesDialog.tsx +0 -2
  92. package/src/ui/collection_editor/ViewModeSwitch.tsx +43 -0
  93. package/src/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +6 -3
  94. package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +5 -2
  95. package/src/ui/collection_editor/properties/BlockPropertyField.tsx +0 -2
  96. package/src/ui/collection_editor/properties/BooleanPropertyField.tsx +4 -1
  97. package/src/ui/collection_editor/properties/CommonPropertyFields.tsx +6 -4
  98. package/src/ui/collection_editor/properties/DateTimePropertyField.tsx +126 -42
  99. package/src/ui/collection_editor/properties/EnumPropertyField.tsx +32 -24
  100. package/src/ui/collection_editor/properties/MapPropertyField.tsx +8 -9
  101. package/src/ui/collection_editor/properties/MarkdownPropertyField.tsx +128 -53
  102. package/src/ui/collection_editor/properties/NumberPropertyField.tsx +3 -1
  103. package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +5 -4
  104. package/src/ui/collection_editor/properties/StoragePropertyField.tsx +47 -52
  105. package/src/ui/collection_editor/properties/StringPropertyField.tsx +3 -1
  106. package/src/ui/collection_editor/properties/UrlPropertyField.tsx +12 -10
  107. package/src/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx +23 -4
  108. package/src/ui/collection_editor/properties/conditions/ConditionsEditor.tsx +866 -0
  109. package/src/ui/collection_editor/properties/conditions/ConditionsPanel.tsx +28 -0
  110. package/src/ui/collection_editor/properties/conditions/EnumConditionsEditor.tsx +599 -0
  111. package/src/ui/collection_editor/properties/conditions/index.ts +6 -0
  112. package/src/ui/collection_editor/properties/conditions/property_paths.ts +92 -0
  113. package/src/ui/collection_editor/properties/validation/ArrayPropertyValidation.tsx +5 -2
  114. package/src/ui/collection_editor/properties/validation/GeneralPropertyValidation.tsx +7 -5
  115. package/src/ui/collection_editor/properties/validation/NumberPropertyValidation.tsx +10 -7
  116. package/src/ui/collection_editor/properties/validation/StringPropertyValidation.tsx +11 -9
  117. package/src/ui/collection_editor/properties/validation/ValidationPanel.tsx +5 -2
  118. package/src/useCollectionEditorPlugin.tsx +53 -22
  119. package/src/utils/validateCollectionJson.ts +380 -0
@@ -5,7 +5,8 @@ import {
5
5
  EntityCustomView,
6
6
  resolveEntityView,
7
7
  useCustomizationController,
8
- User
8
+ User,
9
+ useTranslation
9
10
  } from "@firecms/core";
10
11
  import {
11
12
  AddIcon,
@@ -30,22 +31,25 @@ import { EntityCustomViewsSelectDialog } from "./EntityCustomViewsSelectDialog";
30
31
  import { useFormex } from "@firecms/formex";
31
32
 
32
33
  export function SubcollectionsEditTab({
33
- collection,
34
- parentCollection,
35
- configController,
36
- collectionInference,
37
- getUser,
38
- parentCollectionIds
39
- }: {
34
+ collection,
35
+ parentCollection,
36
+ configController,
37
+ collectionInference,
38
+ getUser,
39
+ parentCollectionIds,
40
+ embedded = false
41
+ }: {
40
42
  collection: PersistedCollection,
41
43
  parentCollection?: EntityCollection,
42
44
  configController: CollectionsConfigController;
43
45
  collectionInference?: CollectionInference;
44
46
  getUser?: (uid: string) => User | null;
45
47
  parentCollectionIds?: string[];
48
+ embedded?: boolean;
46
49
  }) {
47
50
 
48
51
  const { entityViews: contextEntityViews } = useCustomizationController();
52
+ const { t } = useTranslation();
49
53
 
50
54
  const [subcollectionToDelete, setSubcollectionToDelete] = React.useState<string | undefined>();
51
55
  const [addEntityViewDialogOpen, setAddEntityViewDialogOpen] = React.useState<boolean>(false);
@@ -68,177 +72,179 @@ export function SubcollectionsEditTab({
68
72
  const hardCodedEntityViews = collection.entityViews?.filter(e => typeof e !== "string") as EntityCustomView[] ?? [];
69
73
  const totalEntityViews = resolvedEntityViews.length + hardCodedEntityViews.length;
70
74
 
71
- return (
72
- <div className={"overflow-auto my-auto"}>
73
- <Container maxWidth={"2xl"} className={"flex flex-col gap-4 p-8 m-auto"}>
74
- <div className={"flex flex-col gap-16"}>
75
+ const content = (
76
+ <div className={"flex flex-col gap-16"}>
75
77
 
76
- <div className={"flex-grow flex flex-col gap-4 items-start"}>
77
- <Typography variant={"h5"}>
78
- Subcollections of {values.name}
79
- </Typography>
78
+ <div className={"flex-grow flex flex-col gap-4 items-start"}>
79
+ <Typography variant={"h6"}>
80
+ {t("subcollections_of")} {values.name}
81
+ </Typography>
80
82
 
81
- <Paper className={"flex flex-col gap-4 p-2 w-full"}>
82
- {subcollections && subcollections.length > 0 && <Table>
83
- <TableBody>
84
- {subcollections.map((subcollection) => (
85
- <TableRow key={subcollection.path}
86
- onClick={() => setCurrentDialog({
87
- isNewCollection: false,
88
- editedCollectionId: subcollection.id
89
- })}>
90
- <TableCell
91
- align="left">
92
- <Typography variant={"subtitle2"} className={"flex-grow"}>
93
- {subcollection.name}
94
- </Typography>
95
- </TableCell>
96
- <TableCell
97
- align="right">
98
- <Tooltip title={"Remove"}
99
- asChild={true}>
100
- <IconButton size="small"
101
- onClick={(e) => {
102
- e.preventDefault();
103
- e.stopPropagation();
104
- setSubcollectionToDelete(subcollection.id);
105
- }}
106
- color="inherit">
107
- <DeleteIcon size={"small"}/>
108
- </IconButton>
109
- </Tooltip>
110
- </TableCell>
111
- </TableRow>
112
- ))}
113
- </TableBody>
114
- </Table>}
83
+ <Paper className={"flex flex-col gap-4 p-2 w-full"}>
84
+ {subcollections && subcollections.length > 0 && <Table>
85
+ <TableBody>
86
+ {subcollections.map((subcollection) => (
87
+ <TableRow key={subcollection.path}
88
+ onClick={() => setCurrentDialog({
89
+ isNewCollection: false,
90
+ editedCollectionId: subcollection.id
91
+ })}>
92
+ <TableCell
93
+ align="left">
94
+ <Typography variant={"subtitle2"} className={"flex-grow"}>
95
+ {subcollection.name}
96
+ </Typography>
97
+ </TableCell>
98
+ <TableCell
99
+ align="right">
100
+ <Tooltip title={t("remove")}
101
+ asChild={true}>
102
+ <IconButton size="small"
103
+ onClick={(e) => {
104
+ e.preventDefault();
105
+ e.stopPropagation();
106
+ setSubcollectionToDelete(subcollection.id);
107
+ }}
108
+ color="inherit">
109
+ <DeleteIcon size={"small"} />
110
+ </IconButton>
111
+ </Tooltip>
112
+ </TableCell>
113
+ </TableRow>
114
+ ))}
115
+ </TableBody>
116
+ </Table>}
115
117
 
116
- <Button
117
- onClick={() => {
118
- setCurrentDialog({
119
- isNewCollection: true
120
- });
121
- }}
122
- variant={"text"}
123
- startIcon={<AddIcon/>}>
124
- Add subcollection
125
- </Button>
118
+ <Button
119
+ onClick={() => {
120
+ setCurrentDialog({
121
+ isNewCollection: true
122
+ });
123
+ }}
124
+ startIcon={<AddIcon />}>
125
+ {t("add_subcollection")}
126
+ </Button>
126
127
 
127
- </Paper>
128
+ </Paper>
128
129
 
129
- </div>
130
+ </div>
130
131
 
131
- <div className={"flex-grow flex flex-col gap-4 items-start"}>
132
- <Typography variant={"h5"}>
133
- Custom views
134
- </Typography>
132
+ <div className={"flex-grow flex flex-col gap-4 items-start"}>
133
+ <Typography variant={"h6"}>
134
+ {t("custom_views")}
135
+ </Typography>
135
136
 
136
- {totalEntityViews === 0 &&
137
- <Alert action={<Button variant="text"
138
- size={"small"}
139
- href={"https://firecms.co/docs/cloud/quickstart"}
140
- component={"a"}
141
- rel="noopener noreferrer"
142
- target="_blank">More info</Button>}>
143
- Define your own custom views by uploading them with the CLI.
144
- </Alert>
145
- }
137
+ {totalEntityViews === 0 &&
138
+ <Alert action={<Button variant="text"
139
+ size={"small"}
140
+ href={"https://firecms.co/docs/cloud/quickstart"}
141
+ component={"a"}
142
+ rel="noopener noreferrer"
143
+ target="_blank">{t("more_info")}</Button>}>
144
+ {t("define_custom_views_cli")}
145
+ </Alert>
146
+ }
146
147
 
147
- {<>
148
- <Paper className={"flex flex-col gap-4 p-2 w-full"}>
149
- <Table>
150
- <TableBody>
151
- {resolvedEntityViews.map((view) => (
152
- <TableRow key={view.key}>
153
- <TableCell
154
- align="left">
155
- <Typography variant={"subtitle2"} className={"flex-grow"}>
156
- {view.name}
157
- </Typography>
158
- </TableCell>
159
- <TableCell
160
- align="right">
161
- <Tooltip title={"Remove"}
162
- asChild={true}>
163
- <IconButton size="small"
164
- onClick={(e) => {
165
- e.preventDefault();
166
- e.stopPropagation();
167
- setViewToDelete(view.key);
168
- }}
169
- color="inherit">
170
- <DeleteIcon size={"small"}/>
171
- </IconButton>
172
- </Tooltip>
173
- </TableCell>
174
- </TableRow>
175
- ))}
176
- {hardCodedEntityViews.map((view) => (
177
- <TableRow key={view.key}>
178
- <TableCell
179
- align="left">
180
- <Typography variant={"subtitle2"} className={"flex-grow"}>
181
- {view.name}
182
- </Typography>
183
- <Typography variant={"caption"} className={"flex-grow"}>
184
- This view is defined in code with
185
- key <code>{view.key}</code>
186
- </Typography>
187
- </TableCell>
188
- </TableRow>
189
- ))}
190
- </TableBody>
191
- </Table>
148
+ {<>
149
+ <Paper className={"flex flex-col gap-4 p-2 w-full"}>
150
+ <Table>
151
+ <TableBody>
152
+ {resolvedEntityViews.map((view) => (
153
+ <TableRow key={view.key}>
154
+ <TableCell
155
+ align="left">
156
+ <Typography variant={"subtitle2"} className={"flex-grow"}>
157
+ {view.name}
158
+ </Typography>
159
+ </TableCell>
160
+ <TableCell
161
+ align="right">
162
+ <Tooltip title={t("remove")}
163
+ asChild={true}>
164
+ <IconButton size="small"
165
+ onClick={(e) => {
166
+ e.preventDefault();
167
+ e.stopPropagation();
168
+ setViewToDelete(view.key);
169
+ }}
170
+ color="inherit">
171
+ <DeleteIcon size={"small"} />
172
+ </IconButton>
173
+ </Tooltip>
174
+ </TableCell>
175
+ </TableRow>
176
+ ))}
177
+ {hardCodedEntityViews.map((view) => (
178
+ <TableRow key={view.key}>
179
+ <TableCell
180
+ align="left">
181
+ <Typography variant={"subtitle2"} className={"flex-grow"}>
182
+ {view.name}
183
+ </Typography>
184
+ <Typography variant={"caption"} className={"flex-grow"}>
185
+ {t("view_defined_in_code")} <code>{view.key}</code>
186
+ </Typography>
187
+ </TableCell>
188
+ </TableRow>
189
+ ))}
190
+ </TableBody>
191
+ </Table>
192
192
 
193
- <Button
194
- onClick={() => {
195
- setAddEntityViewDialogOpen(true);
196
- }}
197
- variant={"text"}
198
- startIcon={<AddIcon/>}>
199
- Add custom entity view
200
- </Button>
201
- </Paper>
193
+ <Button
194
+ onClick={() => {
195
+ setAddEntityViewDialogOpen(true);
196
+ }}
197
+ startIcon={<AddIcon />}>
198
+ {t("add_custom_entity_view")}
199
+ </Button>
200
+ </Paper>
202
201
 
203
- </>}
202
+ </>}
204
203
 
205
204
 
206
- </div>
205
+ </div>
207
206
 
208
- </div>
209
- </Container>
207
+ </div>
208
+ );
210
209
 
211
- <div style={{ height: "52px" }}/>
210
+ return (
211
+ <>
212
+ {embedded ? (
213
+ content
214
+ ) : (
215
+ <div className={"overflow-auto my-auto"}>
216
+ <Container maxWidth={"2xl"} className={"flex flex-col gap-4 p-8 m-auto"}>
217
+ {content}
218
+ </Container>
219
+ <div style={{ height: "52px" }} />
220
+ </div>
221
+ )}
212
222
 
213
223
  {subcollectionToDelete &&
214
224
  <ConfirmationDialog open={Boolean(subcollectionToDelete)}
215
- onAccept={() => {
216
- const props = {
217
- id: subcollectionToDelete,
218
- parentCollectionIds: [...(parentCollectionIds ?? []), collection.id]
219
- };
220
- console.debug("Deleting subcollection", props)
221
- configController.deleteCollection(props).then(() => {
222
- setSubcollectionToDelete(undefined);
223
- setSubcollections(subcollections?.filter(e => e.id !== subcollectionToDelete))
224
- });
225
- }}
226
- onCancel={() => setSubcollectionToDelete(undefined)}
227
- title={<>Delete this subcollection?</>}
228
- body={<> This will <b>not
229
- delete any data</b>, only
230
- the collection in the CMS</>}/>}
225
+ onAccept={() => {
226
+ const props = {
227
+ id: subcollectionToDelete,
228
+ parentCollectionIds: [...(parentCollectionIds ?? []), collection.id]
229
+ };
230
+ console.debug("Deleting subcollection", props)
231
+ configController.deleteCollection(props).then(() => {
232
+ setSubcollectionToDelete(undefined);
233
+ setSubcollections(subcollections?.filter(e => e.id !== subcollectionToDelete))
234
+ });
235
+ }}
236
+ onCancel={() => setSubcollectionToDelete(undefined)}
237
+ title={<>{t("delete_this_subcollection")}</>}
238
+ body={<>{t("remove_collection_warning")}</>} />}
231
239
  {viewToDelete &&
232
240
  <ConfirmationDialog open={Boolean(viewToDelete)}
233
- onAccept={() => {
234
- setFieldValue("entityViews", values.entityViews?.filter(e => e !== viewToDelete));
235
- setViewToDelete(undefined);
236
- }}
237
- onCancel={() => setViewToDelete(undefined)}
238
- title={<>Remove this view?</>}
239
- body={<>This will <b>not
240
- delete any data</b>, only
241
- the view in the CMS</>}/>}
241
+ onAccept={() => {
242
+ setFieldValue("entityViews", values.entityViews?.filter(e => e !== viewToDelete));
243
+ setViewToDelete(undefined);
244
+ }}
245
+ onCancel={() => setViewToDelete(undefined)}
246
+ title={<>{t("remove_this_view")}</>}
247
+ body={<>{t("remove_view_warning")}</>} />}
242
248
 
243
249
  <CollectionEditorDialog
244
250
  open={Boolean(currentDialog)}
@@ -254,7 +260,7 @@ export function SubcollectionsEditTab({
254
260
  setSubcollections([...subcollections, updatedCollection]);
255
261
  }
256
262
  setCurrentDialog(undefined);
257
- }}/>
263
+ }} />
258
264
 
259
265
  <EntityCustomViewsSelectDialog
260
266
  open={addEntityViewDialogOpen}
@@ -263,7 +269,7 @@ export function SubcollectionsEditTab({
263
269
  setFieldValue("entityViews", [...(values.entityViews ?? []), selectedViewKey]);
264
270
  }
265
271
  setAddEntityViewDialogOpen(false);
266
- }}/>
267
- </div>
272
+ }} />
273
+ </>
268
274
  );
269
275
  }
@@ -38,10 +38,8 @@ export function UnsavedChangesDialog({
38
38
 
39
39
  <DialogActions>
40
40
  <Button variant="text"
41
- color={"primary"}
42
41
  onClick={handleCancel} autoFocus> Cancel </Button>
43
42
  <Button
44
- color={"primary"}
45
43
  onClick={handleOk}> Ok </Button>
46
44
  </DialogActions>
47
45
  </Dialog>
@@ -0,0 +1,43 @@
1
+ import { ViewMode, useTranslation } from "@firecms/core";
2
+ import { AppsIcon, cls, ListIcon, ToggleButtonGroup, Typography, ViewKanbanIcon } from "@firecms/ui";
3
+
4
+ export function ViewModeSwitch({
5
+ value,
6
+ onChange,
7
+ className
8
+ }: {
9
+ value: ViewMode;
10
+ onChange: (value: ViewMode) => void;
11
+ className?: string;
12
+ }) {
13
+
14
+ const { t } = useTranslation();
15
+
16
+ return <div className={cls(className)}>
17
+ <Typography variant={"label"} color={"secondary"} className={"ml-3.5"}>{t("default_collection_view")}</Typography>
18
+ <div className={"my-2"}>
19
+ <ToggleButtonGroup
20
+ value={value}
21
+ onValueChange={onChange}
22
+ options={[
23
+ {
24
+ value: "table",
25
+ label: t("table_view"),
26
+ icon: <ListIcon />
27
+ },
28
+ {
29
+ value: "cards",
30
+ label: t("cards_view"),
31
+ icon: <AppsIcon />
32
+ },
33
+ {
34
+ value: "kanban",
35
+ label: t("kanban_view"),
36
+ icon: <ViewKanbanIcon />
37
+ }
38
+ ]}
39
+ />
40
+ </div>
41
+ <Typography variant={"caption"} color={"secondary"} className={"ml-3.5"}>{t("choose_how_entities_displayed_default")}</Typography>
42
+ </div>
43
+ }
@@ -5,7 +5,8 @@ import {
5
5
  Properties,
6
6
  useAuthController,
7
7
  useNavigationController,
8
- useSelectionController
8
+ useSelectionController,
9
+ useTranslation
9
10
  } from "@firecms/core";
10
11
  import { useEffect, useState } from "react";
11
12
  import { Typography } from "@firecms/ui";
@@ -19,6 +20,8 @@ export function CollectionEditorImportDataPreview({
19
20
  properties: Properties,
20
21
  propertiesOrder: string[]
21
22
  }) {
23
+ const { t } = useTranslation();
24
+
22
25
 
23
26
  const authController = useAuthController();
24
27
  const navigation = useNavigationController();
@@ -46,8 +49,8 @@ export function CollectionEditorImportDataPreview({
46
49
 
47
50
  return <EntityCollectionTable
48
51
  title={<div>
49
- <Typography variant={"subtitle2"}>Imported data preview</Typography>
50
- <Typography variant={"caption"}>Entities with the same id will be overwritten</Typography>
52
+ <Typography variant={"subtitle2"}>{t("imported_data_preview")}</Typography>
53
+ <Typography variant={"caption"}>{t("entities_with_same_id_overwritten")}</Typography>
51
54
  </div>}
52
55
  tableController={{
53
56
  data: importConfig.entities,
@@ -6,7 +6,8 @@ import {
6
6
  } from "@firecms/data_import";
7
7
  import { getIn, useFormex } from "@firecms/formex";
8
8
 
9
- import { getFieldConfig, getFieldId, Properties, Property, PropertyConfig, PropertyConfigBadge, } from "@firecms/core";
9
+ import { getFieldConfig, getFieldId, Properties, Property, PropertyConfig, PropertyConfigBadge, useTranslation
10
+ } from "@firecms/core";
10
11
  import { cls, Container, Select, SelectItem, Tooltip, Typography } from "@firecms/ui";
11
12
  import React, { useState } from "react";
12
13
  import { OnPropertyChangedParams, PropertyFormDialog, PropertyWithId } from "../PropertyEditView";
@@ -26,6 +27,8 @@ export function CollectionEditorImportMapping({
26
27
  propertyConfigs: Record<string, PropertyConfig>,
27
28
  collectionEditable: boolean
28
29
  }) {
30
+ const { t } = useTranslation();
31
+
29
32
 
30
33
  // const {
31
34
  // values,
@@ -142,7 +145,7 @@ export function CollectionEditorImportMapping({
142
145
  <div className={"overflow-auto my-auto"}>
143
146
  <Container maxWidth={"6xl"} className={"flex flex-col gap-4 p-8 m-auto"}>
144
147
 
145
- <Typography variant="h6" className={"my-4 ml-3.5"}>Data property mapping</Typography>
148
+ <Typography variant="h6" className={"my-4 ml-3.5"}>{t("data_property_mapping")}</Typography>
146
149
 
147
150
  <DataNewPropertiesMapping importConfig={importConfig}
148
151
  destinationProperties={values.properties as Properties}
@@ -71,8 +71,6 @@ export function BlockPropertyField({
71
71
 
72
72
  const addChildButton = <Button
73
73
  autoFocus
74
- color="primary"
75
-
76
74
  onClick={() => setPropertyDialogOpen(true)}
77
75
  startIcon={<AddIcon/>}
78
76
  >
@@ -4,11 +4,13 @@ import { Field, FormexFieldProps, getIn, useFormex } from "@firecms/formex";
4
4
  import { GeneralPropertyValidation } from "./validation/GeneralPropertyValidation";
5
5
  import { ValidationPanel } from "./validation/ValidationPanel";
6
6
  import { SwitchControl } from "../SwitchControl";
7
+ import { useTranslation } from "@firecms/core";
7
8
 
8
9
  export function BooleanPropertyField({ disabled }: {
9
10
  disabled: boolean;
10
11
  }) {
11
12
  const { values } = useFormex();
13
+ const { t } = useTranslation();
12
14
  const defaultValue = getIn(values, "defaultValue");
13
15
 
14
16
  return (
@@ -27,7 +29,8 @@ export function BooleanPropertyField({ disabled }: {
27
29
  name={"defaultValue"}>
28
30
  {({ field, form }: FormexFieldProps) => {
29
31
  return <SwitchControl
30
- label={defaultValue === null || defaultValue === undefined ? "Default value not set" : ("Default value is " + defaultValue.toString())}
32
+ size={"medium"}
33
+ label={defaultValue === null || defaultValue === undefined ? t("default_value_not_set") : t("default_value_is", { value: defaultValue.toString() })}
31
34
  disabled={disabled}
32
35
  allowIndeterminate={true} field={field}
33
36
  form={form}/>
@@ -2,7 +2,7 @@ import { Field, getIn, useFormex } from "@firecms/formex";
2
2
  import { DebouncedTextField } from "@firecms/ui";
3
3
  import { PropertyWithId } from "../PropertyEditView";
4
4
  import React from "react";
5
- import { FieldCaption, prettifyIdentifier, toSnakeCase } from "@firecms/core";
5
+ import { FieldCaption, prettifyIdentifier, toSnakeCase, useTranslation } from "@firecms/core";
6
6
 
7
7
  type CommonPropertyFieldsProps = {
8
8
  showErrors: boolean,
@@ -30,6 +30,8 @@ export const CommonPropertyFields = React.forwardRef<HTMLDivElement, CommonPrope
30
30
  validate
31
31
  } = useFormex<PropertyWithId>();
32
32
 
33
+ const { t } = useTranslation();
34
+
33
35
  const name = "name";
34
36
  const nameError = showErrors && getIn(errors, name);
35
37
 
@@ -58,7 +60,7 @@ export const CommonPropertyFields = React.forwardRef<HTMLDivElement, CommonPrope
58
60
  setFieldTouched(name, true);
59
61
  }}
60
62
  style={{ fontSize: 20 }}
61
- placeholder={"Field name"}
63
+ placeholder={t("field_name")}
62
64
  required
63
65
  disabled={disabled}
64
66
  error={Boolean(nameError)}/>
@@ -72,7 +74,7 @@ export const CommonPropertyFields = React.forwardRef<HTMLDivElement, CommonPrope
72
74
  <Field
73
75
  name={id}
74
76
  as={DebouncedTextField}
75
- label={"ID"}
77
+ label={t("id")}
76
78
  value={values[id]}
77
79
  onChange={(e: any) => {
78
80
  const newIdValue = e.target.value;
@@ -95,7 +97,7 @@ export const CommonPropertyFields = React.forwardRef<HTMLDivElement, CommonPrope
95
97
  <div>
96
98
  <Field name={description}
97
99
  as={DebouncedTextField}
98
- label={"Description"}
100
+ label={t("description")}
99
101
  disabled={disabled}
100
102
  error={Boolean(descriptionError)}/>
101
103
  <FieldCaption error={Boolean(descriptionError)}>