@firecms/collection_editor 3.0.0 → 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.
Files changed (91) hide show
  1. package/dist/ConfigControllerProvider.d.ts +6 -0
  2. package/dist/api/generateCollectionApi.d.ts +71 -0
  3. package/dist/api/index.d.ts +1 -0
  4. package/dist/index.d.ts +5 -1
  5. package/dist/index.es.js +9677 -5837
  6. package/dist/index.es.js.map +1 -1
  7. package/dist/index.umd.js +9653 -5813
  8. package/dist/index.umd.js.map +1 -1
  9. package/dist/types/collection_editor_controller.d.ts +14 -0
  10. package/dist/types/collection_inference.d.ts +8 -2
  11. package/dist/types/config_controller.d.ts +31 -1
  12. package/dist/ui/AddKanbanColumnAction.d.ts +11 -0
  13. package/dist/ui/KanbanSetupAction.d.ts +10 -0
  14. package/dist/ui/collection_editor/AICollectionGeneratorPopover.d.ts +33 -0
  15. package/dist/ui/collection_editor/AIModifiedPathsContext.d.ts +20 -0
  16. package/dist/ui/collection_editor/CollectionDetailsForm.d.ts +2 -3
  17. package/dist/ui/collection_editor/CollectionEditorDialog.d.ts +20 -0
  18. package/dist/ui/collection_editor/CollectionEditorWelcomeView.d.ts +3 -1
  19. package/dist/ui/collection_editor/CollectionJsonImportDialog.d.ts +7 -0
  20. package/dist/ui/collection_editor/CollectionYupValidation.d.ts +9 -13
  21. package/dist/ui/collection_editor/DisplaySettingsForm.d.ts +3 -0
  22. package/dist/ui/collection_editor/EntityActionsEditTab.d.ts +2 -1
  23. package/dist/ui/collection_editor/ExtendSettingsForm.d.ts +14 -0
  24. package/dist/ui/collection_editor/GeneralSettingsForm.d.ts +7 -0
  25. package/dist/ui/collection_editor/KanbanConfigSection.d.ts +4 -0
  26. package/dist/ui/collection_editor/PropertyEditView.d.ts +6 -1
  27. package/dist/ui/collection_editor/PropertyTree.d.ts +2 -1
  28. package/dist/ui/collection_editor/SubcollectionsEditTab.d.ts +2 -1
  29. package/dist/ui/collection_editor/ViewModeSwitch.d.ts +6 -0
  30. package/dist/ui/collection_editor/properties/EnumPropertyField.d.ts +2 -1
  31. package/dist/ui/collection_editor/properties/conditions/ConditionsEditor.d.ts +10 -0
  32. package/dist/ui/collection_editor/properties/conditions/ConditionsPanel.d.ts +2 -0
  33. package/dist/ui/collection_editor/properties/conditions/EnumConditionsEditor.d.ts +6 -0
  34. package/dist/ui/collection_editor/properties/conditions/index.d.ts +6 -0
  35. package/dist/ui/collection_editor/properties/conditions/property_paths.d.ts +19 -0
  36. package/dist/useCollectionEditorPlugin.d.ts +7 -1
  37. package/dist/utils/validateCollectionJson.d.ts +22 -0
  38. package/package.json +11 -11
  39. package/src/ConfigControllerProvider.tsx +81 -47
  40. package/src/api/generateCollectionApi.ts +119 -0
  41. package/src/api/index.ts +1 -0
  42. package/src/index.ts +28 -1
  43. package/src/types/collection_editor_controller.tsx +16 -3
  44. package/src/types/collection_inference.ts +15 -2
  45. package/src/types/config_controller.tsx +37 -1
  46. package/src/ui/AddKanbanColumnAction.tsx +203 -0
  47. package/src/ui/EditorCollectionActionStart.tsx +1 -2
  48. package/src/ui/HomePageEditorCollectionAction.tsx +41 -13
  49. package/src/ui/KanbanSetupAction.tsx +38 -0
  50. package/src/ui/MissingReferenceWidget.tsx +1 -1
  51. package/src/ui/NewCollectionButton.tsx +1 -1
  52. package/src/ui/PropertyAddColumnComponent.tsx +1 -1
  53. package/src/ui/collection_editor/AICollectionGeneratorPopover.tsx +225 -0
  54. package/src/ui/collection_editor/AIModifiedPathsContext.tsx +88 -0
  55. package/src/ui/collection_editor/CollectionDetailsForm.tsx +209 -258
  56. package/src/ui/collection_editor/CollectionEditorDialog.tsx +226 -173
  57. package/src/ui/collection_editor/CollectionEditorWelcomeView.tsx +130 -67
  58. package/src/ui/collection_editor/CollectionJsonImportDialog.tsx +171 -0
  59. package/src/ui/collection_editor/CollectionPropertiesEditorForm.tsx +190 -91
  60. package/src/ui/collection_editor/DisplaySettingsForm.tsx +333 -0
  61. package/src/ui/collection_editor/EntityActionsEditTab.tsx +106 -96
  62. package/src/ui/collection_editor/EntityActionsSelectDialog.tsx +6 -7
  63. package/src/ui/collection_editor/EntityCustomViewsSelectDialog.tsx +1 -3
  64. package/src/ui/collection_editor/EnumForm.tsx +147 -100
  65. package/src/ui/collection_editor/ExtendSettingsForm.tsx +93 -0
  66. package/src/ui/collection_editor/GeneralSettingsForm.tsx +335 -0
  67. package/src/ui/collection_editor/GetCodeDialog.tsx +57 -36
  68. package/src/ui/collection_editor/KanbanConfigSection.tsx +207 -0
  69. package/src/ui/collection_editor/LayoutModeSwitch.tsx +22 -41
  70. package/src/ui/collection_editor/PropertyEditView.tsx +205 -141
  71. package/src/ui/collection_editor/PropertyFieldPreview.tsx +1 -1
  72. package/src/ui/collection_editor/PropertyTree.tsx +130 -58
  73. package/src/ui/collection_editor/SubcollectionsEditTab.tsx +171 -162
  74. package/src/ui/collection_editor/UnsavedChangesDialog.tsx +0 -2
  75. package/src/ui/collection_editor/ViewModeSwitch.tsx +41 -0
  76. package/src/ui/collection_editor/properties/BlockPropertyField.tsx +0 -2
  77. package/src/ui/collection_editor/properties/BooleanPropertyField.tsx +1 -0
  78. package/src/ui/collection_editor/properties/DateTimePropertyField.tsx +117 -35
  79. package/src/ui/collection_editor/properties/EnumPropertyField.tsx +28 -21
  80. package/src/ui/collection_editor/properties/MapPropertyField.tsx +0 -2
  81. package/src/ui/collection_editor/properties/MarkdownPropertyField.tsx +115 -39
  82. package/src/ui/collection_editor/properties/ReferencePropertyField.tsx +1 -5
  83. package/src/ui/collection_editor/properties/StoragePropertyField.tsx +23 -2
  84. package/src/ui/collection_editor/properties/conditions/ConditionsEditor.tsx +861 -0
  85. package/src/ui/collection_editor/properties/conditions/ConditionsPanel.tsx +28 -0
  86. package/src/ui/collection_editor/properties/conditions/EnumConditionsEditor.tsx +599 -0
  87. package/src/ui/collection_editor/properties/conditions/index.ts +6 -0
  88. package/src/ui/collection_editor/properties/conditions/property_paths.ts +92 -0
  89. package/src/ui/collection_editor/properties/validation/ValidationPanel.tsx +1 -1
  90. package/src/useCollectionEditorPlugin.tsx +32 -17
  91. package/src/utils/validateCollectionJson.ts +380 -0
