@rebasepro/cms 0.23.0 → 0.24.1-canary.g19596ef
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -1
- package/dist/collection_editor/CollectionEditorDialogsContext.js +10 -0
- package/dist/collection_editor/CollectionEditorDialogsContext.js.map +1 -0
- package/dist/collection_editor/ConfigControllerProvider.js +274 -0
- package/dist/collection_editor/ConfigControllerProvider.js.map +1 -0
- package/dist/collection_editor/_cms_internals.d.ts +2 -1
- package/dist/collection_editor/api/generateCollectionApi.js +64 -0
- package/dist/collection_editor/api/generateCollectionApi.js.map +1 -0
- package/dist/collection_editor/collection_wire.d.ts +13 -0
- package/dist/collection_editor/collection_wire.js +49 -0
- package/dist/collection_editor/collection_wire.js.map +1 -0
- package/dist/collection_editor/liveSchemaClient.d.ts +38 -18
- package/dist/collection_editor/liveSchemaClient.js +130 -0
- package/dist/collection_editor/liveSchemaClient.js.map +1 -0
- package/dist/collection_editor/relation_kinds.js +74 -0
- package/dist/collection_editor/relation_kinds.js.map +1 -0
- package/dist/collection_editor/serializable_types.d.ts +6 -1
- package/dist/collection_editor/serializable_utils.js +504 -0
- package/dist/collection_editor/serializable_utils.js.map +1 -0
- package/dist/collection_editor/types/config_controller.d.ts +11 -0
- package/dist/collection_editor/ui/EditorCollectionAction.js +37 -0
- package/dist/collection_editor/ui/EditorCollectionAction.js.map +1 -0
- package/dist/collection_editor/ui/MissingReferenceWidget.js +39 -0
- package/dist/collection_editor/ui/MissingReferenceWidget.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.js +160 -0
- package/dist/collection_editor/ui/collection_editor/AICollectionGeneratorPopover.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/AIModifiedPathsContext.js +61 -0
- package/dist/collection_editor/ui/collection_editor/AIModifiedPathsContext.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js +731 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.js +220 -0
- package/dist/collection_editor/ui/collection_editor/CollectionEditorWelcomeView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionJsonImportDialog.js +160 -0
- package/dist/collection_editor/ui/collection_editor/CollectionJsonImportDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js +394 -0
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js +616 -0
- package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionStudioView.js +68 -0
- package/dist/collection_editor/ui/collection_editor/CollectionStudioView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionYupValidation.js +11 -0
- package/dist/collection_editor/ui/collection_editor/CollectionYupValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.js +148 -0
- package/dist/collection_editor/ui/collection_editor/CollectionsStudioView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js +244 -0
- package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/EnumForm.js +222 -0
- package/dist/collection_editor/ui/collection_editor/EnumForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js +204 -0
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/GetCodeDialog.js +108 -0
- package/dist/collection_editor/ui/collection_editor/GetCodeDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js +163 -0
- package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/LayoutModeSwitch.js +59 -0
- package/dist/collection_editor/ui/collection_editor/LayoutModeSwitch.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.js +640 -0
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js +141 -0
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/PropertyTree.js +210 -0
- package/dist/collection_editor/ui/collection_editor/PropertyTree.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.js +31 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionStudioView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.js +25 -0
- package/dist/collection_editor/ui/collection_editor/RouterCollectionsStudioView.js.map +1 -0
- package/dist/{SchemaChangeDialog-BeP0A4MJ.js → collection_editor/ui/collection_editor/SchemaChangeDialog.js} +73 -69
- package/dist/collection_editor/ui/collection_editor/SchemaChangeDialog.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/SwitchControl.js +24 -0
- package/dist/collection_editor/ui/collection_editor/SwitchControl.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/ViewModeSwitch.js +66 -0
- package/dist/collection_editor/ui/collection_editor/ViewModeSwitch.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js +61 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.js +188 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.d.ts +12 -0
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.js +74 -0
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.js +100 -0
- package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/BooleanPropertyField.js +34 -0
- package/dist/collection_editor/ui/collection_editor/properties/BooleanPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/CommonPropertyFields.js +75 -0
- package/dist/collection_editor/ui/collection_editor/properties/CommonPropertyFields.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js +338 -0
- package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js +83 -0
- package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.js +15 -0
- package/dist/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.js +121 -0
- package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js +127 -0
- package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/NumberPropertyField.js +151 -0
- package/dist/collection_editor/ui/collection_editor/properties/NumberPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.js +77 -0
- package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.js +254 -0
- package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.js +71 -0
- package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js +356 -0
- package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.js +173 -0
- package/dist/collection_editor/ui/collection_editor/properties/StringPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/UrlPropertyField.js +79 -0
- package/dist/collection_editor/ui/collection_editor/properties/UrlPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/VectorPropertyField.js +34 -0
- package/dist/collection_editor/ui/collection_editor/properties/VectorPropertyField.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.js +47 -0
- package/dist/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.js +47 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.js +62 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.js +119 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.d.ts +10 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.js +178 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.js +23 -0
- package/dist/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/blog_template.js +116 -0
- package/dist/collection_editor/ui/collection_editor/templates/blog_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/pages_template.js +182 -0
- package/dist/collection_editor/ui/collection_editor/templates/pages_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/products_template.js +87 -0
- package/dist/collection_editor/ui/collection_editor/templates/products_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/templates/users_template.js +46 -0
- package/dist/collection_editor/ui/collection_editor/templates/users_template.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/util.js +20 -0
- package/dist/collection_editor/ui/collection_editor/util.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/utils/strings.js +2 -0
- package/dist/collection_editor/ui/collection_editor/utils/supported_fields.js +37 -0
- package/dist/collection_editor/ui/collection_editor/utils/supported_fields.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.js +192 -0
- package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.js.map +1 -0
- package/dist/collection_editor/useCollectionEditorController.js +12 -0
- package/dist/collection_editor/useCollectionEditorController.js.map +1 -0
- package/dist/collection_editor/useCollectionsConfigController.js +12 -0
- package/dist/collection_editor/useCollectionsConfigController.js.map +1 -0
- package/dist/collection_editor/useJsonCollectionsConfigController.js +191 -0
- package/dist/collection_editor/useJsonCollectionsConfigController.js.map +1 -0
- package/dist/collection_editor/useLiveSchemaEditing.d.ts +5 -5
- package/dist/collection_editor/useLiveSchemaEditing.js +214 -0
- package/dist/collection_editor/useLiveSchemaEditing.js.map +1 -0
- package/dist/collection_editor/useLocalCollectionsConfigController.d.ts +7 -0
- package/dist/collection_editor/useLocalCollectionsConfigController.js +228 -0
- package/dist/collection_editor/useLocalCollectionsConfigController.js.map +1 -0
- package/dist/collection_editor/useSafeSnackbarController.js +13 -0
- package/dist/collection_editor/useSafeSnackbarController.js.map +1 -0
- package/dist/collection_editor/validateCollectionJson.js +289 -0
- package/dist/collection_editor/validateCollectionJson.js.map +1 -0
- package/dist/collection_editor_ui.js +7 -33
- package/dist/components/AdditionalFieldValue.js +60 -0
- package/dist/components/AdditionalFieldValue.js.map +1 -0
- package/dist/components/AdminModeSyncer.js +41 -0
- package/dist/components/AdminModeSyncer.js.map +1 -0
- package/dist/components/ArrayContainer.d.ts +8 -2
- package/dist/components/ArrayContainer.js +363 -0
- package/dist/components/ArrayContainer.js.map +1 -0
- package/dist/components/ClearFilterSortButton.d.ts +7 -1
- package/dist/components/ClearFilterSortButton.js +33 -0
- package/dist/components/ClearFilterSortButton.js.map +1 -0
- package/dist/components/CollectionEditorDialogs.js +49 -0
- package/dist/components/CollectionEditorDialogs.js.map +1 -0
- package/dist/components/CollectionPanel.d.ts +26 -5
- package/dist/components/CollectionPanel.js +142 -0
- package/dist/components/CollectionPanel.js.map +1 -0
- package/dist/components/CollectionTableBinding/CollectionRowActions.js +165 -0
- package/dist/components/CollectionTableBinding/CollectionRowActions.js.map +1 -0
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js +329 -0
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js.map +1 -0
- package/dist/components/CollectionTableBinding/PropertyTableCell.js +311 -0
- package/dist/components/CollectionTableBinding/PropertyTableCell.js.map +1 -0
- package/dist/components/CollectionTableBinding/column_utils.js +85 -0
- package/dist/components/CollectionTableBinding/column_utils.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/CompactEntityCellField.js +45 -0
- package/dist/components/CollectionTableBinding/fields/CompactEntityCellField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js +66 -0
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js +86 -0
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js +93 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.js +33 -0
- package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js +171 -0
- package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js +91 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js.map +1 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableUserSelect.js +36 -0
- package/dist/components/CollectionTableBinding/fields/VirtualTableUserSelect.js.map +1 -0
- package/dist/components/CollectionTableBinding/index.js +6 -0
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js +50 -0
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCell.d.ts +2 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCell.js +223 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCell.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCellActions.js +58 -0
- package/dist/components/CollectionTableBinding/internal/EntityTableCellActions.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/TableCellOpener.js +53 -0
- package/dist/components/CollectionTableBinding/internal/TableCellOpener.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/common.js +40 -0
- package/dist/components/CollectionTableBinding/internal/common.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js +270 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useDraggable.js +68 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useDraggable.js.map +1 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useWindowSize.js +24 -0
- package/dist/components/CollectionTableBinding/internal/popup_field/useWindowSize.js.map +1 -0
- package/dist/components/CollectionTableBinding/table_bindings.js +306 -0
- package/dist/components/CollectionTableBinding/table_bindings.js.map +1 -0
- package/dist/components/CollectionViewBinding/BoardCardBinding.js +160 -0
- package/dist/components/CollectionViewBinding/BoardCardBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js +471 -0
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js +108 -0
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js +988 -0
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewActions.d.ts +6 -1
- package/dist/components/CollectionViewBinding/CollectionViewActions.js +146 -0
- package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewBinding.d.ts +5 -2
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js +1209 -0
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js +133 -0
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js.map +1 -0
- package/dist/components/CollectionViewBinding/EntityCardBinding.js +133 -0
- package/dist/components/CollectionViewBinding/EntityCardBinding.js.map +1 -0
- package/dist/components/CollectionViewBinding/FilterPresetsButton.js +203 -0
- package/dist/components/CollectionViewBinding/FilterPresetsButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/FiltersDialog.d.ts +5 -0
- package/dist/components/CollectionViewBinding/FiltersDialog.js +148 -0
- package/dist/components/CollectionViewBinding/FiltersDialog.js.map +1 -0
- package/dist/components/CollectionViewBinding/SearchExplanation.js +86 -0
- package/dist/components/CollectionViewBinding/SearchExplanation.js.map +1 -0
- package/dist/components/CollectionViewBinding/SearchHighlight.js +262 -0
- package/dist/components/CollectionViewBinding/SearchHighlight.js.map +1 -0
- package/dist/components/CollectionViewBinding/SlotValue.js +117 -0
- package/dist/components/CollectionViewBinding/SlotValue.js.map +1 -0
- package/dist/components/CollectionViewBinding/SortButton.js +214 -0
- package/dist/components/CollectionViewBinding/SortButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListCloseButton.js +41 -0
- package/dist/components/CollectionViewBinding/SplitListCloseButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListShowButton.js +29 -0
- package/dist/components/CollectionViewBinding/SplitListShowButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListView.js +311 -0
- package/dist/components/CollectionViewBinding/SplitListView.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitViewContext.js +21 -0
- package/dist/components/CollectionViewBinding/SplitViewContext.js.map +1 -0
- package/dist/components/CollectionViewBinding/ViewModeToggle.js +150 -0
- package/dist/components/CollectionViewBinding/ViewModeToggle.js.map +1 -0
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js +49 -0
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js.map +1 -0
- package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.js +122 -0
- package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.js.map +1 -0
- package/dist/components/CollectionViewBinding/useBoardDataController.js +530 -0
- package/dist/components/CollectionViewBinding/useBoardDataController.js.map +1 -0
- package/dist/components/CollectionViewBinding/usePreviewSlots.d.ts +4 -1
- package/dist/components/CollectionViewBinding/usePreviewSlots.js +384 -0
- package/dist/components/CollectionViewBinding/usePreviewSlots.js.map +1 -0
- package/dist/components/CollectionViewBinding/useSelectionController.js +104 -0
- package/dist/components/CollectionViewBinding/useSelectionController.js.map +1 -0
- package/dist/components/CollectionViewBinding/utils.js +21 -0
- package/dist/components/CollectionViewBinding/utils.js.map +1 -0
- package/dist/components/CollectionsProvider.d.ts +44 -0
- package/dist/components/CollectionsProvider.js +137 -0
- package/dist/components/CollectionsProvider.js.map +1 -0
- package/dist/components/CollectionsScopeContext.d.ts +18 -0
- package/dist/components/CollectionsScopeContext.js +25 -0
- package/dist/components/CollectionsScopeContext.js.map +1 -0
- package/dist/components/DefaultAppBar.js +179 -0
- package/dist/components/DefaultAppBar.js.map +1 -0
- package/dist/components/DefaultDrawer.js +364 -0
- package/dist/components/DefaultDrawer.js.map +1 -0
- package/dist/components/DeleteEntityDialog.js +256 -0
- package/dist/components/DeleteEntityDialog.js.map +1 -0
- package/dist/components/DetailViewBinding.js +504 -0
- package/dist/components/DetailViewBinding.js.map +1 -0
- package/dist/components/DrawerNavigationGroup.js +74 -0
- package/dist/components/DrawerNavigationGroup.js.map +1 -0
- package/dist/components/DrawerNavigationItem.d.ts +8 -0
- package/dist/components/DrawerNavigationItem.js +45 -0
- package/dist/components/DrawerNavigationItem.js.map +1 -0
- package/dist/components/EditFormActions.js +210 -0
- package/dist/components/EditFormActions.js.map +1 -0
- package/dist/components/EditViewBinding.d.ts +7 -1
- package/dist/components/EditViewBinding.js +802 -0
- package/dist/components/EditViewBinding.js.map +1 -0
- package/dist/components/EntityDisplayHeader.js +139 -0
- package/dist/components/EntityDisplayHeader.js.map +1 -0
- package/dist/components/EntityFormPanel.d.ts +58 -0
- package/dist/components/EntityFormPanel.js +126 -0
- package/dist/components/EntityFormPanel.js.map +1 -0
- package/dist/components/EntityIdentityBar.d.ts +29 -4
- package/dist/components/EntityIdentityBar.js +364 -0
- package/dist/components/EntityIdentityBar.js.map +1 -0
- package/dist/components/EntityInspector.js +96 -0
- package/dist/components/EntityInspector.js.map +1 -0
- package/dist/components/EntityPreviewBinding.js +282 -0
- package/dist/components/EntityPreviewBinding.js.map +1 -0
- package/dist/components/EntityPreviewNesting.js +53 -0
- package/dist/components/EntityPreviewNesting.js.map +1 -0
- package/dist/components/EntityViewBinding.js +246 -0
- package/dist/components/EntityViewBinding.js.map +1 -0
- package/dist/components/FieldCaption.js +17 -0
- package/dist/components/FieldCaption.js.map +1 -0
- package/dist/components/HomePage/ContentHomePage.js +326 -0
- package/dist/components/HomePage/ContentHomePage.js.map +1 -0
- package/dist/components/HomePage/FavouritesView.js +44 -0
- package/dist/components/HomePage/FavouritesView.js.map +1 -0
- package/dist/components/HomePage/HomePageDnD.js +436 -0
- package/dist/components/HomePage/HomePageDnD.js.map +1 -0
- package/dist/components/HomePage/NavigationCard.js +59 -0
- package/dist/components/HomePage/NavigationCard.js.map +1 -0
- package/dist/components/HomePage/NavigationCardBinding.js +70 -0
- package/dist/components/HomePage/NavigationCardBinding.js.map +1 -0
- package/dist/components/HomePage/NavigationGroup.js +98 -0
- package/dist/components/HomePage/NavigationGroup.js.map +1 -0
- package/dist/components/HomePage/RenameGroupDialog.js +89 -0
- package/dist/components/HomePage/RenameGroupDialog.js.map +1 -0
- package/dist/components/InlineEntityPreview.js +116 -0
- package/dist/components/InlineEntityPreview.js.map +1 -0
- package/dist/{JsonPreviewBinding-v0w3H0fp.js → components/JsonPreviewBinding.js} +2 -2
- package/dist/components/JsonPreviewBinding.js.map +1 -0
- package/dist/components/NavigationLoadingErrorView.d.ts +16 -0
- package/dist/components/NavigationLoadingErrorView.js +27 -0
- package/dist/components/NavigationLoadingErrorView.js.map +1 -0
- package/dist/components/PickerTrigger.js +27 -0
- package/dist/components/PickerTrigger.js.map +1 -0
- package/dist/components/PropertyCollectionView.js +215 -0
- package/dist/components/PropertyCollectionView.js.map +1 -0
- package/dist/components/PropertyConfigBadge.js +19 -0
- package/dist/components/PropertyConfigBadge.js.map +1 -0
- package/dist/components/PropertyKeyHint.js +58 -0
- package/dist/components/PropertyKeyHint.js.map +1 -0
- package/dist/components/RebaseAuthGate.js +35 -0
- package/dist/components/RebaseAuthGate.js.map +1 -0
- package/dist/components/RebaseCMS.js +44 -0
- package/dist/components/RebaseCMS.js.map +1 -0
- package/dist/components/RebaseLayout.js +59 -0
- package/dist/components/RebaseLayout.js.map +1 -0
- package/dist/components/RebaseNavigation.js +215 -0
- package/dist/components/RebaseNavigation.js.map +1 -0
- package/dist/components/RebaseRouteDefs.js +96 -0
- package/dist/components/RebaseRouteDefs.js.map +1 -0
- package/dist/components/RebaseShell.js +50 -0
- package/dist/components/RebaseShell.js.map +1 -0
- package/dist/components/ReferenceTable/SelectionTableBinding.js +224 -0
- package/dist/components/ReferenceTable/SelectionTableBinding.js.map +1 -0
- package/dist/components/ReferenceWidget.js +100 -0
- package/dist/components/ReferenceWidget.js.map +1 -0
- package/dist/components/RelationSelector.js +625 -0
- package/dist/components/RelationSelector.js.map +1 -0
- package/dist/components/SearchIconsView.js +52 -0
- package/dist/components/SearchIconsView.js.map +1 -0
- package/dist/components/SelectableTable/SelectableTable.d.ts +1 -1
- package/dist/components/SelectableTable/SelectableTable.js +158 -0
- package/dist/components/SelectableTable/SelectableTable.js.map +1 -0
- package/dist/components/SelectableTable/SelectableTableContext.js +8 -0
- package/dist/components/SelectableTable/SelectableTableContext.js.map +1 -0
- package/dist/components/SelectableTable/SelectionStore.js +29 -0
- package/dist/components/SelectableTable/SelectionStore.js.map +1 -0
- package/dist/components/SelectableTable/filters/BooleanFilterField.js +28 -0
- package/dist/components/SelectableTable/filters/BooleanFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/DateTimeFilterField.d.ts +2 -1
- package/dist/components/SelectableTable/filters/DateTimeFilterField.js +93 -0
- package/dist/components/SelectableTable/filters/DateTimeFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/FilterFieldBinding.js +132 -0
- package/dist/components/SelectableTable/filters/FilterFieldBinding.js.map +1 -0
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js +157 -0
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/RelationFilterField.js +169 -0
- package/dist/components/SelectableTable/filters/RelationFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/StringNumberFilterField.js +181 -0
- package/dist/components/SelectableTable/filters/StringNumberFilterField.js.map +1 -0
- package/dist/components/SelectableTable/filters/null_filter.js +36 -0
- package/dist/components/SelectableTable/filters/null_filter.js.map +1 -0
- package/dist/components/SideDialogs.js +149 -0
- package/dist/components/SideDialogs.js.map +1 -0
- package/dist/components/SidePanelBinding.js +287 -0
- package/dist/components/SidePanelBinding.js.map +1 -0
- package/dist/components/SidePanelProvider.js +69 -0
- package/dist/components/SidePanelProvider.js.map +1 -0
- package/dist/components/UserSelector.d.ts +2 -0
- package/dist/components/UserSelector.js +418 -0
- package/dist/components/UserSelector.js.map +1 -0
- package/dist/components/admin/CreationResultDialog.js +118 -0
- package/dist/components/admin/CreationResultDialog.js.map +1 -0
- package/dist/components/app/AppBar.js +14 -0
- package/dist/components/app/AppBar.js.map +1 -0
- package/dist/components/app/Drawer.js +26 -0
- package/dist/components/app/Drawer.js.map +1 -0
- package/dist/components/app/Scaffold.js +229 -0
- package/dist/components/app/Scaffold.js.map +1 -0
- package/dist/components/app/useApp.js +24 -0
- package/dist/components/app/useApp.js.map +1 -0
- package/dist/components/common/ActionMenuLabel.d.ts +15 -0
- package/dist/components/common/ActionMenuLabel.js +30 -0
- package/dist/components/common/ActionMenuLabel.js.map +1 -0
- package/dist/components/common/default_entity_actions.d.ts +37 -0
- package/dist/components/common/default_entity_actions.js +590 -0
- package/dist/components/common/default_entity_actions.js.map +1 -0
- package/dist/components/drawer_expansion.d.ts +25 -0
- package/dist/components/drawer_expansion.js +44 -0
- package/dist/components/drawer_expansion.js.map +1 -0
- package/dist/components/field_configs.d.ts +2 -2
- package/dist/components/field_configs.js +431 -0
- package/dist/components/field_configs.js.map +1 -0
- package/dist/components/field_ids.d.ts +11 -0
- package/dist/components/field_ids.js +58 -0
- package/dist/components/field_ids.js.map +1 -0
- package/dist/components/history/EntityHistoryEntry.js +151 -0
- package/dist/components/history/EntityHistoryEntry.js.map +1 -0
- package/dist/components/history/EntityHistoryView.js +157 -0
- package/dist/components/history/EntityHistoryView.js.map +1 -0
- package/dist/components/history/UserChip.js +21 -0
- package/dist/components/history/UserChip.js.map +1 -0
- package/dist/components/history/index.js +4 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/lazy_record_views.d.ts +10 -0
- package/dist/components/lazy_record_views.js +57 -0
- package/dist/components/lazy_record_views.js.map +1 -0
- package/dist/contexts/BreacrumbsContext.js +28 -0
- package/dist/contexts/BreacrumbsContext.js.map +1 -0
- package/dist/contexts/EditorAIControllerContext.d.ts +18 -0
- package/dist/contexts/EditorAIControllerContext.js +29 -0
- package/dist/contexts/EditorAIControllerContext.js.map +1 -0
- package/dist/contexts/SideDialogsControllerContext.js +7 -0
- package/dist/contexts/SideDialogsControllerContext.js.map +1 -0
- package/dist/data_export/export/BasicExportAction.js +151 -0
- package/dist/data_export/export/BasicExportAction.js.map +1 -0
- package/dist/data_export/export/ExportCollectionAction.js +297 -0
- package/dist/data_export/export/ExportCollectionAction.js.map +1 -0
- package/dist/data_export/export/additional_fields.js +40 -0
- package/dist/data_export/export/additional_fields.js.map +1 -0
- package/dist/data_export/export/export.d.ts +35 -0
- package/dist/data_export/export/export.js +400 -0
- package/dist/data_export/export/export.js.map +1 -0
- package/dist/data_export/export/fetch_export_data.d.ts +17 -7
- package/dist/data_export/export/fetch_export_data.js +67 -0
- package/dist/data_export/export/fetch_export_data.js.map +1 -0
- package/dist/data_export/export/index.d.ts +4 -2
- package/dist/data_export/export/index.js +5 -0
- package/dist/data_import/components/DataNewPropertiesMapping.js +207 -0
- package/dist/data_import/components/DataNewPropertiesMapping.js.map +1 -0
- package/dist/data_import/components/ImportConversionProblems.d.ts +11 -0
- package/dist/data_import/components/ImportConversionProblems.js +89 -0
- package/dist/data_import/components/ImportConversionProblems.js.map +1 -0
- package/dist/data_import/components/ImportFileUpload.js +43 -0
- package/dist/data_import/components/ImportFileUpload.js.map +1 -0
- package/dist/data_import/components/ImportNewPropertyFieldPreview.js +42 -0
- package/dist/data_import/components/ImportNewPropertyFieldPreview.js.map +1 -0
- package/dist/data_import/components/ImportSaveInProgress.js +105 -0
- package/dist/data_import/components/ImportSaveInProgress.js.map +1 -0
- package/dist/data_import/components/index.d.ts +1 -0
- package/dist/data_import/hooks/useImportConfig.js +34 -0
- package/dist/data_import/hooks/useImportConfig.js.map +1 -0
- package/dist/{import-TCgkTVlS.js → data_import/import/ImportCollectionAction.js} +84 -92
- package/dist/data_import/import/ImportCollectionAction.js.map +1 -0
- package/dist/data_import/import/index.js +2 -0
- package/dist/data_import/utils/csv.js +146 -0
- package/dist/data_import/utils/csv.js.map +1 -0
- package/dist/data_import/utils/data.d.ts +81 -4
- package/dist/data_import/utils/data.js +366 -0
- package/dist/data_import/utils/data.js.map +1 -0
- package/dist/data_import/utils/file_headers.js +32 -0
- package/dist/data_import/utils/file_headers.js.map +1 -0
- package/dist/data_import/utils/file_to_json.js +149 -0
- package/dist/data_import/utils/file_to_json.js.map +1 -0
- package/dist/data_import/utils/get_import_inference_type.js +14 -0
- package/dist/data_import/utils/get_import_inference_type.js.map +1 -0
- package/dist/data_import/utils/id_column.js +27 -0
- package/dist/data_import/utils/id_column.js.map +1 -0
- package/dist/data_import/utils/import_columns.d.ts +48 -0
- package/dist/data_import/utils/import_columns.js +92 -0
- package/dist/data_import/utils/import_columns.js.map +1 -0
- package/dist/data_import/utils/save_entities.d.ts +33 -4
- package/dist/data_import/utils/save_entities.js +244 -0
- package/dist/data_import/utils/save_entities.js.map +1 -0
- package/dist/data_import/utils/transforms.js +83 -0
- package/dist/data_import/utils/transforms.js.map +1 -0
- package/dist/editor/components/SlashCommandMenu.js +497 -0
- package/dist/editor/components/SlashCommandMenu.js.map +1 -0
- package/dist/editor/components/editor-bubble-item.js +24 -0
- package/dist/editor/components/editor-bubble-item.js.map +1 -0
- package/dist/editor/components/editor-bubble.js +97 -0
- package/dist/editor/components/editor-bubble.js.map +1 -0
- package/dist/editor/components/image-bubble.js +148 -0
- package/dist/editor/components/image-bubble.js.map +1 -0
- package/dist/editor/components/table-bubble.js +406 -0
- package/dist/editor/components/table-bubble.js.map +1 -0
- package/dist/editor/editor.d.ts +7 -1
- package/dist/editor/editor.js +423 -0
- package/dist/editor/editor.js.map +1 -0
- package/dist/editor/extensions/HighlightDecorationExtension.js +74 -0
- package/dist/editor/extensions/HighlightDecorationExtension.js.map +1 -0
- package/dist/editor/extensions/Image.d.ts +28 -1
- package/dist/editor/extensions/Image.js +160 -0
- package/dist/editor/extensions/Image.js.map +1 -0
- package/dist/editor/extensions/TextLoadingDecorationExtension.js +82 -0
- package/dist/editor/extensions/TextLoadingDecorationExtension.js.map +1 -0
- package/dist/editor/extensions/clipboard.js +63 -0
- package/dist/editor/extensions/clipboard.js.map +1 -0
- package/dist/editor/extensions/drag-and-drop.js +354 -0
- package/dist/editor/extensions/drag-and-drop.js.map +1 -0
- package/dist/editor/hooks/useProseMirror.d.ts +4 -1
- package/dist/editor/hooks/useProseMirror.js +101 -0
- package/dist/editor/hooks/useProseMirror.js.map +1 -0
- package/dist/editor/hooks/useProseMirrorContext.js +11 -0
- package/dist/editor/hooks/useProseMirrorContext.js.map +1 -0
- package/dist/editor/markdown.js +154 -0
- package/dist/editor/markdown.js.map +1 -0
- package/dist/editor/nodeViews/ImageComponent.js +35 -0
- package/dist/editor/nodeViews/ImageComponent.js.map +1 -0
- package/dist/editor/nodeViews/ReactNodeView.js +57 -0
- package/dist/editor/nodeViews/ReactNodeView.js.map +1 -0
- package/dist/editor/nodeViews/TaskItemComponent.js +29 -0
- package/dist/editor/nodeViews/TaskItemComponent.js.map +1 -0
- package/dist/editor/nodeViews/index.js +21 -0
- package/dist/editor/nodeViews/index.js.map +1 -0
- package/dist/editor/plugins/index.js +54 -0
- package/dist/editor/plugins/index.js.map +1 -0
- package/dist/editor/plugins/inputrules.js +54 -0
- package/dist/editor/plugins/inputrules.js.map +1 -0
- package/dist/editor/plugins/placeholderPlugin.js +38 -0
- package/dist/editor/plugins/placeholderPlugin.js.map +1 -0
- package/dist/editor/plugins/slashCommandPlugin.js +40 -0
- package/dist/editor/plugins/slashCommandPlugin.js.map +1 -0
- package/dist/editor/sanitize-html.js +190 -0
- package/dist/editor/sanitize-html.js.map +1 -0
- package/dist/{markdown-CCqp8ibf.js → editor/schema.js} +2 -159
- package/dist/editor/schema.js.map +1 -0
- package/dist/editor/selectors/link-selector.js +118 -0
- package/dist/editor/selectors/link-selector.js.map +1 -0
- package/dist/editor/selectors/node-selector.js +118 -0
- package/dist/editor/selectors/node-selector.js.map +1 -0
- package/dist/editor/selectors/text-buttons.js +71 -0
- package/dist/editor/selectors/text-buttons.js.map +1 -0
- package/dist/editor/utils/prosemirror-utils.js +92 -0
- package/dist/editor/utils/prosemirror-utils.js.map +1 -0
- package/dist/editor/utils/remove_classes.js +16 -0
- package/dist/editor/utils/remove_classes.js.map +1 -0
- package/dist/editor.js +1 -3085
- package/dist/form/EntityForm.js +734 -0
- package/dist/form/EntityForm.js.map +1 -0
- package/dist/form/EntityFormActions.js +101 -0
- package/dist/form/EntityFormActions.js.map +1 -0
- package/dist/form/EntityFormBinding.js +256 -0
- package/dist/form/EntityFormBinding.js.map +1 -0
- package/dist/form/PropertyFieldBinding.js +298 -0
- package/dist/form/PropertyFieldBinding.js.map +1 -0
- package/dist/form/components/ErrorFocus.js +33 -0
- package/dist/form/components/ErrorFocus.js.map +1 -0
- package/dist/form/components/FieldBlock.js +118 -0
- package/dist/form/components/FieldBlock.js.map +1 -0
- package/dist/form/components/FieldHelperText.js +56 -0
- package/dist/form/components/FieldHelperText.js.map +1 -0
- package/dist/form/components/FormRail.js +118 -0
- package/dist/form/components/FormRail.js.map +1 -0
- package/dist/form/components/FormSections.js +63 -0
- package/dist/form/components/FormSections.js.map +1 -0
- package/dist/form/components/LabelWithIcon.js +29 -0
- package/dist/form/components/LabelWithIcon.js.map +1 -0
- package/dist/form/components/LocalChangesMenu.js +127 -0
- package/dist/form/components/LocalChangesMenu.js.map +1 -0
- package/dist/form/components/StorageItemPreview.js +46 -0
- package/dist/form/components/StorageItemPreview.js.map +1 -0
- package/dist/form/components/StorageUploadProgress.js +84 -0
- package/dist/form/components/StorageUploadProgress.js.map +1 -0
- package/dist/form/components/useRailVisible.js +43 -0
- package/dist/form/components/useRailVisible.js.map +1 -0
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js +84 -0
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js +125 -0
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/BinaryFieldBinding.js +135 -0
- package/dist/form/field_bindings/BinaryFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/BlockFieldBinding.js +164 -0
- package/dist/form/field_bindings/BlockFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/DateTimeFieldBinding.js +47 -0
- package/dist/form/field_bindings/DateTimeFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/GeopointFieldBinding.js +148 -0
- package/dist/form/field_bindings/GeopointFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/KeyValueFieldBinding.js +450 -0
- package/dist/form/field_bindings/KeyValueFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MapFieldBinding.js +77 -0
- package/dist/form/field_bindings/MapFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js +215 -0
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MultiSelectFieldBinding.js +88 -0
- package/dist/form/field_bindings/MultiSelectFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js +118 -0
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/ReadOnlyFieldBinding.js +52 -0
- package/dist/form/field_bindings/ReadOnlyFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/ReferenceFieldBinding.js +99 -0
- package/dist/form/field_bindings/ReferenceFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/RelationFieldBinding.js +135 -0
- package/dist/form/field_bindings/RelationFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/RepeatFieldBinding.js +103 -0
- package/dist/form/field_bindings/RepeatFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/SelectFieldBinding.js +80 -0
- package/dist/form/field_bindings/SelectFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/StorageUploadFieldBinding.js +266 -0
- package/dist/form/field_bindings/StorageUploadFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/SwitchFieldBinding.js +41 -0
- package/dist/form/field_bindings/SwitchFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/TextFieldBinding.js +114 -0
- package/dist/form/field_bindings/TextFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/UserSelectFieldBinding.js +48 -0
- package/dist/form/field_bindings/UserSelectFieldBinding.js.map +1 -0
- package/dist/form/field_bindings/VectorFieldBinding.js +147 -0
- package/dist/form/field_bindings/VectorFieldBinding.js.map +1 -0
- package/dist/form/form_keyboard_scope.d.ts +26 -0
- package/dist/form/form_keyboard_scope.js +39 -0
- package/dist/form/form_keyboard_scope.js.map +1 -0
- package/dist/form/form_uploads.d.ts +24 -0
- package/dist/form/form_uploads.js +31 -0
- package/dist/form/form_uploads.js.map +1 -0
- package/dist/form/form_utils.d.ts +48 -0
- package/dist/form/form_utils.js +280 -0
- package/dist/form/form_utils.js.map +1 -0
- package/dist/form/resolve_cell_property.d.ts +32 -0
- package/dist/form/resolve_cell_property.js +80 -0
- package/dist/form/resolve_cell_property.js.map +1 -0
- package/dist/form/resolve_form_properties.d.ts +27 -0
- package/dist/form/resolve_form_properties.js +78 -0
- package/dist/form/resolve_form_properties.js.map +1 -0
- package/dist/form/useClearRestoreValue.js +27 -0
- package/dist/form/useClearRestoreValue.js.map +1 -0
- package/dist/form/useUndoableDiscard.js +36 -0
- package/dist/form/useUndoableDiscard.js.map +1 -0
- package/dist/form/validation.d.ts +20 -0
- package/dist/form/validation.js +416 -0
- package/dist/form/validation.js.map +1 -0
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.js +22 -0
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.js.map +1 -0
- package/dist/hooks/navigation/contexts/NavigationStateContext.js +15 -0
- package/dist/hooks/navigation/contexts/NavigationStateContext.js.map +1 -0
- package/dist/hooks/navigation/contexts/UrlContext.js +22 -0
- package/dist/hooks/navigation/contexts/UrlContext.js.map +1 -0
- package/dist/hooks/navigation/useAsyncResolver.js +68 -0
- package/dist/hooks/navigation/useAsyncResolver.js.map +1 -0
- package/dist/hooks/navigation/useBuildCollectionRegistryController.js +141 -0
- package/dist/hooks/navigation/useBuildCollectionRegistryController.js.map +1 -0
- package/dist/hooks/navigation/useBuildNavigationStateController.js +77 -0
- package/dist/hooks/navigation/useBuildNavigationStateController.js.map +1 -0
- package/dist/hooks/navigation/useBuildUrlController.js +57 -0
- package/dist/hooks/navigation/useBuildUrlController.js.map +1 -0
- package/dist/hooks/navigation/useNavigationResolution.js +177 -0
- package/dist/hooks/navigation/useNavigationResolution.js.map +1 -0
- package/dist/hooks/navigation/useResolvedCollections.js +56 -0
- package/dist/hooks/navigation/useResolvedCollections.js.map +1 -0
- package/dist/hooks/navigation/useResolvedViews.js +94 -0
- package/dist/hooks/navigation/useResolvedViews.js.map +1 -0
- package/dist/hooks/navigation/useTopLevelNavigation.js +162 -0
- package/dist/hooks/navigation/useTopLevelNavigation.js.map +1 -0
- package/dist/hooks/navigation/utils.js +125 -0
- package/dist/hooks/navigation/utils.js.map +1 -0
- package/dist/hooks/useAdminContext.js +45 -0
- package/dist/hooks/useAdminContext.js.map +1 -0
- package/dist/hooks/useBreadcrumbsController.js +17 -0
- package/dist/hooks/useBreadcrumbsController.js.map +1 -0
- package/dist/hooks/useBuildSideDialogsController.js +96 -0
- package/dist/hooks/useBuildSideDialogsController.js.map +1 -0
- package/dist/hooks/useBuildSidePanel.js +221 -0
- package/dist/hooks/useBuildSidePanel.js.map +1 -0
- package/dist/hooks/useChildViewSource.js +41 -0
- package/dist/hooks/useChildViewSource.js.map +1 -0
- package/dist/hooks/useEntityDisplay.js +136 -0
- package/dist/hooks/useEntityDisplay.js.map +1 -0
- package/dist/hooks/useEntityDisplayTitle.js +34 -0
- package/dist/hooks/useEntityDisplayTitle.js.map +1 -0
- package/dist/hooks/useHistory.js +137 -0
- package/dist/hooks/useHistory.js.map +1 -0
- package/dist/hooks/useRecordActions.d.ts +28 -6
- package/dist/hooks/useRecordActions.js +108 -0
- package/dist/hooks/useRecordActions.js.map +1 -0
- package/dist/hooks/useReferencePaths.d.ts +21 -0
- package/dist/hooks/useReferencePaths.js +32 -0
- package/dist/hooks/useReferencePaths.js.map +1 -0
- package/dist/hooks/useResolvedNavigationFrom.js +83 -0
- package/dist/hooks/useResolvedNavigationFrom.js.map +1 -0
- package/dist/hooks/useResolvedUsers.js +109 -0
- package/dist/hooks/useResolvedUsers.js.map +1 -0
- package/dist/hooks/useSelectionDialog.js +53 -0
- package/dist/hooks/useSelectionDialog.js.map +1 -0
- package/dist/hooks/useSideDialogsController.js +8 -0
- package/dist/hooks/useSideDialogsController.js.map +1 -0
- package/dist/hooks/useSidePanel.js +15 -0
- package/dist/hooks/useSidePanel.js.map +1 -0
- package/dist/hooks/useStorageReferenceResolver.d.ts +25 -0
- package/dist/hooks/useStorageReferenceResolver.js +49 -0
- package/dist/hooks/useStorageReferenceResolver.js.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.js +151 -3793
- package/dist/preview/PropertyPreview.js +260 -0
- package/dist/preview/PropertyPreview.js.map +1 -0
- package/dist/preview/compact_text.js +52 -0
- package/dist/preview/compact_text.js.map +1 -0
- package/dist/preview/components/ArrayEnumPreview.js +24 -0
- package/dist/preview/components/ArrayEnumPreview.js.map +1 -0
- package/dist/preview/components/BooleanPreview.js +25 -0
- package/dist/preview/components/BooleanPreview.js.map +1 -0
- package/dist/preview/components/DatePreview.d.ts +3 -2
- package/dist/preview/components/DatePreview.js +87 -0
- package/dist/preview/components/DatePreview.js.map +1 -0
- package/dist/preview/components/EmptyValue.js +13 -0
- package/dist/preview/components/EmptyValue.js.map +1 -0
- package/dist/preview/components/EnumValuesChip.js +26 -0
- package/dist/preview/components/EnumValuesChip.js.map +1 -0
- package/dist/preview/components/ImagePreview.d.ts +7 -1
- package/dist/preview/components/ImagePreview.js +112 -0
- package/dist/preview/components/ImagePreview.js.map +1 -0
- package/dist/preview/components/InlineEntityListPreview.js +31 -0
- package/dist/preview/components/InlineEntityListPreview.js.map +1 -0
- package/dist/preview/components/ReferencePreview.js +162 -0
- package/dist/preview/components/ReferencePreview.js.map +1 -0
- package/dist/preview/components/RelationPreview.js +196 -0
- package/dist/preview/components/RelationPreview.js.map +1 -0
- package/dist/preview/components/StorageMarkdown.d.ts +11 -0
- package/dist/preview/components/StorageMarkdown.js +49 -0
- package/dist/preview/components/StorageMarkdown.js.map +1 -0
- package/dist/preview/components/StorageThumbnail.js +183 -0
- package/dist/preview/components/StorageThumbnail.js.map +1 -0
- package/dist/preview/components/UrlComponentPreview.d.ts +3 -1
- package/dist/preview/components/UrlComponentPreview.js +88 -0
- package/dist/preview/components/UrlComponentPreview.js.map +1 -0
- package/dist/preview/components/UserPreview.js +30 -0
- package/dist/preview/components/UserPreview.js.map +1 -0
- package/dist/preview/components/date_fns_locales.js +124 -0
- package/dist/preview/components/date_fns_locales.js.map +1 -0
- package/dist/preview/components/storageRenditions.d.ts +10 -0
- package/dist/preview/components/storageRenditions.js +95 -0
- package/dist/preview/components/storageRenditions.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfMapsPreview.js +44 -0
- package/dist/preview/property_previews/ArrayOfMapsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfReferencesPreview.js +48 -0
- package/dist/preview/property_previews/ArrayOfReferencesPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfRelationsPreview.js +50 -0
- package/dist/preview/property_previews/ArrayOfRelationsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.js +30 -0
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOfStringsPreview.js +42 -0
- package/dist/preview/property_previews/ArrayOfStringsPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayOneOfPreview.js +47 -0
- package/dist/preview/property_previews/ArrayOneOfPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.js +25 -0
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.js.map +1 -0
- package/dist/preview/property_previews/ArrayPropertyPreview.js +48 -0
- package/dist/preview/property_previews/ArrayPropertyPreview.js.map +1 -0
- package/dist/preview/property_previews/MapPropertyPreview.js +137 -0
- package/dist/preview/property_previews/MapPropertyPreview.js.map +1 -0
- package/dist/preview/property_previews/NumberPropertyPreview.js +34 -0
- package/dist/preview/property_previews/NumberPropertyPreview.js.map +1 -0
- package/dist/preview/property_previews/SkeletonPropertyComponent.js +151 -0
- package/dist/preview/property_previews/SkeletonPropertyComponent.js.map +1 -0
- package/dist/preview/property_previews/StringPropertyPreview.js +49 -0
- package/dist/preview/property_previews/StringPropertyPreview.js.map +1 -0
- package/dist/preview/util.d.ts +8 -3
- package/dist/{util-CC0ozHoD.js → preview/util.js} +13 -6
- package/dist/preview/util.js.map +1 -0
- package/dist/routes/CustomViewRoute.js +26 -0
- package/dist/routes/CustomViewRoute.js.map +1 -0
- package/dist/routes/RebaseRoute.js +311 -0
- package/dist/routes/RebaseRoute.js.map +1 -0
- package/dist/selection/SelectionMenu.js +90 -0
- package/dist/selection/SelectionMenu.js.map +1 -0
- package/dist/selection/resolve_selection.js +79 -0
- package/dist/selection/resolve_selection.js.map +1 -0
- package/dist/util/caller_scopes.d.ts +15 -0
- package/dist/util/caller_scopes.js +25 -0
- package/dist/util/caller_scopes.js.map +1 -0
- package/dist/util/collection_open_mode.d.ts +20 -0
- package/dist/util/collection_open_mode.js +32 -0
- package/dist/util/collection_open_mode.js.map +1 -0
- package/dist/util/dataControllerAdapter.js +65 -0
- package/dist/util/dataControllerAdapter.js.map +1 -0
- package/dist/util/entity_actions.d.ts +42 -1
- package/dist/util/entity_actions.js +77 -0
- package/dist/util/entity_actions.js.map +1 -0
- package/dist/util/entity_pages.d.ts +37 -3
- package/dist/util/entity_pages.js +71 -0
- package/dist/util/entity_pages.js.map +1 -0
- package/dist/util/find_entities_by_ids.d.ts +23 -0
- package/dist/util/find_entities_by_ids.js +55 -0
- package/dist/util/find_entities_by_ids.js.map +1 -0
- package/dist/util/fit_inline_actions.d.ts +20 -0
- package/dist/util/fit_inline_actions.js +40 -0
- package/dist/util/fit_inline_actions.js.map +1 -0
- package/dist/util/format_collection_date.d.ts +29 -0
- package/dist/util/format_collection_date.js +60 -0
- package/dist/util/format_collection_date.js.map +1 -0
- package/dist/util/map_with_concurrency.js +46 -0
- package/dist/util/map_with_concurrency.js.map +1 -0
- package/dist/util/navigation_utils.js +45 -0
- package/dist/util/navigation_utils.js.map +1 -0
- package/dist/util/number_format.js +33 -0
- package/dist/util/number_format.js.map +1 -0
- package/dist/util/previews.js +71 -0
- package/dist/util/previews.js.map +1 -0
- package/dist/util/propertyConfigMapper.js +83 -0
- package/dist/util/propertyConfigMapper.js.map +1 -0
- package/dist/util/property_utils.js +141 -0
- package/dist/util/property_utils.js.map +1 -0
- package/dist/util/resolutions.js +55 -0
- package/dist/util/resolutions.js.map +1 -0
- package/dist/util/view_constants.js +35 -0
- package/dist/util/view_constants.js.map +1 -0
- package/dist/util/view_mode.js +112 -0
- package/dist/util/view_mode.js.map +1 -0
- package/package.json +13 -9
- package/dist/CollectionEditorDialog-DLHCka00.js +0 -3630
- package/dist/CollectionEditorDialog-DLHCka00.js.map +0 -1
- package/dist/JsonPreviewBinding-v0w3H0fp.js.map +0 -1
- package/dist/PropertyEditView-_pu5hzZn.js +0 -3837
- package/dist/PropertyEditView-_pu5hzZn.js.map +0 -1
- package/dist/RouterCollectionsStudioView-ChPNl_uU.js +0 -212
- package/dist/RouterCollectionsStudioView-ChPNl_uU.js.map +0 -1
- package/dist/SchemaChangeDialog-BeP0A4MJ.js.map +0 -1
- package/dist/collection_editor/ui/CollectionViewHeaderAction.d.ts +0 -13
- package/dist/collection_editor/ui/PropertyAddColumnComponent.d.ts +0 -8
- package/dist/collection_editor_ui.js.map +0 -1
- package/dist/editor.js.map +0 -1
- package/dist/export-4bJWdlDK.js +0 -520
- package/dist/export-4bJWdlDK.js.map +0 -1
- package/dist/history-BElrZ5Rw.js +0 -313
- package/dist/history-BElrZ5Rw.js.map +0 -1
- package/dist/import-TCgkTVlS.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/markdown-CCqp8ibf.js.map +0 -1
- package/dist/rolldown-runtime-D7D4PA-g.js +0 -13
- package/dist/util-CC0ozHoD.js.map +0 -1
- package/dist/util-DybQBkug.js +0 -26390
- package/dist/util-DybQBkug.js.map +0 -1
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { getPropertyInPath as getPropertyInPath$1 } from "../util/property_utils.js";
|
|
2
|
+
import { isEmptyPreviewValue } from "../preview/util.js";
|
|
3
|
+
import { SkeletonPropertyComponent } from "../preview/property_previews/SkeletonPropertyComponent.js";
|
|
4
|
+
import { useEntityTitle } from "../hooks/useEntityDisplay.js";
|
|
5
|
+
import { resolveCollectionSlotKeys } from "./CollectionViewBinding/usePreviewSlots.js";
|
|
6
|
+
import { useCollectionRegistryController } from "../hooks/navigation/contexts/CollectionRegistryContext.js";
|
|
7
|
+
import { useSidePanel } from "../hooks/useSidePanel.js";
|
|
8
|
+
import { NestedEntityPreviewBoundary } from "./EntityPreviewNesting.js";
|
|
9
|
+
import { PropertyPreview } from "../preview/PropertyPreview.js";
|
|
10
|
+
import * as React$1 from "react";
|
|
11
|
+
import { useMemo } from "react";
|
|
12
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { ArrowRightToLineIcon, IconButton, Skeleton, Tooltip, Typography, cls, defaultBorderMixin } from "@rebasepro/ui";
|
|
14
|
+
import { ErrorView, IconForView, getEntityImagePreviewPropertyKey, useAnalyticsController, useAuthController, useCustomizationController } from "@rebasepro/app";
|
|
15
|
+
import { getValueInPath } from "@rebasepro/utils";
|
|
16
|
+
//#region src/components/EntityPreviewBinding.tsx
|
|
17
|
+
/**
|
|
18
|
+
* This component contains the main logic and content for displaying a entity preview,
|
|
19
|
+
* without any container wrapper. Used internally by EntityPreviewBinding.
|
|
20
|
+
*/
|
|
21
|
+
function EntityPreviewBindingData({ actions, collection: collectionProp, previewKeys, size = "medium", includeId = true, onSidePanelClick, includeTitle = true, includeEntityLink = true, includeImage = true, layout = "card", entity }) {
|
|
22
|
+
const authController = useAuthController();
|
|
23
|
+
const analyticsController = useAnalyticsController();
|
|
24
|
+
const sidePanelController = useSidePanel();
|
|
25
|
+
const customizationController = useCustomizationController();
|
|
26
|
+
const collectionRegistryController = useCollectionRegistryController();
|
|
27
|
+
const collection = collectionProp ?? collectionRegistryController.getCollection(entity.path);
|
|
28
|
+
const title = useEntityTitle({
|
|
29
|
+
collection,
|
|
30
|
+
entity
|
|
31
|
+
});
|
|
32
|
+
const statedKeys = previewKeys ?? collection?.previewProperties;
|
|
33
|
+
const listProperties = useMemo(() => {
|
|
34
|
+
if (!collection) return [];
|
|
35
|
+
if (statedKeys && statedKeys.length > 0) return statedKeys.filter((key) => getPropertyInPath$1(collection.properties, key));
|
|
36
|
+
const slotKeys = resolveCollectionSlotKeys(collection, authController, customizationController.propertyConfigs);
|
|
37
|
+
return [slotKeys.subtitleKey, slotKeys.statusKey].filter(Boolean);
|
|
38
|
+
}, [
|
|
39
|
+
statedKeys,
|
|
40
|
+
collection,
|
|
41
|
+
authController,
|
|
42
|
+
customizationController.propertyConfigs
|
|
43
|
+
]);
|
|
44
|
+
if (!collection) return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(ErrorView, { error: `Collection not found: ${entity.path}` }) });
|
|
45
|
+
const titleProperty = includeTitle ? title.source?.key : void 0;
|
|
46
|
+
const imagePropertyKey = includeImage ? getEntityImagePreviewPropertyKey(collection) : void 0;
|
|
47
|
+
const imageProperty = imagePropertyKey ? collection.properties[imagePropertyKey] : void 0;
|
|
48
|
+
const ofProp = imageProperty && "of" in imageProperty ? imageProperty.of : void 0;
|
|
49
|
+
const usedImageProperty = ofProp ? Array.isArray(ofProp) ? ofProp[0] : ofProp : imageProperty;
|
|
50
|
+
const restProperties = listProperties.filter((p) => p !== titleProperty && p !== imagePropertyKey);
|
|
51
|
+
const openInSidePanel = () => {
|
|
52
|
+
onSidePanelClick?.(entity);
|
|
53
|
+
analyticsController.onAnalyticsEvent?.("entity_click_from_reference", {
|
|
54
|
+
path: entity.path,
|
|
55
|
+
entityId: entity.id
|
|
56
|
+
});
|
|
57
|
+
sidePanelController.open({
|
|
58
|
+
entityId: entity.id,
|
|
59
|
+
path: entity.path,
|
|
60
|
+
collection,
|
|
61
|
+
updateUrl: true
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
const imageValue = imagePropertyKey ? getValueInPath(entity.values, imagePropertyKey) : void 0;
|
|
65
|
+
const usedImageValue = imageProperty !== void 0 ? "of" in imageProperty ? (imageValue ?? []).length > 0 ? imageValue[0] : void 0 : imageValue : void 0;
|
|
66
|
+
if (layout === "row") return /* @__PURE__ */ jsx(EntityRowPreviewContent, {
|
|
67
|
+
size,
|
|
68
|
+
entity,
|
|
69
|
+
collection,
|
|
70
|
+
title: title.value ?? String(entity.id),
|
|
71
|
+
imageProperty: usedImageProperty,
|
|
72
|
+
imagePropertyKey,
|
|
73
|
+
imageValue: usedImageValue,
|
|
74
|
+
supportingKeys: restProperties,
|
|
75
|
+
onOpen: includeEntityLink ? openInSidePanel : void 0
|
|
76
|
+
});
|
|
77
|
+
return /* @__PURE__ */ jsxs(NestedEntityPreviewBoundary, { children: [
|
|
78
|
+
/* @__PURE__ */ jsxs("div", {
|
|
79
|
+
className: cls("flex shrink-0 overflow-hidden", {
|
|
80
|
+
"w-6 h-6 mx-1 my-0.5": size === "small" || size === "smallest",
|
|
81
|
+
"w-8 h-8 ml-1 mr-2 m-2 self-start": size === "medium",
|
|
82
|
+
"w-10 h-10 ml-2 mr-2 m-2 self-start": size === "large"
|
|
83
|
+
}),
|
|
84
|
+
children: [usedImageProperty && usedImageValue ? /* @__PURE__ */ jsx(PropertyPreview, {
|
|
85
|
+
property: usedImageProperty,
|
|
86
|
+
propertyKey: imagePropertyKey,
|
|
87
|
+
size: "small",
|
|
88
|
+
value: usedImageValue
|
|
89
|
+
}) : null, !usedImageProperty || !usedImageValue ? /* @__PURE__ */ jsx(IconForView, {
|
|
90
|
+
collectionOrView: collection,
|
|
91
|
+
color: "primary",
|
|
92
|
+
size,
|
|
93
|
+
className: "m-auto"
|
|
94
|
+
}) : null]
|
|
95
|
+
}),
|
|
96
|
+
/* @__PURE__ */ jsxs("div", {
|
|
97
|
+
className: "flex flex-col grow w-full m-1 shrink min-w-0 text-text-primary dark:text-text-primary-dark flex-1 mr-2",
|
|
98
|
+
children: [
|
|
99
|
+
includeId && (entity ? /* @__PURE__ */ jsx("div", {
|
|
100
|
+
className: "block whitespace-nowrap overflow-hidden truncate",
|
|
101
|
+
children: /* @__PURE__ */ jsx(Typography, {
|
|
102
|
+
variant: "caption",
|
|
103
|
+
color: "disabled",
|
|
104
|
+
className: "font-mono",
|
|
105
|
+
children: entity.id
|
|
106
|
+
})
|
|
107
|
+
}) : /* @__PURE__ */ jsx(Skeleton, {})),
|
|
108
|
+
includeTitle && (titleProperty || title.value) && /* @__PURE__ */ jsx("div", {
|
|
109
|
+
className: "truncate my-0.5 text-sm font-medium text-text-primary dark:text-text-primary-dark",
|
|
110
|
+
children: !entity && titleProperty ? /* @__PURE__ */ jsx(SkeletonPropertyComponent, {
|
|
111
|
+
property: getPropertyInPath$1(collection.properties, titleProperty),
|
|
112
|
+
size: "medium"
|
|
113
|
+
}) : titleProperty ? /* @__PURE__ */ jsx(PropertyPreview, {
|
|
114
|
+
propertyKey: titleProperty,
|
|
115
|
+
value: title.source?.value,
|
|
116
|
+
property: getPropertyInPath$1(collection.properties, titleProperty),
|
|
117
|
+
size: "medium"
|
|
118
|
+
}) : title.value
|
|
119
|
+
}),
|
|
120
|
+
restProperties && restProperties.map((key) => {
|
|
121
|
+
const childProperty = getPropertyInPath$1(collection.properties, key);
|
|
122
|
+
if (!childProperty) return null;
|
|
123
|
+
const valueInPath = getValueInPath(entity.values, key);
|
|
124
|
+
return /* @__PURE__ */ jsx("div", {
|
|
125
|
+
className: cls("truncate min-w-0 max-h-8 overflow-hidden", restProperties.length > 1 ? "my-0.5" : "my-0"),
|
|
126
|
+
children: entity ? /* @__PURE__ */ jsx(PropertyPreview, {
|
|
127
|
+
propertyKey: key,
|
|
128
|
+
value: valueInPath,
|
|
129
|
+
property: childProperty,
|
|
130
|
+
size: "small"
|
|
131
|
+
}) : /* @__PURE__ */ jsx(SkeletonPropertyComponent, {
|
|
132
|
+
property: childProperty,
|
|
133
|
+
size: "small"
|
|
134
|
+
})
|
|
135
|
+
}, "ref_prev_" + key);
|
|
136
|
+
})
|
|
137
|
+
]
|
|
138
|
+
}),
|
|
139
|
+
entity && includeEntityLink && /* @__PURE__ */ jsx("div", {
|
|
140
|
+
className: "flex-shrink-0",
|
|
141
|
+
children: /* @__PURE__ */ jsx(Tooltip, {
|
|
142
|
+
title: `See details for ${entity.id}`,
|
|
143
|
+
className: "shrink-0",
|
|
144
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
145
|
+
"aria-label": `See details for ${entity.id}`,
|
|
146
|
+
size: "small",
|
|
147
|
+
className: size !== "small" ? "self-start" : "",
|
|
148
|
+
onClick: (e) => {
|
|
149
|
+
e.stopPropagation();
|
|
150
|
+
e.preventDefault();
|
|
151
|
+
openInSidePanel();
|
|
152
|
+
},
|
|
153
|
+
children: /* @__PURE__ */ jsx(ArrowRightToLineIcon, {})
|
|
154
|
+
})
|
|
155
|
+
})
|
|
156
|
+
}),
|
|
157
|
+
actions && /* @__PURE__ */ jsx("div", {
|
|
158
|
+
className: "flex-shrink-0",
|
|
159
|
+
children: actions
|
|
160
|
+
})
|
|
161
|
+
] });
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* A record as a line of a table row: its image, a title that opens it, and the
|
|
165
|
+
* supporting lines that fit — one at `medium`, two at `large`. Supporting
|
|
166
|
+
* values that are empty are skipped rather than drawn as an empty bar, so the
|
|
167
|
+
* line under a name is the first thing the record actually has to say.
|
|
168
|
+
*/
|
|
169
|
+
function EntityRowPreviewContent({ size, entity, collection, title, imageProperty, imagePropertyKey, imageValue, supportingKeys, onOpen }) {
|
|
170
|
+
const maxLines = size === "large" ? 2 : 1;
|
|
171
|
+
const lines = supportingKeys.map((key) => ({
|
|
172
|
+
key,
|
|
173
|
+
property: getPropertyInPath$1(collection.properties, key),
|
|
174
|
+
value: getValueInPath(entity.values, key)
|
|
175
|
+
})).filter((line) => Boolean(line.property) && !isEmptyPreviewValue(line.value)).slice(0, maxLines);
|
|
176
|
+
const titleNode = /* @__PURE__ */ jsx("span", {
|
|
177
|
+
className: "truncate",
|
|
178
|
+
children: title
|
|
179
|
+
});
|
|
180
|
+
return /* @__PURE__ */ jsx(NestedEntityPreviewBoundary, { children: /* @__PURE__ */ jsxs("div", {
|
|
181
|
+
className: "flex items-center gap-2.5 min-w-0 w-full text-left",
|
|
182
|
+
children: [imagePropertyKey && /* @__PURE__ */ jsx("div", {
|
|
183
|
+
className: cls("flex shrink-0 items-center justify-center overflow-hidden rounded-md", size === "large" ? "w-10 h-10" : "w-8 h-8"),
|
|
184
|
+
children: imageProperty && imageValue ? /* @__PURE__ */ jsx(PropertyPreview, {
|
|
185
|
+
property: imageProperty,
|
|
186
|
+
propertyKey: imagePropertyKey,
|
|
187
|
+
size: "small",
|
|
188
|
+
value: imageValue
|
|
189
|
+
}) : /* @__PURE__ */ jsx(IconForView, {
|
|
190
|
+
collectionOrView: collection,
|
|
191
|
+
color: "primary",
|
|
192
|
+
size: "small"
|
|
193
|
+
})
|
|
194
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
195
|
+
className: "flex flex-col min-w-0 flex-1",
|
|
196
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
197
|
+
className: "flex min-w-0 text-sm font-medium text-text-primary dark:text-text-primary-dark",
|
|
198
|
+
children: onOpen ? /* @__PURE__ */ jsx(Tooltip, {
|
|
199
|
+
title: `See details for ${title}`,
|
|
200
|
+
asChild: true,
|
|
201
|
+
children: /* @__PURE__ */ jsx("span", {
|
|
202
|
+
role: "button",
|
|
203
|
+
tabIndex: 0,
|
|
204
|
+
className: "inline-flex min-w-0 max-w-full cursor-pointer hover:underline underline-offset-2",
|
|
205
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
206
|
+
onClick: (event) => {
|
|
207
|
+
event.preventDefault();
|
|
208
|
+
event.stopPropagation();
|
|
209
|
+
onOpen();
|
|
210
|
+
},
|
|
211
|
+
onKeyDown: (event) => {
|
|
212
|
+
if (event.key !== "Enter" && event.key !== " ") return;
|
|
213
|
+
event.preventDefault();
|
|
214
|
+
event.stopPropagation();
|
|
215
|
+
onOpen();
|
|
216
|
+
},
|
|
217
|
+
children: titleNode
|
|
218
|
+
})
|
|
219
|
+
}) : titleNode
|
|
220
|
+
}), lines.map(({ key, property, value }) => /* @__PURE__ */ jsx("div", {
|
|
221
|
+
className: "truncate min-w-0 max-h-5 overflow-hidden text-xs text-text-secondary dark:text-text-secondary-dark",
|
|
222
|
+
children: /* @__PURE__ */ jsx(PropertyPreview, {
|
|
223
|
+
propertyKey: key,
|
|
224
|
+
value,
|
|
225
|
+
property,
|
|
226
|
+
size: "small"
|
|
227
|
+
})
|
|
228
|
+
}, key))]
|
|
229
|
+
})]
|
|
230
|
+
}) });
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* This view is used to display a preview of a entity.
|
|
234
|
+
* It is used by default in reference fields and whenever a reference is displayed.
|
|
235
|
+
*/
|
|
236
|
+
function EntityPreviewBinding({ actions, disabled, hover, collection, previewKeys, onClick, size = "medium", includeId = true, includeTitle = true, includeEntityLink = true, includeImage = true, onSidePanelClick, entity }) {
|
|
237
|
+
return /* @__PURE__ */ jsx(EntityPreviewContainer, {
|
|
238
|
+
onClick: disabled ? void 0 : onClick,
|
|
239
|
+
hover: disabled ? void 0 : hover,
|
|
240
|
+
size,
|
|
241
|
+
children: /* @__PURE__ */ jsx(EntityPreviewBindingData, {
|
|
242
|
+
actions,
|
|
243
|
+
collection,
|
|
244
|
+
previewKeys,
|
|
245
|
+
size,
|
|
246
|
+
includeId,
|
|
247
|
+
includeTitle,
|
|
248
|
+
includeEntityLink,
|
|
249
|
+
includeImage,
|
|
250
|
+
onSidePanelClick,
|
|
251
|
+
entity
|
|
252
|
+
})
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
var EntityPreviewContainer = React$1.forwardRef(({ children, hover, onClick, size = "medium", style, className, fullwidth = true, ...props }, ref) => {
|
|
256
|
+
return /* @__PURE__ */ jsx("div", {
|
|
257
|
+
ref,
|
|
258
|
+
tabIndex: 0,
|
|
259
|
+
style,
|
|
260
|
+
className: cls("bg-surface-card", size === "small" ? "min-h-[32px]" : "min-h-[48px]", fullwidth ? "w-full" : "", "items-center overflow-hidden", hover ? "hover:bg-surface-hover group-hover:bg-surface-hover" : "", size === "small" ? "p-1" : "px-2 py-1", "flex border rounded-lg", onClick ? "cursor-pointer" : "", defaultBorderMixin, className),
|
|
261
|
+
role: onClick ? "button" : void 0,
|
|
262
|
+
onClick: (event) => {
|
|
263
|
+
if (onClick) {
|
|
264
|
+
event.preventDefault();
|
|
265
|
+
onClick(event);
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
onKeyDown: (event) => {
|
|
269
|
+
if (onClick && (event.key === "Enter" || event.key === " ")) {
|
|
270
|
+
event.preventDefault();
|
|
271
|
+
onClick(event);
|
|
272
|
+
}
|
|
273
|
+
},
|
|
274
|
+
...props,
|
|
275
|
+
children
|
|
276
|
+
});
|
|
277
|
+
});
|
|
278
|
+
EntityPreviewContainer.displayName = "EntityPreviewContainer";
|
|
279
|
+
//#endregion
|
|
280
|
+
export { EntityPreviewBinding, EntityPreviewBindingData, EntityPreviewContainer };
|
|
281
|
+
|
|
282
|
+
//# sourceMappingURL=EntityPreviewBinding.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityPreviewBinding.js","names":[],"sources":["../../src/components/EntityPreviewBinding.tsx"],"sourcesContent":["\nimport type { Property } from \"@rebasepro/types\";\nimport * as React from \"react\";\nimport { useEffect, useMemo } from \"react\";\n\nimport { Entity } from \"@rebasepro/types\";\nimport type { PreviewSize } from \"../types/components/PropertyPreviewProps\";\nimport { getEntityImagePreviewPropertyKey } from \"@rebasepro/app\";\nimport {\n ArrowRightToLineIcon,\n cls,\n defaultBorderMixin,\n IconButton,\n Skeleton,\n Tooltip,\n Typography\n} from \"@rebasepro/ui\";\nimport { PropertyPreview, SkeletonPropertyComponent } from \"../preview\";\nimport {\n useAuthController,\n useCustomizationController,\n useData,\n ErrorView\n} from \"@rebasepro/app\";\nimport { useAnalyticsController } from \"@rebasepro/app\";\nimport { IconForView } from \"@rebasepro/app\";\nimport { getPropertyInPath } from \"../util/property_utils\";\nimport { resolveCollectionSlotKeys } from \"./CollectionViewBinding/usePreviewSlots\";\nimport { useEntityTitle } from \"../hooks/useEntityDisplay\";\nimport { getValueInPath } from \"@rebasepro/utils\";\nimport { useCollectionRegistryController } from \"../hooks/navigation/contexts/CollectionRegistryContext\";\nimport { useSidePanel } from \"../hooks/useSidePanel\";\nimport { EntityPreviewLayout, NestedEntityPreviewBoundary } from \"./EntityPreviewNesting\";\nimport { isEmptyPreviewValue } from \"../preview/util\";\nimport type { AdminCollection } from \"@rebasepro/cms-types\";\n\nexport type EntityPreviewBindingProps = {\n size?: PreviewSize,\n actions?: React.ReactNode,\n collection?: AdminCollection,\n hover?: boolean;\n previewKeys?: string[],\n disabled?: boolean,\n entity: Entity<any>,\n includeId?: boolean,\n includeTitle?: boolean,\n includeEntityLink?: boolean,\n includeImage?: boolean,\n onClick?: (e: React.SyntheticEvent) => void;\n onSidePanelClick?: (entity: Entity) => void,\n};\n\nexport type EntityPreviewBindingDataProps = {\n size?: \"smallest\" | \"small\" | \"medium\" | \"large\",\n actions?: React.ReactNode,\n collection?: AdminCollection,\n previewKeys?: string[],\n entity: Entity<any>,\n onSidePanelClick?: (entity: Entity) => void,\n includeId?: boolean,\n includeTitle?: boolean,\n includeEntityLink?: boolean,\n includeImage?: boolean,\n /**\n * `row` draws the record as a line of a table row instead of a card: see\n * {@link EntityPreviewLayout}. No id, no open button — the title opens the\n * record — and only as many supporting lines as the row has room for.\n */\n layout?: EntityPreviewLayout,\n};\n\n/**\n * This component contains the main logic and content for displaying a entity preview,\n * without any container wrapper. Used internally by EntityPreviewBinding.\n */\nexport function EntityPreviewBindingData({\n actions,\n collection: collectionProp,\n previewKeys,\n size = \"medium\",\n includeId = true,\n onSidePanelClick,\n includeTitle = true,\n includeEntityLink = true,\n includeImage = true,\n layout = \"card\",\n entity\n}: EntityPreviewBindingDataProps) {\n\n const authController = useAuthController();\n const analyticsController = useAnalyticsController();\n const sidePanelController = useSidePanel();\n const customizationController = useCustomizationController();\n\n const collectionRegistryController = useCollectionRegistryController();\n\n const collection = collectionProp ?? collectionRegistryController.getCollection(entity.path);\n\n // Above the `!collection` return, because hooks are. `useEntityTitle`\n // tolerates a missing collection for exactly this reason.\n const title = useEntityTitle({\n collection,\n entity\n });\n\n // What the card says under the title.\n //\n // A stated list wins outright — `previewProperties` is the one place a\n // developer says \"show these\", and nothing here is allowed to second-guess\n // it. Failing that, the card fills the same slots as every other surface\n // that renders one record in a row: a supporting line and a status. It used\n // to take the first few properties in declaration order instead, which is\n // how an author card ended up rendering an entire Markdown biography.\n const statedKeys = previewKeys ?? (collection?.previewProperties as string[] | undefined);\n const listProperties = useMemo(() => {\n if (!collection) return [];\n if (statedKeys && statedKeys.length > 0) {\n return statedKeys.filter(key => getPropertyInPath(collection.properties, key));\n }\n const slotKeys = resolveCollectionSlotKeys(\n collection as AdminCollection<Record<string, unknown>>,\n authController,\n customizationController.propertyConfigs);\n return [slotKeys.subtitleKey, slotKeys.statusKey].filter(Boolean) as string[];\n }, [statedKeys, collection, authController, customizationController.propertyConfigs]);\n\n if (!collection) {\n return (\n <>\n <ErrorView error={`Collection not found: ${entity.path}`}/>\n </>\n );\n }\n\n const titleProperty = includeTitle ? title.source?.key : undefined;\n const imagePropertyKey = includeImage ? getEntityImagePreviewPropertyKey(collection) : undefined;\n const imageProperty = imagePropertyKey ? collection.properties[imagePropertyKey] : undefined;\n const ofProp = imageProperty && \"of\" in imageProperty ? imageProperty.of : undefined;\n const usedImageProperty = ofProp ? (Array.isArray(ofProp) ? ofProp[0] : ofProp) : imageProperty;\n const restProperties = listProperties.filter(p => p !== titleProperty && p !== imagePropertyKey);\n\n const openInSidePanel = () => {\n onSidePanelClick?.(entity);\n analyticsController.onAnalyticsEvent?.(\"entity_click_from_reference\", {\n path: entity.path,\n entityId: entity.id\n });\n sidePanelController.open({\n entityId: entity.id,\n path: entity.path,\n collection,\n updateUrl: true\n });\n };\n\n const imageValue = imagePropertyKey ? getValueInPath(entity.values, imagePropertyKey) : undefined;\n const usedImageValue = imageProperty !== undefined ? (\"of\" in imageProperty\n ? (((imageValue as unknown[]) ?? []).length > 0\n ? (imageValue as unknown[])[0] : undefined)\n : imageValue)\n : undefined;\n\n if (layout === \"row\")\n return <EntityRowPreviewContent size={size}\n entity={entity}\n collection={collection}\n title={title.value ?? String(entity.id)}\n imageProperty={usedImageProperty}\n imagePropertyKey={imagePropertyKey}\n imageValue={usedImageValue}\n supportingKeys={restProperties}\n onOpen={includeEntityLink ? openInSidePanel : undefined}/>;\n\n return (\n // Everything below renders *inside* this preview: a reference or\n // relation among the preview properties collapses to one line instead\n // of nesting another bordered card with its own id and action button.\n <NestedEntityPreviewBoundary>\n {/* `overflow-hidden`: the image slot is a fixed box, and a thumbnail\n that fails to load renders a \"file not found\" message sized for a\n full preview — which spilled across the title beside it. */}\n <div className={cls(\"flex shrink-0 overflow-hidden\", {\n \"w-6 h-6 mx-1 my-0.5\": size === \"small\" || size === \"smallest\",\n \"w-8 h-8 ml-1 mr-2 m-2 self-start\": size === \"medium\",\n \"w-10 h-10 ml-2 mr-2 m-2 self-start\": size === \"large\"\n })}>\n {usedImageProperty && usedImageValue ? <PropertyPreview property={usedImageProperty}\n propertyKey={imagePropertyKey as string}\n size={\"small\"}\n value={usedImageValue as never}/> : null}\n {(!usedImageProperty || !usedImageValue) ? <IconForView collectionOrView={collection}\n color={\"primary\"}\n size={size}\n className={\"m-auto\"}/> : null}\n </div>\n\n <div\n className={\"flex flex-col grow w-full m-1 shrink min-w-0 text-text-primary dark:text-text-primary-dark flex-1 mr-2\"}>\n\n {includeId && (\n entity\n ? <div className={\"block whitespace-nowrap overflow-hidden truncate\"}>\n <Typography variant={\"caption\"}\n color={\"disabled\"}\n className={\"font-mono\"}>\n {entity.id}\n </Typography>\n </div>\n : <Skeleton/>)}\n\n {/* A title that came from a property keeps that property's own\n rendering — an enum stays its coloured chip, a relation stays\n a link. A computed one is text, because that is all a\n resolver returns. */}\n {includeTitle && (titleProperty || title.value) && (\n <div\n className={\"truncate my-0.5 text-sm font-medium text-text-primary dark:text-text-primary-dark\"}>\n {!entity && titleProperty\n ? <SkeletonPropertyComponent\n property={getPropertyInPath(collection.properties, titleProperty) as Property}\n size={\"medium\"}/>\n : titleProperty\n ? <PropertyPreview\n propertyKey={titleProperty}\n value={title.source?.value as never}\n property={getPropertyInPath(collection.properties, titleProperty) as Property}\n size={\"medium\"}/>\n : title.value}\n </div>\n )}\n\n {restProperties && restProperties.map((key) => {\n const childProperty = getPropertyInPath(collection.properties, key);\n if (!childProperty) return null;\n\n const valueInPath = getValueInPath(entity.values, key);\n return (\n // `truncate` clamps a line of text; it does nothing to a\n // preview that renders blocks. Custom `admin.Preview`\n // components can render anything at all, so the height\n // is capped here as well — a card that loses the tail of\n // an unusual value beats a card the size of a document.\n <div key={\"ref_prev_\" + key}\n className={cls(\"truncate min-w-0 max-h-8 overflow-hidden\",\n restProperties.length > 1 ? \"my-0.5\" : \"my-0\")}>\n {\n entity\n ? <PropertyPreview\n propertyKey={key as string}\n value={valueInPath as never}\n property={childProperty as Property}\n size={\"small\"}/>\n : <SkeletonPropertyComponent\n property={childProperty as Property}\n size={\"small\"}/>\n }\n </div>\n );\n })}\n\n </div>\n\n {entity && includeEntityLink &&\n <div className=\"flex-shrink-0\">\n <Tooltip title={`See details for ${entity.id}`} className={\"shrink-0\"}>\n <IconButton aria-label={`See details for ${entity.id}`}\n size={\"small\"}\n className={size !== \"small\" ? \"self-start\" : \"\"}\n onClick={(e) => {\n e.stopPropagation();\n e.preventDefault();\n openInSidePanel();\n }}>\n <ArrowRightToLineIcon/>\n </IconButton>\n </Tooltip>\n </div>}\n\n {actions && <div className=\"flex-shrink-0\">{actions}</div>}\n </NestedEntityPreviewBoundary>\n );\n}\n\n/**\n * A record as a line of a table row: its image, a title that opens it, and the\n * supporting lines that fit — one at `medium`, two at `large`. Supporting\n * values that are empty are skipped rather than drawn as an empty bar, so the\n * line under a name is the first thing the record actually has to say.\n */\nfunction EntityRowPreviewContent({\n size,\n entity,\n collection,\n title,\n imageProperty,\n imagePropertyKey,\n imageValue,\n supportingKeys,\n onOpen\n}: {\n size: \"smallest\" | \"small\" | \"medium\" | \"large\";\n entity: Entity<Record<string, unknown>>;\n collection: AdminCollection;\n title: string;\n imageProperty?: Property;\n imagePropertyKey?: string;\n imageValue: unknown;\n supportingKeys: string[];\n onOpen?: () => void;\n}) {\n const maxLines = size === \"large\" ? 2 : 1;\n const lines = supportingKeys\n .map(key => ({\n key,\n property: getPropertyInPath(collection.properties, key),\n value: getValueInPath(entity.values, key)\n }))\n .filter((line): line is { key: string, property: Property, value: unknown } =>\n Boolean(line.property) && !isEmptyPreviewValue(line.value))\n .slice(0, maxLines);\n\n const titleNode = <span className={\"truncate\"}>{title}</span>;\n\n return (\n <NestedEntityPreviewBoundary>\n <div className={\"flex items-center gap-2.5 min-w-0 w-full text-left\"}>\n {imagePropertyKey && <div className={cls(\"flex shrink-0 items-center justify-center overflow-hidden rounded-md\",\n size === \"large\" ? \"w-10 h-10\" : \"w-8 h-8\")}>\n {imageProperty && imageValue\n ? <PropertyPreview property={imageProperty}\n propertyKey={imagePropertyKey}\n size={\"small\"}\n value={imageValue as never}/>\n : <IconForView collectionOrView={collection}\n color={\"primary\"}\n size={\"small\"}/>}\n </div>}\n <div className={\"flex flex-col min-w-0 flex-1\"}>\n <div className={\"flex min-w-0 text-sm font-medium text-text-primary dark:text-text-primary-dark\"}>\n {onOpen\n ? <Tooltip title={`See details for ${title}`} asChild={true}>\n <span role={\"button\"}\n tabIndex={0}\n className={\"inline-flex min-w-0 max-w-full cursor-pointer hover:underline underline-offset-2\"}\n // See InlineEntityPreview: a press does not\n // move the focus, or a table cell would\n // select itself mid-click.\n onMouseDown={(event) => event.preventDefault()}\n onClick={(event) => {\n event.preventDefault();\n event.stopPropagation();\n onOpen();\n }}\n onKeyDown={(event) => {\n if (event.key !== \"Enter\" && event.key !== \" \") return;\n event.preventDefault();\n event.stopPropagation();\n onOpen();\n }}>\n {titleNode}\n </span>\n </Tooltip>\n : titleNode}\n </div>\n {lines.map(({ key, property, value }) =>\n <div key={key}\n className={\"truncate min-w-0 max-h-5 overflow-hidden text-xs text-text-secondary dark:text-text-secondary-dark\"}>\n <PropertyPreview propertyKey={key}\n value={value as never}\n property={property}\n size={\"small\"}/>\n </div>)}\n </div>\n </div>\n </NestedEntityPreviewBoundary>\n );\n}\n\nexport function EntityPreviewBindingWithId({\n entityId,\n path,\n ...props\n}: Omit<EntityPreviewBindingProps, \"entity\"> & {\n entityId: string | number;\n path: string;\n databaseId?: string;\n}) {\n\n const [entity, setEntity] = React.useState<Entity | undefined>();\n const [dataLoading, setDataLoading] = React.useState(false);\n const dataClient = useData();\n\n useEffect(() => {\n let isMounted = true;\n if (!entityId || !path) {\n setEntity(undefined);\n return;\n }\n const fetchOne = async () => {\n setDataLoading(true);\n try {\n const fetchedEntity = await dataClient.collection(path).findById(entityId);\n if (isMounted) {\n setEntity(fetchedEntity);\n }\n } catch (error) {\n console.error(\"Error fetching entity:\", error);\n if (isMounted) {\n setEntity(undefined);\n }\n } finally {\n if (isMounted) {\n setDataLoading(false);\n }\n }\n }\n\n fetchOne();\n\n return () => {\n isMounted = false;\n }\n }, [entityId, path]);\n\n if (dataLoading && !entity) {\n return (\n <EntityPreviewContainer\n hover={props.hover}\n size={props.size}>\n <Skeleton/>\n </EntityPreviewContainer>\n );\n }\n\n if (!entity) {\n return (\n <EntityPreviewContainer\n hover={props.hover}\n size={props.size}>\n <div className={\"text-text-secondary dark:text-text-secondary-dark\"}>\n Entity not found\n </div>\n </EntityPreviewContainer>\n );\n }\n\n return <EntityPreviewBindingData\n {...props}\n entity={entity}/>;\n}\n\n/**\n * This view is used to display a preview of a entity.\n * It is used by default in reference fields and whenever a reference is displayed.\n */\nexport function EntityPreviewBinding({\n actions,\n disabled,\n hover,\n collection,\n previewKeys,\n onClick,\n size = \"medium\",\n includeId = true,\n includeTitle = true,\n includeEntityLink = true,\n includeImage = true,\n onSidePanelClick,\n entity\n}: EntityPreviewBindingProps) {\n\n return (\n <EntityPreviewContainer\n onClick={disabled ? undefined : onClick}\n hover={disabled ? undefined : hover}\n size={size}>\n <EntityPreviewBindingData\n actions={actions}\n collection={collection}\n previewKeys={previewKeys}\n size={size}\n includeId={includeId}\n includeTitle={includeTitle}\n includeEntityLink={includeEntityLink}\n includeImage={includeImage}\n onSidePanelClick={onSidePanelClick}\n entity={entity}\n />\n </EntityPreviewContainer>\n );\n}\n\nexport type EntityPreviewContainerProps = {\n children: React.ReactNode;\n hover?: boolean;\n fullwidth?: boolean;\n size?: PreviewSize;\n className?: string;\n style?: React.CSSProperties;\n onClick?: (e: React.SyntheticEvent) => void;\n};\n\nexport const EntityPreviewContainer = React.forwardRef<HTMLDivElement, EntityPreviewContainerProps>(({\n children,\n hover,\n onClick,\n size = \"medium\",\n style,\n className,\n fullwidth = true,\n ...props\n}, ref) => {\n return <div\n ref={ref}\n tabIndex={0}\n style={style}\n className={cls(\n \"bg-surface-card\",\n // On the shared 28/32/40/48 control scale. `44px` was between two\n // steps of it, so a reference in a form was 4px short of the field\n // next to it and their boxes never quite agreed.\n size === \"small\" ? \"min-h-[32px]\" : \"min-h-[48px]\",\n fullwidth ? \"w-full\" : \"\",\n \"items-center overflow-hidden\",\n hover ? \"hover:bg-surface-hover group-hover:bg-surface-hover\" : \"\",\n size === \"small\" ? \"p-1\" : \"px-2 py-1\",\n \"flex border rounded-lg\",\n onClick ? \"cursor-pointer\" : \"\",\n defaultBorderMixin,\n className)}\n role={onClick ? \"button\" : undefined}\n onClick={(event) => {\n if (onClick) {\n event.preventDefault();\n onClick(event);\n }\n }}\n onKeyDown={(event) => {\n if (onClick && (event.key === \"Enter\" || event.key === \" \")) {\n event.preventDefault();\n onClick(event);\n }\n }}\n {...props}>\n {children}\n </div>;\n});\n\nEntityPreviewContainer.displayName = \"EntityPreviewContainer\";\n"],"mappings":"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"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import * as React$1 from "react";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
//#region src/components/EntityPreviewNesting.tsx
|
|
4
|
+
/**
|
|
5
|
+
* How deep the current entity preview is nested inside another one.
|
|
6
|
+
*
|
|
7
|
+
* A reference or relation rendered on its own (a form field, a table cell) is
|
|
8
|
+
* at depth 0 and gets the full card treatment: image slot, id, title, preview
|
|
9
|
+
* properties and a link to the side panel. A reference rendered *inside*
|
|
10
|
+
* another entity preview is at depth 1+, where repeating that card produces a
|
|
11
|
+
* box-inside-a-box with its own borders, id line and action button. Nested
|
|
12
|
+
* previews collapse to a compact chip instead.
|
|
13
|
+
*/
|
|
14
|
+
var EntityPreviewDepthContext = React$1.createContext(0);
|
|
15
|
+
/**
|
|
16
|
+
* Current entity preview nesting depth. 0 means "not inside another preview".
|
|
17
|
+
*/
|
|
18
|
+
function useEntityPreviewDepth() {
|
|
19
|
+
return React$1.useContext(EntityPreviewDepthContext);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* True when the preview being rendered lives inside another entity preview,
|
|
23
|
+
* and should therefore render its compact variant.
|
|
24
|
+
*/
|
|
25
|
+
function useIsNestedEntityPreview() {
|
|
26
|
+
return useEntityPreviewDepth() > 0;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Marks its children as being rendered inside an entity preview, so any
|
|
30
|
+
* reference or relation below collapses to a chip.
|
|
31
|
+
*/
|
|
32
|
+
function NestedEntityPreviewBoundary({ children }) {
|
|
33
|
+
const depth = useEntityPreviewDepth();
|
|
34
|
+
return /* @__PURE__ */ jsx(EntityPreviewDepthContext.Provider, {
|
|
35
|
+
value: depth + 1,
|
|
36
|
+
children
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
var EntityPreviewLayoutContext = React$1.createContext("card");
|
|
40
|
+
function useEntityPreviewLayout() {
|
|
41
|
+
return React$1.useContext(EntityPreviewLayoutContext);
|
|
42
|
+
}
|
|
43
|
+
/** Lays out the previews below it as rows. See {@link EntityPreviewLayout}. */
|
|
44
|
+
function RowEntityPreviewLayout({ children }) {
|
|
45
|
+
return /* @__PURE__ */ jsx(EntityPreviewLayoutContext.Provider, {
|
|
46
|
+
value: "row",
|
|
47
|
+
children
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//#endregion
|
|
51
|
+
export { NestedEntityPreviewBoundary, RowEntityPreviewLayout, useEntityPreviewDepth, useEntityPreviewLayout, useIsNestedEntityPreview };
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=EntityPreviewNesting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EntityPreviewNesting.js","names":[],"sources":["../../src/components/EntityPreviewNesting.tsx"],"sourcesContent":["import * as React from \"react\";\n\n/**\n * How deep the current entity preview is nested inside another one.\n *\n * A reference or relation rendered on its own (a form field, a table cell) is\n * at depth 0 and gets the full card treatment: image slot, id, title, preview\n * properties and a link to the side panel. A reference rendered *inside*\n * another entity preview is at depth 1+, where repeating that card produces a\n * box-inside-a-box with its own borders, id line and action button. Nested\n * previews collapse to a compact chip instead.\n */\nconst EntityPreviewDepthContext = React.createContext<number>(0);\n\n/**\n * Current entity preview nesting depth. 0 means \"not inside another preview\".\n */\nexport function useEntityPreviewDepth(): number {\n return React.useContext(EntityPreviewDepthContext);\n}\n\n/**\n * True when the preview being rendered lives inside another entity preview,\n * and should therefore render its compact variant.\n */\nexport function useIsNestedEntityPreview(): boolean {\n return useEntityPreviewDepth() > 0;\n}\n\n/**\n * Marks its children as being rendered inside an entity preview, so any\n * reference or relation below collapses to a chip.\n */\nexport function NestedEntityPreviewBoundary({ children }: { children: React.ReactNode }) {\n const depth = useEntityPreviewDepth();\n return <EntityPreviewDepthContext.Provider value={depth + 1}>\n {children}\n </EntityPreviewDepthContext.Provider>;\n}\n\n/**\n * Resets the nesting depth back to 0. Used by surfaces that open a fresh\n * rendering context for an entity — a side panel, a dialog — from within a\n * preview, where the children are no longer visually nested.\n */\nexport function RootEntityPreviewBoundary({ children }: { children: React.ReactNode }) {\n return <EntityPreviewDepthContext.Provider value={0}>\n {children}\n </EntityPreviewDepthContext.Provider>;\n}\n\n/**\n * How a top-level reference or relation preview is laid out.\n *\n * `card` is the form's: a bordered box with the record's id, title, preview\n * properties and a button to open it. `row` is a table cell's: the same\n * record as a line of the row it sits in — image, a title that opens it, one\n * supporting line — with no box of its own, because the cell is the box and\n * a card is taller than a row.\n */\nexport type EntityPreviewLayout = \"card\" | \"row\";\n\nconst EntityPreviewLayoutContext = React.createContext<EntityPreviewLayout>(\"card\");\n\nexport function useEntityPreviewLayout(): EntityPreviewLayout {\n return React.useContext(EntityPreviewLayoutContext);\n}\n\n/** Lays out the previews below it as rows. See {@link EntityPreviewLayout}. */\nexport function RowEntityPreviewLayout({ children }: { children: React.ReactNode }) {\n return <EntityPreviewLayoutContext.Provider value={\"row\"}>\n {children}\n </EntityPreviewLayoutContext.Provider>;\n}\n"],"mappings":";;;;;;;;;;;;;AAYA,IAAM,4BAA4B,QAAM,cAAsB,CAAC;;;;AAK/D,SAAgB,wBAAgC;CAC5C,OAAO,QAAM,WAAW,yBAAyB;AACrD;;;;;AAMA,SAAgB,2BAAoC;CAChD,OAAO,sBAAsB,IAAI;AACrC;;;;;AAMA,SAAgB,4BAA4B,EAAE,YAA2C;CACrF,MAAM,QAAQ,sBAAsB;CACpC,OAAO,oBAAC,0BAA0B,UAA3B;EAAoC,OAAO,QAAQ;EACrD;CAC+B,CAAA;AACxC;AAwBA,IAAM,6BAA6B,QAAM,cAAmC,MAAM;AAElF,SAAgB,yBAA8C;CAC1D,OAAO,QAAM,WAAW,0BAA0B;AACtD;;AAGA,SAAgB,uBAAuB,EAAE,YAA2C;CAChF,OAAO,oBAAC,2BAA2B,UAA5B;EAAqC,OAAO;EAC9C;CACgC,CAAA;AACzC"}
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { FieldBlock, spanClass } from "../form/components/FieldBlock.js";
|
|
2
|
+
import { AdditionalFieldValue } from "./AdditionalFieldValue.js";
|
|
3
|
+
import { FormRail, RecordMeta } from "../form/components/FormRail.js";
|
|
4
|
+
import { FormSections } from "../form/components/FormSections.js";
|
|
5
|
+
import { useRailVisible } from "../form/components/useRailVisible.js";
|
|
6
|
+
import { useEntityDisplayValues } from "../hooks/useEntityDisplay.js";
|
|
7
|
+
import { PropertyPreview } from "../preview/PropertyPreview.js";
|
|
8
|
+
import { EntityDisplayHeader, HEADER_DISPLAY_ROLES } from "./EntityDisplayHeader.js";
|
|
9
|
+
import { useCallback, useMemo, useRef, useState } from "react";
|
|
10
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { AlignLeftIcon, cls, defaultBorderMixin, paperMixin } from "@rebasepro/ui";
|
|
12
|
+
import { getFormFieldKeys, resolveFormLayout, useRebaseContext } from "@rebasepro/app";
|
|
13
|
+
import { getValueInPath } from "@rebasepro/utils";
|
|
14
|
+
//#region src/components/EntityViewBinding.tsx
|
|
15
|
+
/** Nothing can be in error in a view that cannot be submitted. */
|
|
16
|
+
var NO_ERRORS = /* @__PURE__ */ new Set();
|
|
17
|
+
/**
|
|
18
|
+
* The fields the read-only view lays out, in render order.
|
|
19
|
+
*
|
|
20
|
+
* The same set the form uses, minus two groups. Both are dropped *before* the
|
|
21
|
+
* layout resolves rather than skipped while rendering, because the resolver has
|
|
22
|
+
* by then given each one a place on the grid — skipping later leaves that place
|
|
23
|
+
* as a hole.
|
|
24
|
+
*
|
|
25
|
+
* - The `additionalFields` when there is no form context to hand them: those
|
|
26
|
+
* entries are arbitrary components, not values, and one rendered against no
|
|
27
|
+
* context is nothing at all.
|
|
28
|
+
* - `headerKeys` — the properties {@link EntityDisplayHeader} has already
|
|
29
|
+
* rendered as the record's picture, subtitle, state and labels. Leaving one in
|
|
30
|
+
* prints its value twice on one screen.
|
|
31
|
+
*
|
|
32
|
+
* The record's **title property is not among them**, deliberately. It names the
|
|
33
|
+
* page in the identity bar, but a heading and a labelled field are different
|
|
34
|
+
* things: `Order #` is a column with a name and a description that someone opens
|
|
35
|
+
* the record to read, and dropping it because its text also appears in the
|
|
36
|
+
* breadcrumb removes a value from the record on the grounds that it is legible
|
|
37
|
+
* somewhere else. See {@link HEADER_DISPLAY_ROLES}.
|
|
38
|
+
*/
|
|
39
|
+
function readOnlyFieldKeys(collection, hasFormContext, headerKeys) {
|
|
40
|
+
const keys = getFormFieldKeys(collection);
|
|
41
|
+
const additional = hasFormContext ? void 0 : new Set((collection.additionalFields ?? []).map((field) => field.key));
|
|
42
|
+
return keys.filter((key) => !additional?.has(key) && !headerKeys?.has(key));
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* The read-only rendering of a record's values.
|
|
46
|
+
*
|
|
47
|
+
* This is the same layout as {@link EntityForm}: the sections, the grid spans,
|
|
48
|
+
* the labels and the rail all come from the one resolver, so the record does
|
|
49
|
+
* not rearrange itself when you press Edit. Only the controls differ — each
|
|
50
|
+
* field renders its {@link PropertyPreview} instead of an input.
|
|
51
|
+
*
|
|
52
|
+
* It used to be a flat two-column table of every value in the record: no
|
|
53
|
+
* grouping, no widths, a label column sized for short names and a value column
|
|
54
|
+
* that wrapped emails over two lines while the pane beside it stayed empty. A
|
|
55
|
+
* boolean and a markdown body were given the same room.
|
|
56
|
+
*
|
|
57
|
+
* The synthetic `Id` row it used to prepend is gone with the same reasoning the
|
|
58
|
+
* form applies: between that row, the collection's own id property and the
|
|
59
|
+
* `path/id` chip above them, one UUID appeared three times. The id is a
|
|
60
|
+
* copyable chip in the identity bar, and the rail's record block, once each.
|
|
61
|
+
*
|
|
62
|
+
* The labels are the form's labels, icon and all: a field is the same field
|
|
63
|
+
* whether or not you are editing it. What `mode: "read"` drops is the per-field
|
|
64
|
+
* *description*, which is input help rather than part of the label — and what it
|
|
65
|
+
* adds is room. A control is a bordered box that separates itself from the next
|
|
66
|
+
* one; a value is bare text, so the rows and sections are opened up rather than
|
|
67
|
+
* inheriting spacing sized for inputs.
|
|
68
|
+
*/
|
|
69
|
+
function EntityViewBinding({ entity, collection, className, asPage = false, openEntityMode = "full_screen", formContext }) {
|
|
70
|
+
const display = useEntityDisplayValues({
|
|
71
|
+
collection,
|
|
72
|
+
entity
|
|
73
|
+
});
|
|
74
|
+
const headerKeys = useMemo(() => {
|
|
75
|
+
const keys = /* @__PURE__ */ new Set();
|
|
76
|
+
for (const role of HEADER_DISPLAY_ROLES) {
|
|
77
|
+
const key = display[role].source?.key;
|
|
78
|
+
if (key) keys.add(key);
|
|
79
|
+
}
|
|
80
|
+
return keys;
|
|
81
|
+
}, [display]);
|
|
82
|
+
const hasFormContext = Boolean(formContext);
|
|
83
|
+
const fieldKeys = useMemo(() => readOnlyFieldKeys(collection, hasFormContext, headerKeys), [
|
|
84
|
+
collection,
|
|
85
|
+
hasFormContext,
|
|
86
|
+
headerKeys
|
|
87
|
+
]);
|
|
88
|
+
const layout = useMemo(() => resolveFormLayout({
|
|
89
|
+
collection,
|
|
90
|
+
fieldKeys,
|
|
91
|
+
status: "existing"
|
|
92
|
+
}), [collection, fieldKeys]);
|
|
93
|
+
const containerRef = useRef(null);
|
|
94
|
+
const railVisible = useRailVisible(containerRef);
|
|
95
|
+
const showRail = asPage && layout.hasRail && railVisible;
|
|
96
|
+
const [collapsedSections, setCollapsedSections] = useState(() => new Set(layout.sections.filter((section) => section.collapsed).map((section) => section.key)));
|
|
97
|
+
const toggleSection = useCallback((key) => {
|
|
98
|
+
setCollapsedSections((prev) => {
|
|
99
|
+
const next = new Set(prev);
|
|
100
|
+
if (next.has(key)) next.delete(key);
|
|
101
|
+
else next.add(key);
|
|
102
|
+
return next;
|
|
103
|
+
});
|
|
104
|
+
}, []);
|
|
105
|
+
const rebaseContext = useRebaseContext();
|
|
106
|
+
const renderField = useCallback((field) => {
|
|
107
|
+
if (field.additional) {
|
|
108
|
+
const additionalField = collection.additionalFields?.find((f) => f.key === field.key);
|
|
109
|
+
if (!additionalField || !formContext) return null;
|
|
110
|
+
const AdditionalFieldBuilder = additionalField.Builder;
|
|
111
|
+
const child = AdditionalFieldBuilder ? /* @__PURE__ */ jsx(AdditionalFieldBuilder, {
|
|
112
|
+
entity,
|
|
113
|
+
context: rebaseContext
|
|
114
|
+
}) : /* @__PURE__ */ jsx("div", {
|
|
115
|
+
className: "w-full",
|
|
116
|
+
children: /* @__PURE__ */ jsx(AdditionalFieldValue, {
|
|
117
|
+
field: additionalField,
|
|
118
|
+
entity,
|
|
119
|
+
context: rebaseContext
|
|
120
|
+
})
|
|
121
|
+
});
|
|
122
|
+
return /* @__PURE__ */ jsx("div", {
|
|
123
|
+
className: spanClass(field.span),
|
|
124
|
+
children: /* @__PURE__ */ jsx(FieldBlock, {
|
|
125
|
+
propertyKey: field.key,
|
|
126
|
+
showLabel: true,
|
|
127
|
+
mode: "read",
|
|
128
|
+
label: additionalField.name,
|
|
129
|
+
icon: /* @__PURE__ */ jsx(AlignLeftIcon, { size: 14 }),
|
|
130
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
131
|
+
className: cls(paperMixin, "w-full min-h-12 p-4 md:p-6 overflow-x-auto no-scrollbar"),
|
|
132
|
+
children: child
|
|
133
|
+
})
|
|
134
|
+
})
|
|
135
|
+
}, `additional_${field.key}`);
|
|
136
|
+
}
|
|
137
|
+
const property = collection.properties?.[field.key];
|
|
138
|
+
if (!property) return null;
|
|
139
|
+
return /* @__PURE__ */ jsx("div", {
|
|
140
|
+
className: spanClass(field.span),
|
|
141
|
+
children: /* @__PURE__ */ jsx(FieldBlock, {
|
|
142
|
+
propertyKey: field.key,
|
|
143
|
+
property,
|
|
144
|
+
showLabel: true,
|
|
145
|
+
mode: "read",
|
|
146
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
147
|
+
className: "min-h-8 flex flex-col justify-center min-w-0 text-sm text-text-primary dark:text-text-primary-dark",
|
|
148
|
+
children: /* @__PURE__ */ jsx(PropertyPreview, {
|
|
149
|
+
propertyKey: field.key,
|
|
150
|
+
value: getValueInPath(entity.values, field.key),
|
|
151
|
+
property,
|
|
152
|
+
hideLabel: true,
|
|
153
|
+
size: "medium"
|
|
154
|
+
})
|
|
155
|
+
})
|
|
156
|
+
})
|
|
157
|
+
}, `field_${field.key}`);
|
|
158
|
+
}, [
|
|
159
|
+
collection,
|
|
160
|
+
entity,
|
|
161
|
+
formContext,
|
|
162
|
+
rebaseContext
|
|
163
|
+
]);
|
|
164
|
+
/**
|
|
165
|
+
* One field of a `readVariant: "summary"` section: a label/value row rather
|
|
166
|
+
* than a grid cell, with the last one emphasised.
|
|
167
|
+
*
|
|
168
|
+
* The last row is the one a summary exists for — a run of figures is read to
|
|
169
|
+
* arrive at its final line — so it is separated by a rule and set at the
|
|
170
|
+
* weight the grid gave every cell equally.
|
|
171
|
+
*/
|
|
172
|
+
const renderSummaryField = useCallback((field, index, total) => {
|
|
173
|
+
const property = collection.properties?.[field.key];
|
|
174
|
+
if (!property) return null;
|
|
175
|
+
const last = index === total - 1;
|
|
176
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
177
|
+
className: cls("flex items-baseline justify-between gap-4 min-w-0 py-2", last && total > 1 && cls("mt-1.5 pt-3 border-t", defaultBorderMixin)),
|
|
178
|
+
children: [/* @__PURE__ */ jsx("span", {
|
|
179
|
+
className: cls("min-w-0 truncate", last ? "text-sm font-semibold text-text-primary dark:text-text-primary-dark" : "text-sm text-text-secondary dark:text-text-secondary-dark"),
|
|
180
|
+
children: property.name ?? field.key
|
|
181
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
182
|
+
className: cls("shrink-0 text-right text-text-primary dark:text-text-primary-dark", last ? "text-base font-semibold" : "text-sm"),
|
|
183
|
+
children: /* @__PURE__ */ jsx(PropertyPreview, {
|
|
184
|
+
propertyKey: field.key,
|
|
185
|
+
value: getValueInPath(entity.values, field.key),
|
|
186
|
+
property,
|
|
187
|
+
hideLabel: true,
|
|
188
|
+
size: "medium"
|
|
189
|
+
})
|
|
190
|
+
})]
|
|
191
|
+
}, `summary_${field.key}`);
|
|
192
|
+
}, [collection, entity]);
|
|
193
|
+
const sections = showRail || !layout.sidebar.length ? layout.sections : [...layout.sections, {
|
|
194
|
+
key: "__rail",
|
|
195
|
+
title: "Settings",
|
|
196
|
+
collapsible: false,
|
|
197
|
+
collapsed: false,
|
|
198
|
+
fields: layout.sidebar
|
|
199
|
+
}];
|
|
200
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
201
|
+
/* @__PURE__ */ jsx(EntityDisplayHeader, {
|
|
202
|
+
entity,
|
|
203
|
+
collection,
|
|
204
|
+
showTitle: !asPage,
|
|
205
|
+
className: "mb-10"
|
|
206
|
+
}),
|
|
207
|
+
/* @__PURE__ */ jsx(FormSections, {
|
|
208
|
+
sections,
|
|
209
|
+
collapsed: collapsedSections,
|
|
210
|
+
onToggle: toggleSection,
|
|
211
|
+
errorKeys: NO_ERRORS,
|
|
212
|
+
renderField,
|
|
213
|
+
renderSummaryField,
|
|
214
|
+
mode: "read"
|
|
215
|
+
}),
|
|
216
|
+
!showRail && layout.showRecordMeta && /* @__PURE__ */ jsx("div", {
|
|
217
|
+
className: cls("mt-10 pt-6 border-t max-w-sm", defaultBorderMixin),
|
|
218
|
+
children: /* @__PURE__ */ jsx(RecordMeta, { entity })
|
|
219
|
+
})
|
|
220
|
+
] });
|
|
221
|
+
if (!asPage) return /* @__PURE__ */ jsx("div", {
|
|
222
|
+
ref: containerRef,
|
|
223
|
+
className: cls("@container/col w-full min-w-0", className),
|
|
224
|
+
children: content
|
|
225
|
+
});
|
|
226
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
227
|
+
ref: containerRef,
|
|
228
|
+
className: cls("@container/form flex-1 flex flex-row w-full min-h-0", className),
|
|
229
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
230
|
+
className: "flex-1 min-w-0 overflow-y-auto flex justify-center items-start",
|
|
231
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
232
|
+
className: cls("@container/col w-full max-w-3xl @7xl/form:max-w-4xl 2xl:max-w-4xl flex flex-col", openEntityMode === "dialog" ? "pt-5 pb-8 px-6 sm:px-8" : "pt-6 pb-12 px-5 sm:px-8"),
|
|
233
|
+
children: content
|
|
234
|
+
})
|
|
235
|
+
}), showRail && /* @__PURE__ */ jsx(FormRail, {
|
|
236
|
+
fields: layout.sidebar,
|
|
237
|
+
showRecordMeta: layout.showRecordMeta,
|
|
238
|
+
entity,
|
|
239
|
+
renderField
|
|
240
|
+
})]
|
|
241
|
+
});
|
|
242
|
+
}
|
|
243
|
+
//#endregion
|
|
244
|
+
export { EntityViewBinding, readOnlyFieldKeys };
|
|
245
|
+
|
|
246
|
+
//# sourceMappingURL=EntityViewBinding.js.map
|