@rebasepro/admin 0.6.0 → 0.7.0

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 (149) hide show
  1. package/README.md +7 -3
  2. package/dist/{CollectionEditorDialog-jA-PLh6N.js → CollectionEditorDialog-iGgS4rLX.js} +233 -152
  3. package/dist/CollectionEditorDialog-iGgS4rLX.js.map +1 -0
  4. package/dist/{PropertyEditView-DEUddmg_.js → PropertyEditView-C9yhLyja.js} +129 -15
  5. package/dist/PropertyEditView-C9yhLyja.js.map +1 -0
  6. package/dist/{CollectionsStudioView-UKouBPOm.js → RouterCollectionsStudioView-Dqx27GD8.js} +61 -39
  7. package/dist/RouterCollectionsStudioView-Dqx27GD8.js.map +1 -0
  8. package/dist/collection_editor/extensibility_types.d.ts +135 -0
  9. package/dist/collection_editor/index.d.ts +6 -0
  10. package/dist/collection_editor/serializable_types.d.ts +374 -0
  11. package/dist/collection_editor/serializable_utils.d.ts +50 -0
  12. package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.d.ts +2 -1
  13. package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.d.ts +12 -1
  14. package/dist/collection_editor/ui/collection_editor/CollectionStudioView.d.ts +13 -1
  15. package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.d.ts +24 -2
  16. package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.d.ts +2 -1
  17. package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.d.ts +4 -1
  18. package/dist/collection_editor/ui/collection_editor/PropertyEditView.d.ts +12 -1
  19. package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.d.ts +15 -0
  20. package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.d.ts +14 -0
  21. package/dist/collection_editor/useJsonCollectionsConfigController.d.ts +37 -0
  22. package/dist/collection_editor/useSafeSnackbarController.d.ts +2 -0
  23. package/dist/collection_editor_ui.d.ts +4 -0
  24. package/dist/collection_editor_ui.js +33 -4
  25. package/dist/collection_editor_ui.js.map +1 -0
  26. package/dist/components/EntityCollectionView/EntityBoardCard.d.ts +3 -3
  27. package/dist/components/EntityCollectionView/hooks/useKanbanDragAndDrop.d.ts +3 -3
  28. package/dist/components/EntityEditView.d.ts +3 -2
  29. package/dist/components/RebaseCMS.d.ts +1 -1
  30. package/dist/editor/editor.d.ts +10 -4
  31. package/dist/editor.js +6 -4
  32. package/dist/editor.js.map +1 -1
  33. package/dist/form/EntityForm.d.ts +10 -9
  34. package/dist/form/EntityFormBinding.d.ts +27 -0
  35. package/dist/form/field_bindings/MarkdownEditorFieldBinding.d.ts +2 -2
  36. package/dist/form/form_utils.d.ts +8 -0
  37. package/dist/form/index.d.ts +5 -1
  38. package/dist/{history-BL49TIDb.js → history-ChHgyyvM.js} +2 -2
  39. package/dist/{history-BL49TIDb.js.map → history-ChHgyyvM.js.map} +1 -1
  40. package/dist/hooks/navigation/contexts/CollectionRegistryContext.d.ts +1 -1
  41. package/dist/hooks/navigation/useAsyncResolver.d.ts +26 -0
  42. package/dist/hooks/navigation/useBuildCollectionRegistryController.d.ts +2 -0
  43. package/dist/hooks/navigation/useTopLevelNavigation.d.ts +1 -1
  44. package/dist/hooks/navigation/utils.d.ts +1 -1
  45. package/dist/index.d.ts +3 -1
  46. package/dist/index.js +2 -2
  47. package/dist/routes/CustomViewRoute.d.ts +2 -1
  48. package/dist/{src-BJ8fkM8y.js → src-DOX2nOyh.js} +1634 -1330
  49. package/dist/src-DOX2nOyh.js.map +1 -0
  50. package/dist/types/components/EntityFormActionsProps.d.ts +1 -1
  51. package/dist/types/components/EntityFormProps.d.ts +59 -0
  52. package/dist/types/fields.d.ts +6 -1
  53. package/dist/util/dataControllerAdapter.d.ts +30 -0
  54. package/dist/util/navigation_utils.d.ts +1 -1
  55. package/dist/util/propertyConfigMapper.d.ts +17 -0
  56. package/package.json +18 -18
  57. package/src/collection_editor/extensibility_types.ts +168 -0
  58. package/src/collection_editor/index.ts +46 -0
  59. package/src/collection_editor/serializable_types.ts +487 -0
  60. package/src/collection_editor/serializable_utils.ts +588 -0
  61. package/src/collection_editor/ui/AddKanbanColumnAction.tsx +2 -0
  62. package/src/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.tsx +4 -4
  63. package/src/collection_editor/ui/collection_editor/CollectionEditorDialog.tsx +134 -70
  64. package/src/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.tsx +95 -78
  65. package/src/collection_editor/ui/collection_editor/CollectionStudioView.tsx +23 -20
  66. package/src/collection_editor/ui/collection_editor/CollectionsStudioView.tsx +79 -27
  67. package/src/collection_editor/ui/collection_editor/DisplaySettingsForm.tsx +9 -7
  68. package/src/collection_editor/ui/collection_editor/GeneralSettingsForm.tsx +22 -5
  69. package/src/collection_editor/ui/collection_editor/GetCodeDialog.tsx +3 -3
  70. package/src/collection_editor/ui/collection_editor/PropertyEditView.tsx +155 -10
  71. package/src/collection_editor/ui/collection_editor/PropertyFieldPreview.tsx +6 -6
  72. package/src/collection_editor/ui/collection_editor/PropertyTree.tsx +1 -0
  73. package/src/collection_editor/ui/collection_editor/RouterCollectionStudioView.tsx +44 -0
  74. package/src/collection_editor/ui/collection_editor/RouterCollectionsStudioView.tsx +41 -0
  75. package/src/collection_editor/ui/collection_editor/properties/EnumPropertyField.tsx +4 -3
  76. package/src/collection_editor/useJsonCollectionsConfigController.tsx +286 -0
  77. package/src/collection_editor/useSafeSnackbarController.ts +9 -0
  78. package/src/collection_editor_ui.ts +6 -0
  79. package/src/components/ArrayContainer.tsx +5 -5
  80. package/src/components/DefaultDrawer.tsx +13 -3
  81. package/src/components/DrawerNavigationGroup.tsx +2 -2
  82. package/src/components/DrawerNavigationItem.tsx +4 -4
  83. package/src/components/EntityCollectionView/EntityBoardCard.tsx +6 -6
  84. package/src/components/EntityCollectionView/EntityCollectionBoardView.tsx +14 -11
  85. package/src/components/EntityCollectionView/EntityCollectionCardView.tsx +40 -190
  86. package/src/components/EntityCollectionView/EntityCollectionListView.tsx +54 -183
  87. package/src/components/EntityCollectionView/hooks/useKanbanDragAndDrop.ts +6 -6
  88. package/src/components/EntityEditView.tsx +5 -4
  89. package/src/components/EntityEditViewFormActions.tsx +32 -26
  90. package/src/components/HomePage/ContentHomePage.tsx +13 -4
  91. package/src/components/HomePage/NavigationCard.tsx +8 -14
  92. package/src/components/HomePage/NavigationGroup.tsx +1 -1
  93. package/src/components/HomePage/SmallNavigationCard.tsx +1 -5
  94. package/src/components/RebaseCMS.tsx +3 -2
  95. package/src/components/RebaseNavigation.tsx +71 -7
  96. package/src/components/SelectableTable/SelectableTable.tsx +2 -2
  97. package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +28 -21
  98. package/src/components/SideDialogs.tsx +0 -7
  99. package/src/components/common/default_entity_actions.tsx +18 -10
  100. package/src/contexts/BreacrumbsContext.tsx +15 -6
  101. package/src/editor/editor.tsx +14 -8
  102. package/src/editor/selectors/ai-selector.tsx +0 -1
  103. package/src/form/EntityForm.tsx +191 -428
  104. package/src/form/EntityFormActions.tsx +33 -47
  105. package/src/form/EntityFormBinding.tsx +323 -0
  106. package/src/form/components/FormLayout.tsx +1 -1
  107. package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +4 -4
  108. package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +7 -2
  109. package/src/form/field_bindings/StorageUploadFieldBinding.tsx +1 -1
  110. package/src/form/form_utils.ts +163 -0
  111. package/src/form/index.tsx +14 -5
  112. package/src/hooks/navigation/contexts/CollectionRegistryContext.tsx +2 -2
  113. package/src/hooks/navigation/contexts/NavigationStateContext.tsx +2 -2
  114. package/src/hooks/navigation/contexts/UrlContext.tsx +1 -2
  115. package/src/hooks/navigation/useAsyncResolver.ts +100 -0
  116. package/src/hooks/navigation/useBuildCollectionRegistryController.tsx +15 -8
  117. package/src/hooks/navigation/useBuildNavigationStateController.tsx +12 -8
  118. package/src/hooks/navigation/useNavigationResolution.ts +33 -0
  119. package/src/hooks/navigation/useResolvedCollections.ts +29 -71
  120. package/src/hooks/navigation/useResolvedViews.tsx +40 -70
  121. package/src/hooks/navigation/useTopLevelNavigation.ts +20 -16
  122. package/src/hooks/navigation/utils.ts +7 -4
  123. package/src/index.ts +7 -2
  124. package/src/routes/CustomViewRoute.tsx +14 -6
  125. package/src/types/components/EntityFormActionsProps.tsx +1 -1
  126. package/src/types/components/EntityFormProps.tsx +68 -0
  127. package/src/types/fields.tsx +7 -1
  128. package/src/util/dataControllerAdapter.ts +93 -0
  129. package/src/util/navigation_utils.ts +1 -1
  130. package/src/util/propertyConfigMapper.ts +134 -0
  131. package/LICENSE +0 -21
  132. package/dist/CollectionEditorDialog-jA-PLh6N.js.map +0 -1
  133. package/dist/CollectionsStudioView-UKouBPOm.js.map +0 -1
  134. package/dist/PropertyEditView-DEUddmg_.js.map +0 -1
  135. package/dist/components/EntityCollectionView/Board.d.ts +0 -3
  136. package/dist/components/EntityCollectionView/BoardColumn.d.ts +0 -42
  137. package/dist/components/EntityCollectionView/BoardColumnTitle.d.ts +0 -9
  138. package/dist/components/EntityCollectionView/BoardSortableList.d.ts +0 -14
  139. package/dist/components/EntityCollectionView/board_types.d.ts +0 -105
  140. package/dist/hooks/navigation/useNavigationRegistry.d.ts +0 -12
  141. package/dist/hooks/navigation/useNavigationURLs.d.ts +0 -11
  142. package/dist/src-BJ8fkM8y.js.map +0 -1
  143. package/src/components/EntityCollectionView/Board.tsx +0 -475
  144. package/src/components/EntityCollectionView/BoardColumn.tsx +0 -165
  145. package/src/components/EntityCollectionView/BoardColumnTitle.tsx +0 -46
  146. package/src/components/EntityCollectionView/BoardSortableList.tsx +0 -177
  147. package/src/components/EntityCollectionView/board_types.ts +0 -113
  148. package/src/hooks/navigation/useNavigationRegistry.ts +0 -164
  149. package/src/hooks/navigation/useNavigationURLs.ts +0 -56
