@rebasepro/admin 0.2.1 → 0.2.4

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 (214) hide show
  1. package/dist/{CollectionEditorDialog-BXIh2AXg.js → CollectionEditorDialog-D0VqpLPO.js} +73 -256
  2. package/dist/CollectionEditorDialog-D0VqpLPO.js.map +1 -0
  3. package/dist/{CollectionsStudioView-jR8iz_ja.js → CollectionsStudioView-Bc3Rxxc2.js} +5 -4
  4. package/dist/{CollectionsStudioView-jR8iz_ja.js.map → CollectionsStudioView-Bc3Rxxc2.js.map} +1 -1
  5. package/dist/{ExportCollectionAction-CMdiiv1L.js → ExportCollectionAction-Ckc-09BQ.js} +4 -3
  6. package/dist/ExportCollectionAction-Ckc-09BQ.js.map +1 -0
  7. package/dist/{ImportCollectionAction-C05lE0IW.js → ImportCollectionAction-BqjIrC3Z.js} +3 -2
  8. package/dist/{ImportCollectionAction-C05lE0IW.js.map → ImportCollectionAction-BqjIrC3Z.js.map} +1 -1
  9. package/dist/{PropertyEditView-BB5xjnhZ.js → PropertyEditView-CvRSV-A2.js} +430 -445
  10. package/dist/PropertyEditView-CvRSV-A2.js.map +1 -0
  11. package/dist/collection_editor/ConfigControllerProvider.d.ts +0 -5
  12. package/dist/collection_editor/index.d.ts +0 -1
  13. package/dist/collection_editor/types/collection_editor_controller.d.ts +0 -2
  14. package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +3 -3
  15. package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.d.ts +1 -7
  16. package/dist/collection_editor_ui.js +3 -3
  17. package/dist/components/ArrayContainer.d.ts +2 -2
  18. package/dist/components/DefaultAppBar.d.ts +18 -1
  19. package/dist/components/DefaultDrawer.d.ts +51 -3
  20. package/dist/components/EntityCollectionTable/fields/TableStorageUpload.d.ts +2 -2
  21. package/dist/components/EntityCollectionTable/internal/EntityTableCell.d.ts +2 -2
  22. package/dist/components/EntityCollectionTable/table_bindings.d.ts +4 -3
  23. package/dist/components/EntityCollectionView/hooks/useKanbanDragAndDrop.d.ts +4 -3
  24. package/dist/components/EntityEditView.d.ts +2 -1
  25. package/dist/components/HomePage/HomePageDnD.d.ts +3 -3
  26. package/dist/components/PropertyCollectionView.d.ts +1 -1
  27. package/dist/components/PropertyIdCopyTooltip.d.ts +1 -1
  28. package/dist/components/SelectableTable/SelectionStore.d.ts +4 -1
  29. package/dist/components/SelectableTable/filters/BooleanFilterField.d.ts +2 -2
  30. package/dist/components/SelectableTable/filters/DateTimeFilterField.d.ts +2 -2
  31. package/dist/components/SelectableTable/filters/ReferenceFilterField.d.ts +2 -2
  32. package/dist/components/SelectableTable/filters/StringNumberFilterField.d.ts +2 -2
  33. package/dist/components/admin/RolesView.d.ts +3 -3
  34. package/dist/components/admin/UsersView.d.ts +3 -3
  35. package/dist/components/app/Drawer.d.ts +8 -1
  36. package/dist/data_export/export/export.d.ts +3 -3
  37. package/dist/editor/components/editor-bubble.d.ts +5 -1
  38. package/dist/editor/components/image-bubble.d.ts +5 -1
  39. package/dist/editor/components/index.d.ts +3 -3
  40. package/dist/editor/components/table-bubble.d.ts +5 -1
  41. package/dist/editor/nodeViews/ReactNodeView.d.ts +4 -1
  42. package/dist/editor/useProseMirror.d.ts +2 -2
  43. package/dist/editor/utils/remove_classes.d.ts +1 -1
  44. package/dist/editor.js +15 -14
  45. package/dist/editor.js.map +1 -1
  46. package/dist/form/EntityForm.d.ts +2 -2
  47. package/dist/form/components/StorageUploadProgress.d.ts +2 -2
  48. package/dist/form/field_bindings/MultiSelectFieldBinding.d.ts +1 -1
  49. package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +1 -1
  50. package/dist/form/validation.d.ts +3 -3
  51. package/dist/hooks/navigation/useResolvedCollections.d.ts +6 -0
  52. package/dist/hooks/navigation/useResolvedViews.d.ts +3 -4
  53. package/dist/{index-BAM9KCmM.js → index-BCcLwgfe.js} +3 -2
  54. package/dist/{index-BAM9KCmM.js.map → index-BCcLwgfe.js.map} +1 -1
  55. package/dist/{index-D5OQhv-T.js → index-DY2k5TtG.js} +3 -3
  56. package/dist/index-DY2k5TtG.js.map +1 -0
  57. package/dist/{index-CoSNm3e3.js → index-UQOMHwt1.js} +3 -3
  58. package/dist/index-UQOMHwt1.js.map +1 -0
  59. package/dist/index.d.ts +1 -1
  60. package/dist/index.js +2813 -372
  61. package/dist/index.js.map +1 -1
  62. package/dist/{markdown-z2Ir7Cgo.js → markdown-DD2JDU1X.js} +2 -2
  63. package/dist/markdown-DD2JDU1X.js.map +1 -0
  64. package/dist/preview/components/UrlComponentPreview.d.ts +1 -0
  65. package/dist/types/components/EntityFormActionsProps.d.ts +1 -1
  66. package/dist/types/components/EntityFormProps.d.ts +2 -2
  67. package/dist/types/fields.d.ts +1 -1
  68. package/dist/{util-DtbWD7LF.js → util-ZM9gQuCv.js} +2104 -2071
  69. package/dist/util-ZM9gQuCv.js.map +1 -0
  70. package/package.json +10 -9
  71. package/src/collection_editor/ConfigControllerProvider.tsx +3 -13
  72. package/src/collection_editor/index.ts +1 -3
  73. package/src/collection_editor/types/collection_editor_controller.tsx +0 -3
  74. package/src/collection_editor/ui/EditorCollectionAction.tsx +1 -6
  75. package/src/collection_editor/ui/EditorCollectionActionStart.tsx +1 -6
  76. package/src/collection_editor/ui/EditorEntityAction.tsx +1 -6
  77. package/src/collection_editor/ui/HomePageEditorCollectionAction.tsx +7 -14
  78. package/src/collection_editor/ui/NewCollectionCard.tsx +1 -5
  79. package/src/collection_editor/ui/PropertyAddColumnComponent.tsx +3 -8
  80. package/src/collection_editor/ui/collection_editor/CollectionEditorDialog.tsx +1 -10
  81. package/src/collection_editor/ui/collection_editor/CollectionJsonImportDialog.tsx +8 -12
  82. package/src/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.tsx +21 -21
  83. package/src/collection_editor/ui/collection_editor/CollectionRLSTab.tsx +4 -4
  84. package/src/collection_editor/ui/collection_editor/EnumForm.tsx +1 -1
  85. package/src/collection_editor/ui/collection_editor/properties/BlockPropertyField.tsx +3 -3
  86. package/src/collection_editor/ui/collection_editor/properties/CommonPropertyFields.tsx +3 -3
  87. package/src/collection_editor/ui/collection_editor/properties/DateTimePropertyField.tsx +8 -8
  88. package/src/collection_editor/ui/collection_editor/properties/EnumPropertyField.tsx +5 -5
  89. package/src/collection_editor/ui/collection_editor/properties/MapPropertyField.tsx +2 -2
  90. package/src/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.tsx +5 -5
  91. package/src/collection_editor/ui/collection_editor/properties/NumberPropertyField.tsx +5 -5
  92. package/src/collection_editor/ui/collection_editor/properties/ReferencePropertyField.tsx +2 -2
  93. package/src/collection_editor/ui/collection_editor/properties/RelationPropertyField.tsx +37 -57
  94. package/src/collection_editor/ui/collection_editor/properties/RepeatPropertyField.tsx +2 -2
  95. package/src/collection_editor/ui/collection_editor/properties/StoragePropertyField.tsx +8 -8
  96. package/src/collection_editor/ui/collection_editor/properties/StringPropertyField.tsx +5 -5
  97. package/src/collection_editor/ui/collection_editor/properties/UrlPropertyField.tsx +3 -2
  98. package/src/collection_editor/ui/collection_editor/properties/VectorPropertyField.tsx +2 -2
  99. package/src/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.tsx +2 -2
  100. package/src/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.tsx +1 -1
  101. package/src/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.tsx +4 -7
  102. package/src/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.tsx +4 -4
  103. package/src/collection_editor/validateCollectionJson.ts +88 -1
  104. package/src/components/ArrayContainer.tsx +3 -3
  105. package/src/components/DefaultAppBar.tsx +52 -31
  106. package/src/components/DefaultDrawer.tsx +279 -66
  107. package/src/components/DrawerNavigationItem.tsx +1 -1
  108. package/src/components/EntityCollectionTable/EntityCollectionTable.tsx +6 -5
  109. package/src/components/EntityCollectionTable/PropertyTableCell.tsx +9 -7
  110. package/src/components/EntityCollectionTable/fields/TableStorageUpload.tsx +5 -5
  111. package/src/components/EntityCollectionTable/fields/VirtualTableNumberInput.tsx +12 -9
  112. package/src/components/EntityCollectionTable/internal/EntityTableCell.tsx +2 -2
  113. package/src/components/EntityCollectionTable/internal/popup_field/PopupFormField.tsx +1 -1
  114. package/src/components/EntityCollectionTable/table_bindings.tsx +5 -4
  115. package/src/components/EntityCollectionView/EntityCollectionView.tsx +6 -4
  116. package/src/components/EntityCollectionView/hooks/useCollectionInlineEditor.ts +1 -1
  117. package/src/components/EntityCollectionView/hooks/useKanbanDragAndDrop.ts +7 -6
  118. package/src/components/EntityDetailView.tsx +46 -24
  119. package/src/components/EntityEditView.tsx +51 -28
  120. package/src/components/EntityEditViewFormActions.tsx +4 -4
  121. package/src/components/EntityPreview.tsx +9 -4
  122. package/src/components/HomePage/HomePageDnD.tsx +3 -2
  123. package/src/components/PropertyCollectionView.tsx +1 -1
  124. package/src/components/PropertyIdCopyTooltip.tsx +1 -1
  125. package/src/components/RebaseLayout.tsx +5 -1
  126. package/src/components/RebaseNavigation.tsx +2 -2
  127. package/src/components/RebaseRouteDefs.tsx +4 -7
  128. package/src/components/RebaseShell.tsx +16 -13
  129. package/src/components/SearchIconsView.tsx +1 -8
  130. package/src/components/SelectableTable/SelectableTable.tsx +8 -11
  131. package/src/components/SelectableTable/SelectionStore.ts +1 -1
  132. package/src/components/SelectableTable/filters/BooleanFilterField.tsx +3 -3
  133. package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +3 -3
  134. package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +5 -5
  135. package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +3 -3
  136. package/src/components/SideEntityProvider.tsx +2 -1
  137. package/src/components/admin/RolesView.tsx +7 -2
  138. package/src/components/admin/UsersView.tsx +12 -6
  139. package/src/components/app/Drawer.tsx +9 -1
  140. package/src/components/app/Scaffold.tsx +5 -1
  141. package/src/data_export/export/export.ts +17 -17
  142. package/src/data_import/components/DataNewPropertiesMapping.tsx +1 -1
  143. package/src/editor/components/editor-bubble.tsx +32 -9
  144. package/src/editor/components/image-bubble.tsx +27 -11
  145. package/src/editor/components/index.ts +3 -3
  146. package/src/editor/components/table-bubble.tsx +79 -17
  147. package/src/editor/extensions/HighlightDecorationExtension.ts +3 -2
  148. package/src/editor/nodeViews/ReactNodeView.tsx +1 -1
  149. package/src/editor/nodeViews/TaskItemComponent.tsx +9 -8
  150. package/src/editor/schema.ts +135 -59
  151. package/src/editor/selectors/link-selector.tsx +8 -5
  152. package/src/editor/useProseMirror.ts +2 -2
  153. package/src/editor/utils/remove_classes.ts +6 -5
  154. package/src/form/EntityForm.tsx +15 -15
  155. package/src/form/EntityFormActions.tsx +2 -2
  156. package/src/form/PropertyFieldBinding.tsx +64 -64
  157. package/src/form/components/FieldHelperText.tsx +4 -4
  158. package/src/form/components/StorageUploadProgress.tsx +2 -2
  159. package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +1 -1
  160. package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +1 -1
  161. package/src/form/field_bindings/BlockFieldBinding.tsx +54 -53
  162. package/src/form/field_bindings/KeyValueFieldBinding.tsx +290 -289
  163. package/src/form/field_bindings/MapFieldBinding.tsx +2 -2
  164. package/src/form/field_bindings/MultiSelectFieldBinding.tsx +2 -2
  165. package/src/form/field_bindings/MultipleRelationFieldBinding.tsx +1 -1
  166. package/src/form/field_bindings/ReferenceAsStringFieldBinding.tsx +1 -1
  167. package/src/form/field_bindings/ReferenceFieldBinding.tsx +8 -6
  168. package/src/form/field_bindings/RelationFieldBinding.tsx +4 -4
  169. package/src/form/field_bindings/RepeatFieldBinding.tsx +1 -1
  170. package/src/form/field_bindings/SelectFieldBinding.tsx +1 -1
  171. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +84 -84
  172. package/src/form/field_bindings/SwitchFieldBinding.tsx +16 -16
  173. package/src/form/field_bindings/TextFieldBinding.tsx +77 -73
  174. package/src/form/field_bindings/UserSelectFieldBinding.tsx +17 -17
  175. package/src/form/validation.ts +43 -43
  176. package/src/hooks/navigation/useBuildNavigationStateController.tsx +3 -5
  177. package/src/hooks/navigation/useResolvedCollections.ts +27 -7
  178. package/src/hooks/navigation/useResolvedViews.tsx +24 -44
  179. package/src/index.ts +2 -0
  180. package/src/preview/PropertyPreview.tsx +2 -2
  181. package/src/preview/components/ImagePreview.tsx +2 -1
  182. package/src/preview/components/UrlComponentPreview.tsx +11 -2
  183. package/src/preview/components/UserPreview.tsx +1 -1
  184. package/src/preview/property_previews/ArrayOfMapsPreview.tsx +2 -2
  185. package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +4 -4
  186. package/src/preview/property_previews/ArrayOfRelationsPreview.tsx +3 -3
  187. package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +3 -3
  188. package/src/preview/property_previews/ArrayOfStringsPreview.tsx +3 -2
  189. package/src/preview/property_previews/ArrayOneOfPreview.tsx +6 -8
  190. package/src/preview/property_previews/ArrayPropertyEnumPreview.tsx +1 -1
  191. package/src/preview/property_previews/ArrayPropertyPreview.tsx +3 -3
  192. package/src/preview/property_previews/MapPropertyPreview.tsx +4 -3
  193. package/src/preview/property_previews/NumberPropertyPreview.tsx +5 -3
  194. package/src/preview/property_previews/StringPropertyPreview.tsx +10 -8
  195. package/src/types/components/EntityFormActionsProps.tsx +1 -1
  196. package/src/types/components/EntityFormProps.tsx +2 -2
  197. package/src/types/fields.tsx +2 -2
  198. package/dist/CollectionEditorDialog-BXIh2AXg.js.map +0 -1
  199. package/dist/ContentHomePage-BQZWuOFb.js +0 -1784
  200. package/dist/ContentHomePage-BQZWuOFb.js.map +0 -1
  201. package/dist/ExportCollectionAction-CMdiiv1L.js.map +0 -1
  202. package/dist/PropertyEditView-BB5xjnhZ.js.map +0 -1
  203. package/dist/RoleChip-QtUFXeTp.js +0 -67
  204. package/dist/RoleChip-QtUFXeTp.js.map +0 -1
  205. package/dist/RolesView-CULIHWZ9.js +0 -437
  206. package/dist/RolesView-CULIHWZ9.js.map +0 -1
  207. package/dist/UsersView-D7_AtJ44.js +0 -408
  208. package/dist/UsersView-D7_AtJ44.js.map +0 -1
  209. package/dist/collection_editor/types/config_permissions.d.ts +0 -19
  210. package/dist/index-CoSNm3e3.js.map +0 -1
  211. package/dist/index-D5OQhv-T.js.map +0 -1
  212. package/dist/markdown-z2Ir7Cgo.js.map +0 -1
  213. package/dist/util-DtbWD7LF.js.map +0 -1
  214. package/src/collection_editor/types/config_permissions.ts +0 -20