@@ -10,6 +10,7 @@ import {
10
10
  isPropertyBuilder,
11
11
  isValidRegExp,
12
12
  mergeDeep,
13
+ Properties,
13
14
  Property,
14
15
  PropertyConfig,
15
16
  PropertyConfigBadge,
@@ -45,6 +46,7 @@ import { NumberPropertyField } from "./properties/NumberPropertyField";
45
46
  import { ReferencePropertyField } from "./properties/ReferencePropertyField";
46
47
  import { DateTimePropertyField } from "./properties/DateTimePropertyField";
47
48
  import { AdvancedPropertyValidation } from "./properties/advanced/AdvancedPropertyValidation";
49
+ import { ConditionsPanel, ConditionsEditor, EnumConditionsEditor } from "./properties/conditions";
48
50
  import { editableProperty } from "../../utils/entities";
49
51
  import { KeyValuePropertyField } from "./properties/KeyValuePropertyField";
50
52
  import { updatePropertyFromWidget } from "./utils/update_property_for_widget";
@@ -85,6 +87,11 @@ export type PropertyFormProps = {
85
87
  getController?: (formex: FormexController<PropertyWithId>) => void;
86
88
  propertyConfigs: Record<string, PropertyConfig>;
87
89
  collectionEditable: boolean;
90
+ /**
91
+ * Collection properties for populating the conditions field selector.
92
+ * Includes nested map properties.
93
+ */
94
+ collectionProperties?: Properties;
88
95
  };
89
96
 
90
97
  export const PropertyForm = React.memo(
@@ -108,10 +115,11 @@ export const PropertyForm = React.memo(
108
115
  initialErrors,
109
116
  forceShowErrors,
110
117
  allowDataInference,
111
- getController,
112
118
  getData,
119
+ getController,
113
120
  propertyConfigs,
114
- collectionEditable
121
+ collectionEditable,
122
+ collectionProperties
115
123
  } = props;
116
124
 
117
125
  const initialValue: PropertyWithId = {
@@ -128,9 +136,9 @@ export const PropertyForm = React.memo(
128
136
  } : undefined);
129
137
 
130
138
  const doOnPropertyChanged = ({
131
- id,
132
- property
133
- }: OnPropertyChangedParams) => {
139
+ id,
140
+ property
141
+ }: OnPropertyChangedParams) => {
134
142
  const params = {
135
143
  id,
136
144
  previousId: lastSubmittedProperty.current?.id,
@@ -177,7 +185,9 @@ export const PropertyForm = React.memo(
177
185
  if (!values.id) {
178
186
  errors.id = "Required";
179
187
  } else {
180
- const idError = validateId(values.id, existingPropertyKeys);
188
+ // Exclude the current property key when editing to avoid false duplicate error
189
+ const keysToCheck = existingPropertyKeys?.filter(key => key !== propertyKey);
190
+ const idError = validateId(values.id, keysToCheck);
181
191
  if (idError)
182
192
  errors.id = idError;
183
193
  }
@@ -203,6 +213,50 @@ export const PropertyForm = React.memo(
203
213
  errors.oneOf = "You need to specify the properties of this block";
204
214
  }
205
215
  }
216
+
217
+ // Validate conditions - check for incomplete condition rules
218
+ const conditions = (values as any).conditions;
219
+ if (conditions) {
220
+ const conditionErrors: Record<string, string> = {};
221
+ const conditionTypes = ["disabled", "hidden", "required", "readOnly"];
222
+
223
+ // Helper to check if a JSON Logic rule is incomplete (placeholder or empty keys)
224
+ const isIncompleteRule = (rule: any): boolean => {
225
+ if (!rule || typeof rule !== "object") return false;
226
+ const ruleStr = JSON.stringify(rule);
227
+ // Check for placeholder pattern used when field is not selected
228
+ if (ruleStr.includes("values._placeholder")) return true;
229
+ // Check for empty string keys (invalid operators)
230
+ if (Object.keys(rule).some(k => k === "")) return true;
231
+ // Recursively check nested objects
232
+ for (const key of Object.keys(rule)) {
233
+ if (typeof rule[key] === "object" && isIncompleteRule(rule[key])) return true;
234
+ }
235
+ return false;
236
+ };
237
+
238
+ for (const type of conditionTypes) {
239
+ const rule = conditions[type];
240
+ if (rule && isIncompleteRule(rule)) {
241
+ conditionErrors[type] = "Incomplete condition - please select a field";
242
+ }
243
+ }
244
+
245
+ // Validate enum conditions (allowedEnumValues, excludedEnumValues)
246
+ for (const enumType of ["allowedEnumValues", "excludedEnumValues"]) {
247
+ const rule = conditions[enumType];
248
+ if (rule && typeof rule === "object" && rule.if) {
249
+ if (isIncompleteRule(rule)) {
250
+ conditionErrors[enumType] = "Incomplete condition - please select a field";
251
+ }
252
+ }
253
+ }
254
+
255
+ if (Object.keys(conditionErrors).length > 0) {
256
+ errors.conditions = conditionErrors;
257
+ }
258
+ }
259
+
206
260
  return errors;
207
261
  }
208
262
  });
