@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,7 +1,7 @@
1
1
  import React from "react";
2
2
 
3
3
  import { Field, FormexFieldProps, getIn, useFormex } from "@firecms/formex";
4
- import { FieldCaption, serializeRegExp } from "@firecms/core";
4
+ import { FieldCaption, serializeRegExp, useTranslation } from "@firecms/core";
5
5
  import { DebouncedTextField, } from "@firecms/ui";
6
6
  import { GeneralPropertyValidation } from "./GeneralPropertyValidation";
7
7
  import { SwitchControl } from "../../SwitchControl";
@@ -34,6 +34,8 @@ export function StringPropertyValidation({
34
34
  errors
35
35
  } = useFormex();
36
36
 
37
+ const { t } = useTranslation();
38
+
37
39
  const validationLength = "validation.length";
38
40
  const validationMin = "validation.min";
39
41
  const validationMax = "validation.max";
@@ -58,7 +60,7 @@ export function StringPropertyValidation({
58
60
  type="checkbox">
59
61
  {({ field, form }: FormexFieldProps) => {
60
62
  return <SwitchControl
61
- label={"Lowercase"}
63
+ label={t("lowercase")}
62
64
  disabled={disabled}
63
65
  form={form}
64
66
  field={field}/>
@@ -71,7 +73,7 @@ export function StringPropertyValidation({
71
73
  type="checkbox">
72
74
  {({ field, form }: FormexFieldProps) => {
73
75
  return <SwitchControl
74
- label={"Uppercase"}
76
+ label={t("uppercase")}
75
77
  disabled={disabled}
76
78
  form={form}
77
79
  field={field}/>
@@ -84,7 +86,7 @@ export function StringPropertyValidation({
84
86
  type="checkbox">
85
87
  {({ field, form }: FormexFieldProps) => {
86
88
  return <SwitchControl
87
- label={"Trim"}
89
+ label={t("trim")}
88
90
  disabled={disabled}
89
91
  form={form}
90
92
  field={field}/>
@@ -98,7 +100,7 @@ export function StringPropertyValidation({
98
100
  {length && <div className={"col-span-4"}>
99
101
  <DebouncedTextField
100
102
  value={getIn(values, validationLength)}
101
- label={"Exact length"}
103
+ label={t("exact_length")}
102
104
  name={validationLength}
103
105
  type="number"
104
106
  size="small"
@@ -109,7 +111,7 @@ export function StringPropertyValidation({
109
111
 
110
112
  {min && <div className={"col-span-4"}>
111
113
  <DebouncedTextField value={getIn(values, validationMin)}
112
- label={"Min length"}
114
+ label={t("min_length")}
113
115
  name={validationMin}
114
116
  type="number"
115
117
  size="small"
@@ -120,7 +122,7 @@ export function StringPropertyValidation({
120
122
 
121
123
  {max && <div className={"col-span-4"}>
122
124
  <DebouncedTextField value={getIn(values, validationMax)}
123
- label={"Max length"}
125
+ label={t("max_length")}
124
126
  name={validationMax}
125
127
  type="number"
126
128
  size="small"
@@ -134,13 +136,13 @@ export function StringPropertyValidation({
134
136
  {matches && <div className={"col-span-12"}>
135
137
  <Field name={validationMatches}
136
138
  as={DebouncedTextField}
137
- label={"Matches regex"}
139
+ label={t("matches_regex")}
138
140
  size="small"
139
141
  disabled={disabled}
140
142
  value={matchesStringValue}
141
143
  error={Boolean(matchesError)}/>
142
144
  <FieldCaption error={Boolean(matchesError)}>
143
- {matchesError ? "Not a valid regexp" : "e.g. /^\\d+$/ for digits only"}
145
+ {matchesError ? t("not_valid_regexp") : t("regex_helper")}
144
146
  </FieldCaption>
145
147
  </div>}
146
148
 
@@ -1,11 +1,14 @@
1
1
  import { PropsWithChildren } from "react";
2
2
 
3
3
  import { ExpandablePanel, RuleIcon, Typography } from "@firecms/ui";
4
+ import { useTranslation } from "@firecms/core";
4
5
 
5
6
  export function ValidationPanel({
6
7
  children
7
8
  }: PropsWithChildren<{}>) {
8
9
 
10
+ const { t } = useTranslation();
11
+
9
12
  return (
10
13
  <ExpandablePanel
11
14
  initiallyExpanded={false}
@@ -16,7 +19,7 @@ export function ValidationPanel({
16
19
  <RuleIcon/>
17
20
  <Typography variant={"subtitle2"}
18
21
  className="ml-4">
19
- Validation
22
+ {t("validation")}
20
23
  </Typography>
21
24
  </div>
22
25
  }>
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { FireCMSPlugin, useAuthController, useNavigationController, User } from "@firecms/core";
2
+ import { FireCMSPlugin, useAuthController, useNavigationController, User, useTranslation } from "@firecms/core";
3
3
  import { ConfigControllerProvider } from "./ConfigControllerProvider";
4
4
  import { CollectionEditorPermissionsBuilder } from "./types/config_permissions";
5
5
  import { EditorCollectionAction } from "./ui/EditorCollectionAction";
@@ -18,6 +18,13 @@ import { NewCollectionCard } from "./ui/NewCollectionCard";
18
18
  import { EditorEntityAction } from "./ui/EditorEntityAction";
19
19
  import { KanbanSetupAction } from "./ui/KanbanSetupAction";
20
20
  import { AddKanbanColumnAction } from "./ui/AddKanbanColumnAction";
21
+ import { collectionEditorTranslationsEn } from "./locales/en";
22
+ import { collectionEditorTranslationsEs } from "./locales/es";
23
+ import { collectionEditorTranslationsDe } from "./locales/de";
24
+ import { collectionEditorTranslationsFr } from "./locales/fr";
25
+ import { collectionEditorTranslationsIt } from "./locales/it";
26
+ import { collectionEditorTranslationsHi } from "./locales/hi";
27
+ import { collectionEditorTranslationsPt } from "./locales/pt";
21
28
 
22
29
  export interface CollectionConfigControllerProps<EC extends PersistedCollection = PersistedCollection, USER extends User = User> {
23
30
 
@@ -130,6 +137,15 @@ export function useCollectionEditorPlugin<EC extends PersistedCollection = Persi
130
137
  },
131
138
  form: {
132
139
  ActionsTop: EditorEntityAction,
140
+ },
141
+ i18n: {
142
+ en: collectionEditorTranslationsEn,
143
+ es: collectionEditorTranslationsEs,
144
+ de: collectionEditorTranslationsDe,
145
+ fr: collectionEditorTranslationsFr,
146
+ it: collectionEditorTranslationsIt,
147
+ hi: collectionEditorTranslationsHi,
148
+ pt: collectionEditorTranslationsPt
133
149
  }
134
150
  };
135
151
  }
@@ -141,6 +157,7 @@ export function IntroWidget() {
141
157
  throw Error("Navigation not ready in FireCMSHomePage");
142
158
 
143
159
  const authController = useAuthController();
160
+ const { t } = useTranslation();
144
161
 
145
162
  const collectionEditorController = useCollectionEditorController();
146
163
  const canCreateCollections = collectionEditorController.configPermissions
@@ -156,10 +173,9 @@ export function IntroWidget() {
156
173
  return (
157
174
  <Paper
158
175
  className={"my-4 px-4 py-6 flex flex-col bg-white dark:bg-surface-accent-800 gap-2"}>
159
- <Typography variant={"subtitle2"} className={"uppercase"}>No collections found</Typography>
176
+ <Typography variant={"subtitle2"} className={"uppercase"}>{t("no_collections_found")}</Typography>
160
177
  <Typography>
161
- Start building collections in FireCMS easily. Map them to your existing
162
- database data, import from files, or use our templates.
178
+ {t("start_building_collections")}
163
179
  </Typography>
164
180
  {canCreateCollections && <Button
165
181
  onClick={collectionEditorController && canCreateCollections
@@ -169,10 +185,10 @@ export function IntroWidget() {
169
185
  sourceClick: "new_collection_card"
170
186
  })
171
187
  : undefined}>
172
- <AddIcon />Create your first collection
188
+ <AddIcon />{t("create_first_collection")}
173
189
  </Button>}
174
190
  <Typography color={"secondary"}>
175
- You can also define collections programmatically.
191
+ {t("define_collections_programmatically")}
176
192
  </Typography>
177
193
  </Paper>
178
194
  );