@firecms/collection_editor 3.0.1 → 3.1.0-canary.1df3b2c
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 +9418 -5587
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +9413 -5582
- package/dist/index.umd.js.map +1 -1
- 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 +23 -2
- package/dist/ui/AddKanbanColumnAction.d.ts +11 -0
- package/dist/ui/KanbanSetupAction.d.ts +10 -0
- package/dist/ui/collection_editor/AICollectionGeneratorPopover.d.ts +33 -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 +20 -0
- package/dist/ui/collection_editor/CollectionEditorWelcomeView.d.ts +3 -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 +11 -11
- package/src/ConfigControllerProvider.tsx +81 -47
- package/src/api/generateCollectionApi.ts +119 -0
- package/src/api/index.ts +1 -0
- package/src/index.ts +28 -1
- package/src/types/collection_editor_controller.tsx +16 -3
- package/src/types/collection_inference.ts +15 -2
- package/src/types/config_controller.tsx +27 -2
- package/src/ui/AddKanbanColumnAction.tsx +203 -0
- package/src/ui/EditorCollectionActionStart.tsx +1 -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 +1 -1
- package/src/ui/PropertyAddColumnComponent.tsx +1 -1
- package/src/ui/collection_editor/AICollectionGeneratorPopover.tsx +225 -0
- package/src/ui/collection_editor/AIModifiedPathsContext.tsx +88 -0
- package/src/ui/collection_editor/CollectionDetailsForm.tsx +209 -257
- package/src/ui/collection_editor/CollectionEditorDialog.tsx +226 -167
- package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +130 -67
- package/src/ui/collection_editor/CollectionJsonImportDialog.tsx +171 -0
- package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +190 -91
- package/src/ui/collection_editor/DisplaySettingsForm.tsx +333 -0
- package/src/ui/collection_editor/EntityActionsEditTab.tsx +106 -96
- package/src/ui/collection_editor/EntityActionsSelectDialog.tsx +6 -7
- package/src/ui/collection_editor/EntityCustomViewsSelectDialog.tsx +1 -3
- package/src/ui/collection_editor/EnumForm.tsx +147 -100
- package/src/ui/collection_editor/ExtendSettingsForm.tsx +93 -0
- package/src/ui/collection_editor/GeneralSettingsForm.tsx +335 -0
- package/src/ui/collection_editor/GetCodeDialog.tsx +57 -36
- package/src/ui/collection_editor/KanbanConfigSection.tsx +207 -0
- package/src/ui/collection_editor/LayoutModeSwitch.tsx +22 -41
- package/src/ui/collection_editor/PropertyEditView.tsx +205 -141
- 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 +171 -162
- package/src/ui/collection_editor/UnsavedChangesDialog.tsx +0 -2
- package/src/ui/collection_editor/ViewModeSwitch.tsx +41 -0
- package/src/ui/collection_editor/properties/BlockPropertyField.tsx +0 -2
- package/src/ui/collection_editor/properties/BooleanPropertyField.tsx +1 -0
- package/src/ui/collection_editor/properties/DateTimePropertyField.tsx +117 -35
- package/src/ui/collection_editor/properties/EnumPropertyField.tsx +28 -21
- package/src/ui/collection_editor/properties/MapPropertyField.tsx +0 -2
- package/src/ui/collection_editor/properties/MarkdownPropertyField.tsx +115 -39
- package/src/ui/collection_editor/properties/StoragePropertyField.tsx +1 -1
- package/src/ui/collection_editor/properties/conditions/ConditionsEditor.tsx +861 -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/ValidationPanel.tsx +1 -1
- package/src/useCollectionEditorPlugin.tsx +32 -17
- package/src/utils/validateCollectionJson.ts +380 -0
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
ErrorBoundary,
|
|
7
7
|
isPropertyBuilder,
|
|
8
8
|
makePropertiesEditable,
|
|
9
|
+
MapProperty,
|
|
9
10
|
Properties,
|
|
10
11
|
Property,
|
|
11
12
|
PropertyConfig,
|
|
@@ -16,13 +17,13 @@ import {
|
|
|
16
17
|
} from "@firecms/core";
|
|
17
18
|
import {
|
|
18
19
|
AddIcon,
|
|
19
|
-
AutorenewIcon,
|
|
20
20
|
Button,
|
|
21
21
|
CircularProgress,
|
|
22
22
|
cls,
|
|
23
23
|
CodeIcon,
|
|
24
24
|
DebouncedTextField,
|
|
25
25
|
defaultBorderMixin,
|
|
26
|
+
FindInPageIcon,
|
|
26
27
|
IconButton,
|
|
27
28
|
Tooltip,
|
|
28
29
|
Typography,
|
|
@@ -33,6 +34,7 @@ import { OnPropertyChangedParams, PropertyForm, PropertyFormDialog } from "./Pro
|
|
|
33
34
|
import { PropertyTree } from "./PropertyTree";
|
|
34
35
|
import { PersistedCollection } from "../../types/persisted_collection";
|
|
35
36
|
import { GetCodeDialog } from "./GetCodeDialog";
|
|
37
|
+
import { useAIModifiedPaths } from "./AIModifiedPathsContext";
|
|
36
38
|
|
|
37
39
|
type CollectionEditorFormProps = {
|
|
38
40
|
showErrors: boolean;
|
|
@@ -50,19 +52,19 @@ type CollectionEditorFormProps = {
|
|
|
50
52
|
};
|
|
51
53
|
|
|
52
54
|
export function CollectionPropertiesEditorForm({
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
55
|
+
showErrors,
|
|
56
|
+
isNewCollection,
|
|
57
|
+
propertyErrorsRef,
|
|
58
|
+
onPropertyError,
|
|
59
|
+
setDirty,
|
|
60
|
+
reservedGroups,
|
|
61
|
+
extraIcon,
|
|
62
|
+
getUser,
|
|
63
|
+
getData,
|
|
64
|
+
doCollectionInference,
|
|
65
|
+
propertyConfigs,
|
|
66
|
+
collectionEditable
|
|
67
|
+
}: CollectionEditorFormProps) {
|
|
66
68
|
|
|
67
69
|
const {
|
|
68
70
|
values,
|
|
@@ -108,7 +110,7 @@ export function CollectionPropertiesEditorForm({
|
|
|
108
110
|
|
|
109
111
|
setInferringProperties(true);
|
|
110
112
|
|
|
111
|
-
console.debug("CollectionEditor: inferring properties from data",
|
|
113
|
+
console.debug("CollectionEditor: inferring properties from data", values);
|
|
112
114
|
// @ts-ignore
|
|
113
115
|
doCollectionInference(values)
|
|
114
116
|
.then((newCollection) => {
|
|
@@ -123,35 +125,130 @@ export function CollectionPropertiesEditorForm({
|
|
|
123
125
|
});
|
|
124
126
|
return;
|
|
125
127
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
+
|
|
129
|
+
// Helper function to find all new property keys including nested ones
|
|
130
|
+
const findNewPropertyKeys = (
|
|
131
|
+
existingProps: Record<string, PropertyOrBuilder> | undefined,
|
|
132
|
+
newProps: Record<string, PropertyOrBuilder> | undefined,
|
|
133
|
+
namespace?: string
|
|
134
|
+
): string[] => {
|
|
135
|
+
if (!newProps) return [];
|
|
136
|
+
const keys: string[] = [];
|
|
137
|
+
|
|
138
|
+
for (const key of Object.keys(newProps)) {
|
|
139
|
+
const fullKey = namespace ? `${namespace}.${key}` : key;
|
|
140
|
+
const existingProp = existingProps?.[key];
|
|
141
|
+
const newProp = newProps[key];
|
|
142
|
+
|
|
143
|
+
if (!existingProp) {
|
|
144
|
+
// This is a completely new property
|
|
145
|
+
keys.push(fullKey);
|
|
146
|
+
} else if (
|
|
147
|
+
typeof newProp === "object" &&
|
|
148
|
+
"dataType" in newProp &&
|
|
149
|
+
newProp.dataType === "map" &&
|
|
150
|
+
newProp.properties
|
|
151
|
+
) {
|
|
152
|
+
// This is a map property, check for new nested properties
|
|
153
|
+
const existingMapProps = typeof existingProp === "object" &&
|
|
154
|
+
"dataType" in existingProp &&
|
|
155
|
+
existingProp.dataType === "map"
|
|
156
|
+
? (existingProp as any).properties
|
|
157
|
+
: undefined;
|
|
158
|
+
keys.push(...findNewPropertyKeys(existingMapProps, newProp.properties as Record<string, PropertyOrBuilder>, fullKey));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return keys;
|
|
162
|
+
};
|
|
163
|
+
|
|
164
|
+
// Helper function to add only new properties without overwriting existing ones
|
|
165
|
+
// This preserves existing property configurations while adding missing nested properties
|
|
166
|
+
const addNewPropertiesOnly = (
|
|
167
|
+
existingProps: Record<string, PropertyOrBuilder> | undefined,
|
|
168
|
+
newProps: Record<string, PropertyOrBuilder> | undefined
|
|
169
|
+
): Record<string, PropertyOrBuilder> => {
|
|
170
|
+
if (!newProps) return existingProps ?? {};
|
|
171
|
+
if (!existingProps) return newProps;
|
|
172
|
+
|
|
173
|
+
const result = { ...existingProps };
|
|
174
|
+
|
|
175
|
+
for (const key of Object.keys(newProps)) {
|
|
176
|
+
const existingProp = existingProps[key];
|
|
177
|
+
const newProp = newProps[key];
|
|
178
|
+
|
|
179
|
+
if (!existingProp) {
|
|
180
|
+
// This property doesn't exist, add it
|
|
181
|
+
result[key] = newProp;
|
|
182
|
+
} else if (
|
|
183
|
+
typeof existingProp === "object" &&
|
|
184
|
+
"dataType" in existingProp &&
|
|
185
|
+
existingProp.dataType === "map" &&
|
|
186
|
+
typeof newProp === "object" &&
|
|
187
|
+
"dataType" in newProp &&
|
|
188
|
+
newProp.dataType === "map" &&
|
|
189
|
+
newProp.properties
|
|
190
|
+
) {
|
|
191
|
+
// Both are map properties, recursively add new nested properties
|
|
192
|
+
// Only if the existing map has properties, merge them; otherwise keep existing as-is
|
|
193
|
+
const existingMapProps = (existingProp as MapProperty).properties as Record<string, PropertyOrBuilder> | undefined;
|
|
194
|
+
if (existingMapProps) {
|
|
195
|
+
result[key] = {
|
|
196
|
+
...existingProp,
|
|
197
|
+
properties: addNewPropertiesOnly(
|
|
198
|
+
existingMapProps,
|
|
199
|
+
newProp.properties as Record<string, PropertyOrBuilder>
|
|
200
|
+
)
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
// If existingProp doesn't have properties, keep it as-is (don't overwrite with inferred)
|
|
204
|
+
}
|
|
205
|
+
// Otherwise, keep the existing property as-is (don't overwrite)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
return result;
|
|
209
|
+
};
|
|
210
|
+
|
|
211
|
+
// Add only new properties from inferred collection without replacing existing ones
|
|
212
|
+
const updatedProperties = addNewPropertiesOnly(
|
|
213
|
+
values.properties ?? {},
|
|
214
|
+
newCollection.properties as Record<string, PropertyOrBuilder>
|
|
215
|
+
) as { [key: string]: PropertyOrBuilder };
|
|
216
|
+
|
|
217
|
+
// Find all new property keys including nested ones
|
|
218
|
+
const allNewPropertyKeys = findNewPropertyKeys(
|
|
219
|
+
values.properties,
|
|
220
|
+
newCollection.properties as Record<string, PropertyOrBuilder>
|
|
221
|
+
);
|
|
222
|
+
|
|
223
|
+
// Find new top-level property keys for the properties order
|
|
224
|
+
const newTopLevelPropertyKeys = (newCollection.properties ? Object.keys(newCollection.properties) : [])
|
|
128
225
|
.filter((propertyKey) => !values.properties[propertyKey]);
|
|
129
|
-
|
|
226
|
+
|
|
227
|
+
// Check if there are any changes (new properties or modified nested properties)
|
|
228
|
+
if (allNewPropertyKeys.length === 0) {
|
|
130
229
|
snackbarController.open({
|
|
131
230
|
type: "info",
|
|
132
231
|
message: "No new properties found in existing data"
|
|
133
232
|
});
|
|
134
233
|
return;
|
|
135
234
|
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
return acc;
|
|
141
|
-
}, {} as {
|
|
142
|
-
[key: string]: PropertyOrBuilder
|
|
143
|
-
}),
|
|
144
|
-
...values.properties
|
|
145
|
-
};
|
|
235
|
+
|
|
236
|
+
// Update properties order: keep existing order and append new keys at the beginning
|
|
237
|
+
// Use Object.keys from updatedProperties to ensure all properties are included
|
|
238
|
+
const allExistingKeys = values.propertiesOrder ?? Object.keys(values.properties ?? {});
|
|
146
239
|
const updatedPropertiesOrder = [
|
|
147
|
-
...
|
|
148
|
-
...(
|
|
240
|
+
...newTopLevelPropertyKeys,
|
|
241
|
+
...allExistingKeys.filter(key => !newTopLevelPropertyKeys.includes(key))
|
|
149
242
|
];
|
|
150
|
-
setFieldValue("properties", updatedProperties, false);
|
|
151
243
|
|
|
244
|
+
setFieldValue("properties", updatedProperties, false);
|
|
152
245
|
updatePropertiesOrder(updatedPropertiesOrder);
|
|
246
|
+
setInferredPropertyKeys(allNewPropertyKeys);
|
|
153
247
|
|
|
154
|
-
|
|
248
|
+
snackbarController.open({
|
|
249
|
+
type: "success",
|
|
250
|
+
message: `Added ${allNewPropertyKeys.length} new ${allNewPropertyKeys.length === 1 ? "property" : "properties"}`
|
|
251
|
+
});
|
|
155
252
|
})
|
|
156
253
|
.finally(() => {
|
|
157
254
|
setInferringProperties(false);
|
|
@@ -197,9 +294,9 @@ export function CollectionPropertiesEditorForm({
|
|
|
197
294
|
};
|
|
198
295
|
|
|
199
296
|
const onPropertyCreated = ({
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
297
|
+
id,
|
|
298
|
+
property
|
|
299
|
+
}: {
|
|
203
300
|
id?: string,
|
|
204
301
|
property: Property
|
|
205
302
|
}) => {
|
|
@@ -223,11 +320,11 @@ export function CollectionPropertiesEditorForm({
|
|
|
223
320
|
};
|
|
224
321
|
|
|
225
322
|
const onPropertyChanged = ({
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
323
|
+
id,
|
|
324
|
+
property,
|
|
325
|
+
previousId,
|
|
326
|
+
namespace
|
|
327
|
+
}: OnPropertyChangedParams) => {
|
|
231
328
|
|
|
232
329
|
const fullId = id ? getFullId(id, namespace) : undefined;
|
|
233
330
|
const propertyPath = fullId ? idToPropertiesPath(fullId) : undefined;
|
|
@@ -292,6 +389,10 @@ export function CollectionPropertiesEditorForm({
|
|
|
292
389
|
|
|
293
390
|
const owner = useMemo(() => values.ownerId && getUser ? getUser(values.ownerId) : null, [getUser, values.ownerId]);
|
|
294
391
|
|
|
392
|
+
// Get AI generation counter for key to force remount on AI changes
|
|
393
|
+
const aiModifiedPaths = useAIModifiedPaths();
|
|
394
|
+
const generationCounter = aiModifiedPaths?.generationCounter ?? 0;
|
|
395
|
+
|
|
295
396
|
const onPropertyClick = (propertyKey: string, namespace?: string) => {
|
|
296
397
|
console.debug("CollectionEditor: onPropertyClick", {
|
|
297
398
|
propertyKey,
|
|
@@ -303,7 +404,7 @@ export function CollectionPropertiesEditorForm({
|
|
|
303
404
|
};
|
|
304
405
|
|
|
305
406
|
const body = (
|
|
306
|
-
<div className={"grid grid-cols-12 gap-2 h-full bg-
|
|
407
|
+
<div className={"grid grid-cols-12 gap-2 h-full bg-surface dark:bg-surface-dark"}>
|
|
307
408
|
<div className={cls(
|
|
308
409
|
"bg-surface-50 dark:bg-surface-900",
|
|
309
410
|
"p-4 md:p-8 pb-20 md:pb-20",
|
|
@@ -324,12 +425,12 @@ export function CollectionPropertiesEditorForm({
|
|
|
324
425
|
placeholder={"Collection name"}
|
|
325
426
|
size={"small"}
|
|
326
427
|
required
|
|
327
|
-
error={Boolean(errors?.name)}/>
|
|
428
|
+
error={Boolean(errors?.name)} />
|
|
328
429
|
|
|
329
430
|
{owner &&
|
|
330
431
|
<Typography variant={"body2"}
|
|
331
|
-
|
|
332
|
-
|
|
432
|
+
className={"ml-2"}
|
|
433
|
+
color={"secondary"}>
|
|
333
434
|
Created by {owner.displayName}
|
|
334
435
|
</Typography>}
|
|
335
436
|
</div>
|
|
@@ -340,30 +441,28 @@ export function CollectionPropertiesEditorForm({
|
|
|
340
441
|
|
|
341
442
|
<div className="ml-1 mt-2 flex flex-row gap-2">
|
|
342
443
|
<Tooltip title={"Get the code for this collection"}
|
|
343
|
-
|
|
444
|
+
asChild={true}>
|
|
344
445
|
<IconButton
|
|
345
446
|
variant={"filled"}
|
|
346
447
|
disabled={inferringProperties}
|
|
347
448
|
onClick={() => setCodeDialogOpen(true)}>
|
|
348
|
-
<CodeIcon/>
|
|
449
|
+
<CodeIcon />
|
|
349
450
|
</IconButton>
|
|
350
451
|
</Tooltip>
|
|
351
452
|
{inferPropertiesFromData && <Tooltip title={"Add new properties based on data"}
|
|
352
|
-
|
|
453
|
+
asChild={true}>
|
|
353
454
|
<IconButton
|
|
354
455
|
variant={"filled"}
|
|
355
456
|
disabled={inferringProperties}
|
|
356
457
|
onClick={inferPropertiesFromData}>
|
|
357
|
-
{inferringProperties ? <CircularProgress size={"small"}/> : <
|
|
458
|
+
{inferringProperties ? <CircularProgress size={"small"} /> : <FindInPageIcon />}
|
|
358
459
|
</IconButton>
|
|
359
460
|
</Tooltip>}
|
|
360
461
|
<Tooltip title={"Add new property"}
|
|
361
|
-
|
|
462
|
+
asChild={true}>
|
|
362
463
|
<Button
|
|
363
|
-
variant={"outlined"}
|
|
364
|
-
color={"primary"}
|
|
365
464
|
onClick={() => setNewPropertyDialogOpen(true)}>
|
|
366
|
-
<AddIcon/>
|
|
465
|
+
<AddIcon />
|
|
367
466
|
</Button>
|
|
368
467
|
</Tooltip>
|
|
369
468
|
</div>
|
|
@@ -379,17 +478,15 @@ export function CollectionPropertiesEditorForm({
|
|
|
379
478
|
propertiesOrder={usedPropertiesOrder}
|
|
380
479
|
onPropertyClick={onPropertyClick}
|
|
381
480
|
onPropertyMove={onPropertyMove}
|
|
382
|
-
onPropertyRemove={isNewCollection ? deleteProperty : undefined}
|
|
481
|
+
onPropertyRemove={(isNewCollection || (inferredPropertyKeys && inferredPropertyKeys.length > 0)) ? deleteProperty : undefined}
|
|
383
482
|
collectionEditable={collectionEditable}
|
|
384
|
-
errors={errors}/>
|
|
483
|
+
errors={errors} />
|
|
385
484
|
</ErrorBoundary>
|
|
386
485
|
|
|
387
486
|
<Button className={"mt-8 w-full"}
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
onClick={() => setNewPropertyDialogOpen(true)}
|
|
392
|
-
startIcon={<AddIcon/>}>
|
|
487
|
+
size={"large"}
|
|
488
|
+
onClick={() => setNewPropertyDialogOpen(true)}
|
|
489
|
+
startIcon={<AddIcon />}>
|
|
393
490
|
Add new property
|
|
394
491
|
</Button>
|
|
395
492
|
</div>
|
|
@@ -404,7 +501,7 @@ export function CollectionPropertiesEditorForm({
|
|
|
404
501
|
!isPropertyBuilder(selectedProperty) &&
|
|
405
502
|
<PropertyForm
|
|
406
503
|
inArray={false}
|
|
407
|
-
key={`edit_view_${selectedPropertyIndex}`}
|
|
504
|
+
key={`edit_view_${selectedPropertyIndex}_${generationCounter}`}
|
|
408
505
|
existingProperty={!isNewCollection}
|
|
409
506
|
autoUpdateId={false}
|
|
410
507
|
allowDataInference={!isNewCollection}
|
|
@@ -420,6 +517,7 @@ export function CollectionPropertiesEditorForm({
|
|
|
420
517
|
getData={getData}
|
|
421
518
|
propertyConfigs={propertyConfigs}
|
|
422
519
|
collectionEditable={collectionEditable}
|
|
520
|
+
collectionProperties={values.properties as Properties}
|
|
423
521
|
/>}
|
|
424
522
|
|
|
425
523
|
{!selectedProperty &&
|
|
@@ -429,11 +527,10 @@ export function CollectionPropertiesEditorForm({
|
|
|
429
527
|
? "Now you can add your first property"
|
|
430
528
|
: "Select a property to edit it"}
|
|
431
529
|
</Typography>
|
|
432
|
-
<Button
|
|
433
|
-
|
|
434
|
-
onClick={() => setNewPropertyDialogOpen(true)}
|
|
530
|
+
<Button
|
|
531
|
+
onClick={() => setNewPropertyDialogOpen(true)}
|
|
435
532
|
>
|
|
436
|
-
<AddIcon/>
|
|
533
|
+
<AddIcon />
|
|
437
534
|
Add new property
|
|
438
535
|
</Button>
|
|
439
536
|
</div>}
|
|
@@ -448,7 +545,7 @@ export function CollectionPropertiesEditorForm({
|
|
|
448
545
|
{asDialog && <PropertyFormDialog
|
|
449
546
|
inArray={false}
|
|
450
547
|
open={selectedPropertyIndex !== undefined}
|
|
451
|
-
key={`edit_view_${selectedPropertyIndex}`}
|
|
548
|
+
key={`edit_view_${selectedPropertyIndex}_${generationCounter}`}
|
|
452
549
|
autoUpdateId={!selectedProperty}
|
|
453
550
|
allowDataInference={!isNewCollection}
|
|
454
551
|
existingProperty={true}
|
|
@@ -464,40 +561,42 @@ export function CollectionPropertiesEditorForm({
|
|
|
464
561
|
getData={getData}
|
|
465
562
|
propertyConfigs={propertyConfigs}
|
|
466
563
|
collectionEditable={collectionEditable}
|
|
564
|
+
collectionProperties={values.properties as Properties}
|
|
467
565
|
onCancel={closePropertyDialog}
|
|
468
566
|
onOkClicked={asDialog
|
|
469
567
|
? closePropertyDialog
|
|
470
568
|
: undefined
|
|
471
|
-
}/>}
|
|
569
|
+
} />}
|
|
472
570
|
|
|
473
571
|
</div>);
|
|
474
572
|
|
|
475
573
|
return (<>
|
|
476
574
|
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
575
|
+
{body}
|
|
576
|
+
|
|
577
|
+
{/* This is the dialog used for new properties*/}
|
|
578
|
+
<PropertyFormDialog
|
|
579
|
+
inArray={false}
|
|
580
|
+
existingProperty={false}
|
|
581
|
+
autoOpenTypeSelect={true}
|
|
582
|
+
autoUpdateId={true}
|
|
583
|
+
forceShowErrors={showErrors}
|
|
584
|
+
open={newPropertyDialogOpen}
|
|
585
|
+
onCancel={() => setNewPropertyDialogOpen(false)}
|
|
586
|
+
onPropertyChanged={onPropertyCreated}
|
|
587
|
+
getData={getData}
|
|
588
|
+
allowDataInference={!isNewCollection}
|
|
589
|
+
propertyConfigs={propertyConfigs}
|
|
590
|
+
collectionEditable={collectionEditable}
|
|
591
|
+
collectionProperties={values.properties as Properties}
|
|
592
|
+
existingPropertyKeys={values.propertiesOrder as string[]} />
|
|
593
|
+
|
|
594
|
+
<ErrorBoundary>
|
|
595
|
+
<GetCodeDialog
|
|
596
|
+
collection={values}
|
|
597
|
+
open={codeDialogOpen}
|
|
598
|
+
onOpenChange={setCodeDialogOpen} />
|
|
599
|
+
</ErrorBoundary>
|
|
600
|
+
</>
|
|
502
601
|
);
|
|
503
602
|
}
|