@@ -65,7 +65,7 @@ export function MapFieldBinding({
65
65
  .filter(([_, property]) => !isHidden(property))
66
66
  .map(([entryKey, childProperty], index) => {
67
67
  const thisDisabled = isReadOnly(childProperty) || Boolean(childProperty.ui?.disabled);
68
- const fieldBindingProps: PropertyFieldBindingProps<any> = {
68
+ const fieldBindingProps: PropertyFieldBindingProps<Record<string, unknown>> = {
69
69
  propertyKey: `${propertyKey}.${entryKey}`,
70
70
  disabled: disabled || thisDisabled,
71
71
  property: childProperty,
@@ -133,7 +133,7 @@ export function MapFieldBinding({
133
133
  );
134
134
  }
135
135
 
136
- const buildPickKeysSelect = (disabled: boolean, properties: Properties, setValue: (value: any) => void, value: any) => {
136
+ const buildPickKeysSelect = (disabled: boolean, properties: Properties, setValue: (value: Record<string, unknown> | null) => void, value: Record<string, unknown> | undefined) => {
137
137
 
138
138
  const keys = Object.keys(properties)
139
139
  .filter((key) => !value || !(key in value));
@@ -28,7 +28,7 @@ export function MultiSelectFieldBinding({
28
28
  includeDescription,
29
29
  size = "large",
30
30
  autoFocus
31
- }: FieldProps<ArrayProperty, any, any>) {
31
+ }: FieldProps<ArrayProperty, unknown, Record<string, unknown>>) {
32
32
 
33
33
  const of = property.of;
34
34
  if (!of) {
@@ -74,7 +74,7 @@ export function MultiSelectFieldBinding({
74
74
  onClick={(e) => {
75
75
  e.preventDefault();
76
76
  e.stopPropagation();
77
- setValue((value ?? []).filter((v: any) => v !== enumKey));
77
+ setValue((value ?? []).filter((v: string | number) => v !== enumKey));
78
78
  }}
79
79
  >
80
80
  <XIcon size={iconSize.smallest}/>
@@ -55,7 +55,7 @@ export function MultipleRelationFieldBinding({
55
55
  const selectedEntityIds = value && Array.isArray(value) ? value.map((ref) => ref.id) : [];
56
56
  const collection = relation.target();
57
57
 
58
- const onMultipleEntitiesSelected = useCallback((entities: Entity<any>[]) => {
58
+ const onMultipleEntitiesSelected = useCallback((entities: Entity<Record<string, unknown>>[]) => {
59
59
  setValue(entities.map(e => getRelationFrom(e)));
60
60
  }, [setValue]);
61
61
 
@@ -71,7 +71,7 @@ path });
71
71
  throw Error(`Couldn't find the corresponding collection for the path: ${path}`);
72
72
  }
73
73
 
74
- const onSingleEntitySelected = useCallback((e: Entity<any> | null) => {
74
+ const onSingleEntitySelected = useCallback((e: Entity<Record<string, unknown>> | null) => {
75
75
  setValue(e ? String(e.id) : null);
76
76
  }, [setValue]);
77
77
 
@@ -53,13 +53,15 @@ function ReferenceFieldBindingInternal({
53
53
  throw new Error("Property path is required for ReferenceFieldBinding");
54
54
  }
55
55
 
56
+ const refValue = value as EntityReference | null | undefined;
57
+
56
58
  useClearRestoreValue({
57
59
  property,
58
60
  value,
59
61
  setValue
60
62
  });
61
63
 
62
- const validValue = value && value.isEntityReference && value.isEntityReference();
64
+ const validValue = refValue && typeof refValue === "object" && "isEntityReference" in refValue && refValue.isEntityReference();
63
65
 
64
66
  const collectionRegistryController = useCollectionRegistryController();
65
67
  const collection: EntityCollection | undefined = useMemo(() => {
@@ -70,7 +72,7 @@ function ReferenceFieldBindingInternal({
70
72
  throw Error(`Couldn't find the corresponding collection for the path: ${property.path}`);
71
73
  }
72
74
 
73
- const onSingleEntitySelected = useCallback((e: Entity<any> | null) => {
75
+ const onSingleEntitySelected = useCallback((e: Entity<Record<string, unknown>> | null) => {
74
76
  const ref = e ? getReferenceFrom(e) : null;
75
77
  setValue(ref);
76
78
  }, [setValue, propertyKey]);
@@ -80,7 +82,7 @@ function ReferenceFieldBindingInternal({
80
82
  path: property.path,
81
83
  collection,
82
84
  onSingleEntitySelected,
83
- selectedEntityIds: validValue ? [value.id] : undefined,
85
+ selectedEntityIds: validValue && refValue ? [refValue.id] : undefined,
84
86
  fixedFilter: property.fixedFilter
85
87
  }
86
88
  );
@@ -104,18 +106,18 @@ function ReferenceFieldBindingInternal({
104
106
 
105
107
  {collection && <>
106
108
 
107
- {value && <ReferencePreview
109
+ {refValue && <ReferencePreview
108
110
  disabled={!property.path}
109
111
  previewProperties={property.ui?.previewProperties}
110
112
  hover={!disabled}
111
113
  size={size}
112
114
  onClick={disabled || isSubmitting ? undefined : onEntryClick}
113
- reference={value}
115
+ reference={refValue}
114
116
  includeEntityLink={property.includeEntityLink}
115
117
  includeId={property.includeId}
116
118
  />}
117
119
 
118
- {!value && <div className="justify-center text-left">
120
+ {!refValue && <div className="justify-center text-left">
119
121
  <EntityPreviewContainer className={cls("px-6 h-16 text-sm font-medium flex items-center gap-6",
120
122
  disabled || isSubmitting
121
123
  ? "text-surface-accent-500"
@@ -2,7 +2,7 @@ import { useEntitySelectionDialog } from "../../hooks/useEntitySelectionDialog";
2
2
  import type { FieldProps } from "../../types/fields";
3
3
  import type { RelationProperty } from "@rebasepro/types";
4
4
  import React, { useCallback } from "react";
5
- import { Entity, getDataSourceCapabilities } from "@rebasepro/types";
5
+ import { Entity, EntityRelation, getDataSourceCapabilities, Relation } from "@rebasepro/types";
6
6
  import { FieldHelperText, LabelWithIconAndTooltip } from "../components";
7
7
  import { EntityPreviewContainer } from "../../components/EntityPreview";
8
8
  import { IconForView } from "@rebasepro/core";
@@ -56,7 +56,7 @@ function RelationSelectorBinding({
56
56
  setValue,
57
57
  relation,
58
58
  manyRelation
59
- }: FieldProps<RelationProperty> & { relation: any; manyRelation: boolean }) {
59
+ }: FieldProps<RelationProperty> & { relation: Relation; manyRelation: boolean }) {
60
60
  const normalizedSingle = (!manyRelation && value && !Array.isArray(value)) ? normalizeToEntityRelation(value) : null;
61
61
  const singleValue = normalizedSingle ?? null;
62
62
  const multipleValue = (manyRelation && Array.isArray(value)) ? value : [];
@@ -108,7 +108,7 @@ function SingleRelationFieldBinding({
108
108
  includeDescription,
109
109
  setValue,
110
110
  relation
111
- }: FieldProps<RelationProperty> & { relation: any }) {
111
+ }: FieldProps<RelationProperty> & { relation: Relation | undefined }) {
112
112
  const normalizedValue = value && !Array.isArray(value) ? normalizeToEntityRelation(value) : null;
113
113
  const validValue = !!normalizedValue;
114
114
 
@@ -118,7 +118,7 @@ function SingleRelationFieldBinding({
118
118
  throw Error(`Couldn't find the corresponding collection for the relation: ${propertyKey}`);
119
119
  }
120
120
 
121
- const onSingleEntitySelected = useCallback((e: Entity<any> | null) => {
121
+ const onSingleEntitySelected = useCallback((e: Entity<Record<string, unknown>> | null) => {
122
122
  setValue(e ? getRelationFrom(e) : null);
123
123
  }, [setValue]);
124
124
 
@@ -95,7 +95,7 @@ export function RepeatFieldBinding({
95
95
  const sortable = property.sortable === undefined ? true : property.sortable;
96
96
  const arrayContainer = <ArrayContainer droppableId={propertyKey}
97
97
  addLabel={property.name ? t("add_to_field", { fieldName: property.name }) : t("add_entry")}
98
- value={value ?? []}
98
+ value={(value as unknown[]) ?? []}
99
99
  buildEntry={buildEntry}
100
100
  onInternalIdAdded={setLastAddedId}
101
101
  disabled={isSubmitting || Boolean(property.ui?.disabled)}
@@ -79,7 +79,7 @@ export function SelectFieldBinding({
79
79
  : null;
80
80
  return setValue(newValue);
81
81
  }}
82
- renderValue={(enumKey: any) => {
82
+ renderValue={(enumKey: string) => {
83
83
  return <EnumValuesChip
84
84
  enumKey={enumKey}
85
85
  enumValues={enumValues}
@@ -47,18 +47,18 @@ const acceptDropClasses = "transition-colors duration-200 ease-[cubic-bezier(0,0
47
47
  const rejectDropClasses = "transition-colors duration-200 ease-[cubic-bezier(0,0,0.2,1)] border-2 border-solid border-red-500"
48
48
 
49
49
  export function StorageUploadFieldBinding({
50
- propertyKey,
51
- value,
52
- setValue,
53
- error,
54
- showError,
55
- autoFocus,
56
- minimalistView,
57
- property,
58
- includeDescription,
59
- context,
60
- isSubmitting
61
- }: FieldProps<StringProperty | ArrayProperty>) {
50
+ propertyKey,
51
+ value,
52
+ setValue,
53
+ error,
54
+ showError,
55
+ autoFocus,
56
+ minimalistView,
57
+ property,
58
+ includeDescription,
59
+ context,
60
+ isSubmitting
61
+ }: FieldProps<StringProperty | ArrayProperty>) {
62
62
 
63
63
  const authController = useAuthController();
64
64
 
@@ -79,7 +79,7 @@ export function StorageUploadFieldBinding({
79
79
  path: context.path,
80
80
  property,
81
81
  propertyKey,
82
- value,
82
+ value: value as string | string[] | null,
83
83
  storageSource,
84
84
  disabled: disabled ?? false,
85
85
  onChange: setValue
@@ -87,7 +87,7 @@ export function StorageUploadFieldBinding({
87
87
 
88
88
  useClearRestoreValue<string | string[]>({
89
89
  property,
90
- value,
90
+ value: value as string | string[] | null,
91
91
  setValue
92
92
  });
93
93
 
@@ -118,10 +118,10 @@ export function StorageUploadFieldBinding({
118
118
  multipleFilesSupported={multipleFilesSupported}/>
119
119
 
120
120
  <FieldHelperText includeDescription={includeDescription}
121
- showError={showError}
122
- error={error}
123
- disabled={disabled}
124
- property={property}/>
121
+ showError={showError}
122
+ error={error}
123
+ disabled={disabled}
124
+ property={property}/>
125
125
 
126
126
  </>
127
127
  );
@@ -134,22 +134,22 @@ interface SortableStorageItemProps {
134
134
  name: string;
135
135
  metadata?: Record<string, unknown>;
136
136
  storagePathBuilder: (file: File) => string;
137
- onFileUploadComplete: (uploadedPath: string, entry: StorageFieldItem, fileMetadata?: any) => Promise<void>;
137
+ onFileUploadComplete: (uploadedPath: string, entry: StorageFieldItem, fileMetadata?: Record<string, unknown>) => Promise<void>;
138
138
  onClear: (clearedStoragePathOrDownloadUrl: string) => void;
139
139
  disabled: boolean;
140
140
  isSortable: boolean; // Kept for consistency, though dnd-kit handles sortability via context
141
141
  }
142
142
 
143
143
  function SortableStorageItem({
144
- id,
145
- entry,
146
- property,
147
- metadata,
148
- storagePathBuilder,
149
- onFileUploadComplete,
150
- onClear,
151
- disabled
152
- }: SortableStorageItemProps) {
144
+ id,
145
+ entry,
146
+ property,
147
+ metadata,
148
+ storagePathBuilder,
149
+ onFileUploadComplete,
150
+ onClear,
151
+ disabled
152
+ }: SortableStorageItemProps) {
153
153
 
154
154
  const {
155
155
  attributes,
@@ -218,21 +218,21 @@ function SortableStorageItem({
218
218
  }
219
219
 
220
220
  function FileDropComponent({
221
- storage,
222
- disabled,
223
- onFilesAdded,
224
- multipleFilesSupported,
225
- autoFocus,
226
- internalValue,
227
- property,
228
- onClear,
229
- metadata,
230
- storagePathBuilder,
231
- onFileUploadComplete,
232
- name,
233
- helpText,
234
- isDndItemDragging
235
- }: {
221
+ storage,
222
+ disabled,
223
+ onFilesAdded,
224
+ multipleFilesSupported,
225
+ autoFocus,
226
+ internalValue,
227
+ property,
228
+ onClear,
229
+ metadata,
230
+ storagePathBuilder,
231
+ onFileUploadComplete,
232
+ name,
233
+ helpText,
234
+ isDndItemDragging
235
+ }: {
236
236
  storage: StorageConfig,
237
237
  disabled: boolean,
238
238
  onFilesAdded: (acceptedFiles: File[]) => Promise<void>,
@@ -241,9 +241,9 @@ function FileDropComponent({
241
241
  internalValue: StorageFieldItem[],
242
242
  property: StringProperty,
243
243
  onClear: (clearedStoragePathOrDownloadUrl: string) => void,
244
- metadata?: any,
244
+ metadata?: Record<string, unknown>,
245
245
  storagePathBuilder: (file: File) => string,
246
- onFileUploadComplete: (uploadedPath: string, entry: StorageFieldItem, fileMetadata?: any) => Promise<void>,
246
+ onFileUploadComplete: (uploadedPath: string, entry: StorageFieldItem, fileMetadata?: Record<string, unknown>) => Promise<void>,
247
247
  name: string,
248
248
  helpText: string,
249
249
  isDndItemDragging?: boolean
@@ -258,33 +258,33 @@ function FileDropComponent({
258
258
  isDragAccept,
259
259
  isDragReject
260
260
  } = useDropzone({
261
- accept: storage.acceptedFiles ? storage.acceptedFiles.reduce((acc, ext) => ({
262
- ...acc,
263
- [ext]: []
264
- }), {}) : undefined,
265
- disabled: disabled || isDndItemDragging,
266
- noDragEventsBubbling: true,
267
- maxSize: storage.maxSize,
268
- onDrop: onFilesAdded,
269
- onDropRejected: (fileRejections) => {
270
- for (const fileRejection of fileRejections) {
271
- for (const error of fileRejection.errors) {
272
- console.error("Error uploading file: ", error);
273
- if (error.code === "file-too-large") {
274
- snackbarContext.open({
275
- type: "error",
276
- message: `Error uploading file: File is larger than ${storage.maxSize} bytes`
277
- });
278
- } else if (error.code === "file-invalid-type") {
279
- snackbarContext.open({
280
- type: "error",
281
- message: "Error uploading file: File type is not supported"
282
- });
261
+ accept: storage.acceptedFiles ? storage.acceptedFiles.reduce((acc, ext) => ({
262
+ ...acc,
263
+ [ext]: []
264
+ }), {}) : undefined,
265
+ disabled: disabled || isDndItemDragging,
266
+ noDragEventsBubbling: true,
267
+ maxSize: storage.maxSize,
268
+ onDrop: onFilesAdded,
269
+ onDropRejected: (fileRejections) => {
270
+ for (const fileRejection of fileRejections) {
271
+ for (const error of fileRejection.errors) {
272
+ console.error("Error uploading file: ", error);
273
+ if (error.code === "file-too-large") {
274
+ snackbarContext.open({
275
+ type: "error",
276
+ message: `Error uploading file: File is larger than ${storage.maxSize} bytes`
277
+ });
278
+ } else if (error.code === "file-invalid-type") {
279
+ snackbarContext.open({
280
+ type: "error",
281
+ message: "Error uploading file: File type is not supported"
282
+ });
283
+ }
283
284
  }
284
285
  }
285
286
  }
286
287
  }
287
- }
288
288
  );
289
289
 
290
290
  return (
@@ -336,8 +336,8 @@ function FileDropComponent({
336
336
  <div
337
337
  className="flex-grow min-h-[38px] box-border m-2 text-center">
338
338
  <Typography align={"center"}
339
- variant={"label"}
340
- className={disabled ? "text-surface-accent-600 dark:text-surface-accent-500" : ""}>
339
+ variant={"label"}
340
+ className={disabled ? "text-surface-accent-600 dark:text-surface-accent-500" : ""}>
341
341
  {helpText}
342
342
  </Typography>
343
343
  </div>
@@ -357,23 +357,23 @@ export interface StorageUploadProps {
357
357
  storage: StorageConfig;
358
358
  onFilesAdded: (acceptedFiles: File[]) => Promise<void>; // Updated from useStorageUploadController
359
359
  storagePathBuilder: (file: File) => string;
360
- onFileUploadComplete: (uploadedPath: string, entry: StorageFieldItem, fileMetadata?: any) => Promise<void>;
360
+ onFileUploadComplete: (uploadedPath: string, entry: StorageFieldItem, fileMetadata?: Record<string, unknown>) => Promise<void>;
361
361
  }
362
362
 
363
363
  export function StorageUpload({
364
- property,
365
- name,
366
- value, // This is internalValue from useStorageUploadController
367
- setInternalValue,
368
- onChange,
369
- multipleFilesSupported,
370
- onFileUploadComplete,
371
- disabled,
372
- onFilesAdded,
373
- autoFocus,
374
- storage,
375
- storagePathBuilder
376
- }: StorageUploadProps) {
364
+ property,
365
+ name,
366
+ value, // This is internalValue from useStorageUploadController
367
+ setInternalValue,
368
+ onChange,
369
+ multipleFilesSupported,
370
+ onFileUploadComplete,
371
+ disabled,
372
+ onFilesAdded,
373
+ autoFocus,
374
+ storage,
375
+ storagePathBuilder
376
+ }: StorageUploadProps) {
377
377
 
378
378
  if (multipleFilesSupported) {
379
379
  const arrayProperty = property as ArrayProperty;
@@ -17,17 +17,17 @@ import { PropertyIdCopyTooltip } from "../../components/PropertyIdCopyTooltip";
17
17
  * @group Form fields
18
18
  */
19
19
  export const SwitchFieldBinding = function SwitchFieldBinding({
20
- propertyKey,
21
- value,
22
- setValue,
23
- error,
24
- showError,
25
- autoFocus,
26
- disabled,
27
- size = "large",
28
- property,
29
- includeDescription
30
- }: FieldProps<BooleanProperty>) {
20
+ propertyKey,
21
+ value,
22
+ setValue,
23
+ error,
24
+ showError,
25
+ autoFocus,
26
+ disabled,
27
+ size = "large",
28
+ property,
29
+ includeDescription
30
+ }: FieldProps<BooleanProperty>) {
31
31
 
32
32
  useClearRestoreValue({
33
33
  property,
@@ -40,7 +40,7 @@ export const SwitchFieldBinding = function SwitchFieldBinding({
40
40
 
41
41
  <PropertyIdCopyTooltip propertyKey={propertyKey}>
42
42
  <BooleanSwitchWithLabel
43
- value={value}
43
+ value={value as boolean | null}
44
44
  onValueChange={(v) => setValue(v)}
45
45
  error={showError}
46
46
  className={property.ui?.widthPercentage !== undefined ? "mt-8" : undefined}
@@ -55,10 +55,10 @@ export const SwitchFieldBinding = function SwitchFieldBinding({
55
55
  </PropertyIdCopyTooltip>
56
56
 
57
57
  <FieldHelperText includeDescription={includeDescription}
58
- showError={showError}
59
- error={error}
60
- disabled={disabled}
61
- property={property}/>
58
+ showError={showError}
59
+ error={error}
60
+ disabled={disabled}
61
+ property={property}/>
62
62
  </>
63
63
 
64
64
  );
@@ -26,17 +26,17 @@ import { getIconForProperty } from "../../util/property_utils";
26
26
  * @group Form fields
27
27
  */
28
28
  export function TextFieldBinding<T extends string | number>({
29
- propertyKey,
30
- value,
31
- setValue,
32
- error,
33
- showError,
34
- disabled,
35
- autoFocus,
36
- property,
37
- includeDescription,
38
- size = "large"
39
- }: FieldProps<StringProperty | NumberProperty>) {
29
+ propertyKey,
30
+ value,
31
+ setValue,
32
+ error,
33
+ showError,
34
+ disabled,
35
+ autoFocus,
36
+ property,
37
+ includeDescription,
38
+ size = "large"
39
+ }: FieldProps<StringProperty | NumberProperty>) {
40
40
 
41
41
  let multiline: boolean | undefined;
42
42
  let url: boolean | PreviewType | undefined;
@@ -51,6 +51,8 @@ export function TextFieldBinding<T extends string | number>({
51
51
  setValue
52
52
  });
53
53
 
54
+ const displayValue = (value !== undefined && value !== null) ? String(value) : "";
55
+
54
56
  const handleClearClick = useCallback((e: React.MouseEvent) => {
55
57
  e.stopPropagation();
56
58
  e.preventDefault();
@@ -89,76 +91,78 @@ export function TextFieldBinding<T extends string | number>({
89
91
  title={property.name ?? propertyKey}/>
90
92
  );
91
93
  return (<>
92
- <PropertyIdCopyTooltip propertyKey={propertyKey}>
93
- {isMultiline ? (
94
- <div className={cls(
95
- "rounded-md relative max-w-full min-h-[64px]",
96
- fieldBackgroundMixin,
97
- fieldBackgroundHoverMixin,
98
- showError && error ? "border border-red-500 dark:border-red-600" : "",
99
- property.ui?.widthPercentage !== undefined ? "mt-8" : undefined
100
- )}>
101
- <div className="pointer-events-none absolute top-1 text-xs font-medium px-3 text-text-secondary dark:text-text-secondary-dark">
102
- {label}
94
+ <PropertyIdCopyTooltip propertyKey={propertyKey}>
95
+ {isMultiline ? (
96
+ <div className={cls(
97
+ "rounded-md relative max-w-full min-h-[64px]",
98
+ fieldBackgroundMixin,
99
+ fieldBackgroundHoverMixin,
100
+ showError && error ? "border border-red-500 dark:border-red-600" : "",
101
+ property.ui?.widthPercentage !== undefined ? "mt-8" : undefined
102
+ )}>
103
+ <div
104
+ className="pointer-events-none absolute top-1 text-xs font-medium px-3 text-text-secondary dark:text-text-secondary-dark">
105
+ {label}
106
+ </div>
107
+ <TextareaAutosize
108
+ value={displayValue}
109
+ onChange={onChange}
110
+ autoFocus={autoFocus}
111
+ disabled={disabled}
112
+ className={cls(
113
+ "rounded-md resize-none w-full outline-none p-[32px] text-base bg-transparent min-h-[64px] px-3 pt-8",
114
+ disabled && "outline-none opacity-50 text-surface-accent-600 dark:text-surface-accent-500",
115
+ showError && error ? "text-red-500 dark:text-red-600" : ""
116
+ )}
117
+ />
118
+ {property.ui?.clearable && (
119
+ <div
120
+ className="flex flex-row justify-center items-center absolute h-full right-0 top-0 mr-4">
121
+ <IconButton onClick={handleClearClick}>
122
+ <XIcon/>
123
+ </IconButton>
124
+ </div>
125
+ )}
103
126
  </div>
104
- <TextareaAutosize
105
- value={value ?? ""}
127
+ ) : (
128
+ <TextField
129
+ size={size}
130
+ value={displayValue}
106
131
  onChange={onChange}
107
132
  autoFocus={autoFocus}
133
+ className={property.ui?.widthPercentage !== undefined ? "mt-8" : undefined}
134
+ label={<LabelWithIcon
135
+ icon={getIconForProperty(property, "small")}
136
+ required={property.validation?.required || property.isId === true}
137
+ title={property.name ?? propertyKey}/>}
138
+ type={inputType}
108
139
  disabled={disabled}
109
- className={cls(
110
- "rounded-md resize-none w-full outline-none p-[32px] text-base bg-transparent min-h-[64px] px-3 pt-8",
111
- disabled && "outline-none opacity-50 text-surface-accent-600 dark:text-surface-accent-500",
112
- showError && error ? "text-red-500 dark:text-red-600" : ""
113
- )}
114
- />
115
- {property.ui?.clearable && (
116
- <div className="flex flex-row justify-center items-center absolute h-full right-0 top-0 mr-4">
117
- <IconButton onClick={handleClearClick}>
140
+ endAdornment={
141
+ property.ui?.clearable && <IconButton
142
+ onClick={handleClearClick}>
118
143
  <XIcon/>
119
144
  </IconButton>
120
- </div>
121
- )}
122
- </div>
123
- ) : (
124
- <TextField
125
- size={size}
126
- value={value ?? ""}
127
- onChange={onChange}
128
- autoFocus={autoFocus}
129
- className={property.ui?.widthPercentage !== undefined ? "mt-8" : undefined}
130
- label={<LabelWithIcon
131
- icon={getIconForProperty(property, "small")}
132
- required={property.validation?.required || property.isId === true}
133
- title={property.name ?? propertyKey}/>}
134
- type={inputType}
135
- disabled={disabled}
136
- endAdornment={
137
- property.ui?.clearable && <IconButton
138
- onClick={handleClearClick}>
139
- <XIcon/>
140
- </IconButton>
141
- }
142
- error={showError ? !!error : undefined}
143
- inputClassName={error ? "text-red-500 dark:text-red-600" : ""}/>
144
- )}
145
- </PropertyIdCopyTooltip>
146
- <FieldHelperText includeDescription={includeDescription}
147
- showError={showError}
148
- error={error}
149
- disabled={disabled}
150
- property={property}/>
145
+ }
146
+ error={showError ? !!error : undefined}
147
+ inputClassName={error ? "text-red-500 dark:text-red-600" : ""}/>
148
+ )}
149
+ </PropertyIdCopyTooltip>
150
+ <FieldHelperText includeDescription={includeDescription}
151
+ showError={showError}
152
+ error={error}
153
+ disabled={disabled}
154
+ property={property}/>
151
155
 
152
- {url && <Collapse
153
- className="mt-1 ml-1"
154
- in={Boolean(value)}>
155
- <PropertyPreview
156
- value={value}
157
- property={property}
158
- size={size}/>
159
- </Collapse>}
156
+ {url && <Collapse
157
+ className="mt-1 ml-1"
158
+ in={Boolean(value)}>
159
+ <PropertyPreview
160
+ value={value}
161
+ property={property}
162
+ size={size}/>
163
+ </Collapse>}
160
164
 
161
- </>
165
+ </>
162
166
  );
163
167
 
164
168
  }