@@ -231,28 +285,30 @@ export const PropertyForm = React.memo(
231
285
  allowDataInference={allowDataInference}
232
286
  propertyConfigs={propertyConfigs}
233
287
  collectionEditable={collectionEditable}
234
- {...formexController}/>
288
+ collectionProperties={collectionProperties}
289
+ {...formexController} />
235
290
  </Formex>;
236
291
  }, (a, b) =>
237
- a.getData === b.getData &&
238
- a.propertyKey === b.propertyKey &&
239
- a.propertyNamespace === b.propertyNamespace &&
240
- a.includeIdAndName === b.includeIdAndName &&
241
- a.autoOpenTypeSelect === b.autoOpenTypeSelect &&
242
- a.autoUpdateId === b.autoUpdateId &&
243
- a.existingPropertyKeys === b.existingPropertyKeys &&
244
- a.existingProperty === b.existingProperty
292
+ a.getData === b.getData &&
293
+ a.propertyKey === b.propertyKey &&
294
+ a.propertyNamespace === b.propertyNamespace &&
295
+ a.includeIdAndName === b.includeIdAndName &&
296
+ a.autoOpenTypeSelect === b.autoOpenTypeSelect &&
297
+ a.autoUpdateId === b.autoUpdateId &&
298
+ a.existingPropertyKeys === b.existingPropertyKeys &&
299
+ a.existingProperty === b.existingProperty &&
300
+ equal(a.property, b.property)
245
301
  );
