@rebasepro/cms 0.30.0 → 0.31.0-canary.g902a0ce
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 +8 -8
- package/dist/collection_editor/ConfigControllerProvider.js +25 -22
- package/dist/collection_editor/ConfigControllerProvider.js.map +1 -1
- package/dist/collection_editor/firestore_callee.d.ts +10 -0
- package/dist/collection_editor/firestore_callee.js +15 -0
- package/dist/collection_editor/firestore_callee.js.map +1 -0
- package/dist/collection_editor/firestore_edit.d.ts +62 -0
- package/dist/collection_editor/firestore_edit.js +339 -0
- package/dist/collection_editor/firestore_edit.js.map +1 -0
- package/dist/collection_editor/index.d.ts +2 -3
- package/dist/collection_editor/liveSchemaClient.d.ts +44 -22
- package/dist/collection_editor/liveSchemaClient.js +9 -3
- package/dist/collection_editor/liveSchemaClient.js.map +1 -1
- package/dist/collection_editor/property_column.d.ts +86 -0
- package/dist/collection_editor/property_column.js +719 -0
- package/dist/collection_editor/property_column.js.map +1 -0
- package/dist/collection_editor/serializable_types.d.ts +2 -24
- package/dist/collection_editor/serializable_utils.d.ts +1 -1
- package/dist/collection_editor/serializable_utils.js +2 -1
- package/dist/collection_editor/serializable_utils.js.map +1 -1
- package/dist/collection_editor/split_edit.d.ts +106 -0
- package/dist/collection_editor/split_edit.js +564 -0
- package/dist/collection_editor/split_edit.js.map +1 -0
- package/dist/collection_editor/split_edit_error.d.ts +25 -0
- package/dist/collection_editor/split_edit_error.js +35 -0
- package/dist/collection_editor/split_edit_error.js.map +1 -0
- package/dist/collection_editor/types/collection_editor_controller.d.ts +1 -1
- package/dist/collection_editor/types/config_controller.d.ts +67 -1
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.d.ts +6 -5
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js +44 -12
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js +18 -3
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js +94 -55
- package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/CollectionRelationsTab.d.ts +2 -1
- package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/EnumForm.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/EnumForm.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js +3 -3
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.d.ts +2 -3
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.js +1 -1
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js +1 -1
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/PropertyTree.d.ts +7 -4
- package/dist/collection_editor/ui/collection_editor/PropertyTree.js +15 -5
- package/dist/collection_editor/ui/collection_editor/PropertyTree.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/SchemaChangeDialog.js +1 -1
- package/dist/collection_editor/ui/collection_editor/SchemaChangeDialog.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/SchemaEditRefusalView.d.ts +20 -0
- package/dist/collection_editor/ui/collection_editor/SchemaEditRefusalView.js +74 -0
- package/dist/collection_editor/ui/collection_editor/SchemaEditRefusalView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/conditions/ConditionsEditor.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/conditions/EnumConditionsEditor.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/conditions/property_paths.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/rlsRuleForm.d.ts +34 -0
- package/dist/collection_editor/ui/collection_editor/rlsRuleForm.js +50 -0
- package/dist/collection_editor/ui/collection_editor/rlsRuleForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.d.ts +1 -2
- package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.js.map +1 -1
- package/dist/collection_editor/useDetachRulesConfirmation.d.ts +16 -0
- package/dist/collection_editor/useDetachRulesConfirmation.js +48 -0
- package/dist/collection_editor/useDetachRulesConfirmation.js.map +1 -0
- package/dist/collection_editor/useLiveSchemaEditing.d.ts +2 -2
- package/dist/collection_editor/useLiveSchemaEditing.js +1 -1
- package/dist/collection_editor/useLiveSchemaEditing.js.map +1 -1
- package/dist/collection_editor/useLocalCollectionsConfigController.d.ts +54 -10
- package/dist/collection_editor/useLocalCollectionsConfigController.js +394 -122
- package/dist/collection_editor/useLocalCollectionsConfigController.js.map +1 -1
- package/dist/collection_editor/validateCollectionJson.js.map +1 -1
- package/dist/components/CollectionPanel.d.ts +10 -9
- package/dist/components/CollectionPanel.js +5 -2
- package/dist/components/CollectionPanel.js.map +1 -1
- package/dist/components/CollectionTableBinding/CollectionRowActions.d.ts +1 -2
- package/dist/components/CollectionTableBinding/CollectionRowActions.js.map +1 -1
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js.map +1 -1
- package/dist/components/CollectionTableBinding/CollectionTableBindingProps.d.ts +3 -5
- package/dist/components/CollectionTableBinding/PropertyTableCell.d.ts +2 -2
- package/dist/components/CollectionTableBinding/PropertyTableCell.js.map +1 -1
- package/dist/components/CollectionTableBinding/column_utils.d.ts +1 -1
- package/dist/components/CollectionTableBinding/column_utils.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.d.ts +2 -2
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js +1 -2
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.d.ts +2 -2
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js +2 -2
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableRelationField.d.ts +2 -2
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js +1 -2
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.d.ts +2 -1
- package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableStorageUpload.d.ts +2 -2
- package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.d.ts +1 -1
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js +1 -1
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js.map +1 -1
- package/dist/components/CollectionTableBinding/internal/common.d.ts +1 -2
- package/dist/components/CollectionTableBinding/internal/common.js.map +1 -1
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.d.ts +1 -1
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js +2 -2
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js.map +1 -1
- package/dist/components/CollectionTableBinding/table_bindings.d.ts +2 -2
- package/dist/components/CollectionTableBinding/table_bindings.js.map +1 -1
- package/dist/components/CollectionViewBinding/BoardCardBinding.d.ts +1 -1
- package/dist/components/CollectionViewBinding/BoardCardBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.d.ts +1 -2
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js +9 -5
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.d.ts +1 -2
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionEntityActions.d.ts +1 -1
- package/dist/components/CollectionViewBinding/CollectionEntityActions.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.d.ts +1 -2
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js +1 -1
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionToolbar.js +1 -1
- package/dist/components/CollectionViewBinding/CollectionToolbar.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewActions.js +2 -4
- package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewBinding.d.ts +6 -6
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewContent.js +1 -2
- package/dist/components/CollectionViewBinding/CollectionViewContent.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.d.ts +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js.map +1 -1
- package/dist/components/CollectionViewBinding/CustomViewHost.d.ts +1 -2
- package/dist/components/CollectionViewBinding/CustomViewHost.js.map +1 -1
- package/dist/components/CollectionViewBinding/EntitiesCount.js +3 -3
- package/dist/components/CollectionViewBinding/EntitiesCount.js.map +1 -1
- package/dist/components/CollectionViewBinding/EntityCardBinding.d.ts +1 -2
- package/dist/components/CollectionViewBinding/EntityCardBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.js +1 -1
- package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.js.map +1 -1
- package/dist/components/CollectionViewBinding/FilterPresetsButton.d.ts +1 -2
- package/dist/components/CollectionViewBinding/FilterPresetsButton.js +1 -1
- package/dist/components/CollectionViewBinding/FilterPresetsButton.js.map +1 -1
- package/dist/components/CollectionViewBinding/FiltersButton.d.ts +1 -2
- package/dist/components/CollectionViewBinding/FiltersButton.js.map +1 -1
- package/dist/components/CollectionViewBinding/FiltersDialog.d.ts +1 -1
- package/dist/components/CollectionViewBinding/FiltersDialog.js.map +1 -1
- package/dist/components/CollectionViewBinding/PluginColumnSlots.d.ts +1 -2
- package/dist/components/CollectionViewBinding/PluginColumnSlots.js.map +1 -1
- package/dist/components/CollectionViewBinding/RowActions.d.ts +1 -2
- package/dist/components/CollectionViewBinding/RowActions.js.map +1 -1
- package/dist/components/CollectionViewBinding/SortButton.d.ts +1 -1
- package/dist/components/CollectionViewBinding/SortButton.js.map +1 -1
- package/dist/components/CollectionViewBinding/SplitListView.d.ts +1 -2
- package/dist/components/CollectionViewBinding/SplitListView.js.map +1 -1
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.d.ts +1 -2
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js +1 -1
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js.map +1 -1
- package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.d.ts +1 -2
- package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.js.map +1 -1
- package/dist/components/CollectionViewBinding/useBoardDataController.d.ts +2 -1
- package/dist/components/CollectionViewBinding/useBoardDataController.js +3 -3
- package/dist/components/CollectionViewBinding/useBoardDataController.js.map +1 -1
- package/dist/components/CollectionViewBinding/useCollectionViewState.d.ts +2 -4
- package/dist/components/CollectionViewBinding/useCollectionViewState.js +14 -19
- package/dist/components/CollectionViewBinding/useCollectionViewState.js.map +1 -1
- package/dist/components/CollectionViewBinding/usePreviewSlots.d.ts +1 -3
- package/dist/components/CollectionViewBinding/usePreviewSlots.js.map +1 -1
- package/dist/components/CollectionViewBinding/useSelectionController.d.ts +1 -2
- package/dist/components/CollectionViewBinding/useSelectionController.js.map +1 -1
- package/dist/components/CollectionsProvider.d.ts +23 -8
- package/dist/components/CollectionsProvider.js +23 -7
- package/dist/components/CollectionsProvider.js.map +1 -1
- package/dist/components/DefaultDrawer.js +1 -1
- package/dist/components/DeleteEntityDialog.d.ts +1 -1
- package/dist/components/DeleteEntityDialog.js +1 -1
- package/dist/components/DeleteEntityDialog.js.map +1 -1
- package/dist/components/DetailViewBinding.js +3 -3
- package/dist/components/DetailViewBinding.js.map +1 -1
- package/dist/components/EditFormActions.js.map +1 -1
- package/dist/components/EditViewBinding.d.ts +2 -1
- package/dist/components/EditViewBinding.js +6 -6
- package/dist/components/EditViewBinding.js.map +1 -1
- package/dist/components/EntityDisplayHeader.d.ts +1 -2
- package/dist/components/EntityDisplayHeader.js.map +1 -1
- package/dist/components/EntityInspector.d.ts +1 -2
- package/dist/components/EntityInspector.js.map +1 -1
- package/dist/components/EntityPreviewBinding.d.ts +1 -1
- package/dist/components/EntityPreviewBinding.js +1 -1
- package/dist/components/EntityPreviewBinding.js.map +1 -1
- package/dist/components/EntityViewBinding.d.ts +1 -1
- package/dist/components/EntityViewBinding.js.map +1 -1
- package/dist/components/EntityViewBody.d.ts +1 -1
- package/dist/components/EntityViewBody.js +3 -4
- package/dist/components/EntityViewBody.js.map +1 -1
- package/dist/components/FieldValue.js +2 -2
- package/dist/components/FieldValue.js.map +1 -1
- package/dist/components/HomePage/ContentHomePage.js +12 -3
- package/dist/components/HomePage/ContentHomePage.js.map +1 -1
- package/dist/components/InlineEntityPreview.d.ts +1 -1
- package/dist/components/InlineEntityPreview.js.map +1 -1
- package/dist/components/PropertyCollectionView.d.ts +2 -2
- package/dist/components/PropertyCollectionView.js.map +1 -1
- package/dist/components/PropertyConfigBadge.js.map +1 -1
- package/dist/components/RebaseCMS.d.ts +22 -3
- package/dist/components/RebaseCMS.js +32 -14
- package/dist/components/RebaseCMS.js.map +1 -1
- package/dist/components/RebaseNavigation.js +106 -31
- package/dist/components/RebaseNavigation.js.map +1 -1
- package/dist/components/RecordDetail.js +4 -1
- package/dist/components/RecordDetail.js.map +1 -1
- package/dist/components/RecordForm.d.ts +5 -5
- package/dist/components/RecordForm.js +5 -2
- package/dist/components/RecordForm.js.map +1 -1
- package/dist/components/ReferenceTable/SelectionTableBinding.d.ts +2 -2
- package/dist/components/ReferenceTable/SelectionTableBinding.js +1 -1
- package/dist/components/ReferenceTable/SelectionTableBinding.js.map +1 -1
- package/dist/components/ReferenceWidget.d.ts +2 -1
- package/dist/components/ReferenceWidget.js +2 -2
- package/dist/components/ReferenceWidget.js.map +1 -1
- package/dist/components/RelationSelector.d.ts +2 -1
- package/dist/components/RelationSelector.js +2 -3
- package/dist/components/RelationSelector.js.map +1 -1
- package/dist/components/SelectableTable/SelectableTable.d.ts +2 -2
- package/dist/components/SelectableTable/SelectableTable.js.map +1 -1
- package/dist/components/SelectableTable/filters/FilterFieldBinding.d.ts +2 -1
- package/dist/components/SelectableTable/filters/FilterFieldBinding.js +3 -3
- package/dist/components/SelectableTable/filters/FilterFieldBinding.js.map +1 -1
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js +2 -2
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js.map +1 -1
- package/dist/components/SelectableTable/filters/RelationFilterField.d.ts +1 -1
- package/dist/components/SelectableTable/filters/RelationFilterField.js +1 -1
- package/dist/components/SelectableTable/filters/RelationFilterField.js.map +1 -1
- package/dist/components/SelectableTable/filters/StringNumberFilterField.d.ts +1 -1
- package/dist/components/SelectableTable/filters/StringNumberFilterField.js.map +1 -1
- package/dist/components/SelectableTable/filters/null_filter.d.ts +1 -3
- package/dist/components/SelectableTable/filters/null_filter.js.map +1 -1
- package/dist/components/SidePanelBinding.js +1 -1
- package/dist/components/SidePanelBinding.js.map +1 -1
- package/dist/components/field_configs.d.ts +1 -2
- package/dist/components/field_configs.js.map +1 -1
- package/dist/components/field_ids.d.ts +1 -1
- package/dist/components/field_ids.js +1 -1
- package/dist/components/field_ids.js.map +1 -1
- package/dist/components/history/EntityHistoryEntry.js.map +1 -1
- package/dist/components/history/EntityHistoryView.d.ts +1 -2
- package/dist/components/history/EntityHistoryView.js +1 -1
- package/dist/components/history/EntityHistoryView.js.map +1 -1
- package/dist/data_export/export/BasicExportAction.d.ts +1 -1
- package/dist/data_export/export/BasicExportAction.js.map +1 -1
- package/dist/data_export/export/ExportCollectionAction.js +2 -2
- package/dist/data_export/export/ExportCollectionAction.js.map +1 -1
- package/dist/data_export/export/additional_fields.d.ts +1 -1
- package/dist/data_export/export/additional_fields.js.map +1 -1
- package/dist/data_export/export/export.d.ts +1 -1
- package/dist/data_export/export/export.js +1 -1
- package/dist/data_export/export/export.js.map +1 -1
- package/dist/data_export/export/fetch_export_data.d.ts +3 -2
- package/dist/data_export/export/fetch_export_data.js.map +1 -1
- package/dist/data_import/components/DataNewPropertiesMapping.d.ts +1 -1
- package/dist/data_import/components/DataNewPropertiesMapping.js.map +1 -1
- package/dist/data_import/components/ImportNewPropertyFieldPreview.d.ts +1 -1
- package/dist/data_import/components/ImportNewPropertyFieldPreview.js.map +1 -1
- package/dist/data_import/hooks/useImportConfig.js.map +1 -1
- package/dist/data_import/import/ImportCollectionAction.d.ts +2 -2
- package/dist/data_import/import/ImportCollectionAction.js.map +1 -1
- package/dist/data_import/types/column_mapping.d.ts +1 -1
- package/dist/data_import/utils/data.d.ts +1 -2
- package/dist/data_import/utils/data.js +1 -2
- package/dist/data_import/utils/data.js.map +1 -1
- package/dist/data_import/utils/get_import_inference_type.d.ts +1 -1
- package/dist/data_import/utils/get_import_inference_type.js.map +1 -1
- package/dist/data_import/utils/id_column.d.ts +1 -1
- package/dist/data_import/utils/id_column.js.map +1 -1
- package/dist/data_import/utils/import_columns.d.ts +1 -1
- package/dist/data_import/utils/import_columns.js.map +1 -1
- package/dist/data_import/utils/save_entities.d.ts +3 -3
- package/dist/data_import/utils/save_entities.js +1 -1
- package/dist/data_import/utils/save_entities.js.map +1 -1
- package/dist/form/EntityForm.js +2 -1
- package/dist/form/EntityForm.js.map +1 -1
- package/dist/form/EntityFormActions.js.map +1 -1
- package/dist/form/EntityFormBinding.js +2 -2
- package/dist/form/EntityFormBinding.js.map +1 -1
- package/dist/form/FormFieldsContext.d.ts +1 -4
- package/dist/form/FormFieldsContext.js +1 -1
- package/dist/form/FormFieldsContext.js.map +1 -1
- package/dist/form/PropertyFieldBinding.js +6 -8
- package/dist/form/PropertyFieldBinding.js.map +1 -1
- package/dist/form/components/FieldBlock.d.ts +1 -2
- package/dist/form/components/FieldBlock.js.map +1 -1
- package/dist/form/components/FieldHelperText.d.ts +1 -1
- package/dist/form/components/FieldHelperText.js.map +1 -1
- package/dist/form/components/FormRail.d.ts +1 -1
- package/dist/form/components/FormRail.js.map +1 -1
- package/dist/form/components/LocalChangesMenu.d.ts +1 -1
- package/dist/form/components/LocalChangesMenu.js.map +1 -1
- package/dist/form/components/StorageItemPreview.d.ts +1 -1
- package/dist/form/components/StorageItemPreview.js.map +1 -1
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js +1 -1
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.d.ts +2 -2
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js +2 -2
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/BinaryFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/BinaryFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/BlockFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/BlockFieldBinding.js +1 -1
- package/dist/form/field_bindings/BlockFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/DateTimeFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/DateTimeFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/GeopointFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/GeopointFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/KeyValueFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/KeyValueFieldBinding.js +1 -2
- package/dist/form/field_bindings/KeyValueFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MapFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js +1 -1
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/MultiSelectFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MultiSelectFieldBinding.js +1 -1
- package/dist/form/field_bindings/MultiSelectFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/MultipleRelationFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js +2 -2
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/ReadOnlyFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/ReadOnlyFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/ReferenceFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/ReferenceFieldBinding.js +2 -2
- package/dist/form/field_bindings/ReferenceFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/RelationFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/RelationFieldBinding.js +2 -2
- package/dist/form/field_bindings/RelationFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/RepeatFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/RepeatFieldBinding.js +1 -1
- package/dist/form/field_bindings/RepeatFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/SelectFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/SelectFieldBinding.js +1 -1
- package/dist/form/field_bindings/SelectFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +2 -2
- package/dist/form/field_bindings/StorageUploadFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/SwitchFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/SwitchFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/TextFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/TextFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/UserSelectFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/UserSelectFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/VectorFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/VectorFieldBinding.js.map +1 -1
- package/dist/form/form_utils.d.ts +3 -3
- package/dist/form/form_utils.js +1 -2
- package/dist/form/form_utils.js.map +1 -1
- package/dist/form/label_placement.d.ts +1 -2
- package/dist/form/label_placement.js.map +1 -1
- package/dist/form/resolve_cell_property.d.ts +1 -2
- package/dist/form/resolve_cell_property.js +1 -1
- package/dist/form/resolve_cell_property.js.map +1 -1
- package/dist/form/resolve_form_properties.d.ts +2 -2
- package/dist/form/resolve_form_properties.js +1 -1
- package/dist/form/resolve_form_properties.js.map +1 -1
- package/dist/form/useClearRestoreValue.d.ts +1 -1
- package/dist/form/useClearRestoreValue.js.map +1 -1
- package/dist/form/validation.d.ts +2 -2
- package/dist/form/validation.js +1 -1
- package/dist/form/validation.js.map +1 -1
- package/dist/hooks/navigation/compose_collections.d.ts +59 -0
- package/dist/hooks/navigation/compose_collections.js +48 -0
- package/dist/hooks/navigation/compose_collections.js.map +1 -0
- package/dist/hooks/navigation/compose_collections_input.d.ts +8 -0
- package/dist/hooks/navigation/compose_collections_input.js +17 -0
- package/dist/hooks/navigation/compose_collections_input.js.map +1 -0
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.d.ts +1 -1
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.js.map +1 -1
- package/dist/hooks/navigation/registered_collection.d.ts +15 -0
- package/dist/hooks/navigation/registered_collection.js +20 -0
- package/dist/hooks/navigation/registered_collection.js.map +1 -0
- package/dist/hooks/navigation/ui_preferences.d.ts +47 -0
- package/dist/hooks/navigation/ui_preferences.js +179 -0
- package/dist/hooks/navigation/ui_preferences.js.map +1 -0
- package/dist/hooks/navigation/useAsyncResolver.d.ts +8 -1
- package/dist/hooks/navigation/useAsyncResolver.js +9 -3
- package/dist/hooks/navigation/useAsyncResolver.js.map +1 -1
- package/dist/hooks/navigation/useBuildCollectionRegistryController.d.ts +1 -3
- package/dist/hooks/navigation/useBuildCollectionRegistryController.js +3 -3
- package/dist/hooks/navigation/useBuildCollectionRegistryController.js.map +1 -1
- package/dist/hooks/navigation/useBuildNavigationStateController.d.ts +9 -5
- package/dist/hooks/navigation/useBuildNavigationStateController.js +2 -1
- package/dist/hooks/navigation/useBuildNavigationStateController.js.map +1 -1
- package/dist/hooks/navigation/useBuildUrlController.d.ts +1 -1
- package/dist/hooks/navigation/useBuildUrlController.js.map +1 -1
- package/dist/hooks/navigation/useNavigationResolution.js +1 -2
- package/dist/hooks/navigation/useNavigationResolution.js.map +1 -1
- package/dist/hooks/navigation/usePanelTables.d.ts +11 -0
- package/dist/hooks/navigation/usePanelTables.js +33 -0
- package/dist/hooks/navigation/usePanelTables.js.map +1 -0
- package/dist/hooks/navigation/useResolvedCollections.d.ts +8 -3
- package/dist/hooks/navigation/useResolvedCollections.js +3 -2
- package/dist/hooks/navigation/useResolvedCollections.js.map +1 -1
- package/dist/hooks/navigation/useResolvedViews.d.ts +1 -2
- package/dist/hooks/navigation/useResolvedViews.js.map +1 -1
- package/dist/hooks/navigation/useTopLevelNavigation.d.ts +1 -2
- package/dist/hooks/navigation/useTopLevelNavigation.js.map +1 -1
- package/dist/hooks/navigation/user_preferences_overlay.d.ts +21 -0
- package/dist/hooks/navigation/user_preferences_overlay.js +101 -0
- package/dist/hooks/navigation/user_preferences_overlay.js.map +1 -0
- package/dist/hooks/navigation/utils.js +1 -1
- package/dist/hooks/navigation/utils.js.map +1 -1
- package/dist/hooks/useAdminContext.d.ts +1 -2
- package/dist/hooks/useAdminContext.js.map +1 -1
- package/dist/hooks/useBuildSidePanel.d.ts +1 -2
- package/dist/hooks/useBuildSidePanel.js +2 -1
- package/dist/hooks/useBuildSidePanel.js.map +1 -1
- package/dist/hooks/useChildViewSource.d.ts +1 -1
- package/dist/hooks/useChildViewSource.js +1 -1
- package/dist/hooks/useChildViewSource.js.map +1 -1
- package/dist/hooks/useEntityDisplay.d.ts +1 -2
- package/dist/hooks/useEntityDisplay.js +1 -1
- package/dist/hooks/useEntityDisplay.js.map +1 -1
- package/dist/hooks/useEntityDisplayTitle.d.ts +2 -2
- package/dist/hooks/useEntityDisplayTitle.js.map +1 -1
- package/dist/hooks/useHistory.js +1 -1
- package/dist/hooks/useHistory.js.map +1 -1
- package/dist/hooks/useRecordActions.d.ts +1 -2
- package/dist/hooks/useRecordActions.js.map +1 -1
- package/dist/hooks/useReferencePaths.d.ts +21 -7
- package/dist/hooks/useReferencePaths.js +23 -6
- package/dist/hooks/useReferencePaths.js.map +1 -1
- package/dist/hooks/useResolvedNavigationFrom.d.ts +3 -3
- package/dist/hooks/useResolvedNavigationFrom.js +1 -1
- package/dist/hooks/useResolvedNavigationFrom.js.map +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.js +8 -2
- package/dist/mcp_view/app_modules.d.ts +2 -2
- package/dist/mcp_view/app_modules.js +4 -4
- package/dist/mcp_view/app_modules.js.map +1 -1
- package/dist/mcp_view/index.d.ts +16 -19
- package/dist/mcp_view/index.js +43 -62
- package/dist/mcp_view/index.js.map +1 -1
- package/dist/mcp_view/payload.d.ts +54 -18
- package/dist/mcp_view/payload.js +49 -24
- package/dist/mcp_view/payload.js.map +1 -1
- package/dist/mcp_view/screen.js +11 -11
- package/dist/mcp_view/screen.js.map +1 -1
- package/dist/mcp_view/tool_driver.d.ts +5 -34
- package/dist/mcp_view/tool_driver.js +17 -16
- package/dist/mcp_view/tool_driver.js.map +1 -1
- package/dist/mcp_view/write_review.d.ts +1 -2
- package/dist/mcp_view/write_review.js +1 -1
- package/dist/mcp_view/write_review.js.map +1 -1
- package/dist/preview/PropertyPreview.d.ts +1 -1
- package/dist/preview/PropertyPreview.js +4 -3
- package/dist/preview/PropertyPreview.js.map +1 -1
- package/dist/preview/components/ArrayEnumPreview.d.ts +1 -1
- package/dist/preview/components/ArrayEnumPreview.js.map +1 -1
- package/dist/preview/components/BooleanPreview.d.ts +1 -1
- package/dist/preview/components/BooleanPreview.js.map +1 -1
- package/dist/preview/components/EnumValuesChip.d.ts +1 -1
- package/dist/preview/components/EnumValuesChip.js +1 -1
- package/dist/preview/components/EnumValuesChip.js.map +1 -1
- package/dist/preview/components/ReferencePreview.d.ts +1 -1
- package/dist/preview/components/ReferencePreview.js.map +1 -1
- package/dist/preview/components/RelationPreview.d.ts +1 -1
- package/dist/preview/components/RelationPreview.js.map +1 -1
- package/dist/preview/components/StorageThumbnail.js +2 -1
- package/dist/preview/components/StorageThumbnail.js.map +1 -1
- package/dist/preview/components/UserPreview.d.ts +1 -1
- package/dist/preview/components/UserPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayOfMapsPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOfMapsPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayOfReferencesPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOfReferencesPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayOfRelationsPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOfRelationsPreview.js +2 -1
- package/dist/preview/property_previews/ArrayOfRelationsPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayOfStringsPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOfStringsPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayOneOfPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOneOfPreview.js +1 -1
- package/dist/preview/property_previews/ArrayOneOfPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.js +1 -1
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayPropertyPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayPropertyPreview.js +1 -1
- package/dist/preview/property_previews/ArrayPropertyPreview.js.map +1 -1
- package/dist/preview/property_previews/MapPropertyPreview.d.ts +1 -1
- package/dist/preview/property_previews/MapPropertyPreview.js.map +1 -1
- package/dist/preview/property_previews/NumberPropertyPreview.d.ts +1 -1
- package/dist/preview/property_previews/NumberPropertyPreview.js +1 -1
- package/dist/preview/property_previews/NumberPropertyPreview.js.map +1 -1
- package/dist/preview/property_previews/SkeletonPropertyComponent.d.ts +1 -1
- package/dist/preview/property_previews/SkeletonPropertyComponent.js.map +1 -1
- package/dist/preview/property_previews/StringPropertyPreview.d.ts +1 -1
- package/dist/preview/property_previews/StringPropertyPreview.js.map +1 -1
- package/dist/preview/util.d.ts +1 -1
- package/dist/preview/util.js.map +1 -1
- package/dist/routes/RebaseRoute.js +2 -2
- package/dist/routes/RebaseRoute.js.map +1 -1
- package/dist/saved_apps/SavedAppsView.d.ts +1 -1
- package/dist/saved_apps/SavedAppsView.js +1 -1
- package/dist/saved_apps/SavedAppsView.js.map +1 -1
- package/dist/selection/SelectionMenu.d.ts +1 -1
- package/dist/selection/SelectionMenu.js.map +1 -1
- package/dist/selection/resolve_selection.d.ts +3 -3
- package/dist/selection/resolve_selection.js +3 -2
- package/dist/selection/resolve_selection.js.map +1 -1
- package/dist/tables/apply_customization.d.ts +65 -0
- package/dist/tables/apply_customization.js +644 -0
- package/dist/tables/apply_customization.js.map +1 -0
- package/dist/tables/column_property.d.ts +64 -0
- package/dist/tables/column_property.js +549 -0
- package/dist/tables/column_property.js.map +1 -0
- package/dist/tables/customize_table.d.ts +39 -0
- package/dist/tables/customize_table.js +247 -0
- package/dist/tables/customize_table.js.map +1 -0
- package/dist/tables/index.d.ts +12 -0
- package/dist/tables/labels.d.ts +18 -0
- package/dist/tables/labels.js +18 -0
- package/dist/tables/labels.js.map +1 -0
- package/dist/tables/project_table.d.ts +79 -0
- package/dist/tables/project_table.js +148 -0
- package/dist/tables/project_table.js.map +1 -0
- package/dist/tables/relations.d.ts +47 -0
- package/dist/tables/relations.js +112 -0
- package/dist/tables/relations.js.map +1 -0
- package/dist/tables/rls.d.ts +39 -0
- package/dist/tables/rls.js +111 -0
- package/dist/tables/rls.js.map +1 -0
- package/dist/tables/update_record.d.ts +32 -0
- package/dist/tables/update_record.js +40 -0
- package/dist/tables/update_record.js.map +1 -0
- package/dist/types/components/EntityFormActionsProps.d.ts +1 -1
- package/dist/types/components/PropertyPreviewProps.d.ts +2 -2
- package/dist/types/fields.d.ts +2 -2
- package/dist/util/dataControllerAdapter.js.map +1 -1
- package/dist/util/entity_pages.d.ts +2 -1
- package/dist/util/entity_pages.js.map +1 -1
- package/dist/util/find_entities_by_ids.d.ts +2 -2
- package/dist/util/find_entities_by_ids.js +1 -1
- package/dist/util/find_entities_by_ids.js.map +1 -1
- package/dist/util/format_collection_date.d.ts +1 -1
- package/dist/util/format_collection_date.js.map +1 -1
- package/dist/util/identity.d.ts +8 -0
- package/dist/util/identity.js +16 -0
- package/dist/util/identity.js.map +1 -0
- package/dist/util/navigation_utils.js +1 -1
- package/dist/util/navigation_utils.js.map +1 -1
- package/dist/util/previews.js +1 -1
- package/dist/util/previews.js.map +1 -1
- package/dist/util/propertyConfigMapper.d.ts +1 -1
- package/dist/util/propertyConfigMapper.js.map +1 -1
- package/dist/util/property_utils.d.ts +1 -3
- package/dist/util/property_utils.js +1 -1
- package/dist/util/property_utils.js.map +1 -1
- package/dist/util/relations.d.ts +18 -0
- package/dist/util/relations.js +32 -0
- package/dist/util/relations.js.map +1 -0
- package/package.json +12 -10
- package/recipes/README.md +4 -4
- package/recipes/my-preferences.tsx +34 -26
- package/recipes/site-settings.tsx +34 -27
- package/dist/collection_editor/collection_wire.d.ts +0 -13
- package/dist/collection_editor/collection_wire.js +0 -49
- package/dist/collection_editor/collection_wire.js.map +0 -1
- package/dist/collection_editor/useJsonCollectionsConfigController.d.ts +0 -37
- package/dist/collection_editor/useJsonCollectionsConfigController.js +0 -191
- package/dist/collection_editor/useJsonCollectionsConfigController.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyFieldPreview.js","names":[],"sources":["../../../../src/collection_editor/ui/collection_editor/PropertyFieldPreview.tsx"],"sourcesContent":["import { useCustomizationController } from \"@rebasepro/app\";\nimport { getFieldConfig } from \"../../../components/field_configs\";\nimport { PropertyConfigBadge } from \"../../../components/PropertyConfigBadge\";\nimport { ErrorBoundary } from \"@rebasepro/ui\";\nimport { Property } from \"@rebasepro/types\";\nimport { isPropertyBuilder } from \"@rebasepro/common\";\nimport { cls, Paper, Typography } from \"@rebasepro/ui\";\nimport { FunctionSquareIcon, iconSize, MinusCircleIcon } from \"@rebasepro/ui\";\n\n\nexport function PropertyFieldPreview({\n property,\n propertyKey,\n onClick,\n hasError,\n includeName,\n includeEditButton,\n selected\n}: {\n property: Property,\n propertyKey?: string,\n hasError?: boolean,\n selected?: boolean,\n includeName?: boolean,\n includeEditButton?: boolean;\n onClick?: () => void\n}) {\n\n const { propertyConfigs } = useCustomizationController();\n const propertyConfig = getFieldConfig(property, propertyConfigs);\n\n\n const borderColorClass = hasError\n ? \"border-red-500 dark:border-red-500 border-red-500/100 dark:border-red-500/100 ring-0 dark:ring-0\"\n : (selected ? \"border-primary\" : \"\");\n\n return <ErrorBoundary>\n <div onClick={onClick} className={onClick ? \"cursor-pointer\" : \"\"}>\n <div\n className={cls(\n \"w-full flex flex-row gap-3 items-center px-3 py-2 rounded-lg transition-all duration-200 border bg-surface-card shadow-xs\",\n borderColorClass || \"border-hairline-strong\",\n selected\n ? \"bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary-light ring-1 ring-inset ring-primary border-primary/30\"\n : \"hover:bg-surface-hover\"\n )}\n >\n <PropertyConfigBadge propertyConfig={propertyConfig} size=\"small\"/>\n\n <div className=\"flex-1 flex flex-col min-w-0 mr-16\">\n {includeName &&\n <ErrorBoundary>\n <div className=\"flex items-center gap-2 min-w-0\">\n <Typography variant=\"body2\" component=\"span\" className=\"truncate font-medium\">\n {property.name || propertyKey || \"\\u00a0\"}\n </Typography>\n {propertyConfig?.name && (\n <Typography\n variant={\"caption\"}\n component=\"span\"\n className=\"text-text-secondary dark:text-text-secondary-dark shrink-0\">\n {propertyConfig.name}\n </Typography>\n )}\n </div>\n <div className=\"flex items-center gap-1.5 mt-0.5 min-w-0\">\n {propertyKey && (\n <Typography variant=\"caption\" component=\"span\" color=\"secondary\" className=\"font-mono truncate\">\n {propertyKey}\n </Typography>\n )}\n <ErrorBoundary>\n <Typography variant=\"caption\" component=\"span\" className=\"shrink-0 text-text-disabled dark:text-text-disabled-dark font-mono\">\n · {\"columnType\" in property ? (property as { columnType?: string }).columnType ?? property.type : property.type}\n </Typography>\n </ErrorBoundary>\n </div>\n </ErrorBoundary>}\n\n {!includeName &&\n <div className=\"flex flex-row items-center gap-2\">\n <ErrorBoundary>\n <Typography\n variant={\"caption\"}\n component=\"span\"\n className=\"text-text-secondary dark:text-text-secondary-dark font-medium\">\n {propertyConfig?.name}\n </Typography>\n </ErrorBoundary>\n </div>}\n </div>\n\n {includeEditButton && <Typography variant={\"button\"}>EDIT</Typography>}\n </div>\n </div>\n </ErrorBoundary>\n}\n\nexport function NonEditablePropertyPreview({\n name,\n selected,\n onClick,\n property\n}: {\n name: string,\n selected: boolean,\n onClick?: () => void,\n property?: Property\n}) {\n\n const { propertyConfigs } = useCustomizationController();\n const propertyConfig = !isPropertyBuilder(property) && property ? getFieldConfig(property, propertyConfigs) : undefined;\n\n return (\n <div onClick={onClick} className={onClick ? \"cursor-pointer\" : \"\"}>\n <div\n className={cls(\n \"w-full flex flex-row gap-3 items-center px-3 py-2 rounded-lg transition-all duration-200 border bg-surface-card border-hairline-strong shadow-xs\",\n selected\n ? \"bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary-light ring-1 ring-inset ring-primary border-primary/30\"\n : \"hover:bg-surface-hover\"\n )}\n >\n <div className={\"relative shrink-0\"}>\n {propertyConfig && <PropertyConfigBadge propertyConfig={propertyConfig} size=\"small\"/>}\n {!propertyConfig && <div\n className={\"h-8 w-8 flex items-center justify-center rounded-full shadow-2xs text-white bg-surface-500\"}>\n <FunctionSquareIcon className={\"text-inherit\"} size={iconSize.small}/>\n </div>}\n <MinusCircleIcon className={\"text-surface-accent-400 absolute -right-2 -top-2 bg-surface-card rounded-full\"} size={iconSize.small}/>\n </div>\n\n <div className=\"flex-1 flex flex-col min-w-0 mr-16\">\n <div className=\"flex items-center gap-2 min-w-0\">\n <Typography variant=\"label\" component=\"span\" className=\"truncate\">\n {property?.name ? property.name : name}\n </Typography>\n {propertyConfig && <Typography variant={\"caption\"} component=\"span\" className=\"text-text-secondary dark:text-text-secondary-dark shrink-0\">\n {propertyConfig?.name}\n </Typography>}\n </div>\n\n <div className=\"flex flex-row items-center gap-1.5 mt-0.5 min-w-0\">\n <Typography variant=\"caption\" component=\"span\" color=\"secondary\" className=\"font-mono truncate\">\n {name}\n </Typography>\n\n {property && isPropertyBuilder(property) && <ErrorBoundary>\n <Typography variant=\"caption\" component=\"span\" className=\"text-text-disabled dark:text-text-disabled-dark\">\n · Defined in code\n </Typography>\n </ErrorBoundary>}\n\n {!property && <ErrorBoundary>\n <Typography variant=\"caption\" component=\"span\" className=\"text-text-disabled dark:text-text-disabled-dark\">\n · Additional field\n </Typography>\n </ErrorBoundary>}\n </div>\n </div>\n </div>\n </div>\n )\n}\n"],"mappings":";;;;;;;AAUA,SAAgB,qBAAqB,EACjC,UACA,aACA,SACA,UACA,aACA,mBACA,YASD;CAEC,MAAM,EAAE,oBAAoB,2BAA2B;CACvD,MAAM,iBAAiB,eAAe,UAAU,eAAe;CAO/D,OAAO,oBAAC,eAAD,EAAA,UACH,oBAAC,OAAD;EAAc;EAAS,WAAW,UAAU,mBAAmB;YAC/D,qBAAC,OAAD;GACI,WAAW,IACP,8HARa,WACnB,qGACC,WAAW,mBAAmB,OAOL,0BACpB,WACM,2HACA,wBACV;aAPJ;IASI,oBAAC,qBAAD;KAAqC;KAAgB,MAAK;IAAQ,CAAA;IAElE,qBAAC,OAAD;KAAK,WAAU;eAAf,CACK,eACG,qBAAC,eAAD,EAAA,UAAA,CACI,qBAAC,OAAD;MAAK,WAAU;gBAAf,CACI,oBAAC,YAAD;OAAY,SAAQ;OAAQ,WAAU;OAAO,WAAU;iBAClD,SAAS,QAAQ,eAAe;MACzB,CAAA,GACX,gBAAgB,QACb,oBAAC,YAAD;OACI,SAAS;OACT,WAAU;OACV,WAAU;iBACT,eAAe;MACR,CAAA,CAEf;SACL,qBAAC,OAAD;MAAK,WAAU;gBAAf,CACK,eACG,oBAAC,YAAD;OAAY,SAAQ;OAAU,WAAU;OA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AAO;KAC1B,CAAA,GACX,kBAAkB,oBAAC,YAAD;MAAY,SAAS;MAAW,WAAU;MAAO,WAAU;gBACzE,gBAAgB;KACT,CAAA,CACX;QAEL,qBAAC,OAAD;KAAK,WAAU;eAAf;MACI,oBAAC,YAAD;OAAY,SAAQ;OAAU,WAAU;OAAO,OAAM;OAAY,WAAU;iBACtE;MACO,CAAA;MAEX,YAAY,kBAAkB,QAAQ,KAAK,oBAAC,eAAD,EAAA,UACxC,oBAAC,YAAD;OAAY,SAAQ;OAAU,WAAU;OAAO,WAAU;iBAAkD;MAE/F,CAAA,EACD,CAAA;MAEd,CAAC,YAAY,oBAAC,eAAD,EAAA,UACV,oBAAC,YAAD;OAAY,SAAQ;OAAU,WAAU;OAAO,WAAU;iBAAkD;MAE/F,CAAA,EACD,CAAA;KACd;MACJ;KACJ;;CACA,CAAA;AAEb"}
|
|
1
|
+
{"version":3,"file":"PropertyFieldPreview.js","names":[],"sources":["../../../../src/collection_editor/ui/collection_editor/PropertyFieldPreview.tsx"],"sourcesContent":["import { useCustomizationController } from \"@rebasepro/app\";\nimport { getFieldConfig } from \"../../../components/field_configs\";\nimport { PropertyConfigBadge } from \"../../../components/PropertyConfigBadge\";\nimport { ErrorBoundary } from \"@rebasepro/ui\";\nimport { isPropertyBuilder, Property } from \"@rebasepro/cms-types\";\nimport { cls, Paper, Typography } from \"@rebasepro/ui\";\nimport { FunctionSquareIcon, iconSize, MinusCircleIcon } from \"@rebasepro/ui\";\n\n\nexport function PropertyFieldPreview({\n property,\n propertyKey,\n onClick,\n hasError,\n includeName,\n includeEditButton,\n selected\n}: {\n property: Property,\n propertyKey?: string,\n hasError?: boolean,\n selected?: boolean,\n includeName?: boolean,\n includeEditButton?: boolean;\n onClick?: () => void\n}) {\n\n const { propertyConfigs } = useCustomizationController();\n const propertyConfig = getFieldConfig(property, propertyConfigs);\n\n\n const borderColorClass = hasError\n ? \"border-red-500 dark:border-red-500 border-red-500/100 dark:border-red-500/100 ring-0 dark:ring-0\"\n : (selected ? \"border-primary\" : \"\");\n\n return <ErrorBoundary>\n <div onClick={onClick} className={onClick ? \"cursor-pointer\" : \"\"}>\n <div\n className={cls(\n \"w-full flex flex-row gap-3 items-center px-3 py-2 rounded-lg transition-all duration-200 border bg-surface-card shadow-xs\",\n borderColorClass || \"border-hairline-strong\",\n selected\n ? \"bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary-light ring-1 ring-inset ring-primary border-primary/30\"\n : \"hover:bg-surface-hover\"\n )}\n >\n <PropertyConfigBadge propertyConfig={propertyConfig} size=\"small\"/>\n\n <div className=\"flex-1 flex flex-col min-w-0 mr-16\">\n {includeName &&\n <ErrorBoundary>\n <div className=\"flex items-center gap-2 min-w-0\">\n <Typography variant=\"body2\" component=\"span\" className=\"truncate font-medium\">\n {property.name || propertyKey || \"\\u00a0\"}\n </Typography>\n {propertyConfig?.name && (\n <Typography\n variant={\"caption\"}\n component=\"span\"\n className=\"text-text-secondary dark:text-text-secondary-dark shrink-0\">\n {propertyConfig.name}\n </Typography>\n )}\n </div>\n <div className=\"flex items-center gap-1.5 mt-0.5 min-w-0\">\n {propertyKey && (\n <Typography variant=\"caption\" component=\"span\" color=\"secondary\" className=\"font-mono truncate\">\n {propertyKey}\n </Typography>\n )}\n <ErrorBoundary>\n <Typography variant=\"caption\" component=\"span\" className=\"shrink-0 text-text-disabled dark:text-text-disabled-dark font-mono\">\n · {\"columnType\" in property ? (property as { columnType?: string }).columnType ?? property.type : property.type}\n </Typography>\n </ErrorBoundary>\n </div>\n </ErrorBoundary>}\n\n {!includeName &&\n <div className=\"flex flex-row items-center gap-2\">\n <ErrorBoundary>\n <Typography\n variant={\"caption\"}\n component=\"span\"\n className=\"text-text-secondary dark:text-text-secondary-dark font-medium\">\n {propertyConfig?.name}\n </Typography>\n </ErrorBoundary>\n </div>}\n </div>\n\n {includeEditButton && <Typography variant={\"button\"}>EDIT</Typography>}\n </div>\n </div>\n </ErrorBoundary>\n}\n\nexport function NonEditablePropertyPreview({\n name,\n selected,\n onClick,\n property\n}: {\n name: string,\n selected: boolean,\n onClick?: () => void,\n property?: Property\n}) {\n\n const { propertyConfigs } = useCustomizationController();\n const propertyConfig = !isPropertyBuilder(property) && property ? getFieldConfig(property, propertyConfigs) : undefined;\n\n return (\n <div onClick={onClick} className={onClick ? \"cursor-pointer\" : \"\"}>\n <div\n className={cls(\n \"w-full flex flex-row gap-3 items-center px-3 py-2 rounded-lg transition-all duration-200 border bg-surface-card border-hairline-strong shadow-xs\",\n selected\n ? \"bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary-light ring-1 ring-inset ring-primary border-primary/30\"\n : \"hover:bg-surface-hover\"\n )}\n >\n <div className={\"relative shrink-0\"}>\n {propertyConfig && <PropertyConfigBadge propertyConfig={propertyConfig} size=\"small\"/>}\n {!propertyConfig && <div\n className={\"h-8 w-8 flex items-center justify-center rounded-full shadow-2xs text-white bg-surface-500\"}>\n <FunctionSquareIcon className={\"text-inherit\"} size={iconSize.small}/>\n </div>}\n <MinusCircleIcon className={\"text-surface-accent-400 absolute -right-2 -top-2 bg-surface-card rounded-full\"} size={iconSize.small}/>\n </div>\n\n <div className=\"flex-1 flex flex-col min-w-0 mr-16\">\n <div className=\"flex items-center gap-2 min-w-0\">\n <Typography variant=\"label\" component=\"span\" className=\"truncate\">\n {property?.name ? property.name : name}\n </Typography>\n {propertyConfig && <Typography variant={\"caption\"} component=\"span\" className=\"text-text-secondary dark:text-text-secondary-dark shrink-0\">\n {propertyConfig?.name}\n </Typography>}\n </div>\n\n <div className=\"flex flex-row items-center gap-1.5 mt-0.5 min-w-0\">\n <Typography variant=\"caption\" component=\"span\" color=\"secondary\" className=\"font-mono truncate\">\n {name}\n </Typography>\n\n {property && isPropertyBuilder(property) && <ErrorBoundary>\n <Typography variant=\"caption\" component=\"span\" className=\"text-text-disabled dark:text-text-disabled-dark\">\n · Defined in code\n </Typography>\n </ErrorBoundary>}\n\n {!property && <ErrorBoundary>\n <Typography variant=\"caption\" component=\"span\" className=\"text-text-disabled dark:text-text-disabled-dark\">\n · Additional field\n </Typography>\n </ErrorBoundary>}\n </div>\n </div>\n </div>\n </div>\n )\n}\n"],"mappings":";;;;;;;AASA,SAAgB,qBAAqB,EACjC,UACA,aACA,SACA,UACA,aACA,mBACA,YASD;CAEC,MAAM,EAAE,oBAAoB,2BAA2B;CACvD,MAAM,iBAAiB,eAAe,UAAU,eAAe;CAO/D,OAAO,oBAAC,eAAD,EAAA,UACH,oBAAC,OAAD;EAAc;EAAS,WAAW,UAAU,mBAAmB;YAC/D,qBAAC,OAAD;GACI,WAAW,IACP,8HARa,WACnB,qGACC,WAAW,mBAAmB,OAOL,0BACpB,WACM,2HACA,wBACV;aAPJ;IASI,oBAAC,qBAAD;KAAqC;KAAgB,MAAK;IAAQ,CAAA;IAElE,qBAAC,OAAD;KAAK,WAAU;eAAf,CACK,eACG,qBAAC,eAAD,EAAA,UAAA,CACI,qBAAC,OAAD;MAAK,WAAU;gBAAf,CACI,oBAAC,YAAD;OAAY,SAAQ;OAAQ,WAAU;OAAO,WAAU;iBAClD,SAAS,QAAQ,eAAe;MACzB,CAAA,GACX,gBAAgB,QACb,oBAAC,YAAD;OACI,SAAS;OACT,WAAU;OACV,WAAU;iBACT,eAAe;MACR,CAAA,CAEf;SACL,qBAAC,OAAD;MAAK,WAAU;gBAAf,CACK,eACG,oBAAC,YAAD;OAAY,SAAQ;OAAU,WAAU;OAAO,OAAM;OAAY,WAAU;iBACtE;MACO,CAAA,GAEhB,oBAAC,eAAD,EAAA,UACI,qBAAC,YAAD;OAAY,SAAQ;OAAU,WAAU;OAAO,WAAU;iBAAzD,CAA8H,MACvH,gBAAgB,WAAY,SAAqC,cAAc,SAAS,OAAO,SAAS,IACnG;SACD,CAAA,CACd;OACM,EAAA,CAAA,GAElB,CAAC,eACE,oBAAC,OAAD;MAAK,WAAU;gBACX,oBAAC,eAAD,EAAA,UACI,oBAAC,YAAD;OACI,SAAS;OACT,WAAU;OACV,WAAU;iBACT,gB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AE/F,CAAA,EACD,CAAA;MAEd,CAAC,YAAY,oBAAC,eAAD,EAAA,UACV,oBAAC,YAAD;OAAY,SAAQ;OAAU,WAAU;OAAO,WAAU;iBAAkD;MAE/F,CAAA,EACD,CAAA;KACd;MACJ;KACJ;;CACA,CAAA;AAEb"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { Properties, Property } from "@rebasepro/types";
|
|
3
|
-
import { AdditionalFieldDelegate } from "@rebasepro/cms-types";
|
|
2
|
+
import { AdditionalFieldDelegate, Properties, Property } from "@rebasepro/cms-types";
|
|
4
3
|
export declare const PropertyTree: React.MemoExoticComponent<(<M extends {
|
|
5
4
|
[Key: string]: unknown;
|
|
6
|
-
}>({ namespace, selectedPropertyKey, onPropertyClick, properties, propertiesOrder: propertiesOrderProp, additionalFields, errors, onPropertyMove, onPropertyRemove, className, inferredPropertyKeys }: {
|
|
5
|
+
}>({ namespace, selectedPropertyKey, onPropertyClick, properties, propertiesOrder: propertiesOrderProp, additionalFields, errors, onPropertyMove, onPropertyRemove, className, inferredPropertyKeys, editedInCode }: {
|
|
7
6
|
namespace?: string;
|
|
8
7
|
selectedPropertyKey?: string;
|
|
9
8
|
onPropertyClick?: (propertyKey: string, namespace?: string) => void;
|
|
@@ -15,8 +14,10 @@ export declare const PropertyTree: React.MemoExoticComponent<(<M extends {
|
|
|
15
14
|
onPropertyRemove?: (propertyKey: string, namespace?: string) => void;
|
|
16
15
|
className?: string;
|
|
17
16
|
inferredPropertyKeys?: string[];
|
|
17
|
+
/** Top-level fields the schema editor reads as written in code, with why: shown read-only. */
|
|
18
|
+
editedInCode?: Record<string, string>;
|
|
18
19
|
}) => React.JSX.Element)>;
|
|
19
|
-
export declare function PropertyTreeEntry({ id, propertyKey, namespace, property, additionalField, selectedPropertyKey, errors, propertiesOrder, onPropertyClick, onPropertyMove, onPropertyRemove, inferredPropertyKeys }: {
|
|
20
|
+
export declare function PropertyTreeEntry({ id, propertyKey, namespace, property, additionalField, selectedPropertyKey, errors, propertiesOrder, onPropertyClick, onPropertyMove, onPropertyRemove, inferredPropertyKeys, editedInCode }: {
|
|
20
21
|
id: string;
|
|
21
22
|
propertyKey: string;
|
|
22
23
|
namespace?: string;
|
|
@@ -29,4 +30,6 @@ export declare function PropertyTreeEntry({ id, propertyKey, namespace, property
|
|
|
29
30
|
onPropertyMove?: (propertiesOrder: string[], namespace?: string) => void;
|
|
30
31
|
onPropertyRemove?: (propertyKey: string, namespace?: string) => void;
|
|
31
32
|
inferredPropertyKeys?: string[];
|
|
33
|
+
/** Why the schema editor reads this field as written in code, when it does. */
|
|
34
|
+
editedInCode?: string;
|
|
32
35
|
}): React.JSX.Element;
|
|
@@ -5,14 +5,14 @@ import React from "react";
|
|
|
5
5
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { deepEqual } from "fast-equals";
|
|
7
7
|
import { ArrowDownToLineIcon, ArrowUpToLineIcon, FileSearchIcon, IconButton, Menu, MenuItem, MoreVerticalIcon, Tooltip, Trash2Icon, cls, defaultBorderMixin, iconSize } from "@rebasepro/ui";
|
|
8
|
-
import { isPropertyBuilder } from "@rebasepro/
|
|
8
|
+
import { isPropertyBuilder } from "@rebasepro/cms-types";
|
|
9
9
|
import { AIModifiedIndicator, useTranslation } from "@rebasepro/app";
|
|
10
10
|
import { DndContext, KeyboardSensor, PointerSensor, closestCenter, useSensor, useSensors } from "@dnd-kit/core";
|
|
11
11
|
import { restrictToVerticalAxis } from "@dnd-kit/modifiers";
|
|
12
12
|
import { SortableContext, sortableKeyboardCoordinates, useSortable, verticalListSortingStrategy } from "@dnd-kit/sortable";
|
|
13
13
|
import { CSS } from "@dnd-kit/utilities";
|
|
14
14
|
//#region src/collection_editor/ui/collection_editor/PropertyTree.tsx
|
|
15
|
-
var PropertyTree = React.memo(function PropertyTree({ namespace, selectedPropertyKey, onPropertyClick, properties, propertiesOrder: propertiesOrderProp, additionalFields, errors, onPropertyMove, onPropertyRemove, className, inferredPropertyKeys }) {
|
|
15
|
+
var PropertyTree = React.memo(function PropertyTree({ namespace, selectedPropertyKey, onPropertyClick, properties, propertiesOrder: propertiesOrderProp, additionalFields, errors, onPropertyMove, onPropertyRemove, className, inferredPropertyKeys, editedInCode }) {
|
|
16
16
|
const propertyKeys = Object.keys(properties);
|
|
17
17
|
const filteredOrder = (propertiesOrderProp ?? propertyKeys).filter((key) => !key.includes(".") && properties[key]);
|
|
18
18
|
const missingKeys = propertyKeys.filter((key) => !filteredOrder.includes(key));
|
|
@@ -66,14 +66,15 @@ var PropertyTree = React.memo(function PropertyTree({ namespace, selectedPropert
|
|
|
66
66
|
onPropertyMove,
|
|
67
67
|
onPropertyRemove,
|
|
68
68
|
onPropertyClick,
|
|
69
|
-
selectedPropertyKey
|
|
69
|
+
selectedPropertyKey,
|
|
70
|
+
editedInCode: namespace ? void 0 : editedInCode?.[propertyKey]
|
|
70
71
|
}, id);
|
|
71
72
|
}).filter(Boolean)
|
|
72
73
|
})
|
|
73
74
|
})
|
|
74
75
|
});
|
|
75
76
|
}, deepEqual);
|
|
76
|
-
function PropertyTreeEntry({ id, propertyKey, namespace, property, additionalField, selectedPropertyKey, errors, propertiesOrder, onPropertyClick, onPropertyMove, onPropertyRemove, inferredPropertyKeys }) {
|
|
77
|
+
function PropertyTreeEntry({ id, propertyKey, namespace, property, additionalField, selectedPropertyKey, errors, propertiesOrder, onPropertyClick, onPropertyMove, onPropertyRemove, inferredPropertyKeys, editedInCode }) {
|
|
77
78
|
const { t } = useTranslation();
|
|
78
79
|
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({ id });
|
|
79
80
|
const style = {
|
|
@@ -100,7 +101,7 @@ function PropertyTreeEntry({ id, propertyKey, namespace, property, additionalFie
|
|
|
100
101
|
});
|
|
101
102
|
}
|
|
102
103
|
const selected = selectedPropertyKey === fullId;
|
|
103
|
-
const editable = property && !isPropertyBuilder(property);
|
|
104
|
+
const editable = property && !isPropertyBuilder(property) && editedInCode === void 0;
|
|
104
105
|
const isAIModified = useAIModifiedPaths()?.isPathModified(`properties.${propertyKey}`) ?? false;
|
|
105
106
|
return /* @__PURE__ */ jsx("div", {
|
|
106
107
|
ref: setNodeRef,
|
|
@@ -126,6 +127,15 @@ function PropertyTreeEntry({ id, propertyKey, namespace, property, additionalFie
|
|
|
126
127
|
includeName: true,
|
|
127
128
|
selected,
|
|
128
129
|
hasError
|
|
130
|
+
}) : editedInCode !== void 0 ? /* @__PURE__ */ jsx(Tooltip, {
|
|
131
|
+
title: editedInCode,
|
|
132
|
+
asChild: true,
|
|
133
|
+
children: /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(NonEditablePropertyPreview, {
|
|
134
|
+
name: propertyKey,
|
|
135
|
+
property,
|
|
136
|
+
onClick: onPropertyClick ? () => onPropertyClick(propertyKey, namespace) : void 0,
|
|
137
|
+
selected
|
|
138
|
+
}) })
|
|
129
139
|
}) : /* @__PURE__ */ jsx(NonEditablePropertyPreview, {
|
|
130
140
|
name: propertyKey,
|
|
131
141
|
property,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PropertyTree.js","names":[],"sources":["../../../../src/collection_editor/ui/collection_editor/PropertyTree.tsx"],"sourcesContent":["\nimport React from \"react\";\nimport { deepEqual as equal } from \"fast-equals\"\n\nimport { AIModifiedIndicator, useTranslation } from \"@rebasepro/app\";\nimport { Properties, Property } from \"@rebasepro/types\";\nimport { AdditionalFieldDelegate } from \"@rebasepro/cms-types\";\nimport { isPropertyBuilder } from \"@rebasepro/common\";\nimport {\n ArrowDownToLineIcon,\n ArrowUpToLineIcon,\n cls,\n defaultBorderMixin,\n FileSearchIcon,\n IconButton,\n iconSize,\n Menu,\n MenuItem,\n MoreVerticalIcon,\n Tooltip,\n Trash2Icon\n} from \"@rebasepro/ui\";\nimport { NonEditablePropertyPreview, PropertyFieldPreview } from \"./PropertyFieldPreview\";\nimport {\n closestCenter,\n DndContext,\n DragEndEvent,\n KeyboardSensor,\n PointerSensor,\n useSensor,\n useSensors\n} from \"@dnd-kit/core\";\nimport {\n SortableContext,\n sortableKeyboardCoordinates,\n useSortable,\n verticalListSortingStrategy\n} from \"@dnd-kit/sortable\";\nimport { restrictToVerticalAxis } from \"@dnd-kit/modifiers\";\n\nimport { CSS } from \"@dnd-kit/utilities\";\nimport { getFullId, getFullIdPath } from \"./util\";\n\nimport { useAIModifiedPaths } from \"./AIModifiedPathsContext\";\n\nexport const PropertyTree = React.memo(\n function PropertyTree<M extends {\n [Key: string]: unknown\n }>({\n namespace,\n selectedPropertyKey,\n onPropertyClick,\n properties,\n propertiesOrder: propertiesOrderProp,\n additionalFields,\n errors,\n onPropertyMove,\n onPropertyRemove,\n className,\n inferredPropertyKeys\n }: {\n namespace?: string;\n selectedPropertyKey?: string;\n onPropertyClick?: (propertyKey: string, namespace?: string) => void;\n properties: Properties;\n propertiesOrder?: string[];\n additionalFields?: AdditionalFieldDelegate<M>[];\n errors: Record<string, any>;\n onPropertyMove?: (propertiesOrder: string[], namespace?: string) => void;\n onPropertyRemove?: (propertyKey: string, namespace?: string) => void;\n className?: string;\n inferredPropertyKeys?: string[];\n }) {\n\n // Filter propertiesOrder to only include top-level keys (no dots) that exist in properties\n // Nested keys like \"data.mode\" are for column ordering in the table, not for the property editor\n const propertyKeys = Object.keys(properties);\n const filteredOrder = (propertiesOrderProp ?? propertyKeys)\n .filter(key => !key.includes(\".\") && properties[key as keyof typeof properties]);\n\n // Ensure all properties are included (append any missing ones)\n const missingKeys = propertyKeys.filter(key => !filteredOrder.includes(key));\n const propertiesOrder = [...filteredOrder, ...missingKeys];\n\n const sensors = useSensors(\n useSensor(PointerSensor, {\n activationConstraint: {\n distance: 5\n }\n }),\n useSensor(KeyboardSensor, {\n coordinateGetter: sortableKeyboardCoordinates\n })\n );\n\n const handleDragEnd = (event: DragEndEvent) => {\n const {\n active,\n over\n } = event;\n\n if (!over || active.id === over.id) {\n return;\n }\n\n const activeId = String(active.id);\n const overId = String(over.id);\n\n // Extract property keys from the full IDs\n const activeKey = activeId.includes(\".\") ? activeId.split(\".\").pop() : activeId;\n const overKey = overId.includes(\".\") ? overId.split(\".\").pop() : overId;\n\n if (!activeKey || !overKey) return;\n\n const oldIndex = propertiesOrder.indexOf(activeKey);\n const newIndex = propertiesOrder.indexOf(overKey);\n\n if (oldIndex !== -1 && newIndex !== -1) {\n const newPropertiesOrder = [...propertiesOrder];\n const [removed] = newPropertiesOrder.splice(oldIndex, 1);\n newPropertiesOrder.splice(newIndex, 0, removed);\n\n if (onPropertyMove) {\n onPropertyMove(newPropertiesOrder, namespace);\n }\n }\n };\n\n const items = propertiesOrder.map(key => getFullId(key, namespace));\n\n return (\n <DndContext\n sensors={sensors}\n collisionDetection={closestCenter}\n onDragEnd={handleDragEnd}\n modifiers={[restrictToVerticalAxis]}\n >\n <SortableContext\n items={items}\n strategy={verticalListSortingStrategy}\n >\n <div className={cls(\"flex flex-col gap-0.5\", className)}>\n\n {propertiesOrder && propertiesOrder\n .map((propertyKey: string, index: number) => {\n const property = properties[propertyKey];\n const additionalField = additionalFields?.find(field => field.key === propertyKey);\n\n if (!property && !additionalField) {\n console.warn(`Property ${propertyKey} not found in properties or additionalFields`);\n return null;\n }\n\n const id = getFullId(propertyKey, namespace);\n\n return (\n <PropertyTreeEntry\n key={id}\n id={id}\n propertyKey={propertyKey}\n property={property}\n additionalField={additionalField}\n errors={errors}\n namespace={namespace}\n propertiesOrder={propertiesOrder}\n inferredPropertyKeys={inferredPropertyKeys}\n onPropertyMove={onPropertyMove}\n onPropertyRemove={onPropertyRemove}\n onPropertyClick={onPropertyClick}\n selectedPropertyKey={selectedPropertyKey}\n\n />\n );\n }).filter(Boolean)}\n </div>\n </SortableContext>\n </DndContext>\n );\n },\n equal\n);\n\nexport function PropertyTreeEntry({\n id,\n propertyKey,\n namespace,\n property,\n additionalField,\n selectedPropertyKey,\n errors,\n propertiesOrder,\n onPropertyClick,\n onPropertyMove,\n onPropertyRemove,\n inferredPropertyKeys\n}: {\n id: string;\n propertyKey: string;\n namespace?: string;\n property: Property;\n additionalField?: AdditionalFieldDelegate<any>;\n selectedPropertyKey?: string;\n errors: Record<string, any>;\n propertiesOrder: string[];\n onPropertyClick?: (propertyKey: string, namespace?: string) => void;\n onPropertyMove?: (propertiesOrder: string[], namespace?: string) => void;\n onPropertyRemove?: (propertyKey: string, namespace?: string) => void;\n inferredPropertyKeys?: string[];\n}) {\n const { t } = useTranslation();\n\n const {\n attributes,\n listeners,\n setNodeRef,\n transform,\n transition,\n isDragging\n } = useSortable({\n id\n });\n\n const style = {\n // Key change: use Translate instead of Transform to prevent stretching\n transform: CSS.Translate.toString(transform),\n transition,\n zIndex: isDragging ? 10 : undefined,\n position: \"relative\" as const\n };\n\n const isPropertyInferred = inferredPropertyKeys?.includes(namespace ? `${namespace}.${propertyKey}` : propertyKey);\n const fullId = id;\n const fullIdPath = getFullIdPath(propertyKey, namespace);\n const hasError = fullIdPath in errors;\n\n let subtree;\n if (typeof property === \"object\") {\n if (property.type === \"map\" && property.properties) {\n subtree = <PropertyTree\n selectedPropertyKey={selectedPropertyKey}\n namespace={fullId}\n properties={property.properties}\n propertiesOrder={property.propertiesOrder}\n errors={errors}\n onPropertyClick={onPropertyClick}\n onPropertyMove={onPropertyMove}\n onPropertyRemove={onPropertyRemove}\n inferredPropertyKeys={inferredPropertyKeys}\n />\n }\n }\n\n const selected = selectedPropertyKey === fullId;\n const editable = property && !isPropertyBuilder(property);\n\n // Check if this property was AI-modified\n const aiModifiedPaths = useAIModifiedPaths();\n const isAIModified = aiModifiedPaths?.isPathModified(`properties.${propertyKey}`) ?? false;\n\n return (\n <div\n ref={setNodeRef}\n style={style}\n className=\"relative cursor-grab\"\n {...attributes}\n {...listeners}\n >\n <div className=\"relative\">\n {subtree && <div\n className={\"absolute border-l \" + defaultBorderMixin}\n style={{\n left: \"24px\",\n top: \"40px\",\n bottom: \"16px\"\n }}/>}\n\n <div>\n {!isPropertyBuilder(property) && !additionalField && editable\n ? <PropertyFieldPreview\n property={property}\n propertyKey={propertyKey}\n onClick={onPropertyClick ? () => onPropertyClick(propertyKey, namespace) : undefined}\n includeName={true}\n selected={selected}\n hasError={hasError}/>\n : <NonEditablePropertyPreview name={propertyKey}\n property={property}\n onClick={onPropertyClick ? () => onPropertyClick(propertyKey, namespace) : undefined}\n selected={selected}/>}\n </div>\n\n <div className=\"absolute top-1/2 -translate-y-1/2 right-2 flex flex-row items-center gap-1\">\n {isAIModified && <AIModifiedIndicator/>}\n {isPropertyInferred && <>\n <Tooltip title={\"Inferred property\"} asChild={true}>\n <IconButton aria-label={\"Inferred property\"} size=\"smallest\" disabled>\n <FileSearchIcon size={iconSize.smallest}/>\n </IconButton>\n </Tooltip>\n {onPropertyRemove && <Tooltip title={\"Remove inferred property\"}\n asChild={true}>\n <IconButton aria-label={\"Remove inferred property\"} size=\"smallest\"\n onClick={(e: React.MouseEvent) => {\n e.stopPropagation();\n onPropertyRemove(propertyKey, namespace);\n }}>\n <Trash2Icon size={iconSize.smallest}/>\n </IconButton>\n </Tooltip>}\n </>}\n\n <Menu\n trigger={\n <IconButton aria-label={t(\"more_actions\")}\n size=\"smallest\"\n >\n <MoreVerticalIcon size={iconSize.smallest}/>\n </IconButton>\n }\n >\n <MenuItem\n dense\n onClick={() => {\n const currentIndex = propertiesOrder.indexOf(propertyKey);\n if (currentIndex > 0) {\n const newOrder = propertiesOrder.filter(k => k !== propertyKey);\n newOrder.unshift(propertyKey);\n onPropertyMove?.(newOrder, namespace);\n }\n }}\n >\n <ArrowUpToLineIcon size={iconSize.smallest}/>\n Move to top\n </MenuItem>\n <MenuItem\n dense\n onClick={() => {\n const currentIndex = propertiesOrder.indexOf(propertyKey);\n if (currentIndex < propertiesOrder.length - 1) {\n const newOrder = propertiesOrder.filter(k => k !== propertyKey);\n newOrder.push(propertyKey);\n onPropertyMove?.(newOrder, namespace);\n }\n }}\n >\n <ArrowDownToLineIcon size={iconSize.smallest}/>\n Move to bottom\n </MenuItem>\n <MenuItem\n dense\n onClick={() => onPropertyRemove?.(propertyKey, namespace)}\n >\n <Trash2Icon size={iconSize.smallest}/>\n Delete\n </MenuItem>\n </Menu>\n\n </div>\n\n {subtree && <div className={\"ml-12\"}>{subtree}</div>}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AA6CA,IAAa,eAAe,MAAM,KAC9B,SAAS,aAEN,EACC,WACA,qBACA,iBACA,YACA,iBAAiB,qBACjB,kBACA,QACA,gBACA,kBACA,WACA,wBAaD;CAIC,MAAM,eAAe,OAAO,KAAK,UAAU;CAC3C,MAAM,iBAAiB,uBAAuB,aAAA,CACzC,QAAO,QAAO,CAAC,IAAI,SAAS,GAAG,KAAK,WAAW,IAA+B;CAGnF,MAAM,cAAc,aAAa,QAAO,QAAO,CAAC,cAAc,SAAS,GAAG,CAAC;CAC3E,MAAM,kBAAkB,CAAC,GAAG,eAAe,GAAG,WAAW;CAEzD,MAAM,UAAU,WACZ,UAAU,eAAe,EACrB,sBAAsB,EAClB,UAAU,EACd,EACJ,CAAC,GACD,UAAU,gBAAgB,EACtB,kBAAkB,4BACtB,CAAC,CACL;CAEA,MAAM,iBAAiB,UAAwB;EAC3C,MAAM,EACF,QACA,SACA;EAEJ,IAAI,CAAC,QAAQ,OAAO,OAAO,KAAK,IAC5B;EAGJ,MAAM,WAAW,OAAO,OAAO,EAAE;EACjC,MAAM,SAAS,OAAO,KAAK,EAAE;EAG7B,MAAM,YAAY,SAAS,SAAS,GAAG,IAAI,SAAS,MAAM,GAAG,CAAC,CAAC,IAAI,IAAI;EACvE,MAAM,UAAU,OAAO,SAAS,GAAG,IAAI,OAAO,MAAM,GAAG,CAAC,CAAC,IAAI,IAAI;EAEjE,IAAI,CAAC,aAAa,CAAC,SAAS;EAE5B,MAAM,WAAW,gBAAgB,QAAQ,SAAS;EAClD,MAAM,WAAW,gBAAgB,QAAQ,OAAO;EAEhD,IAAI,aAAa,MAAM,aAAa,IAAI;GACpC,MAAM,qBAAqB,CAAC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editor/ui/collection_editor/PropertyTree.tsx"],"sourcesContent":["\nimport React from \"react\";\nimport { deepEqual as equal } from \"fast-equals\"\n\nimport { AIModifiedIndicator, useTranslation } from \"@rebasepro/app\";\nimport { AdditionalFieldDelegate, isPropertyBuilder, Properties, Property } from \"@rebasepro/cms-types\";\nimport {\n ArrowDownToLineIcon,\n ArrowUpToLineIcon,\n cls,\n defaultBorderMixin,\n FileSearchIcon,\n IconButton,\n iconSize,\n Menu,\n MenuItem,\n MoreVerticalIcon,\n Tooltip,\n Trash2Icon\n} from \"@rebasepro/ui\";\nimport { NonEditablePropertyPreview, PropertyFieldPreview } from \"./PropertyFieldPreview\";\nimport {\n closestCenter,\n DndContext,\n DragEndEvent,\n KeyboardSensor,\n PointerSensor,\n useSensor,\n useSensors\n} from \"@dnd-kit/core\";\nimport {\n SortableContext,\n sortableKeyboardCoordinates,\n useSortable,\n verticalListSortingStrategy\n} from \"@dnd-kit/sortable\";\nimport { restrictToVerticalAxis } from \"@dnd-kit/modifiers\";\n\nimport { CSS } from \"@dnd-kit/utilities\";\nimport { getFullId, getFullIdPath } from \"./util\";\n\nimport { useAIModifiedPaths } from \"./AIModifiedPathsContext\";\n\nexport const PropertyTree = React.memo(\n function PropertyTree<M extends {\n [Key: string]: unknown\n }>({\n namespace,\n selectedPropertyKey,\n onPropertyClick,\n properties,\n propertiesOrder: propertiesOrderProp,\n additionalFields,\n errors,\n onPropertyMove,\n onPropertyRemove,\n className,\n inferredPropertyKeys,\n editedInCode\n }: {\n namespace?: string;\n selectedPropertyKey?: string;\n onPropertyClick?: (propertyKey: string, namespace?: string) => void;\n properties: Properties;\n propertiesOrder?: string[];\n additionalFields?: AdditionalFieldDelegate<M>[];\n errors: Record<string, any>;\n onPropertyMove?: (propertiesOrder: string[], namespace?: string) => void;\n onPropertyRemove?: (propertyKey: string, namespace?: string) => void;\n className?: string;\n inferredPropertyKeys?: string[];\n /** Top-level fields the schema editor reads as written in code, with why: shown read-only. */\n editedInCode?: Record<string, string>;\n }) {\n\n // Filter propertiesOrder to only include top-level keys (no dots) that exist in properties\n // Nested keys like \"data.mode\" are for column ordering in the table, not for the property editor\n const propertyKeys = Object.keys(properties);\n const filteredOrder = (propertiesOrderProp ?? propertyKeys)\n .filter(key => !key.includes(\".\") && properties[key as keyof typeof properties]);\n\n // Ensure all properties are included (append any missing ones)\n const missingKeys = propertyKeys.filter(key => !filteredOrder.includes(key));\n const propertiesOrder = [...filteredOrder, ...missingKeys];\n\n const sensors = useSensors(\n useSensor(PointerSensor, {\n activationConstraint: {\n distance: 5\n }\n }),\n useSensor(KeyboardSensor, {\n coordinateGetter: sortableKeyboardCoordinates\n })\n );\n\n const handleDragEnd = (event: DragEndEvent) => {\n const {\n active,\n over\n } = event;\n\n if (!over || active.id === over.id) {\n return;\n }\n\n const activeId = String(active.id);\n const overId = String(over.id);\n\n // Extract property keys from the full IDs\n const activeKey = activeId.includes(\".\") ? activeId.split(\".\").pop() : activeId;\n const overKey = overId.includes(\".\") ? overId.split(\".\").pop() : overId;\n\n if (!activeKey || !overKey) return;\n\n const oldIndex = propertiesOrder.indexOf(activeKey);\n const newIndex = propertiesOrder.indexOf(overKey);\n\n if (oldIndex !== -1 && newIndex !== -1) {\n const newPropertiesOrder = [...propertiesOrder];\n const [removed] = newPropertiesOrder.splice(oldIndex, 1);\n newPropertiesOrder.splice(newIndex, 0, removed);\n\n if (onPropertyMove) {\n onPropertyMove(newPropertiesOrder, namespace);\n }\n }\n };\n\n const items = propertiesOrder.map(key => getFullId(key, namespace));\n\n return (\n <DndContext\n sensors={sensors}\n collisionDetection={closestCenter}\n onDragEnd={handleDragEnd}\n modifiers={[restrictToVerticalAxis]}\n >\n <SortableContext\n items={items}\n strategy={verticalListSortingStrategy}\n >\n <div className={cls(\"flex flex-col gap-0.5\", className)}>\n\n {propertiesOrder && propertiesOrder\n .map((propertyKey: string, index: number) => {\n const property = properties[propertyKey];\n const additionalField = additionalFields?.find(field => field.key === propertyKey);\n\n if (!property && !additionalField) {\n console.warn(`Property ${propertyKey} not found in properties or additionalFields`);\n return null;\n }\n\n const id = getFullId(propertyKey, namespace);\n\n return (\n <PropertyTreeEntry\n key={id}\n id={id}\n propertyKey={propertyKey}\n property={property}\n additionalField={additionalField}\n errors={errors}\n namespace={namespace}\n propertiesOrder={propertiesOrder}\n inferredPropertyKeys={inferredPropertyKeys}\n onPropertyMove={onPropertyMove}\n onPropertyRemove={onPropertyRemove}\n onPropertyClick={onPropertyClick}\n selectedPropertyKey={selectedPropertyKey}\n editedInCode={namespace ? undefined : editedInCode?.[propertyKey]}\n />\n );\n }).filter(Boolean)}\n </div>\n </SortableContext>\n </DndContext>\n );\n },\n equal\n);\n\nexport function PropertyTreeEntry({\n id,\n propertyKey,\n namespace,\n property,\n additionalField,\n selectedPropertyKey,\n errors,\n propertiesOrder,\n onPropertyClick,\n onPropertyMove,\n onPropertyRemove,\n inferredPropertyKeys,\n editedInCode\n}: {\n id: string;\n propertyKey: string;\n namespace?: string;\n property: Property;\n additionalField?: AdditionalFieldDelegate<any>;\n selectedPropertyKey?: string;\n errors: Record<string, any>;\n propertiesOrder: string[];\n onPropertyClick?: (propertyKey: string, namespace?: string) => void;\n onPropertyMove?: (propertiesOrder: string[], namespace?: string) => void;\n onPropertyRemove?: (propertyKey: string, namespace?: string) => void;\n inferredPropertyKeys?: string[];\n /** Why the schema editor reads this field as written in code, when it does. */\n editedInCode?: string;\n}) {\n const { t } = useTranslation();\n\n const {\n attributes,\n listeners,\n setNodeRef,\n transform,\n transition,\n isDragging\n } = useSortable({\n id\n });\n\n const style = {\n // Key change: use Translate instead of Transform to prevent stretching\n transform: CSS.Translate.toString(transform),\n transition,\n zIndex: isDragging ? 10 : undefined,\n position: \"relative\" as const\n };\n\n const isPropertyInferred = inferredPropertyKeys?.includes(namespace ? `${namespace}.${propertyKey}` : propertyKey);\n const fullId = id;\n const fullIdPath = getFullIdPath(propertyKey, namespace);\n const hasError = fullIdPath in errors;\n\n let subtree;\n if (typeof property === \"object\") {\n if (property.type === \"map\" && property.properties) {\n subtree = <PropertyTree\n selectedPropertyKey={selectedPropertyKey}\n namespace={fullId}\n properties={property.properties}\n propertiesOrder={property.propertiesOrder}\n errors={errors}\n onPropertyClick={onPropertyClick}\n onPropertyMove={onPropertyMove}\n onPropertyRemove={onPropertyRemove}\n inferredPropertyKeys={inferredPropertyKeys}\n />\n }\n }\n\n const selected = selectedPropertyKey === fullId;\n const editable = property && !isPropertyBuilder(property) && editedInCode === undefined;\n\n // Check if this property was AI-modified\n const aiModifiedPaths = useAIModifiedPaths();\n const isAIModified = aiModifiedPaths?.isPathModified(`properties.${propertyKey}`) ?? false;\n\n return (\n <div\n ref={setNodeRef}\n style={style}\n className=\"relative cursor-grab\"\n {...attributes}\n {...listeners}\n >\n <div className=\"relative\">\n {subtree && <div\n className={\"absolute border-l \" + defaultBorderMixin}\n style={{\n left: \"24px\",\n top: \"40px\",\n bottom: \"16px\"\n }}/>}\n\n <div>\n {!isPropertyBuilder(property) && !additionalField && editable\n ? <PropertyFieldPreview\n property={property}\n propertyKey={propertyKey}\n onClick={onPropertyClick ? () => onPropertyClick(propertyKey, namespace) : undefined}\n includeName={true}\n selected={selected}\n hasError={hasError}/>\n : editedInCode !== undefined\n ? <Tooltip title={editedInCode} asChild={true}>\n <div>\n <NonEditablePropertyPreview name={propertyKey}\n property={property}\n onClick={onPropertyClick ? () => onPropertyClick(propertyKey, namespace) : undefined}\n selected={selected}/>\n </div>\n </Tooltip>\n : <NonEditablePropertyPreview name={propertyKey}\n property={property}\n onClick={onPropertyClick ? () => onPropertyClick(propertyKey, namespace) : undefined}\n selected={selected}/>}\n </div>\n\n <div className=\"absolute top-1/2 -translate-y-1/2 right-2 flex flex-row items-center gap-1\">\n {isAIModified && <AIModifiedIndicator/>}\n {isPropertyInferred && <>\n <Tooltip title={\"Inferred property\"} asChild={true}>\n <IconButton aria-label={\"Inferred property\"} size=\"smallest\" disabled>\n <FileSearchIcon size={iconSize.smallest}/>\n </IconButton>\n </Tooltip>\n {onPropertyRemove && <Tooltip title={\"Remove inferred property\"}\n asChild={true}>\n <IconButton aria-label={\"Remove inferred property\"} size=\"smallest\"\n onClick={(e: React.MouseEvent) => {\n e.stopPropagation();\n onPropertyRemove(propertyKey, namespace);\n }}>\n <Trash2Icon size={iconSize.smallest}/>\n </IconButton>\n </Tooltip>}\n </>}\n\n <Menu\n trigger={\n <IconButton aria-label={t(\"more_actions\")}\n size=\"smallest\"\n >\n <MoreVerticalIcon size={iconSize.smallest}/>\n </IconButton>\n }\n >\n <MenuItem\n dense\n onClick={() => {\n const currentIndex = propertiesOrder.indexOf(propertyKey);\n if (currentIndex > 0) {\n const newOrder = propertiesOrder.filter(k => k !== propertyKey);\n newOrder.unshift(propertyKey);\n onPropertyMove?.(newOrder, namespace);\n }\n }}\n >\n <ArrowUpToLineIcon size={iconSize.smallest}/>\n Move to top\n </MenuItem>\n <MenuItem\n dense\n onClick={() => {\n const currentIndex = propertiesOrder.indexOf(propertyKey);\n if (currentIndex < propertiesOrder.length - 1) {\n const newOrder = propertiesOrder.filter(k => k !== propertyKey);\n newOrder.push(propertyKey);\n onPropertyMove?.(newOrder, namespace);\n }\n }}\n >\n <ArrowDownToLineIcon size={iconSize.smallest}/>\n Move to bottom\n </MenuItem>\n <MenuItem\n dense\n onClick={() => onPropertyRemove?.(propertyKey, namespace)}\n >\n <Trash2Icon size={iconSize.smallest}/>\n Delete\n </MenuItem>\n </Menu>\n\n </div>\n\n {subtree && <div className={\"ml-12\"}>{subtree}</div>}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AA2CA,IAAa,eAAe,MAAM,KAC9B,SAAS,aAEN,EACC,WACA,qBACA,iBACA,YACA,iBAAiB,qBACjB,kBACA,QACA,gBACA,kBACA,WACA,sBACA,gBAeD;CAIC,MAAM,eAAe,OAAO,KAAK,UAAU;CAC3C,MAAM,iBAAiB,uBAAuB,aAAA,CACzC,QAAO,QAAO,CAAC,IAAI,SAAS,GAAG,KAAK,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AAD,EAAY,MAAM,SAAS,SAAU,CAAA;OAC7B,CAAA;MACP,CAAA,CACX,EAAA,CAAA;MAEF,qBAAC,MAAD;OACI,SACI,oBAAC,YAAD;QAAY,cAAY,EAAE,cAAc;QACpC,MAAK;kBAEL,oBAAC,kBAAD,EAAkB,MAAM,SAAS,SAAU,CAAA;OACnC,CAAA;iBANpB;QASI,qBAAC,UAAD;SACI,OAAA;SACA,eAAe;UAEX,IADqB,gBAAgB,QAAQ,WACzC,IAAe,GAAG;WAClB,MAAM,WAAW,gBAAgB,QAAO,MAAK,MAAM,WAAW;WAC9D,SAAS,QAAQ,WAAW;WAC5B,iBAAiB,UAAU,SAAS;UACxC;SACJ;mBATJ,CAWI,oBAAC,mBAAD,EAAmB,MAAM,SAAS,SAAU,CAAA,GAAC,aAEvC;;QACV,qBAAC,UAAD;SACI,OAAA;SACA,eAAe;UAEX,IADqB,gBAAgB,QAAQ,WACzC,IAAe,gBAAgB,SAAS,GAAG;WAC3C,MAAM,WAAW,gBAAgB,QAAO,MAAK,MAAM,WAAW;WAC9D,SAAS,KAAK,WAAW;WACzB,iBAAiB,UAAU,SAAS;UACxC;SACJ;mBATJ,CAWI,oBAAC,qBAAD,EAAqB,MAAM,SAAS,SAAU,CAAA,GAAC,gBAEzC;;QACV,qBAAC,UAAD;SACI,OAAA;SACA,eAAe,mBAAmB,aAAa,SAAS;mBAF5D,CAII,oBAAC,YAAD,EAAY,MAAM,SAAS,SAAU,CAAA,GAAC,QAEhC;;OACR;;KAEL;;IAEJ,WAAW,oBAAC,OAAD;KAAK,WAAW;eAAU;IAAa,CAAA;GAClD;;CACJ,CAAA;AAEb"}
|
|
@@ -160,7 +160,7 @@ function Applied({ result }) {
|
|
|
160
160
|
className: "flex flex-col gap-4",
|
|
161
161
|
children: [
|
|
162
162
|
/* @__PURE__ */ jsx(Alert, {
|
|
163
|
-
color: result.applied || result.sourceOnly ? "success" : "warning",
|
|
163
|
+
color: (result.applied || result.sourceOnly) && result.serving?.status !== "after-restart" ? "success" : "warning",
|
|
164
164
|
children: /* @__PURE__ */ jsx(Typography, {
|
|
165
165
|
variant: "body2",
|
|
166
166
|
children: result.summary
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SchemaChangeDialog.js","names":[],"sources":["../../../../src/collection_editor/ui/collection_editor/SchemaChangeDialog.tsx"],"sourcesContent":["/**\n * What a schema change would do, before it does it.\n *\n * The dialog exists because a schema change has three possible verdicts and two\n * of them are refusals. Without a preview, the only way to discover that a\n * change is refused is to press a button on a live database and read what comes\n * back — which is a fine way to learn and a poor way to work.\n *\n * ## What it shows, in the order somebody reads it\n *\n * The verdict first, in a sentence, because it decides whether the rest is\n * worth reading. Then the changes, each with what it does and — when it is\n * refused — what to do instead. Then the things that are easy to skip past and\n * expensive to have skipped: constraints the change asks for that the database\n * will not end up enforcing. The SQL and the file list come last, collapsed,\n * for the reader who wants them; they are the evidence, not the summary.\n *\n * ## Why the button says \"Commit and apply\"\n *\n * Because that is the order, and the order is the feature. The commit lands\n * first, so a failed apply leaves the repository ahead of the database — the\n * ordinary state of every project between an edit and a deploy, which the next\n * boot reconciles. A button labelled \"Save\" would be describing a different,\n * worse thing.\n */\nimport React from \"react\";\nimport {\n Alert,\n Button,\n Chip,\n CircularProgress,\n cls,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n ExpandablePanel,\n Typography\n} from \"@rebasepro/ui\";\nimport { useTranslation } from \"@rebasepro/app\";\n\nimport type { LiveSchemaPlan, LiveSchemaResult, WithheldConstraint } from \"../../liveSchemaClient\";\n\nexport interface SchemaChangeDialogProps {\n open: boolean;\n /** The collection being changed, for the title. */\n collectionId: string;\n /** `undefined` while the plan is still being fetched. */\n plan?: LiveSchemaPlan;\n /** Set when planning itself failed — a network error, a refusal, a 500. */\n planError?: string;\n /** Set once the change has been applied, which turns this into a receipt. */\n result?: LiveSchemaResult;\n applying: boolean;\n /** Set when the apply threw rather than returning a result. */\n applyError?: string;\n onConfirm: () => void;\n /**\n * Ask again, when planning failed.\n *\n * A dropped connection should cost a click, not the whole wizard. The form\n * is already filled in, and making somebody redo it for a transient failure\n * teaches them to distrust the preview rather than the network.\n */\n onRetry?: () => void;\n /**\n * Write the collection source and leave the database alone.\n *\n * Offered only when the change is refused, and it is what keeps the editor\n * usable while it is. Removing a property is the ordinary case: the ensure\n * path has no `DROP COLUMN`, so a removal can never be applied — and\n * refusing the whole save over it would mean a dev could no longer delete a\n * field from a collection they are still designing.\n *\n * This is exactly what the editor did before live editing existed, so it is\n * not a new hazard; the difference is that it now says what it leaves\n * behind instead of reporting success.\n */\n onSourceOnly?: () => void;\n onClose: () => void;\n /**\n * Why this caller may preview but not apply, when that is the case.\n *\n * A person signed in with an API key, most often. Shown next to a disabled\n * button so the refusal arrives while they are deciding rather than after\n * they have decided.\n */\n applyRefusedBecause?: string;\n /**\n * The change can only be committed as source — the deployment applies\n * nothing to its database — so {@link onSourceOnly} is the main action,\n * labelled \"Commit\", and not refused by {@link applyRefusedBecause}.\n */\n sourceOnlyIsTheCommit?: boolean;\n /**\n * Where a confirmation would land — `owner/repo` and a branch.\n *\n * On screen before the button, not in the receipt after it. A commit is\n * going somewhere, and which branch it is going to is the one fact somebody\n * cannot recover from being wrong about.\n */\n target?: { repository?: string; branch?: string };\n}\n\ntype Verdict = LiveSchemaPlan[\"verdict\"];\n\ntype Translate = ReturnType<typeof useTranslation>[\"t\"];\n\n/**\n * What the verdict means, in the words the reader needs rather than the enum's.\n *\n * `safe` is written twice because the two cases are genuinely different, and\n * saying \"can be made against the running database\" when nothing will be run is\n * the kind of small lie that teaches people to stop reading. A document\n * database has no table to alter, and a change that needs no DDL on a\n * relational one is in the same position: the commit *is* the change.\n */\nconst VERDICT_COPY: Record<Verdict, { titleKey: string; bodyKey: string; color: \"info\" | \"warning\" | \"error\" }> = {\n safe: {\n titleKey: \"schema_change_verdict_safe_title\",\n bodyKey: \"schema_change_verdict_safe_body\",\n color: \"info\"\n },\n diverges: {\n titleKey: \"schema_change_verdict_diverges_title\",\n bodyKey: \"schema_change_verdict_diverges_body\",\n color: \"warning\"\n },\n \"needs-migration\": {\n titleKey: \"schema_change_verdict_migration_title\",\n bodyKey: \"schema_change_verdict_migration_body\",\n color: \"error\"\n }\n};\n\nconst VERDICT_CHIP: Record<Verdict, { labelKey: string; scheme: \"greenLighter\" | \"orangeLighter\" | \"redLighter\" }> = {\n safe: { labelKey: \"schema_change_chip_safe\", scheme: \"greenLighter\" },\n diverges: { labelKey: \"schema_change_chip_diverges\", scheme: \"orangeLighter\" },\n \"needs-migration\": { labelKey: \"schema_change_chip_migration\", scheme: \"redLighter\" }\n};\n\nconst monospace = \"font-mono text-xs leading-relaxed\";\nconst codeBlock = cls(\n monospace,\n \"bg-surface-raised rounded-md p-3 overflow-x-auto whitespace-pre\"\n);\n\n/** A disclosure that starts closed. The evidence, for the reader who wants it. */\nfunction Details({ summary, count, children }: {\n summary: string;\n count: number;\n children: React.ReactNode;\n}) {\n if (count === 0) return null;\n return (\n <ExpandablePanel\n initiallyExpanded={false}\n titleClassName=\"!min-h-0 !py-2 px-3\"\n innerClassName=\"p-3\"\n title={<Typography variant=\"body2\" color=\"secondary\">{summary} ({count})</Typography>}\n >\n {children}\n </ExpandablePanel>\n );\n}\n\n/**\n * What still has to happen after this lands.\n *\n * Above the evidence and below the changes, because it is not a refusal and not\n * a detail: the change will apply, and something outside this dialog still has\n * to be done or a later environment will differ from this one.\n */\nfunction FollowUp({ items }: { items: string[] }) {\n const { t } = useTranslation();\n if (items.length === 0) return null;\n return (\n <Alert color=\"info\">\n <Typography variant=\"body2\" className=\"font-medium mb-1\">\n {items.length === 1 ? t(\"schema_change_follow_up_one\") : t(\"schema_change_follow_up\")}\n </Typography>\n <ul className=\"space-y-2\">\n {items.map(item => (\n <li key={item} className=\"text-sm\">{item}</li>\n ))}\n </ul>\n </Alert>\n );\n}\n\n/**\n * The destination, short enough to read at a glance.\n *\n * A remote repository already reports itself as `owner/repo`, which is exactly\n * what somebody recognises. A local one reports an absolute path, and the\n * leading directories are the part nobody needs: what matters is which\n * checkout, and its name says that.\n */\nfunction repositoryLabel(repository: string): string {\n if (!repository.startsWith(\"/\")) return repository;\n return repository.split(\"/\").filter(Boolean).pop() ?? repository;\n}\n\nfunction WithheldConstraints({ constraints }: { constraints: WithheldConstraint[] }) {\n const { t } = useTranslation();\n if (constraints.length === 0) return null;\n return (\n <Alert color=\"warning\">\n <Typography variant=\"body2\" className=\"font-medium mb-1\">\n {constraints.length === 1\n ? t(\"schema_change_withheld_one\")\n : t(\"schema_change_withheld_many\", { count: constraints.length })}\n </Typography>\n <ul className=\"space-y-2\">\n {constraints.map(constraint => (\n <li key={constraint.target} className=\"text-sm\">\n <Typography component=\"code\" variant=\"mono\" className=\"bg-surface-raised px-1 rounded-md\">\n {constraint.target}\n </Typography>\n <Typography variant=\"body2\" className=\"mt-1\">{constraint.reason}</Typography>\n <Typography variant=\"body2\" color=\"secondary\" className=\"mt-1\">\n {constraint.remedy}\n </Typography>\n </li>\n ))}\n </ul>\n </Alert>\n );\n}\n\n/**\n * How far a failed apply got, in a heading.\n *\n * The statements run one at a time with no transaction around them, so only\n * \"none ran\" means the database is as it was.\n */\nfunction partialApplyHeading(result: LiveSchemaResult, t: Translate): string {\n const ran = result.appliedStatements;\n if (ran === 0) return t(\"schema_change_db_not_changed\");\n if (ran === undefined) return t(\"schema_change_db_maybe_changed\");\n return t(\"schema_change_statements_partial\", { ran, total: result.statements.length });\n}\n\n/** The receipt. Shown in place of the plan once the change has been applied. */\nfunction Applied({ result }: { result: LiveSchemaResult }) {\n const { t } = useTranslation();\n return (\n <div className=\"flex flex-col gap-4\">\n <Alert color={result.applied || result.sourceOnly ? \"success\" : \"warning\"}>\n <Typography variant=\"body2\">{result.summary}</Typography>\n </Alert>\n\n {!result.applied && !result.sourceOnly && result.applyError && (\n // Deliberately not an error state. The commit landed, which is\n // the durable half; the database is now behind the repository,\n // which is where every project sits between an edit and a\n // deploy, and boot reconciles it.\n <Alert color=\"warning\">\n <Typography variant=\"body2\" className=\"font-medium mb-1\">\n {partialApplyHeading(result, t)}\n </Typography>\n <Typography variant=\"body2\">{result.applyError}</Typography>\n <Typography variant=\"body2\" className=\"mt-2\">\n {t(\"schema_change_commit_holds\", { branch: result.committed.branch })}\n </Typography>\n </Alert>\n )}\n\n <WithheldConstraints constraints={result.withheldConstraints ?? []}/>\n <FollowUp items={result.followUp ?? []}/>\n\n <div>\n <Typography variant=\"label\" color=\"secondary\">{t(\"schema_change_committed\")}</Typography>\n <div className={cls(codeBlock, \"mt-1\")}>\n {t(\"schema_change_committed_on\", { sha: result.committed.sha.slice(0, 9), branch: result.committed.branch })}\n {\"\\n\"}\n {result.committed.files.map(file => ` ${file}`).join(\"\\n\")}\n </div>\n </div>\n </div>\n );\n}\n\nexport function SchemaChangeDialog({\n open,\n collectionId,\n plan,\n planError,\n result,\n applying,\n applyError,\n onConfirm,\n onRetry,\n onSourceOnly,\n onClose,\n applyRefusedBecause,\n sourceOnlyIsTheCommit,\n target\n}: SchemaChangeDialogProps) {\n\n const { t } = useTranslation();\n const verdict = plan?.verdict;\n const statements = plan?.statements.length ?? 0;\n\n // \"Commit\" only when we positively know there is nothing to apply: a plan\n // that is going ahead and has no statements. A *refused* plan also has none\n // — because it will not run — and labelling that button \"Commit\" would be\n // describing the change it is refusing to make. Unknown reads as the fuller\n // action, which is the safer way to be wrong about a label.\n const commitOnly = Boolean(plan?.applicable) && statements === 0;\n\n // Described from the plan rather than from an assumption about the engine.\n // A document database runs nothing; so does a relational change that only\n // moves source. Both are a commit, and calling either one \"apply\" would be\n // describing something that does not happen.\n // A plan with changes and no statements still changes something — a\n // security rule takes effect when the server next starts — so \"there is\n // no schema change to make\" is said only when there is none.\n const copy = verdict === \"safe\" && commitOnly\n ? {\n title: t(\"schema_change_commit_only_title\"),\n body: plan && plan.changes.length > 0\n ? t(\"schema_change_commit_only_body\")\n : t(\"schema_change_commit_only_body_no_changes\"),\n color: \"info\" as const\n }\n : verdict\n ? {\n title: t(VERDICT_COPY[verdict].titleKey),\n body: t(VERDICT_COPY[verdict].bodyKey),\n color: VERDICT_COPY[verdict].color\n }\n : undefined;\n\n return (\n <Dialog open={open} onOpenChange={value => { if (!value) onClose(); }} maxWidth=\"3xl\">\n <DialogTitle className=\"flex items-center gap-2\">\n {result\n ? (result.sourceOnly ? t(\"schema_change_title_committed\") : t(\"schema_change_title_applied\"))\n : t(\"schema_change_title_review\")}\n <Typography component=\"code\" variant=\"mono\" color=\"secondary\">\n {collectionId}\n </Typography>\n </DialogTitle>\n\n <DialogContent className=\"flex flex-col gap-4\">\n {planError && (\n <Alert color=\"error\">\n <Typography variant=\"body2\" className=\"font-medium mb-1\">\n {t(\"schema_change_plan_failed\")}\n </Typography>\n <Typography variant=\"body2\">{planError}</Typography>\n </Alert>\n )}\n\n {!plan && !planError && !result && (\n <div className=\"flex items-center gap-3 py-6\">\n <CircularProgress size=\"small\"/>\n <Typography variant=\"body2\" color=\"secondary\">\n {t(\"schema_change_planning\")}\n </Typography>\n </div>\n )}\n\n {result && <Applied result={result}/>}\n\n {plan && !result && copy && (\n <>\n <Alert color={copy.color}>\n <Typography variant=\"body2\" className=\"font-medium mb-1\">\n {copy.title}\n </Typography>\n <Typography variant=\"body2\">{copy.body}</Typography>\n </Alert>\n\n {applyError && (\n <Alert color=\"error\">\n <Typography variant=\"body2\">{applyError}</Typography>\n </Alert>\n )}\n\n {plan.changes.length === 0 && (\n <Typography variant=\"body2\" color=\"secondary\">\n {t(\"schema_change_source_only_changes\")}\n </Typography>\n )}\n\n {!plan.applicable && onSourceOnly && (\n // Said per change: what a removal leaves behind is\n // not what a type change or a new required field\n // does, and the one that breaks every insert has to\n // be on screen before the button is pressed.\n <Alert color=\"warning\">\n <Typography variant=\"body2\" className=\"font-medium mb-1\">\n {t(\"schema_change_source_only_title\")}\n </Typography>\n <ul className=\"space-y-1\">\n {plan.changes.filter(change => change.verdict !== \"safe\" && change.sourceOnly).map((change, index) => (\n <li key={`${change.property ?? change.collection}.${index}`} className=\"text-sm\">\n {change.sourceOnly}\n </li>\n ))}\n </ul>\n </Alert>\n )}\n\n {plan.changes.length > 0 && (\n <ul className=\"flex flex-col gap-3\">\n {plan.changes.map((change, index) => (\n <li\n key={`${change.collection}.${change.property ?? \"\"}.${index}`}\n className=\"flex gap-3\"\n >\n <Chip\n size=\"smallest\"\n colorScheme={VERDICT_CHIP[change.verdict].scheme}\n className=\"shrink-0 mt-0.5\"\n >\n {t(VERDICT_CHIP[change.verdict].labelKey)}\n </Chip>\n <div className=\"min-w-0\">\n <Typography variant=\"body2\">{change.detail}</Typography>\n {change.remedy && (\n <Typography\n variant=\"body2\"\n color=\"secondary\"\n className=\"mt-1\"\n >\n {change.remedy}\n </Typography>\n )}\n </div>\n </li>\n ))}\n </ul>\n )}\n\n <WithheldConstraints constraints={plan.withheldConstraints ?? []}/>\n <FollowUp items={plan.followUp ?? []}/>\n\n {applyRefusedBecause && (\n <Alert color=\"info\">\n <Typography variant=\"body2\" className=\"font-medium mb-1\">\n {t(\"schema_change_preview_only\")}\n </Typography>\n <Typography variant=\"body2\">{applyRefusedBecause}</Typography>\n </Alert>\n )}\n\n <Details summary={t(\"schema_change_statements\")} count={plan.statements.length}>\n <div className={codeBlock}>{plan.statements.join(\"\\n\")}</div>\n </Details>\n\n <Details summary={t(\"schema_change_files\")} count={plan.files.length}>\n <div className={codeBlock}>{plan.files.join(\"\\n\")}</div>\n </Details>\n\n <Details summary={t(\"schema_change_message\")} count={plan.message ? 1 : 0}>\n <div className={codeBlock}>{plan.message}</div>\n </Details>\n </>\n )}\n </DialogContent>\n\n <DialogActions>\n {!result && target?.repository && (\n <Typography variant=\"caption\" color=\"secondary\" className={cls(monospace, \"mr-auto truncate\")}>\n → {repositoryLabel(target.repository)}{target.branch ? ` · ${target.branch}` : \"\"}\n </Typography>\n )}\n <Button variant=\"text\" onClick={onClose} disabled={applying}>\n {result ? t(\"close\") : t(\"cancel\")}\n </Button>\n {!result && planError && onRetry && (\n <Button variant=\"outlined\" onClick={onRetry}>\n {t(\"retry\")}\n </Button>\n )}\n {!result && plan && !plan.applicable && onSourceOnly && (\n <Button variant=\"outlined\" onClick={onSourceOnly} disabled={applying}>\n {t(\"schema_change_edit_source_only\")}\n </Button>\n )}\n {!result && sourceOnlyIsTheCommit && onSourceOnly && (\n <Button variant=\"filled\" color=\"primary\" onClick={onSourceOnly} disabled={applying}>\n {applying ? t(\"schema_change_committing\") : t(\"schema_change_commit\")}\n </Button>\n )}\n {!result && !(sourceOnlyIsTheCommit && onSourceOnly) && (\n <Button\n variant=\"filled\"\n color=\"primary\"\n onClick={onConfirm}\n // `applicable` is the server's word, not a\n // re-derivation from the verdicts on screen:\n // `applySchemaChange` re-checks it before it writes\n // anything, so a button that disagreed would only\n // produce the same refusal one click later. The same\n // goes for the permission — `/apply` checks it too, and\n // this only saves somebody the round trip.\n disabled={!plan?.applicable || applying || Boolean(applyRefusedBecause)}\n >\n {applying\n ? (commitOnly ? t(\"schema_change_committing\") : t(\"schema_change_applying\"))\n : (commitOnly ? t(\"schema_change_commit\") : t(\"schema_change_commit_and_apply\"))}\n </Button>\n )}\n </DialogActions>\n </Dialog>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAqHA,IAAM,eAA4G;CAC9G,MAAM;EACF,UAAU;EACV,SAAS;EACT,OAAO;CACX;CACA,UAAU;EACN,UAAU;EACV,SAAS;EACT,OAAO;CACX;CACA,mBAAmB;EACf,UAAU;EACV,SAAS;EACT,OAAO;CACX;AACJ;AAEA,IAAM,eAA+G;CACjH,MAAM;EAAE,UAAU;EAA2B,QAAQ;CAAe;CACpE,UAAU;EAAE,UAAU;EAA+B,QAAQ;CAAgB;CAC7E,mBAAmB;EAAE,UAAU;EAAgC,QAAQ;CAAa;AACxF;AAEA,IAAM,YAAY;AAClB,IAAM,YAAY,IACd,WACA,iEACJ;;AAGA,SAAS,QAAQ,EAAE,SAAS,OAAO,YAIhC;CACC,IAAI,UAAU,GAAG,OAAO;CACxB,OAC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AD;QAAK,WAAW;kBAAY,KAAK;OAAa,CAAA;MACzC,CAAA;KACX,EAAA,CAAA;IAEK;;GAEf,qBAAC,eAAD,EAAA,UAAA;IACK,CAAC,UAAU,QAAQ,cAChB,qBAAC,YAAD;KAAY,SAAQ;KAAU,OAAM;KAAY,WAAW,IAAI,WAAW,kBAAkB;eAA5F;MAA+F;MACxF,gBAAgB,OAAO,UAAU;MAAG,OAAO,SAAS,MAAM,OAAO,WAAW;KACvE;;IAEhB,oBAAC,QAAD;KAAQ,SAAQ;KAAO,SAAS;KAAS,UAAU;eAC9C,SAAS,EAAE,OAAO,IAAI,EAAE,QAAQ;IAC7B,CAAA;IACP,CAAC,UAAU,aAAa,WACrB,oBAAC,QAAD;KAAQ,SAAQ;KAAW,SAAS;eAC/B,EAAE,OAAO;IACN,CAAA;IAEX,CAAC,UAAU,QAAQ,CAAC,KAAK,cAAc,gBACpC,oBAAC,QAAD;KAAQ,SAAQ;KAAW,SAAS;KAAc,UAAU;eACvD,EAAE,gCAAgC;IAC/B,CAAA;IAEX,CAAC,UAAU,yBAAyB,gBACjC,oBAAC,QAAD;KAAQ,SAAQ;KAAS,OAAM;KAAU,SAAS;KAAc,UAAU;eACrE,WAAW,EAAE,0BAA0B,IAAI,EAAE,sBAAsB;IAChE,CAAA;IAEX,CAAC,UAAU,EAAE,yBAAyB,iBACnC,oBAAC,QAAD;KACI,SAAQ;KACR,OAAM;KACN,SAAS;KAQT,UAAU,CAAC,MAAM,cAAc,YAAY,QAAQ,mBAAmB;eAErE,WACM,aAAa,EAAE,0BAA0B,IAAI,EAAE,wBAAwB,IACvE,aAAa,EAAE,sBAAsB,IAAI,EAAE,gCAAgC;IAC9E,CAAA;GAED,EAAA,CAAA;EACX;;AAEhB"}
|
|
1
|
+
{"version":3,"file":"SchemaChangeDialog.js","names":[],"sources":["../../../../src/collection_editor/ui/collection_editor/SchemaChangeDialog.tsx"],"sourcesContent":["/**\n * What a schema change would do, before it does it.\n *\n * The dialog exists because a schema change has three possible verdicts and two\n * of them are refusals. Without a preview, the only way to discover that a\n * change is refused is to press a button on a live database and read what comes\n * back — which is a fine way to learn and a poor way to work.\n *\n * ## What it shows, in the order somebody reads it\n *\n * The verdict first, in a sentence, because it decides whether the rest is\n * worth reading. Then the changes, each with what it does and — when it is\n * refused — what to do instead. Then the things that are easy to skip past and\n * expensive to have skipped: constraints the change asks for that the database\n * will not end up enforcing. The SQL and the file list come last, collapsed,\n * for the reader who wants them; they are the evidence, not the summary.\n *\n * ## Why the button says \"Commit and apply\"\n *\n * Because that is the order, and the order is the feature. The commit lands\n * first, so a failed apply leaves the repository ahead of the database — the\n * ordinary state of every project between an edit and a deploy, which the next\n * boot reconciles. A button labelled \"Save\" would be describing a different,\n * worse thing.\n */\nimport React from \"react\";\nimport {\n Alert,\n Button,\n Chip,\n CircularProgress,\n cls,\n Dialog,\n DialogActions,\n DialogContent,\n DialogTitle,\n ExpandablePanel,\n Typography\n} from \"@rebasepro/ui\";\nimport { useTranslation } from \"@rebasepro/app\";\n\nimport type { LiveSchemaPlan, LiveSchemaResult, WithheldConstraint } from \"../../liveSchemaClient\";\n\nexport interface SchemaChangeDialogProps {\n open: boolean;\n /** The collection being changed, for the title. */\n collectionId: string;\n /** `undefined` while the plan is still being fetched. */\n plan?: LiveSchemaPlan;\n /** Set when planning itself failed — a network error, a refusal, a 500. */\n planError?: string;\n /** Set once the change has been applied, which turns this into a receipt. */\n result?: LiveSchemaResult;\n applying: boolean;\n /** Set when the apply threw rather than returning a result. */\n applyError?: string;\n onConfirm: () => void;\n /**\n * Ask again, when planning failed.\n *\n * A dropped connection should cost a click, not the whole wizard. The form\n * is already filled in, and making somebody redo it for a transient failure\n * teaches them to distrust the preview rather than the network.\n */\n onRetry?: () => void;\n /**\n * Write the collection source and leave the database alone.\n *\n * Offered only when the change is refused, and it is what keeps the editor\n * usable while it is. Removing a property is the ordinary case: the ensure\n * path has no `DROP COLUMN`, so a removal can never be applied — and\n * refusing the whole save over it would mean a dev could no longer delete a\n * field from a collection they are still designing.\n *\n * This is exactly what the editor did before live editing existed, so it is\n * not a new hazard; the difference is that it now says what it leaves\n * behind instead of reporting success.\n */\n onSourceOnly?: () => void;\n onClose: () => void;\n /**\n * Why this caller may preview but not apply, when that is the case.\n *\n * A person signed in with an API key, most often. Shown next to a disabled\n * button so the refusal arrives while they are deciding rather than after\n * they have decided.\n */\n applyRefusedBecause?: string;\n /**\n * The change can only be committed as source — the deployment applies\n * nothing to its database — so {@link onSourceOnly} is the main action,\n * labelled \"Commit\", and not refused by {@link applyRefusedBecause}.\n */\n sourceOnlyIsTheCommit?: boolean;\n /**\n * Where a confirmation would land — `owner/repo` and a branch.\n *\n * On screen before the button, not in the receipt after it. A commit is\n * going somewhere, and which branch it is going to is the one fact somebody\n * cannot recover from being wrong about.\n */\n target?: { repository?: string; branch?: string };\n}\n\ntype Verdict = LiveSchemaPlan[\"verdict\"];\n\ntype Translate = ReturnType<typeof useTranslation>[\"t\"];\n\n/**\n * What the verdict means, in the words the reader needs rather than the enum's.\n *\n * `safe` is written twice because the two cases are genuinely different, and\n * saying \"can be made against the running database\" when nothing will be run is\n * the kind of small lie that teaches people to stop reading. A document\n * database has no table to alter, and a change that needs no DDL on a\n * relational one is in the same position: the commit *is* the change.\n */\nconst VERDICT_COPY: Record<Verdict, { titleKey: string; bodyKey: string; color: \"info\" | \"warning\" | \"error\" }> = {\n safe: {\n titleKey: \"schema_change_verdict_safe_title\",\n bodyKey: \"schema_change_verdict_safe_body\",\n color: \"info\"\n },\n diverges: {\n titleKey: \"schema_change_verdict_diverges_title\",\n bodyKey: \"schema_change_verdict_diverges_body\",\n color: \"warning\"\n },\n \"needs-migration\": {\n titleKey: \"schema_change_verdict_migration_title\",\n bodyKey: \"schema_change_verdict_migration_body\",\n color: \"error\"\n }\n};\n\nconst VERDICT_CHIP: Record<Verdict, { labelKey: string; scheme: \"greenLighter\" | \"orangeLighter\" | \"redLighter\" }> = {\n safe: { labelKey: \"schema_change_chip_safe\", scheme: \"greenLighter\" },\n diverges: { labelKey: \"schema_change_chip_diverges\", scheme: \"orangeLighter\" },\n \"needs-migration\": { labelKey: \"schema_change_chip_migration\", scheme: \"redLighter\" }\n};\n\nconst monospace = \"font-mono text-xs leading-relaxed\";\nconst codeBlock = cls(\n monospace,\n \"bg-surface-raised rounded-md p-3 overflow-x-auto whitespace-pre\"\n);\n\n/** A disclosure that starts closed. The evidence, for the reader who wants it. */\nfunction Details({ summary, count, children }: {\n summary: string;\n count: number;\n children: React.ReactNode;\n}) {\n if (count === 0) return null;\n return (\n <ExpandablePanel\n initiallyExpanded={false}\n titleClassName=\"!min-h-0 !py-2 px-3\"\n innerClassName=\"p-3\"\n title={<Typography variant=\"body2\" color=\"secondary\">{summary} ({count})</Typography>}\n >\n {children}\n </ExpandablePanel>\n );\n}\n\n/**\n * What still has to happen after this lands.\n *\n * Above the evidence and below the changes, because it is not a refusal and not\n * a detail: the change will apply, and something outside this dialog still has\n * to be done or a later environment will differ from this one.\n */\nfunction FollowUp({ items }: { items: string[] }) {\n const { t } = useTranslation();\n if (items.length === 0) return null;\n return (\n <Alert color=\"info\">\n <Typography variant=\"body2\" className=\"font-medium mb-1\">\n {items.length === 1 ? t(\"schema_change_follow_up_one\") : t(\"schema_change_follow_up\")}\n </Typography>\n <ul className=\"space-y-2\">\n {items.map(item => (\n <li key={item} className=\"text-sm\">{item}</li>\n ))}\n </ul>\n </Alert>\n );\n}\n\n/**\n * The destination, short enough to read at a glance.\n *\n * A remote repository already reports itself as `owner/repo`, which is exactly\n * what somebody recognises. A local one reports an absolute path, and the\n * leading directories are the part nobody needs: what matters is which\n * checkout, and its name says that.\n */\nfunction repositoryLabel(repository: string): string {\n if (!repository.startsWith(\"/\")) return repository;\n return repository.split(\"/\").filter(Boolean).pop() ?? repository;\n}\n\nfunction WithheldConstraints({ constraints }: { constraints: WithheldConstraint[] }) {\n const { t } = useTranslation();\n if (constraints.length === 0) return null;\n return (\n <Alert color=\"warning\">\n <Typography variant=\"body2\" className=\"font-medium mb-1\">\n {constraints.length === 1\n ? t(\"schema_change_withheld_one\")\n : t(\"schema_change_withheld_many\", { count: constraints.length })}\n </Typography>\n <ul className=\"space-y-2\">\n {constraints.map(constraint => (\n <li key={constraint.target} className=\"text-sm\">\n <Typography component=\"code\" variant=\"mono\" className=\"bg-surface-raised px-1 rounded-md\">\n {constraint.target}\n </Typography>\n <Typography variant=\"body2\" className=\"mt-1\">{constraint.reason}</Typography>\n <Typography variant=\"body2\" color=\"secondary\" className=\"mt-1\">\n {constraint.remedy}\n </Typography>\n </li>\n ))}\n </ul>\n </Alert>\n );\n}\n\n/**\n * How far a failed apply got, in a heading.\n *\n * The statements run one at a time with no transaction around them, so only\n * \"none ran\" means the database is as it was.\n */\nfunction partialApplyHeading(result: LiveSchemaResult, t: Translate): string {\n const ran = result.appliedStatements;\n if (ran === 0) return t(\"schema_change_db_not_changed\");\n if (ran === undefined) return t(\"schema_change_db_maybe_changed\");\n return t(\"schema_change_statements_partial\", { ran, total: result.statements.length });\n}\n\n/** The receipt. Shown in place of the plan once the change has been applied. */\nfunction Applied({ result }: { result: LiveSchemaResult }) {\n const { t } = useTranslation();\n return (\n <div className=\"flex flex-col gap-4\">\n {/* Applied but served only after a restart is not a plain\n success: the summary says what is not live yet. */}\n <Alert color={(result.applied || result.sourceOnly) && result.serving?.status !== \"after-restart\" ? \"success\" : \"warning\"}>\n <Typography variant=\"body2\">{result.summary}</Typography>\n </Alert>\n\n {!result.applied && !result.sourceOnly && result.applyError && (\n // Deliberately not an error state. The commit landed, which is\n // the durable half; the database is now behind the repository,\n // which is where every project sits between an edit and a\n // deploy, and boot reconciles it.\n <Alert color=\"warning\">\n <Typography variant=\"body2\" className=\"font-medium mb-1\">\n {partialApplyHeading(result, t)}\n </Typography>\n <Typography variant=\"body2\">{result.applyError}</Typography>\n <Typography variant=\"body2\" className=\"mt-2\">\n {t(\"schema_change_commit_holds\", { branch: result.committed.branch })}\n </Typography>\n </Alert>\n )}\n\n <WithheldConstraints constraints={result.withheldConstraints ?? []}/>\n <FollowUp items={result.followUp ?? []}/>\n\n <div>\n <Typography variant=\"label\" color=\"secondary\">{t(\"schema_change_committed\")}</Typography>\n <div className={cls(codeBlock, \"mt-1\")}>\n {t(\"schema_change_committed_on\", { sha: result.committed.sha.slice(0, 9), branch: result.committed.branch })}\n {\"\\n\"}\n {result.committed.files.map(file => ` ${file}`).join(\"\\n\")}\n </div>\n </div>\n </div>\n );\n}\n\nexport function SchemaChangeDialog({\n open,\n collectionId,\n plan,\n planError,\n result,\n applying,\n applyError,\n onConfirm,\n onRetry,\n onSourceOnly,\n onClose,\n applyRefusedBecause,\n sourceOnlyIsTheCommit,\n target\n}: SchemaChangeDialogProps) {\n\n const { t } = useTranslation();\n const verdict = plan?.verdict;\n const statements = plan?.statements.length ?? 0;\n\n // \"Commit\" only when we positively know there is nothing to apply: a plan\n // that is going ahead and has no statements. A *refused* plan also has none\n // — because it will not run — and labelling that button \"Commit\" would be\n // describing the change it is refusing to make. Unknown reads as the fuller\n // action, which is the safer way to be wrong about a label.\n const commitOnly = Boolean(plan?.applicable) && statements === 0;\n\n // Described from the plan rather than from an assumption about the engine.\n // A document database runs nothing; so does a relational change that only\n // moves source. Both are a commit, and calling either one \"apply\" would be\n // describing something that does not happen.\n // A plan with changes and no statements still changes something — a\n // security rule takes effect when the server next starts — so \"there is\n // no schema change to make\" is said only when there is none.\n const copy = verdict === \"safe\" && commitOnly\n ? {\n title: t(\"schema_change_commit_only_title\"),\n body: plan && plan.changes.length > 0\n ? t(\"schema_change_commit_only_body\")\n : t(\"schema_change_commit_only_body_no_changes\"),\n color: \"info\" as const\n }\n : verdict\n ? {\n title: t(VERDICT_COPY[verdict].titleKey),\n body: t(VERDICT_COPY[verdict].bodyKey),\n color: VERDICT_COPY[verdict].color\n }\n : undefined;\n\n return (\n <Dialog open={open} onOpenChange={value => { if (!value) onClose(); }} maxWidth=\"3xl\">\n <DialogTitle className=\"flex items-center gap-2\">\n {result\n ? (result.sourceOnly ? t(\"schema_change_title_committed\") : t(\"schema_change_title_applied\"))\n : t(\"schema_change_title_review\")}\n <Typography component=\"code\" variant=\"mono\" color=\"secondary\">\n {collectionId}\n </Typography>\n </DialogTitle>\n\n <DialogContent className=\"flex flex-col gap-4\">\n {planError && (\n <Alert color=\"error\">\n <Typography variant=\"body2\" className=\"font-medium mb-1\">\n {t(\"schema_change_plan_failed\")}\n </Typography>\n <Typography variant=\"body2\">{planError}</Typography>\n </Alert>\n )}\n\n {!plan && !planError && !result && (\n <div className=\"flex items-center gap-3 py-6\">\n <CircularProgress size=\"small\"/>\n <Typography variant=\"body2\" color=\"secondary\">\n {t(\"schema_change_planning\")}\n </Typography>\n </div>\n )}\n\n {result && <Applied result={result}/>}\n\n {plan && !result && copy && (\n <>\n <Alert color={copy.color}>\n <Typography variant=\"body2\" className=\"font-medium mb-1\">\n {copy.title}\n </Typography>\n <Typography variant=\"body2\">{copy.body}</Typography>\n </Alert>\n\n {applyError && (\n <Alert color=\"error\">\n <Typography variant=\"body2\">{applyError}</Typography>\n </Alert>\n )}\n\n {plan.changes.length === 0 && (\n <Typography variant=\"body2\" color=\"secondary\">\n {t(\"schema_change_source_only_changes\")}\n </Typography>\n )}\n\n {!plan.applicable && onSourceOnly && (\n // Said per change: what a removal leaves behind is\n // not what a type change or a new required field\n // does, and the one that breaks every insert has to\n // be on screen before the button is pressed.\n <Alert color=\"warning\">\n <Typography variant=\"body2\" className=\"font-medium mb-1\">\n {t(\"schema_change_source_only_title\")}\n </Typography>\n <ul className=\"space-y-1\">\n {plan.changes.filter(change => change.verdict !== \"safe\" && change.sourceOnly).map((change, index) => (\n <li key={`${change.property ?? change.collection}.${index}`} className=\"text-sm\">\n {change.sourceOnly}\n </li>\n ))}\n </ul>\n </Alert>\n )}\n\n {plan.changes.length > 0 && (\n <ul className=\"flex flex-col gap-3\">\n {plan.changes.map((change, index) => (\n <li\n key={`${change.collection}.${change.property ?? \"\"}.${index}`}\n className=\"flex gap-3\"\n >\n <Chip\n size=\"smallest\"\n colorScheme={VERDICT_CHIP[change.verdict].scheme}\n className=\"shrink-0 mt-0.5\"\n >\n {t(VERDICT_CHIP[change.verdict].labelKey)}\n </Chip>\n <div className=\"min-w-0\">\n <Typography variant=\"body2\">{change.detail}</Typography>\n {change.remedy && (\n <Typography\n variant=\"body2\"\n color=\"secondary\"\n className=\"mt-1\"\n >\n {change.remedy}\n </Typography>\n )}\n </div>\n </li>\n ))}\n </ul>\n )}\n\n <WithheldConstraints constraints={plan.withheldConstraints ?? []}/>\n <FollowUp items={plan.followUp ?? []}/>\n\n {applyRefusedBecause && (\n <Alert color=\"info\">\n <Typography variant=\"body2\" className=\"font-medium mb-1\">\n {t(\"schema_change_preview_only\")}\n </Typography>\n <Typography variant=\"body2\">{applyRefusedBecause}</Typography>\n </Alert>\n )}\n\n <Details summary={t(\"schema_change_statements\")} count={plan.statements.length}>\n <div className={codeBlock}>{plan.statements.join(\"\\n\")}</div>\n </Details>\n\n <Details summary={t(\"schema_change_files\")} count={plan.files.length}>\n <div className={codeBlock}>{plan.files.join(\"\\n\")}</div>\n </Details>\n\n <Details summary={t(\"schema_change_message\")} count={plan.message ? 1 : 0}>\n <div className={codeBlock}>{plan.message}</div>\n </Details>\n </>\n )}\n </DialogContent>\n\n <DialogActions>\n {!result && target?.repository && (\n <Typography variant=\"caption\" color=\"secondary\" className={cls(monospace, \"mr-auto truncate\")}>\n → {repositoryLabel(target.repository)}{target.branch ? ` · ${target.branch}` : \"\"}\n </Typography>\n )}\n <Button variant=\"text\" onClick={onClose} disabled={applying}>\n {result ? t(\"close\") : t(\"cancel\")}\n </Button>\n {!result && planError && onRetry && (\n <Button variant=\"outlined\" onClick={onRetry}>\n {t(\"retry\")}\n </Button>\n )}\n {!result && plan && !plan.applicable && onSourceOnly && (\n <Button variant=\"outlined\" onClick={onSourceOnly} disabled={applying}>\n {t(\"schema_change_edit_source_only\")}\n </Button>\n )}\n {!result && sourceOnlyIsTheCommit && onSourceOnly && (\n <Button variant=\"filled\" color=\"primary\" onClick={onSourceOnly} disabled={applying}>\n {applying ? t(\"schema_change_committing\") : t(\"schema_change_commit\")}\n </Button>\n )}\n {!result && !(sourceOnlyIsTheCommit && onSourceOnly) && (\n <Button\n variant=\"filled\"\n color=\"primary\"\n onClick={onConfirm}\n // `applicable` is the server's word, not a\n // re-derivation from the verdicts on screen:\n // `applySchemaChange` re-checks it before it writes\n // anything, so a button that disagreed would only\n // produce the same refusal one click later. The same\n // goes for the permission — `/apply` checks it too, and\n // this only saves somebody the round trip.\n disabled={!plan?.applicable || applying || Boolean(applyRefusedBecause)}\n >\n {applying\n ? (commitOnly ? t(\"schema_change_committing\") : t(\"schema_change_applying\"))\n : (commitOnly ? t(\"schema_change_commit\") : t(\"schema_change_commit_and_apply\"))}\n </Button>\n )}\n </DialogActions>\n </Dialog>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AAqHA,IAAM,eAA4G;CAC9G,MAAM;EACF,UAAU;EACV,SAAS;EACT,OAAO;CACX;CACA,UAAU;EACN,UAAU;EACV,SAAS;EACT,OAAO;CACX;CACA,mBAAmB;EACf,UAAU;EACV,SAAS;EACT,OAAO;CACX;AACJ;AAEA,IAAM,eAA+G;CACjH,MAAM;EAAE,UAAU;EAA2B,QAAQ;CAAe;CACpE,UAAU;EAAE,UAAU;EAA+B,QAAQ;CAAgB;CAC7E,mBAAmB;EAAE,UAAU;EAAgC,QAAQ;CAAa;AACxF;AAEA,IAAM,YAAY;AAClB,IAAM,YAAY,IACd,WACA,iEACJ;;AAGA,SAAS,QAAQ,EAAE,SAAS,OAAO,YAIhC;CACC,IAAI,UAAU,GAAG,OAAO;CACxB,OACI,oBAAC,iBAAD;EACI,mBAAmB;EACnB,gBAAe;EACf,gBAAe;EACf,OAAO,qBAAC,YAAD;GAAY,SAAQ;GAAQ,OAAM;aAAlC;IAA+C;IAAQ;IAAG;IAAM;GAAa;;EAEnF;CACY,CAAA;AAEzB;;;;;;;;AASA,SAAS,SAAS,EAAE,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M;KAAY,WAAW,IAAI,WAAW,kBAAkB;eAA5F;MAA+F;MACxF,gBAAgB,OAAO,UAAU;MAAG,OAAO,SAAS,MAAM,OAAO,WAAW;KACvE;;IAEhB,oBAAC,QAAD;KAAQ,SAAQ;KAAO,SAAS;KAAS,UAAU;eAC9C,SAAS,EAAE,OAAO,IAAI,EAAE,QAAQ;IAC7B,CAAA;IACP,CAAC,UAAU,aAAa,WACrB,oBAAC,QAAD;KAAQ,SAAQ;KAAW,SAAS;eAC/B,EAAE,OAAO;IACN,CAAA;IAEX,CAAC,UAAU,QAAQ,CAAC,KAAK,cAAc,gBACpC,oBAAC,QAAD;KAAQ,SAAQ;KAAW,SAAS;KAAc,UAAU;eACvD,EAAE,gCAAgC;IAC/B,CAAA;IAEX,CAAC,UAAU,yBAAyB,gBACjC,oBAAC,QAAD;KAAQ,SAAQ;KAAS,OAAM;KAAU,SAAS;KAAc,UAAU;eACrE,WAAW,EAAE,0BAA0B,IAAI,EAAE,sBAAsB;IAChE,CAAA;IAEX,CAAC,UAAU,EAAE,yBAAyB,iBACnC,oBAAC,QAAD;KACI,SAAQ;KACR,OAAM;KACN,SAAS;KAQT,UAAU,CAAC,MAAM,cAAc,YAAY,QAAQ,mBAAmB;eAErE,WACM,aAAa,EAAE,0BAA0B,IAAI,EAAE,wBAAwB,IACvE,aAAa,EAAE,sBAAsB,IAAI,EAAE,gCAAgC;IAC9E,CAAA;GAED,EAAA,CAAA;EACX;;AAEhB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SchemaEditProblem } from "../../liveSchemaClient.js";
|
|
3
|
+
/**
|
|
4
|
+
* Why a save of the collection editor did not happen, as more than a line.
|
|
5
|
+
*
|
|
6
|
+
* - An edit whose result does not compile lists every problem the server
|
|
7
|
+
* found against the table and field it names.
|
|
8
|
+
* - A file that changed on disk since the edit was prepared offers to reload:
|
|
9
|
+
* the edit has to be made again against the file as it is now.
|
|
10
|
+
* - A slug or table rename, a collection defined in the frontend, a field with
|
|
11
|
+
* no column equivalent, redacted rules: what to do instead.
|
|
12
|
+
*
|
|
13
|
+
* Anything else falls back to the panel's error view.
|
|
14
|
+
*/
|
|
15
|
+
export declare function SchemaEditRefusalView({ error, onReload }: {
|
|
16
|
+
error: Error;
|
|
17
|
+
onReload?: () => void;
|
|
18
|
+
}): React.JSX.Element;
|
|
19
|
+
/** The problems a refusal names for one field, for drawing beside that field. */
|
|
20
|
+
export declare function problemsForField(error: Error | undefined, field: string): SchemaEditProblem[];
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { SplitEditError } from "../../split_edit_error.js";
|
|
2
|
+
import { SchemaEditRefused } from "../../useLocalCollectionsConfigController.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Alert, Button, Typography } from "@rebasepro/ui";
|
|
6
|
+
import { ErrorView, useTranslation } from "@rebasepro/app";
|
|
7
|
+
//#region src/collection_editor/ui/collection_editor/SchemaEditRefusalView.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Why a save of the collection editor did not happen, as more than a line.
|
|
10
|
+
*
|
|
11
|
+
* - An edit whose result does not compile lists every problem the server
|
|
12
|
+
* found against the table and field it names.
|
|
13
|
+
* - A file that changed on disk since the edit was prepared offers to reload:
|
|
14
|
+
* the edit has to be made again against the file as it is now.
|
|
15
|
+
* - A slug or table rename, a collection defined in the frontend, a field with
|
|
16
|
+
* no column equivalent, redacted rules: what to do instead.
|
|
17
|
+
*
|
|
18
|
+
* Anything else falls back to the panel's error view.
|
|
19
|
+
*/
|
|
20
|
+
function SchemaEditRefusalView({ error, onReload }) {
|
|
21
|
+
const { t } = useTranslation();
|
|
22
|
+
if (error instanceof SplitEditError) return /* @__PURE__ */ jsx(Alert, {
|
|
23
|
+
color: error.code === "MIGRATION_REQUIRED" || error.code === "EXTERNAL_COLLECTION" ? "warning" : "error",
|
|
24
|
+
size: "small",
|
|
25
|
+
children: error.message
|
|
26
|
+
});
|
|
27
|
+
if (error instanceof SchemaEditRefused) {
|
|
28
|
+
if (isStaleFile(error)) return /* @__PURE__ */ jsx(Alert, {
|
|
29
|
+
color: "warning",
|
|
30
|
+
size: "small",
|
|
31
|
+
action: onReload && /* @__PURE__ */ jsx(Button, {
|
|
32
|
+
size: "small",
|
|
33
|
+
variant: "text",
|
|
34
|
+
onClick: onReload,
|
|
35
|
+
children: t("schema_edit_reload")
|
|
36
|
+
}),
|
|
37
|
+
children: t("schema_edit_file_changed")
|
|
38
|
+
});
|
|
39
|
+
return /* @__PURE__ */ jsxs(Alert, {
|
|
40
|
+
color: "error",
|
|
41
|
+
size: "small",
|
|
42
|
+
children: [/* @__PURE__ */ jsx(Typography, {
|
|
43
|
+
variant: "body2",
|
|
44
|
+
children: error.code === "SCHEMA_EDIT_DOES_NOT_COMPILE" ? t("schema_edit_does_not_compile") : error.message
|
|
45
|
+
}), error.problems.length > 0 && /* @__PURE__ */ jsx(ProblemList, { problems: error.problems })]
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return /* @__PURE__ */ jsx(ErrorView, { error });
|
|
49
|
+
}
|
|
50
|
+
/** The server's problems, each against the table and field it names. */
|
|
51
|
+
function ProblemList({ problems }) {
|
|
52
|
+
return /* @__PURE__ */ jsx("ul", {
|
|
53
|
+
className: "mt-1 list-disc pl-5",
|
|
54
|
+
children: problems.map((problem, index) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs(Typography, {
|
|
55
|
+
variant: "caption",
|
|
56
|
+
children: [
|
|
57
|
+
/* @__PURE__ */ jsx("code", {
|
|
58
|
+
className: "font-mono",
|
|
59
|
+
children: problem.key ? `${problem.table}.${problem.key}` : problem.table
|
|
60
|
+
}),
|
|
61
|
+
" — ",
|
|
62
|
+
problem.message
|
|
63
|
+
]
|
|
64
|
+
}) }, index))
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/** The server refuses an apply whose file changed on disk since the preview read it, with a code of its own. */
|
|
68
|
+
function isStaleFile(error) {
|
|
69
|
+
return error.code === "SCHEMA_EDIT_STALE_FILE";
|
|
70
|
+
}
|
|
71
|
+
//#endregion
|
|
72
|
+
export { SchemaEditRefusalView };
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=SchemaEditRefusalView.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SchemaEditRefusalView.js","names":[],"sources":["../../../../src/collection_editor/ui/collection_editor/SchemaEditRefusalView.tsx"],"sourcesContent":["import React from \"react\";\nimport { Alert, Button, Typography } from \"@rebasepro/ui\";\nimport { ErrorView, useTranslation } from \"@rebasepro/app\";\n\nimport { SchemaEditRefused } from \"../../useLocalCollectionsConfigController\";\nimport { SplitEditError } from \"../../split_edit_error\";\nimport type { SchemaEditProblem } from \"../../liveSchemaClient\";\n\n/**\n * Why a save of the collection editor did not happen, as more than a line.\n *\n * - An edit whose result does not compile lists every problem the server\n * found against the table and field it names.\n * - A file that changed on disk since the edit was prepared offers to reload:\n * the edit has to be made again against the file as it is now.\n * - A slug or table rename, a collection defined in the frontend, a field with\n * no column equivalent, redacted rules: what to do instead.\n *\n * Anything else falls back to the panel's error view.\n */\nexport function SchemaEditRefusalView({ error, onReload }: { error: Error; onReload?: () => void }) {\n const { t } = useTranslation();\n\n if (error instanceof SplitEditError) {\n return (\n <Alert color={error.code === \"MIGRATION_REQUIRED\" || error.code === \"EXTERNAL_COLLECTION\" ? \"warning\" : \"error\"} size=\"small\">\n {error.message}\n </Alert>\n );\n }\n\n if (error instanceof SchemaEditRefused) {\n if (isStaleFile(error)) {\n return (\n <Alert color=\"warning\" size=\"small\"\n action={onReload && <Button size=\"small\" variant=\"text\" onClick={onReload}>{t(\"schema_edit_reload\")}</Button>}>\n {t(\"schema_edit_file_changed\")}\n </Alert>\n );\n }\n return (\n <Alert color=\"error\" size=\"small\">\n <Typography variant=\"body2\">{error.code === \"SCHEMA_EDIT_DOES_NOT_COMPILE\" ? t(\"schema_edit_does_not_compile\") : error.message}</Typography>\n {error.problems.length > 0 && <ProblemList problems={error.problems}/>}\n </Alert>\n );\n }\n\n return <ErrorView error={error}/>;\n}\n\n/** The server's problems, each against the table and field it names. */\nfunction ProblemList({ problems }: { problems: readonly SchemaEditProblem[] }) {\n return (\n <ul className=\"mt-1 list-disc pl-5\">\n {problems.map((problem, index) => (\n <li key={index}>\n <Typography variant=\"caption\">\n <code className=\"font-mono\">{problem.key ? `${problem.table}.${problem.key}` : problem.table}</code>\n {\" — \"}{problem.message}\n </Typography>\n </li>\n ))}\n </ul>\n );\n}\n\n/** The server refuses an apply whose file changed on disk since the preview read it, with a code of its own. */\nfunction isStaleFile(error: SchemaEditRefused): boolean {\n return error.code === \"SCHEMA_EDIT_STALE_FILE\";\n}\n\n/** The problems a refusal names for one field, for drawing beside that field. */\nexport function problemsForField(error: Error | undefined, field: string): SchemaEditProblem[] {\n if (!(error instanceof SchemaEditRefused)) return [];\n return error.problems.filter(problem => problem.key === field || problem.key?.startsWith(`${field}.`));\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAoBA,SAAgB,sBAAsB,EAAE,OAAO,YAAqD;CAChG,MAAM,EAAE,MAAM,eAAe;CAE7B,IAAI,iBAAiB,gBACjB,OACI,oBAAC,OAAD;EAAO,OAAO,MAAM,SAAS,wBAAwB,MAAM,SAAS,wBAAwB,YAAY;EAAS,MAAK;YACjH,MAAM;CACJ,CAAA;CAIf,IAAI,iBAAiB,mBAAmB;EACpC,IAAI,YAAY,KAAK,GACjB,OACI,oBAAC,OAAD;GAAO,OAAM;GAAU,MAAK;GACrB,QAAQ,YAAY,oBAAC,QAAD;IAAQ,MAAK;IAAQ,SAAQ;IAAO,SAAS;cAAW,EAAE,oBAAoB;GAAU,CAAA;aAC9G,EAAE,0BAA0B;EAC1B,CAAA;EAGf,OACI,qBAAC,OAAD;GAAO,OAAM;GAAQ,MAAK;aAA1B,CACI,oBAAC,YAAD;IAAY,SAAQ;cAAS,MAAM,SAAS,iCAAiC,EAAE,8BAA8B,IAAI,MAAM;GAAoB,CAAA,GAC1I,MAAM,SAAS,SAAS,KAAK,oBAAC,aAAD,EAAa,UAAU,MAAM,SAAU,CAAA,CAClE;;CAEf;CAEA,OAAO,oBAAC,WAAD,EAAkB,MAAO,CAAA;AACpC;;AAGA,SAAS,YAAY,EAAE,YAAwD;CAC3E,OACI,oBAAC,MAAD;EAAI,WAAU;YACT,SAAS,KAAK,SAAS,UACpB,oBAAC,MAAD,EAAA,UACI,qBAAC,YAAD;GAAY,SAAQ;aAApB;IACI,oBAAC,QAAD;KAAM,WAAU;eAAa,QAAQ,MAAM,GAAG,QAAQ,MAAM,GAAG,QAAQ,QAAQ,QAAQ;IAAY,CAAA;IAClG;IAAO,QAAQ;GACR;KACZ,GALK,KAKL,CACP;CACD,CAAA;AAEZ;;AAGA,SAAS,YAAY,OAAmC;CACpD,OAAO,MAAM,SAAS;AAC1B"}
|
package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ImportConfig } from "../../../_cms_internals.js";
|
|
2
|
-
import { Properties } from "@rebasepro/types";
|
|
2
|
+
import { Properties } from "@rebasepro/cms-types";
|
|
3
3
|
export declare function CollectionEditorImportDataPreview({ importConfig, properties, propertiesOrder }: {
|
|
4
4
|
importConfig: ImportConfig;
|
|
5
5
|
properties: Properties;
|
package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollectionEditorImportDataPreview.js","names":[],"sources":["../../../../../src/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx"],"sourcesContent":["import { useCollectionRegistryController } from \"../../../_cms_internals\";\nimport { convertImportData, ImportConfig, ImportConversionProblems } from \"../../../_cms_internals\";\nimport type { ImportConversionProblem } from \"../../../../data_import/utils/data\";\nimport { useAuthController } from \"@rebasepro/app\";\nimport { CollectionTableBinding } from \"../../../../components/CollectionTableBinding/CollectionTableBinding\";\nimport { useEntitySelectionController } from \"../../../../components/CollectionViewBinding/useSelectionController\";\nimport { CircularProgressCenter } from \"@rebasepro/ui\";\nimport { Properties } from \"@rebasepro/types\";\nimport { useEffect, useState } from \"react\";\nimport { Typography } from \"@rebasepro/ui\";\n\nexport function CollectionEditorImportDataPreview({\n importConfig,\n properties,\n propertiesOrder\n}: {\n importConfig: ImportConfig,\n properties: Properties,\n propertiesOrder: string[]\n}) {\n\n const authController = useAuthController();\n const registry = useCollectionRegistryController();\n const [loading, setLoading] = useState<boolean>(false);\n const [problems, setProblems] = useState<ImportConversionProblem[]>([]);\n\n async function loadEntities() {\n const converted = convertImportData(authController,\n registry,\n importConfig.importData,\n importConfig.idColumn,\n importConfig.headersMapping,\n properties,\n \"TEMP_PATH\",\n importConfig.defaultValues);\n importConfig.setEntities(converted.entities);\n setProblems(converted.problems);\n }\n\n useEffect(() => {\n loadEntities().finally(() => setLoading(false));\n }, []);\n\n const selectionController = useEntitySelectionController();\n if (loading)\n return <CircularProgressCenter/>\n\n return <div className={\"flex flex-col h-full w-full\"}>\n <ImportConversionProblems problems={problems}/>\n <div className={\"flex-1 min-h-0\"}>\n <CollectionTableBinding\n title={<div>\n <Typography variant={\"subtitle2\"}>Imported data preview</Typography>\n <Typography variant={\"caption\"}>Entities with the same id will be overwritten</Typography>\n </div>}\n tableController={{\n data: importConfig.entities,\n dataLoading: false,\n noMoreToLoad: false\n }}\n endAdornment={<div className={\"h-12\"}/>}\n filterable={false}\n sortable={false}\n selectionController={selectionController}\n displayedColumnIds={propertiesOrder.map(p => ({\n key: p,\n disabled: false\n }))}\n openEntityMode={\"side_panel\"}\n properties={properties}\n enablePopupIcon={false}/>\n </div>\n </div>;\n\n}\n"],"mappings":";;;;;;;;;;AAWA,SAAgB,kCAAkC,EAC9C,cACA,YACA,mBAKD;CAEC,MAAM,iBAAiB,kBAAkB;CACzC,MAAM,WAAW,gCAAgC;CACjD,MAAM,CAAC,SAAS,cAAc,SAAkB,KAAK;CACrD,MAAM,CAAC,UAAU,eAAe,SAAoC,CAAC,CAAC;CAEtE,eAAe,eAAe;EAC1B,MAAM,YAAY,kBAAkB,gBAChC,UACA,aAAa,YACb,aAAa,UACb,aAAa,gBACb,YACA,aACA,aAAa,aAAa;EAC9B,aAAa,YAAY,UAAU,QAAQ;EAC3C,YAAY,UAAU,QAAQ;CAClC;CAEA,gBAAgB;EACZ,aAAa,CAAC,CAAC,cAAc,WAAW,KAAK,CAAC;CAClD,GAAG,CAAC,CAAC;CAEL,MAAM,sBAAsB,6BAA6B;CACzD,IAAI,SACA,OAAO,oBAAC,wBAAD,CAAwB,CAAA;CAEnC,OAAO,qBAAC,OAAD;EAAK,WAAW;YAAhB,CACH,oBAAC,0BAAD,EAAoC,SAAU,CAAA,GAC9C,oBAAC,OAAD;GAAK,WAAW;aACZ,oBAAC,wBAAD;IACI,OAAO,qBAAC,OAAD,EAAA,UAAA,CACH,oBAAC,YAAD;KAAY,SAAS;eAAa;IAAiC,CAAA,GACnE,oBAAC,YAAD;KAAY,SAAS;eAAW;IAAyD,CAAA,CACxF,EAAA,CAAA;IACL,iBAAiB;KACb,MAAM,aAAa;KACnB,aAAa;KACb,cAAc;IAClB;IACA,cAAc,oBAAC,OAAD,EAAK,WAAW,OAAQ,CAAA;IACtC,YAAY;IACZ,UAAU;IACW;IACrB,oBAAoB,gBAAgB,KAAI,OAAM;KAC1C,KAAK;KACL,UAAU;IACd,EAAE;IACF,gBAAgB;IACJ;IACZ,iBAAiB;GAAO,CAAA;EAC3B,CAAA,CACJ;;AAET"}
|
|
1
|
+
{"version":3,"file":"CollectionEditorImportDataPreview.js","names":[],"sources":["../../../../../src/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.tsx"],"sourcesContent":["import { useCollectionRegistryController } from \"../../../_cms_internals\";\nimport { convertImportData, ImportConfig, ImportConversionProblems } from \"../../../_cms_internals\";\nimport type { ImportConversionProblem } from \"../../../../data_import/utils/data\";\nimport { useAuthController } from \"@rebasepro/app\";\nimport { CollectionTableBinding } from \"../../../../components/CollectionTableBinding/CollectionTableBinding\";\nimport { useEntitySelectionController } from \"../../../../components/CollectionViewBinding/useSelectionController\";\nimport { CircularProgressCenter } from \"@rebasepro/ui\";\nimport { Properties } from \"@rebasepro/cms-types\";\nimport { useEffect, useState } from \"react\";\nimport { Typography } from \"@rebasepro/ui\";\n\nexport function CollectionEditorImportDataPreview({\n importConfig,\n properties,\n propertiesOrder\n}: {\n importConfig: ImportConfig,\n properties: Properties,\n propertiesOrder: string[]\n}) {\n\n const authController = useAuthController();\n const registry = useCollectionRegistryController();\n const [loading, setLoading] = useState<boolean>(false);\n const [problems, setProblems] = useState<ImportConversionProblem[]>([]);\n\n async function loadEntities() {\n const converted = convertImportData(authController,\n registry,\n importConfig.importData,\n importConfig.idColumn,\n importConfig.headersMapping,\n properties,\n \"TEMP_PATH\",\n importConfig.defaultValues);\n importConfig.setEntities(converted.entities);\n setProblems(converted.problems);\n }\n\n useEffect(() => {\n loadEntities().finally(() => setLoading(false));\n }, []);\n\n const selectionController = useEntitySelectionController();\n if (loading)\n return <CircularProgressCenter/>\n\n return <div className={\"flex flex-col h-full w-full\"}>\n <ImportConversionProblems problems={problems}/>\n <div className={\"flex-1 min-h-0\"}>\n <CollectionTableBinding\n title={<div>\n <Typography variant={\"subtitle2\"}>Imported data preview</Typography>\n <Typography variant={\"caption\"}>Entities with the same id will be overwritten</Typography>\n </div>}\n tableController={{\n data: importConfig.entities,\n dataLoading: false,\n noMoreToLoad: false\n }}\n endAdornment={<div className={\"h-12\"}/>}\n filterable={false}\n sortable={false}\n selectionController={selectionController}\n displayedColumnIds={propertiesOrder.map(p => ({\n key: p,\n disabled: false\n }))}\n openEntityMode={\"side_panel\"}\n properties={properties}\n enablePopupIcon={false}/>\n </div>\n </div>;\n\n}\n"],"mappings":";;;;;;;;;;AAWA,SAAgB,kCAAkC,EAC9C,cACA,YACA,mBAKD;CAEC,MAAM,iBAAiB,kBAAkB;CACzC,MAAM,WAAW,gCAAgC;CACjD,MAAM,CAAC,SAAS,cAAc,SAAkB,KAAK;CACrD,MAAM,CAAC,UAAU,eAAe,SAAoC,CAAC,CAAC;CAEtE,eAAe,eAAe;EAC1B,MAAM,YAAY,kBAAkB,gBAChC,UACA,aAAa,YACb,aAAa,UACb,aAAa,gBACb,YACA,aACA,aAAa,aAAa;EAC9B,aAAa,YAAY,UAAU,QAAQ;EAC3C,YAAY,UAAU,QAAQ;CAClC;CAEA,gBAAgB;EACZ,aAAa,CAAC,CAAC,cAAc,WAAW,KAAK,CAAC;CAClD,GAAG,CAAC,CAAC;CAEL,MAAM,sBAAsB,6BAA6B;CACzD,IAAI,SACA,OAAO,oBAAC,wBAAD,CAAwB,CAAA;CAEnC,OAAO,qBAAC,OAAD;EAAK,WAAW;YAAhB,CACH,oBAAC,0BAAD,EAAoC,SAAU,CAAA,GAC9C,oBAAC,OAAD;GAAK,WAAW;aACZ,oBAAC,wBAAD;IACI,OAAO,qBAAC,OAAD,EAAA,UAAA,CACH,oBAAC,YAAD;KAAY,SAAS;eAAa;IAAiC,CAAA,GACnE,oBAAC,YAAD;KAAY,SAAS;eAAW;IAAyD,CAAA,CACxF,EAAA,CAAA;IACL,iBAAiB;KACb,MAAM,aAAa;KACnB,aAAa;KACb,cAAc;IAClB;IACA,cAAc,oBAAC,OAAD,EAAK,WAAW,OAAQ,CAAA;IACtC,YAAY;IACZ,UAAU;IACW;IACrB,oBAAoB,gBAAgB,KAAI,OAAM;KAC1C,KAAK;KACL,UAAU;IACd,EAAE;IACF,gBAAgB;IACJ;IACZ,iBAAiB;GAAO,CAAA;EAC3B,CAAA,CACJ;;AAET"}
|