@firecms/collection_editor 3.1.0 → 3.2.0-canary.44dc65b

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 (63) hide show
  1. package/dist/index.es.js +6887 -3709
  2. package/dist/index.es.js.map +1 -1
  3. package/dist/index.umd.js +6885 -3707
  4. package/dist/index.umd.js.map +1 -1
  5. package/dist/locales/de.d.ts +118 -0
  6. package/dist/locales/en.d.ts +118 -0
  7. package/dist/locales/es.d.ts +118 -0
  8. package/dist/locales/fr.d.ts +118 -0
  9. package/dist/locales/hi.d.ts +118 -0
  10. package/dist/locales/it.d.ts +118 -0
  11. package/dist/locales/pt.d.ts +118 -0
  12. package/package.json +8 -8
  13. package/src/locales/de.ts +123 -0
  14. package/src/locales/en.ts +143 -0
  15. package/src/locales/es.ts +123 -0
  16. package/src/locales/fr.ts +123 -0
  17. package/src/locales/hi.ts +123 -0
  18. package/src/locales/it.ts +123 -0
  19. package/src/locales/pt.ts +123 -0
  20. package/src/ui/EditorCollectionAction.tsx +3 -3
  21. package/src/ui/EditorEntityAction.tsx +3 -2
  22. package/src/ui/NewCollectionButton.tsx +3 -1
  23. package/src/ui/NewCollectionCard.tsx +7 -4
  24. package/src/ui/PropertyAddColumnComponent.tsx +3 -2
  25. package/src/ui/collection_editor/AICollectionGeneratorPopover.tsx +11 -10
  26. package/src/ui/collection_editor/CollectionDetailsForm.tsx +26 -24
  27. package/src/ui/collection_editor/CollectionEditorDialog.tsx +42 -38
  28. package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +19 -18
  29. package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +12 -10
  30. package/src/ui/collection_editor/DisplaySettingsForm.tsx +19 -17
  31. package/src/ui/collection_editor/EntityActionsEditTab.tsx +11 -12
  32. package/src/ui/collection_editor/EntityActionsSelectDialog.tsx +5 -6
  33. package/src/ui/collection_editor/EntityCustomViewsSelectDialog.tsx +5 -5
  34. package/src/ui/collection_editor/EnumForm.tsx +6 -2
  35. package/src/ui/collection_editor/ExtendSettingsForm.tsx +8 -7
  36. package/src/ui/collection_editor/GeneralSettingsForm.tsx +36 -38
  37. package/src/ui/collection_editor/GetCodeDialog.tsx +13 -12
  38. package/src/ui/collection_editor/KanbanConfigSection.tsx +11 -9
  39. package/src/ui/collection_editor/LayoutModeSwitch.tsx +7 -4
  40. package/src/ui/collection_editor/PropertyEditView.tsx +74 -65
  41. package/src/ui/collection_editor/SubcollectionsEditTab.tsx +16 -19
  42. package/src/ui/collection_editor/ViewModeSwitch.tsx +8 -6
  43. package/src/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +6 -3
  44. package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +5 -2
  45. package/src/ui/collection_editor/properties/BooleanPropertyField.tsx +3 -1
  46. package/src/ui/collection_editor/properties/CommonPropertyFields.tsx +6 -4
  47. package/src/ui/collection_editor/properties/DateTimePropertyField.tsx +20 -18
  48. package/src/ui/collection_editor/properties/EnumPropertyField.tsx +5 -4
  49. package/src/ui/collection_editor/properties/MapPropertyField.tsx +8 -7
  50. package/src/ui/collection_editor/properties/MarkdownPropertyField.tsx +22 -23
  51. package/src/ui/collection_editor/properties/NumberPropertyField.tsx +3 -1
  52. package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +5 -4
  53. package/src/ui/collection_editor/properties/StoragePropertyField.tsx +46 -51
  54. package/src/ui/collection_editor/properties/StringPropertyField.tsx +3 -1
  55. package/src/ui/collection_editor/properties/UrlPropertyField.tsx +12 -10
  56. package/src/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx +7 -4
  57. package/src/ui/collection_editor/properties/conditions/ConditionsEditor.tsx +8 -3
  58. package/src/ui/collection_editor/properties/validation/ArrayPropertyValidation.tsx +5 -2
  59. package/src/ui/collection_editor/properties/validation/GeneralPropertyValidation.tsx +7 -5
  60. package/src/ui/collection_editor/properties/validation/NumberPropertyValidation.tsx +10 -7
  61. package/src/ui/collection_editor/properties/validation/StringPropertyValidation.tsx +11 -9
  62. package/src/ui/collection_editor/properties/validation/ValidationPanel.tsx +4 -1
  63. package/src/useCollectionEditorPlugin.tsx +22 -6
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { getIn, useFormex } from "@firecms/formex";
3
- import { FieldCaption, NumberProperty, StringProperty } from "@firecms/core";
3
+ import { FieldCaption, NumberProperty, StringProperty, useTranslation } from "@firecms/core";
4
4
  import { Select, SelectItem } from "@firecms/ui";
