@firecms/collection_editor 3.0.0 → 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.
- package/dist/ConfigControllerProvider.d.ts +6 -0
- package/dist/api/generateCollectionApi.d.ts +71 -0
- package/dist/api/index.d.ts +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.es.js +15234 -8138
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +15199 -8103
- package/dist/index.umd.js.map +1 -1
- package/dist/locales/de.d.ts +120 -0
- package/dist/locales/en.d.ts +120 -0
- package/dist/locales/es.d.ts +120 -0
- package/dist/locales/fr.d.ts +120 -0
- package/dist/locales/hi.d.ts +120 -0
- package/dist/locales/it.d.ts +120 -0
- package/dist/locales/pt.d.ts +120 -0
- package/dist/types/collection_editor_controller.d.ts +14 -0
- package/dist/types/collection_inference.d.ts +8 -2
- package/dist/types/config_controller.d.ts +31 -1
- package/dist/ui/AddKanbanColumnAction.d.ts +11 -0
- package/dist/ui/KanbanSetupAction.d.ts +10 -0
- package/dist/ui/collection_editor/AICollectionGeneratorPopover.d.ts +37 -0
- package/dist/ui/collection_editor/AIModifiedPathsContext.d.ts +20 -0
- package/dist/ui/collection_editor/CollectionDetailsForm.d.ts +2 -3
- package/dist/ui/collection_editor/CollectionEditorDialog.d.ts +24 -0
- package/dist/ui/collection_editor/CollectionEditorWelcomeView.d.ts +4 -1
- package/dist/ui/collection_editor/CollectionJsonImportDialog.d.ts +7 -0
- package/dist/ui/collection_editor/CollectionYupValidation.d.ts +9 -13
- package/dist/ui/collection_editor/DisplaySettingsForm.d.ts +3 -0
- package/dist/ui/collection_editor/EntityActionsEditTab.d.ts +2 -1
- package/dist/ui/collection_editor/ExtendSettingsForm.d.ts +14 -0
- package/dist/ui/collection_editor/GeneralSettingsForm.d.ts +7 -0
- package/dist/ui/collection_editor/KanbanConfigSection.d.ts +4 -0
- package/dist/ui/collection_editor/PropertyEditView.d.ts +6 -1
- package/dist/ui/collection_editor/PropertyTree.d.ts +2 -1
- package/dist/ui/collection_editor/SubcollectionsEditTab.d.ts +2 -1
- package/dist/ui/collection_editor/ViewModeSwitch.d.ts +6 -0
- package/dist/ui/collection_editor/properties/EnumPropertyField.d.ts +2 -1
- package/dist/ui/collection_editor/properties/conditions/ConditionsEditor.d.ts +10 -0
- package/dist/ui/collection_editor/properties/conditions/ConditionsPanel.d.ts +2 -0
- package/dist/ui/collection_editor/properties/conditions/EnumConditionsEditor.d.ts +6 -0
- package/dist/ui/collection_editor/properties/conditions/index.d.ts +6 -0
- package/dist/ui/collection_editor/properties/conditions/property_paths.d.ts +19 -0
- package/dist/useCollectionEditorPlugin.d.ts +7 -1
- package/dist/utils/validateCollectionJson.d.ts +22 -0
- package/package.json +15 -15
- package/src/ConfigControllerProvider.tsx +82 -47
- package/src/api/generateCollectionApi.ts +119 -0
- package/src/api/index.ts +1 -0
- package/src/index.ts +28 -1
- package/src/locales/de.ts +125 -0
- package/src/locales/en.ts +145 -0
- package/src/locales/es.ts +125 -0
- package/src/locales/fr.ts +125 -0
- package/src/locales/hi.ts +125 -0
- package/src/locales/it.ts +125 -0
- package/src/locales/pt.ts +125 -0
- package/src/types/collection_editor_controller.tsx +16 -3
- package/src/types/collection_inference.ts +15 -2
- package/src/types/config_controller.tsx +37 -1
- package/src/ui/AddKanbanColumnAction.tsx +203 -0
- package/src/ui/EditorCollectionAction.tsx +3 -3
- package/src/ui/EditorCollectionActionStart.tsx +1 -2
- package/src/ui/EditorEntityAction.tsx +3 -2
- package/src/ui/HomePageEditorCollectionAction.tsx +41 -13
- package/src/ui/KanbanSetupAction.tsx +38 -0
- package/src/ui/MissingReferenceWidget.tsx +1 -1
- package/src/ui/NewCollectionButton.tsx +4 -2
- package/src/ui/NewCollectionCard.tsx +7 -4
- package/src/ui/PropertyAddColumnComponent.tsx +4 -3
- package/src/ui/collection_editor/AICollectionGeneratorPopover.tsx +243 -0
- package/src/ui/collection_editor/AIModifiedPathsContext.tsx +88 -0
- package/src/ui/collection_editor/CollectionDetailsForm.tsx +222 -268
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +270 -204
- package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +138 -71
- package/src/ui/collection_editor/CollectionJsonImportDialog.tsx +171 -0
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +202 -101
- package/src/ui/collection_editor/DisplaySettingsForm.tsx +335 -0
- package/src/ui/collection_editor/EntityActionsEditTab.tsx +106 -97
- package/src/ui/collection_editor/EntityActionsSelectDialog.tsx +8 -10
- package/src/ui/collection_editor/EntityCustomViewsSelectDialog.tsx +5 -7
- package/src/ui/collection_editor/EnumForm.tsx +153 -102
- package/src/ui/collection_editor/ExtendSettingsForm.tsx +94 -0
- package/src/ui/collection_editor/GeneralSettingsForm.tsx +335 -0
- package/src/ui/collection_editor/GetCodeDialog.tsx +63 -41
- package/src/ui/collection_editor/KanbanConfigSection.tsx +209 -0
- package/src/ui/collection_editor/LayoutModeSwitch.tsx +27 -43
- package/src/ui/collection_editor/PropertyEditView.tsx +272 -199
- package/src/ui/collection_editor/PropertyFieldPreview.tsx +1 -1
- package/src/ui/collection_editor/PropertyTree.tsx +130 -58
- package/src/ui/collection_editor/SubcollectionsEditTab.tsx +169 -163
- package/src/ui/collection_editor/UnsavedChangesDialog.tsx +0 -2
- package/src/ui/collection_editor/ViewModeSwitch.tsx +43 -0
- package/src/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +6 -3
- package/src/ui/collection_editor/import/CollectionEditorImportMapping.tsx +5 -2
- package/src/ui/collection_editor/properties/BlockPropertyField.tsx +0 -2
- package/src/ui/collection_editor/properties/BooleanPropertyField.tsx +4 -1
- package/src/ui/collection_editor/properties/CommonPropertyFields.tsx +6 -4
- package/src/ui/collection_editor/properties/DateTimePropertyField.tsx +126 -42
- package/src/ui/collection_editor/properties/EnumPropertyField.tsx +32 -24
- package/src/ui/collection_editor/properties/MapPropertyField.tsx +8 -9
- package/src/ui/collection_editor/properties/MarkdownPropertyField.tsx +128 -53
- package/src/ui/collection_editor/properties/NumberPropertyField.tsx +3 -1
- package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +6 -9
- package/src/ui/collection_editor/properties/StoragePropertyField.tsx +65 -49
- package/src/ui/collection_editor/properties/StringPropertyField.tsx +3 -1
- package/src/ui/collection_editor/properties/UrlPropertyField.tsx +12 -10
- package/src/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx +23 -4
- package/src/ui/collection_editor/properties/conditions/ConditionsEditor.tsx +866 -0
- package/src/ui/collection_editor/properties/conditions/ConditionsPanel.tsx +28 -0
- package/src/ui/collection_editor/properties/conditions/EnumConditionsEditor.tsx +599 -0
- package/src/ui/collection_editor/properties/conditions/index.ts +6 -0
- package/src/ui/collection_editor/properties/conditions/property_paths.ts +92 -0
- package/src/ui/collection_editor/properties/validation/ArrayPropertyValidation.tsx +5 -2
- package/src/ui/collection_editor/properties/validation/GeneralPropertyValidation.tsx +7 -5
- package/src/ui/collection_editor/properties/validation/NumberPropertyValidation.tsx +10 -7
- package/src/ui/collection_editor/properties/validation/StringPropertyValidation.tsx +11 -9
- package/src/ui/collection_editor/properties/validation/ValidationPanel.tsx +5 -2
- package/src/useCollectionEditorPlugin.tsx +53 -22
- 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
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
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
|
-
|
|
72
|
-
<div className={"
|
|
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
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
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
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
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
|
-
|
|
128
|
+
</Paper>
|
|
128
129
|
|
|
129
|
-
|
|
130
|
+
</div>
|
|
130
131
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
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
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
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
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
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
|
-
|
|
205
|
+
</div>
|
|
207
206
|
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
</div>
|
|
208
|
+
);
|
|
210
209
|
|
|
211
|
-
|
|
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
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
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
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
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
|
-
|
|
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"}>
|
|
50
|
-
<Typography variant={"caption"}>
|
|
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,
|
|
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"}>
|
|
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}
|
|
@@ -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
|
-
|
|
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={"
|
|
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={"
|
|
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={"
|
|
100
|
+
label={t("description")}
|
|
99
101
|
disabled={disabled}
|
|
100
102
|
error={Boolean(descriptionError)}/>
|
|
101
103
|
<FieldCaption error={Boolean(descriptionError)}>
|