@@ -4,6 +4,7 @@ import { useNavigationStateController, useCollectionRegistryController, useUrlCo
4
4
  import * as React from "react";
5
5
  import { useEffect, useRef, useState } from "react";
6
6
  import { ConfirmationDialog, ErrorView, useAuthController, useCustomizationController, useSnackbarController } from "@rebasepro/core";
7
+ import { useSafeSnackbarController } from "../../useSafeSnackbarController";
7
8
  import { CircularProgressCenter } from "@rebasepro/ui";
8
9
  import {
9
10
  ArrowLeftIcon,
@@ -46,8 +47,9 @@ import { CollectionRLSTab } from "./CollectionRLSTab";
46
47
  import { buildCollectionFromTableMetadata } from "../../pgColumnToProperty";
47
48
  import { TableMetadata } from "@rebasepro/types";
48
49
  import { mergeDeep, randomString, removeUndefined } from "@rebasepro/utils";
50
+ import type { CollectionEditorExtensionProps, CollectionEditorTab } from "../../extensibility_types";
49
51
 
50
- export interface CollectionEditorDialogProps {
52
+ export interface CollectionEditorDialogProps extends CollectionEditorExtensionProps {
51
53
  open: boolean;
52
54
  isNewCollection: boolean;
53
55
  initialValues?: {
@@ -139,6 +141,7 @@ export function CollectionEditorDialog(props: CollectionEditorDialogProps) {
139
141
  fullHeight={true}
140
142
  scrollable={false}
141
143
  maxWidth={"7xl"}
144
+ className="bg-surface-50 dark:bg-surface-800"
142
145
  onOpenChange={(open) => !open ? handleCancel() : undefined}
143
146
  >
144
147
  <DialogTitle hidden>Collection editor</DialogTitle>
@@ -168,17 +171,23 @@ export function CollectionEditor(props: CollectionEditorDialogProps & {
168
171
  handleCancel: () => void,
169
172
  setFormDirty: (dirty: boolean) => void
170
173
  }) {
171
- const { propertyConfigs } = useCustomizationController();
174
+ const { standalone } = props;
175
+
176
+ const customizationController = useCustomizationController();
172
177
  const navigationState = useNavigationStateController();
173
178
  const collectionRegistry = useCollectionRegistryController();
174
179
  const authController = useAuthController();
175
180
 
176
- const {
177
- topLevelNavigation
178
- } = navigationState;
179
- const {
180
- collections
181
- } = collectionRegistry;
181
+ // In standalone mode, use safe defaults instead of context values
182
+ const propertyConfigs = standalone
183
+ ? (customizationController?.propertyConfigs ?? {})
184
+ : customizationController.propertyConfigs;
185
+ const topLevelNavigation = standalone
186
+ ? (navigationState?.topLevelNavigation ?? [])
187
+ : navigationState.topLevelNavigation;
188
+ const collections = standalone
189
+ ? (collectionRegistry?.collections ?? [])
190
+ : collectionRegistry.collections;
182
191
 
183
192
  const initialValuesProp = props.initialValues;
184
193
  const copyFromProp = props.copyFrom;
@@ -192,7 +201,13 @@ export function CollectionEditor(props: CollectionEditorDialogProps & {
192
201
 
193
202
  useEffect(() => {
194
203
  try {
195
- if (collectionRegistry.initialised) {
204
+ const initialised = (standalone
205
+ ? true
206
+ : (collectionRegistry?.initialised ?? true)) && !props.configController?.loading;
207
+ const getRawCollection = standalone
208
+ ? (() => undefined)
209
+ : collectionRegistry.getRawCollection;
210
+ if (initialised) {
196
211
  if (props.editedCollectionId) {
197
212
  // We must use getRawCollection so the editor schema fields
198
213
  // aren't polluted with dynamically injected runtime `relations`.
@@ -200,7 +215,9 @@ export function CollectionEditor(props: CollectionEditorDialogProps & {
200
215
  const collectionPath = [...(props.parentCollectionSlugs ?? []), props.editedCollectionId]
201
216
  .reduce((acc, segment, i) => i === 0 ? segment : `${acc}/fake_id/${segment}`, "");
202
217
 
203
- setCollection(collectionRegistry.getRawCollection(collectionPath) as EntityCollection<any>);
218
+ const registryCol = getRawCollection ? getRawCollection(collectionPath) : undefined;
219
+ const configCol = props.configController?.collections?.find(c => c.slug === props.editedCollectionId);
220
+ setCollection((registryCol ?? configCol) as EntityCollection<any>);
204
221
  } else {
205
222
  setCollection(undefined);
206
223
  }
@@ -209,44 +226,51 @@ export function CollectionEditor(props: CollectionEditorDialogProps & {
209
226
  } catch (e) {
210
227
  console.error(e);
211
228
  }
212
- }, [props.editedCollectionId, props.parentCollectionSlugs, props.parentEntityIds, collectionRegistry.initialised, collectionRegistry.getRawCollection]);
229
+ }, [props.editedCollectionId, props.parentCollectionSlugs, props.parentEntityIds, standalone, collectionRegistry.initialised, collectionRegistry.getRawCollection, props.configController.collections, props.configController.loading, collections]);
213
230
 
214
231
 
215
- const initialCollection = collection
216
- ? {
217
- ...collection,
218
- slug: collection.slug ?? randomString(16)
219
- }
220
- : undefined;
232
+ const initialIcon = React.useMemo(() => coolIconKeys[Math.floor(Math.random() * coolIconKeys.length)], []);
233
+ const fallbackSlug = React.useMemo(() => randomString(16), []);
234
+
235
+ const initialCollection = React.useMemo(() => {
236
+ return collection
237
+ ? {
238
+ ...collection,
239
+ slug: collection.slug ?? fallbackSlug
240
+ }
241
+ : undefined;
242
+ }, [collection, fallbackSlug]);
221
243
 
222
244
  // Build initial values - handle copyFrom for duplication
223
- const initialValues: EntityCollection<any> = initialCollection
224
- ? applyPropertyConfigs(initialCollection, propertyConfigs)
225
- : copyFromProp
226
- ? (() => {
227
- // When duplicating, copy all properties but clear identifiers
228
- const { subcollections: _sub, ...rest } = copyFromProp as unknown as Record<string, unknown>;
229
- return {
230
- ...rest,
231
- name: "",
245
+ const initialValues: EntityCollection<any> = React.useMemo(() => {
246
+ return initialCollection
247
+ ? applyPropertyConfigs(initialCollection, propertyConfigs)
248
+ : copyFromProp
249
+ ? (() => {
250
+ // When duplicating, copy all properties but clear identifiers
251
+ const { subcollections: _sub, ...rest } = copyFromProp as unknown as Record<string, unknown>;
252
+ return {
253
+ ...rest,
254
+ name: "",
255
+ ownerId: authController.user?.uid ?? ""
256
+ } as EntityCollection<any>;
257
+ })()
258
+ : {
259
+ slug: initialValuesProp?.slug ?? fallbackSlug,
260
+ table: initialValuesProp?.slug ?? "",
261
+ name: initialValuesProp?.name ?? "",
262
+ properties: {} as Properties,
263
+ propertiesOrder: [],
264
+ icon: initialIcon,
232
265
  ownerId: authController.user?.uid ?? ""
233
- } as EntityCollection<any>;
234
- })()
235
- : {
236
- slug: initialValuesProp?.slug ?? randomString(16),
237
- table: initialValuesProp?.slug ?? "",
238
- name: initialValuesProp?.name ?? "",
239
- properties: {} as Properties,
240
- propertiesOrder: [],
241
- icon: coolIconKeys[Math.floor(Math.random() * coolIconKeys.length)],
242
- ownerId: authController.user?.uid ?? ""
243
- };
266
+ };
267
+ }, [initialCollection, propertyConfigs, copyFromProp, initialValuesProp, fallbackSlug, initialIcon, authController.user?.uid]);
244
268
 
245
269
  if (!initialLoadingCompleted) {
246
270
  return <CircularProgressCenter/>;
247
271
  }
248
272
 
249
- if (!props.isNewCollection && (!collectionRegistry.initialised || !initialLoadingCompleted)) {
273
+ if (!props.isNewCollection && (!(standalone ? true : (collectionRegistry?.initialised ?? true)) || !initialLoadingCompleted)) {
250
274
  return <CircularProgressCenter/>;
251
275
  }
252
276
 
@@ -290,7 +314,13 @@ function CollectionEditorInternal<M extends Record<string, unknown>>({
290
314
  onAnalyticsEvent,
291
315
  fullScreen,
292
316
  unmappedTables,
293
- onFetchTableMetadata
317
+ onFetchTableMetadata,
318
+ propertyTypePresets,
319
+ hiddenPropertyTypes,
320
+ renderExtraPropertyFields,
321
+ renderExtraCollectionFields,
322
+ visibleTabs,
323
+ standalone
294
324
  }: CollectionEditorDialogProps & {
295
325
  handleCancel: () => void,
296
326
  setFormDirty: (dirty: boolean) => void,
@@ -304,10 +334,33 @@ function CollectionEditorInternal<M extends Record<string, unknown>>({
304
334
  }
305
335
  ) {
306
336
 
307
- const importConfig = useImportConfig();
308
- const urlController = useUrlController();
309
- const collectionRegistry = useCollectionRegistryController();
310
- const snackbarController = useSnackbarController();
337
+ const importConfigRaw = useImportConfig();
338
+ const urlControllerRaw = useUrlController();
339
+ const collectionRegistryRaw = useCollectionRegistryController();
340
+ const snackbarControllerRaw = useSafeSnackbarController();
341
+
342
+ // In standalone mode, use safe defaults
343
+ const importConfig = standalone ? undefined : importConfigRaw;
344
+ const urlController = standalone
345
+ ? {
346
+ basePath: "/",
347
+ baseCollectionPath: "/c",
348
+ urlPathToDataPath: () => "",
349
+ homeUrl: "/",
350
+ isUrlCollectionPath: () => false,
351
+ buildUrlCollectionPath: () => "",
352
+ buildAppUrlPath: () => "",
353
+ resolveDatabasePathsFrom: (p: string) => p,
354
+ navigate: () => { }
355
+ }
356
+ : urlControllerRaw;
357
+ const collectionRegistryInternal = standalone
358
+ ? { convertIdsToPaths: (ids: string[]) => ids }
359
+ : collectionRegistryRaw;
360
+ const snackbarController = snackbarControllerRaw ?? {
361
+ open: () => { },
362
+ close: () => { }
363
+ };
311
364
 
312
365
  // Use this ref to store which properties have errors
313
366
  const propertyErrorsRef = useRef<Record<string, any>>({});
@@ -317,6 +370,12 @@ function CollectionEditorInternal<M extends Record<string, unknown>>({
317
370
  : (initialViewProp ?? "properties");
318
371
  const [currentView, setCurrentView] = useState<EditorView>(initialView); // this view can edit either the details view or the properties one
319
372
 
373
+ useEffect(() => {
374
+ if (visibleTabs && !visibleTabs.includes(currentView as CollectionEditorTab)) {
375
+ setCurrentView(visibleTabs[0] || "general");
376
+ }
377
+ }, [visibleTabs, currentView]);
378
+
320
379
  const [error, setError] = React.useState<Error | undefined>();
321
380
 
322
381
  const saveCollection = (updatedCollection: EntityCollection<M>): Promise<boolean> => {
@@ -345,7 +404,7 @@ function CollectionEditorInternal<M extends Record<string, unknown>>({
345
404
 
346
405
  const setNextMode = () => {
347
406
  if (currentView === "general") {
348
- if (importConfig.inUse) {
407
+ if (importConfig?.inUse) {
349
408
  setCurrentView("import_data_saving");
350
409
  } else if (extraView) {
351
410
  setCurrentView("extra_view");
@@ -439,7 +498,7 @@ function CollectionEditorInternal<M extends Record<string, unknown>>({
439
498
  setNextMode();
440
499
  formexController.resetForm({ values: newCollectionState });
441
500
  } else if (currentView === "general") {
442
- if (extraView || importConfig.inUse) {
501
+ if (extraView || importConfig?.inUse) {
443
502
  formexController.resetForm({ values: newCollectionState });
444
503
  setNextMode();
445
504
  } else if (isNewCollection) {
@@ -537,7 +596,7 @@ function CollectionEditorInternal<M extends Record<string, unknown>>({
537
596
  const usedPath = getTableName(values);
538
597
  const pathError = validatePath(usedPath, isNewCollection, existingPaths, values.slug);
539
598
 
540
- const parentPaths = !pathError && parentCollectionSlugs ? collectionRegistry.convertIdsToPaths(parentCollectionSlugs) : undefined;
599
+ const parentPaths = !pathError && parentCollectionSlugs ? collectionRegistryInternal.convertIdsToPaths(parentCollectionSlugs) : undefined;
541
600
 
542
601
  const updatedFullPath = parentPaths && parentPaths.length > 0
543
602
  ? [...parentPaths, usedPath].join("/fake_id/")
@@ -558,18 +617,18 @@ function CollectionEditorInternal<M extends Record<string, unknown>>({
558
617
  }, [dirty]);
559
618
 
560
619
  function onImportDataSet(data: object[], propertiesOrder?: string[]) {
561
- importConfig.setInUse(true);
620
+ importConfig?.setInUse(true);
562
621
  buildEntityPropertiesFromData(data, getInferenceType)
563
- .then((properties: any) => {
622
+ .then((properties: unknown) => {
564
623
  const res = cleanPropertiesFromImport(properties as Properties);
565
624
 
566
- importConfig.setIdColumn(res.idColumn);
567
- importConfig.setImportData(data);
568
- importConfig.setHeadersMapping(res.headersMapping);
625
+ importConfig?.setIdColumn(res.idColumn);
626
+ importConfig?.setImportData(data);
627
+ importConfig?.setHeadersMapping(res.headersMapping);
569
628
  const filteredHeadingsOrder = ((propertiesOrder ?? [])
570
629
  .filter((key) => res.headersMapping[key]) as string[]) ?? Object.keys(res.properties);
571
- importConfig.setHeadingsOrder(filteredHeadingsOrder);
572
- importConfig.setOriginProperties(res.properties);
630
+ importConfig?.setHeadingsOrder(filteredHeadingsOrder);
631
+ importConfig?.setOriginProperties(res.properties);
573
632
 
574
633
  const mappedHeadings = (propertiesOrder ?? []).map((key) => res.headersMapping[key]).filter(Boolean) as string[] ?? Object.keys(res.properties);
575
634
  setFieldValue("properties", res.properties);
@@ -581,7 +640,7 @@ function CollectionEditorInternal<M extends Record<string, unknown>>({
581
640
 
582
641
  const onImportMappingComplete = () => {
583
642
  const updatedProperties = { ...values.properties };
584
- if (importConfig.idColumn)
643
+ if (importConfig?.idColumn)
585
644
  delete updatedProperties[importConfig.idColumn];
586
645
  setFieldValue("properties", updatedProperties);
587
646
  // setFieldValue("propertiesOrder", Object.values(importConfig.headersMapping));
@@ -620,25 +679,25 @@ function CollectionEditorInternal<M extends Record<string, unknown>>({
620
679
  }
621
680
  };
622
681
 
623
- return <div className="h-full w-full flex flex-col bg-white dark:bg-surface-950">
682
+ return <div className="h-full w-full flex flex-col bg-surface-50 dark:bg-surface-800">
624
683
  <Formex value={formController}>
625
684
 
626
685
  <>
627
- {!isNewCollection && <div className={cls("px-4 py-2 w-full flex shrink-0 items-center justify-between gap-4 bg-surface-50 dark:bg-surface-950 border-b", defaultBorderMixin)}>
686
+ {!isNewCollection && <div className={cls("px-4 py-2 w-full flex shrink-0 items-center justify-between gap-4 bg-surface-50 dark:bg-surface-900 border-b", defaultBorderMixin)}>
628
687
  <div className="flex flex-1 items-center justify-end gap-4 min-w-0">
629
688
  <Tabs value={currentView}
630
689
  className="bg-transparent !w-fit max-w-full"
631
690
  onValueChange={(v) => setCurrentView(v as EditorView)}>
632
- <Tab value={"general"}>
691
+ {(!visibleTabs || visibleTabs.includes("general")) && <Tab value={"general"}>
633
692
  General
634
- </Tab>
635
- <Tab value={"display"}>
693
+ </Tab>}
694
+ {(!visibleTabs || visibleTabs.includes("display")) && <Tab value={"display"}>
636
695
  Display
637
- </Tab>
638
- <Tab value={"properties"}>
696
+ </Tab>}
697
+ {(!visibleTabs || visibleTabs.includes("properties")) && <Tab value={"properties"}>
639
698
  Properties
640
- </Tab>
641
- {getDataSourceCapabilities(values.driver).supportsRLS && <Tab value={"rls"}>
699
+ </Tab>}
700
+ {(!visibleTabs || visibleTabs.includes("rls")) && getDataSourceCapabilities(values.driver).supportsRLS && <Tab value={"rls"}>
642
701
  RLS
643
702
  </Tab>}
644
703
  </Tabs>
@@ -673,7 +732,7 @@ function CollectionEditorInternal<M extends Record<string, unknown>>({
673
732
  onSubmit={formController.handleSubmit}
674
733
  className="flex-grow flex flex-col min-h-0 relative">
675
734
 
676
- <div className="flex-grow flex flex-col min-h-0 overflow-y-auto no-scrollbar relative w-full h-full">
735
+ <div className="flex-grow flex flex-col min-h-0 no-scrollbar relative w-full h-full bg-surface-50 dark:bg-surface-800">
677
736
 
678
737
  {currentView === "loading" &&
679
738
  <CircularProgressCenter/>}
@@ -736,14 +795,16 @@ function CollectionEditorInternal<M extends Record<string, unknown>>({
736
795
 
737
796
  {currentView === "general" &&
738
797
  <GeneralSettingsForm
798
+ isNewCollection={isNewCollection}
739
799
  existingPaths={existingPaths}
740
800
  existingIds={existingIds}
741
801
  parentCollection={parentCollection}
742
- isNewCollection={isNewCollection}/>
802
+ renderExtraCollectionFields={renderExtraCollectionFields}
803
+ standalone={standalone}/>
743
804
  }
744
805
 
745
806
  {currentView === "display" &&
746
- <DisplaySettingsForm expandKanban={expandKanban}/>
807
+ <DisplaySettingsForm expandKanban={expandKanban} standalone={standalone}/>
747
808
  }
748
809
 
749
810
  {currentView === "rls" && getDataSourceCapabilities(values.driver).supportsRLS &&
@@ -766,25 +827,28 @@ function CollectionEditorInternal<M extends Record<string, unknown>>({
766
827
  getData={getDataWithPath}
767
828
  doCollectionInference={doCollectionInference}
768
829
  propertyConfigs={propertyConfigs}
769
-
830
+ propertyTypePresets={propertyTypePresets}
831
+ hiddenPropertyTypes={hiddenPropertyTypes}
832
+ renderExtraPropertyFields={renderExtraPropertyFields}
770
833
  extraIcon={extraView?.icon &&
771
834
  <IconButton
772
835
  color={"primary"}
773
836
  onClick={() => setCurrentView("extra_view")}>
774
837
  {extraView.icon}
775
- </IconButton>}/>
838
+ </IconButton>}
839
+ standalone={standalone}/>
776
840
  }
777
841
 
778
842
  </div>
779
843
  {(!fullScreen || isNewCollection || !!error) && (
780
- <div className="shrink-0 w-full p-4 sm:px-6 sm:py-4 border-t border-surface-200 dark:border-surface-900 flex items-center justify-between gap-4 bg-white dark:bg-surface-950">
844
+ <div className="shrink-0 w-full p-4 sm:px-6 sm:py-4 border-t border-surface-200 dark:border-surface-900 flex items-center justify-between gap-4 bg-surface-50 dark:bg-surface-900">
781
845
  {error && <ErrorView error={error}/>}
782
846
 
783
847
  {isNewCollection && includeTemplates && currentView === "import_data_mapping" &&
784
848
  <Button variant={"text"}
785
849
  type="button"
786
850
  onClick={() => {
787
- importConfig.setInUse(false);
851
+ importConfig?.setInUse(false);
788
852
  return setCurrentView("welcome");
789
853
  }}>
790
854
  Back