5
5
  import { GeneralPropertyValidation } from "./validation/GeneralPropertyValidation";
6
6
  import { ValidationPanel } from "./validation/ValidationPanel";
@@ -69,6 +69,8 @@ export function DateTimePropertyField({ disabled }: {
69
69
  setFieldValue
70
70
  } = useFormex<StringProperty | NumberProperty>();
71
71
 
72
+ const { t } = useTranslation();
73
+
72
74
  const modePath = "mode";
73
75
  const modeValue: string | undefined = getIn(values, modePath);
74
76
  const modeError: string | undefined = getIn(touched, modePath) && getIn(errors, modePath);
@@ -90,21 +92,21 @@ export function DateTimePropertyField({ disabled }: {
90
92
  error={Boolean(modeError)}
91
93
  size={"large"}
92
94
  onValueChange={(v) => setFieldValue(modePath, v)}
93
- label={"Mode"}
95
+ label={t("mode_label")}
94
96
  fullWidth={true}
95
97
  renderValue={(v) => {
96
98
  switch (v) {
97
99
  case "date_time":
98
- return "Date/Time";
100
+ return t("date_time_mode");
99
101
  case "date":
100
- return "Date";
102
+ return t("date_mode");
101
103
  default:
102
104
  return "";
103
105
  }
104
106
  }}
105
107
  disabled={disabled}>
106
- <SelectItem value={"date_time"}> Date/Time </SelectItem>
107
- <SelectItem value={"date"}> Date </SelectItem>
108
+ <SelectItem value={"date_time"}> {t("date_time_mode")} </SelectItem>
109
+ <SelectItem value={"date"}> {t("date_mode")} </SelectItem>
108
110
  </Select>
109
111
  <FieldCaption error={Boolean(modeError)}>
110
112
  {modeError}
@@ -120,21 +122,21 @@ export function DateTimePropertyField({ disabled }: {
120
122
  renderValue={(v) => {
121
123
  switch (v) {
122
124
  case "on_create":
123
- return "On create";
125
+ return t("auto_on_create");
124
126
  case "on_update":
125
- return "On any update";
127
+ return t("auto_on_update");
126
128
  default:
127
- return "None";
129
+ return t("auto_none");
128
130
  }
129
131
  }}
130
132
  error={Boolean(autoValueError)}
131
- label={"Automatic value"}>
132
- <SelectItem value={"none"}> None </SelectItem>
133
- <SelectItem value={"on_create"}> On create </SelectItem>
134
- <SelectItem value={"on_update"}> On any update </SelectItem>
133
+ label={t("automatic_value")}>
134
+ <SelectItem value={"none"}> {t("auto_none")} </SelectItem>
135
+ <SelectItem value={"on_create"}> {t("auto_on_create")} </SelectItem>
136
+ <SelectItem value={"on_update"}> {t("auto_on_update")} </SelectItem>
135
137
  </Select>
136
138
  <FieldCaption error={Boolean(autoValueError)}>
137
- {autoValueError ?? "Update this field automatically when creating or updating the entity"}
139
+ {autoValueError ?? t("auto_value_description")}
138
140
  </FieldCaption>
139
141
  </div>
140
142
  <div>
@@ -145,13 +147,13 @@ export function DateTimePropertyField({ disabled }: {
145
147
  value={timezoneValue ?? "__local__"}
146
148
  onValueChange={(v) => setFieldValue(timezonePath, v === "__local__" ? undefined : v)}
147
149
  renderValue={(v) => {
148
- if (!v || v === "__local__") return "Local timezone";
150
+ if (!v || v === "__local__") return t("local_timezone");
149
151
  const tz = TIMEZONES.find(t => t.value === v);
150
152
  return tz?.label ?? v;
151
153
  }}
152
154
  error={Boolean(timezoneError)}
153
- label={"Timezone"}>
154
- <SelectItem value={"__local__"}> Local timezone </SelectItem>
155
+ label={t("timezone_label")}>
156
+ <SelectItem value={"__local__"}> {t("local_timezone")} </SelectItem>
155
157
  {TIMEZONES.map((tz) => (
156
158
  <SelectItem key={tz.value} value={tz.value}>
157
159
  {tz.label}
@@ -159,7 +161,7 @@ export function DateTimePropertyField({ disabled }: {
159
161
  ))}
160
162
  </Select>
161
163
  <FieldCaption error={Boolean(timezoneError)}>
162
- {timezoneError ?? "Timezone for displaying and inputting dates. Values are always stored in UTC."}
164
+ {timezoneError ?? t("timezone_description")}
163
165
  </FieldCaption>
164
166
  </div>
165
167
 
@@ -1,6 +1,6 @@
1
1
  import React, { useMemo } from "react";
2
2
  import { getIn, useFormex } from "@firecms/formex";
3
- import { EnumValueConfig, resolveEnumValues, useSnackbarController } from "@firecms/core";
3
+ import { EnumValueConfig, resolveEnumValues, useSnackbarController, useTranslation } from "@firecms/core";
4
4
  import { Select, SelectItem } from "@firecms/ui";
5
5
  import { EnumForm } from "../EnumForm";
6
6
  import { StringPropertyValidation } from "./validation/StringPropertyValidation";
@@ -32,6 +32,7 @@ export function EnumPropertyField({
32
32
  setFieldValue
33
33
  } = useFormex<PropertyWithId>();
34
34
 
35
+ const { t } = useTranslation();
35
36
  const snackbarContext = useSnackbarController();
36
37
 
37
38
  const enumValuesPath = multiselect ? "of.enumValues" : "enumValues";
@@ -55,7 +56,7 @@ export function EnumPropertyField({
55
56
  setFieldValue("defaultValue", undefined);
56
57
  snackbarContext.open({
57
58
  type: "warning",
58
- message: "Default value was cleared"
59
+ message: t("default_value_was_cleared")
59
60
  })
60
61
  }
61
62
  }
@@ -74,7 +75,7 @@ export function EnumPropertyField({
74
75
  disabled={disabled}
75
76
  allowDataInference={allowDataInference}
76
77
  onError={(hasError) => {
77
- setFieldError(enumValuesPath, hasError ? "This enum property is missing some values" : undefined);
78
+ setFieldError(enumValuesPath, hasError ? t("enum_missing_values") : undefined);
78
79
  }}
79
80
  getData={getData && fullPropertyPath
80
81
  ? () => getData()
@@ -105,7 +106,7 @@ export function EnumPropertyField({
105
106
  setFieldValue("defaultValue", value);
106
107
  }}
107
108
  size={"large"}
108
- label={"Default value"}
109
+ label={t("default_value")}
109
110
  value={defaultValue ?? ""}>
110
111
  {enumValues
111
112
  .filter((enumValue) => Boolean(enumValue?.id))
@@ -1,5 +1,6 @@
1
1
  import React, { useState } from "react";
2
- import { FieldCaption, MapProperty, Property, PropertyConfig, } from "@firecms/core";
2
+ import { FieldCaption, MapProperty, Property, PropertyConfig, useTranslation
3
+ } from "@firecms/core";
3
4
  import { AddIcon, BooleanSwitchWithLabel, Button, Paper, Typography } from "@firecms/ui";
4
5
  import { PropertyFormDialog } from "../PropertyEditView";
5
6
  import { getIn, useFormex } from "@firecms/formex";
@@ -13,6 +14,7 @@ export function MapPropertyField({ disabled, getData, allowDataInference, proper
13
14
  propertyConfigs: Record<string, PropertyConfig>,
14
15
  collectionEditable: boolean;
15
16
  }) {
17
+ const { t } = useTranslation();
16
18
 
17
19
  const {
18
20
  values,
@@ -73,12 +75,12 @@ export function MapPropertyField({ disabled, getData, allowDataInference, proper
73
75
  <>
74
76
  <div className={"col-span-12"}>
75
77
  <div className="flex justify-between items-end my-4">
76
- <Typography variant={"subtitle2"}>Properties in this group</Typography>
78
+ <Typography variant={"subtitle2"}>{t("properties_in_this_group")}</Typography>
77
79
  <Button
78
80
  onClick={() => setPropertyDialogOpen(true)}
79
81
  startIcon={<AddIcon/>}
80
82
  >
81
- Add property to {values.name ?? "this group"}
83
+ {t("add_property_to", { name: values.name ?? t("properties_in_this_group") })}
82
84
  </Button>
83
85
  </div>
84
86
  <Paper className="p-2 pl-8">
@@ -97,7 +99,7 @@ export function MapPropertyField({ disabled, getData, allowDataInference, proper
97
99
  {empty &&
98
100
  <Typography variant={"label"}
99
101
  className="h-full flex items-center justify-center p-4">
100
- Add the first property to this group
102
+ {t("add_first_property_to_group")}
101
103
  </Typography>}
102
104
  </Paper>
103
105
  </div>
@@ -106,13 +108,12 @@ export function MapPropertyField({ disabled, getData, allowDataInference, proper
106
108
  <BooleanSwitchWithLabel
107
109
  position={"start"}
108
110
  size={"medium"}
109
- label="Spread children as columns"
111
+ label={t("spread_children_as_columns")}
110
112
  onValueChange={(v) => setFieldValue("spreadChildren", v)}
111
113
  value={values.spreadChildren ?? false}
112
114
  />
113
115
  <FieldCaption>
114
- Set this flag to true if you want to display the children of this group as individual columns. This
115
- will only work for top level groups.
116
+ {t("spread_children_description")}
116
117
  </FieldCaption>
117
118
  </div>
118
119
 
@@ -12,6 +12,7 @@ import {
12
12
  TextField,
13
13
  Typography
14
14
  } from "@firecms/ui";
15
+ import { useTranslation } from "@firecms/core";
15
16
 
16
17
  export function MarkdownPropertyField({
17
18
  disabled,
@@ -26,6 +27,8 @@ export function MarkdownPropertyField({
26
27
  setFieldValue
27
28
  } = useFormex();
28
29
 
30
+ const { t } = useTranslation();
31
+
29
32
  const baseStoragePath = "storage";
30
33
  const baseMarkdownPath = "markdown";
31
34
 
@@ -96,7 +99,7 @@ export function MarkdownPropertyField({
96
99
  <SettingsIcon />
97
100
  <Typography variant={"subtitle2"}
98
101
  className="ml-4">
99
- Paste behavior
102
+ {t("paste_behavior")}
100
103
  </Typography>
101
104
  </div>
102
105
  }>
@@ -107,10 +110,10 @@ export function MarkdownPropertyField({
107
110
  disabled={disabled}
108
111
  value={!htmlValue}
109
112
  onValueChange={(value) => updateMarkdownConfig("html", !value)}
110
- label={"Strip HTML on paste"}
113
+ label={t("strip_html_on_paste")}
111
114
  />
112
115
  <Typography variant={"caption"} className={"ml-3.5 mt-1 mb-2"}>
113
- Remove HTML tags and inline styles when pasting content from external sources
116
+ {t("strip_html_description")}
114
117
  </Typography>
115
118
 
116
119
  <BooleanSwitchWithLabel
@@ -118,10 +121,10 @@ export function MarkdownPropertyField({
118
121
  disabled={disabled}
119
122
  value={transformPastedTextValue}
120
123
  onValueChange={(value) => updateMarkdownConfig("transformPastedText", value)}
121
- label={"Convert pasted text to markdown"}
124
+ label={t("convert_pasted_to_markdown")}
122
125
  />
123
126
  <Typography variant={"caption"} className={"ml-3.5 mt-1 mb-2"}>
124
- Convert rich text (from Google Docs, Word, etc.) to clean markdown format
127
+ {t("convert_pasted_description")}
125
128
  </Typography>
126
129
  </div>
127
130
  </ExpandablePanel>
@@ -134,7 +137,7 @@ export function MarkdownPropertyField({
134
137
  <CloudUploadIcon />
135
138
  <Typography variant={"subtitle2"}
136
139
  className="ml-4">
137
- File upload config
140
+ {t("file_upload_config")}
138
141
  </Typography>
139
142
  </div>
140
143
  }>
@@ -145,7 +148,7 @@ export function MarkdownPropertyField({
145
148
  <div className={"col-span-12"}>
146
149
  <Field name={fileName}
147
150
  as={DebouncedTextField}
148
- label={"File name"}
151
+ label={t("file_name_label")}
149
152
  size={"small"}
150
153
  disabled={hasFilenameCallback || disabled}
151
154
  value={hasFilenameCallback ? "-" : fileNameValue}
@@ -154,37 +157,33 @@ export function MarkdownPropertyField({
154
157
  <div className={"col-span-12"}>
155
158
  <Field name={storagePath}
156
159
  as={DebouncedTextField}
157
- label={"Storage path"}
160
+ label={t("storage_path_label")}
158
161
  disabled={hasStoragePathCallback || disabled}
159
162
  size={"small"}
160
163
  value={hasStoragePathCallback ? "-" : storagePathValue}
161
164
  />
162
165
  <Typography variant={"caption"} className={"ml-3.5 mt-1 mb-2"}>
163
- <p>You can use the following placeholders in
164
- the file name
165
- and storage path values:</p>
166
+ <p>{t("storage_placeholders_description")}</p>
166
167
  <ul>
167
- <li>{"{file} - Full name of the uploaded file"}</li>
168
- <li>{"{file.name} - Name of the uploaded file without extension"}</li>
169
- <li>{"{file.ext} - Extension of the uploaded file"}</li>
170
- <li>{"{entityId} - ID of the entity"}</li>
171
- <li>{"{propertyKey} - ID of this field"}</li>
172
- <li>{"{path} - Path of this entity"}</li>
173
- <li>{"{rand} - Random value used to avoid name collisions"}</li>
168
+ <li>{t("storage_placeholder_file")}</li>
169
+ <li>{t("storage_placeholder_file_name")}</li>
170
+ <li>{t("storage_placeholder_file_ext")}</li>
171
+ <li>{t("storage_placeholder_entity_id")}</li>
172
+ <li>{t("storage_placeholder_property_key")}</li>
173
+ <li>{t("storage_placeholder_path")}</li>
174
+ <li>{t("storage_placeholder_rand")}</li>
174
175
  </ul>
175
176
  </Typography>
176
177
 
177
178
  <Typography variant={"caption"} className={"ml-3.5 mt-1 mb-2"}>
178
- When using Markdown, the URL of the uploaded files are always saved in the text value
179
- (not
180
- the path).
179
+ {t("markdown_url_note")}
181
180
  </Typography>
182
181
  </div>
183
182
 
184
183
  <div className={"col-span-12"}>
185
184
  <DebouncedTextField name={maxSize}
186
185
  type={"number"}
187
- label={"Max size (in bytes)"}
186
+ label={t("max_size_bytes")}
188
187
  size={"small"}
189
188
  value={maxSizeValue !== undefined && maxSizeValue !== null ? maxSizeValue.toString() : ""}
190
189
  onChange={(e) => {
@@ -206,7 +205,7 @@ export function MarkdownPropertyField({
206
205
  onChange={(e: any) => {
207
206
  setFieldValue("defaultValue", e.target.value === "" ? undefined : e.target.value);
208
207
  }}
209
- label={"Default value"}
208
+ label={t("default_value")}
210
209
  value={getIn(values, "defaultValue") ?? ""} />
211
210
 
212
211
  </div>
@@ -3,12 +3,14 @@ import { NumberPropertyValidation } from "./validation/NumberPropertyValidation"
3
3
  import { ValidationPanel } from "./validation/ValidationPanel";
4
4
  import { TextField } from "@firecms/ui";
5
5
  import { getIn, useFormex } from "@firecms/formex";
6
+ import { useTranslation } from "@firecms/core";
6
7
 
7
8
  export function NumberPropertyField({ disabled }: {
8
9
  disabled: boolean;
9
10
  }) {
10
11
 
11
12
  const { values, setFieldValue } = useFormex();
13
+ const { t } = useTranslation();
12
14
 
13
15
  return (
14
16
  <>
@@ -29,7 +31,7 @@ export function NumberPropertyField({ disabled }: {
29
31
  onChange={(e: any) => {
30
32
  setFieldValue("defaultValue", e.target.value === "" ? undefined : parseFloat(e.target.value));
31
33
  }}
32
- label={"Default value"}
34
+ label={t("default_value")}
33
35
  value={getIn(values, "defaultValue") ?? ""}/>
34
36
 
35
37
  </div>
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { Field, getIn, useFormex } from "@firecms/formex";
3
- import { FieldCaption, IconForView, NumberProperty, StringProperty, useNavigationController } from "@firecms/core";
3
+ import { FieldCaption, IconForView, NumberProperty, StringProperty, useNavigationController, useTranslation } from "@firecms/core";
4
4
  import { CircularProgress, Select, SelectGroup, SelectItem, Typography, } from "@firecms/ui";
5
5
 
6
6
  export function ReferencePropertyField({
@@ -69,6 +69,7 @@ export function CollectionsSelect({
69
69
  }) {
70
70
 
71
71
  const navigation = useNavigationController();
72
+ const { t } = useTranslation();
72
73
 
73
74
  if (!navigation)
74
75
  return <div className={"col-span-12"}>
@@ -94,7 +95,7 @@ export function CollectionsSelect({
94
95
  size={"large"}
95
96
  fullWidth={true}
96
97
  onChange={handleChange}
97
- label={"Target collection"}
98
+ label={t("target_collection")}
98
99
  renderValue={(selected) => {
99
100
  const selectedCollection = collections.find(collection => collection.id === selected || collection.path === selected);
100
101
  if (!selectedCollection) return null;
@@ -111,7 +112,7 @@ export function CollectionsSelect({
111
112
  {...props}>
112
113
 
113
114
  {groups.flatMap((group) => (
114
- <SelectGroup label={group || "Views"}
115
+ <SelectGroup label={group || t("views_group")}
115
116
  key={`group_${group}`}>
116
117
  {
117
118
  collections.filter(collection => collection.group === group)
@@ -134,7 +135,7 @@ export function CollectionsSelect({
134
135
  </SelectGroup>
135
136
  ))}
136
137
 
137
- {ungroupedCollections && <SelectGroup label={"Views"}>
138
+ {ungroupedCollections && <SelectGroup label={t("views_group")}>
138
139
  {ungroupedCollections
139
140
  .map((collection) => {
140
141
  return <SelectItem key={collection.id ?? collection.path}