@rebasepro/cms 0.23.0 → 0.24.1-canary.g19596ef
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 +3 -1
- package/dist/collection_editor/CollectionEditorDialogsContext.js +10 -0
- package/dist/collection_editor/CollectionEditorDialogsContext.js.map +1 -0
- package/dist/collection_editor/ConfigControllerProvider.js +274 -0
- package/dist/collection_editor/ConfigControllerProvider.js.map +1 -0
- package/dist/collection_editor/_cms_internals.d.ts +2 -1
- package/dist/collection_editor/api/generateCollectionApi.js +64 -0
- package/dist/collection_editor/api/generateCollectionApi.js.map +1 -0
- package/dist/collection_editor/collection_wire.d.ts +13 -0
- package/dist/collection_editor/collection_wire.js +49 -0
- package/dist/collection_editor/collection_wire.js.map +1 -0
- package/dist/collection_editor/liveSchemaClient.d.ts +38 -18
- package/dist/collection_editor/liveSchemaClient.js +130 -0
- package/dist/collection_editor/liveSchemaClient.js.map +1 -0
- package/dist/collection_editor/relation_kinds.js +74 -0
- package/dist/collection_editor/relation_kinds.js.map +1 -0
- package/dist/collection_editor/serializable_types.d.ts +6 -1
- package/dist/collection_editor/serializable_utils.js +504 -0
- package/dist/collection_editor/serializable_utils.js.map +1 -0
- package/dist/collection_editor/types/config_controller.d.ts +11 -0
- package/dist/collection_editor/ui/EditorCollectionAction.js +37 -0
- package/dist/collection_editor/ui/EditorCollectionAction.js.map +1 -0
- package/dist/collection_editor/ui/MissingReferenceWidget.js +39 -0
- package/dist/collection_editor/ui/MissingReferenceWidget.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.js +160 -0
- package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/AIModifiedPathsContext.js +61 -0
- package/dist/collection_editor/ui/collection_editor/AIModifiedPathsContext.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js +731 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.js +220 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionJsonImportDialog.js +160 -0
- package/dist/collection_editor/ui/collection_editor/CollectionJsonImportDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js +394 -0
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js +616 -0
- package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionStudioView.js +68 -0
- package/dist/collection_editor/ui/collection_editor/CollectionStudioView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionYupValidation.js +11 -0
- package/dist/collection_editor/ui/collection_editor/CollectionYupValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.js +148 -0
- package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js +244 -0
- package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/EnumForm.js +222 -0
- package/dist/collection_editor/ui/collection_editor/EnumForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js +204 -0
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/GetCodeDialog.js +108 -0
- package/dist/collection_editor/ui/collection_editor/GetCodeDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js +163 -0
- package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/LayoutModeSwitch.js +59 -0
- package/dist/collection_editor/ui/collection_editor/LayoutModeSwitch.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.js +640 -0
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js +141 -0
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/PropertyTree.js +210 -0
- package/dist/collection_editor/ui/collection_editor/PropertyTree.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.js +31 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.js +25 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.js.map +1 -0
- package/dist/{SchemaChangeDialog-BeP0A4MJ.js → collection_editor/ui/collection_editor/SchemaChangeDialog.js} +73 -69
- package/dist/collection_editor/ui/collection_editor/SchemaChangeDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/SwitchControl.js +24 -0
- package/dist/collection_editor/ui/collection_editor/SwitchControl.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/ViewModeSwitch.js +66 -0
- package/dist/collection_editor/ui/collection_editor/ViewModeSwitch.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js +61 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.js +188 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.d.ts +12 -0
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.js +74 -0
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.js +100 -0
- package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/BooleanPropertyField.js +34 -0
- package/dist/collection_editor/ui/collection_editor/properties/BooleanPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/CommonPropertyFields.js +75 -0
- package/dist/collection_editor/ui/collection_editor/properties/CommonPropertyFields.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js +338 -0
- package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js +83 -0
- package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.js +15 -0
- package/dist/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.js +121 -0
- package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js +127 -0
- package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/NumberPropertyField.js +151 -0
- package/dist/collection_editor/ui/collection_editor/properties/NumberPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.js +77 -0
- package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.js +254 -0
- package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.js +71 -0
- package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js +356 -0
- package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.js +173 -0
- package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/UrlPropertyField.js +79 -0
- package/dist/collection_editor/ui/collection_editor/properties/UrlPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/VectorPropertyField.js +34 -0
- package/dist/collection_editor/ui/collection_editor/properties/VectorPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.js +47 -0
- package/dist/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.js +47 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.js +62 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.js +119 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.d.ts +10 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.js +178 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.js +23 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/blog_template.js +116 -0
- package/dist/collection_editor/ui/collection_editor/templates/blog_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/pages_template.js +182 -0
- package/dist/collection_editor/ui/collection_editor/templates/pages_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/products_template.js +87 -0
- package/dist/collection_editor/ui/collection_editor/templates/products_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/users_template.js +46 -0
- package/dist/collection_editor/ui/collection_editor/templates/users_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/util.js +20 -0
- package/dist/collection_editor/ui/collection_editor/util.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/utils/strings.js +2 -0
- package/dist/collection_editor/ui/collection_editor/utils/supported_fields.js +37 -0
- package/dist/collection_editor/ui/collection_editor/utils/supported_fields.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.js +192 -0
- package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.js.map +1 -0
- package/dist/collection_editor/useCollectionEditorController.js +12 -0
- package/dist/collection_editor/useCollectionEditorController.js.map +1 -0
- package/dist/collection_editor/useCollectionsConfigController.js +12 -0
- package/dist/collection_editor/useCollectionsConfigController.js.map +1 -0
- package/dist/collection_editor/useJsonCollectionsConfigController.js +191 -0
- package/dist/collection_editor/useJsonCollectionsConfigController.js.map +1 -0
- package/dist/collection_editor/useLiveSchemaEditing.d.ts +5 -5
- package/dist/collection_editor/useLiveSchemaEditing.js +214 -0
- package/dist/collection_editor/useLiveSchemaEditing.js.map +1 -0
- package/dist/collection_editor/useLocalCollectionsConfigController.d.ts +7 -0
- package/dist/collection_editor/useLocalCollectionsConfigController.js +228 -0
- package/dist/collection_editor/useLocalCollectionsConfigController.js.map +1 -0
- package/dist/collection_editor/useSafeSnackbarController.js +13 -0
- package/dist/collection_editor/useSafeSnackbarController.js.map +1 -0
- package/dist/collection_editor/validateCollectionJson.js +289 -0
- package/dist/collection_editor/validateCollectionJson.js.map +1 -0
- package/dist/collection_editor_ui.js +7 -33
- package/dist/components/AdditionalFieldValue.js +60 -0
- package/dist/components/AdditionalFieldValue.js.map +1 -0
- package/dist/components/AdminModeSyncer.js +41 -0
- package/dist/components/AdminModeSyncer.js.map +1 -0
- package/dist/components/ArrayContainer.d.ts +8 -2
- package/dist/components/ArrayContainer.js +363 -0
- package/dist/components/ArrayContainer.js.map +1 -0
- package/dist/components/ClearFilterSortButton.d.ts +7 -1
- package/dist/components/ClearFilterSortButton.js +33 -0
- package/dist/components/ClearFilterSortButton.js.map +1 -0
- package/dist/components/CollectionEditorDialogs.js +49 -0
- package/dist/components/CollectionEditorDialogs.js.map +1 -0
- package/dist/components/CollectionPanel.d.ts +26 -5
- package/dist/components/CollectionPanel.js +142 -0
- package/dist/components/CollectionPanel.js.map +1 -0
- package/dist/components/CollectionTableBinding/CollectionRowActions.js +165 -0
- package/dist/components/CollectionTableBinding/CollectionRowActions.js.map +1 -0
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js +329 -0
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js.map +1 -0
- package/dist/components/CollectionTableBinding/PropertyTableCell.js +311 -0
- package/dist/components/CollectionTableBinding/PropertyTableCell.js.map +1 -0
- package/dist/components/CollectionTableBinding/column_utils.js +85 -0
- package/dist/components/CollectionTableBinding/column_utils.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/CompactEntityCellField.js +45 -0
- package/dist/components/CollectionTableBinding/fields/CompactEntityCellField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js +66 -0
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js +86 -0
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js +93 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.js +33 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js +171 -0
- package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js +91 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableUserSelect.js +36 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableUserSelect.js.map +1 -0
- package/dist/components/CollectionTableBinding/index.js +6 -0
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js +50 -0
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCell.d.ts +2 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCell.js +223 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCell.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCellActions.js +58 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCellActions.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/TableCellOpener.js +53 -0
- package/dist/components/CollectionTableBinding/internal/TableCellOpener.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/common.js +40 -0
- package/dist/components/CollectionTableBinding/internal/common.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js +270 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useDraggable.js +68 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useDraggable.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useWindowSize.js +24 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useWindowSize.js.map +1 -0
- package/dist/components/CollectionTableBinding/table_bindings.js +306 -0
- package/dist/components/CollectionTableBinding/table_bindings.js.map +1 -0
- package/dist/components/CollectionViewBinding/BoardCardBinding.js +160 -0
- package/dist/components/CollectionViewBinding/BoardCardBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js +471 -0
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js +108 -0
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js +988 -0
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewActions.d.ts +6 -1
- package/dist/components/CollectionViewBinding/CollectionViewActions.js +146 -0
- package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewBinding.d.ts +5 -2
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js +1209 -0
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js +133 -0
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js.map +1 -0
- package/dist/components/CollectionViewBinding/EntityCardBinding.js +133 -0
- package/dist/components/CollectionViewBinding/EntityCardBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/FilterPresetsButton.js +203 -0
- package/dist/components/CollectionViewBinding/FilterPresetsButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/FiltersDialog.d.ts +5 -0
- package/dist/components/CollectionViewBinding/FiltersDialog.js +148 -0
- package/dist/components/CollectionViewBinding/FiltersDialog.js.map +1 -0
- package/dist/components/CollectionViewBinding/SearchExplanation.js +86 -0
- package/dist/components/CollectionViewBinding/SearchExplanation.js.map +1 -0
- package/dist/components/CollectionViewBinding/SearchHighlight.js +262 -0
- package/dist/components/CollectionViewBinding/SearchHighlight.js.map +1 -0
- package/dist/components/CollectionViewBinding/SlotValue.js +117 -0
- package/dist/components/CollectionViewBinding/SlotValue.js.map +1 -0
- package/dist/components/CollectionViewBinding/SortButton.js +214 -0
- package/dist/components/CollectionViewBinding/SortButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListCloseButton.js +41 -0
- package/dist/components/CollectionViewBinding/SplitListCloseButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListShowButton.js +29 -0
- package/dist/components/CollectionViewBinding/SplitListShowButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListView.js +311 -0
- package/dist/components/CollectionViewBinding/SplitListView.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitViewContext.js +21 -0
- package/dist/components/CollectionViewBinding/SplitViewContext.js.map +1 -0
- package/dist/components/CollectionViewBinding/ViewModeToggle.js +150 -0
- package/dist/components/CollectionViewBinding/ViewModeToggle.js.map +1 -0
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js +49 -0
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js.map +1 -0
- package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.js +122 -0
- package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.js.map +1 -0
- package/dist/components/CollectionViewBinding/useBoardDataController.js +530 -0
- package/dist/components/CollectionViewBinding/useBoardDataController.js.map +1 -0
- package/dist/components/CollectionViewBinding/usePreviewSlots.d.ts +4 -1
- package/dist/components/CollectionViewBinding/usePreviewSlots.js +384 -0
- package/dist/components/CollectionViewBinding/usePreviewSlots.js.map +1 -0
- package/dist/components/CollectionViewBinding/useSelectionController.js +104 -0
- package/dist/components/CollectionViewBinding/useSelectionController.js.map +1 -0
- package/dist/components/CollectionViewBinding/utils.js +21 -0
- package/dist/components/CollectionViewBinding/utils.js.map +1 -0
- package/dist/components/CollectionsProvider.d.ts +44 -0
- package/dist/components/CollectionsProvider.js +137 -0
- package/dist/components/CollectionsProvider.js.map +1 -0
- package/dist/components/CollectionsScopeContext.d.ts +18 -0
- package/dist/components/CollectionsScopeContext.js +25 -0
- package/dist/components/CollectionsScopeContext.js.map +1 -0
- package/dist/components/DefaultAppBar.js +179 -0
- package/dist/components/DefaultAppBar.js.map +1 -0
- package/dist/components/DefaultDrawer.js +364 -0
- package/dist/components/DefaultDrawer.js.map +1 -0
- package/dist/components/DeleteEntityDialog.js +256 -0
- package/dist/components/DeleteEntityDialog.js.map +1 -0
- package/dist/components/DetailViewBinding.js +504 -0
- package/dist/components/DetailViewBinding.js.map +1 -0
- package/dist/components/DrawerNavigationGroup.js +74 -0
- package/dist/components/DrawerNavigationGroup.js.map +1 -0
- package/dist/components/DrawerNavigationItem.d.ts +8 -0
- package/dist/components/DrawerNavigationItem.js +45 -0
- package/dist/components/DrawerNavigationItem.js.map +1 -0
- package/dist/components/EditFormActions.js +210 -0
- package/dist/components/EditFormActions.js.map +1 -0
- package/dist/components/EditViewBinding.d.ts +7 -1
- package/dist/components/EditViewBinding.js +802 -0
- package/dist/components/EditViewBinding.js.map +1 -0
- package/dist/components/EntityDisplayHeader.js +139 -0
- package/dist/components/EntityDisplayHeader.js.map +1 -0
- package/dist/components/EntityFormPanel.d.ts +58 -0
- package/dist/components/EntityFormPanel.js +126 -0
- package/dist/components/EntityFormPanel.js.map +1 -0
- package/dist/components/EntityIdentityBar.d.ts +29 -4
- package/dist/components/EntityIdentityBar.js +364 -0
- package/dist/components/EntityIdentityBar.js.map +1 -0
- package/dist/components/EntityInspector.js +96 -0
- package/dist/components/EntityInspector.js.map +1 -0
- package/dist/components/EntityPreviewBinding.js +282 -0
- package/dist/components/EntityPreviewBinding.js.map +1 -0
- package/dist/components/EntityPreviewNesting.js +53 -0
- package/dist/components/EntityPreviewNesting.js.map +1 -0
- package/dist/components/EntityViewBinding.js +246 -0
- package/dist/components/EntityViewBinding.js.map +1 -0
- package/dist/components/FieldCaption.js +17 -0
- package/dist/components/FieldCaption.js.map +1 -0
- package/dist/components/HomePage/ContentHomePage.js +326 -0
- package/dist/components/HomePage/ContentHomePage.js.map +1 -0
- package/dist/components/HomePage/FavouritesView.js +44 -0
- package/dist/components/HomePage/FavouritesView.js.map +1 -0
- package/dist/components/HomePage/HomePageDnD.js +436 -0
- package/dist/components/HomePage/HomePageDnD.js.map +1 -0
- package/dist/components/HomePage/NavigationCard.js +59 -0
- package/dist/components/HomePage/NavigationCard.js.map +1 -0
- package/dist/components/HomePage/NavigationCardBinding.js +70 -0
- package/dist/components/HomePage/NavigationCardBinding.js.map +1 -0
- package/dist/components/HomePage/NavigationGroup.js +98 -0
- package/dist/components/HomePage/NavigationGroup.js.map +1 -0
- package/dist/components/HomePage/RenameGroupDialog.js +89 -0
- package/dist/components/HomePage/RenameGroupDialog.js.map +1 -0
- package/dist/components/InlineEntityPreview.js +116 -0
- package/dist/components/InlineEntityPreview.js.map +1 -0
- package/dist/{JsonPreviewBinding-v0w3H0fp.js → components/JsonPreviewBinding.js} +2 -2
- package/dist/components/JsonPreviewBinding.js.map +1 -0
- package/dist/components/NavigationLoadingErrorView.d.ts +16 -0
- package/dist/components/NavigationLoadingErrorView.js +27 -0
- package/dist/components/NavigationLoadingErrorView.js.map +1 -0
- package/dist/components/PickerTrigger.js +27 -0
- package/dist/components/PickerTrigger.js.map +1 -0
- package/dist/components/PropertyCollectionView.js +215 -0
- package/dist/components/PropertyCollectionView.js.map +1 -0
- package/dist/components/PropertyConfigBadge.js +19 -0
- package/dist/components/PropertyConfigBadge.js.map +1 -0
- package/dist/components/PropertyKeyHint.js +58 -0
- package/dist/components/PropertyKeyHint.js.map +1 -0
- package/dist/components/RebaseAuthGate.js +35 -0
- package/dist/components/RebaseAuthGate.js.map +1 -0
- package/dist/components/RebaseCMS.js +44 -0
- package/dist/components/RebaseCMS.js.map +1 -0
- package/dist/components/RebaseLayout.js +59 -0
- package/dist/components/RebaseLayout.js.map +1 -0
- package/dist/components/RebaseNavigation.js +215 -0
- package/dist/components/RebaseNavigation.js.map +1 -0
- package/dist/components/RebaseRouteDefs.js +96 -0
- package/dist/components/RebaseRouteDefs.js.map +1 -0
- package/dist/components/RebaseShell.js +50 -0
- package/dist/components/RebaseShell.js.map +1 -0
- package/dist/components/ReferenceTable/SelectionTableBinding.js +224 -0
- package/dist/components/ReferenceTable/SelectionTableBinding.js.map +1 -0
- package/dist/components/ReferenceWidget.js +100 -0
- package/dist/components/ReferenceWidget.js.map +1 -0
- package/dist/components/RelationSelector.js +625 -0
- package/dist/components/RelationSelector.js.map +1 -0
- package/dist/components/SearchIconsView.js +52 -0
- package/dist/components/SearchIconsView.js.map +1 -0
- package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
- package/dist/components/SelectableTable/SelectableTable.js +158 -0
- package/dist/components/SelectableTable/SelectableTable.js.map +1 -0
- package/dist/components/SelectableTable/SelectableTableContext.js +8 -0
- package/dist/components/SelectableTable/SelectableTableContext.js.map +1 -0
- package/dist/components/SelectableTable/SelectionStore.js +29 -0
- package/dist/components/SelectableTable/SelectionStore.js.map +1 -0
- package/dist/components/SelectableTable/filters/BooleanFilterField.js +28 -0
- package/dist/components/SelectableTable/filters/BooleanFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/DateTimeFilterField.d.ts +2 -1
- package/dist/components/SelectableTable/filters/DateTimeFilterField.js +93 -0
- package/dist/components/SelectableTable/filters/DateTimeFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/FilterFieldBinding.js +132 -0
- package/dist/components/SelectableTable/filters/FilterFieldBinding.js.map +1 -0
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js +157 -0
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/RelationFilterField.js +169 -0
- package/dist/components/SelectableTable/filters/RelationFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/StringNumberFilterField.js +181 -0
- package/dist/components/SelectableTable/filters/StringNumberFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/null_filter.js +36 -0
- package/dist/components/SelectableTable/filters/null_filter.js.map +1 -0
- package/dist/components/SideDialogs.js +149 -0
- package/dist/components/SideDialogs.js.map +1 -0
- package/dist/components/SidePanelBinding.js +287 -0
- package/dist/components/SidePanelBinding.js.map +1 -0
- package/dist/components/SidePanelProvider.js +69 -0
- package/dist/components/SidePanelProvider.js.map +1 -0
- package/dist/components/UserSelector.d.ts +2 -0
- package/dist/components/UserSelector.js +418 -0
- package/dist/components/UserSelector.js.map +1 -0
- package/dist/components/admin/CreationResultDialog.js +118 -0
- package/dist/components/admin/CreationResultDialog.js.map +1 -0
- package/dist/components/app/AppBar.js +14 -0
- package/dist/components/app/AppBar.js.map +1 -0
- package/dist/components/app/Drawer.js +26 -0
- package/dist/components/app/Drawer.js.map +1 -0
- package/dist/components/app/Scaffold.js +229 -0
- package/dist/components/app/Scaffold.js.map +1 -0
- package/dist/components/app/useApp.js +24 -0
- package/dist/components/app/useApp.js.map +1 -0
- package/dist/components/common/ActionMenuLabel.d.ts +15 -0
- package/dist/components/common/ActionMenuLabel.js +30 -0
- package/dist/components/common/ActionMenuLabel.js.map +1 -0
- package/dist/components/common/default_entity_actions.d.ts +37 -0
- package/dist/components/common/default_entity_actions.js +590 -0
- package/dist/components/common/default_entity_actions.js.map +1 -0
- package/dist/components/drawer_expansion.d.ts +25 -0
- package/dist/components/drawer_expansion.js +44 -0
- package/dist/components/drawer_expansion.js.map +1 -0
- package/dist/components/field_configs.d.ts +2 -2
- package/dist/components/field_configs.js +431 -0
- package/dist/components/field_configs.js.map +1 -0
- package/dist/components/field_ids.d.ts +11 -0
- package/dist/components/field_ids.js +58 -0
- package/dist/components/field_ids.js.map +1 -0
- package/dist/components/history/EntityHistoryEntry.js +151 -0
- package/dist/components/history/EntityHistoryEntry.js.map +1 -0
- package/dist/components/history/EntityHistoryView.js +157 -0
- package/dist/components/history/EntityHistoryView.js.map +1 -0
- package/dist/components/history/UserChip.js +21 -0
- package/dist/components/history/UserChip.js.map +1 -0
- package/dist/components/history/index.js +4 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/lazy_record_views.d.ts +10 -0
- package/dist/components/lazy_record_views.js +57 -0
- package/dist/components/lazy_record_views.js.map +1 -0
- package/dist/contexts/BreacrumbsContext.js +28 -0
- package/dist/contexts/BreacrumbsContext.js.map +1 -0
- package/dist/contexts/EditorAIControllerContext.d.ts +18 -0
- package/dist/contexts/EditorAIControllerContext.js +29 -0
- package/dist/contexts/EditorAIControllerContext.js.map +1 -0
- package/dist/contexts/SideDialogsControllerContext.js +7 -0
- package/dist/contexts/SideDialogsControllerContext.js.map +1 -0
- package/dist/data_export/export/BasicExportAction.js +151 -0
- package/dist/data_export/export/BasicExportAction.js.map +1 -0
- package/dist/data_export/export/ExportCollectionAction.js +297 -0
- package/dist/data_export/export/ExportCollectionAction.js.map +1 -0
- package/dist/data_export/export/additional_fields.js +40 -0
- package/dist/data_export/export/additional_fields.js.map +1 -0
- package/dist/data_export/export/export.d.ts +35 -0
- package/dist/data_export/export/export.js +400 -0
- package/dist/data_export/export/export.js.map +1 -0
- package/dist/data_export/export/fetch_export_data.d.ts +17 -7
- package/dist/data_export/export/fetch_export_data.js +67 -0
- package/dist/data_export/export/fetch_export_data.js.map +1 -0
- package/dist/data_export/export/index.d.ts +4 -2
- package/dist/data_export/export/index.js +5 -0
- package/dist/data_import/components/DataNewPropertiesMapping.js +207 -0
- package/dist/data_import/components/DataNewPropertiesMapping.js.map +1 -0
- package/dist/data_import/components/ImportConversionProblems.d.ts +11 -0
- package/dist/data_import/components/ImportConversionProblems.js +89 -0
- package/dist/data_import/components/ImportConversionProblems.js.map +1 -0
- package/dist/data_import/components/ImportFileUpload.js +43 -0
- package/dist/data_import/components/ImportFileUpload.js.map +1 -0
- package/dist/data_import/components/ImportNewPropertyFieldPreview.js +42 -0
- package/dist/data_import/components/ImportNewPropertyFieldPreview.js.map +1 -0
- package/dist/data_import/components/ImportSaveInProgress.js +105 -0
- package/dist/data_import/components/ImportSaveInProgress.js.map +1 -0
- package/dist/data_import/components/index.d.ts +1 -0
- package/dist/data_import/hooks/useImportConfig.js +34 -0
- package/dist/data_import/hooks/useImportConfig.js.map +1 -0
- package/dist/{import-TCgkTVlS.js → data_import/import/ImportCollectionAction.js} +84 -92
- package/dist/data_import/import/ImportCollectionAction.js.map +1 -0
- package/dist/data_import/import/index.js +2 -0
- package/dist/data_import/utils/csv.js +146 -0
- package/dist/data_import/utils/csv.js.map +1 -0
- package/dist/data_import/utils/data.d.ts +81 -4
- package/dist/data_import/utils/data.js +366 -0
- package/dist/data_import/utils/data.js.map +1 -0
- package/dist/data_import/utils/file_headers.js +32 -0
- package/dist/data_import/utils/file_headers.js.map +1 -0
- package/dist/data_import/utils/file_to_json.js +149 -0
- package/dist/data_import/utils/file_to_json.js.map +1 -0
- package/dist/data_import/utils/get_import_inference_type.js +14 -0
- package/dist/data_import/utils/get_import_inference_type.js.map +1 -0
- package/dist/data_import/utils/id_column.js +27 -0
- package/dist/data_import/utils/id_column.js.map +1 -0
- package/dist/data_import/utils/import_columns.d.ts +48 -0
- package/dist/data_import/utils/import_columns.js +92 -0
- package/dist/data_import/utils/import_columns.js.map +1 -0
- package/dist/data_import/utils/save_entities.d.ts +33 -4
- package/dist/data_import/utils/save_entities.js +244 -0
- package/dist/data_import/utils/save_entities.js.map +1 -0
- package/dist/data_import/utils/transforms.js +83 -0
- package/dist/data_import/utils/transforms.js.map +1 -0
- package/dist/editor/components/SlashCommandMenu.js +497 -0
- package/dist/editor/components/SlashCommandMenu.js.map +1 -0
- package/dist/editor/components/editor-bubble-item.js +24 -0
- package/dist/editor/components/editor-bubble-item.js.map +1 -0
- package/dist/editor/components/editor-bubble.js +97 -0
- package/dist/editor/components/editor-bubble.js.map +1 -0
- package/dist/editor/components/image-bubble.js +148 -0
- package/dist/editor/components/image-bubble.js.map +1 -0
- package/dist/editor/components/table-bubble.js +406 -0
- package/dist/editor/components/table-bubble.js.map +1 -0
- package/dist/editor/editor.d.ts +7 -1
- package/dist/editor/editor.js +423 -0
- package/dist/editor/editor.js.map +1 -0
- package/dist/editor/extensions/HighlightDecorationExtension.js +74 -0
- package/dist/editor/extensions/HighlightDecorationExtension.js.map +1 -0
- package/dist/editor/extensions/Image.d.ts +28 -1
- package/dist/editor/extensions/Image.js +160 -0
- package/dist/editor/extensions/Image.js.map +1 -0
- package/dist/editor/extensions/TextLoadingDecorationExtension.js +82 -0
- package/dist/editor/extensions/TextLoadingDecorationExtension.js.map +1 -0
- package/dist/editor/extensions/clipboard.js +63 -0
- package/dist/editor/extensions/clipboard.js.map +1 -0
- package/dist/editor/extensions/drag-and-drop.js +354 -0
- package/dist/editor/extensions/drag-and-drop.js.map +1 -0
- package/dist/editor/hooks/useProseMirror.d.ts +4 -1
- package/dist/editor/hooks/useProseMirror.js +101 -0
- package/dist/editor/hooks/useProseMirror.js.map +1 -0
- package/dist/editor/hooks/useProseMirrorContext.js +11 -0
- package/dist/editor/hooks/useProseMirrorContext.js.map +1 -0
- package/dist/editor/markdown.js +154 -0
- package/dist/editor/markdown.js.map +1 -0
- package/dist/editor/nodeViews/ImageComponent.js +35 -0
- package/dist/editor/nodeViews/ImageComponent.js.map +1 -0
- package/dist/editor/nodeViews/ReactNodeView.js +57 -0
- package/dist/editor/nodeViews/ReactNodeView.js.map +1 -0
- package/dist/editor/nodeViews/TaskItemComponent.js +29 -0
- package/dist/editor/nodeViews/TaskItemComponent.js.map +1 -0
- package/dist/editor/nodeViews/index.js +21 -0
- package/dist/editor/nodeViews/index.js.map +1 -0
- package/dist/editor/plugins/index.js +54 -0
- package/dist/editor/plugins/index.js.map +1 -0
- package/dist/editor/plugins/inputrules.js +54 -0
- package/dist/editor/plugins/inputrules.js.map +1 -0
- package/dist/editor/plugins/placeholderPlugin.js +38 -0
- package/dist/editor/plugins/placeholderPlugin.js.map +1 -0
- package/dist/editor/plugins/slashCommandPlugin.js +40 -0
- package/dist/editor/plugins/slashCommandPlugin.js.map +1 -0
- package/dist/editor/sanitize-html.js +190 -0
- package/dist/editor/sanitize-html.js.map +1 -0
- package/dist/{markdown-CCqp8ibf.js → editor/schema.js} +2 -159
- package/dist/editor/schema.js.map +1 -0
- package/dist/editor/selectors/link-selector.js +118 -0
- package/dist/editor/selectors/link-selector.js.map +1 -0
- package/dist/editor/selectors/node-selector.js +118 -0
- package/dist/editor/selectors/node-selector.js.map +1 -0
- package/dist/editor/selectors/text-buttons.js +71 -0
- package/dist/editor/selectors/text-buttons.js.map +1 -0
- package/dist/editor/utils/prosemirror-utils.js +92 -0
- package/dist/editor/utils/prosemirror-utils.js.map +1 -0
- package/dist/editor/utils/remove_classes.js +16 -0
- package/dist/editor/utils/remove_classes.js.map +1 -0
- package/dist/editor.js +1 -3085
- package/dist/form/EntityForm.js +734 -0
- package/dist/form/EntityForm.js.map +1 -0
- package/dist/form/EntityFormActions.js +101 -0
- package/dist/form/EntityFormActions.js.map +1 -0
- package/dist/form/EntityFormBinding.js +256 -0
- package/dist/form/EntityFormBinding.js.map +1 -0
- package/dist/form/PropertyFieldBinding.js +298 -0
- package/dist/form/PropertyFieldBinding.js.map +1 -0
- package/dist/form/components/ErrorFocus.js +33 -0
- package/dist/form/components/ErrorFocus.js.map +1 -0
- package/dist/form/components/FieldBlock.js +118 -0
- package/dist/form/components/FieldBlock.js.map +1 -0
- package/dist/form/components/FieldHelperText.js +56 -0
- package/dist/form/components/FieldHelperText.js.map +1 -0
- package/dist/form/components/FormRail.js +118 -0
- package/dist/form/components/FormRail.js.map +1 -0
- package/dist/form/components/FormSections.js +63 -0
- package/dist/form/components/FormSections.js.map +1 -0
- package/dist/form/components/LabelWithIcon.js +29 -0
- package/dist/form/components/LabelWithIcon.js.map +1 -0
- package/dist/form/components/LocalChangesMenu.js +127 -0
- package/dist/form/components/LocalChangesMenu.js.map +1 -0
- package/dist/form/components/StorageItemPreview.js +46 -0
- package/dist/form/components/StorageItemPreview.js.map +1 -0
- package/dist/form/components/StorageUploadProgress.js +84 -0
- package/dist/form/components/StorageUploadProgress.js.map +1 -0
- package/dist/form/components/useRailVisible.js +43 -0
- package/dist/form/components/useRailVisible.js.map +1 -0
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js +84 -0
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js +125 -0
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/BinaryFieldBinding.js +135 -0
- package/dist/form/field_bindings/BinaryFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/BlockFieldBinding.js +164 -0
- package/dist/form/field_bindings/BlockFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/DateTimeFieldBinding.js +47 -0
- package/dist/form/field_bindings/DateTimeFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/GeopointFieldBinding.js +148 -0
- package/dist/form/field_bindings/GeopointFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/KeyValueFieldBinding.js +450 -0
- package/dist/form/field_bindings/KeyValueFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MapFieldBinding.js +77 -0
- package/dist/form/field_bindings/MapFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js +215 -0
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MultiSelectFieldBinding.js +88 -0
- package/dist/form/field_bindings/MultiSelectFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js +118 -0
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/ReadOnlyFieldBinding.js +52 -0
- package/dist/form/field_bindings/ReadOnlyFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/ReferenceFieldBinding.js +99 -0
- package/dist/form/field_bindings/ReferenceFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/RelationFieldBinding.js +135 -0
- package/dist/form/field_bindings/RelationFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/RepeatFieldBinding.js +103 -0
- package/dist/form/field_bindings/RepeatFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/SelectFieldBinding.js +80 -0
- package/dist/form/field_bindings/SelectFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/StorageUploadFieldBinding.js +266 -0
- package/dist/form/field_bindings/StorageUploadFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/SwitchFieldBinding.js +41 -0
- package/dist/form/field_bindings/SwitchFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/TextFieldBinding.js +114 -0
- package/dist/form/field_bindings/TextFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/UserSelectFieldBinding.js +48 -0
- package/dist/form/field_bindings/UserSelectFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/VectorFieldBinding.js +147 -0
- package/dist/form/field_bindings/VectorFieldBinding.js.map +1 -0
- package/dist/form/form_keyboard_scope.d.ts +26 -0
- package/dist/form/form_keyboard_scope.js +39 -0
- package/dist/form/form_keyboard_scope.js.map +1 -0
- package/dist/form/form_uploads.d.ts +24 -0
- package/dist/form/form_uploads.js +31 -0
- package/dist/form/form_uploads.js.map +1 -0
- package/dist/form/form_utils.d.ts +48 -0
- package/dist/form/form_utils.js +280 -0
- package/dist/form/form_utils.js.map +1 -0
- package/dist/form/resolve_cell_property.d.ts +32 -0
- package/dist/form/resolve_cell_property.js +80 -0
- package/dist/form/resolve_cell_property.js.map +1 -0
- package/dist/form/resolve_form_properties.d.ts +27 -0
- package/dist/form/resolve_form_properties.js +78 -0
- package/dist/form/resolve_form_properties.js.map +1 -0
- package/dist/form/useClearRestoreValue.js +27 -0
- package/dist/form/useClearRestoreValue.js.map +1 -0
- package/dist/form/useUndoableDiscard.js +36 -0
- package/dist/form/useUndoableDiscard.js.map +1 -0
- package/dist/form/validation.d.ts +20 -0
- package/dist/form/validation.js +416 -0
- package/dist/form/validation.js.map +1 -0
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.js +22 -0
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.js.map +1 -0
- package/dist/hooks/navigation/contexts/NavigationStateContext.js +15 -0
- package/dist/hooks/navigation/contexts/NavigationStateContext.js.map +1 -0
- package/dist/hooks/navigation/contexts/UrlContext.js +22 -0
- package/dist/hooks/navigation/contexts/UrlContext.js.map +1 -0
- package/dist/hooks/navigation/useAsyncResolver.js +68 -0
- package/dist/hooks/navigation/useAsyncResolver.js.map +1 -0
- package/dist/hooks/navigation/useBuildCollectionRegistryController.js +141 -0
- package/dist/hooks/navigation/useBuildCollectionRegistryController.js.map +1 -0
- package/dist/hooks/navigation/useBuildNavigationStateController.js +77 -0
- package/dist/hooks/navigation/useBuildNavigationStateController.js.map +1 -0
- package/dist/hooks/navigation/useBuildUrlController.js +57 -0
- package/dist/hooks/navigation/useBuildUrlController.js.map +1 -0
- package/dist/hooks/navigation/useNavigationResolution.js +177 -0
- package/dist/hooks/navigation/useNavigationResolution.js.map +1 -0
- package/dist/hooks/navigation/useResolvedCollections.js +56 -0
- package/dist/hooks/navigation/useResolvedCollections.js.map +1 -0
- package/dist/hooks/navigation/useResolvedViews.js +94 -0
- package/dist/hooks/navigation/useResolvedViews.js.map +1 -0
- package/dist/hooks/navigation/useTopLevelNavigation.js +162 -0
- package/dist/hooks/navigation/useTopLevelNavigation.js.map +1 -0
- package/dist/hooks/navigation/utils.js +125 -0
- package/dist/hooks/navigation/utils.js.map +1 -0
- package/dist/hooks/useAdminContext.js +45 -0
- package/dist/hooks/useAdminContext.js.map +1 -0
- package/dist/hooks/useBreadcrumbsController.js +17 -0
- package/dist/hooks/useBreadcrumbsController.js.map +1 -0
- package/dist/hooks/useBuildSideDialogsController.js +96 -0
- package/dist/hooks/useBuildSideDialogsController.js.map +1 -0
- package/dist/hooks/useBuildSidePanel.js +221 -0
- package/dist/hooks/useBuildSidePanel.js.map +1 -0
- package/dist/hooks/useChildViewSource.js +41 -0
- package/dist/hooks/useChildViewSource.js.map +1 -0
- package/dist/hooks/useEntityDisplay.js +136 -0
- package/dist/hooks/useEntityDisplay.js.map +1 -0
- package/dist/hooks/useEntityDisplayTitle.js +34 -0
- package/dist/hooks/useEntityDisplayTitle.js.map +1 -0
- package/dist/hooks/useHistory.js +137 -0
- package/dist/hooks/useHistory.js.map +1 -0
- package/dist/hooks/useRecordActions.d.ts +28 -6
- package/dist/hooks/useRecordActions.js +108 -0
- package/dist/hooks/useRecordActions.js.map +1 -0
- package/dist/hooks/useReferencePaths.d.ts +21 -0
- package/dist/hooks/useReferencePaths.js +32 -0
- package/dist/hooks/useReferencePaths.js.map +1 -0
- package/dist/hooks/useResolvedNavigationFrom.js +83 -0
- package/dist/hooks/useResolvedNavigationFrom.js.map +1 -0
- package/dist/hooks/useResolvedUsers.js +109 -0
- package/dist/hooks/useResolvedUsers.js.map +1 -0
- package/dist/hooks/useSelectionDialog.js +53 -0
- package/dist/hooks/useSelectionDialog.js.map +1 -0
- package/dist/hooks/useSideDialogsController.js +8 -0
- package/dist/hooks/useSideDialogsController.js.map +1 -0
- package/dist/hooks/useSidePanel.js +15 -0
- package/dist/hooks/useSidePanel.js.map +1 -0
- package/dist/hooks/useStorageReferenceResolver.d.ts +25 -0
- package/dist/hooks/useStorageReferenceResolver.js +49 -0
- package/dist/hooks/useStorageReferenceResolver.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +151 -3793
- package/dist/preview/PropertyPreview.js +260 -0
- package/dist/preview/PropertyPreview.js.map +1 -0
- package/dist/preview/compact_text.js +52 -0
- package/dist/preview/compact_text.js.map +1 -0
- package/dist/preview/components/ArrayEnumPreview.js +24 -0
- package/dist/preview/components/ArrayEnumPreview.js.map +1 -0
- package/dist/preview/components/BooleanPreview.js +25 -0
- package/dist/preview/components/BooleanPreview.js.map +1 -0
- package/dist/preview/components/DatePreview.d.ts +3 -2
- package/dist/preview/components/DatePreview.js +87 -0
- package/dist/preview/components/DatePreview.js.map +1 -0
- package/dist/preview/components/EmptyValue.js +13 -0
- package/dist/preview/components/EmptyValue.js.map +1 -0
- package/dist/preview/components/EnumValuesChip.js +26 -0
- package/dist/preview/components/EnumValuesChip.js.map +1 -0
- package/dist/preview/components/ImagePreview.d.ts +7 -1
- package/dist/preview/components/ImagePreview.js +112 -0
- package/dist/preview/components/ImagePreview.js.map +1 -0
- package/dist/preview/components/InlineEntityListPreview.js +31 -0
- package/dist/preview/components/InlineEntityListPreview.js.map +1 -0
- package/dist/preview/components/ReferencePreview.js +162 -0
- package/dist/preview/components/ReferencePreview.js.map +1 -0
- package/dist/preview/components/RelationPreview.js +196 -0
- package/dist/preview/components/RelationPreview.js.map +1 -0
- package/dist/preview/components/StorageMarkdown.d.ts +11 -0
- package/dist/preview/components/StorageMarkdown.js +49 -0
- package/dist/preview/components/StorageMarkdown.js.map +1 -0
- package/dist/preview/components/StorageThumbnail.js +183 -0
- package/dist/preview/components/StorageThumbnail.js.map +1 -0
- package/dist/preview/components/UrlComponentPreview.d.ts +3 -1
- package/dist/preview/components/UrlComponentPreview.js +88 -0
- package/dist/preview/components/UrlComponentPreview.js.map +1 -0
- package/dist/preview/components/UserPreview.js +30 -0
- package/dist/preview/components/UserPreview.js.map +1 -0
- package/dist/preview/components/date_fns_locales.js +124 -0
- package/dist/preview/components/date_fns_locales.js.map +1 -0
- package/dist/preview/components/storageRenditions.d.ts +10 -0
- package/dist/preview/components/storageRenditions.js +95 -0
- package/dist/preview/components/storageRenditions.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfMapsPreview.js +44 -0
- package/dist/preview/property_previews/ArrayOfMapsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfReferencesPreview.js +48 -0
- package/dist/preview/property_previews/ArrayOfReferencesPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfRelationsPreview.js +50 -0
- package/dist/preview/property_previews/ArrayOfRelationsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.js +30 -0
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfStringsPreview.js +42 -0
- package/dist/preview/property_previews/ArrayOfStringsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOneOfPreview.js +47 -0
- package/dist/preview/property_previews/ArrayOneOfPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.js +25 -0
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayPropertyPreview.js +48 -0
- package/dist/preview/property_previews/ArrayPropertyPreview.js.map +1 -0
- package/dist/preview/property_previews/MapPropertyPreview.js +137 -0
- package/dist/preview/property_previews/MapPropertyPreview.js.map +1 -0
- package/dist/preview/property_previews/NumberPropertyPreview.js +34 -0
- package/dist/preview/property_previews/NumberPropertyPreview.js.map +1 -0
- package/dist/preview/property_previews/SkeletonPropertyComponent.js +151 -0
- package/dist/preview/property_previews/SkeletonPropertyComponent.js.map +1 -0
- package/dist/preview/property_previews/StringPropertyPreview.js +49 -0
- package/dist/preview/property_previews/StringPropertyPreview.js.map +1 -0
- package/dist/preview/util.d.ts +8 -3
- package/dist/{util-CC0ozHoD.js → preview/util.js} +13 -6
- package/dist/preview/util.js.map +1 -0
- package/dist/routes/CustomViewRoute.js +26 -0
- package/dist/routes/CustomViewRoute.js.map +1 -0
- package/dist/routes/RebaseRoute.js +311 -0
- package/dist/routes/RebaseRoute.js.map +1 -0
- package/dist/selection/SelectionMenu.js +90 -0
- package/dist/selection/SelectionMenu.js.map +1 -0
- package/dist/selection/resolve_selection.js +79 -0
- package/dist/selection/resolve_selection.js.map +1 -0
- package/dist/util/caller_scopes.d.ts +15 -0
- package/dist/util/caller_scopes.js +25 -0
- package/dist/util/caller_scopes.js.map +1 -0
- package/dist/util/collection_open_mode.d.ts +20 -0
- package/dist/util/collection_open_mode.js +32 -0
- package/dist/util/collection_open_mode.js.map +1 -0
- package/dist/util/dataControllerAdapter.js +65 -0
- package/dist/util/dataControllerAdapter.js.map +1 -0
- package/dist/util/entity_actions.d.ts +42 -1
- package/dist/util/entity_actions.js +77 -0
- package/dist/util/entity_actions.js.map +1 -0
- package/dist/util/entity_pages.d.ts +37 -3
- package/dist/util/entity_pages.js +71 -0
- package/dist/util/entity_pages.js.map +1 -0
- package/dist/util/find_entities_by_ids.d.ts +23 -0
- package/dist/util/find_entities_by_ids.js +55 -0
- package/dist/util/find_entities_by_ids.js.map +1 -0
- package/dist/util/fit_inline_actions.d.ts +20 -0
- package/dist/util/fit_inline_actions.js +40 -0
- package/dist/util/fit_inline_actions.js.map +1 -0
- package/dist/util/format_collection_date.d.ts +29 -0
- package/dist/util/format_collection_date.js +60 -0
- package/dist/util/format_collection_date.js.map +1 -0
- package/dist/util/map_with_concurrency.js +46 -0
- package/dist/util/map_with_concurrency.js.map +1 -0
- package/dist/util/navigation_utils.js +45 -0
- package/dist/util/navigation_utils.js.map +1 -0
- package/dist/util/number_format.js +33 -0
- package/dist/util/number_format.js.map +1 -0
- package/dist/util/previews.js +71 -0
- package/dist/util/previews.js.map +1 -0
- package/dist/util/propertyConfigMapper.js +83 -0
- package/dist/util/propertyConfigMapper.js.map +1 -0
- package/dist/util/property_utils.js +141 -0
- package/dist/util/property_utils.js.map +1 -0
- package/dist/util/resolutions.js +55 -0
- package/dist/util/resolutions.js.map +1 -0
- package/dist/util/view_constants.js +35 -0
- package/dist/util/view_constants.js.map +1 -0
- package/dist/util/view_mode.js +112 -0
- package/dist/util/view_mode.js.map +1 -0
- package/package.json +13 -9
- package/dist/CollectionEditorDialog-DLHCka00.js +0 -3630
- package/dist/CollectionEditorDialog-DLHCka00.js.map +0 -1
- package/dist/JsonPreviewBinding-v0w3H0fp.js.map +0 -1
- package/dist/PropertyEditView-_pu5hzZn.js +0 -3837
- package/dist/PropertyEditView-_pu5hzZn.js.map +0 -1
- package/dist/RouterCollectionsStudioView-ChPNl_uU.js +0 -212
- package/dist/RouterCollectionsStudioView-ChPNl_uU.js.map +0 -1
- package/dist/SchemaChangeDialog-BeP0A4MJ.js.map +0 -1
- package/dist/collection_editor/ui/CollectionViewHeaderAction.d.ts +0 -13
- package/dist/collection_editor/ui/PropertyAddColumnComponent.d.ts +0 -8
- package/dist/collection_editor_ui.js.map +0 -1
- package/dist/editor.js.map +0 -1
- package/dist/export-4bJWdlDK.js +0 -520
- package/dist/export-4bJWdlDK.js.map +0 -1
- package/dist/history-BElrZ5Rw.js +0 -313
- package/dist/history-BElrZ5Rw.js.map +0 -1
- package/dist/import-TCgkTVlS.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/markdown-CCqp8ibf.js.map +0 -1
- package/dist/rolldown-runtime-D7D4PA-g.js +0 -13
- package/dist/util-CC0ozHoD.js.map +0 -1
- package/dist/util-DybQBkug.js +0 -26390
- package/dist/util-DybQBkug.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CollectionEditorDialog.js","names":[],"sources":["../../../../src/collection_editor/ui/collection_editor/CollectionEditorDialog.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { useEffect, useRef, useState } from \"react\";\nimport {\n ConfirmationDialog,\n ErrorView,\n UnsavedChangesDialog,\n useAuthController,\n useCustomizationController,\n useUnsavedChangesDialog,\n useTranslation\n} from \"@rebasepro/app\";\nimport {\n getInferenceType,\n ImportSaveInProgress,\n useCollectionRegistryController,\n useImportConfig,\n useNavigationStateController,\n useUrlController\n} from \"../../_cms_internals\";\nimport { useSafeSnackbarController } from \"../../useSafeSnackbarController\";\nimport {\n ArrowLeftIcon,\n Button,\n CheckIcon,\n CircularProgressCenter,\n cls,\n coolIconKeys,\n defaultBorderMixin,\n Dialog,\n DialogTitle,\n IconButton,\n LoadingButton,\n Tab,\n Tabs,\n Tooltip,\n Typography\n} from \"@rebasepro/ui\";\nimport { EngineProperties, Entity, getDataSourceCapabilities, MapProperty, Properties, Property, TableMetadata, User } from \"@rebasepro/types\";\nimport { PropertyConfig, AdminCollection } from \"@rebasepro/cms-types\";\nimport { getSubcollections, getTableName, isPropertyBuilder } from \"@rebasepro/common\";\nimport { removeInitialAndTrailingSlashes } from \"@rebasepro/app\";\nimport { isSchemaChangeCancelled } from \"../../liveSchemaClient\";\nimport { CollectionEditorSchema } from \"./CollectionYupValidation\";\nimport { GeneralSettingsForm } from \"./GeneralSettingsForm\";\nimport { DisplaySettingsForm } from \"./DisplaySettingsForm\";\nimport { CollectionPropertiesEditorForm } from \"./CollectionPropertiesEditorForm\";\nimport { CollectionsConfigController } from \"../../types/config_controller\";\nimport { CollectionEditorWelcomeView } from \"./CollectionEditorWelcomeView\";\nimport { CollectionInference } from \"../../types/collection_inference\";\nimport { buildEntityPropertiesFromData } from \"@rebasepro/inference\";\nimport { CollectionEditorImportMapping } from \"./import/CollectionEditorImportMapping\";\nimport { CollectionEditorImportDataPreview } from \"./import/CollectionEditorImportDataPreview\";\nimport { cleanPropertiesFromImport, importedColumnOrder } from \"./import/clean_import_data\";\nimport { Formex, FormexController, useCreateFormex } from \"@rebasepro/forms\";\nimport { getFullIdPath } from \"./util\";\nimport { AICollectionGeneratorPopover } from \"./AICollectionGeneratorPopover\";\nimport { AIModifiedPathsProvider, useAIModifiedPaths } from \"./AIModifiedPathsContext\";\nimport { CollectionGenerationCallback, CollectionOperation } from \"../../api/generateCollectionApi\";\nimport { CollectionRLSTab } from \"./CollectionRLSTab\";\nimport { buildCollectionFromTableMetadata } from \"@rebasepro/common\";\nimport { mergeDeep, randomString, removeUndefined } from \"@rebasepro/utils\";\nimport type { CollectionEditorExtensionProps, CollectionEditorTab } from \"../../extensibility_types\";\n\nexport interface CollectionEditorDialogProps extends CollectionEditorExtensionProps {\n open: boolean;\n isNewCollection: boolean;\n initialValues?: {\n slug?: string,\n name?: string,\n }\n /**\n * A collection to duplicate from. If provided, the new collection will be\n * pre-populated with the same properties (but with empty name, path, and id).\n */\n copyFrom?: AdminCollection;\n editedCollectionId?: string;\n path?: string; // full path of this particular collection, like `products/123/locales`\n parentCollectionSlugs?: string[], parentEntityIds?: string[]; // path ids of the parent collection, like [`products`]\n handleClose: (collection?: AdminCollection) => void;\n configController: CollectionsConfigController;\n collectionInference?: CollectionInference;\n extraView?: {\n View: React.ComponentType<{\n path: string\n }>,\n icon: React.ReactNode | any\n };\n getUser?: (uid: string) => User | null;\n getData?: (path: string, parentPaths: string[]) => Promise<object[]>;\n parentCollection?: AdminCollection;\n existingEntities?: Entity<any>[];\n /**\n * Initial view to open when editing: \"general\", \"display\", or \"properties\".\n * For new collections, this is ignored.\n */\n initialView?: \"general\" | \"display\" | \"properties\";\n /**\n * If true, auto-expand the Kanban configuration section.\n */\n expandKanban?: boolean;\n /**\n * Callback function for generating/modifying collections.\n * The plugin is API-agnostic - the consumer provides the implementation.\n */\n generateCollection?: CollectionGenerationCallback;\n /**\n * Optional analytics callback\n */\n onAnalyticsEvent?: (event: string, params?: object) => void;\n /**\n * If true, it indicates that the editor is rendered inline (not in a dialog) and therefore updates headers and footers to adapt to the layout.\n */\n fullScreen?: boolean;\n /**\n * List of unmapped database tables available for import.\n */\n unmappedTables?: string[];\n /**\n * Callback to fetch column metadata for a table.\n */\n onFetchTableMetadata?: (tableName: string) => Promise<TableMetadata | undefined>;\n}\n\nexport function CollectionEditorDialog(props: CollectionEditorDialogProps) {\n\n const open = props.open;\n\n const [formDirty, setFormDirty] = React.useState<boolean>(false);\n\n const { dialogProps, triggerDialog } = useUnsavedChangesDialog(\n open && formDirty,\n () => props.handleClose(undefined)\n );\n\n const handleCancel = () => {\n if (!formDirty) {\n props.handleClose(undefined);\n } else {\n triggerDialog();\n }\n };\n\n useEffect(() => {\n if (!open) {\n setFormDirty(false);\n }\n }, [open]);\n\n return (\n <Dialog\n open={open}\n fullWidth={true}\n fullHeight={true}\n scrollable={false}\n maxWidth={\"7xl\"}\n className=\"bg-surface-sheet\"\n onOpenChange={(open) => !open ? handleCancel() : undefined}\n >\n <DialogTitle hidden>Collection editor</DialogTitle>\n <AIModifiedPathsProvider>\n {open && <CollectionEditor {...props}\n handleCancel={handleCancel}\n setFormDirty={setFormDirty}/>}\n\n <UnsavedChangesDialog {...dialogProps}/>\n </AIModifiedPathsProvider>\n </Dialog>\n );\n}\n\ntype EditorView = \"welcome\"\n | \"general\"\n | \"display\"\n | \"import_data_mapping\"\n | \"import_data_preview\"\n | \"import_data_saving\"\n | \"properties\"\n | \"loading\"\n | \"extra_view\"\n | \"rls\";\n\nexport function CollectionEditor(props: CollectionEditorDialogProps & {\n handleCancel: () => void,\n setFormDirty: (dirty: boolean) => void\n}) {\n const { standalone } = props;\n\n const customizationController = useCustomizationController();\n const navigationState = useNavigationStateController();\n const collectionRegistry = useCollectionRegistryController();\n const authController = useAuthController();\n\n // In standalone mode, use safe defaults instead of context values\n const propertyConfigs = standalone\n ? (customizationController?.propertyConfigs ?? {})\n : customizationController.propertyConfigs;\n const topLevelNavigation = standalone\n ? (navigationState?.topLevelNavigation ?? [])\n : navigationState.topLevelNavigation;\n const collections = standalone\n ? (collectionRegistry?.collections ?? [])\n : collectionRegistry.collections;\n\n const initialValuesProp = props.initialValues;\n const copyFromProp = props.copyFrom;\n // Skip templates when duplicating (copyFrom is provided)\n const includeTemplates = !copyFromProp && !initialValuesProp?.slug && (props.parentCollectionSlugs ?? []).length === 0;\n const collectionsInThisLevel = (props.parentCollection ? getSubcollections(props.parentCollection) : collections) ?? [];\n const existingPaths = collectionsInThisLevel.map(col => getTableName(col)?.trim().toLowerCase()).filter(Boolean);\n const existingIds = collectionsInThisLevel.map(col => col.slug?.trim().toLowerCase()).filter(Boolean) as string[];\n const [collection, setCollection] = React.useState<AdminCollection<any> | undefined>();\n const [initialLoadingCompleted, setInitialLoadingCompleted] = React.useState(false);\n\n useEffect(() => {\n try {\n const initialised = (standalone\n ? true\n : (collectionRegistry?.initialised ?? true)) && !props.configController?.loading;\n const getRawCollection = standalone\n ? (() => undefined)\n : collectionRegistry.getRawCollection;\n if (initialised) {\n if (props.editedCollectionId) {\n // We must use getRawCollection so the editor schema fields\n // aren't polluted with dynamically injected runtime `relations`.\n // The path lookup relies on generating a fake child path to resolve through the registry\n const collectionPath = [...(props.parentCollectionSlugs ?? []), props.editedCollectionId]\n .reduce((acc, segment, i) => i === 0 ? segment : `${acc}/fake_id/${segment}`, \"\");\n\n const registryCol = getRawCollection ? getRawCollection(collectionPath) : undefined;\n const configCol = props.configController?.collections?.find(c => c.slug === props.editedCollectionId);\n setCollection((registryCol ?? configCol) as AdminCollection<any>);\n } else {\n setCollection(undefined);\n }\n setInitialLoadingCompleted(true);\n }\n } catch (e) {\n console.error(e);\n }\n }, [props.editedCollectionId, props.parentCollectionSlugs, props.parentEntityIds, standalone, collectionRegistry.initialised, collectionRegistry.getRawCollection, props.configController.collections, props.configController.loading, collections]);\n\n const initialIcon = React.useMemo(() => coolIconKeys[Math.floor(Math.random() * coolIconKeys.length)], []);\n const fallbackSlug = React.useMemo(() => randomString(16), []);\n\n const initialCollection = React.useMemo(() => {\n return collection\n ? {\n ...collection,\n slug: collection.slug ?? fallbackSlug\n }\n : undefined;\n }, [collection, fallbackSlug]);\n\n // Build initial values - handle copyFrom for duplication\n const initialValues = React.useMemo((): AdminCollection<any> => {\n return (initialCollection\n ? applyPropertyConfigs(initialCollection, propertyConfigs)\n : copyFromProp\n ? (() => {\n // When duplicating, copy all properties but clear identifiers.\n //\n // \"Identifiers\" has to include the ones this dialog cannot\n // show. `schema` has no field anywhere in the editor, so a\n // duplicate of the Users collection — the one collection\n // scaffolded with `schema: \"rebase\"` — silently produced a\n // new collection whose table is created in `rebase` rather\n // than `public`, with nothing on screen to explain why.\n // Panel-authored collections are `public` collections.\n //\n // `slug`/`table` are cleared rather than carried: both are\n // re-derived from the name the user types (see\n // `updateName` in GeneralSettingsForm, which fills untouched\n // fields while `isNewCollection`), and carrying them meant a\n // duplicate pointed at the source's table until then.\n //\n // `auth` goes too — a duplicate must not become a second\n // auth collection wired to the same user store.\n const {\n subcollections: _sub,\n schema: _schema,\n auth: _auth,\n ...rest\n } = copyFromProp as Record<string, unknown>;\n return {\n ...rest,\n name: \"\",\n // Same shape the \"new collection\" branch below starts\n // from, so validation and the registry lookups never see\n // an undefined slug mid-edit.\n slug: fallbackSlug,\n table: \"\",\n ownerId: authController.user?.uid ?? \"\"\n } as AdminCollection<any>;\n })()\n : {\n slug: initialValuesProp?.slug ?? fallbackSlug,\n table: initialValuesProp?.slug ?? \"\",\n name: initialValuesProp?.name ?? \"\",\n properties: {} as EngineProperties,\n propertiesOrder: [],\n icon: initialIcon,\n ownerId: authController.user?.uid ?? \"\"\n }) as AdminCollection<any>;\n }, [initialCollection, propertyConfigs, copyFromProp, initialValuesProp, fallbackSlug, initialIcon, authController.user?.uid]);\n\n if (!initialLoadingCompleted) {\n return <CircularProgressCenter/>;\n }\n\n if (!props.isNewCollection && (!(standalone ? true : (collectionRegistry?.initialised ?? true)) || !initialLoadingCompleted)) {\n return <CircularProgressCenter/>;\n }\n\n return <CollectionEditorInternal\n {...props}\n initialValues={initialValues}\n existingPaths={existingPaths}\n existingIds={existingIds}\n includeTemplates={includeTemplates}\n collection={collection}\n setCollection={setCollection}\n propertyConfigs={propertyConfigs}/>\n\n}\n\nfunction CollectionEditorInternal<M extends Record<string, unknown>>({\n isNewCollection,\n configController,\n editedCollectionId,\n parentCollectionSlugs, parentEntityIds,\n path,\n collectionInference,\n handleClose,\n extraView,\n handleCancel,\n setFormDirty,\n getUser,\n parentCollection,\n getData,\n existingPaths,\n existingIds,\n includeTemplates,\n collection,\n setCollection,\n initialValues,\n propertyConfigs,\n existingEntities,\n initialView: initialViewProp,\n expandKanban,\n generateCollection,\n onAnalyticsEvent,\n fullScreen,\n unmappedTables,\n onFetchTableMetadata,\n propertyTypePresets,\n hiddenPropertyTypes,\n renderExtraPropertyFields,\n renderExtraCollectionFields,\n visibleTabs,\n standalone\n}: CollectionEditorDialogProps & {\n handleCancel: () => void,\n setFormDirty: (dirty: boolean) => void,\n initialValues: AdminCollection<M>,\n existingPaths: string[],\n existingIds: string[],\n includeTemplates: boolean,\n collection: AdminCollection<M> | undefined,\n setCollection: (collection: AdminCollection<M>) => void,\n propertyConfigs: Record<string, PropertyConfig>,\n}\n) {\n const { t } = useTranslation();\n\n /** Why the submit buttons below are dead, straight from the backend. */\n const readOnlyTitle = configController?.readOnlyReason\n || \"This backend does not accept collection edits.\";\n\n const importConfigRaw = useImportConfig();\n const urlControllerRaw = useUrlController();\n const collectionRegistryRaw = useCollectionRegistryController();\n const snackbarControllerRaw = useSafeSnackbarController();\n\n // In standalone mode, use safe defaults\n const importConfig = standalone ? undefined : importConfigRaw;\n const urlController = standalone\n ? {\n basePath: \"/\",\n baseCollectionPath: \"/c\",\n urlPathToDataPath: () => \"\",\n homeUrl: \"/\",\n isUrlCollectionPath: () => false,\n buildUrlCollectionPath: () => \"\",\n buildAppUrlPath: () => \"\",\n resolveDatabasePathsFrom: (p: string) => p,\n navigate: () => { }\n }\n : urlControllerRaw;\n const collectionRegistryInternal = standalone\n ? { convertIdsToPaths: (ids: string[]) => ids }\n : collectionRegistryRaw;\n const snackbarController = snackbarControllerRaw ?? {\n open: () => { },\n close: () => { }\n };\n\n // Use this ref to store which properties have errors\n const propertyErrorsRef = useRef<Record<string, any>>({});\n\n const initialView = isNewCollection\n ? (includeTemplates ? \"welcome\" : \"general\")\n : (initialViewProp ?? \"properties\");\n const [currentView, setCurrentView] = useState<EditorView>(initialView); // this view can edit either the details view or the properties one\n\n useEffect(() => {\n if (visibleTabs && !visibleTabs.includes(currentView as CollectionEditorTab)) {\n setCurrentView(visibleTabs[0] || \"general\");\n }\n }, [visibleTabs, currentView]);\n\n const [error, setError] = React.useState<Error | undefined>();\n\n /**\n * `baseline` is what the form was loaded with: the controller saves the\n * difference between it and `updatedCollection`, so only what the person\n * changed is written. Never for a new collection, which is saved whole.\n */\n const saveCollection = (updatedCollection: AdminCollection<M>, baseline?: AdminCollection<M>): Promise<boolean> => {\n const id = updatedCollection.slug;\n\n return configController.saveCollection({\n id,\n collectionData: updatedCollection,\n baseline: isNewCollection ? undefined : baseline,\n previousId: editedCollectionId,\n parentCollectionSlugs\n })\n .then(() => {\n setError(undefined);\n return true;\n })\n .catch((e) => {\n // Cancelling the schema-change review rejects, so that the form\n // does not go on believing it saved. It is still the person's\n // own choice, and reporting it back to them as \"Error\n // persisting collection\" — in the console and in a red\n // snackbar — describes their decision as a fault.\n if (isSchemaChangeCancelled(e)) {\n setError(undefined);\n return false;\n }\n setError(e);\n console.error(e);\n snackbarController.open({\n type: \"error\",\n message: \"Error persisting collection: \" + (e.message ?? \"Details in the console\")\n });\n return false;\n });\n };\n\n const setNextMode = () => {\n if (currentView === \"general\") {\n if (importConfig?.inUse) {\n setCurrentView(\"import_data_saving\");\n } else if (extraView) {\n setCurrentView(\"extra_view\");\n } else {\n setCurrentView(\"properties\");\n }\n } else if (currentView === \"welcome\") {\n setCurrentView(\"general\");\n } else if (currentView === \"import_data_mapping\") {\n setCurrentView(\"import_data_preview\");\n } else if (currentView === \"import_data_preview\") {\n setCurrentView(\"general\");\n } else if (currentView === \"extra_view\") {\n setCurrentView(\"properties\");\n } else {\n setCurrentView(\"general\");\n }\n\n };\n\n const doCollectionInference = collectionInference ? (collection: AdminCollection<any>) => {\n if (!collectionInference) return undefined;\n return collectionInference?.(\n collection.slug,\n parentPaths ?? [],\n collection.databaseId\n );\n } : undefined;\n\n const inferCollectionFromData = async (newCollection: AdminCollection<M>) => {\n\n try {\n if (!doCollectionInference) {\n setCollection(newCollection);\n return Promise.resolve(newCollection);\n }\n\n setCurrentView(\"loading\");\n\n const inferredCollection = await doCollectionInference?.(newCollection);\n\n if (!inferredCollection) {\n setCollection(newCollection);\n return Promise.resolve(newCollection);\n }\n const values = {\n ...(newCollection ?? {})\n };\n\n if (Object.keys(inferredCollection.properties ?? {}).length > 0) {\n values.properties = inferredCollection.properties as EngineProperties;\n values.propertiesOrder = inferredCollection.propertiesOrder as Extract<keyof M, string>[];\n }\n\n if (!values.propertiesOrder) {\n values.propertiesOrder = Object.keys(values.properties) as Extract<keyof M, string>[];\n return values;\n }\n\n setCollection(values);\n console.debug(\"Inferred collection\", {\n newCollection: newCollection ?? {},\n values\n });\n return values;\n } catch (e: unknown) {\n console.error(e);\n snackbarController.open({\n type: \"error\",\n message: \"Error inferring collection: \" + (e instanceof Error ? e.message : \"Details in the console\")\n });\n return newCollection;\n }\n };\n\n const onSubmit = async (newCollectionState: AdminCollection<M>, formexController: FormexController<AdminCollection<M>>) => {\n console.debug(\"Submitting collection\", newCollectionState);\n try {\n\n if (!isNewCollection) {\n const success = await saveCollection(newCollectionState, formexController.initialValues);\n if (success) {\n aiModifiedPaths?.clearAllPaths();\n formexController.resetForm({ values: newCollectionState });\n handleClose(newCollectionState as AdminCollection);\n }\n return;\n }\n\n if (currentView === \"welcome\") {\n setNextMode();\n formexController.resetForm({ values: newCollectionState });\n } else if (currentView === \"general\") {\n if (extraView || importConfig?.inUse) {\n formexController.resetForm({ values: newCollectionState });\n setNextMode();\n } else if (isNewCollection) {\n const values = await inferCollectionFromData(newCollectionState);\n formexController.resetForm({\n values: values ?? newCollectionState,\n touched: {\n path: true,\n name: true\n }\n });\n setNextMode();\n } else {\n formexController.resetForm({ values: newCollectionState });\n setNextMode();\n }\n } else if (currentView === \"extra_view\") {\n setNextMode();\n formexController.resetForm({ values: newCollectionState });\n } else if (currentView === \"import_data_mapping\") {\n setNextMode();\n } else if (currentView === \"import_data_preview\") {\n setNextMode();\n } else if (currentView === \"properties\") {\n const success = await saveCollection(newCollectionState);\n if (success) {\n formexController.resetForm({ values: initialValues });\n setNextMode();\n handleClose(newCollectionState as AdminCollection);\n }\n } else {\n setNextMode();\n formexController.resetForm({ values: newCollectionState });\n }\n } catch (e: unknown) {\n snackbarController.open({\n type: \"error\",\n message: \"Error persisting collection: \" + (e instanceof Error ? e.message : \"Details in the console\")\n });\n console.error(e);\n formexController.resetForm({ values: newCollectionState });\n }\n };\n\n const validation = (col: AdminCollection<M>) => {\n\n let errors: Record<string, string> = {};\n const schema = (currentView === \"properties\" || currentView === \"general\") && CollectionEditorSchema;\n if (schema) {\n const result = schema.safeParse(col);\n if (!result.success) {\n result.error.issues.forEach((issue) => {\n const path = issue.path.join(\".\");\n if (path) {\n errors[path] = issue.message;\n }\n });\n }\n }\n if (currentView === \"properties\") {\n errors = { ...errors,\n...propertyErrorsRef.current };\n }\n if (currentView === \"general\") {\n const pathError = validatePath(getTableName(col), isNewCollection, existingPaths, col.slug);\n if (pathError) {\n errors.slug = pathError;\n }\n const idError = validateId(col.slug, isNewCollection, existingPaths, existingIds);\n if (idError) {\n errors.id = idError;\n }\n }\n if (Object.keys(errors).length > 0) {\n console.error(\"Formex validation blocked save:\", errors, \"Current view:\", currentView);\n }\n return errors;\n };\n\n const formController = useCreateFormex<AdminCollection<M>>({\n initialValues,\n onSubmit,\n validation,\n debugId: \"COLLECTION_EDITOR\"\n });\n\n const {\n values,\n setFieldValue,\n isSubmitting,\n dirty,\n submitCount\n } = formController;\n\n const usedPath = getTableName(values);\n const pathError = validatePath(usedPath, isNewCollection, existingPaths, values.slug);\n\n const parentPaths = !pathError && parentCollectionSlugs ? collectionRegistryInternal.convertIdsToPaths(parentCollectionSlugs) : undefined;\n\n const updatedFullPath = parentPaths && parentPaths.length > 0\n ? [...parentPaths, usedPath].join(\"/fake_id/\")\n : (path?.includes(\"/\") ? path.split(\"/\").slice(0, -1).join(\"/\") + \"/\" + usedPath : usedPath);\n\n const resolvedPath = !pathError ? urlController.resolveDatabasePathsFrom(updatedFullPath) : undefined;\n const getDataWithPath = resolvedPath && getData ? async () => {\n const data = await getData!(resolvedPath, parentPaths ?? []);\n if (existingEntities) {\n const existingData = existingEntities.map(e => e.values);\n data.push(...existingData);\n }\n return data;\n } : undefined;\n\n useEffect(() => {\n setFormDirty(dirty);\n }, [dirty]);\n\n function onImportDataSet(data: object[], propertiesOrder?: string[]) {\n importConfig?.setInUse(true);\n buildEntityPropertiesFromData(data, getInferenceType)\n .then((properties: unknown) => {\n const res = cleanPropertiesFromImport(properties as Properties);\n\n importConfig?.setIdColumn(res.idColumn);\n importConfig?.setImportData(data);\n importConfig?.setHeadersMapping(res.headersMapping);\n const order = importedColumnOrder(propertiesOrder ?? [], res.headersMapping);\n importConfig?.setHeadingsOrder(order.headingsOrder);\n importConfig?.setOriginProperties(res.properties);\n\n setFieldValue(\"properties\", res.properties);\n setFieldValue(\"propertiesOrder\", order.propertiesOrder);\n });\n }\n\n const validValues = Boolean(values.name) && Boolean(values.slug);\n\n const onImportMappingComplete = () => {\n const updatedProperties = { ...values.properties };\n if (importConfig?.idColumn)\n delete updatedProperties[importConfig.idColumn];\n setFieldValue(\"properties\", updatedProperties);\n // setFieldValue(\"propertiesOrder\", Object.values(importConfig.headersMapping));\n setNextMode();\n };\n\n const [deleteRequested, setDeleteRequested] = useState(false);\n\n const deleteCollection = () => {\n if (!collection) return;\n configController?.deleteCollection({ id: collection.slug }).then(() => {\n setDeleteRequested(false);\n handleCancel();\n snackbarController.open({\n message: \"Collection deleted\",\n type: \"success\"\n });\n }, (e: unknown) => {\n setDeleteRequested(false);\n if (isSchemaChangeCancelled(e)) return;\n console.error(e);\n snackbarController.open({\n type: \"error\",\n message: \"Error deleting collection: \" + (e instanceof Error ? e.message : String(e))\n });\n });\n };\n\n const onWelcomeScreenContinue = (importData?: object[], propertiesOrder?: string[]) => {\n if (importData) {\n onImportDataSet(importData, propertiesOrder);\n setCurrentView(\"import_data_mapping\");\n } else {\n setCurrentView(\"general\");\n }\n };\n\n const aiModifiedPaths = useAIModifiedPaths();\n\n const handleAIGenerated = (generatedCollection: AdminCollection, operations?: CollectionOperation[]) => {\n formController.setValues(generatedCollection as AdminCollection<M>);\n if (operations && aiModifiedPaths) {\n aiModifiedPaths.addModifiedPaths(operations);\n }\n };\n\n return <div className=\"h-full w-full flex flex-col bg-surface-sheet\">\n <Formex value={formController}>\n\n <>\n {!isNewCollection && <div className={cls(\"px-4 py-2 w-full flex shrink-0 items-center justify-between gap-4 border-b\", defaultBorderMixin)}>\n <div className=\"flex flex-1 items-center justify-end gap-4 min-w-0\">\n <Tabs value={currentView}\n className=\"bg-transparent !w-fit max-w-full\"\n onValueChange={(v) => setCurrentView(v as EditorView)}>\n {(!visibleTabs || visibleTabs.includes(\"general\")) && <Tab value={\"general\"}>\n General\n </Tab>}\n {(!visibleTabs || visibleTabs.includes(\"display\")) && <Tab value={\"display\"}>\n Display\n </Tab>}\n {(!visibleTabs || visibleTabs.includes(\"properties\")) && <Tab value={\"properties\"}>\n Properties\n </Tab>}\n {(!visibleTabs || visibleTabs.includes(\"rls\")) && getDataSourceCapabilities(values.engine).supportsRLS && <Tab value={\"rls\"}>\n RLS\n </Tab>}\n </Tabs>\n </div>\n <div className=\"flex items-center gap-4\">\n {generateCollection && (\n <AICollectionGeneratorPopover\n existingCollection={values}\n onGenerated={handleAIGenerated}\n generateCollection={generateCollection}\n onAnalyticsEvent={onAnalyticsEvent}\n />\n )}\n {fullScreen && !isNewCollection && (\n <div className=\"flex items-center gap-2\">\n {/* \"(Read-only)\" says the button will not work but not why.\n The controller carries the backend's own reason —\n production, `baas` mode, no `collectionsDir`, no\n `ts-morph` — so show it, on screen and not only under\n a hover: a reason nobody finds is a reason nobody has.\n Full text in the tooltip, because these run long. */}\n {configController?.readOnly && (\n <Typography\n variant=\"caption\"\n color=\"secondary\"\n className=\"max-w-[28rem] truncate\"\n title={readOnlyTitle}\n >\n {readOnlyTitle}\n </Typography>\n )}\n <Tooltip title={configController?.readOnly ? readOnlyTitle : undefined}>\n <div>\n <LoadingButton\n variant=\"filled\"\n color=\"primary\"\n type=\"submit\"\n onClick={() => formController.handleSubmit()}\n disabled={!dirty || isSubmitting || configController?.readOnly}\n loading={isSubmitting}\n >\n {configController?.readOnly ? \"Update (Read-only)\" : \"Update\"}\n </LoadingButton>\n </div>\n </Tooltip>\n </div>\n )}\n </div>\n </div>}\n\n <form noValidate\n onSubmit={formController.handleSubmit}\n className=\"flex-grow flex flex-col min-h-0 relative\">\n\n <div className=\"flex-grow flex flex-col min-h-0 relative w-full h-full bg-surface-sheet\">\n\n {currentView === \"loading\" &&\n <CircularProgressCenter/>}\n\n {currentView === \"extra_view\" &&\n usedPath &&\n extraView?.View &&\n <extraView.View path={usedPath}/>}\n\n {currentView === \"welcome\" &&\n <CollectionEditorWelcomeView\n path={usedPath}\n onContinue={onWelcomeScreenContinue}\n existingCollectionPaths={existingPaths}\n parentCollection={parentCollection}\n generateCollection={generateCollection}\n onAnalyticsEvent={onAnalyticsEvent}\n unmappedTables={unmappedTables}\n onImportFromTable={onFetchTableMetadata ? async (tableName: string) => {\n try {\n const columns = await onFetchTableMetadata!(tableName);\n if (!columns) return;\n const collectionData = buildCollectionFromTableMetadata(tableName, columns);\n formController.setValues({\n ...formController.values,\n ...collectionData\n } as AdminCollection<M>);\n onWelcomeScreenContinue();\n } catch (e: unknown) {\n console.error(\"Error importing table:\", e);\n snackbarController.open({\n type: \"error\",\n message: \"Error importing table: \" + (e instanceof Error ? e.message : \"Unknown error\")\n });\n }\n } : undefined}/>}\n\n {currentView === \"import_data_mapping\" && importConfig &&\n <CollectionEditorImportMapping importConfig={importConfig}\n propertyConfigs={propertyConfigs}/>}\n\n {currentView === \"import_data_preview\" && importConfig &&\n <CollectionEditorImportDataPreview importConfig={importConfig}\n properties={values.properties as Properties}\n propertiesOrder={values.propertiesOrder as string[]}/>}\n\n {currentView === \"import_data_saving\" && importConfig &&\n <ImportSaveInProgress importConfig={importConfig}\n collection={values}\n path={usedPath}\n onImportSuccess={async (importedCollection) => {\n snackbarController.open({\n type: \"info\",\n message: \"Data imported successfully\"\n });\n await saveCollection(values, formController.initialValues);\n handleClose(importedCollection);\n }}\n />}\n\n {currentView === \"general\" &&\n <GeneralSettingsForm\n isNewCollection={isNewCollection}\n existingPaths={existingPaths}\n existingIds={existingIds}\n parentCollection={parentCollection}\n renderExtraCollectionFields={renderExtraCollectionFields}\n standalone={standalone}/>\n }\n\n {currentView === \"display\" &&\n <DisplaySettingsForm expandKanban={expandKanban} standalone={standalone}/>\n }\n\n {currentView === \"rls\" && getDataSourceCapabilities(values.engine).supportsRLS &&\n <CollectionRLSTab/>\n }\n\n {currentView === \"properties\" &&\n <CollectionPropertiesEditorForm\n showErrors={submitCount > 0}\n isNewCollection={isNewCollection}\n onPropertyError={(propertyKey, namespace, error) => {\n const current = removeUndefined({\n ...propertyErrorsRef.current,\n [getFullIdPath(propertyKey, namespace)]: removeUndefined(error, true)\n }, true) as Record<string, any>;\n propertyErrorsRef.current = current;\n formController.validate();\n }}\n getUser={getUser}\n getData={getDataWithPath}\n doCollectionInference={doCollectionInference}\n propertyConfigs={propertyConfigs}\n propertyTypePresets={propertyTypePresets}\n hiddenPropertyTypes={hiddenPropertyTypes}\n renderExtraPropertyFields={renderExtraPropertyFields}\n extraIcon={extraView?.icon &&\n <IconButton aria-label={t(\"open_view\")}\n onClick={() => setCurrentView(\"extra_view\")}>\n {extraView.icon}\n </IconButton>}\n standalone={standalone}/>\n }\n\n </div>\n {(!fullScreen || isNewCollection || !!error) && (\n <div className=\"shrink-0 w-full p-4 sm:px-6 sm:py-4 border-t border-hairline flex items-center justify-between gap-4\">\n {error && <ErrorView error={error}/>}\n\n {isNewCollection && includeTemplates && currentView === \"import_data_mapping\" &&\n <Button variant={\"text\"}\n type=\"button\"\n onClick={() => {\n importConfig?.setInUse(false);\n return setCurrentView(\"welcome\");\n }}>\n Back\n </Button>}\n\n {isNewCollection && includeTemplates && currentView === \"import_data_preview\" &&\n <Button variant={\"text\"}\n type=\"button\"\n onClick={() => {\n setCurrentView(\"import_data_mapping\");\n }}>\n Back\n </Button>}\n\n {isNewCollection && includeTemplates && currentView === \"general\" &&\n <Button variant={\"text\"}\n type=\"button\"\n onClick={() => setCurrentView(\"welcome\")}>\n Back\n </Button>}\n\n {isNewCollection && currentView === \"properties\" && <Button variant={\"text\"}\n type=\"button\"\n color={\"neutral\"}\n onClick={() => setCurrentView(\"general\")}>\n <ArrowLeftIcon/>\n Back\n </Button>}\n\n <div className=\"flex items-center gap-2 ml-auto\">\n {(!fullScreen || isNewCollection) && (\n <Button variant={\"text\"}\n color={\"neutral\"}\n onClick={() => {\n handleCancel();\n }}>\n Cancel\n </Button>\n )}\n\n {currentView === \"welcome\" &&\n <Button variant={\"text\"} onClick={() => onWelcomeScreenContinue()}>\n Continue from scratch\n </Button>}\n\n {isNewCollection && currentView === \"import_data_mapping\" &&\n <Button\n variant={\"filled\"}\n color=\"primary\"\n onClick={onImportMappingComplete}\n >\n Next\n </Button>}\n\n {isNewCollection && currentView === \"import_data_preview\" &&\n <Button\n variant={\"filled\"}\n color=\"primary\"\n onClick={() => {\n setNextMode();\n }}\n >\n Next\n </Button>}\n\n {isNewCollection && (currentView === \"general\" || currentView === \"properties\") &&\n <LoadingButton\n variant={\"filled\"}\n color=\"primary\"\n type=\"submit\"\n loading={isSubmitting}\n disabled={isSubmitting || (currentView === \"general\" && !validValues) || configController?.readOnly}\n startIcon={currentView === \"properties\"\n ? <CheckIcon/>\n : undefined}\n >\n {currentView === \"general\" && \"Next\"}\n {currentView === \"properties\" && \"Create collection\"}\n </LoadingButton>}\n\n {!isNewCollection && !fullScreen && <Tooltip title={configController?.readOnly ? readOnlyTitle : undefined}>\n <div>\n <LoadingButton\n variant=\"filled\"\n color=\"primary\"\n type=\"submit\"\n disabled={isSubmitting || configController?.readOnly}\n loading={isSubmitting}\n >\n {configController?.readOnly ? \"Update collection (Read-only)\" : \"Update collection\"}\n </LoadingButton>\n </div>\n </Tooltip>}\n </div>\n\n </div>\n )}\n </form>\n </>\n\n </Formex>\n\n <ConfirmationDialog\n open={deleteRequested}\n onAccept={deleteCollection}\n onCancel={() => setDeleteRequested(false)}\n title={<>Delete this collection?</>}\n body={<>Deletes <code>{collection?.slug}.ts</code> from your collections and its entry in\n {\" \"}<code>index.ts</code>, and commits that. The table and its rows stay in the\n database. Refused while another collection links to this one.</>}/>\n\n </div>\n\n}\n\nfunction applyPropertyConfigs<M extends Record<string, unknown> = Record<string, unknown>>(collection: AdminCollection<M>, propertyConfigs: Record<string, PropertyConfig>): AdminCollection<M> {\n const {\n properties,\n ...rest\n } = collection;\n const propertiesResult: Properties = {};\n if (properties) {\n Object.keys(properties).forEach((key) => {\n const prop = properties[key];\n if (prop == null) return;\n propertiesResult[key] = applyPropertiesConfig(prop, propertyConfigs);\n });\n }\n\n return {\n ...rest,\n properties: propertiesResult as EngineProperties\n } as AdminCollection<M>;\n}\n\nfunction applyPropertiesConfig(property: Property, propertyConfigs: Record<string, PropertyConfig>) {\n let internalProperty = property;\n if (propertyConfigs && internalProperty && typeof internalProperty === \"object\" && internalProperty.propertyConfig) {\n const propertyConfig = propertyConfigs[internalProperty.propertyConfig];\n if (propertyConfig && isPropertyBuilder(propertyConfig.property as Property)) {\n internalProperty = propertyConfig.property as Property;\n } else {\n\n if (propertyConfig) {\n internalProperty = mergeDeep(propertyConfig.property as Property, internalProperty);\n }\n\n if (!isPropertyBuilder(internalProperty) && internalProperty.type === \"map\" && internalProperty.properties) {\n const properties: Record<string, Property> = {};\n Object.keys(internalProperty.properties).forEach((key) => {\n properties[key] = applyPropertiesConfig(((internalProperty as MapProperty).properties as Properties)[key] as Property, propertyConfigs);\n });\n internalProperty = {\n ...internalProperty,\n properties\n };\n }\n\n }\n }\n return internalProperty;\n\n}\n\nconst validatePath = (value: string, isNewCollection: boolean, existingPaths: string[], idValue?: string) => {\n let error;\n if (!value) {\n error = \"You must specify a path in the database for this collection\";\n }\n // if (isNewCollection && existingIds?.includes(value.trim().toLowerCase()))\n // error = \"There is already a collection which uses this path as an id\";\n if (isNewCollection && existingPaths?.includes(value.trim().toLowerCase()) && !idValue)\n error = \"There is already a collection with the specified path. If you want to have multiple collections referring to the same database path, make sure the have different ids\";\n\n const subpaths = removeInitialAndTrailingSlashes(value).split(\"/\");\n if (subpaths.length % 2 === 0) {\n error = `Collection paths must have an odd number of segments: ${value}`;\n }\n return error;\n};\n\nconst validateId = (value: string, isNewCollection: boolean, existingPaths: string[], existingIds: string[]) => {\n if (!value) return undefined;\n let error;\n if (isNewCollection && existingPaths?.includes(value.trim().toLowerCase()))\n error = \"There is already a collection that uses this value as a path\";\n if (isNewCollection && existingIds?.includes(value.trim().toLowerCase()))\n error = \"There is already a collection which uses this id\";\n // if (error) {\n // setAdvancedPanelExpanded(true);\n // }\n return error;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2HA,SAAgB,uBAAuB,OAAoC;CAEvE,MAAM,OAAO,MAAM;CAEnB,MAAM,CAAC,W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B,kBAAkB,eAAe,QAAoB,GACvE,mBAAmB,eAAe;OAC/B;GAEH,IAAI,gBACA,mBAAmB,UAAU,eAAe,UAAsB,gBAAgB;GAGtF,IAAI,CAAC,kBAAkB,gBAAgB,KAAK,iBAAiB,SAAS,SAAS,iBAAiB,YAAY;IACxG,MAAM,aAAuC,CAAC;IAC9C,OAAO,KAAK,iBAAiB,UAAU,CAAC,CAAC,SAAS,QAAQ;KACtD,WAAW,OAAO,sBAAwB,iBAAiC,WAA0B,MAAkB,eAAe;IAC1I,CAAC;IACD,mBAAmB;KACf,GAAG;KACH;IACJ;GACJ;EAEJ;CACJ;CACA,OAAO;AAEX;AAEA,IAAM,gBAAgB,OAAe,iBAA0B,eAAyB,YAAqB;CACzG,IAAI;CACJ,IAAI,CAAC,OACD,QAAQ;CAIZ,IAAI,mBAAmB,eAAe,SAAS,MAAM,KAAK,CAAC,CAAC,YAAY,CAAC,KAAK,CAAC,SAC3E,QAAQ;CAGZ,IADiB,gCAAgC,KAAK,CAAC,CAAC,MAAM,GAC1D,CAAA,CAAS,SAAS,MAAM,GACxB,QAAQ,yDAAyD;CAErE,OAAO;AACX;AAEA,IAAM,cAAc,OAAe,iBAA0B,eAAyB,gBAA0B;CAC5G,IAAI,CAAC,OAAO,OAAO,KAAA;CACnB,IAAI;CACJ,IAAI,mBAAmB,eAAe,SAAS,MAAM,KAAK,CAAC,CAAC,YAAY,CAAC,GACrE,QAAQ;CACZ,IAAI,mBAAmB,aAAa,SAAS,MAAM,KAAK,CAAC,CAAC,YAAY,CAAC,GACnE,QAAQ;CAIZ,OAAO;AACX"}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { ImportFileUpload } from "../../../data_import/components/ImportFileUpload.js";
|
|
2
|
+
import { useCollectionEditorController } from "../../useCollectionEditorController.js";
|
|
3
|
+
import { CollectionJsonImportDialog } from "./CollectionJsonImportDialog.js";
|
|
4
|
+
import { productsCollectionTemplate } from "./templates/products_template.js";
|
|
5
|
+
import { blogCollectionTemplate } from "./templates/blog_template.js";
|
|
6
|
+
import { usersCollectionTemplate } from "./templates/users_template.js";
|
|
7
|
+
import { pagesCollectionTemplate } from "./templates/pages_template.js";
|
|
8
|
+
import { AICollectionGeneratorPopover } from "./AICollectionGeneratorPopover.js";
|
|
9
|
+
import { useState } from "react";
|
|
10
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { Button, Card, Chip, CodeIcon, Container, FileIcon, FileTextIcon, ShoppingCartIcon, TableIcon, Tooltip, Typography, UserIcon, cls, iconSize } from "@rebasepro/ui";
|
|
12
|
+
import { AIIcon } from "@rebasepro/app";
|
|
13
|
+
import { useFormex } from "@rebasepro/forms";
|
|
14
|
+
import { prettifyIdentifier } from "@rebasepro/utils";
|
|
15
|
+
//#region src/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.tsx
|
|
16
|
+
function CollectionEditorWelcomeView({ path, parentCollection, onContinue, existingCollectionPaths, generateCollection, onAnalyticsEvent, unmappedTables, onImportFromTable }) {
|
|
17
|
+
const { pathSuggestions } = useCollectionEditorController();
|
|
18
|
+
const filteredSuggestions = (pathSuggestions ?? []).filter((s) => !(existingCollectionPaths ?? []).find((c) => c.trim().toLowerCase() === s.trim().toLowerCase()));
|
|
19
|
+
const { values, setFieldValue, setValues, submitCount } = useFormex();
|
|
20
|
+
const [jsonImportOpen, setJsonImportOpen] = useState(false);
|
|
21
|
+
const [importingTable, setImportingTable] = useState(null);
|
|
22
|
+
const filteredUnmappedTables = (unmappedTables ?? []).filter((t) => !(existingCollectionPaths ?? []).find((c) => c.trim().toLowerCase() === t.trim().toLowerCase()));
|
|
23
|
+
return /* @__PURE__ */ jsx("div", {
|
|
24
|
+
className: "overflow-auto my-auto",
|
|
25
|
+
children: /* @__PURE__ */ jsxs(Container, {
|
|
26
|
+
maxWidth: "4xl",
|
|
27
|
+
className: "flex flex-col gap-4 p-8 m-auto",
|
|
28
|
+
children: [
|
|
29
|
+
/* @__PURE__ */ jsx("div", {
|
|
30
|
+
className: "flex flex-row py-2 pt-3 items-center",
|
|
31
|
+
children: /* @__PURE__ */ jsx(Typography, {
|
|
32
|
+
variant: "h4",
|
|
33
|
+
className: "grow",
|
|
34
|
+
children: "New collection"
|
|
35
|
+
})
|
|
36
|
+
}),
|
|
37
|
+
parentCollection && /* @__PURE__ */ jsx(Chip, {
|
|
38
|
+
colorScheme: "teal",
|
|
39
|
+
children: /* @__PURE__ */ jsxs(Typography, {
|
|
40
|
+
variant: "caption",
|
|
41
|
+
children: ["This is a subcollection of ", /* @__PURE__ */ jsx("b", { children: parentCollection.name })]
|
|
42
|
+
})
|
|
43
|
+
}),
|
|
44
|
+
filteredUnmappedTables.length > 0 && /* @__PURE__ */ jsxs("div", {
|
|
45
|
+
className: "my-2",
|
|
46
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
47
|
+
variant: "caption",
|
|
48
|
+
color: "secondary",
|
|
49
|
+
children: "● Import from an existing database table:"
|
|
50
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
51
|
+
className: "flex flex-wrap gap-x-2 gap-y-1 items-center my-2 min-h-7",
|
|
52
|
+
children: filteredUnmappedTables.map((tableName) => /* @__PURE__ */ jsxs(Chip, {
|
|
53
|
+
colorScheme: "purple",
|
|
54
|
+
onClick: () => {
|
|
55
|
+
if (onImportFromTable) {
|
|
56
|
+
setImportingTable(tableName);
|
|
57
|
+
onImportFromTable(tableName);
|
|
58
|
+
} else {
|
|
59
|
+
setFieldValue("name", prettifyIdentifier(tableName));
|
|
60
|
+
setFieldValue("id", tableName);
|
|
61
|
+
setFieldValue("path", tableName);
|
|
62
|
+
onContinue();
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
size: "small",
|
|
66
|
+
children: [/* @__PURE__ */ jsx(TableIcon, { size: iconSize.smallest }), importingTable === tableName ? "Loading..." : tableName]
|
|
67
|
+
}, tableName))
|
|
68
|
+
})]
|
|
69
|
+
}),
|
|
70
|
+
(filteredSuggestions ?? []).length > 0 && /* @__PURE__ */ jsxs("div", {
|
|
71
|
+
className: "my-2",
|
|
72
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
73
|
+
variant: "caption",
|
|
74
|
+
color: "secondary",
|
|
75
|
+
children: "● Use one of the existing paths in your database:"
|
|
76
|
+
}), /* @__PURE__ */ jsx("div", {
|
|
77
|
+
className: "flex flex-wrap gap-x-2 gap-y-1 items-center my-2 min-h-7",
|
|
78
|
+
children: filteredSuggestions?.map((suggestion, index) => /* @__PURE__ */ jsx(Chip, {
|
|
79
|
+
colorScheme: "cyan",
|
|
80
|
+
onClick: () => {
|
|
81
|
+
setFieldValue("name", prettifyIdentifier(suggestion));
|
|
82
|
+
setFieldValue("id", suggestion);
|
|
83
|
+
setFieldValue("path", suggestion);
|
|
84
|
+
setFieldValue("properties", void 0);
|
|
85
|
+
onContinue();
|
|
86
|
+
},
|
|
87
|
+
size: "small",
|
|
88
|
+
children: suggestion
|
|
89
|
+
}, suggestion))
|
|
90
|
+
})]
|
|
91
|
+
}),
|
|
92
|
+
/* @__PURE__ */ jsxs("div", {
|
|
93
|
+
className: "flex flex-row gap-8",
|
|
94
|
+
children: [generateCollection && /* @__PURE__ */ jsxs("div", {
|
|
95
|
+
className: "my-2",
|
|
96
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
97
|
+
variant: "caption",
|
|
98
|
+
color: "secondary",
|
|
99
|
+
className: "mb-2",
|
|
100
|
+
children: "● Describe your collection to AI:"
|
|
101
|
+
}), /* @__PURE__ */ jsx(AICollectionGeneratorPopover, {
|
|
102
|
+
onGenerated: (generatedCollection) => {
|
|
103
|
+
setValues(generatedCollection);
|
|
104
|
+
onContinue();
|
|
105
|
+
},
|
|
106
|
+
generateCollection,
|
|
107
|
+
onAnalyticsEvent,
|
|
108
|
+
trigger: /* @__PURE__ */ jsx(Button, {
|
|
109
|
+
variant: "filled",
|
|
110
|
+
color: "neutral",
|
|
111
|
+
startIcon: /* @__PURE__ */ jsx(AIIcon, { size: "small" }),
|
|
112
|
+
children: "Generate with AI"
|
|
113
|
+
})
|
|
114
|
+
})]
|
|
115
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
116
|
+
className: "my-2",
|
|
117
|
+
children: [
|
|
118
|
+
/* @__PURE__ */ jsx(Typography, {
|
|
119
|
+
variant: "caption",
|
|
120
|
+
color: "secondary",
|
|
121
|
+
className: "mb-2",
|
|
122
|
+
children: "● Create from JSON configuration:"
|
|
123
|
+
}),
|
|
124
|
+
/* @__PURE__ */ jsx(Button, {
|
|
125
|
+
variant: "filled",
|
|
126
|
+
color: "neutral",
|
|
127
|
+
onClick: () => setJsonImportOpen(true),
|
|
128
|
+
startIcon: /* @__PURE__ */ jsx(CodeIcon, { size: iconSize.small }),
|
|
129
|
+
children: "Paste JSON Configuration"
|
|
130
|
+
}),
|
|
131
|
+
/* @__PURE__ */ jsx(CollectionJsonImportDialog, {
|
|
132
|
+
open: jsonImportOpen,
|
|
133
|
+
onClose: () => setJsonImportOpen(false),
|
|
134
|
+
onImport: (collection) => {
|
|
135
|
+
setValues(collection);
|
|
136
|
+
onContinue();
|
|
137
|
+
}
|
|
138
|
+
})
|
|
139
|
+
]
|
|
140
|
+
})]
|
|
141
|
+
}),
|
|
142
|
+
!parentCollection && /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Typography, {
|
|
143
|
+
variant: "caption",
|
|
144
|
+
color: "secondary",
|
|
145
|
+
className: "mb-2",
|
|
146
|
+
children: "● Create a collection from a file (csv, json, xls, xslx...)"
|
|
147
|
+
}), /* @__PURE__ */ jsx(ImportFileUpload, { onDataAdded: (data, propertiesOrder) => onContinue(data, propertiesOrder) })] }),
|
|
148
|
+
/* @__PURE__ */ jsxs("div", {
|
|
149
|
+
className: "my-2",
|
|
150
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
151
|
+
variant: "caption",
|
|
152
|
+
color: "secondary",
|
|
153
|
+
children: "● Select a template:"
|
|
154
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
155
|
+
className: "flex gap-2",
|
|
156
|
+
children: [
|
|
157
|
+
/* @__PURE__ */ jsx(TemplateButton, {
|
|
158
|
+
title: "Products",
|
|
159
|
+
subtitle: "A collection of products with images, prices and stock",
|
|
160
|
+
icon: /* @__PURE__ */ jsx(ShoppingCartIcon, { size: iconSize.small }),
|
|
161
|
+
onClick: () => {
|
|
162
|
+
setValues(productsCollectionTemplate);
|
|
163
|
+
onContinue();
|
|
164
|
+
}
|
|
165
|
+
}),
|
|
166
|
+
/* @__PURE__ */ jsx(TemplateButton, {
|
|
167
|
+
title: "Users",
|
|
168
|
+
subtitle: "A collection of users with emails, names and roles",
|
|
169
|
+
icon: /* @__PURE__ */ jsx(UserIcon, { size: iconSize.small }),
|
|
170
|
+
onClick: () => {
|
|
171
|
+
setValues(usersCollectionTemplate);
|
|
172
|
+
onContinue();
|
|
173
|
+
}
|
|
174
|
+
}),
|
|
175
|
+
/* @__PURE__ */ jsx(TemplateButton, {
|
|
176
|
+
title: "Blog posts",
|
|
177
|
+
subtitle: "A collection of blog posts with images, authors and complex content",
|
|
178
|
+
icon: /* @__PURE__ */ jsx(FileTextIcon, { size: iconSize.small }),
|
|
179
|
+
onClick: () => {
|
|
180
|
+
setValues(blogCollectionTemplate);
|
|
181
|
+
onContinue();
|
|
182
|
+
}
|
|
183
|
+
}),
|
|
184
|
+
/* @__PURE__ */ jsx(TemplateButton, {
|
|
185
|
+
title: "Pages",
|
|
186
|
+
subtitle: "A collection of pages with images, authors and complex content",
|
|
187
|
+
icon: /* @__PURE__ */ jsx(FileIcon, { size: iconSize.small }),
|
|
188
|
+
onClick: () => {
|
|
189
|
+
setValues(pagesCollectionTemplate);
|
|
190
|
+
onContinue();
|
|
191
|
+
}
|
|
192
|
+
})
|
|
193
|
+
]
|
|
194
|
+
})]
|
|
195
|
+
})
|
|
196
|
+
]
|
|
197
|
+
})
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
function TemplateButton({ title, subtitle, icon, onClick }) {
|
|
201
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
202
|
+
title: subtitle,
|
|
203
|
+
asChild: true,
|
|
204
|
+
children: /* @__PURE__ */ jsxs(Card, {
|
|
205
|
+
onClick,
|
|
206
|
+
className: cls("my-2 rounded-md border px-4 py-3 focus:outline-none transition ease-in-out duration-150 flex flex-row gap-4 items-center", "text-text-secondary dark:text-text-secondary-dark", "hover:border-primary-dark hover:text-primary-dark dark:hover:text-primary focus:ring-primary hover:ring-1 hover:ring-primary", "border-surface-400 dark:border-surface-600 "),
|
|
207
|
+
children: [icon, /* @__PURE__ */ jsx("div", {
|
|
208
|
+
className: "flex flex-col items-start",
|
|
209
|
+
children: /* @__PURE__ */ jsx(Typography, {
|
|
210
|
+
variant: "subtitle2",
|
|
211
|
+
children: title
|
|
212
|
+
})
|
|
213
|
+
})]
|
|
214
|
+
})
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
//#endregion
|
|
218
|
+
export { CollectionEditorWelcomeView, TemplateButton };
|
|
219
|
+
|
|
220
|
+
//# sourceMappingURL=CollectionEditorWelcomeView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CollectionEditorWelcomeView.js","names":[],"sources":["../../../../src/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.tsx"],"sourcesContent":["import { AIIcon } from \"@rebasepro/app\";\n;\nimport React, { useState } from \"react\";\n;\n\nimport {\n Button,\n Card,\n Chip,\n cls,\n CodeIcon,\n Container,\n FileIcon,\n FileTextIcon,\n iconSize,\n ShoppingCartIcon,\n TableIcon,\n Tooltip,\n Typography,\n UserIcon\n} from \"@rebasepro/ui\";\nimport { CollectionJsonImportDialog } from \"./CollectionJsonImportDialog\";\n\nimport { productsCollectionTemplate } from \"./templates/products_template\";\nimport { blogCollectionTemplate } from \"./templates/blog_template\";\nimport { usersCollectionTemplate } from \"./templates/users_template\";\nimport { ImportFileUpload } from \"../../_cms_internals\";\nimport { pagesCollectionTemplate } from \"./templates/pages_template\";\nimport { useFormex } from \"@rebasepro/forms\";\nimport { useCollectionEditorController } from \"../../useCollectionEditorController\";\nimport { AICollectionGeneratorPopover } from \"./AICollectionGeneratorPopover\";\nimport { CollectionGenerationCallback } from \"../../api/generateCollectionApi\";\nimport { prettifyIdentifier } from \"@rebasepro/utils\";\nimport type { AdminCollection } from \"@rebasepro/cms-types\";\n\nexport function CollectionEditorWelcomeView({\n path,\n parentCollection,\n onContinue,\n existingCollectionPaths,\n generateCollection,\n onAnalyticsEvent,\n unmappedTables,\n onImportFromTable\n}: {\n path: string;\n parentCollection?: AdminCollection;\n onContinue: (importData?: object[], propertiesOrder?: string[]) => void;\n existingCollectionPaths?: string[];\n generateCollection?: CollectionGenerationCallback;\n onAnalyticsEvent?: (event: string, params?: object) => void;\n unmappedTables?: string[];\n onImportFromTable?: (tableName: string) => void;\n}) {\n\n const { pathSuggestions } = useCollectionEditorController();\n\n const filteredSuggestions = (pathSuggestions ?? []).filter(s => !(existingCollectionPaths ?? []).find(c => c.trim().toLowerCase() === s.trim().toLowerCase()));\n\n const {\n values,\n setFieldValue,\n setValues,\n submitCount\n } = useFormex<AdminCollection>();\n\n const [jsonImportOpen, setJsonImportOpen] = useState(false);\n const [importingTable, setImportingTable] = useState<string | null>(null);\n\n // Filter unmapped tables that aren't already mapped\n const filteredUnmappedTables = (unmappedTables ?? []).filter(\n t => !(existingCollectionPaths ?? []).find(c => c.trim().toLowerCase() === t.trim().toLowerCase())\n );\n\n return (\n <div className={\"overflow-auto my-auto\"}>\n <Container maxWidth={\"4xl\"} className={\"flex flex-col gap-4 p-8 m-auto\"}>\n\n <div\n className=\"flex flex-row py-2 pt-3 items-center\">\n <Typography variant={\"h4\"} className={\"grow\"}>\n New collection\n </Typography>\n </div>\n\n {parentCollection && <Chip colorScheme={\"teal\"}>\n <Typography variant={\"caption\"}>\n This is a subcollection of <b>{parentCollection.name}</b>\n </Typography>\n </Chip>}\n\n {filteredUnmappedTables.length > 0 && <div className={\"my-2\"}>\n\n <Typography variant={\"caption\"}\n color={\"secondary\"}>\n ● Import from an existing database table:\n </Typography>\n <div className={\"flex flex-wrap gap-x-2 gap-y-1 items-center my-2 min-h-7\"}>\n\n {filteredUnmappedTables.map((tableName) => (\n <Chip key={tableName}\n colorScheme={\"purple\"}\n onClick={() => {\n if (onImportFromTable) {\n setImportingTable(tableName);\n onImportFromTable(tableName);\n } else {\n // Fallback: just set path/name like pathSuggestions\n setFieldValue(\"name\", prettifyIdentifier(tableName));\n setFieldValue(\"id\", tableName);\n setFieldValue(\"path\", tableName);\n onContinue();\n }\n }}\n size=\"small\">\n <TableIcon size={iconSize.smallest}/>\n {importingTable === tableName ? \"Loading...\" : tableName}\n </Chip>\n ))}\n\n </div>\n\n </div>}\n\n {(filteredSuggestions ?? []).length > 0 && <div className={\"my-2\"}>\n\n <Typography variant={\"caption\"}\n color={\"secondary\"}>\n ● Use one of the existing paths in your database:\n </Typography>\n <div className={\"flex flex-wrap gap-x-2 gap-y-1 items-center my-2 min-h-7\"}>\n\n {filteredSuggestions?.map((suggestion, index) => (\n <Chip key={suggestion}\n colorScheme={\"cyan\"}\n onClick={() => {\n setFieldValue(\"name\", prettifyIdentifier(suggestion));\n setFieldValue(\"id\", suggestion);\n setFieldValue(\"path\", suggestion);\n setFieldValue(\"properties\", undefined);\n onContinue();\n }}\n size=\"small\">\n {suggestion}\n </Chip>\n ))}\n\n </div>\n\n </div>}\n <div className=\"flex flex-row gap-8\">\n\n {generateCollection && (\n <div className={\"my-2\"}>\n <Typography variant={\"caption\"}\n color={\"secondary\"}\n className={\"mb-2\"}>\n ● Describe your collection to AI:\n </Typography>\n\n <AICollectionGeneratorPopover\n onGenerated={(generatedCollection) => {\n setValues(generatedCollection);\n onContinue();\n }}\n generateCollection={generateCollection}\n onAnalyticsEvent={onAnalyticsEvent}\n trigger={\n <Button\n variant=\"filled\"\n color=\"neutral\"\n startIcon={<AIIcon size=\"small\"/>}\n >\n Generate with AI\n </Button>\n }\n />\n </div>\n )}\n\n <div className={\"my-2\"}>\n <Typography variant={\"caption\"}\n color={\"secondary\"}\n className={\"mb-2\"}>\n ● Create from JSON configuration:\n </Typography>\n\n <Button\n variant=\"filled\"\n color=\"neutral\"\n onClick={() => setJsonImportOpen(true)}\n startIcon={<CodeIcon size={iconSize.small}/>}\n >\n Paste JSON Configuration\n </Button>\n\n <CollectionJsonImportDialog\n open={jsonImportOpen}\n onClose={() => setJsonImportOpen(false)}\n onImport={(collection) => {\n setValues(collection);\n onContinue();\n }}\n />\n </div>\n\n </div>\n\n {!parentCollection && <div>\n\n <Typography variant={\"caption\"}\n color={\"secondary\"}\n className={\"mb-2\"}>\n ● Create a collection from a file (csv, json, xls, xslx...)\n </Typography>\n\n <ImportFileUpload onDataAdded={(data, propertiesOrder) => onContinue(data, propertiesOrder)}/>\n\n </div>}\n\n <div className={\"my-2\"}>\n <Typography variant={\"caption\"}\n color={\"secondary\"}>\n ● Select a template:\n </Typography>\n\n <div className={\"flex gap-2\"}>\n <TemplateButton title={\"Products\"}\n subtitle={\"A collection of products with images, prices and stock\"}\n icon={<ShoppingCartIcon size={iconSize.small}/>}\n onClick={() => {\n setValues(productsCollectionTemplate);\n onContinue();\n }}/>\n <TemplateButton title={\"Users\"}\n subtitle={\"A collection of users with emails, names and roles\"}\n icon={<UserIcon size={iconSize.small}/>}\n onClick={() => {\n setValues(usersCollectionTemplate);\n onContinue();\n }}/>\n <TemplateButton title={\"Blog posts\"}\n subtitle={\"A collection of blog posts with images, authors and complex content\"}\n icon={<FileTextIcon size={iconSize.small}/>}\n onClick={() => {\n setValues(blogCollectionTemplate);\n onContinue();\n }}/>\n <TemplateButton title={\"Pages\"}\n subtitle={\"A collection of pages with images, authors and complex content\"}\n icon={<FileIcon size={iconSize.small}/>}\n onClick={() => {\n setValues(pagesCollectionTemplate);\n onContinue();\n }}/>\n </div>\n\n </div>\n\n </Container>\n </div>\n );\n}\n\nexport function TemplateButton({\n title,\n subtitle,\n icon,\n onClick\n}: {\n title: string,\n icon: React.ReactNode | any,\n subtitle: string,\n onClick?: () => void\n}) {\n\n return (\n <Tooltip title={subtitle}\n asChild={true}>\n <Card\n onClick={onClick}\n className={cls(\n \"my-2 rounded-md border px-4 py-3 focus:outline-none transition ease-in-out duration-150 flex flex-row gap-4 items-center\",\n \"text-text-secondary dark:text-text-secondary-dark\",\n \"hover:border-primary-dark hover:text-primary-dark dark:hover:text-primary focus:ring-primary hover:ring-1 hover:ring-primary\",\n \"border-surface-400 dark:border-surface-600 \"\n )}\n >\n {icon}\n <div className={\"flex flex-col items-start\"}>\n\n <Typography variant={\"subtitle2\"}>\n {title}\n </Typography>\n\n </div>\n </Card>\n </Tooltip>\n );\n\n}\n"],"mappings":";;;;;;;;;;;;;;;AAmCA,SAAgB,4BAA4B,EACxC,MACA,kBACA,YACA,yBACA,oBACA,kBACA,gBACA,qBAUD;CAEC,MAAM,EAAE,oBAAoB,8BAA8B;CAE1D,MAAM,uBAAuB,mBAAmB,CAAC,EAAA,CAAG,QAAO,MAAK,EAAE,2BAA2B,CAAC,EAAA,CAAG,MAAK,MAAK,EAAE,KAAK,CAAC,CAAC,YAAY,MAAM,EAAE,KAAK,CAAC,CAAC,YAAY,CAAC,CAAC;CAE7J,MAAM,EACF,QACA,eACA,WACA,gBACA,UAA2B;CAE/B,MAAM,CAAC,gBAAgB,qBAAqB,SAAS,KAAK;CAC1D,MAAM,CAAC,gBAAgB,qBAAqB,SAAwB,IAAI;CAGxE,MAAM,0BAA0B,kBAAkB,CAAC,EAAA,CAAG,QAClD,MAAK,EAAE,2BAA2B,CAAC,EAAA,CAAG,MAAK,MAAK,EAAE,KAAK,CAAC,CAAC,YAAY,MAAM,EAAE,KAAK,CAAC,CAAC,YAAY,CAAC,CACrG;CAEA,OACI,oBAAC,OAAD;EAAK,WAAW;YACZ,qBAAC,WAAD;GAAW,UAAU;GAAO,WAAW;aAAvC;IAEI,oBAAC,OAAD;KACI,WAAU;eACV,oBAAC,YAAD;MAAY,SAAS;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;OAAG,CAAA;OACP,oBAAC,gBAAD;QAAgB,OAAO;QACnB,UAAU;QACV,MAAM,oBAAC,UAAD,EAAU,MAAM,SAAS,MAAO,CAAA;QACtC,eAAe;SACX,UAAU,uBAAuB;SACjC,WAAW;QACf;OAAG,CAAA;OACP,oBAAC,gBAAD;QAAgB,OAAO;QACnB,UAAU;QACV,MAAM,oBAAC,cAAD,EAAc,MAAM,SAAS,MAAO,CAAA;QAC1C,eAAe;SACX,UAAU,sBAAsB;SAChC,WAAW;QACf;OAAG,CAAA;OACP,oBAAC,gBAAD;QAAgB,OAAO;QACnB,UAAU;QACV,MAAM,oBAAC,UAAD,EAAU,MAAM,SAAS,MAAO,CAAA;QACtC,eAAe;SACX,UAAU,uBAAuB;SACjC,WAAW;QACf;OAAG,CAAA;MACN;OAEJ;;GAEE;;CACV,CAAA;AAEb;AAEA,SAAgB,eAAe,EAC3B,OACA,UACA,MACA,WAMD;CAEC,OACI,oBAAC,SAAD;EAAS,OAAO;EACZ,SAAS;YACT,qBAAC,MAAD;GACa;GACT,WAAW,IACP,4HACA,qDACA,gIACA,6CACJ;aAPJ,CASK,MACD,oBAAC,OAAD;IAAK,WAAW;cAEZ,oBAAC,YAAD;KAAY,SAAS;eAChB;IACO,CAAA;GAEX,CAAA,CACH;;CACD,CAAA;AAGjB"}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { validateCollectionJson } from "../../validateCollectionJson.js";
|
|
2
|
+
import { useCallback, useState } from "react";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { Alert, Button, CodeIcon, Dialog, DialogActions, DialogContent, DialogTitle, TextField, Typography, iconSize } from "@rebasepro/ui";
|
|
5
|
+
//#region src/collection_editor/ui/collection_editor/CollectionJsonImportDialog.tsx
|
|
6
|
+
var EXAMPLE_JSON = `{
|
|
7
|
+
"id": "products",
|
|
8
|
+
"name": "Products",
|
|
9
|
+
"path": "products",
|
|
10
|
+
"icon": "shopping_cart",
|
|
11
|
+
"properties": {
|
|
12
|
+
"name": {
|
|
13
|
+
"type": "string",
|
|
14
|
+
"name": "Name",
|
|
15
|
+
"validation": { "required": true }
|
|
16
|
+
},
|
|
17
|
+
"price": {
|
|
18
|
+
"type": "number",
|
|
19
|
+
"name": "Price"
|
|
20
|
+
},
|
|
21
|
+
"available": {
|
|
22
|
+
"type": "boolean",
|
|
23
|
+
"name": "Available"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}`;
|
|
27
|
+
function CollectionJsonImportDialog({ open, onClose, onImport }) {
|
|
28
|
+
const [jsonValue, setJsonValue] = useState("");
|
|
29
|
+
const [errors, setErrors] = useState([]);
|
|
30
|
+
const [touched, setTouched] = useState(false);
|
|
31
|
+
const handleJsonChange = useCallback((e) => {
|
|
32
|
+
const value = e.target.value;
|
|
33
|
+
setJsonValue(value);
|
|
34
|
+
setTouched(true);
|
|
35
|
+
if (!value.trim()) {
|
|
36
|
+
setErrors([]);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const result = validateCollectionJson(value);
|
|
40
|
+
setErrors(result.errors);
|
|
41
|
+
}, []);
|
|
42
|
+
const handleImport = useCallback(() => {
|
|
43
|
+
const result = validateCollectionJson(jsonValue);
|
|
44
|
+
if (result.valid && result.collection) {
|
|
45
|
+
onImport(result.collection);
|
|
46
|
+
setJsonValue("");
|
|
47
|
+
setErrors([]);
|
|
48
|
+
setTouched(false);
|
|
49
|
+
onClose();
|
|
50
|
+
}
|
|
51
|
+
}, [
|
|
52
|
+
jsonValue,
|
|
53
|
+
onImport,
|
|
54
|
+
onClose
|
|
55
|
+
]);
|
|
56
|
+
const handleClose = useCallback(() => {
|
|
57
|
+
setJsonValue("");
|
|
58
|
+
setErrors([]);
|
|
59
|
+
setTouched(false);
|
|
60
|
+
onClose();
|
|
61
|
+
}, [onClose]);
|
|
62
|
+
const isValid = touched && jsonValue.trim() && errors.length === 0;
|
|
63
|
+
return /* @__PURE__ */ jsxs(Dialog, {
|
|
64
|
+
open,
|
|
65
|
+
onOpenChange: (open) => !open && handleClose(),
|
|
66
|
+
maxWidth: "2xl",
|
|
67
|
+
children: [
|
|
68
|
+
/* @__PURE__ */ jsxs(DialogTitle, {
|
|
69
|
+
className: "flex items-center gap-2",
|
|
70
|
+
children: [/* @__PURE__ */ jsx(CodeIcon, { size: iconSize.smallest }), "Import Collection from JSON"]
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ jsxs(DialogContent, {
|
|
73
|
+
className: "flex flex-col gap-4",
|
|
74
|
+
children: [
|
|
75
|
+
/* @__PURE__ */ jsxs(Typography, {
|
|
76
|
+
variant: "body2",
|
|
77
|
+
color: "secondary",
|
|
78
|
+
children: [
|
|
79
|
+
"Paste a JSON object representing your collection configuration. The JSON must include ",
|
|
80
|
+
/* @__PURE__ */ jsx("code", {
|
|
81
|
+
className: "bg-surface-raised px-1 rounded",
|
|
82
|
+
children: "id"
|
|
83
|
+
}),
|
|
84
|
+
",",
|
|
85
|
+
/* @__PURE__ */ jsx("code", {
|
|
86
|
+
className: "bg-surface-raised px-1 rounded",
|
|
87
|
+
children: "name"
|
|
88
|
+
}),
|
|
89
|
+
",",
|
|
90
|
+
/* @__PURE__ */ jsx("code", {
|
|
91
|
+
className: "bg-surface-raised px-1 rounded",
|
|
92
|
+
children: "path"
|
|
93
|
+
}),
|
|
94
|
+
", and",
|
|
95
|
+
/* @__PURE__ */ jsx("code", {
|
|
96
|
+
className: "bg-surface-raised px-1 rounded",
|
|
97
|
+
children: "properties"
|
|
98
|
+
}),
|
|
99
|
+
"."
|
|
100
|
+
]
|
|
101
|
+
}),
|
|
102
|
+
/* @__PURE__ */ jsx(TextField, {
|
|
103
|
+
multiline: true,
|
|
104
|
+
minRows: 12,
|
|
105
|
+
"aria-label": "Collection JSON",
|
|
106
|
+
value: jsonValue,
|
|
107
|
+
onChange: handleJsonChange,
|
|
108
|
+
placeholder: EXAMPLE_JSON,
|
|
109
|
+
error: errors.length > 0 && touched,
|
|
110
|
+
className: "w-full",
|
|
111
|
+
inputClassName: "font-mono text-sm resize-none overflow-y-auto h-[300px]"
|
|
112
|
+
}),
|
|
113
|
+
errors.length > 0 && touched && /* @__PURE__ */ jsxs(Alert, {
|
|
114
|
+
color: "error",
|
|
115
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
116
|
+
variant: "body2",
|
|
117
|
+
className: "font-medium mb-2",
|
|
118
|
+
children: "Validation errors:"
|
|
119
|
+
}), /* @__PURE__ */ jsx("ul", {
|
|
120
|
+
className: "list-disc list-inside space-y-1",
|
|
121
|
+
children: errors.map((error, index) => /* @__PURE__ */ jsx("li", {
|
|
122
|
+
className: "text-sm",
|
|
123
|
+
children: error.path ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
124
|
+
/* @__PURE__ */ jsx("code", {
|
|
125
|
+
className: "bg-red-100 dark:bg-red-900/40 px-1 rounded",
|
|
126
|
+
children: error.path
|
|
127
|
+
}),
|
|
128
|
+
": ",
|
|
129
|
+
error.message
|
|
130
|
+
] }) : error.message
|
|
131
|
+
}, index))
|
|
132
|
+
})]
|
|
133
|
+
}),
|
|
134
|
+
isValid && /* @__PURE__ */ jsx(Alert, {
|
|
135
|
+
color: "success",
|
|
136
|
+
children: /* @__PURE__ */ jsx(Typography, {
|
|
137
|
+
variant: "body2",
|
|
138
|
+
children: "✓ JSON is valid and ready to import"
|
|
139
|
+
})
|
|
140
|
+
})
|
|
141
|
+
]
|
|
142
|
+
}),
|
|
143
|
+
/* @__PURE__ */ jsxs(DialogActions, { children: [/* @__PURE__ */ jsx(Button, {
|
|
144
|
+
variant: "text",
|
|
145
|
+
onClick: handleClose,
|
|
146
|
+
children: "Cancel"
|
|
147
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
148
|
+
variant: "filled",
|
|
149
|
+
color: "primary",
|
|
150
|
+
onClick: handleImport,
|
|
151
|
+
disabled: !isValid,
|
|
152
|
+
children: "Import Collection"
|
|
153
|
+
})] })
|
|
154
|
+
]
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
//#endregion
|
|
158
|
+
export { CollectionJsonImportDialog };
|
|
159
|
+
|
|
160
|
+
//# sourceMappingURL=CollectionJsonImportDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CollectionJsonImportDialog.js","names":[],"sources":["../../../../src/collection_editor/ui/collection_editor/CollectionJsonImportDialog.tsx"],"sourcesContent":["\nimport React, { useCallback, useState } from \"react\";\nimport {\n Alert,\n Button,\n cls,\n CodeIcon,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n iconSize,\n TextField,\n Typography\n} from \"@rebasepro/ui\";\n\nimport { validateCollectionJson, CollectionValidationError } from \"../../validateCollectionJson\";\nimport type { AdminCollection } from \"@rebasepro/cms-types\";\n\nconst EXAMPLE_JSON = `{\n \"id\": \"products\",\n \"name\": \"Products\",\n \"path\": \"products\",\n \"icon\": \"shopping_cart\",\n \"properties\": {\n \"name\": {\n \"type\": \"string\",\n \"name\": \"Name\",\n \"validation\": { \"required\": true }\n },\n \"price\": {\n \"type\": \"number\",\n \"name\": \"Price\"\n },\n \"available\": {\n \"type\": \"boolean\",\n \"name\": \"Available\"\n }\n }\n}`;\n\nexport interface CollectionJsonImportDialogProps {\n open: boolean;\n onClose: () => void;\n onImport: (collection: AdminCollection) => void;\n}\n\nexport function CollectionJsonImportDialog({\n open,\n onClose,\n onImport\n}: CollectionJsonImportDialogProps) {\n const [jsonValue, setJsonValue] = useState<string>(\"\");\n const [errors, setErrors] = useState<CollectionValidationError[]>([]);\n const [touched, setTouched] = useState(false);\n\n const handleJsonChange = useCallback((e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => {\n const value = e.target.value;\n setJsonValue(value);\n setTouched(true);\n\n if (!value.trim()) {\n setErrors([]);\n return;\n }\n\n const result = validateCollectionJson(value);\n setErrors(result.errors);\n }, []);\n\n const handleImport = useCallback(() => {\n const result = validateCollectionJson(jsonValue);\n if (result.valid && result.collection) {\n onImport(result.collection);\n setJsonValue(\"\");\n setErrors([]);\n setTouched(false);\n onClose();\n }\n }, [jsonValue, onImport, onClose]);\n\n const handleClose = useCallback(() => {\n setJsonValue(\"\");\n setErrors([]);\n setTouched(false);\n onClose();\n }, [onClose]);\n\n const isValid = touched && jsonValue.trim() && errors.length === 0;\n\n return (\n <Dialog\n open={open}\n onOpenChange={(open) => !open && handleClose()}\n maxWidth=\"2xl\"\n >\n <DialogTitle className=\"flex items-center gap-2\">\n <CodeIcon size={iconSize.smallest}/>\n Import Collection from JSON\n </DialogTitle>\n <DialogContent className=\"flex flex-col gap-4\">\n <Typography variant=\"body2\" color=\"secondary\">\n Paste a JSON object representing your collection configuration.\n The JSON must include <code className=\"bg-surface-raised px-1 rounded\">id</code>,\n <code className=\"bg-surface-raised px-1 rounded\">name</code>,\n <code className=\"bg-surface-raised px-1 rounded\">path</code>, and\n <code className=\"bg-surface-raised px-1 rounded\">properties</code>.\n </Typography>\n\n <TextField\n multiline\n minRows={12}\n aria-label=\"Collection JSON\"\n value={jsonValue}\n onChange={handleJsonChange}\n placeholder={EXAMPLE_JSON}\n error={errors.length > 0 && touched}\n className=\"w-full\"\n inputClassName=\"font-mono text-sm resize-none overflow-y-auto h-[300px]\"\n />\n\n {errors.length > 0 && touched && (\n <Alert color=\"error\">\n <Typography variant=\"body2\" className=\"font-medium mb-2\">\n Validation errors:\n </Typography>\n <ul className=\"list-disc list-inside space-y-1\">\n {errors.map((error, index) => (\n <li key={index} className=\"text-sm\">\n {error.path ? (\n <>\n <code className=\"bg-red-100 dark:bg-red-900/40 px-1 rounded\">\n {error.path}\n </code>\n : {error.message}\n </>\n ) : (\n error.message\n )}\n </li>\n ))}\n </ul>\n </Alert>\n )}\n\n {isValid && (\n <Alert color=\"success\">\n <Typography variant=\"body2\">\n ✓ JSON is valid and ready to import\n </Typography>\n </Alert>\n )}\n </DialogContent>\n <DialogActions>\n <Button\n variant=\"text\"\n onClick={handleClose}\n >\n Cancel\n </Button>\n <Button\n variant=\"filled\"\n color=\"primary\"\n onClick={handleImport}\n disabled={!isValid}\n >\n Import Collection\n </Button>\n </DialogActions>\n </Dialog>\n );\n}\n"],"mappings":";;;;;AAmBA,IAAM,eAAe;;;;;;;;;;;;;;;;;;;;;AA4BrB,SAAgB,2BAA2B,EACvC,MACA,SACA,YACgC;CAChC,MAAM,CAAC,WAAW,gBAAgB,SAAiB,EAAE;CACrD,MAAM,CAAC,QAAQ,aAAa,SAAsC,CAAC,CAAC;CACpE,MAAM,CAAC,SAAS,cAAc,SAAS,KAAK;CAE5C,MAAM,mBAAmB,aAAa,MAAiE;EACnG,MAAM,QAAQ,EAAE,OAAO;EACvB,aAAa,KAAK;EAClB,WAAW,IAAI;EAEf,IAAI,CAAC,MAAM,KAAK,GAAG;GACf,UAAU,CAAC,CAAC;GACZ;EACJ;EAEA,MAAM,SAAS,uBAAuB,KAAK;EAC3C,UAAU,OAAO,MAAM;CAC3B,GAAG,CAAC,CAAC;CAEL,MAAM,eAAe,kBAAkB;EACnC,MAAM,SAAS,uBAAuB,SAAS;EAC/C,IAAI,OAAO,SAAS,OAAO,YAAY;GACnC,SAAS,OAAO,UAAU;GAC1B,aAAa,EAAE;GACf,UAAU,CAAC,CAAC;GACZ,WAAW,KAAK;GAChB,QAAQ;EACZ;CACJ,GAAG;EAAC;EAAW;EAAU;CAAO,CAAC;CAEjC,MAAM,cAAc,kBAAkB;EAClC,aAAa,EAAE;EACf,UAAU,CAAC,CAAC;EACZ,WAAW,KAAK;EAChB,QAAQ;CACZ,GAAG,CAAC,OAAO,CAAC;CAEZ,MAAM,UAAU,WAAW,UAAU,KAAK,KAAK,OAAO,WAAW;CAEjE,OACI,qBAAC,QAAD;EACU;EACN,eAAe,SAAS,CAAC,QAAQ,YAAY;EAC7C,UAAS;YAHb;GAKI,qBAAC,aAAD;IAAa,WAAU;cAAvB,CACI,oBAAC,UAAD,EAAU,MAAM,SAAS,SAAU,CAAA,GAAC,6BAE3B;;GACb,q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