246
302
 
247
303
  export function PropertyFormDialog({
248
- open,
249
- onCancel,
250
- onOkClicked,
251
- onPropertyChanged,
252
- getData,
253
- collectionEditable,
254
- ...formProps
255
- }: PropertyFormProps & {
304
+ open,
305
+ onCancel,
306
+ onOkClicked,
307
+ onPropertyChanged,
308
+ getData,
309
+ collectionEditable,
310
+ ...formProps
311
+ }: PropertyFormProps & {
256
312
  open?: boolean;
257
313
  onOkClicked?: () => void;
258
314
  onCancel?: () => void;
@@ -268,25 +324,25 @@ export function PropertyFormDialog({
268
324
  fullWidth={true}
269
325
  >
270
326
  <form noValidate={true}
271
- autoComplete={"off"}
272
- onSubmit={(e) => {
273
- e.preventDefault();
274
- e.stopPropagation();
275
- formexRef.current?.handleSubmit(e)
276
- }}>
327
+ autoComplete={"off"}
328
+ onSubmit={(e) => {
329
+ e.preventDefault();
330
+ e.stopPropagation();
331
+ formexRef.current?.handleSubmit(e)
332
+ }}>
277
333
  <DialogTitle hidden>Property edit view</DialogTitle>
278
334
  <DialogContent>
279
335
 
280
336
  <PropertyForm {...formProps}
281
- onDismiss={onCancel}
282
- onPropertyChanged={(params) => {
283
- onPropertyChanged?.(params);
284
- onOkClicked?.();
285
- }}
286
- collectionEditable={collectionEditable}
287
- onPropertyChangedImmediate={false}
288
- getController={getController}
289
- getData={getData}
337
+ onDismiss={onCancel}
338
+ onPropertyChanged={(params) => {
339
+ onPropertyChanged?.(params);
340
+ onOkClicked?.();
341
+ }}
342
+ collectionEditable={collectionEditable}
343
+ onPropertyChangedImmediate={false}
344
+ getController={getController}
345
+ getData={getData}
290
346
  />
291
347
  </DialogContent>
292
348
 
@@ -294,7 +350,6 @@ export function PropertyFormDialog({
294
350
 
295
351
  {onCancel && <Button
296
352
  variant={"text"}
297
- color={"primary"}
298
353
  onClick={() => {
299
354
  onCancel();
300
355
  formexRef.current?.resetForm();
@@ -302,9 +357,7 @@ export function PropertyFormDialog({
302
357
  Cancel
303
358
  </Button>}
304
359
 
305
- <Button variant="outlined"
306
- type={"submit"}
307
- color="primary">
360
+ <Button type={"submit"}>
308
361
  Ok
309
362
  </Button>
310
363
  </DialogActions>
@@ -314,26 +367,27 @@ export function PropertyFormDialog({
314
367
  }
315
368
 
316
369
  function PropertyEditFormFields({
317
- values,
318
- errors,
319
- setValues,
320
- existing,
321
- autoUpdateId = false,
322
- autoOpenTypeSelect,
323
- includeIdAndTitle,
324
- onPropertyChanged,
325
- onDelete,
326
- propertyNamespace,
327
- onDismiss,
328
- onError,
329
- showErrors,
330
- disabled,
331
- inArray,
332
- getData,
333
- allowDataInference,
334
- propertyConfigs,
335
- collectionEditable
336
- }: {
370
+ values,
371
+ errors,
372
+ setValues,
373
+ existing,
374
+ autoUpdateId = false,
375
+ autoOpenTypeSelect,
376
+ includeIdAndTitle,
377
+ onPropertyChanged,
378
+ onDelete,
379
+ propertyNamespace,
380
+ onDismiss,
381
+ onError,
382
+ showErrors,
383
+ disabled,
384
+ inArray,
385
+ getData,
386
+ allowDataInference,
387
+ propertyConfigs,
388
+ collectionEditable,
389
+ collectionProperties
390
+ }: {
337
391
  includeIdAndTitle?: boolean;
338
392
  existing: boolean;
339
393
  autoUpdateId?: boolean;
@@ -350,6 +404,7 @@ function PropertyEditFormFields({
350
404
  allowDataInference: boolean;
351
405
  propertyConfigs: Record<string, PropertyConfig>;
352
406
  collectionEditable: boolean;
407
+ collectionProperties?: Properties;
353
408
  } & FormexController<PropertyWithId>) {
354
409
 
355
410
  const [selectOpen, setSelectOpen] = useState(autoOpenTypeSelect);
@@ -404,16 +459,16 @@ function PropertyEditFormFields({
404
459
  selectedFieldConfigId === "email") {
405
460
  childComponent =
406
461
  <StringPropertyField widgetId={selectedFieldConfigId}
407
- disabled={disabled}
408
- showErrors={showErrors}/>;
462
+ disabled={disabled}
463
+ showErrors={showErrors} />;
409
464
  } else if (selectedFieldConfigId === "url") {
410
465
  childComponent =
411
466
  <UrlPropertyField disabled={disabled}
412
- showErrors={showErrors}/>;
467
+ showErrors={showErrors} />;
413
468
  } else if (selectedFieldConfigId === "markdown") {
414
469
  childComponent =
415
470
  <MarkdownPropertyField disabled={disabled}
416
- showErrors={showErrors}/>;
471
+ showErrors={showErrors} />;
417
472
  } else if (selectedFieldConfigId === "select" ||
418
473
  selectedFieldConfigId === "number_select") {
419
474
  childComponent = <EnumPropertyField
@@ -422,7 +477,8 @@ function PropertyEditFormFields({
422
477
  updateIds={!existing}
423
478
  disabled={disabled}
424
479
  getData={getData}
425
- showErrors={showErrors}/>;
480
+ propertyNamespace={propertyNamespace}
481
+ showErrors={showErrors} />;
426
482
  } else if (selectedFieldConfigId === "multi_select" ||
427
483
  selectedFieldConfigId === "multi_number_select") {
428
484
  childComponent = <EnumPropertyField
@@ -431,64 +487,65 @@ function PropertyEditFormFields({
431
487
  disabled={disabled}
432
488
  allowDataInference={allowDataInference}
433
489
  getData={getData}
434
- showErrors={showErrors}/>;
490
+ propertyNamespace={propertyNamespace}
491
+ showErrors={showErrors} />;
435
492
  } else if (selectedFieldConfigId === "file_upload") {
436
493
  childComponent =
437
494
  <StoragePropertyField existing={existing}
438
- multiple={false}
439
- disabled={disabled}/>;
495
+ multiple={false}
496
+ disabled={disabled} />;
440
497
  } else if (selectedFieldConfigId === "multi_file_upload") {
441
498
  childComponent =
442
499
  <StoragePropertyField existing={existing}
443
- multiple={true}
444
- disabled={disabled}/>;
500
+ multiple={true}
501
+ disabled={disabled} />;
445
502
  } else if (selectedFieldConfigId === "switch") {
446
- childComponent = <BooleanPropertyField disabled={disabled}/>;
503
+ childComponent = <BooleanPropertyField disabled={disabled} />;
447
504
  } else if (selectedFieldConfigId === "number_input") {
448
- childComponent = <NumberPropertyField disabled={disabled}/>;
505
+ childComponent = <NumberPropertyField disabled={disabled} />;
449
506
  } else if (selectedFieldConfigId === "group") {
450
507
  childComponent =
451
508
  <MapPropertyField disabled={disabled} getData={getData} allowDataInference={allowDataInference}
452
- collectionEditable={collectionEditable}
453
- propertyConfigs={propertyConfigs}/>;
509
+ collectionEditable={collectionEditable}
510
+ propertyConfigs={propertyConfigs} />;
454
511
  } else if (selectedFieldConfigId === "block") {
455
512
  childComponent =
456
513
  <BlockPropertyField disabled={disabled} getData={getData} allowDataInference={allowDataInference}
457
- collectionEditable={collectionEditable}
458
- propertyConfigs={propertyConfigs}/>;
514
+ collectionEditable={collectionEditable}
515
+ propertyConfigs={propertyConfigs} />;
459
516
  } else if (selectedFieldConfigId === "reference") {
460
517
  childComponent =
461
518
  <ReferencePropertyField showErrors={showErrors}
462
- existing={existing}
463
- multiple={false}
464
- disabled={disabled}/>;
519
+ existing={existing}
520
+ multiple={false}
521
+ disabled={disabled} />;
465
522
  } else if (selectedFieldConfigId === "reference_as_string") {
466
523
  childComponent =
467
524
  <ReferencePropertyField showErrors={showErrors}
468
- existing={existing}
469
- asString={true}
470
- multiple={false}
471
- disabled={disabled}/>;
525
+ existing={existing}
526
+ asString={true}
527
+ multiple={false}
528
+ disabled={disabled} />;
472
529
  } else if (selectedFieldConfigId === "date_time") {
473
- childComponent = <DateTimePropertyField disabled={disabled}/>;
530
+ childComponent = <DateTimePropertyField disabled={disabled} />;
474
531
  } else if (selectedFieldConfigId === "multi_references") {
475
532
  childComponent =
476
533
  <ReferencePropertyField showErrors={showErrors}
477
- existing={existing}
478
- multiple={true}
479
- disabled={disabled}/>;
534
+ existing={existing}
535
+ multiple={true}
536
+ disabled={disabled} />;
480
537
  } else if (selectedFieldConfigId === "repeat") {
481
538
  childComponent =
482
539
  <RepeatPropertyField showErrors={showErrors}
483
- existing={existing}
484
- getData={getData}
485
- allowDataInference={allowDataInference}
486
- disabled={disabled}
487
- collectionEditable={collectionEditable}
488
- propertyConfigs={propertyConfigs}/>;
540
+ existing={existing}
541
+ getData={getData}
542
+ allowDataInference={allowDataInference}
543
+ disabled={disabled}
544
+ collectionEditable={collectionEditable}
545
+ propertyConfigs={propertyConfigs} />;
489
546
  } else if (selectedFieldConfigId === "key_value") {
490
547
  childComponent =
491
- <KeyValuePropertyField disabled={disabled}/>;
548
+ <KeyValuePropertyField disabled={disabled} />;
492
549
  } else {
493
550
  childComponent = null;
494
551
  }
@@ -520,54 +577,61 @@ function PropertyEditFormFields({
520
577
  showError={Boolean(selectedWidgetError)}
521
578
  existing={existing}
522
579
  propertyConfigs={propertyConfigs}
523
- inArray={inArray}/>
580
+ inArray={inArray} />
524
581
 
525
582
  {selectedWidgetError &&
526
583
  <Typography variant="caption"
527
- className={"ml-3.5"}
528
- color={"error"}>Required</Typography>}
584
+ className={"ml-3.5"}
585
+ color={"error"}>Required</Typography>}
529
586
 
530
587
  {/*<Typography variant="caption" className={"ml-3.5"}>Define your own custom properties and*/}
531
588
  {/* components</Typography>*/}
532
589
 
533
590
  </div>
534
591
 
535
- {onDelete && values?.id &&
592
+ {onDelete && existing && values?.id &&
536
593
  <IconButton
537
594
  variant={"ghost"}
538
595
  className="m-4"
539
596
  disabled={disabled}
540
597
  onClick={() => setDeleteDialogOpen(true)}>
541
- <DeleteIcon/>
598
+ <DeleteIcon />
542
599
  </IconButton>}
543
600
  </div>
544
601
 
545
602
  <div className={"grid grid-cols-12 gap-y-12 mt-8 mb-8"}>
546
603
  {includeIdAndTitle &&
547
604
  <CommonPropertyFields showErrors={showErrors}
548
- disabledId={existing}
549
- isNewProperty={!existing}
550
- disabled={disabled}
551
- autoUpdateId={autoUpdateId}
552
- ref={nameFieldRef}/>}
605
+ disabledId={existing}
606
+ isNewProperty={!existing}
607
+ disabled={disabled}
608
+ autoUpdateId={autoUpdateId}
609
+ ref={nameFieldRef} />}
553
610
 
554
611
  {childComponent}
555
612
 
556
613
  <div className={"col-span-12"}>
557
- <AdvancedPropertyValidation disabled={disabled}/>
614
+ <AdvancedPropertyValidation disabled={disabled} />
615
+ </div>
616
+
617
+ <div className={"col-span-12"}>
618
+ <ConditionsPanel>
619
+ <ConditionsEditor disabled={disabled} collectionProperties={collectionProperties} />
620
+ <EnumConditionsEditor disabled={disabled} collectionProperties={collectionProperties} />
621
+ </ConditionsPanel>
558
622
  </div>
559
623
  </div>
560
624
 
561
625
  {onDelete &&
562
626
  <ConfirmationDialog open={deleteDialogOpen}
563
- onAccept={() => onDelete(values?.id, propertyNamespace)}
564
- onCancel={() => setDeleteDialogOpen(false)}
565
- title={<div>Delete this property?</div>}
566
- body={
567
- <div> This will <b>not delete any
568
- data</b>, only modify the
569
- collection.</div>
570
- }/>}
627
+ onAccept={() => onDelete(values?.id, propertyNamespace)}
628
+ onCancel={() => setDeleteDialogOpen(false)}
629
+ title={<div>Delete this property?</div>}
630
+ body={
631
+ <div> This will <b>not delete any
632
+ data</b>, only modify the
633
+ collection.</div>
634
+ } />}
571
635
 
572
636
  </>
573
637
  );
@@ -625,17 +689,17 @@ const WIDGET_TYPE_MAP: Record<PropertyConfigId, string> = {
625
689
  };
626
690
 
627
691
  function WidgetSelectView({
628
- initialProperty,
629
- value,
630
- onValueChange,
631
- open,
632
- onOpenChange,
633
- disabled,
634
- showError,
635
- existing,
636
- propertyConfigs,
637
- inArray
638
- }: {
692
+ initialProperty,
693
+ value,
694
+ onValueChange,
695
+ open,
696
+ onOpenChange,
697
+ disabled,
698
+ showError,
699
+ existing,
700
+ propertyConfigs,
701
+ inArray
702
+ }: {
639
703
  initialProperty?: PropertyWithId,
640
704
  value?: PropertyConfigId,
641
705
  onValueChange: (value: string) => void,
@@ -695,20 +759,20 @@ function WidgetSelectView({
695
759
  className={cls(
696
760
  "flex items-center")}>
697
761
  <div className={"mr-8"}>
698
- <PropertyConfigBadge propertyConfig={computedFieldConfig}/>
762
+ <PropertyConfigBadge propertyConfig={computedFieldConfig} />
699
763
  </div>
700
764
  <div className={"flex flex-col items-start text-base text-left"}>
701
765
  <div>{computedFieldConfig.name}</div>
702
766
  <Typography variant={"caption"}
703
- color={"secondary"}>
767
+ color={"secondary"}>
704
768
  {computedFieldConfig.description}
705
769
  </Typography>
706
770
  </div>
707
771
  </div>}
708
772
  </div>
709
773
  <Dialog open={open}
710
- onOpenChange={(open) => onOpenChange(open, Boolean(value))}
711
- maxWidth={"4xl"}>
774
+ onOpenChange={(open) => onOpenChange(open, Boolean(value))}
775
+ maxWidth={"4xl"}>
712
776
  <DialogTitle>
713
777
  Select a property widget
714
778
  </DialogTitle>
@@ -729,7 +793,7 @@ function WidgetSelectView({
729
793
  onOpenChange(false, true);
730
794
  }}
731
795
  propertyConfig={propertyConfig}
732
- existing={existing}/>;
796
+ existing={existing} />;
733
797
  }
734
798
  return null;
735
799
  })}
@@ -761,12 +825,12 @@ export interface PropertySelectItemProps {
761
825
  }
762
826
 
763
827
  export function WidgetSelectViewItem({
764
- onClick,
765
- initialProperty,
766
- // optionDisabled,
767
- propertyConfig,
768
- existing
769
- }: PropertySelectItemProps) {
828
+ onClick,
829
+ initialProperty,
830
+ // optionDisabled,
831
+ propertyConfig,
832
+ existing
833
+ }: PropertySelectItemProps) {
770
834
  const baseProperty = propertyConfig.property;
771
835
  const shouldWarnChangingDataType = existing && !isPropertyBuilder(baseProperty) && baseProperty.dataType !== initialProperty?.dataType;
772
836
 
@@ -778,13 +842,13 @@ export function WidgetSelectViewItem({
778
842
  "flex flex-row items-center text-base min-h-[48px]",
779
843
  )}>
780
844
  <div className={"mr-8"}>
781
- <PropertyConfigBadge propertyConfig={propertyConfig} disabled={shouldWarnChangingDataType}/>
845
+ <PropertyConfigBadge propertyConfig={propertyConfig} disabled={shouldWarnChangingDataType} />
782
846
  </div>
783
847
  <div>
784
848
  <div className={"flex flex-row gap-2 items-center"}>
785
849
  {shouldWarnChangingDataType && <Tooltip
786
850
  title={"This widget uses a different data type than the initially selected widget. This can cause errors with existing data."}>
787
- <WarningIcon size="smallest" className={"w-4"}/>
851
+ <WarningIcon size="smallest" className={"w-4"} />
788
852
  </Tooltip>}
789
853
  <Typography
790
854
  variant={"label"}
@@ -792,8 +856,8 @@ export function WidgetSelectViewItem({
792
856
  </div>
793
857
 
794
858
  <Typography variant={"caption"}
795
- color={"secondary"}
796
- className={"max-w-sm"}>
859
+ color={"secondary"}
860
+ className={"max-w-sm"}>
797
861
  {propertyConfig.description}
798
862
  </Typography>
799
863
 
@@ -42,7 +42,7 @@ export function PropertyFieldPreview({
42
42
  const disabled = !editableProperty(property);
43
43
 
44
44
  const borderColorClass = hasError
45
- ? "border-red-500 dark:border-red-500 border-opacity-100 dark:border-opacity-100 ring-0 dark:ring-0"
45
+ ? "border-red-500 dark:border-red-500 border-opacity-100 dark:border-opacity-100 border-red-500/100 dark:border-red-500/100 ring-0 dark:ring-0"
46
46
  : (selected ? "border-primary" : "border-transparent");
47
47
 
48
48
  return <ErrorBoundary>