@rebasepro/cms 0.17.3 → 0.18.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.
- package/README.md +4 -0
- package/dist/{CollectionEditorDialog-B-akreOU.js → CollectionEditorDialog-BeX4b92r.js} +13 -7
- package/dist/{CollectionEditorDialog-B-akreOU.js.map → CollectionEditorDialog-BeX4b92r.js.map} +1 -1
- package/dist/{PropertyEditView-CiY84wkR.js → PropertyEditView-C7thfj4L.js} +3 -3
- package/dist/{PropertyEditView-CiY84wkR.js.map → PropertyEditView-C7thfj4L.js.map} +1 -1
- package/dist/{RouterCollectionsStudioView-DkAWda4N.js → RouterCollectionsStudioView-BtjzvB6E.js} +4 -4
- package/dist/{RouterCollectionsStudioView-DkAWda4N.js.map → RouterCollectionsStudioView-BtjzvB6E.js.map} +1 -1
- package/dist/{SchemaChangeDialog-DceT8QFX.js → SchemaChangeDialog-CkqK6KOC.js} +4 -2
- package/dist/{SchemaChangeDialog-DceT8QFX.js.map → SchemaChangeDialog-CkqK6KOC.js.map} +1 -1
- package/dist/collection_editor/api/generateCollectionApi.d.ts +1 -2
- package/dist/collection_editor_ui.d.ts +2 -0
- package/dist/collection_editor_ui.js +6 -5
- package/dist/collection_editor_ui.js.map +1 -1
- package/dist/components/DeleteEntityDialog.d.ts +2 -3
- package/dist/components/RebaseLayout.d.ts +11 -4
- package/dist/components/field_configs.d.ts +1 -1
- package/dist/editor/sanitize-html.d.ts +15 -0
- package/dist/editor.js +195 -10
- package/dist/editor.js.map +1 -1
- package/dist/{export-Ben8E355.js → export--arni_VY.js} +2 -2
- package/dist/{export-Ben8E355.js.map → export--arni_VY.js.map} +1 -1
- package/dist/form/components/LabelWithIcon.d.ts +10 -0
- package/dist/{history-DIEVd26f.js → history-C2TpoQwi.js} +2 -2
- package/dist/{history-DIEVd26f.js.map → history-C2TpoQwi.js.map} +1 -1
- package/dist/hooks/navigation/useBuildNavigationStateController.d.ts +1 -1
- package/dist/hooks/navigation/useResolvedViews.d.ts +1 -1
- package/dist/hooks/navigation/useTopLevelNavigation.d.ts +1 -1
- package/dist/{import-D25x7ko-.js → import-DTkXNoBg.js} +2 -2
- package/dist/{import-D25x7ko-.js.map → import-DTkXNoBg.js.map} +1 -1
- package/dist/index.js +78 -33
- package/dist/index.js.map +1 -1
- package/dist/util/propertyConfigMapper.d.ts +1 -1
- package/dist/util-CfLFggP7.js +57 -0
- package/dist/util-CfLFggP7.js.map +1 -0
- package/dist/{util-DVqnqlLn.js → util-DE1WQW6h.js} +134 -112
- package/dist/util-DE1WQW6h.js.map +1 -0
- package/package.json +42 -34
- package/dist/util-DVqnqlLn.js.map +0 -1
- package/src/collection_editor/CollectionEditorDialogsContext.tsx +0 -25
- package/src/collection_editor/ConfigControllerProvider.tsx +0 -395
- package/src/collection_editor/_cms_internals.ts +0 -41
- package/src/collection_editor/api/generateCollectionApi.ts +0 -126
- package/src/collection_editor/api/index.ts +0 -1
- package/src/collection_editor/extensibility_types.ts +0 -168
- package/src/collection_editor/index.ts +0 -108
- package/src/collection_editor/liveSchemaClient.ts +0 -285
- package/src/collection_editor/relation_kinds.ts +0 -44
- package/src/collection_editor/serializable_types.ts +0 -535
- package/src/collection_editor/serializable_utils.ts +0 -729
- package/src/collection_editor/types/collection_editor_controller.tsx +0 -62
- package/src/collection_editor/types/collection_inference.ts +0 -18
- package/src/collection_editor/types/config_controller.tsx +0 -121
- package/src/collection_editor/ui/AddKanbanColumnAction.tsx +0 -199
- package/src/collection_editor/ui/CollectionViewHeaderAction.tsx +0 -51
- package/src/collection_editor/ui/EditorCollectionAction.tsx +0 -54
- package/src/collection_editor/ui/EditorCollectionActionStart.tsx +0 -90
- package/src/collection_editor/ui/EditorEntityAction.tsx +0 -50
- package/src/collection_editor/ui/HomePageEditorCollectionAction.tsx +0 -114
- package/src/collection_editor/ui/KanbanSetupAction.tsx +0 -43
- package/src/collection_editor/ui/MissingReferenceWidget.tsx +0 -35
- package/src/collection_editor/ui/NewCollectionButton.tsx +0 -27
- package/src/collection_editor/ui/NewCollectionCard.tsx +0 -48
- package/src/collection_editor/ui/PropertyAddColumnComponent.tsx +0 -49
- package/src/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.tsx +0 -260
- package/src/collection_editor/ui/collection_editor/AIModifiedPathsContext.tsx +0 -90
- package/src/collection_editor/ui/collection_editor/CollectionDetailsForm.tsx +0 -388
- package/src/collection_editor/ui/collection_editor/CollectionEditorDialog.tsx +0 -1098
- package/src/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.tsx +0 -301
- package/src/collection_editor/ui/collection_editor/CollectionJsonImportDialog.tsx +0 -172
- package/src/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.tsx +0 -620
- package/src/collection_editor/ui/collection_editor/CollectionRLSTab.tsx +0 -530
- package/src/collection_editor/ui/collection_editor/CollectionRelationsTab.tsx +0 -462
- package/src/collection_editor/ui/collection_editor/CollectionStudioView.tsx +0 -104
- package/src/collection_editor/ui/collection_editor/CollectionYupValidation.tsx +0 -9
- package/src/collection_editor/ui/collection_editor/CollectionsStudioView.tsx +0 -199
- package/src/collection_editor/ui/collection_editor/DisplaySettingsForm.tsx +0 -315
- package/src/collection_editor/ui/collection_editor/EntityActionsEditTab.tsx +0 -164
- package/src/collection_editor/ui/collection_editor/EntityActionsSelectDialog.tsx +0 -40
- package/src/collection_editor/ui/collection_editor/EntityCustomViewsSelectDialog.tsx +0 -39
- package/src/collection_editor/ui/collection_editor/EnumForm.tsx +0 -373
- package/src/collection_editor/ui/collection_editor/GeneralSettingsForm.tsx +0 -288
- package/src/collection_editor/ui/collection_editor/GetCodeDialog.tsx +0 -141
- package/src/collection_editor/ui/collection_editor/KanbanConfigSection.tsx +0 -194
- package/src/collection_editor/ui/collection_editor/LayoutModeSwitch.tsx +0 -53
- package/src/collection_editor/ui/collection_editor/PropertyEditView.tsx +0 -980
- package/src/collection_editor/ui/collection_editor/PropertyFieldPreview.tsx +0 -164
- package/src/collection_editor/ui/collection_editor/PropertyTree.tsx +0 -364
- package/src/collection_editor/ui/collection_editor/RouterCollectionStudioView.tsx +0 -44
- package/src/collection_editor/ui/collection_editor/RouterCollectionsStudioView.tsx +0 -41
- package/src/collection_editor/ui/collection_editor/SchemaChangeDialog.tsx +0 -470
- package/src/collection_editor/ui/collection_editor/SubcollectionsEditTab.tsx +0 -256
- package/src/collection_editor/ui/collection_editor/SwitchControl.tsx +0 -39
- package/src/collection_editor/ui/collection_editor/ViewModeSwitch.tsx +0 -68
- package/src/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx +0 -67
- package/src/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.tsx +0 -296
- package/src/collection_editor/ui/collection_editor/import/clean_import_data.ts +0 -57
- package/src/collection_editor/ui/collection_editor/properties/BlockPropertyField.tsx +0 -147
- package/src/collection_editor/ui/collection_editor/properties/BooleanPropertyField.tsx +0 -41
- package/src/collection_editor/ui/collection_editor/properties/CommonPropertyFields.tsx +0 -113
- package/src/collection_editor/ui/collection_editor/properties/DateTimePropertyField.tsx +0 -250
- package/src/collection_editor/ui/collection_editor/properties/EnumPropertyField.tsx +0 -126
- package/src/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.tsx +0 -20
- package/src/collection_editor/ui/collection_editor/properties/MapPropertyField.tsx +0 -153
- package/src/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.tsx +0 -217
- package/src/collection_editor/ui/collection_editor/properties/NumberPropertyField.tsx +0 -117
- package/src/collection_editor/ui/collection_editor/properties/ReferencePropertyField.tsx +0 -129
- package/src/collection_editor/ui/collection_editor/properties/RelationPropertyField.tsx +0 -335
- package/src/collection_editor/ui/collection_editor/properties/RepeatPropertyField.tsx +0 -107
- package/src/collection_editor/ui/collection_editor/properties/StoragePropertyField.tsx +0 -403
- package/src/collection_editor/ui/collection_editor/properties/StringPropertyField.tsx +0 -148
- package/src/collection_editor/ui/collection_editor/properties/UrlPropertyField.tsx +0 -91
- package/src/collection_editor/ui/collection_editor/properties/VectorPropertyField.tsx +0 -34
- package/src/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx +0 -49
- package/src/collection_editor/ui/collection_editor/properties/conditions/ConditionsEditor.tsx +0 -925
- package/src/collection_editor/ui/collection_editor/properties/conditions/ConditionsPanel.tsx +0 -28
- package/src/collection_editor/ui/collection_editor/properties/conditions/EnumConditionsEditor.tsx +0 -626
- package/src/collection_editor/ui/collection_editor/properties/conditions/index.ts +0 -6
- package/src/collection_editor/ui/collection_editor/properties/conditions/property_paths.ts +0 -93
- package/src/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.tsx +0 -52
- package/src/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.tsx +0 -63
- package/src/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.tsx +0 -114
- package/src/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.tsx +0 -154
- package/src/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.tsx +0 -28
- package/src/collection_editor/ui/collection_editor/templates/blog_template.ts +0 -112
- package/src/collection_editor/ui/collection_editor/templates/pages_template.ts +0 -183
- package/src/collection_editor/ui/collection_editor/templates/products_template.ts +0 -88
- package/src/collection_editor/ui/collection_editor/templates/users_template.ts +0 -42
- package/src/collection_editor/ui/collection_editor/util.ts +0 -28
- package/src/collection_editor/ui/collection_editor/utils/strings.ts +0 -1
- package/src/collection_editor/ui/collection_editor/utils/supported_fields.tsx +0 -39
- package/src/collection_editor/ui/collection_editor/utils/update_property_for_widget.ts +0 -276
- package/src/collection_editor/useCollectionEditorController.tsx +0 -9
- package/src/collection_editor/useCollectionsConfigController.tsx +0 -9
- package/src/collection_editor/useJsonCollectionsConfigController.tsx +0 -297
- package/src/collection_editor/useLiveSchemaEditing.tsx +0 -315
- package/src/collection_editor/useLocalCollectionsConfigController.tsx +0 -341
- package/src/collection_editor/useSafeSnackbarController.ts +0 -9
- package/src/collection_editor/validateCollectionJson.ts +0 -440
- package/src/collection_editor_ui.ts +0 -21
- package/src/components/AdditionalFieldValue.tsx +0 -68
- package/src/components/AdminModeSyncer.tsx +0 -56
- package/src/components/ArrayContainer.tsx +0 -542
- package/src/components/ClearFilterSortButton.tsx +0 -56
- package/src/components/CollectionEditorDialogs.tsx +0 -69
- package/src/components/CollectionPanel.tsx +0 -179
- package/src/components/CollectionTableBinding/CollectionRowActions.tsx +0 -244
- package/src/components/CollectionTableBinding/CollectionTableBinding.tsx +0 -394
- package/src/components/CollectionTableBinding/CollectionTableBindingProps.tsx +0 -172
- package/src/components/CollectionTableBinding/PropertyTableCell.tsx +0 -350
- package/src/components/CollectionTableBinding/column_utils.tsx +0 -155
- package/src/components/CollectionTableBinding/fields/TableMultipleRelationField.tsx +0 -131
- package/src/components/CollectionTableBinding/fields/TableReferenceField.tsx +0 -193
- package/src/components/CollectionTableBinding/fields/TableRelationField.tsx +0 -192
- package/src/components/CollectionTableBinding/fields/TableRelationSelectorField.tsx +0 -42
- package/src/components/CollectionTableBinding/fields/TableStorageUpload.tsx +0 -324
- package/src/components/CollectionTableBinding/fields/VirtualTableSelect.tsx +0 -132
- package/src/components/CollectionTableBinding/fields/VirtualTableUserSelect.tsx +0 -41
- package/src/components/CollectionTableBinding/index.tsx +0 -14
- package/src/components/CollectionTableBinding/internal/CollectionTableToolbar.tsx +0 -96
- package/src/components/CollectionTableBinding/internal/EntityTableCell.tsx +0 -309
- package/src/components/CollectionTableBinding/internal/EntityTableCellActions.tsx +0 -80
- package/src/components/CollectionTableBinding/internal/common.tsx +0 -74
- package/src/components/CollectionTableBinding/internal/popup_field/PopupFormField.tsx +0 -422
- package/src/components/CollectionTableBinding/internal/popup_field/useDraggable.tsx +0 -99
- package/src/components/CollectionTableBinding/internal/popup_field/useWindowSize.tsx +0 -22
- package/src/components/CollectionTableBinding/table_bindings.tsx +0 -350
- package/src/components/CollectionViewBinding/BoardCardBinding.tsx +0 -263
- package/src/components/CollectionViewBinding/CollectionBoardViewBinding.tsx +0 -662
- package/src/components/CollectionViewBinding/CollectionCardViewBinding.tsx +0 -159
- package/src/components/CollectionViewBinding/CollectionListViewBinding.tsx +0 -1430
- package/src/components/CollectionViewBinding/CollectionViewActions.tsx +0 -227
- package/src/components/CollectionViewBinding/CollectionViewBinding.tsx +0 -1603
- package/src/components/CollectionViewBinding/CollectionViewStartActions.tsx +0 -240
- package/src/components/CollectionViewBinding/EntityCardBinding.tsx +0 -239
- package/src/components/CollectionViewBinding/FilterPresetsButton.tsx +0 -298
- package/src/components/CollectionViewBinding/FiltersDialog.tsx +0 -218
- package/src/components/CollectionViewBinding/SearchExplanation.tsx +0 -106
- package/src/components/CollectionViewBinding/SearchHighlight.tsx +0 -311
- package/src/components/CollectionViewBinding/SlotValue.tsx +0 -156
- package/src/components/CollectionViewBinding/SortButton.tsx +0 -354
- package/src/components/CollectionViewBinding/SplitListCloseButton.tsx +0 -49
- package/src/components/CollectionViewBinding/SplitListShowButton.tsx +0 -28
- package/src/components/CollectionViewBinding/SplitListView.tsx +0 -488
- package/src/components/CollectionViewBinding/SplitViewContext.tsx +0 -34
- package/src/components/CollectionViewBinding/ViewModeToggle.tsx +0 -250
- package/src/components/CollectionViewBinding/hooks/useCollectionInlineEditor.ts +0 -81
- package/src/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.ts +0 -181
- package/src/components/CollectionViewBinding/useBoardDataController.tsx +0 -802
- package/src/components/CollectionViewBinding/usePreviewSlots.ts +0 -703
- package/src/components/CollectionViewBinding/useSelectionController.tsx +0 -40
- package/src/components/CollectionViewBinding/utils.ts +0 -22
- package/src/components/DefaultAppBar.tsx +0 -264
- package/src/components/DefaultDrawer.tsx +0 -593
- package/src/components/DeleteEntityDialog.tsx +0 -205
- package/src/components/DetailViewBinding.tsx +0 -731
- package/src/components/DrawerNavigationGroup.tsx +0 -141
- package/src/components/DrawerNavigationItem.tsx +0 -115
- package/src/components/EditFormActions.tsx +0 -303
- package/src/components/EditViewBinding.tsx +0 -1069
- package/src/components/EntityDisplayHeader.tsx +0 -170
- package/src/components/EntityIdentityBar.tsx +0 -428
- package/src/components/EntityInspector.tsx +0 -156
- package/src/components/EntityPreviewBinding.tsx +0 -432
- package/src/components/EntityPreviewNesting.tsx +0 -50
- package/src/components/EntityViewBinding.tsx +0 -374
- package/src/components/FieldCaption.tsx +0 -14
- package/src/components/HomePage/ContentHomePage.tsx +0 -586
- package/src/components/HomePage/FavouritesView.tsx +0 -60
- package/src/components/HomePage/HomePageDnD.tsx +0 -704
- package/src/components/HomePage/NavigationCard.tsx +0 -81
- package/src/components/HomePage/NavigationCardBinding.tsx +0 -107
- package/src/components/HomePage/NavigationGroup.tsx +0 -156
- package/src/components/HomePage/RenameGroupDialog.tsx +0 -123
- package/src/components/HomePage/SmallNavigationCard.tsx +0 -41
- package/src/components/HomePage/index.tsx +0 -5
- package/src/components/InlineEntityPreview.tsx +0 -149
- package/src/components/JsonPreviewBinding.tsx +0 -66
- package/src/components/PropertyCollectionView.tsx +0 -336
- package/src/components/PropertyConfigBadge.tsx +0 -28
- package/src/components/PropertyIdCopyTooltip.tsx +0 -47
- package/src/components/RebaseAuthGate.tsx +0 -44
- package/src/components/RebaseCMS.tsx +0 -30
- package/src/components/RebaseLayout.tsx +0 -80
- package/src/components/RebaseNavigation.tsx +0 -369
- package/src/components/RebaseRouteDefs.tsx +0 -127
- package/src/components/RebaseShell.tsx +0 -83
- package/src/components/ReferenceTable/SelectionTableBinding.tsx +0 -389
- package/src/components/ReferenceWidget.tsx +0 -156
- package/src/components/RelationSelector.tsx +0 -926
- package/src/components/SearchIconsView.tsx +0 -78
- package/src/components/SelectableTable/SelectableTable.tsx +0 -309
- package/src/components/SelectableTable/SelectableTableContext.tsx +0 -7
- package/src/components/SelectableTable/SelectionStore.ts +0 -43
- package/src/components/SelectableTable/filters/BooleanFilterField.tsx +0 -59
- package/src/components/SelectableTable/filters/DateTimeFilterField.tsx +0 -146
- package/src/components/SelectableTable/filters/FilterFieldBinding.tsx +0 -190
- package/src/components/SelectableTable/filters/ReferenceFilterField.tsx +0 -250
- package/src/components/SelectableTable/filters/RelationFilterField.tsx +0 -238
- package/src/components/SelectableTable/filters/StringNumberFilterField.tsx +0 -282
- package/src/components/SelectableTable/filters/null_filter.ts +0 -63
- package/src/components/SideDialogs.tsx +0 -238
- package/src/components/SidePanelBinding.tsx +0 -361
- package/src/components/SidePanelProvider.tsx +0 -80
- package/src/components/UserSelector.tsx +0 -513
- package/src/components/admin/CreationResultDialog.tsx +0 -138
- package/src/components/admin/index.ts +0 -1
- package/src/components/app/AppBar.tsx +0 -17
- package/src/components/app/Drawer.tsx +0 -38
- package/src/components/app/Scaffold.tsx +0 -366
- package/src/components/app/index.ts +0 -4
- package/src/components/app/useApp.tsx +0 -36
- package/src/components/common/default_entity_actions.tsx +0 -440
- package/src/components/common/index.ts +0 -1
- package/src/components/field_configs.tsx +0 -506
- package/src/components/history/EntityHistoryEntry.tsx +0 -203
- package/src/components/history/EntityHistoryView.tsx +0 -206
- package/src/components/history/LastEditedByFormAction.tsx +0 -24
- package/src/components/history/LastEditedByIndicator.tsx +0 -95
- package/src/components/history/UserChip.tsx +0 -15
- package/src/components/history/index.tsx +0 -5
- package/src/components/index.ts +0 -63
- package/src/contexts/BreacrumbsContext.tsx +0 -45
- package/src/contexts/SideDialogsControllerContext.tsx +0 -5
- package/src/contexts/SidePanelControllerContext.tsx +0 -5
- package/src/data_export/export/BasicExportAction.tsx +0 -142
- package/src/data_export/export/ExportCollectionAction.tsx +0 -321
- package/src/data_export/export/export.ts +0 -295
- package/src/data_export/export/fetch_export_data.ts +0 -90
- package/src/data_export/export/index.ts +0 -4
- package/src/data_export/index.ts +0 -1
- package/src/data_import/components/DataNewPropertiesMapping.tsx +0 -261
- package/src/data_import/components/ImportFileUpload.tsx +0 -42
- package/src/data_import/components/ImportNewPropertyFieldPreview.tsx +0 -58
- package/src/data_import/components/ImportSaveInProgress.tsx +0 -121
- package/src/data_import/components/index.ts +0 -4
- package/src/data_import/hooks/index.ts +0 -1
- package/src/data_import/hooks/useImportConfig.tsx +0 -34
- package/src/data_import/import/ImportCollectionAction.tsx +0 -461
- package/src/data_import/import/index.ts +0 -1
- package/src/data_import/index.ts +0 -5
- package/src/data_import/types/column_mapping.ts +0 -32
- package/src/data_import/types/index.ts +0 -1
- package/src/data_import/utils/csv.ts +0 -153
- package/src/data_import/utils/data.ts +0 -181
- package/src/data_import/utils/file_headers.ts +0 -14
- package/src/data_import/utils/file_to_json.ts +0 -149
- package/src/data_import/utils/get_import_inference_type.ts +0 -33
- package/src/data_import/utils/get_properties_mapping.ts +0 -67
- package/src/data_import/utils/index.ts +0 -5
- package/src/data_import/utils/save_entities.ts +0 -138
- package/src/data_import/utils/transforms.ts +0 -70
- package/src/editor/components/SlashCommandMenu.tsx +0 -532
- package/src/editor/components/editor-bubble-item.tsx +0 -32
- package/src/editor/components/editor-bubble.tsx +0 -143
- package/src/editor/components/image-bubble.tsx +0 -183
- package/src/editor/components/index.ts +0 -14
- package/src/editor/components/table-bubble.tsx +0 -233
- package/src/editor/editor.tsx +0 -529
- package/src/editor/extensions/HighlightDecorationExtension.ts +0 -115
- package/src/editor/extensions/Image.ts +0 -159
- package/src/editor/extensions/TextLoadingDecorationExtension.tsx +0 -107
- package/src/editor/extensions/clipboard.ts +0 -72
- package/src/editor/extensions/custom-keymap.ts +0 -25
- package/src/editor/extensions/drag-and-drop.tsx +0 -508
- package/src/editor/hooks/useProseMirror.ts +0 -126
- package/src/editor/hooks/useProseMirrorContext.ts +0 -15
- package/src/editor/index.ts +0 -2
- package/src/editor/markdown-it-plugins.d.ts +0 -24
- package/src/editor/markdown.ts +0 -204
- package/src/editor/nodeViews/ImageComponent.tsx +0 -20
- package/src/editor/nodeViews/ReactNodeView.tsx +0 -89
- package/src/editor/nodeViews/TaskItemComponent.tsx +0 -30
- package/src/editor/nodeViews/index.ts +0 -35
- package/src/editor/plugins/index.ts +0 -58
- package/src/editor/plugins/inputrules.ts +0 -82
- package/src/editor/plugins/placeholderPlugin.ts +0 -55
- package/src/editor/plugins/slashCommandPlugin.ts +0 -65
- package/src/editor/schema.ts +0 -339
- package/src/editor/selectors/ai-selector.tsx +0 -110
- package/src/editor/selectors/color-selector.tsx +0 -199
- package/src/editor/selectors/link-selector.tsx +0 -122
- package/src/editor/selectors/node-selector.tsx +0 -159
- package/src/editor/selectors/text-buttons.tsx +0 -79
- package/src/editor/types.ts +0 -6
- package/src/editor/useProseMirror.ts +0 -125
- package/src/editor/utils/prosemirror-utils.ts +0 -113
- package/src/editor/utils/remove_classes.ts +0 -18
- package/src/editor/utils/useDebouncedCallback.ts +0 -25
- package/src/form/EntityForm.tsx +0 -761
- package/src/form/EntityFormActions.tsx +0 -160
- package/src/form/EntityFormBinding.tsx +0 -342
- package/src/form/PropertyFieldBinding.tsx +0 -348
- package/src/form/components/ErrorFocus.tsx +0 -44
- package/src/form/components/FieldBlock.tsx +0 -189
- package/src/form/components/FieldHelperText.tsx +0 -84
- package/src/form/components/FormRail.tsx +0 -153
- package/src/form/components/FormSections.tsx +0 -145
- package/src/form/components/LabelWithIcon.tsx +0 -43
- package/src/form/components/LabelWithIconAndTooltip.tsx +0 -28
- package/src/form/components/LocalChangesMenu.tsx +0 -147
- package/src/form/components/StorageItemPreview.tsx +0 -81
- package/src/form/components/StorageUploadProgress.tsx +0 -118
- package/src/form/components/index.tsx +0 -6
- package/src/form/components/useRailVisible.tsx +0 -47
- package/src/form/field_bindings/ArrayCustomShapedFieldBinding.tsx +0 -109
- package/src/form/field_bindings/ArrayOfReferencesFieldBinding.tsx +0 -172
- package/src/form/field_bindings/BinaryFieldBinding.tsx +0 -177
- package/src/form/field_bindings/BlockFieldBinding.tsx +0 -282
- package/src/form/field_bindings/DateTimeFieldBinding.tsx +0 -78
- package/src/form/field_bindings/GeopointFieldBinding.tsx +0 -200
- package/src/form/field_bindings/KeyValueFieldBinding.tsx +0 -574
- package/src/form/field_bindings/MapFieldBinding.tsx +0 -120
- package/src/form/field_bindings/MarkdownEditorFieldBinding.tsx +0 -259
- package/src/form/field_bindings/MultiSelectFieldBinding.tsx +0 -130
- package/src/form/field_bindings/MultipleRelationFieldBinding.tsx +0 -168
- package/src/form/field_bindings/ReadOnlyFieldBinding.tsx +0 -94
- package/src/form/field_bindings/ReferenceFieldBinding.tsx +0 -146
- package/src/form/field_bindings/RelationFieldBinding.tsx +0 -202
- package/src/form/field_bindings/RepeatFieldBinding.tsx +0 -143
- package/src/form/field_bindings/SelectFieldBinding.tsx +0 -111
- package/src/form/field_bindings/StorageUploadFieldBinding.tsx +0 -521
- package/src/form/field_bindings/SwitchFieldBinding.tsx +0 -70
- package/src/form/field_bindings/TextFieldBinding.tsx +0 -189
- package/src/form/field_bindings/UserSelectFieldBinding.tsx +0 -71
- package/src/form/field_bindings/VectorFieldBinding.tsx +0 -209
- package/src/form/form_utils.ts +0 -243
- package/src/form/index.tsx +0 -36
- package/src/form/useClearRestoreValue.tsx +0 -36
- package/src/form/useUndoableDiscard.ts +0 -39
- package/src/form/validation.ts +0 -583
- package/src/hooks/index.ts +0 -16
- package/src/hooks/navigation/contexts/CollectionRegistryContext.tsx +0 -22
- package/src/hooks/navigation/contexts/NavigationStateContext.tsx +0 -16
- package/src/hooks/navigation/contexts/UrlContext.tsx +0 -24
- package/src/hooks/navigation/contexts/index.ts +0 -14
- package/src/hooks/navigation/useAsyncResolver.ts +0 -100
- package/src/hooks/navigation/useBuildCollectionRegistryController.tsx +0 -218
- package/src/hooks/navigation/useBuildNavigationStateController.tsx +0 -134
- package/src/hooks/navigation/useBuildUrlController.tsx +0 -66
- package/src/hooks/navigation/useNavigationResolution.ts +0 -271
- package/src/hooks/navigation/useResolvedCollections.ts +0 -102
- package/src/hooks/navigation/useResolvedViews.tsx +0 -139
- package/src/hooks/navigation/useTopLevelNavigation.ts +0 -273
- package/src/hooks/navigation/utils.ts +0 -200
- package/src/hooks/useAdminContext.tsx +0 -83
- package/src/hooks/useBreadcrumbsController.tsx +0 -17
- package/src/hooks/useBuildSideDialogsController.tsx +0 -145
- package/src/hooks/useBuildSidePanel.tsx +0 -315
- package/src/hooks/useChildViewSource.ts +0 -46
- package/src/hooks/useEntityDisplay.tsx +0 -262
- package/src/hooks/useEntityDisplayTitle.tsx +0 -49
- package/src/hooks/useHistory.ts +0 -178
- package/src/hooks/useRecordActions.tsx +0 -69
- package/src/hooks/useResolvedNavigationFrom.tsx +0 -167
- package/src/hooks/useResolvedUsers.ts +0 -148
- package/src/hooks/useSelectionDialog.tsx +0 -58
- package/src/hooks/useSideDialogsController.tsx +0 -25
- package/src/hooks/useSidePanel.tsx +0 -13
- package/src/index.ts +0 -124
- package/src/preview/PropertyPreview.tsx +0 -331
- package/src/preview/compact_text.ts +0 -68
- package/src/preview/components/ArrayEnumPreview.tsx +0 -39
- package/src/preview/components/BooleanPreview.tsx +0 -28
- package/src/preview/components/DatePreview.tsx +0 -106
- package/src/preview/components/EmptyValue.tsx +0 -10
- package/src/preview/components/EnumValuesChip.tsx +0 -39
- package/src/preview/components/ImagePreview.tsx +0 -144
- package/src/preview/components/InlineEntityListPreview.tsx +0 -42
- package/src/preview/components/ReferencePreview.tsx +0 -235
- package/src/preview/components/RelationPreview.tsx +0 -271
- package/src/preview/components/StorageThumbnail.tsx +0 -147
- package/src/preview/components/UrlComponentPreview.tsx +0 -116
- package/src/preview/components/UserPreview.tsx +0 -30
- package/src/preview/components/date_fns_locales.ts +0 -125
- package/src/preview/index.ts +0 -26
- package/src/preview/property_previews/ArrayOfMapsPreview.tsx +0 -73
- package/src/preview/property_previews/ArrayOfReferencesPreview.tsx +0 -67
- package/src/preview/property_previews/ArrayOfRelationsPreview.tsx +0 -77
- package/src/preview/property_previews/ArrayOfStorageComponentsPreview.tsx +0 -49
- package/src/preview/property_previews/ArrayOfStringsPreview.tsx +0 -70
- package/src/preview/property_previews/ArrayOneOfPreview.tsx +0 -79
- package/src/preview/property_previews/ArrayPropertyEnumPreview.tsx +0 -35
- package/src/preview/property_previews/ArrayPropertyPreview.tsx +0 -79
- package/src/preview/property_previews/MapPropertyPreview.tsx +0 -198
- package/src/preview/property_previews/NumberPropertyPreview.tsx +0 -39
- package/src/preview/property_previews/SkeletonPropertyComponent.tsx +0 -276
- package/src/preview/property_previews/StringPropertyPreview.tsx +0 -70
- package/src/preview/util.ts +0 -39
- package/src/routes/CustomViewRoute.tsx +0 -33
- package/src/routes/RebaseRoute.tsx +0 -467
- package/src/routes/index.ts +0 -2
- package/src/types/components/EntityFormActionsProps.tsx +0 -20
- package/src/types/components/EntityFormProps.tsx +0 -119
- package/src/types/components/PropertyPreviewProps.tsx +0 -85
- package/src/types/components/formex.tsx +0 -2
- package/src/types/components/index.ts +0 -3
- package/src/types/fields.tsx +0 -340
- package/src/types/index.ts +0 -4
- package/src/util/dataControllerAdapter.ts +0 -88
- package/src/util/entity_actions.ts +0 -28
- package/src/util/index.ts +0 -5
- package/src/util/navigation_utils.ts +0 -89
- package/src/util/number_format.ts +0 -46
- package/src/util/previews.ts +0 -131
- package/src/util/propertyConfigMapper.ts +0 -134
- package/src/util/property_utils.tsx +0 -236
- package/src/util/resolutions.ts +0 -96
- package/src/util/view_constants.ts +0 -33
- package/src/util/view_mode.ts +0 -176
|
@@ -1,620 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import React, { useEffect, useMemo, useState } from "react";
|
|
3
|
-
|
|
4
|
-
import { Field, getIn, useFormex } from "@rebasepro/forms";
|
|
5
|
-
import {
|
|
6
|
-
useLargeLayout
|
|
7
|
-
} from "@rebasepro/app";
|
|
8
|
-
import { useSafeSnackbarController } from "../../useSafeSnackbarController";
|
|
9
|
-
import { ErrorBoundary } from "@rebasepro/ui";
|
|
10
|
-
import {
|
|
11
|
-
Button,
|
|
12
|
-
CircularProgress,
|
|
13
|
-
cls,
|
|
14
|
-
CodeIcon,
|
|
15
|
-
DebouncedTextField,
|
|
16
|
-
defaultBorderMixin,
|
|
17
|
-
FileSearchIcon,
|
|
18
|
-
IconButton,
|
|
19
|
-
iconSize,
|
|
20
|
-
PlusIcon,
|
|
21
|
-
Tooltip,
|
|
22
|
-
Typography
|
|
23
|
-
} from "@rebasepro/ui";
|
|
24
|
-
import { MapProperty, Properties, Property, User } from "@rebasepro/types";
|
|
25
|
-
import { PropertyConfig, AdminCollection } from "@rebasepro/cms-types";
|
|
26
|
-
import { isPropertyBuilder } from "@rebasepro/common";
|
|
27
|
-
|
|
28
|
-
import { getFullId, idToPropertiesPath, namespaceToPropertiesOrderPath } from "./util";
|
|
29
|
-
import { OnPropertyChangedParams, PropertyForm, PropertyFormDialog } from "./PropertyEditView";
|
|
30
|
-
import { PropertyTree } from "./PropertyTree";
|
|
31
|
-
import { GetCodeDialog } from "./GetCodeDialog";
|
|
32
|
-
import { useAIModifiedPaths } from "./AIModifiedPathsContext";
|
|
33
|
-
import { useCollectionsConfigController } from "../../useCollectionsConfigController";
|
|
34
|
-
import type { PropertyTypePreset, PropertyType } from "../../extensibility_types";
|
|
35
|
-
import type { SerializableProperty, SerializableCollectionConfig } from "../../serializable_types";
|
|
36
|
-
|
|
37
|
-
type PropertyOrBuilder = Property | Record<string, unknown>;
|
|
38
|
-
|
|
39
|
-
type CollectionEditorFormProps = {
|
|
40
|
-
showErrors: boolean;
|
|
41
|
-
isNewCollection: boolean;
|
|
42
|
-
propertyErrorsRef?: React.MutableRefObject<Record<string, unknown> | undefined>;
|
|
43
|
-
onPropertyError: (propertyKey: string, namespace: string | undefined, error?: Record<string, unknown>) => void;
|
|
44
|
-
setDirty?: (dirty: boolean) => void;
|
|
45
|
-
extraIcon: React.ReactNode;
|
|
46
|
-
getUser?: (uid: string) => User | null;
|
|
47
|
-
getData?: () => Promise<object[]>;
|
|
48
|
-
doCollectionInference?: (collection: AdminCollection) => Promise<Partial<AdminCollection> | null> | undefined;
|
|
49
|
-
propertyConfigs: Record<string, PropertyConfig>;
|
|
50
|
-
propertyTypePresets?: PropertyTypePreset[];
|
|
51
|
-
hiddenPropertyTypes?: PropertyType[];
|
|
52
|
-
renderExtraPropertyFields?: (params: {
|
|
53
|
-
metadata: Record<string, unknown>;
|
|
54
|
-
onMetadataChange: (key: string, value: unknown) => void;
|
|
55
|
-
property: SerializableProperty;
|
|
56
|
-
collection: SerializableCollectionConfig;
|
|
57
|
-
}) => React.ReactNode;
|
|
58
|
-
standalone?: boolean;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
export function CollectionPropertiesEditorForm({
|
|
62
|
-
showErrors,
|
|
63
|
-
isNewCollection,
|
|
64
|
-
propertyErrorsRef,
|
|
65
|
-
onPropertyError,
|
|
66
|
-
setDirty,
|
|
67
|
-
extraIcon,
|
|
68
|
-
getUser,
|
|
69
|
-
getData,
|
|
70
|
-
doCollectionInference,
|
|
71
|
-
propertyConfigs,
|
|
72
|
-
propertyTypePresets,
|
|
73
|
-
hiddenPropertyTypes,
|
|
74
|
-
renderExtraPropertyFields,
|
|
75
|
-
standalone,
|
|
76
|
-
|
|
77
|
-
}: CollectionEditorFormProps) {
|
|
78
|
-
|
|
79
|
-
const {
|
|
80
|
-
values,
|
|
81
|
-
setFieldValue,
|
|
82
|
-
setFieldError,
|
|
83
|
-
setFieldTouched,
|
|
84
|
-
errors,
|
|
85
|
-
dirty
|
|
86
|
-
} = useFormex<AdminCollection>();
|
|
87
|
-
|
|
88
|
-
const snackbarController = useSafeSnackbarController();
|
|
89
|
-
const configControllerFromContext = useCollectionsConfigController();
|
|
90
|
-
const configController = standalone ? { readOnly: false } : configControllerFromContext;
|
|
91
|
-
|
|
92
|
-
const largeLayout = useLargeLayout();
|
|
93
|
-
const asDialog = standalone ? false : !largeLayout
|
|
94
|
-
|
|
95
|
-
// index of the selected property within the namespace
|
|
96
|
-
const [selectedPropertyIndex, setSelectedPropertyIndex] = useState<number | undefined>();
|
|
97
|
-
const [selectedPropertyKey, setSelectedPropertyKey] = useState<string | undefined>();
|
|
98
|
-
const [selectedPropertyNamespace, setSelectedPropertyNamespace] = useState<string | undefined>();
|
|
99
|
-
|
|
100
|
-
const selectedPropertyFullId = selectedPropertyKey ? getFullId(selectedPropertyKey, selectedPropertyNamespace) : undefined;
|
|
101
|
-
const selectedProperty = selectedPropertyFullId ? getIn(values.properties, selectedPropertyFullId.replaceAll(".", ".properties.")) : undefined;
|
|
102
|
-
const [codeDialogOpen, setCodeDialogOpen] = useState<boolean>(false);
|
|
103
|
-
|
|
104
|
-
const [inferringProperties, setInferringProperties] = useState<boolean>(false);
|
|
105
|
-
|
|
106
|
-
const [newPropertyDialogOpen, setNewPropertyDialogOpen] = useState<boolean>(false);
|
|
107
|
-
const [inferredPropertyKeys, setInferredPropertyKeys] = useState<string[]>([]);
|
|
108
|
-
|
|
109
|
-
const currentPropertiesOrderRef = React.useRef<{
|
|
110
|
-
[key: string]: string[]
|
|
111
|
-
}>(values.propertiesOrder ? { "": values.propertiesOrder } : {});
|
|
112
|
-
|
|
113
|
-
useEffect(() => {
|
|
114
|
-
if (setDirty)
|
|
115
|
-
setDirty(dirty);
|
|
116
|
-
}, [dirty]);
|
|
117
|
-
|
|
118
|
-
const inferPropertiesFromData = doCollectionInference
|
|
119
|
-
? (): void => {
|
|
120
|
-
const inferenceFn = doCollectionInference;
|
|
121
|
-
if (!inferenceFn || configController?.readOnly)
|
|
122
|
-
return;
|
|
123
|
-
|
|
124
|
-
setInferringProperties(true);
|
|
125
|
-
|
|
126
|
-
console.debug("CollectionEditor: inferring properties from data", values);
|
|
127
|
-
const promise = inferenceFn(values);
|
|
128
|
-
if (!promise) {
|
|
129
|
-
setInferringProperties(false);
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
promise.then((newCollection) => {
|
|
133
|
-
|
|
134
|
-
if (!newCollection) {
|
|
135
|
-
snackbarController?.open?.({
|
|
136
|
-
type: "error",
|
|
137
|
-
message: "Could not infer properties from data"
|
|
138
|
-
});
|
|
139
|
-
return;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
// Helper function to find all new property keys including nested ones
|
|
143
|
-
const findNewPropertyKeys = (
|
|
144
|
-
existingProps: Record<string, PropertyOrBuilder> | undefined,
|
|
145
|
-
newProps: Record<string, PropertyOrBuilder> | undefined,
|
|
146
|
-
namespace?: string
|
|
147
|
-
): string[] => {
|
|
148
|
-
if (!newProps) return [];
|
|
149
|
-
const keys: string[] = [];
|
|
150
|
-
|
|
151
|
-
for (const key of Object.keys(newProps)) {
|
|
152
|
-
const fullKey = namespace ? `${namespace}.${key}` : key;
|
|
153
|
-
const existingProp = existingProps?.[key];
|
|
154
|
-
const newProp = newProps[key];
|
|
155
|
-
|
|
156
|
-
if (!existingProp) {
|
|
157
|
-
// This is a completely new property
|
|
158
|
-
keys.push(fullKey);
|
|
159
|
-
} else if (
|
|
160
|
-
typeof newProp === "object" &&
|
|
161
|
-
"type" in newProp &&
|
|
162
|
-
(newProp as MapProperty).type === "map" &&
|
|
163
|
-
(newProp as MapProperty).properties
|
|
164
|
-
) {
|
|
165
|
-
// This is a map property, check for new nested properties
|
|
166
|
-
const existingMapProps = typeof existingProp === "object" &&
|
|
167
|
-
"type" in existingProp &&
|
|
168
|
-
(existingProp as MapProperty).type === "map"
|
|
169
|
-
? (existingProp as MapProperty).properties
|
|
170
|
-
: undefined;
|
|
171
|
-
keys.push(...findNewPropertyKeys(existingMapProps, (newProp as MapProperty).properties as Record<string, PropertyOrBuilder>, fullKey));
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
return keys;
|
|
175
|
-
};
|
|
176
|
-
|
|
177
|
-
// Helper function to add only new properties without overwriting existing ones
|
|
178
|
-
// This preserves existing property configurations while adding missing nested properties
|
|
179
|
-
const addNewPropertiesOnly = (
|
|
180
|
-
existingProps: Record<string, PropertyOrBuilder> | undefined,
|
|
181
|
-
newProps: Record<string, PropertyOrBuilder> | undefined
|
|
182
|
-
): Record<string, PropertyOrBuilder> => {
|
|
183
|
-
if (!newProps) return existingProps ?? {};
|
|
184
|
-
if (!existingProps) return newProps;
|
|
185
|
-
|
|
186
|
-
const result = { ...existingProps };
|
|
187
|
-
|
|
188
|
-
for (const key of Object.keys(newProps)) {
|
|
189
|
-
const existingProp = existingProps[key];
|
|
190
|
-
const newProp = newProps[key];
|
|
191
|
-
|
|
192
|
-
if (!existingProp) {
|
|
193
|
-
// This property doesn't exist, add it
|
|
194
|
-
result[key] = newProp;
|
|
195
|
-
} else if (
|
|
196
|
-
typeof existingProp === "object" &&
|
|
197
|
-
"type" in existingProp &&
|
|
198
|
-
(existingProp as MapProperty).type === "map" &&
|
|
199
|
-
typeof newProp === "object" &&
|
|
200
|
-
"type" in newProp &&
|
|
201
|
-
(newProp as MapProperty).type === "map" &&
|
|
202
|
-
(newProp as MapProperty).properties
|
|
203
|
-
) {
|
|
204
|
-
// Both are map properties, recursively add new nested properties
|
|
205
|
-
// Only if the existing map has properties, merge them; otherwise keep existing as-is
|
|
206
|
-
const existingMapProps = (existingProp as MapProperty).properties as Record<string, PropertyOrBuilder> | undefined;
|
|
207
|
-
if (existingMapProps) {
|
|
208
|
-
result[key] = {
|
|
209
|
-
...existingProp,
|
|
210
|
-
properties: addNewPropertiesOnly(
|
|
211
|
-
existingMapProps,
|
|
212
|
-
(newProp as MapProperty).properties as Record<string, PropertyOrBuilder>
|
|
213
|
-
) as Properties
|
|
214
|
-
} as MapProperty;
|
|
215
|
-
}
|
|
216
|
-
// If existingProp doesn't have properties, keep it as-is (don't overwrite with inferred)
|
|
217
|
-
}
|
|
218
|
-
// Otherwise, keep the existing property as-is (don't overwrite)
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
return result;
|
|
222
|
-
};
|
|
223
|
-
|
|
224
|
-
// Add only new properties from inferred collection without replacing existing ones
|
|
225
|
-
const updatedProperties = addNewPropertiesOnly(
|
|
226
|
-
values.properties ?? {},
|
|
227
|
-
newCollection.properties as Record<string, PropertyOrBuilder>
|
|
228
|
-
) as { [key: string]: PropertyOrBuilder };
|
|
229
|
-
|
|
230
|
-
// Find all new property keys including nested ones
|
|
231
|
-
const allNewPropertyKeys = findNewPropertyKeys(
|
|
232
|
-
values.properties,
|
|
233
|
-
newCollection.properties as Record<string, PropertyOrBuilder>
|
|
234
|
-
);
|
|
235
|
-
|
|
236
|
-
// Find new top-level property keys for the properties order
|
|
237
|
-
const newTopLevelPropertyKeys = (newCollection.properties ? Object.keys(newCollection.properties) : [])
|
|
238
|
-
.filter((propertyKey) => !values.properties[propertyKey]);
|
|
239
|
-
|
|
240
|
-
// Check if there are any changes (new properties or modified nested properties)
|
|
241
|
-
if (allNewPropertyKeys.length === 0) {
|
|
242
|
-
snackbarController?.open?.({
|
|
243
|
-
type: "info",
|
|
244
|
-
message: "No new properties found in existing data"
|
|
245
|
-
});
|
|
246
|
-
return;
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
// Update properties order: keep existing order and append new keys at the beginning
|
|
250
|
-
// Use Object.keys from updatedProperties to ensure all properties are included
|
|
251
|
-
const allExistingKeys = values.propertiesOrder ?? Object.keys(values.properties ?? {});
|
|
252
|
-
const updatedPropertiesOrder = [
|
|
253
|
-
...newTopLevelPropertyKeys,
|
|
254
|
-
...allExistingKeys.filter(key => !newTopLevelPropertyKeys.includes(key))
|
|
255
|
-
];
|
|
256
|
-
|
|
257
|
-
setFieldValue("properties", updatedProperties, false);
|
|
258
|
-
updatePropertiesOrder(updatedPropertiesOrder);
|
|
259
|
-
setInferredPropertyKeys(allNewPropertyKeys);
|
|
260
|
-
|
|
261
|
-
snackbarController?.open?.({
|
|
262
|
-
type: "success",
|
|
263
|
-
message: `Added ${allNewPropertyKeys.length} new ${allNewPropertyKeys.length === 1 ? "property" : "properties"}`
|
|
264
|
-
});
|
|
265
|
-
})
|
|
266
|
-
.finally(() => {
|
|
267
|
-
setInferringProperties(false);
|
|
268
|
-
})
|
|
269
|
-
}
|
|
270
|
-
: undefined;
|
|
271
|
-
|
|
272
|
-
const getCurrentPropertiesOrder = (namespace?: string) => {
|
|
273
|
-
if (!namespace) return currentPropertiesOrderRef.current[""] ?? getIn(values, namespaceToPropertiesOrderPath());
|
|
274
|
-
return currentPropertiesOrderRef.current[namespace] ?? getIn(values, namespaceToPropertiesOrderPath(namespace));
|
|
275
|
-
};
|
|
276
|
-
|
|
277
|
-
const updatePropertiesOrder = (newPropertiesOrder: string[], namespace?: string) => {
|
|
278
|
-
const propertiesOrderPath = namespaceToPropertiesOrderPath(namespace);
|
|
279
|
-
|
|
280
|
-
setFieldValue(propertiesOrderPath, newPropertiesOrder, false);
|
|
281
|
-
currentPropertiesOrderRef.current[namespace ?? ""] = newPropertiesOrder;
|
|
282
|
-
|
|
283
|
-
};
|
|
284
|
-
|
|
285
|
-
const deleteProperty = (propertyKey?: string, namespace?: string) => {
|
|
286
|
-
if (configController?.readOnly) return;
|
|
287
|
-
const fullId = propertyKey ? getFullId(propertyKey, namespace) : undefined;
|
|
288
|
-
if (!fullId)
|
|
289
|
-
throw Error("collection editor miss config");
|
|
290
|
-
|
|
291
|
-
setFieldValue(idToPropertiesPath(fullId), undefined, false);
|
|
292
|
-
|
|
293
|
-
const currentPropertiesOrder = getCurrentPropertiesOrder(namespace);
|
|
294
|
-
if (currentPropertiesOrder) {
|
|
295
|
-
const newPropertiesOrder = currentPropertiesOrder.filter((p) => p !== propertyKey);
|
|
296
|
-
updatePropertiesOrder(newPropertiesOrder, namespace);
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
setNewPropertyDialogOpen(false);
|
|
300
|
-
|
|
301
|
-
setSelectedPropertyIndex(undefined);
|
|
302
|
-
setSelectedPropertyKey(undefined);
|
|
303
|
-
setSelectedPropertyNamespace(undefined);
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
const onPropertyMove = (propertiesOrder: string[], namespace?: string) => {
|
|
307
|
-
if (configController?.readOnly) return;
|
|
308
|
-
setFieldValue(namespaceToPropertiesOrderPath(namespace), propertiesOrder, false);
|
|
309
|
-
};
|
|
310
|
-
|
|
311
|
-
const onPropertyCreated = ({
|
|
312
|
-
id,
|
|
313
|
-
property
|
|
314
|
-
}: {
|
|
315
|
-
id?: string,
|
|
316
|
-
property: Property
|
|
317
|
-
}) => {
|
|
318
|
-
if (configController?.readOnly) return;
|
|
319
|
-
if (!id) {
|
|
320
|
-
throw Error("Need to include an ID when creating a new property")
|
|
321
|
-
}
|
|
322
|
-
setFieldValue("properties", {
|
|
323
|
-
...(values.properties ?? {}),
|
|
324
|
-
[id]: property
|
|
325
|
-
}, false);
|
|
326
|
-
|
|
327
|
-
const newPropertiesOrder = [...(values.propertiesOrder ?? Object.keys(values.properties)), id];
|
|
328
|
-
updatePropertiesOrder(newPropertiesOrder);
|
|
329
|
-
|
|
330
|
-
setNewPropertyDialogOpen(false);
|
|
331
|
-
if (largeLayout) {
|
|
332
|
-
setSelectedPropertyIndex(newPropertiesOrder.indexOf(id));
|
|
333
|
-
setSelectedPropertyKey(id);
|
|
334
|
-
}
|
|
335
|
-
setSelectedPropertyNamespace(undefined);
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
const onPropertyChanged = ({
|
|
339
|
-
id,
|
|
340
|
-
property,
|
|
341
|
-
previousId,
|
|
342
|
-
namespace
|
|
343
|
-
}: OnPropertyChangedParams) => {
|
|
344
|
-
|
|
345
|
-
const fullId = id ? getFullId(id, namespace) : undefined;
|
|
346
|
-
const propertyPath = fullId ? idToPropertiesPath(fullId) : undefined;
|
|
347
|
-
|
|
348
|
-
// If the id has changed we need to a little cleanup
|
|
349
|
-
if (previousId && previousId !== id) {
|
|
350
|
-
|
|
351
|
-
const previousFullId = getFullId(previousId, namespace);
|
|
352
|
-
const previousPropertyPath = idToPropertiesPath(previousFullId);
|
|
353
|
-
|
|
354
|
-
const currentPropertiesOrder = getCurrentPropertiesOrder(namespace);
|
|
355
|
-
|
|
356
|
-
// replace previousId with id in propertiesOrder
|
|
357
|
-
const newPropertiesOrder = currentPropertiesOrder
|
|
358
|
-
.map((p) => p === previousId ? id : p)
|
|
359
|
-
.filter((p) => p !== undefined) as string[];
|
|
360
|
-
|
|
361
|
-
updatePropertiesOrder(newPropertiesOrder, namespace);
|
|
362
|
-
|
|
363
|
-
if (id) {
|
|
364
|
-
setSelectedPropertyIndex(newPropertiesOrder.indexOf(id));
|
|
365
|
-
setSelectedPropertyKey(id);
|
|
366
|
-
}
|
|
367
|
-
setFieldValue(previousPropertyPath, undefined, false);
|
|
368
|
-
setFieldTouched(previousPropertyPath, false, false);
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
if (propertyPath) {
|
|
372
|
-
setFieldValue(propertyPath, property, false);
|
|
373
|
-
setFieldTouched(propertyPath, true, false);
|
|
374
|
-
}
|
|
375
|
-
|
|
376
|
-
};
|
|
377
|
-
|
|
378
|
-
const onPropertyErrorInternal = (id: string, namespace?: string, error?: Record<string, unknown>) => {
|
|
379
|
-
const propertyPath = id ? getFullId(id, namespace) : undefined;
|
|
380
|
-
console.debug("onPropertyErrorInternal", {
|
|
381
|
-
id,
|
|
382
|
-
namespace,
|
|
383
|
-
error,
|
|
384
|
-
propertyPath
|
|
385
|
-
});
|
|
386
|
-
if (propertyPath) {
|
|
387
|
-
const hasError = error && Object.keys(error).length > 0;
|
|
388
|
-
onPropertyError(id, namespace, hasError ? error : undefined);
|
|
389
|
-
setFieldError(idToPropertiesPath(propertyPath), hasError ? "Property error" : undefined);
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
const closePropertyDialog = () => {
|
|
394
|
-
setSelectedPropertyIndex(undefined);
|
|
395
|
-
setSelectedPropertyKey(undefined);
|
|
396
|
-
};
|
|
397
|
-
|
|
398
|
-
const initialErrors = selectedPropertyKey && propertyErrorsRef?.current?.properties ? (propertyErrorsRef.current.properties as Record<string, unknown>)[selectedPropertyKey] as Record<string, any> | undefined : undefined;
|
|
399
|
-
|
|
400
|
-
const emptyCollection = (values?.propertiesOrder === undefined || values.propertiesOrder.length === 0)
|
|
401
|
-
&& (!values?.properties || Object.keys(values.properties).length === 0);
|
|
402
|
-
|
|
403
|
-
const usedPropertiesOrder = (values.propertiesOrder
|
|
404
|
-
? values.propertiesOrder
|
|
405
|
-
: Object.keys(values.properties)) as string[];
|
|
406
|
-
|
|
407
|
-
const owner = useMemo(() => values.ownerId && getUser ? getUser(values.ownerId) : null, [getUser, values.ownerId]);
|
|
408
|
-
|
|
409
|
-
// Get AI generation counter for key to force remount on AI changes
|
|
410
|
-
const aiModifiedPaths = useAIModifiedPaths();
|
|
411
|
-
const generationCounter = aiModifiedPaths?.generationCounter ?? 0;
|
|
412
|
-
|
|
413
|
-
const onPropertyClick = (propertyKey: string, namespace?: string) => {
|
|
414
|
-
console.debug("CollectionEditor: onPropertyClick", {
|
|
415
|
-
propertyKey,
|
|
416
|
-
namespace
|
|
417
|
-
});
|
|
418
|
-
setSelectedPropertyIndex(usedPropertiesOrder.indexOf(propertyKey));
|
|
419
|
-
setSelectedPropertyKey(propertyKey);
|
|
420
|
-
setSelectedPropertyNamespace(namespace);
|
|
421
|
-
};
|
|
422
|
-
|
|
423
|
-
const body = (
|
|
424
|
-
<div className={"grid grid-cols-12 h-full min-h-0 bg-surface-50 dark:bg-surface-800"}>
|
|
425
|
-
<div className={cls(
|
|
426
|
-
"col-span-12 lg:col-span-5 h-full min-h-0 flex flex-col bg-surface-50 dark:bg-surface-800",
|
|
427
|
-
!asDialog && "border-r " + defaultBorderMixin
|
|
428
|
-
)}>
|
|
429
|
-
{/* Sidebar Header */}
|
|
430
|
-
<div className={cls("flex items-center justify-between px-3 py-2 border-b bg-surface-50 dark:bg-surface-900 min-h-[48px] shrink-0", defaultBorderMixin)}>
|
|
431
|
-
<div className="flex-grow min-w-0 pr-2">
|
|
432
|
-
<Field
|
|
433
|
-
name={"name"}
|
|
434
|
-
as={DebouncedTextField}
|
|
435
|
-
invisible={true}
|
|
436
|
-
className="-ml-1"
|
|
437
|
-
inputClassName="text-sm font-semibold truncate bg-transparent border-0 outline-none focus:ring-0"
|
|
438
|
-
placeholder={"Collection name"}
|
|
439
|
-
size={"small"}
|
|
440
|
-
required
|
|
441
|
-
error={Boolean(errors?.name)}/>
|
|
442
|
-
</div>
|
|
443
|
-
|
|
444
|
-
{extraIcon && <div className="flex-shrink-0">{extraIcon}</div>}
|
|
445
|
-
|
|
446
|
-
<div className="flex items-center gap-1.5 flex-shrink-0 ml-2">
|
|
447
|
-
{inferPropertiesFromData && (
|
|
448
|
-
<Tooltip title={"Add new properties based on data"} asChild={true}>
|
|
449
|
-
<IconButton
|
|
450
|
-
size="small"
|
|
451
|
-
disabled={inferringProperties}
|
|
452
|
-
onClick={inferPropertiesFromData}
|
|
453
|
-
>
|
|
454
|
-
{inferringProperties ? <CircularProgress size={"smallest"}/> : <FileSearchIcon size={iconSize.smallest}/>}
|
|
455
|
-
</IconButton>
|
|
456
|
-
</Tooltip>
|
|
457
|
-
)}
|
|
458
|
-
<Tooltip title={"Add new property"} asChild={true}>
|
|
459
|
-
<IconButton
|
|
460
|
-
size="small"
|
|
461
|
-
disabled={configController?.readOnly}
|
|
462
|
-
onClick={() => setNewPropertyDialogOpen(true)}
|
|
463
|
-
>
|
|
464
|
-
<PlusIcon size={iconSize.smallest}/>
|
|
465
|
-
</IconButton>
|
|
466
|
-
</Tooltip>
|
|
467
|
-
</div>
|
|
468
|
-
</div>
|
|
469
|
-
|
|
470
|
-
{/* Sidebar Content */}
|
|
471
|
-
<div className="flex-grow overflow-y-auto p-3 space-y-3 bg-surface-50 dark:bg-surface-800">
|
|
472
|
-
{owner && (
|
|
473
|
-
<div className="px-1 py-0.5">
|
|
474
|
-
<Typography variant="body2" color="secondary">
|
|
475
|
-
Created by {owner.displayName}
|
|
476
|
-
</Typography>
|
|
477
|
-
</div>
|
|
478
|
-
)}
|
|
479
|
-
<ErrorBoundary>
|
|
480
|
-
<PropertyTree
|
|
481
|
-
inferredPropertyKeys={inferredPropertyKeys}
|
|
482
|
-
selectedPropertyKey={selectedPropertyKey ? getFullId(selectedPropertyKey, selectedPropertyNamespace) : undefined}
|
|
483
|
-
properties={values.properties}
|
|
484
|
-
additionalFields={values.additionalFields}
|
|
485
|
-
propertiesOrder={usedPropertiesOrder}
|
|
486
|
-
onPropertyClick={onPropertyClick}
|
|
487
|
-
onPropertyMove={onPropertyMove}
|
|
488
|
-
onPropertyRemove={(isNewCollection || (inferredPropertyKeys && inferredPropertyKeys.length > 0)) && !configController?.readOnly ? deleteProperty : undefined}
|
|
489
|
-
errors={errors}/>
|
|
490
|
-
</ErrorBoundary>
|
|
491
|
-
|
|
492
|
-
<Button className={"w-full"}
|
|
493
|
-
variant="outlined"
|
|
494
|
-
color="neutral"
|
|
495
|
-
disabled={configController?.readOnly}
|
|
496
|
-
onClick={() => setNewPropertyDialogOpen(true)}
|
|
497
|
-
startIcon={<PlusIcon/>}>
|
|
498
|
-
Add new property
|
|
499
|
-
</Button>
|
|
500
|
-
</div>
|
|
501
|
-
</div>
|
|
502
|
-
|
|
503
|
-
{!asDialog &&
|
|
504
|
-
<div className={"col-span-12 lg:col-span-7 p-4 md:py-8 md:px-4 h-full overflow-auto bg-surface-50 dark:bg-surface-800"}>
|
|
505
|
-
<div
|
|
506
|
-
className="sticky top-8 min-h-full w-full flex flex-col justify-center">
|
|
507
|
-
|
|
508
|
-
{selectedPropertyFullId &&
|
|
509
|
-
!!selectedProperty &&
|
|
510
|
-
!isPropertyBuilder(selectedProperty as Property) &&
|
|
511
|
-
<PropertyForm
|
|
512
|
-
inArray={false}
|
|
513
|
-
key={`edit_view_${selectedPropertyIndex}_${generationCounter}`}
|
|
514
|
-
existingProperty={!isNewCollection}
|
|
515
|
-
autoUpdateId={false}
|
|
516
|
-
allowDataInference={!isNewCollection}
|
|
517
|
-
autoOpenTypeSelect={false}
|
|
518
|
-
propertyKey={selectedPropertyKey}
|
|
519
|
-
propertyNamespace={selectedPropertyNamespace}
|
|
520
|
-
property={selectedProperty as Property}
|
|
521
|
-
onPropertyChanged={onPropertyChanged}
|
|
522
|
-
onDelete={deleteProperty}
|
|
523
|
-
onError={onPropertyErrorInternal}
|
|
524
|
-
forceShowErrors={showErrors}
|
|
525
|
-
initialErrors={initialErrors}
|
|
526
|
-
getData={getData}
|
|
527
|
-
propertyConfigs={propertyConfigs}
|
|
528
|
-
propertyTypePresets={propertyTypePresets}
|
|
529
|
-
hiddenPropertyTypes={hiddenPropertyTypes}
|
|
530
|
-
renderExtraPropertyFields={renderExtraPropertyFields}
|
|
531
|
-
collectionValues={values}
|
|
532
|
-
|
|
533
|
-
/>}
|
|
534
|
-
|
|
535
|
-
{!selectedProperty &&
|
|
536
|
-
<div className={"w-full flex flex-col items-center justify-center h-full gap-4"}>
|
|
537
|
-
<Typography variant={"label"} className="">
|
|
538
|
-
{emptyCollection
|
|
539
|
-
? "Now you can add your first property"
|
|
540
|
-
: "Select a property to edit it"}
|
|
541
|
-
</Typography>
|
|
542
|
-
<Button
|
|
543
|
-
disabled={configController?.readOnly}
|
|
544
|
-
onClick={() => setNewPropertyDialogOpen(true)}
|
|
545
|
-
>
|
|
546
|
-
<PlusIcon/>
|
|
547
|
-
Add new property
|
|
548
|
-
</Button>
|
|
549
|
-
</div>}
|
|
550
|
-
|
|
551
|
-
{!!selectedProperty && isPropertyBuilder(selectedProperty as Property) &&
|
|
552
|
-
<Typography variant={"label"} className="flex items-center justify-center">
|
|
553
|
-
{"This property is defined as a property builder in code"}
|
|
554
|
-
</Typography>}
|
|
555
|
-
</div>
|
|
556
|
-
</div>}
|
|
557
|
-
|
|
558
|
-
{asDialog && <PropertyFormDialog
|
|
559
|
-
inArray={false}
|
|
560
|
-
open={selectedPropertyIndex !== undefined}
|
|
561
|
-
key={`edit_view_${selectedPropertyIndex}_${generationCounter}`}
|
|
562
|
-
autoUpdateId={!selectedProperty}
|
|
563
|
-
allowDataInference={!isNewCollection}
|
|
564
|
-
existingProperty={true}
|
|
565
|
-
autoOpenTypeSelect={false}
|
|
566
|
-
propertyKey={selectedPropertyKey}
|
|
567
|
-
propertyNamespace={selectedPropertyNamespace}
|
|
568
|
-
property={selectedProperty as Property | undefined}
|
|
569
|
-
onPropertyChanged={onPropertyChanged}
|
|
570
|
-
onDelete={deleteProperty}
|
|
571
|
-
onError={onPropertyErrorInternal}
|
|
572
|
-
forceShowErrors={showErrors}
|
|
573
|
-
initialErrors={initialErrors}
|
|
574
|
-
getData={getData}
|
|
575
|
-
propertyConfigs={propertyConfigs}
|
|
576
|
-
propertyTypePresets={propertyTypePresets}
|
|
577
|
-
hiddenPropertyTypes={hiddenPropertyTypes}
|
|
578
|
-
renderExtraPropertyFields={renderExtraPropertyFields}
|
|
579
|
-
collectionValues={values}
|
|
580
|
-
|
|
581
|
-
onCancel={closePropertyDialog}
|
|
582
|
-
onOkClicked={asDialog
|
|
583
|
-
? closePropertyDialog
|
|
584
|
-
: undefined
|
|
585
|
-
}/>}
|
|
586
|
-
|
|
587
|
-
</div>);
|
|
588
|
-
|
|
589
|
-
return (<>
|
|
590
|
-
|
|
591
|
-
{body}
|
|
592
|
-
|
|
593
|
-
{/* This is the dialog used for new properties*/}
|
|
594
|
-
<PropertyFormDialog
|
|
595
|
-
inArray={false}
|
|
596
|
-
existingProperty={false}
|
|
597
|
-
autoOpenTypeSelect={true}
|
|
598
|
-
autoUpdateId={true}
|
|
599
|
-
forceShowErrors={showErrors}
|
|
600
|
-
open={newPropertyDialogOpen}
|
|
601
|
-
onCancel={() => setNewPropertyDialogOpen(false)}
|
|
602
|
-
onPropertyChanged={onPropertyCreated}
|
|
603
|
-
getData={getData}
|
|
604
|
-
allowDataInference={!isNewCollection}
|
|
605
|
-
propertyConfigs={propertyConfigs}
|
|
606
|
-
propertyTypePresets={propertyTypePresets}
|
|
607
|
-
hiddenPropertyTypes={hiddenPropertyTypes}
|
|
608
|
-
renderExtraPropertyFields={renderExtraPropertyFields}
|
|
609
|
-
collectionValues={values}
|
|
610
|
-
existingPropertyKeys={values.propertiesOrder as string[]}/>
|
|
611
|
-
|
|
612
|
-
<ErrorBoundary>
|
|
613
|
-
<GetCodeDialog
|
|
614
|
-
collection={values}
|
|
615
|
-
open={codeDialogOpen}
|
|
616
|
-
onOpenChange={setCodeDialogOpen}/>
|
|
617
|
-
</ErrorBoundary>
|
|
618
|
-
</>
|
|
619
|
-
);
|
|
620
|
-
}
|