@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
@@ -16,14 +16,7 @@ import { GeneralPropertyValidation } from "./validation/GeneralPropertyValidatio
16
16
  import { ArrayPropertyValidation } from "./validation/ArrayPropertyValidation";
17
17
  import { ValidationPanel } from "./validation/ValidationPanel";
18
18
  import { SwitchControl } from "../SwitchControl";
19
-
20
- const fileTypes: Record<string, string> = {
21
- "image/*": "Images",
22
- "video/*": "Videos",
23
- "audio/*": "Audio files",
24
- "application/*": "Files (pdf, zip, csv, excel...)",
25
- "text/*": "Text files"
26
- }
19
+ import { useTranslation } from "@firecms/core";
27
20
 
28
21
  export function StoragePropertyField({
29
22
  multiple,
@@ -40,6 +33,8 @@ export function StoragePropertyField({
40
33
  setFieldValue
41
34
  } = useFormex();
42
35
 
36
+ const { t } = useTranslation();
37
+
43
38
  const baseStoragePath = multiple ? "of.storage" : "storage";
44
39
  const acceptedFiles = `${baseStoragePath}.acceptedFiles`;
45
40
 
@@ -73,6 +68,14 @@ export function StoragePropertyField({
73
68
  const fileTypesValue: string[] | undefined = Array.isArray(storedValue) ? storedValue : undefined;
74
69
  const allFileTypesSelected = !fileTypesValue || fileTypesValue.length === 0;
75
70
 
71
+ const fileTypes: Record<string, string> = {
72
+ "image/*": t("file_type_images"),
73
+ "video/*": t("file_type_videos"),
74
+ "audio/*": t("file_type_audio"),
75
+ "application/*": t("file_type_applications"),
76
+ "text/*": t("file_type_text")
77
+ };
78
+
76
79
  const handleTypesChange = (value: string[]) => {
77
80
  if (!value) setFieldValue(acceptedFiles, undefined);
78
81
  else setFieldValue(acceptedFiles, value);
@@ -92,7 +95,7 @@ export function StoragePropertyField({
92
95
  <CloudUploadIcon/>
93
96
  <Typography variant={"subtitle2"}
94
97
  className="ml-4">
95
- File upload config
98
+ {t("file_upload_config")}
96
99
  </Typography>
97
100
  </div>
98
101
  }>
@@ -103,14 +106,14 @@ export function StoragePropertyField({
103
106
 
104
107
  <MultiSelect
105
108
  className={"w-full"}
106
- placeholder={"All file types allowed"}
109
+ placeholder={t("all_file_types_allowed")}
107
110
  disabled={disabled}
108
111
  name={acceptedFiles}
109
112
  value={fileTypesValue ?? []}
110
113
  onValueChange={handleTypesChange}
111
- label={allFileTypesSelected ? undefined : "Allowed file types"}
114
+ label={allFileTypesSelected ? undefined : t("allowed_file_types")}
112
115
  renderValues={(selected) => {
113
- if (!selected || selected.length === 0) return "All file types allowed";
116
+ if (!selected || selected.length === 0) return t("all_file_types_allowed");
114
117
  return selected.map((v: string) => fileTypes[v])
115
118
  .filter((v: string) => Boolean(v))
116
119
  .join(", ");
@@ -130,7 +133,7 @@ export function StoragePropertyField({
130
133
  e.stopPropagation();
131
134
  return setFieldValue(acceptedFiles, [value]);
132
135
  }}>
133
- Only
136
+ {t("only")}
134
137
  </Button>
135
138
  </MultiSelectItem>
136
139
  ))}
@@ -141,7 +144,7 @@ export function StoragePropertyField({
141
144
  <div className={"col-span-12"}>
142
145
  <Field name={fileName}
143
146
  as={DebouncedTextField}
144
- label={"File name"}
147
+ label={t("file_name_label")}
145
148
  size={"small"}
146
149
  disabled={hasFilenameCallback || disabled}
147
150
  value={hasFilenameCallback ? "-" : fileNameValue}
@@ -150,23 +153,21 @@ export function StoragePropertyField({
150
153
  <div className={"col-span-12"}>
151
154
  <Field name={storagePath}
152
155
  as={DebouncedTextField}
153
- label={"Storage path"}
156
+ label={t("storage_path_label")}
154
157
  disabled={hasStoragePathCallback || disabled}
155
158
  size={"small"}
156
159
  value={hasStoragePathCallback ? "-" : storagePathValue}
157
160
  />
158
161
  <Typography variant={"caption"} className={"ml-3.5 mt-1 mb-2"}>
159
- <p>You can use the following placeholders in
160
- the file name
161
- and storage path values:</p>
162
+ <p>{t("storage_placeholders_description")}</p>
162
163
  <ul>
163
- <li>{"{file} - Full name of the uploaded file"}</li>
164
- <li>{"{file.name} - Name of the uploaded file without extension"}</li>
165
- <li>{"{file.ext} - Extension of the uploaded file"}</li>
166
- <li>{"{entityId} - ID of the entity"}</li>
167
- <li>{"{propertyKey} - ID of this field"}</li>
168
- <li>{"{path} - Path of this entity"}</li>
169
- <li>{"{rand} - Random value used to avoid name collisions"}</li>
164
+ <li>{t("storage_placeholder_file")}</li>
165
+ <li>{t("storage_placeholder_file_name")}</li>
166
+ <li>{t("storage_placeholder_file_ext")}</li>
167
+ <li>{t("storage_placeholder_entity_id")}</li>
168
+ <li>{t("storage_placeholder_property_key")}</li>
169
+ <li>{t("storage_placeholder_path")}</li>
170
+ <li>{t("storage_placeholder_rand")}</li>
170
171
  </ul>
171
172
  </Typography>
172
173
 
@@ -177,7 +178,7 @@ export function StoragePropertyField({
177
178
  form
178
179
  }: FormexFieldProps) => {
179
180
  return <SwitchControl
180
- label={"Include bucket URL (gs://...) in saved value"}
181
+ label={t("include_bucket_url")}
181
182
  disabled={existing || disabled}
182
183
  form={form}
183
184
  field={field}/>;
@@ -185,9 +186,7 @@ export function StoragePropertyField({
185
186
  </Field>
186
187
 
187
188
  <Typography variant={"caption"} className={"ml-3.5 mt-1 mb-2"}>
188
- Turn this setting on if you want to save a fully-qualified storage URL
189
- (e.g. <code>gs://my-bucket/path/to/file</code>) instead of just the storage path.
190
- You can only change this prop upon creation.
189
+ {t("include_bucket_url_description")}
191
190
  </Typography>
192
191
 
193
192
  <Field name={storeUrl}
@@ -197,7 +196,7 @@ export function StoragePropertyField({
197
196
  form
198
197
  }: FormexFieldProps) => {
199
198
  return <SwitchControl
200
- label={"Save URL instead of storage path"}
199
+ label={t("save_url_instead_of_path")}
201
200
  disabled={existing || disabled}
202
201
  form={form}
203
202
  field={field}/>;
@@ -205,18 +204,14 @@ export function StoragePropertyField({
205
204
  </Field>
206
205
 
207
206
  <Typography variant={"caption"} className={"ml-3.5 mt-1 mb-2"}>
208
- Turn this setting on, if you prefer to save
209
- the download
210
- URL of the uploaded file instead of the
211
- storage path.
212
- You can only change this prop upon creation.
207
+ {t("save_url_description")}
213
208
  </Typography>
214
209
  </div>
215
210
 
216
211
  <div className={"col-span-12"}>
217
212
  <DebouncedTextField name={maxSize}
218
213
  type={"number"}
219
- label={"Max size (in bytes)"}
214
+ label={t("max_size_bytes")}
220
215
  size={"small"}
221
216
  value={maxSizeValue !== undefined && maxSizeValue !== null ? maxSizeValue.toString() : ""}
222
217
  onChange={(e) => {
@@ -231,10 +226,10 @@ export function StoragePropertyField({
231
226
  <Typography variant={"subtitle2"}
232
227
  color={"secondary"}
233
228
  className={"mb-2 block"}>
234
- Image Resize Configuration
229
+ {t("image_resize_configuration")}
235
230
  </Typography>
236
231
  <Typography variant={"caption"} className={"mb-2 block text-xs"}>
237
- Automatically resize and optimize images before upload (JPEG, PNG, WebP only)
232
+ {t("image_resize_description")}
238
233
  </Typography>
239
234
  </div>
240
235
 
@@ -242,7 +237,7 @@ export function StoragePropertyField({
242
237
  <DebouncedTextField
243
238
  name={imageResizeMaxWidth}
244
239
  type={"number"}
245
- label={"Max width (px)"}
240
+ label={t("max_width_px")}
246
241
  size={"small"}
247
242
  disabled={disabled}
248
243
  value={imageResizeMaxWidthValue !== undefined && imageResizeMaxWidthValue !== null ? imageResizeMaxWidthValue.toString() : ""}
@@ -258,7 +253,7 @@ export function StoragePropertyField({
258
253
  <DebouncedTextField
259
254
  name={imageResizeMaxHeight}
260
255
  type={"number"}
261
- label={"Max height (px)"}
256
+ label={t("max_height_px")}
262
257
  size={"small"}
263
258
  disabled={disabled}
264
259
  value={imageResizeMaxHeightValue !== undefined && imageResizeMaxHeightValue !== null ? imageResizeMaxHeightValue.toString() : ""}
@@ -278,16 +273,16 @@ export function StoragePropertyField({
278
273
  size={"medium"}
279
274
  value={imageResizeModeValue || "cover"}
280
275
  onValueChange={(value) => setFieldValue(imageResizeMode, value || "cover")}
281
- label={"Resize mode"}
276
+ label={t("resize_mode")}
282
277
  renderValue={(selected) => {
283
- if (!selected) return "Cover";
284
- return selected === "contain" ? "Contain (fit within bounds)" : "Cover (fill bounds, may crop)";
278
+ if (!selected) return t("resize_cover");
279
+ return selected === "contain" ? t("resize_contain_description") : t("resize_cover_description");
285
280
  }}>
286
281
  <SelectItem value="contain">
287
- Contain (fit within bounds)
282
+ {t("resize_contain_description")}
288
283
  </SelectItem>
289
284
  <SelectItem value="cover">
290
- Cover (fill bounds, may crop)
285
+ {t("resize_cover_description")}
291
286
  </SelectItem>
292
287
  </Select>
293
288
  </div>
@@ -300,13 +295,13 @@ export function StoragePropertyField({
300
295
  name={imageResizeFormat}
301
296
  value={imageResizeFormatValue || "original"}
302
297
  onValueChange={(value) => setFieldValue(imageResizeFormat, value || "original")}
303
- label={"Output format"}
298
+ label={t("output_format")}
304
299
  renderValue={(selected) => {
305
- if (!selected) return "Original";
300
+ if (!selected) return t("format_original");
306
301
  return selected.charAt(0).toUpperCase() + selected.slice(1);
307
302
  }}>
308
303
  <SelectItem value="original">
309
- Original (keep same format)
304
+ {t("format_original_description")}
310
305
  </SelectItem>
311
306
  <SelectItem value="jpeg">
312
307
  JPEG
@@ -315,7 +310,7 @@ export function StoragePropertyField({
315
310
  PNG
316
311
  </SelectItem>
317
312
  <SelectItem value="webp">
318
- WebP (best compression)
313
+ {t("format_webp_description")}
319
314
  </SelectItem>
320
315
  </Select>
321
316
  </div>
@@ -324,7 +319,7 @@ export function StoragePropertyField({
324
319
  <DebouncedTextField
325
320
  name={imageResizeQuality}
326
321
  type={"number"}
327
- label={"Quality (0-100)"}
322
+ label={t("quality_label")}
328
323
  size={"small"}
329
324
  disabled={disabled}
330
325
  value={imageResizeQualityValue !== undefined && imageResizeQualityValue !== null ? imageResizeQualityValue.toString() : ""}
@@ -340,7 +335,7 @@ export function StoragePropertyField({
340
335
  }}
341
336
  />
342
337
  <Typography variant={"caption"} className={"ml-3.5 mt-1 mb-2"}>
343
- Higher quality = larger file size. Recommended: 80-90 for photos, 90-100 for graphics
338
+ {t("quality_hint")}
344
339
  </Typography>
345
340
  </div>
346
341
 
@@ -4,6 +4,7 @@ import { ValidationPanel } from "./validation/ValidationPanel";
4
4
  import { getIn, useFormex } from "@firecms/formex";
5
5
 
6
6
  import { TextField } from "@firecms/ui";
7
+ import { useTranslation } from "@firecms/core";
7
8
 
8
9
  export function StringPropertyField({
9
10
  widgetId,
@@ -16,6 +17,7 @@ export function StringPropertyField({
16
17
  }) {
17
18
 
18
19
  const { values, setFieldValue } = useFormex();
20
+ const { t } = useTranslation();
19
21
 
20
22
  return (
21
23
  <>
@@ -65,7 +67,7 @@ export function StringPropertyField({
65
67
  onChange={(e: any) => {
66
68
  setFieldValue("defaultValue", e.target.value === "" ? undefined : e.target.value);
67
69
  }}
68
- label={"Default value"}
70
+ label={t("default_value")}
69
71
  value={getIn(values, "defaultValue") ?? ""}/>
70
72
 
71
73
  </div>
@@ -4,6 +4,7 @@ import { ValidationPanel } from "./validation/ValidationPanel";
4
4
  import { getIn, useFormex } from "@firecms/formex";
5
5
 
6
6
  import { Select, SelectItem, TextField } from "@firecms/ui";
7
+ import { useTranslation } from "@firecms/core";
7
8
 
8
9
  export function UrlPropertyField({
9
10
  disabled,
@@ -14,6 +15,7 @@ export function UrlPropertyField({
14
15
  }) {
15
16
 
16
17
  const { values, setFieldValue } = useFormex();
18
+ const { t } = useTranslation();
17
19
 
18
20
  const urlValue = getIn(values, "url");
19
21
 
@@ -31,31 +33,31 @@ export function UrlPropertyField({
31
33
  else
32
34
  setFieldValue("url", value);
33
35
  }}
34
- label={"Preview type"}
36
+ label={t("preview_type")}
35
37
  renderValue={(value: string) => {
36
38
  switch (value) {
37
39
  case "image":
38
- return "Image";
40
+ return t("preview_image");
39
41
  case "video":
40
- return "Video";
42
+ return t("preview_video");
41
43
  case "audio":
42
- return "Audio";
44
+ return t("preview_audio");
43
45
  default:
44
- return "Display URL";
46
+ return t("display_url");
45
47
  }
46
48
  }}
47
49
  value={urlValue ?? "[NONE]"}>
48
50
  <SelectItem value={"[NONE]"}>
49
- Display URL
51
+ {t("display_url")}
50
52
  </SelectItem>
51
53
  <SelectItem value={"image"}>
52
- Image
54
+ {t("preview_image")}
53
55
  </SelectItem>
54
56
  <SelectItem value={"video"}>
55
- Video
57
+ {t("preview_video")}
56
58
  </SelectItem>
57
59
  <SelectItem value={"audio"}>
58
- Audio
60
+ {t("preview_audio")}
59
61
  </SelectItem>
60
62
  </Select>
61
63
  </div>
@@ -81,7 +83,7 @@ export function UrlPropertyField({
81
83
  onChange={(e: any) => {
82
84
  setFieldValue("defaultValue", e.target.value === "" ? undefined : e.target.value);
83
85
  }}
84
- label={"Default value"}
86
+ label={t("default_value")}
85
87
  value={getIn(values, "defaultValue") ?? ""}/>
86
88
 
87
89
  </div>
@@ -2,11 +2,14 @@ import React from "react";
2
2
 
3
3
  import { Field, FormexFieldProps } from "@firecms/formex";
4
4
  import { SwitchControl } from "../../SwitchControl";
5
+ import { useTranslation } from "@firecms/core";
5
6
 
6
7
  export function AdvancedPropertyValidation({ disabled }: {
7
8
  disabled: boolean
8
9
  }) {
9
10
 
11
+ const { t } = useTranslation();
12
+
10
13
  const columnWidth = "columnWidth";
11
14
  const hideFromCollection = "hideFromCollection";
12
15
  const readOnly = "readOnly";
@@ -18,11 +21,11 @@ export function AdvancedPropertyValidation({ disabled }: {
18
21
  <Field type="checkbox" name={hideFromCollection}>
19
22
  {({ field, form }: FormexFieldProps) => {
20
23
  return <SwitchControl
21
- label={"Hide from collection"}
24
+ label={t("hide_from_collection")}
22
25
  size={"medium"}
23
26
  disabled={disabled}
24
27
  form={form}
25
- tooltip={"Hide this field from the collection view. It will still be visible in the form view"}
28
+ tooltip={t("hide_from_collection_tooltip")}
26
29
  field={field}/>
27
30
  }}
28
31
  </Field>
@@ -33,10 +36,10 @@ export function AdvancedPropertyValidation({ disabled }: {
33
36
  type="checkbox">
34
37
  {({ field, form }: FormexFieldProps) => {
35
38
  return <SwitchControl
36
- label={"Read only"}
39
+ label={t("read_only")}
37
40
  size={"medium"}
38
41
  disabled={disabled}
39
- tooltip={"Is this a read only field. Display only as a preview"}
42
+ tooltip={t("read_only_tooltip")}
40
43
  form={form}
41
44
  field={field}/>
42
45
  }}
@@ -21,7 +21,8 @@ import {
21
21
  DEFAULT_FIELD_CONFIGS,
22
22
  getIconForWidget,
23
23
  EnumValueConfig,
24
- isPropertyBuilder
24
+ isPropertyBuilder,
25
+ useTranslation
25
26
  } from "@firecms/core";
26
27
  import { PropertyWithId } from "../../PropertyEditView";
27
28
  import { getPropertyPaths } from "./property_paths";
@@ -448,6 +449,8 @@ function ConditionGroupRow({
448
449
  collectionProperties,
449
450
  showErrors
450
451
  }: ConditionGroupRowProps) {
452
+ const { t } = useTranslation();
453
+
451
454
  const handleLogicChange = (logic: LogicOperator) => {
452
455
  onGroupChange({ ...group, logic });
453
456
  };
@@ -490,8 +493,8 @@ function ConditionGroupRow({
490
493
  disabled={disabled}
491
494
  size="small"
492
495
  inputClassName="min-w-[100px]">
493
- <SelectItem value="and">All of these</SelectItem>
494
- <SelectItem value="or">Any of these</SelectItem>
496
+ <SelectItem value="and">{t("all_of_these")}</SelectItem>
497
+ <SelectItem value="or">{t("any_of_these")}</SelectItem>
495
498
  </Select>
496
499
  )}
497
500
  </div>
@@ -743,6 +746,8 @@ export interface ConditionsEditorProps {
743
746
  }
744
747
 
745
748
  export function ConditionsEditor({ disabled, collectionProperties }: ConditionsEditorProps) {
749
+ const { t } = useTranslation();
750
+
746
751
  const { values, setFieldValue, submitCount } = useFormex<PropertyWithId>();
747
752
 
748
753
  // Get property paths from collection properties (includes nested maps)
@@ -3,6 +3,7 @@ import React from "react";
3
3
  import { getIn, useFormex } from "@firecms/formex";
4
4
  import { DebouncedTextField } from "@firecms/ui";
5
5
  import { GeneralPropertyValidation } from "./GeneralPropertyValidation";
6
+ import { useTranslation } from "@firecms/core";
6
7
 
7
8
  export function ArrayPropertyValidation({
8
9
  max = true,
@@ -19,6 +20,8 @@ export function ArrayPropertyValidation({
19
20
  handleChange
20
21
  } = useFormex();
21
22
 
23
+ const { t } = useTranslation();
24
+
22
25
  const validationMin = "validation.min";
23
26
  const validationMax = "validation.max";
24
27
 
@@ -30,7 +33,7 @@ export function ArrayPropertyValidation({
30
33
  {min && <div className={"col-span-6"}>
31
34
  <DebouncedTextField value={getIn(values, validationMin)}
32
35
  disabled={disabled}
33
- label={"Min length"}
36
+ label={t("min_length")}
34
37
  name={validationMin}
35
38
  type="number"
36
39
  size="small"
@@ -39,7 +42,7 @@ export function ArrayPropertyValidation({
39
42
  {max && <div className={"col-span-6"}>
40
43
  <DebouncedTextField value={getIn(values, validationMax)}
41
44
  disabled={disabled}
42
- label={"Max length"}
45
+ label={t("max_length")}
43
46
  name={validationMax}
44
47
  type="number"
45
48
  size="small"
@@ -3,6 +3,7 @@ import React from "react";
3
3
  import { Field, FormexFieldProps, getIn, useFormex } from "@firecms/formex";
4
4
  import { DebouncedTextField } from "@firecms/ui";
5
5
  import { SwitchControl } from "../../SwitchControl";
6
+ import { useTranslation } from "@firecms/core";
6
7
 
7
8
  export function GeneralPropertyValidation({ disabled }: {
8
9
  required?: boolean;
@@ -10,6 +11,7 @@ export function GeneralPropertyValidation({ disabled }: {
10
11
  }) {
11
12
 
12
13
  const { values, handleChange } = useFormex();
14
+ const { t } = useTranslation();
13
15
 
14
16
  const validationRequired = "validation.required";
15
17
  const validationRequiredMessage = "validation.requiredMessage";
@@ -24,8 +26,8 @@ export function GeneralPropertyValidation({ disabled }: {
24
26
  {({ field, form }: FormexFieldProps) => {
25
27
  return <SwitchControl
26
28
  disabled={disabled}
27
- label={"Required"}
28
- tooltip={"You won't be able to save this entity if this value is not set"}
29
+ label={t("required")}
30
+ tooltip={t("required_tooltip")}
29
31
  form={form}
30
32
  field={field}/>
31
33
  }}
@@ -39,8 +41,8 @@ export function GeneralPropertyValidation({ disabled }: {
39
41
  {({ field, form }: FormexFieldProps) => {
40
42
  return <SwitchControl
41
43
  disabled={disabled}
42
- label={"Unique"}
43
- tooltip={"There cannot be multiple entities with the same value"}
44
+ label={t("unique")}
45
+ tooltip={t("unique_tooltip")}
44
46
  form={form}
45
47
  field={field}/>
46
48
  }}
@@ -51,7 +53,7 @@ export function GeneralPropertyValidation({ disabled }: {
51
53
  <DebouncedTextField
52
54
  disabled={disabled}
53
55
  value={getIn(values, validationRequiredMessage)}
54
- label={"Required message"}
56
+ label={t("required_message")}
55
57
  name={validationRequiredMessage}
56
58
  size="small"
57
59
  onChange={handleChange}/>
@@ -4,6 +4,7 @@ import { Field, FormexFieldProps, getIn, useFormex } from "@firecms/formex";
4
4
  import { DebouncedTextField } from "@firecms/ui";
5
5
  import { GeneralPropertyValidation } from "./GeneralPropertyValidation";
6
6
  import { SwitchControl } from "../../SwitchControl";
7
+ import { useTranslation } from "@firecms/core";
7
8
 
8
9
  export function NumberPropertyValidation({ disabled }: {
9
10
  disabled: boolean;
@@ -14,6 +15,8 @@ export function NumberPropertyValidation({ disabled }: {
14
15
  handleChange
15
16
  } = useFormex();
16
17
 
18
+ const { t } = useTranslation();
19
+
17
20
  const validationMin = "validation.min";
18
21
  const validationMax = "validation.max";
19
22
  const validationLessThan = "validation.lessThan";
@@ -30,7 +33,7 @@ export function NumberPropertyValidation({ disabled }: {
30
33
 
31
34
  <div className={"col-span-6"}>
32
35
  <DebouncedTextField value={getIn(values, validationMin)}
33
- label={"Min value"}
36
+ label={t("min_value")}
34
37
  name={validationMin}
35
38
  type="number"
36
39
  size="small"
@@ -40,7 +43,7 @@ export function NumberPropertyValidation({ disabled }: {
40
43
 
41
44
  <div className={"col-span-6"}>
42
45
  <DebouncedTextField value={getIn(values, validationMax)}
43
- label={"Max value"}
46
+ label={t("max_value")}
44
47
  name={validationMax}
45
48
  type="number"
46
49
  size="small"
@@ -53,7 +56,7 @@ export function NumberPropertyValidation({ disabled }: {
53
56
  <div className={"col-span-6"}>
54
57
  <DebouncedTextField
55
58
  value={getIn(values, validationLessThan)}
56
- label={"Less than"}
59
+ label={t("less_than")}
57
60
  name={validationLessThan}
58
61
  type="number"
59
62
  size="small"
@@ -65,7 +68,7 @@ export function NumberPropertyValidation({ disabled }: {
65
68
  <div className={"col-span-6"}>
66
69
  <DebouncedTextField
67
70
  value={getIn(values, validationMoreThan)}
68
- label={"More than"}
71
+ label={t("more_than")}
69
72
  name={validationMoreThan}
70
73
  type="number"
71
74
  size="small"
@@ -79,7 +82,7 @@ export function NumberPropertyValidation({ disabled }: {
79
82
  type="checkbox">
80
83
  {({ field, form }: FormexFieldProps) => {
81
84
  return <SwitchControl
82
- label={"Positive value"}
85
+ label={t("positive_value")}
83
86
  disabled={disabled}
84
87
  form={form}
85
88
  field={field}/>
@@ -91,7 +94,7 @@ export function NumberPropertyValidation({ disabled }: {
91
94
  type="checkbox">
92
95
  {({ field, form }: FormexFieldProps) => {
93
96
  return <SwitchControl
94
- label={"Negative value"}
97
+ label={t("negative_value")}
95
98
  disabled={disabled}
96
99
  form={form}
97
100
  field={field}/>
@@ -103,7 +106,7 @@ export function NumberPropertyValidation({ disabled }: {
103
106
  type="checkbox">
104
107
  {({ field, form }: FormexFieldProps) => {
105
108
  return <SwitchControl
106
- label={"Integer value"}
109
+ label={t("integer_value")}
107
110
  disabled={disabled}
108
111
  form={form}
109
112
  field={field}/>