@rebasepro/cms 0.24.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/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.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 +4 -1
- package/dist/collection_editor/serializable_utils.js +504 -0
- package/dist/collection_editor/serializable_utils.js.map +1 -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-CcFSXvkK.js → collection_editor/ui/collection_editor/SchemaChangeDialog.js} +42 -59
- 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.js +214 -0
- package/dist/collection_editor/useLiveSchemaEditing.js.map +1 -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.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.js +146 -0
- package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -0
- 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.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.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.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.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.js +30 -0
- package/dist/components/common/ActionMenuLabel.js.map +1 -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.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/hooks/useImportConfig.js +34 -0
- package/dist/data_import/hooks/useImportConfig.js.map +1 -0
- package/dist/{import-DjQoRrIU.js → data_import/import/ImportCollectionAction.js} +53 -43
- 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.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.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.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 +7 -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.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 -3147
- 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 +24 -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 +2 -1
- 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.js +108 -0
- package/dist/hooks/useRecordActions.js.map +1 -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 +4 -2
- 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 -3867
- 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 +2 -1
- 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 +4 -3
- package/dist/{util-D7ebttKT.js → preview/util.js} +8 -5
- 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.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 +5 -0
- 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.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-p5-I-Apu.js +0 -3669
- package/dist/CollectionEditorDialog-p5-I-Apu.js.map +0 -1
- package/dist/JsonPreviewBinding-v0w3H0fp.js.map +0 -1
- package/dist/PropertyEditView-DDB_X-00.js +0 -3837
- package/dist/PropertyEditView-DDB_X-00.js.map +0 -1
- package/dist/RouterCollectionsStudioView-SGBV4CMg.js +0 -212
- package/dist/RouterCollectionsStudioView-SGBV4CMg.js.map +0 -1
- package/dist/SchemaChangeDialog-CcFSXvkK.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-DCHuPD1a.js +0 -520
- package/dist/export-DCHuPD1a.js.map +0 -1
- package/dist/history-CBd6SBRs.js +0 -314
- package/dist/history-CBd6SBRs.js.map +0 -1
- package/dist/import-DjQoRrIU.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-BRvKFMLa.js +0 -27773
- package/dist/util-BRvKFMLa.js.map +0 -1
- package/dist/util-D7ebttKT.js.map +0 -1
|
@@ -1,3837 +0,0 @@
|
|
|
1
|
-
import { t as __exportAll } from "./rolldown-runtime-D7D4PA-g.js";
|
|
2
|
-
import { A as getFieldId, E as DEFAULT_FIELD_CONFIGS, a as namespaceToPropertiesPath, ct as useSafeSnackbarController, g as toSerializableProperty, i as namespaceToPropertiesOrderPath, k as getFieldConfig, ln as FieldCaption, m as toSerializableCollectionConfig, n as getFullIdPath, on as ArrayContainer, r as idToPropertiesPath, sn as PropertyConfigBadge, t as getFullId, yr as useCollectionRegistryController } from "./util-BRvKFMLa.js";
|
|
3
|
-
import React, { createContext, useCallback, useContext, useDeferredValue, useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
-
import { deepEqual } from "fast-equals";
|
|
5
|
-
import { AlertTriangleIcon, ArrowDownToLineIcon, ArrowUpToLineIcon, Badge, BooleanSwitchWithLabel, Button, Card, CheckSquareIcon, CircularProgress, DebouncedTextField, Dialog, DialogActions, DialogContent, DialogTitle, ErrorBoundary, ExpandablePanel, FileSearchIcon, FunctionSquareIcon, IconButton, InfoLabel, ListIcon, Menu, MenuItem, MinusCircleIcon, MoreVerticalIcon, MultiSelect, MultiSelectItem, Paper, PlusIcon, RefreshCcwIcon, Select, SelectItem, SettingsIcon, TextField, Tooltip, Trash2Icon, Typography, UploadCloudIcon, cls, defaultBorderMixin, iconSize } from "@rebasepro/ui";
|
|
6
|
-
import { isPropertyBuilder, resolveEnumValues } from "@rebasepro/common";
|
|
7
|
-
import { AIModifiedIndicator, ConfirmationDialog, IconForView, useCustomizationController, useStorageSources, useTranslation } from "@rebasepro/app";
|
|
8
|
-
import { Field, Formex, getIn, useCreateFormex, useFormex } from "@rebasepro/forms";
|
|
9
|
-
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
-
import { DEFAULT_STORAGE_SOURCE_KEY } from "@rebasepro/types";
|
|
11
|
-
import { isValidRegExp, mergeDeep, prettifyIdentifier, serializeRegExp, toSnakeCase } from "@rebasepro/utils";
|
|
12
|
-
import { DndContext, KeyboardSensor, PointerSensor, closestCenter, useSensor, useSensors } from "@dnd-kit/core";
|
|
13
|
-
import { restrictToVerticalAxis } from "@dnd-kit/modifiers";
|
|
14
|
-
import { SortableContext, sortableKeyboardCoordinates, useSortable, verticalListSortingStrategy } from "@dnd-kit/sortable";
|
|
15
|
-
import { CSS } from "@dnd-kit/utilities";
|
|
16
|
-
import { extractEnumFromValues } from "@rebasepro/inference";
|
|
17
|
-
//#region src/collection_editor/ui/collection_editor/EnumForm.tsx
|
|
18
|
-
function EnumForm({ enumValues, onValuesChanged, onError, updateIds, disabled, allowDataInference, getData }) {
|
|
19
|
-
const formex = useCreateFormex({
|
|
20
|
-
initialValues: { enum: enumValues },
|
|
21
|
-
validateOnChange: true,
|
|
22
|
-
validation: (values) => {
|
|
23
|
-
const enumErrors = [];
|
|
24
|
-
let hasAnyError = false;
|
|
25
|
-
if (values.enum) values.enum.forEach((enumValue, index) => {
|
|
26
|
-
const fieldError = {};
|
|
27
|
-
if (!enumValue?.label) {
|
|
28
|
-
fieldError.label = "You must specify a label for this enum value entry";
|
|
29
|
-
hasAnyError = true;
|
|
30
|
-
}
|
|
31
|
-
if (!enumValue?.id) {
|
|
32
|
-
fieldError.id = "You must specify an ID for this enum value entry";
|
|
33
|
-
hasAnyError = true;
|
|
34
|
-
}
|
|
35
|
-
enumErrors[index] = fieldError;
|
|
36
|
-
});
|
|
37
|
-
const errors = hasAnyError ? { enum: enumErrors } : {};
|
|
38
|
-
onError?.(hasAnyError);
|
|
39
|
-
return errors;
|
|
40
|
-
}
|
|
41
|
-
});
|
|
42
|
-
const { values, errors } = formex;
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
if (onValuesChanged) onValuesChanged(values.enum);
|
|
45
|
-
}, [values.enum]);
|
|
46
|
-
return /* @__PURE__ */ jsx(Formex, {
|
|
47
|
-
value: formex,
|
|
48
|
-
children: /* @__PURE__ */ jsx(EnumFormFields, {
|
|
49
|
-
enumValuesPath: "enum",
|
|
50
|
-
values,
|
|
51
|
-
errors,
|
|
52
|
-
shouldUpdateId: updateIds,
|
|
53
|
-
disabled,
|
|
54
|
-
allowDataInference,
|
|
55
|
-
getData
|
|
56
|
-
})
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
function EnumFormFields({ values, errors, disabled, enumValuesPath, shouldUpdateId, allowDataInference, getData }) {
|
|
60
|
-
const { setFieldValue } = useFormex();
|
|
61
|
-
const [lastInternalIdAdded, setLastInternalIdAdded] = React.useState();
|
|
62
|
-
const [editDialogIndex, setEditDialogIndex] = React.useState();
|
|
63
|
-
const [inferring, setInferring] = React.useState(false);
|
|
64
|
-
const inferredValues = React.useRef(/* @__PURE__ */ new Set()).current;
|
|
65
|
-
const buildEntry = ({ index, internalId }) => {
|
|
66
|
-
const justAdded = lastInternalIdAdded === internalId;
|
|
67
|
-
const entryError = errors?.enum?.[index];
|
|
68
|
-
return /* @__PURE__ */ jsx(EnumEntry, {
|
|
69
|
-
index,
|
|
70
|
-
disabled,
|
|
71
|
-
enumValuesPath,
|
|
72
|
-
autoFocus: justAdded,
|
|
73
|
-
entryError,
|
|
74
|
-
shouldUpdateId: shouldUpdateId || justAdded,
|
|
75
|
-
onDialogOpen: () => setEditDialogIndex(index),
|
|
76
|
-
inferredEntry: inferredValues.has(values.enum[index]?.id)
|
|
77
|
-
}, `${internalId}`);
|
|
78
|
-
};
|
|
79
|
-
const inferValues = async () => {
|
|
80
|
-
if (!getData) return;
|
|
81
|
-
setInferring(true);
|
|
82
|
-
getData?.().then((data) => {
|
|
83
|
-
if (!data) return;
|
|
84
|
-
const flatData = data.flat();
|
|
85
|
-
const fieldData = Array.from(new Set(flatData));
|
|
86
|
-
const currentEnumValues = values.enum;
|
|
87
|
-
const newEnumValues = extractEnumFromValues(fieldData).filter((enumValue) => {
|
|
88
|
-
if (!enumValue) return false;
|
|
89
|
-
return !currentEnumValues?.some((v) => v.id === enumValue.id);
|
|
90
|
-
});
|
|
91
|
-
newEnumValues.forEach((enumValue) => {
|
|
92
|
-
if (enumValue) inferredValues.add(enumValue.id);
|
|
93
|
-
});
|
|
94
|
-
setFieldValue(enumValuesPath, [...newEnumValues, ...currentEnumValues], true);
|
|
95
|
-
}).catch((e) => {
|
|
96
|
-
console.error(e);
|
|
97
|
-
}).finally(() => setInferring(false));
|
|
98
|
-
};
|
|
99
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
100
|
-
className: "col-span-12",
|
|
101
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
102
|
-
className: "ml-3.5 flex flex-row items-center",
|
|
103
|
-
children: [
|
|
104
|
-
/* @__PURE__ */ jsx(ListIcon, {}),
|
|
105
|
-
/* @__PURE__ */ jsx(Typography, {
|
|
106
|
-
variant: "subtitle2",
|
|
107
|
-
className: "ml-2 grow",
|
|
108
|
-
children: "Values"
|
|
109
|
-
}),
|
|
110
|
-
allowDataInference && /* @__PURE__ */ jsxs(Button, {
|
|
111
|
-
disabled: disabled || inferring,
|
|
112
|
-
variant: "text",
|
|
113
|
-
size: "small",
|
|
114
|
-
onClick: inferValues,
|
|
115
|
-
children: [inferring ? /* @__PURE__ */ jsx(CircularProgress, { size: "smallest" }) : /* @__PURE__ */ jsx(RefreshCcwIcon, {}), "Infer values from data"]
|
|
116
|
-
})
|
|
117
|
-
]
|
|
118
|
-
}), /* @__PURE__ */ jsxs(Paper, {
|
|
119
|
-
className: "p-4 m-1",
|
|
120
|
-
children: [/* @__PURE__ */ jsx(ArrayContainer, {
|
|
121
|
-
droppableId: enumValuesPath,
|
|
122
|
-
addLabel: "Add enum value",
|
|
123
|
-
value: values.enum,
|
|
124
|
-
disabled,
|
|
125
|
-
size: "small",
|
|
126
|
-
buildEntry,
|
|
127
|
-
onInternalIdAdded: setLastInternalIdAdded,
|
|
128
|
-
canAddElements: true,
|
|
129
|
-
onValueChange: (value) => setFieldValue(enumValuesPath, value),
|
|
130
|
-
newDefaultEntry: {
|
|
131
|
-
id: "",
|
|
132
|
-
label: ""
|
|
133
|
-
}
|
|
134
|
-
}), /* @__PURE__ */ jsx(EnumEntryDialog, {
|
|
135
|
-
index: editDialogIndex,
|
|
136
|
-
open: editDialogIndex !== void 0,
|
|
137
|
-
enumValuesPath,
|
|
138
|
-
onClose: () => setEditDialogIndex(void 0)
|
|
139
|
-
})]
|
|
140
|
-
})]
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
var EnumEntry = React.memo(function EnumEntryInternal({ index, shouldUpdateId: updateId, enumValuesPath, autoFocus, onDialogOpen, disabled, inferredEntry, entryError }) {
|
|
144
|
-
const { values, handleChange, errors, setFieldValue, touched } = useFormex();
|
|
145
|
-
const shouldUpdateIdRef = React.useRef(!getIn(values, `${enumValuesPath}[${index}].id`));
|
|
146
|
-
const shouldUpdateId = updateId || shouldUpdateIdRef.current;
|
|
147
|
-
const idValue = getIn(values, `${enumValuesPath}[${index}].id`);
|
|
148
|
-
const labelValue = getIn(values, `${enumValuesPath}[${index}].label`);
|
|
149
|
-
const currentLabelRef = React.useRef(labelValue);
|
|
150
|
-
React.useEffect(() => {
|
|
151
|
-
if ((currentLabelRef.current === idValue || !idValue) && shouldUpdateId) setFieldValue(`${enumValuesPath}[${index}].id`, labelValue);
|
|
152
|
-
currentLabelRef.current = labelValue;
|
|
153
|
-
}, [labelValue]);
|
|
154
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
155
|
-
/* @__PURE__ */ jsxs("div", {
|
|
156
|
-
className: "flex w-full align-center justify-center",
|
|
157
|
-
children: [/* @__PURE__ */ jsx(Field, {
|
|
158
|
-
name: `${enumValuesPath}[${index}].label`,
|
|
159
|
-
as: DebouncedTextField,
|
|
160
|
-
className: "grow",
|
|
161
|
-
required: true,
|
|
162
|
-
disabled,
|
|
163
|
-
size: "small",
|
|
164
|
-
autoFocus,
|
|
165
|
-
autoComplete: "off",
|
|
166
|
-
endAdornment: inferredEntry && /* @__PURE__ */ jsx(RefreshCcwIcon, { size: iconSize.small }),
|
|
167
|
-
error: Boolean(entryError?.label)
|
|
168
|
-
}), !disabled && /* @__PURE__ */ jsx(Badge, {
|
|
169
|
-
color: "error",
|
|
170
|
-
invisible: !entryError?.id,
|
|
171
|
-
children: /* @__PURE__ */ jsx(IconButton, {
|
|
172
|
-
size: "small",
|
|
173
|
-
"aria-label": "edit",
|
|
174
|
-
className: "m-1",
|
|
175
|
-
onClick: () => onDialogOpen(),
|
|
176
|
-
children: /* @__PURE__ */ jsx(SettingsIcon, { size: iconSize.small })
|
|
177
|
-
})
|
|
178
|
-
})]
|
|
179
|
-
}),
|
|
180
|
-
entryError?.label && /* @__PURE__ */ jsx(Typography, {
|
|
181
|
-
variant: "caption",
|
|
182
|
-
className: "ml-3.5 text-red-500 dark:text-red-500",
|
|
183
|
-
children: entryError?.label
|
|
184
|
-
}),
|
|
185
|
-
entryError?.id && /* @__PURE__ */ jsx(Typography, {
|
|
186
|
-
variant: "caption",
|
|
187
|
-
className: "ml-3.5 text-red-500 dark:text-red-500",
|
|
188
|
-
children: entryError?.id
|
|
189
|
-
})
|
|
190
|
-
] });
|
|
191
|
-
}, function areEqual(prevProps, nextProps) {
|
|
192
|
-
return prevProps.index === nextProps.index && prevProps.enumValuesPath === nextProps.enumValuesPath && prevProps.shouldUpdateId === nextProps.shouldUpdateId && prevProps.inferredEntry === nextProps.inferredEntry && deepEqual(prevProps.entryError, nextProps.entryError) && prevProps.autoFocus === nextProps.autoFocus;
|
|
193
|
-
});
|
|
194
|
-
function EnumEntryDialog({ index, open, onClose, enumValuesPath }) {
|
|
195
|
-
const { errors } = useFormex();
|
|
196
|
-
const idError = index !== void 0 ? getIn(errors, `${enumValuesPath}[${index}].id`) : void 0;
|
|
197
|
-
return /* @__PURE__ */ jsxs(Dialog, {
|
|
198
|
-
maxWidth: "md",
|
|
199
|
-
"aria-labelledby": "enum-edit-dialog",
|
|
200
|
-
open,
|
|
201
|
-
onOpenChange: (open) => !open ? onClose() : void 0,
|
|
202
|
-
children: [
|
|
203
|
-
/* @__PURE__ */ jsx(DialogTitle, {
|
|
204
|
-
hidden: true,
|
|
205
|
-
children: "Enum form dialog"
|
|
206
|
-
}),
|
|
207
|
-
/* @__PURE__ */ jsx(DialogContent, { children: index !== void 0 && /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Field, {
|
|
208
|
-
name: `${enumValuesPath}[${index}].id`,
|
|
209
|
-
as: DebouncedTextField,
|
|
210
|
-
required: true,
|
|
211
|
-
label: "ID",
|
|
212
|
-
size: "small",
|
|
213
|
-
autoComplete: "off",
|
|
214
|
-
error: Boolean(idError)
|
|
215
|
-
}), /* @__PURE__ */ jsx(FieldCaption, {
|
|
216
|
-
error: Boolean(idError),
|
|
217
|
-
children: idError ?? "Value saved in the data source"
|
|
218
|
-
})] }) }),
|
|
219
|
-
/* @__PURE__ */ jsx(DialogActions, { children: /* @__PURE__ */ jsx(Button, {
|
|
220
|
-
autoFocus: true,
|
|
221
|
-
onClick: onClose,
|
|
222
|
-
children: "Ok"
|
|
223
|
-
}) })
|
|
224
|
-
]
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
//#endregion
|
|
228
|
-
//#region src/collection_editor/ui/collection_editor/SwitchControl.tsx
|
|
229
|
-
function SwitchControl({ field, form, label, tooltip, disabled, size = "small", allowIndeterminate }) {
|
|
230
|
-
const formControlLabel = /* @__PURE__ */ jsx(BooleanSwitchWithLabel, {
|
|
231
|
-
label,
|
|
232
|
-
size,
|
|
233
|
-
position: "start",
|
|
234
|
-
value: field.value,
|
|
235
|
-
disabled,
|
|
236
|
-
allowIndeterminate,
|
|
237
|
-
onValueChange: (checked) => form.setFieldValue(field.name, checked)
|
|
238
|
-
});
|
|
239
|
-
if (tooltip) return /* @__PURE__ */ jsx(Tooltip, {
|
|
240
|
-
title: tooltip,
|
|
241
|
-
children: formControlLabel
|
|
242
|
-
});
|
|
243
|
-
return formControlLabel;
|
|
244
|
-
}
|
|
245
|
-
//#endregion
|
|
246
|
-
//#region src/collection_editor/ui/collection_editor/properties/validation/GeneralPropertyValidation.tsx
|
|
247
|
-
function GeneralPropertyValidation({ disabled }) {
|
|
248
|
-
const { values, handleChange } = useFormex();
|
|
249
|
-
const { t } = useTranslation();
|
|
250
|
-
const validationRequired = "validation.required";
|
|
251
|
-
const validationRequiredMessage = "validation.requiredMessage";
|
|
252
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
253
|
-
/* @__PURE__ */ jsx("div", {
|
|
254
|
-
className: "col-span-6",
|
|
255
|
-
children: /* @__PURE__ */ jsx(Field, {
|
|
256
|
-
name: validationRequired,
|
|
257
|
-
type: "checkbox",
|
|
258
|
-
children: ({ field, form }) => {
|
|
259
|
-
return /* @__PURE__ */ jsx(SwitchControl, {
|
|
260
|
-
disabled,
|
|
261
|
-
label: t("required"),
|
|
262
|
-
tooltip: t("required_tooltip"),
|
|
263
|
-
form,
|
|
264
|
-
field
|
|
265
|
-
});
|
|
266
|
-
}
|
|
267
|
-
})
|
|
268
|
-
}),
|
|
269
|
-
/* @__PURE__ */ jsx("div", {
|
|
270
|
-
className: "col-span-6",
|
|
271
|
-
children: /* @__PURE__ */ jsx(Field, {
|
|
272
|
-
name: "validation.unique",
|
|
273
|
-
type: "checkbox",
|
|
274
|
-
children: ({ field, form }) => {
|
|
275
|
-
return /* @__PURE__ */ jsx(SwitchControl, {
|
|
276
|
-
disabled,
|
|
277
|
-
label: t("unique"),
|
|
278
|
-
tooltip: t("unique_tooltip"),
|
|
279
|
-
form,
|
|
280
|
-
field
|
|
281
|
-
});
|
|
282
|
-
}
|
|
283
|
-
})
|
|
284
|
-
}),
|
|
285
|
-
getIn(values, validationRequired) && /* @__PURE__ */ jsx("div", {
|
|
286
|
-
className: "col-span-12",
|
|
287
|
-
children: /* @__PURE__ */ jsx(DebouncedTextField, {
|
|
288
|
-
disabled,
|
|
289
|
-
value: getIn(values, validationRequiredMessage),
|
|
290
|
-
label: t("required_message"),
|
|
291
|
-
name: validationRequiredMessage,
|
|
292
|
-
size: "small",
|
|
293
|
-
onChange: handleChange
|
|
294
|
-
})
|
|
295
|
-
})
|
|
296
|
-
] });
|
|
297
|
-
}
|
|
298
|
-
//#endregion
|
|
299
|
-
//#region src/collection_editor/ui/collection_editor/properties/validation/StringPropertyValidation.tsx
|
|
300
|
-
function StringPropertyValidation({ length, lowercase, matches, max, min, trim, uppercase, disabled, showErrors }) {
|
|
301
|
-
const { values, handleChange, errors } = useFormex();
|
|
302
|
-
const { t } = useTranslation();
|
|
303
|
-
const validationLength = "validation.length";
|
|
304
|
-
const validationMin = "validation.min";
|
|
305
|
-
const validationMax = "validation.max";
|
|
306
|
-
const validationTrim = "validation.trim";
|
|
307
|
-
const validationMatches = "validation.matches";
|
|
308
|
-
const validationLowercase = "validation.lowercase";
|
|
309
|
-
const validationUppercase = "validation.uppercase";
|
|
310
|
-
const matchesError = getIn(errors, validationMatches);
|
|
311
|
-
const matchesValue = getIn(values, validationMatches);
|
|
312
|
-
const matchesStringValue = typeof matchesValue === "string" ? matchesValue : serializeRegExp(matchesValue);
|
|
313
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
314
|
-
className: "grid grid-cols-12 gap-2",
|
|
315
|
-
children: [
|
|
316
|
-
/* @__PURE__ */ jsx(GeneralPropertyValidation, { disabled }),
|
|
317
|
-
/* @__PURE__ */ jsxs("div", {
|
|
318
|
-
className: "grid grid-cols-12 gap-2 col-span-12",
|
|
319
|
-
children: [
|
|
320
|
-
lowercase && /* @__PURE__ */ jsx("div", {
|
|
321
|
-
className: "col-span-4",
|
|
322
|
-
children: /* @__PURE__ */ jsx(Field, {
|
|
323
|
-
name: validationLowercase,
|
|
324
|
-
type: "checkbox",
|
|
325
|
-
children: ({ field, form }) => {
|
|
326
|
-
return /* @__PURE__ */ jsx(SwitchControl, {
|
|
327
|
-
label: t("lowercase"),
|
|
328
|
-
disabled,
|
|
329
|
-
form,
|
|
330
|
-
field
|
|
331
|
-
});
|
|
332
|
-
}
|
|
333
|
-
})
|
|
334
|
-
}),
|
|
335
|
-
uppercase && /* @__PURE__ */ jsx("div", {
|
|
336
|
-
className: "col-span-4",
|
|
337
|
-
children: /* @__PURE__ */ jsx(Field, {
|
|
338
|
-
name: validationUppercase,
|
|
339
|
-
type: "checkbox",
|
|
340
|
-
children: ({ field, form }) => {
|
|
341
|
-
return /* @__PURE__ */ jsx(SwitchControl, {
|
|
342
|
-
label: t("uppercase"),
|
|
343
|
-
disabled,
|
|
344
|
-
form,
|
|
345
|
-
field
|
|
346
|
-
});
|
|
347
|
-
}
|
|
348
|
-
})
|
|
349
|
-
}),
|
|
350
|
-
trim && /* @__PURE__ */ jsx("div", {
|
|
351
|
-
className: "col-span-4",
|
|
352
|
-
children: /* @__PURE__ */ jsx(Field, {
|
|
353
|
-
name: validationTrim,
|
|
354
|
-
type: "checkbox",
|
|
355
|
-
children: ({ field, form }) => {
|
|
356
|
-
return /* @__PURE__ */ jsx(SwitchControl, {
|
|
357
|
-
label: t("trim"),
|
|
358
|
-
disabled,
|
|
359
|
-
form,
|
|
360
|
-
field
|
|
361
|
-
});
|
|
362
|
-
}
|
|
363
|
-
})
|
|
364
|
-
})
|
|
365
|
-
]
|
|
366
|
-
}),
|
|
367
|
-
/* @__PURE__ */ jsxs("div", {
|
|
368
|
-
className: "grid grid-cols-12 gap-2 col-span-12",
|
|
369
|
-
children: [
|
|
370
|
-
length && /* @__PURE__ */ jsx("div", {
|
|
371
|
-
className: "col-span-4",
|
|
372
|
-
children: /* @__PURE__ */ jsx(DebouncedTextField, {
|
|
373
|
-
value: getIn(values, validationLength),
|
|
374
|
-
label: t("exact_length"),
|
|
375
|
-
name: validationLength,
|
|
376
|
-
type: "number",
|
|
377
|
-
size: "small",
|
|
378
|
-
disabled,
|
|
379
|
-
onChange: handleChange
|
|
380
|
-
})
|
|
381
|
-
}),
|
|
382
|
-
min && /* @__PURE__ */ jsx("div", {
|
|
383
|
-
className: "col-span-4",
|
|
384
|
-
children: /* @__PURE__ */ jsx(DebouncedTextField, {
|
|
385
|
-
value: getIn(values, validationMin),
|
|
386
|
-
label: t("min_length"),
|
|
387
|
-
name: validationMin,
|
|
388
|
-
type: "number",
|
|
389
|
-
size: "small",
|
|
390
|
-
disabled,
|
|
391
|
-
onChange: handleChange
|
|
392
|
-
})
|
|
393
|
-
}),
|
|
394
|
-
max && /* @__PURE__ */ jsx("div", {
|
|
395
|
-
className: "col-span-4",
|
|
396
|
-
children: /* @__PURE__ */ jsx(DebouncedTextField, {
|
|
397
|
-
value: getIn(values, validationMax),
|
|
398
|
-
label: t("max_length"),
|
|
399
|
-
name: validationMax,
|
|
400
|
-
type: "number",
|
|
401
|
-
size: "small",
|
|
402
|
-
disabled,
|
|
403
|
-
onChange: handleChange
|
|
404
|
-
})
|
|
405
|
-
})
|
|
406
|
-
]
|
|
407
|
-
}),
|
|
408
|
-
matches && /* @__PURE__ */ jsxs("div", {
|
|
409
|
-
className: "col-span-12",
|
|
410
|
-
children: [/* @__PURE__ */ jsx(Field, {
|
|
411
|
-
name: validationMatches,
|
|
412
|
-
as: DebouncedTextField,
|
|
413
|
-
label: t("matches_regex"),
|
|
414
|
-
size: "small",
|
|
415
|
-
disabled,
|
|
416
|
-
value: matchesStringValue,
|
|
417
|
-
error: Boolean(matchesError)
|
|
418
|
-
}), /* @__PURE__ */ jsx(FieldCaption, {
|
|
419
|
-
error: Boolean(matchesError),
|
|
420
|
-
children: matchesError ? t("not_valid_regexp") : t("regex_helper")
|
|
421
|
-
})]
|
|
422
|
-
})
|
|
423
|
-
]
|
|
424
|
-
});
|
|
425
|
-
}
|
|
426
|
-
//#endregion
|
|
427
|
-
//#region src/collection_editor/ui/collection_editor/properties/validation/ArrayPropertyValidation.tsx
|
|
428
|
-
function ArrayPropertyValidation({ max = true, min = true, disabled }) {
|
|
429
|
-
const { values, handleChange } = useFormex();
|
|
430
|
-
const { t } = useTranslation();
|
|
431
|
-
const validationMin = "validation.min";
|
|
432
|
-
const validationMax = "validation.max";
|
|
433
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
434
|
-
className: "grid grid-cols-12 gap-2",
|
|
435
|
-
children: [
|
|
436
|
-
/* @__PURE__ */ jsx(GeneralPropertyValidation, { disabled }),
|
|
437
|
-
min && /* @__PURE__ */ jsx("div", {
|
|
438
|
-
className: "col-span-6",
|
|
439
|
-
children: /* @__PURE__ */ jsx(DebouncedTextField, {
|
|
440
|
-
value: getIn(values, validationMin),
|
|
441
|
-
disabled,
|
|
442
|
-
label: t("min_length"),
|
|
443
|
-
name: validationMin,
|
|
444
|
-
type: "number",
|
|
445
|
-
size: "small",
|
|
446
|
-
onChange: handleChange
|
|
447
|
-
})
|
|
448
|
-
}),
|
|
449
|
-
max && /* @__PURE__ */ jsx("div", {
|
|
450
|
-
className: "col-span-6",
|
|
451
|
-
children: /* @__PURE__ */ jsx(DebouncedTextField, {
|
|
452
|
-
value: getIn(values, validationMax),
|
|
453
|
-
disabled,
|
|
454
|
-
label: t("max_length"),
|
|
455
|
-
name: validationMax,
|
|
456
|
-
type: "number",
|
|
457
|
-
size: "small",
|
|
458
|
-
onChange: handleChange
|
|
459
|
-
})
|
|
460
|
-
})
|
|
461
|
-
]
|
|
462
|
-
});
|
|
463
|
-
}
|
|
464
|
-
//#endregion
|
|
465
|
-
//#region src/collection_editor/ui/collection_editor/properties/validation/ValidationPanel.tsx
|
|
466
|
-
function ValidationPanel({ children }) {
|
|
467
|
-
return /* @__PURE__ */ jsx(ExpandablePanel, {
|
|
468
|
-
initiallyExpanded: false,
|
|
469
|
-
asField: true,
|
|
470
|
-
innerClassName: "p-4",
|
|
471
|
-
title: /* @__PURE__ */ jsxs("div", {
|
|
472
|
-
className: "flex flex-row text-surface-500 text-text-secondary dark:text-text-secondary-dark",
|
|
473
|
-
children: [/* @__PURE__ */ jsx(CheckSquareIcon, {}), /* @__PURE__ */ jsx(Typography, {
|
|
474
|
-
variant: "subtitle2",
|
|
475
|
-
className: "ml-4",
|
|
476
|
-
children: "Validation"
|
|
477
|
-
})]
|
|
478
|
-
}),
|
|
479
|
-
children
|
|
480
|
-
});
|
|
481
|
-
}
|
|
482
|
-
//#endregion
|
|
483
|
-
//#region src/collection_editor/ui/collection_editor/properties/EnumPropertyField.tsx
|
|
484
|
-
function EnumPropertyField({ multiselect, updateIds, disabled, showErrors, allowDataInference, getData, propertyNamespace }) {
|
|
485
|
-
const { values, setFieldError, setFieldValue } = useFormex();
|
|
486
|
-
const snackbarContext = useSafeSnackbarController();
|
|
487
|
-
const { t } = useTranslation();
|
|
488
|
-
const enumValuesPath = multiselect ? "of.enum" : "enum";
|
|
489
|
-
const defaultValue = getIn(values, "defaultValue");
|
|
490
|
-
const valuesEnumValues = getIn(values, enumValuesPath);
|
|
491
|
-
const enumValues = useMemo(() => {
|
|
492
|
-
if (!valuesEnumValues || typeof valuesEnumValues === "boolean") return [];
|
|
493
|
-
return resolveEnumValues(valuesEnumValues) ?? [];
|
|
494
|
-
}, [valuesEnumValues]);
|
|
495
|
-
const onValuesChanged = (value) => {
|
|
496
|
-
if (!values) return;
|
|
497
|
-
setFieldValue(enumValuesPath, value);
|
|
498
|
-
if (!multiselect) {
|
|
499
|
-
const enumIds = value.filter((v) => Boolean(v?.id)).map((v) => v.id);
|
|
500
|
-
if (defaultValue && !enumIds.includes(defaultValue)) {
|
|
501
|
-
setFieldValue("defaultValue", void 0);
|
|
502
|
-
snackbarContext?.open({
|
|
503
|
-
type: "warning",
|
|
504
|
-
message: "Default value was cleared"
|
|
505
|
-
});
|
|
506
|
-
}
|
|
507
|
-
}
|
|
508
|
-
};
|
|
509
|
-
const fullPropertyPath = values.id ? propertyNamespace ? `${propertyNamespace}.${values.id}` : values.id : void 0;
|
|
510
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
511
|
-
/* @__PURE__ */ jsx("div", {
|
|
512
|
-
className: "col-span-12",
|
|
513
|
-
children: /* @__PURE__ */ jsx(EnumForm, {
|
|
514
|
-
enumValues,
|
|
515
|
-
updateIds,
|
|
516
|
-
disabled,
|
|
517
|
-
allowDataInference,
|
|
518
|
-
onError: (hasError) => {
|
|
519
|
-
setFieldError(enumValuesPath, hasError ? "This enum property is missing some values" : void 0);
|
|
520
|
-
},
|
|
521
|
-
getData: getData && fullPropertyPath ? () => getData().then((res) => res.map((entry) => getIn(entry, fullPropertyPath)).filter(Boolean)) : void 0,
|
|
522
|
-
onValuesChanged
|
|
523
|
-
})
|
|
524
|
-
}),
|
|
525
|
-
/* @__PURE__ */ jsx("div", {
|
|
526
|
-
className: "col-span-12",
|
|
527
|
-
children: /* @__PURE__ */ jsxs(ValidationPanel, { children: [!multiselect && /* @__PURE__ */ jsx(StringPropertyValidation, {
|
|
528
|
-
disabled,
|
|
529
|
-
showErrors
|
|
530
|
-
}), multiselect && /* @__PURE__ */ jsx(ArrayPropertyValidation, { disabled })] })
|
|
531
|
-
}),
|
|
532
|
-
!multiselect && /* @__PURE__ */ jsx("div", {
|
|
533
|
-
className: "col-span-12",
|
|
534
|
-
children: /* @__PURE__ */ jsx(Select, {
|
|
535
|
-
disabled,
|
|
536
|
-
position: "item-aligned",
|
|
537
|
-
fullWidth: true,
|
|
538
|
-
onValueChange: (value) => {
|
|
539
|
-
setFieldValue("defaultValue", value);
|
|
540
|
-
},
|
|
541
|
-
label: t("default_value"),
|
|
542
|
-
value: defaultValue?.toString() ?? "",
|
|
543
|
-
children: enumValues.filter((enumValue) => Boolean(enumValue?.id)).map((enumValue) => /* @__PURE__ */ jsx(SelectItem, {
|
|
544
|
-
value: enumValue.id?.toString(),
|
|
545
|
-
children: enumValue.label
|
|
546
|
-
}, enumValue.id))
|
|
547
|
-
})
|
|
548
|
-
})
|
|
549
|
-
] });
|
|
550
|
-
}
|
|
551
|
-
//#endregion
|
|
552
|
-
//#region src/collection_editor/ui/collection_editor/properties/StoragePropertyField.tsx
|
|
553
|
-
var fileTypes = {
|
|
554
|
-
"image/*": "Images",
|
|
555
|
-
"video/*": "Videos",
|
|
556
|
-
"audio/*": "Audio files",
|
|
557
|
-
"application/*": "Files (pdf, zip, csv, excel...)",
|
|
558
|
-
"text/*": "Text files"
|
|
559
|
-
};
|
|
560
|
-
function StoragePropertyField({ multiple, existing, disabled }) {
|
|
561
|
-
const { values, setFieldValue } = useFormex();
|
|
562
|
-
const { t } = useTranslation();
|
|
563
|
-
const storageSources = useStorageSources();
|
|
564
|
-
const baseStoragePath = multiple ? "of.storage" : "storage";
|
|
565
|
-
const acceptedFiles = `${baseStoragePath}.acceptedFiles`;
|
|
566
|
-
const storageSource = `${baseStoragePath}.storageSource`;
|
|
567
|
-
`${baseStoragePath}`;
|
|
568
|
-
const fileName = `${baseStoragePath}.fileName`;
|
|
569
|
-
const maxSize = `${baseStoragePath}.maxSize`;
|
|
570
|
-
const storagePath = `${baseStoragePath}.storagePath`;
|
|
571
|
-
const storeUrl = `${baseStoragePath}.storeUrl`;
|
|
572
|
-
const includeBucketUrl = `${baseStoragePath}.includeBucketUrl`;
|
|
573
|
-
const imageResize = `${baseStoragePath}.imageResize`;
|
|
574
|
-
const imageResizeMaxWidth = `${imageResize}.maxWidth`;
|
|
575
|
-
const imageResizeMaxHeight = `${imageResize}.maxHeight`;
|
|
576
|
-
const imageResizeMode = `${imageResize}.mode`;
|
|
577
|
-
const imageResizeFormat = `${imageResize}.format`;
|
|
578
|
-
const imageResizeQuality = `${imageResize}.quality`;
|
|
579
|
-
const fileNameValue = getIn(values, fileName) ?? "{rand}_{file}";
|
|
580
|
-
const storagePathValue = getIn(values, storagePath) ?? "/";
|
|
581
|
-
const maxSizeValue = getIn(values, maxSize);
|
|
582
|
-
const imageResizeMaxWidthValue = getIn(values, imageResizeMaxWidth);
|
|
583
|
-
const imageResizeMaxHeightValue = getIn(values, imageResizeMaxHeight);
|
|
584
|
-
const imageResizeModeValue = getIn(values, imageResizeMode) ?? "cover";
|
|
585
|
-
const imageResizeFormatValue = getIn(values, imageResizeFormat) ?? "original";
|
|
586
|
-
const imageResizeQualityValue = getIn(values, imageResizeQuality);
|
|
587
|
-
const storedValue = getIn(values, acceptedFiles);
|
|
588
|
-
const fileTypesValue = Array.isArray(storedValue) ? storedValue : void 0;
|
|
589
|
-
const allFileTypesSelected = !fileTypesValue || fileTypesValue.length === 0;
|
|
590
|
-
const sourceKeys = Object.keys(storageSources.sources).filter((key) => key !== DEFAULT_STORAGE_SOURCE_KEY);
|
|
591
|
-
const storageSourceValue = getIn(values, storageSource) ?? DEFAULT_STORAGE_SOURCE_KEY;
|
|
592
|
-
const handleTypesChange = (value) => {
|
|
593
|
-
if (!value) setFieldValue(acceptedFiles, void 0);
|
|
594
|
-
else setFieldValue(acceptedFiles, value);
|
|
595
|
-
};
|
|
596
|
-
const hasFilenameCallback = typeof fileNameValue === "function";
|
|
597
|
-
const hasStoragePathCallback = typeof storagePathValue === "function";
|
|
598
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
599
|
-
className: "col-span-12",
|
|
600
|
-
children: /* @__PURE__ */ jsx(ExpandablePanel, {
|
|
601
|
-
title: /* @__PURE__ */ jsxs("div", {
|
|
602
|
-
className: "flex flex-row text-surface-500 text-text-secondary dark:text-text-secondary-dark",
|
|
603
|
-
children: [/* @__PURE__ */ jsx(UploadCloudIcon, {}), /* @__PURE__ */ jsx(Typography, {
|
|
604
|
-
variant: "subtitle2",
|
|
605
|
-
className: "ml-4",
|
|
606
|
-
children: "File upload config"
|
|
607
|
-
})]
|
|
608
|
-
}),
|
|
609
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
610
|
-
className: "grid grid-cols-12 gap-2 p-4",
|
|
611
|
-
children: [
|
|
612
|
-
sourceKeys.length > 0 && /* @__PURE__ */ jsx("div", {
|
|
613
|
-
className: "col-span-12",
|
|
614
|
-
children: /* @__PURE__ */ jsxs(Select, {
|
|
615
|
-
className: "w-full",
|
|
616
|
-
disabled,
|
|
617
|
-
name: storageSource,
|
|
618
|
-
value: storageSourceValue,
|
|
619
|
-
onValueChange: (value) => setFieldValue(storageSource, !value || value === DEFAULT_STORAGE_SOURCE_KEY ? void 0 : value),
|
|
620
|
-
label: "Storage backend",
|
|
621
|
-
renderValue: (key) => {
|
|
622
|
-
return storageSources.registry[key]?.label ?? (key === DEFAULT_STORAGE_SOURCE_KEY ? "Default" : key);
|
|
623
|
-
},
|
|
624
|
-
children: [/* @__PURE__ */ jsx(SelectItem, {
|
|
625
|
-
value: DEFAULT_STORAGE_SOURCE_KEY,
|
|
626
|
-
children: "Default"
|
|
627
|
-
}), sourceKeys.map((key) => /* @__PURE__ */ jsx(SelectItem, {
|
|
628
|
-
value: key,
|
|
629
|
-
children: storageSources.registry[key]?.label ?? key
|
|
630
|
-
}, key))]
|
|
631
|
-
})
|
|
632
|
-
}),
|
|
633
|
-
/* @__PURE__ */ jsx("div", {
|
|
634
|
-
className: "col-span-12",
|
|
635
|
-
children: /* @__PURE__ */ jsx(MultiSelect, {
|
|
636
|
-
className: "w-full",
|
|
637
|
-
placeholder: "All file types allowed",
|
|
638
|
-
disabled,
|
|
639
|
-
name: acceptedFiles,
|
|
640
|
-
value: fileTypesValue ?? [],
|
|
641
|
-
onValueChange: handleTypesChange,
|
|
642
|
-
label: allFileTypesSelected ? void 0 : "Allowed file types",
|
|
643
|
-
renderValues: (selected) => {
|
|
644
|
-
if (!selected || selected.length === 0) return "All file types allowed";
|
|
645
|
-
return selected.map((v) => fileTypes[v]).filter((v) => Boolean(v)).join(", ");
|
|
646
|
-
},
|
|
647
|
-
children: Object.entries(fileTypes).map(([value, label]) => /* @__PURE__ */ jsxs(MultiSelectItem, {
|
|
648
|
-
value,
|
|
649
|
-
className: "flex items-center gap-2",
|
|
650
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
651
|
-
className: "grow",
|
|
652
|
-
children: label
|
|
653
|
-
}), /* @__PURE__ */ jsx(Button, {
|
|
654
|
-
size: "small",
|
|
655
|
-
variant: "text",
|
|
656
|
-
onClick: (e) => {
|
|
657
|
-
e.preventDefault();
|
|
658
|
-
e.stopPropagation();
|
|
659
|
-
return setFieldValue(acceptedFiles, [value]);
|
|
660
|
-
},
|
|
661
|
-
children: "Only"
|
|
662
|
-
})]
|
|
663
|
-
}, value))
|
|
664
|
-
})
|
|
665
|
-
}),
|
|
666
|
-
/* @__PURE__ */ jsx("div", {
|
|
667
|
-
className: "col-span-12",
|
|
668
|
-
children: /* @__PURE__ */ jsx(Field, {
|
|
669
|
-
name: fileName,
|
|
670
|
-
as: DebouncedTextField,
|
|
671
|
-
label: t("storage_file_name"),
|
|
672
|
-
size: "small",
|
|
673
|
-
disabled: hasFilenameCallback || disabled,
|
|
674
|
-
value: hasFilenameCallback ? "-" : fileNameValue
|
|
675
|
-
})
|
|
676
|
-
}),
|
|
677
|
-
/* @__PURE__ */ jsxs("div", {
|
|
678
|
-
className: "col-span-12",
|
|
679
|
-
children: [
|
|
680
|
-
/* @__PURE__ */ jsx(Field, {
|
|
681
|
-
name: storagePath,
|
|
682
|
-
as: DebouncedTextField,
|
|
683
|
-
label: t("storage_path"),
|
|
684
|
-
disabled: hasStoragePathCallback || disabled,
|
|
685
|
-
size: "small",
|
|
686
|
-
value: hasStoragePathCallback ? "-" : storagePathValue
|
|
687
|
-
}),
|
|
688
|
-
/* @__PURE__ */ jsxs(Typography, {
|
|
689
|
-
variant: "caption",
|
|
690
|
-
className: "ml-3.5 mt-1 mb-2",
|
|
691
|
-
children: [/* @__PURE__ */ jsx("p", { children: "You can use the following placeholders in the file name and storage path values:" }), /* @__PURE__ */ jsxs("ul", { children: [
|
|
692
|
-
/* @__PURE__ */ jsx("li", { children: "{file} - Full name of the uploaded file" }),
|
|
693
|
-
/* @__PURE__ */ jsx("li", { children: "{file.name} - Name of the uploaded file without extension" }),
|
|
694
|
-
/* @__PURE__ */ jsx("li", { children: "{file.ext} - Extension of the uploaded file" }),
|
|
695
|
-
/* @__PURE__ */ jsx("li", { children: "{entityId} - ID of the entity" }),
|
|
696
|
-
/* @__PURE__ */ jsx("li", { children: "{propertyKey} - ID of this field" }),
|
|
697
|
-
/* @__PURE__ */ jsx("li", { children: "{path} - Path of this entity" }),
|
|
698
|
-
/* @__PURE__ */ jsx("li", { children: "{rand} - Random value used to avoid name collisions" })
|
|
699
|
-
] })]
|
|
700
|
-
}),
|
|
701
|
-
/* @__PURE__ */ jsx(Field, {
|
|
702
|
-
name: includeBucketUrl,
|
|
703
|
-
type: "checkbox",
|
|
704
|
-
children: ({ field, form }) => {
|
|
705
|
-
return /* @__PURE__ */ jsx(SwitchControl, {
|
|
706
|
-
label: t("storage_include_bucket_url"),
|
|
707
|
-
disabled: existing || disabled,
|
|
708
|
-
form,
|
|
709
|
-
field
|
|
710
|
-
});
|
|
711
|
-
}
|
|
712
|
-
}),
|
|
713
|
-
/* @__PURE__ */ jsxs(Typography, {
|
|
714
|
-
variant: "caption",
|
|
715
|
-
className: "ml-3.5 mt-1 mb-2",
|
|
716
|
-
children: [
|
|
717
|
-
"Turn this setting on if you want to save a fully-qualified storage URL (e.g. ",
|
|
718
|
-
/* @__PURE__ */ jsx("code", { children: "s3://my-bucket/path/to/file" }),
|
|
719
|
-
") instead of just the storage path. You can only change this prop upon creation."
|
|
720
|
-
]
|
|
721
|
-
}),
|
|
722
|
-
/* @__PURE__ */ jsx(Field, {
|
|
723
|
-
name: storeUrl,
|
|
724
|
-
type: "checkbox",
|
|
725
|
-
children: ({ field, form }) => {
|
|
726
|
-
return /* @__PURE__ */ jsx(SwitchControl, {
|
|
727
|
-
label: t("storage_save_url"),
|
|
728
|
-
disabled: existing || disabled,
|
|
729
|
-
form,
|
|
730
|
-
field
|
|
731
|
-
});
|
|
732
|
-
}
|
|
733
|
-
}),
|
|
734
|
-
/* @__PURE__ */ jsx(Typography, {
|
|
735
|
-
variant: "caption",
|
|
736
|
-
className: "ml-3.5 mt-1 mb-2",
|
|
737
|
-
children: "Turn this setting on, if you prefer to save the download URL of the uploaded file instead of the storage path. You can only change this prop upon creation."
|
|
738
|
-
})
|
|
739
|
-
]
|
|
740
|
-
}),
|
|
741
|
-
/* @__PURE__ */ jsx("div", {
|
|
742
|
-
className: "col-span-12",
|
|
743
|
-
children: /* @__PURE__ */ jsx(DebouncedTextField, {
|
|
744
|
-
name: maxSize,
|
|
745
|
-
type: "number",
|
|
746
|
-
label: t("storage_max_size"),
|
|
747
|
-
size: "small",
|
|
748
|
-
value: maxSizeValue !== void 0 && maxSizeValue !== null ? maxSizeValue.toString() : "",
|
|
749
|
-
onChange: (e) => {
|
|
750
|
-
const value = e.target.value;
|
|
751
|
-
if (value === "") setFieldValue(maxSize, void 0);
|
|
752
|
-
else setFieldValue(maxSize, parseInt(value));
|
|
753
|
-
}
|
|
754
|
-
})
|
|
755
|
-
}),
|
|
756
|
-
/* @__PURE__ */ jsxs("div", {
|
|
757
|
-
className: "col-span-12 mt-4",
|
|
758
|
-
children: [/* @__PURE__ */ jsx(Typography, {
|
|
759
|
-
variant: "subtitle2",
|
|
760
|
-
color: "secondary",
|
|
761
|
-
className: "mb-2 block",
|
|
762
|
-
children: "Image Resize Configuration"
|
|
763
|
-
}), /* @__PURE__ */ jsx(Typography, {
|
|
764
|
-
variant: "caption",
|
|
765
|
-
className: "mb-2 block text-xs",
|
|
766
|
-
children: "Automatically resize and optimize images before upload (JPEG, PNG, WebP only)"
|
|
767
|
-
})]
|
|
768
|
-
}),
|
|
769
|
-
/* @__PURE__ */ jsx("div", {
|
|
770
|
-
className: "col-span-6",
|
|
771
|
-
children: /* @__PURE__ */ jsx(DebouncedTextField, {
|
|
772
|
-
name: imageResizeMaxWidth,
|
|
773
|
-
type: "number",
|
|
774
|
-
label: t("storage_max_width"),
|
|
775
|
-
size: "small",
|
|
776
|
-
disabled,
|
|
777
|
-
value: imageResizeMaxWidthValue !== void 0 && imageResizeMaxWidthValue !== null ? imageResizeMaxWidthValue.toString() : "",
|
|
778
|
-
onChange: (e) => {
|
|
779
|
-
const value = e.target.value;
|
|
780
|
-
if (value === "") setFieldValue(imageResizeMaxWidth, void 0);
|
|
781
|
-
else setFieldValue(imageResizeMaxWidth, parseInt(value));
|
|
782
|
-
}
|
|
783
|
-
})
|
|
784
|
-
}),
|
|
785
|
-
/* @__PURE__ */ jsx("div", {
|
|
786
|
-
className: "col-span-6",
|
|
787
|
-
children: /* @__PURE__ */ jsx(DebouncedTextField, {
|
|
788
|
-
name: imageResizeMaxHeight,
|
|
789
|
-
type: "number",
|
|
790
|
-
label: t("storage_max_height"),
|
|
791
|
-
size: "small",
|
|
792
|
-
disabled,
|
|
793
|
-
value: imageResizeMaxHeightValue !== void 0 && imageResizeMaxHeightValue !== null ? imageResizeMaxHeightValue.toString() : "",
|
|
794
|
-
onChange: (e) => {
|
|
795
|
-
const value = e.target.value;
|
|
796
|
-
if (value === "") setFieldValue(imageResizeMaxHeight, void 0);
|
|
797
|
-
else setFieldValue(imageResizeMaxHeight, parseInt(value));
|
|
798
|
-
}
|
|
799
|
-
})
|
|
800
|
-
}),
|
|
801
|
-
/* @__PURE__ */ jsx("div", {
|
|
802
|
-
className: "col-span-6",
|
|
803
|
-
children: /* @__PURE__ */ jsxs(Select, {
|
|
804
|
-
disabled,
|
|
805
|
-
name: imageResizeMode,
|
|
806
|
-
fullWidth: true,
|
|
807
|
-
size: "medium",
|
|
808
|
-
value: imageResizeModeValue || "cover",
|
|
809
|
-
onValueChange: (value) => setFieldValue(imageResizeMode, value || "cover"),
|
|
810
|
-
label: t("storage_resize_mode"),
|
|
811
|
-
renderValue: (selected) => {
|
|
812
|
-
if (!selected) return "Cover";
|
|
813
|
-
return selected === "contain" ? "Contain (fit within bounds)" : "Cover (fill bounds, may crop)";
|
|
814
|
-
},
|
|
815
|
-
children: [/* @__PURE__ */ jsx(SelectItem, {
|
|
816
|
-
value: "contain",
|
|
817
|
-
children: "Contain (fit within bounds)"
|
|
818
|
-
}), /* @__PURE__ */ jsx(SelectItem, {
|
|
819
|
-
value: "cover",
|
|
820
|
-
children: "Cover (fill bounds, may crop)"
|
|
821
|
-
})]
|
|
822
|
-
})
|
|
823
|
-
}),
|
|
824
|
-
/* @__PURE__ */ jsx("div", {
|
|
825
|
-
className: "col-span-6",
|
|
826
|
-
children: /* @__PURE__ */ jsxs(Select, {
|
|
827
|
-
disabled,
|
|
828
|
-
size: "medium",
|
|
829
|
-
fullWidth: true,
|
|
830
|
-
name: imageResizeFormat,
|
|
831
|
-
value: imageResizeFormatValue || "original",
|
|
832
|
-
onValueChange: (value) => setFieldValue(imageResizeFormat, value || "original"),
|
|
833
|
-
label: t("storage_output_format"),
|
|
834
|
-
renderValue: (selected) => {
|
|
835
|
-
if (!selected) return "Original";
|
|
836
|
-
return selected.charAt(0).toUpperCase() + selected.slice(1);
|
|
837
|
-
},
|
|
838
|
-
children: [
|
|
839
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
840
|
-
value: "original",
|
|
841
|
-
children: "Original (keep same format)"
|
|
842
|
-
}),
|
|
843
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
844
|
-
value: "jpeg",
|
|
845
|
-
children: "JPEG"
|
|
846
|
-
}),
|
|
847
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
848
|
-
value: "png",
|
|
849
|
-
children: "PNG"
|
|
850
|
-
}),
|
|
851
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
852
|
-
value: "webp",
|
|
853
|
-
children: "WebP (best compression)"
|
|
854
|
-
})
|
|
855
|
-
]
|
|
856
|
-
})
|
|
857
|
-
}),
|
|
858
|
-
/* @__PURE__ */ jsxs("div", {
|
|
859
|
-
className: "col-span-12",
|
|
860
|
-
children: [/* @__PURE__ */ jsx(DebouncedTextField, {
|
|
861
|
-
name: imageResizeQuality,
|
|
862
|
-
type: "number",
|
|
863
|
-
label: t("storage_quality"),
|
|
864
|
-
size: "small",
|
|
865
|
-
disabled,
|
|
866
|
-
value: imageResizeQualityValue !== void 0 && imageResizeQualityValue !== null ? imageResizeQualityValue.toString() : "",
|
|
867
|
-
onChange: (e) => {
|
|
868
|
-
const value = e.target.value;
|
|
869
|
-
if (value === "") setFieldValue(imageResizeQuality, void 0);
|
|
870
|
-
else {
|
|
871
|
-
const numValue = parseInt(value);
|
|
872
|
-
if (numValue >= 0 && numValue <= 100) setFieldValue(imageResizeQuality, numValue);
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
}), /* @__PURE__ */ jsx(Typography, {
|
|
876
|
-
variant: "caption",
|
|
877
|
-
className: "ml-3.5 mt-1 mb-2",
|
|
878
|
-
children: "Higher quality = larger file size. Recommended: 80-90 for photos, 90-100 for graphics"
|
|
879
|
-
})]
|
|
880
|
-
})
|
|
881
|
-
]
|
|
882
|
-
})
|
|
883
|
-
})
|
|
884
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
885
|
-
className: "col-span-12",
|
|
886
|
-
children: /* @__PURE__ */ jsxs(ValidationPanel, { children: [!multiple && /* @__PURE__ */ jsx("div", {
|
|
887
|
-
className: "grid grid-cols-12 gap-2",
|
|
888
|
-
children: /* @__PURE__ */ jsx(GeneralPropertyValidation, { disabled })
|
|
889
|
-
}), multiple && /* @__PURE__ */ jsx("div", {
|
|
890
|
-
className: "col-span-12",
|
|
891
|
-
children: /* @__PURE__ */ jsx(ArrayPropertyValidation, { disabled })
|
|
892
|
-
})] })
|
|
893
|
-
})] });
|
|
894
|
-
}
|
|
895
|
-
//#endregion
|
|
896
|
-
//#region src/collection_editor/ui/collection_editor/PropertyFieldPreview.tsx
|
|
897
|
-
function PropertyFieldPreview({ property, propertyKey, onClick, hasError, includeName, includeEditButton, selected }) {
|
|
898
|
-
const { propertyConfigs } = useCustomizationController();
|
|
899
|
-
const propertyConfig = getFieldConfig(property, propertyConfigs);
|
|
900
|
-
return /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx("div", {
|
|
901
|
-
onClick,
|
|
902
|
-
className: onClick ? "cursor-pointer" : "",
|
|
903
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
904
|
-
className: cls("w-full flex flex-row gap-3 items-center px-3 py-2 rounded-lg transition-all duration-200 border bg-surface-card shadow-xs", (hasError ? "border-red-500 dark:border-red-500 border-red-500/100 dark:border-red-500/100 ring-0 dark:ring-0" : selected ? "border-primary" : "") || "border-hairline-strong", selected ? "bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary-light ring-1 ring-inset ring-primary border-primary/30" : "hover:bg-surface-hover"),
|
|
905
|
-
children: [
|
|
906
|
-
/* @__PURE__ */ jsx(PropertyConfigBadge, {
|
|
907
|
-
propertyConfig,
|
|
908
|
-
size: "small"
|
|
909
|
-
}),
|
|
910
|
-
/* @__PURE__ */ jsxs("div", {
|
|
911
|
-
className: "flex-1 flex flex-col min-w-0 mr-16",
|
|
912
|
-
children: [includeName && /* @__PURE__ */ jsxs(ErrorBoundary, { children: [/* @__PURE__ */ jsxs("div", {
|
|
913
|
-
className: "flex items-center gap-2 min-w-0",
|
|
914
|
-
children: [/* @__PURE__ */ jsx(Typography, {
|
|
915
|
-
variant: "body2",
|
|
916
|
-
component: "span",
|
|
917
|
-
className: "truncate font-medium",
|
|
918
|
-
children: property.name || propertyKey || "\xA0"
|
|
919
|
-
}), propertyConfig?.name && /* @__PURE__ */ jsx(Typography, {
|
|
920
|
-
variant: "caption",
|
|
921
|
-
component: "span",
|
|
922
|
-
className: "text-text-secondary dark:text-text-secondary-dark shrink-0",
|
|
923
|
-
children: propertyConfig.name
|
|
924
|
-
})]
|
|
925
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
926
|
-
className: "flex items-center gap-1.5 mt-0.5 min-w-0",
|
|
927
|
-
children: [propertyKey && /* @__PURE__ */ jsx(Typography, {
|
|
928
|
-
variant: "caption",
|
|
929
|
-
component: "span",
|
|
930
|
-
color: "secondary",
|
|
931
|
-
className: "font-mono truncate",
|
|
932
|
-
children: propertyKey
|
|
933
|
-
}), /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsxs(Typography, {
|
|
934
|
-
variant: "caption",
|
|
935
|
-
component: "span",
|
|
936
|
-
className: "shrink-0 text-text-disabled dark:text-text-disabled-dark font-mono",
|
|
937
|
-
children: ["· ", "columnType" in property ? property.columnType ?? property.type : property.type]
|
|
938
|
-
}) })]
|
|
939
|
-
})] }), !includeName && /* @__PURE__ */ jsx("div", {
|
|
940
|
-
className: "flex flex-row items-center gap-2",
|
|
941
|
-
children: /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(Typography, {
|
|
942
|
-
variant: "caption",
|
|
943
|
-
component: "span",
|
|
944
|
-
className: "text-text-secondary dark:text-text-secondary-dark font-medium",
|
|
945
|
-
children: propertyConfig?.name
|
|
946
|
-
}) })
|
|
947
|
-
})]
|
|
948
|
-
}),
|
|
949
|
-
includeEditButton && /* @__PURE__ */ jsx(Typography, {
|
|
950
|
-
variant: "button",
|
|
951
|
-
children: "EDIT"
|
|
952
|
-
})
|
|
953
|
-
]
|
|
954
|
-
})
|
|
955
|
-
}) });
|
|
956
|
-
}
|
|
957
|
-
function NonEditablePropertyPreview({ name, selected, onClick, property }) {
|
|
958
|
-
const { propertyConfigs } = useCustomizationController();
|
|
959
|
-
const propertyConfig = !isPropertyBuilder(property) && property ? getFieldConfig(property, propertyConfigs) : void 0;
|
|
960
|
-
return /* @__PURE__ */ jsx("div", {
|
|
961
|
-
onClick,
|
|
962
|
-
className: onClick ? "cursor-pointer" : "",
|
|
963
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
964
|
-
className: cls("w-full flex flex-row gap-3 items-center px-3 py-2 rounded-lg transition-all duration-200 border bg-surface-card border-hairline-strong shadow-xs", selected ? "bg-primary/10 text-primary dark:bg-primary/20 dark:text-primary-light ring-1 ring-inset ring-primary border-primary/30" : "hover:bg-surface-hover"),
|
|
965
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
966
|
-
className: "relative shrink-0",
|
|
967
|
-
children: [
|
|
968
|
-
propertyConfig && /* @__PURE__ */ jsx(PropertyConfigBadge, {
|
|
969
|
-
propertyConfig,
|
|
970
|
-
size: "small"
|
|
971
|
-
}),
|
|
972
|
-
!propertyConfig && /* @__PURE__ */ jsx("div", {
|
|
973
|
-
className: "h-8 w-8 flex items-center justify-center rounded-full shadow-2xs text-white bg-surface-500",
|
|
974
|
-
children: /* @__PURE__ */ jsx(FunctionSquareIcon, {
|
|
975
|
-
className: "text-inherit",
|
|
976
|
-
size: iconSize.small
|
|
977
|
-
})
|
|
978
|
-
}),
|
|
979
|
-
/* @__PURE__ */ jsx(MinusCircleIcon, {
|
|
980
|
-
className: "text-surface-accent-400 absolute -right-2 -top-2 bg-surface-card rounded-full",
|
|
981
|
-
size: iconSize.small
|
|
982
|
-
})
|
|
983
|
-
]
|
|
984
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
985
|
-
className: "flex-1 flex flex-col min-w-0 mr-16",
|
|
986
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
987
|
-
className: "flex items-center gap-2 min-w-0",
|
|
988
|
-
children: [/* @__PURE__ */ jsx(Typography, {
|
|
989
|
-
variant: "label",
|
|
990
|
-
component: "span",
|
|
991
|
-
className: "truncate",
|
|
992
|
-
children: property?.name ? property.name : name
|
|
993
|
-
}), propertyConfig && /* @__PURE__ */ jsx(Typography, {
|
|
994
|
-
variant: "caption",
|
|
995
|
-
component: "span",
|
|
996
|
-
className: "text-text-secondary dark:text-text-secondary-dark shrink-0",
|
|
997
|
-
children: propertyConfig?.name
|
|
998
|
-
})]
|
|
999
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
1000
|
-
className: "flex flex-row items-center gap-1.5 mt-0.5 min-w-0",
|
|
1001
|
-
children: [
|
|
1002
|
-
/* @__PURE__ */ jsx(Typography, {
|
|
1003
|
-
variant: "caption",
|
|
1004
|
-
component: "span",
|
|
1005
|
-
color: "secondary",
|
|
1006
|
-
className: "font-mono truncate",
|
|
1007
|
-
children: name
|
|
1008
|
-
}),
|
|
1009
|
-
property && isPropertyBuilder(property) && /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(Typography, {
|
|
1010
|
-
variant: "caption",
|
|
1011
|
-
component: "span",
|
|
1012
|
-
className: "text-text-disabled dark:text-text-disabled-dark",
|
|
1013
|
-
children: "· Defined in code"
|
|
1014
|
-
}) }),
|
|
1015
|
-
!property && /* @__PURE__ */ jsx(ErrorBoundary, { children: /* @__PURE__ */ jsx(Typography, {
|
|
1016
|
-
variant: "caption",
|
|
1017
|
-
component: "span",
|
|
1018
|
-
className: "text-text-disabled dark:text-text-disabled-dark",
|
|
1019
|
-
children: "· Additional field"
|
|
1020
|
-
}) })
|
|
1021
|
-
]
|
|
1022
|
-
})]
|
|
1023
|
-
})]
|
|
1024
|
-
})
|
|
1025
|
-
});
|
|
1026
|
-
}
|
|
1027
|
-
//#endregion
|
|
1028
|
-
//#region src/collection_editor/ui/collection_editor/AIModifiedPathsContext.tsx
|
|
1029
|
-
var AIModifiedPathsContext = createContext(null);
|
|
1030
|
-
function AIModifiedPathsProvider({ children }) {
|
|
1031
|
-
const [modifiedPaths, setModifiedPaths] = useState(/* @__PURE__ */ new Set());
|
|
1032
|
-
const [generationCounter, setGenerationCounter] = useState(0);
|
|
1033
|
-
const addModifiedPaths = useCallback((operations) => {
|
|
1034
|
-
setModifiedPaths((prev) => {
|
|
1035
|
-
const newSet = new Set(prev);
|
|
1036
|
-
operations.forEach((op) => {
|
|
1037
|
-
newSet.add(op.path);
|
|
1038
|
-
const parts = op.path.split(".");
|
|
1039
|
-
if (parts[0] === "properties" && parts.length >= 2) newSet.add(`properties.${parts[1]}`);
|
|
1040
|
-
});
|
|
1041
|
-
return newSet;
|
|
1042
|
-
});
|
|
1043
|
-
setGenerationCounter((prev) => prev + 1);
|
|
1044
|
-
}, []);
|
|
1045
|
-
const clearPath = useCallback((path) => {
|
|
1046
|
-
setModifiedPaths((prev) => {
|
|
1047
|
-
const newSet = new Set(prev);
|
|
1048
|
-
for (const p of newSet) if (p === path || p.startsWith(path + ".")) newSet.delete(p);
|
|
1049
|
-
return newSet;
|
|
1050
|
-
});
|
|
1051
|
-
}, []);
|
|
1052
|
-
const clearAllPaths = useCallback(() => {
|
|
1053
|
-
setModifiedPaths(/* @__PURE__ */ new Set());
|
|
1054
|
-
}, []);
|
|
1055
|
-
const isPathModified = useCallback((path) => {
|
|
1056
|
-
if (modifiedPaths.has(path)) return true;
|
|
1057
|
-
for (const p of modifiedPaths) if (p.startsWith(path + ".")) return true;
|
|
1058
|
-
return false;
|
|
1059
|
-
}, [modifiedPaths]);
|
|
1060
|
-
const contextValue = useMemo(() => ({
|
|
1061
|
-
modifiedPaths,
|
|
1062
|
-
generationCounter,
|
|
1063
|
-
addModifiedPaths,
|
|
1064
|
-
clearPath,
|
|
1065
|
-
clearAllPaths,
|
|
1066
|
-
isPathModified
|
|
1067
|
-
}), [
|
|
1068
|
-
modifiedPaths,
|
|
1069
|
-
generationCounter,
|
|
1070
|
-
addModifiedPaths,
|
|
1071
|
-
clearPath,
|
|
1072
|
-
clearAllPaths,
|
|
1073
|
-
isPathModified
|
|
1074
|
-
]);
|
|
1075
|
-
return /* @__PURE__ */ jsx(AIModifiedPathsContext.Provider, {
|
|
1076
|
-
value: contextValue,
|
|
1077
|
-
children
|
|
1078
|
-
});
|
|
1079
|
-
}
|
|
1080
|
-
function useAIModifiedPaths() {
|
|
1081
|
-
return useContext(AIModifiedPathsContext);
|
|
1082
|
-
}
|
|
1083
|
-
//#endregion
|
|
1084
|
-
//#region src/collection_editor/ui/collection_editor/PropertyTree.tsx
|
|
1085
|
-
var PropertyTree = React.memo(function PropertyTree({ namespace, selectedPropertyKey, onPropertyClick, properties, propertiesOrder: propertiesOrderProp, additionalFields, errors, onPropertyMove, onPropertyRemove, className, inferredPropertyKeys }) {
|
|
1086
|
-
const propertyKeys = Object.keys(properties);
|
|
1087
|
-
const filteredOrder = (propertiesOrderProp ?? propertyKeys).filter((key) => !key.includes(".") && properties[key]);
|
|
1088
|
-
const missingKeys = propertyKeys.filter((key) => !filteredOrder.includes(key));
|
|
1089
|
-
const propertiesOrder = [...filteredOrder, ...missingKeys];
|
|
1090
|
-
const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 5 } }), useSensor(KeyboardSensor, { coordinateGetter: sortableKeyboardCoordinates }));
|
|
1091
|
-
const handleDragEnd = (event) => {
|
|
1092
|
-
const { active, over } = event;
|
|
1093
|
-
if (!over || active.id === over.id) return;
|
|
1094
|
-
const activeId = String(active.id);
|
|
1095
|
-
const overId = String(over.id);
|
|
1096
|
-
const activeKey = activeId.includes(".") ? activeId.split(".").pop() : activeId;
|
|
1097
|
-
const overKey = overId.includes(".") ? overId.split(".").pop() : overId;
|
|
1098
|
-
if (!activeKey || !overKey) return;
|
|
1099
|
-
const oldIndex = propertiesOrder.indexOf(activeKey);
|
|
1100
|
-
const newIndex = propertiesOrder.indexOf(overKey);
|
|
1101
|
-
if (oldIndex !== -1 && newIndex !== -1) {
|
|
1102
|
-
const newPropertiesOrder = [...propertiesOrder];
|
|
1103
|
-
const [removed] = newPropertiesOrder.splice(oldIndex, 1);
|
|
1104
|
-
newPropertiesOrder.splice(newIndex, 0, removed);
|
|
1105
|
-
if (onPropertyMove) onPropertyMove(newPropertiesOrder, namespace);
|
|
1106
|
-
}
|
|
1107
|
-
};
|
|
1108
|
-
const items = propertiesOrder.map((key) => getFullId(key, namespace));
|
|
1109
|
-
return /* @__PURE__ */ jsx(DndContext, {
|
|
1110
|
-
sensors,
|
|
1111
|
-
collisionDetection: closestCenter,
|
|
1112
|
-
onDragEnd: handleDragEnd,
|
|
1113
|
-
modifiers: [restrictToVerticalAxis],
|
|
1114
|
-
children: /* @__PURE__ */ jsx(SortableContext, {
|
|
1115
|
-
items,
|
|
1116
|
-
strategy: verticalListSortingStrategy,
|
|
1117
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
1118
|
-
className: cls("flex flex-col gap-0.5", className),
|
|
1119
|
-
children: propertiesOrder && propertiesOrder.map((propertyKey, index) => {
|
|
1120
|
-
const property = properties[propertyKey];
|
|
1121
|
-
const additionalField = additionalFields?.find((field) => field.key === propertyKey);
|
|
1122
|
-
if (!property && !additionalField) {
|
|
1123
|
-
console.warn(`Property ${propertyKey} not found in properties or additionalFields`);
|
|
1124
|
-
return null;
|
|
1125
|
-
}
|
|
1126
|
-
const id = getFullId(propertyKey, namespace);
|
|
1127
|
-
return /* @__PURE__ */ jsx(PropertyTreeEntry, {
|
|
1128
|
-
id,
|
|
1129
|
-
propertyKey,
|
|
1130
|
-
property,
|
|
1131
|
-
additionalField,
|
|
1132
|
-
errors,
|
|
1133
|
-
namespace,
|
|
1134
|
-
propertiesOrder,
|
|
1135
|
-
inferredPropertyKeys,
|
|
1136
|
-
onPropertyMove,
|
|
1137
|
-
onPropertyRemove,
|
|
1138
|
-
onPropertyClick,
|
|
1139
|
-
selectedPropertyKey
|
|
1140
|
-
}, id);
|
|
1141
|
-
}).filter(Boolean)
|
|
1142
|
-
})
|
|
1143
|
-
})
|
|
1144
|
-
});
|
|
1145
|
-
}, deepEqual);
|
|
1146
|
-
function PropertyTreeEntry({ id, propertyKey, namespace, property, additionalField, selectedPropertyKey, errors, propertiesOrder, onPropertyClick, onPropertyMove, onPropertyRemove, inferredPropertyKeys }) {
|
|
1147
|
-
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({ id });
|
|
1148
|
-
const style = {
|
|
1149
|
-
transform: CSS.Translate.toString(transform),
|
|
1150
|
-
transition,
|
|
1151
|
-
zIndex: isDragging ? 10 : void 0,
|
|
1152
|
-
position: "relative"
|
|
1153
|
-
};
|
|
1154
|
-
const isPropertyInferred = inferredPropertyKeys?.includes(namespace ? `${namespace}.${propertyKey}` : propertyKey);
|
|
1155
|
-
const fullId = id;
|
|
1156
|
-
const hasError = getFullIdPath(propertyKey, namespace) in errors;
|
|
1157
|
-
let subtree;
|
|
1158
|
-
if (typeof property === "object") {
|
|
1159
|
-
if (property.type === "map" && property.properties) subtree = /* @__PURE__ */ jsx(PropertyTree, {
|
|
1160
|
-
selectedPropertyKey,
|
|
1161
|
-
namespace: fullId,
|
|
1162
|
-
properties: property.properties,
|
|
1163
|
-
propertiesOrder: property.propertiesOrder,
|
|
1164
|
-
errors,
|
|
1165
|
-
onPropertyClick,
|
|
1166
|
-
onPropertyMove,
|
|
1167
|
-
onPropertyRemove,
|
|
1168
|
-
inferredPropertyKeys
|
|
1169
|
-
});
|
|
1170
|
-
}
|
|
1171
|
-
const selected = selectedPropertyKey === fullId;
|
|
1172
|
-
const editable = property && !isPropertyBuilder(property);
|
|
1173
|
-
const isAIModified = useAIModifiedPaths()?.isPathModified(`properties.${propertyKey}`) ?? false;
|
|
1174
|
-
return /* @__PURE__ */ jsx("div", {
|
|
1175
|
-
ref: setNodeRef,
|
|
1176
|
-
style,
|
|
1177
|
-
className: "relative cursor-grab",
|
|
1178
|
-
...attributes,
|
|
1179
|
-
...listeners,
|
|
1180
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
1181
|
-
className: "relative",
|
|
1182
|
-
children: [
|
|
1183
|
-
subtree && /* @__PURE__ */ jsx("div", {
|
|
1184
|
-
className: "absolute border-l " + defaultBorderMixin,
|
|
1185
|
-
style: {
|
|
1186
|
-
left: "24px",
|
|
1187
|
-
top: "40px",
|
|
1188
|
-
bottom: "16px"
|
|
1189
|
-
}
|
|
1190
|
-
}),
|
|
1191
|
-
/* @__PURE__ */ jsx("div", { children: !isPropertyBuilder(property) && !additionalField && editable ? /* @__PURE__ */ jsx(PropertyFieldPreview, {
|
|
1192
|
-
property,
|
|
1193
|
-
propertyKey,
|
|
1194
|
-
onClick: onPropertyClick ? () => onPropertyClick(propertyKey, namespace) : void 0,
|
|
1195
|
-
includeName: true,
|
|
1196
|
-
selected,
|
|
1197
|
-
hasError
|
|
1198
|
-
}) : /* @__PURE__ */ jsx(NonEditablePropertyPreview, {
|
|
1199
|
-
name: propertyKey,
|
|
1200
|
-
property,
|
|
1201
|
-
onClick: onPropertyClick ? () => onPropertyClick(propertyKey, namespace) : void 0,
|
|
1202
|
-
selected
|
|
1203
|
-
}) }),
|
|
1204
|
-
/* @__PURE__ */ jsxs("div", {
|
|
1205
|
-
className: "absolute top-1/2 -translate-y-1/2 right-2 flex flex-row items-center gap-1",
|
|
1206
|
-
children: [
|
|
1207
|
-
isAIModified && /* @__PURE__ */ jsx(AIModifiedIndicator, {}),
|
|
1208
|
-
isPropertyInferred && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
1209
|
-
title: "Inferred property",
|
|
1210
|
-
asChild: true,
|
|
1211
|
-
children: /* @__PURE__ */ jsx(IconButton, {
|
|
1212
|
-
"aria-label": "Inferred property",
|
|
1213
|
-
size: "smallest",
|
|
1214
|
-
disabled: true,
|
|
1215
|
-
children: /* @__PURE__ */ jsx(FileSearchIcon, { size: iconSize.smallest })
|
|
1216
|
-
})
|
|
1217
|
-
}), onPropertyRemove && /* @__PURE__ */ jsx(Tooltip, {
|
|
1218
|
-
title: "Remove inferred property",
|
|
1219
|
-
asChild: true,
|
|
1220
|
-
children: /* @__PURE__ */ jsx(IconButton, {
|
|
1221
|
-
"aria-label": "Remove inferred property",
|
|
1222
|
-
size: "smallest",
|
|
1223
|
-
onClick: (e) => {
|
|
1224
|
-
e.stopPropagation();
|
|
1225
|
-
onPropertyRemove(propertyKey, namespace);
|
|
1226
|
-
},
|
|
1227
|
-
children: /* @__PURE__ */ jsx(Trash2Icon, { size: iconSize.smallest })
|
|
1228
|
-
})
|
|
1229
|
-
})] }),
|
|
1230
|
-
/* @__PURE__ */ jsxs(Menu, {
|
|
1231
|
-
trigger: /* @__PURE__ */ jsx(IconButton, {
|
|
1232
|
-
size: "smallest",
|
|
1233
|
-
children: /* @__PURE__ */ jsx(MoreVerticalIcon, { size: iconSize.smallest })
|
|
1234
|
-
}),
|
|
1235
|
-
children: [
|
|
1236
|
-
/* @__PURE__ */ jsxs(MenuItem, {
|
|
1237
|
-
dense: true,
|
|
1238
|
-
onClick: () => {
|
|
1239
|
-
if (propertiesOrder.indexOf(propertyKey) > 0) {
|
|
1240
|
-
const newOrder = propertiesOrder.filter((k) => k !== propertyKey);
|
|
1241
|
-
newOrder.unshift(propertyKey);
|
|
1242
|
-
onPropertyMove?.(newOrder, namespace);
|
|
1243
|
-
}
|
|
1244
|
-
},
|
|
1245
|
-
children: [/* @__PURE__ */ jsx(ArrowUpToLineIcon, { size: iconSize.smallest }), "Move to top"]
|
|
1246
|
-
}),
|
|
1247
|
-
/* @__PURE__ */ jsxs(MenuItem, {
|
|
1248
|
-
dense: true,
|
|
1249
|
-
onClick: () => {
|
|
1250
|
-
if (propertiesOrder.indexOf(propertyKey) < propertiesOrder.length - 1) {
|
|
1251
|
-
const newOrder = propertiesOrder.filter((k) => k !== propertyKey);
|
|
1252
|
-
newOrder.push(propertyKey);
|
|
1253
|
-
onPropertyMove?.(newOrder, namespace);
|
|
1254
|
-
}
|
|
1255
|
-
},
|
|
1256
|
-
children: [/* @__PURE__ */ jsx(ArrowDownToLineIcon, { size: iconSize.smallest }), "Move to bottom"]
|
|
1257
|
-
}),
|
|
1258
|
-
/* @__PURE__ */ jsxs(MenuItem, {
|
|
1259
|
-
dense: true,
|
|
1260
|
-
onClick: () => onPropertyRemove?.(propertyKey, namespace),
|
|
1261
|
-
children: [/* @__PURE__ */ jsx(Trash2Icon, { size: iconSize.smallest }), "Delete"]
|
|
1262
|
-
})
|
|
1263
|
-
]
|
|
1264
|
-
})
|
|
1265
|
-
]
|
|
1266
|
-
}),
|
|
1267
|
-
subtree && /* @__PURE__ */ jsx("div", {
|
|
1268
|
-
className: "ml-12",
|
|
1269
|
-
children: subtree
|
|
1270
|
-
})
|
|
1271
|
-
]
|
|
1272
|
-
})
|
|
1273
|
-
});
|
|
1274
|
-
}
|
|
1275
|
-
//#endregion
|
|
1276
|
-
//#region src/collection_editor/ui/collection_editor/properties/MapPropertyField.tsx
|
|
1277
|
-
function MapPropertyField({ disabled, getData, allowDataInference, propertyConfigs }) {
|
|
1278
|
-
const { values, setFieldValue } = useFormex();
|
|
1279
|
-
const { t } = useTranslation();
|
|
1280
|
-
const [propertyDialogOpen, setPropertyDialogOpen] = useState(false);
|
|
1281
|
-
const [selectedPropertyKey, setSelectedPropertyKey] = useState();
|
|
1282
|
-
const [selectedPropertyNamespace, setSelectedPropertyNamespace] = useState();
|
|
1283
|
-
const propertiesOrder = values.propertiesOrder ?? Object.keys(values.properties ?? {});
|
|
1284
|
-
const onPropertyCreated = ({ id, property }) => {
|
|
1285
|
-
if (!id) throw Error();
|
|
1286
|
-
setFieldValue("properties", {
|
|
1287
|
-
...values.properties ?? {},
|
|
1288
|
-
[id]: property
|
|
1289
|
-
}, false);
|
|
1290
|
-
const currentPropertiesOrder = values.propertiesOrder ?? Object.keys(values.properties ?? {});
|
|
1291
|
-
const newPropertiesOrder = currentPropertiesOrder.includes(id) ? currentPropertiesOrder : [...currentPropertiesOrder, id];
|
|
1292
|
-
setFieldValue("propertiesOrder", newPropertiesOrder, false);
|
|
1293
|
-
setPropertyDialogOpen(false);
|
|
1294
|
-
};
|
|
1295
|
-
const deleteProperty = (propertyKey, namespace) => {
|
|
1296
|
-
const fullId = propertyKey ? getFullId(propertyKey, namespace) : void 0;
|
|
1297
|
-
if (!fullId) throw Error("collection editor miss config");
|
|
1298
|
-
const propertiesPath = idToPropertiesPath(fullId);
|
|
1299
|
-
const propertiesOrderPath = namespaceToPropertiesOrderPath(namespace);
|
|
1300
|
-
const currentPropertiesOrder = getIn(values, propertiesOrderPath) ?? Object.keys(getIn(values, namespaceToPropertiesPath(namespace)) ?? {});
|
|
1301
|
-
setFieldValue(propertiesPath, void 0, false);
|
|
1302
|
-
setFieldValue(propertiesOrderPath, currentPropertiesOrder.filter((p) => p !== propertyKey), false);
|
|
1303
|
-
setPropertyDialogOpen(false);
|
|
1304
|
-
setSelectedPropertyKey(void 0);
|
|
1305
|
-
setSelectedPropertyNamespace(void 0);
|
|
1306
|
-
};
|
|
1307
|
-
const selectedPropertyFullId = selectedPropertyKey ? getFullId(selectedPropertyKey, selectedPropertyNamespace) : void 0;
|
|
1308
|
-
const selectedProperty = selectedPropertyFullId ? getIn(values.properties, selectedPropertyFullId.replaceAll(".", ".properties.")) : void 0;
|
|
1309
|
-
const empty = !propertiesOrder || propertiesOrder.length < 1;
|
|
1310
|
-
const onPropertyMove = (propertiesOrder, namespace) => {
|
|
1311
|
-
setFieldValue(namespaceToPropertiesOrderPath(namespace), propertiesOrder, false);
|
|
1312
|
-
};
|
|
1313
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1314
|
-
/* @__PURE__ */ jsxs("div", {
|
|
1315
|
-
className: "col-span-12",
|
|
1316
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
1317
|
-
className: "flex justify-between items-end my-4",
|
|
1318
|
-
children: [/* @__PURE__ */ jsx(Typography, {
|
|
1319
|
-
variant: "subtitle2",
|
|
1320
|
-
children: t("properties_in_this_group")
|
|
1321
|
-
}), /* @__PURE__ */ jsxs(Button, {
|
|
1322
|
-
onClick: () => setPropertyDialogOpen(true),
|
|
1323
|
-
startIcon: /* @__PURE__ */ jsx(PlusIcon, {}),
|
|
1324
|
-
children: ["Add property to ", values.name ?? "this group"]
|
|
1325
|
-
})]
|
|
1326
|
-
}), /* @__PURE__ */ jsxs(Paper, {
|
|
1327
|
-
className: "p-2 pl-8",
|
|
1328
|
-
children: [/* @__PURE__ */ jsx(PropertyTree, {
|
|
1329
|
-
properties: values.properties ?? {},
|
|
1330
|
-
propertiesOrder,
|
|
1331
|
-
errors: {},
|
|
1332
|
-
onPropertyClick: (propertyKey, namespace) => {
|
|
1333
|
-
setSelectedPropertyKey(propertyKey);
|
|
1334
|
-
setSelectedPropertyNamespace(namespace);
|
|
1335
|
-
setPropertyDialogOpen(true);
|
|
1336
|
-
},
|
|
1337
|
-
onPropertyMove
|
|
1338
|
-
}), empty && /* @__PURE__ */ jsx(Typography, {
|
|
1339
|
-
variant: "label",
|
|
1340
|
-
className: "h-full flex items-center justify-center p-4",
|
|
1341
|
-
children: "Add the first property to this group"
|
|
1342
|
-
})]
|
|
1343
|
-
})]
|
|
1344
|
-
}),
|
|
1345
|
-
/* @__PURE__ */ jsxs("div", {
|
|
1346
|
-
className: "col-span-12",
|
|
1347
|
-
children: [/* @__PURE__ */ jsx(BooleanSwitchWithLabel, {
|
|
1348
|
-
position: "start",
|
|
1349
|
-
size: "medium",
|
|
1350
|
-
label: t("spread_children_as_columns"),
|
|
1351
|
-
onValueChange: (v) => setFieldValue("admin.spreadChildren", v),
|
|
1352
|
-
value: values.admin?.spreadChildren ?? false
|
|
1353
|
-
}), /* @__PURE__ */ jsx(FieldCaption, { children: "Set this flag to true if you want to display the children of this group as individual columns. This will only work for top level groups." })]
|
|
1354
|
-
}),
|
|
1355
|
-
/* @__PURE__ */ jsx(PropertyFormDialog, {
|
|
1356
|
-
inArray: false,
|
|
1357
|
-
forceShowErrors: false,
|
|
1358
|
-
open: propertyDialogOpen,
|
|
1359
|
-
allowDataInference,
|
|
1360
|
-
onCancel: () => {
|
|
1361
|
-
setPropertyDialogOpen(false);
|
|
1362
|
-
setSelectedPropertyKey(void 0);
|
|
1363
|
-
setSelectedPropertyNamespace(void 0);
|
|
1364
|
-
},
|
|
1365
|
-
onOkClicked: () => {
|
|
1366
|
-
setPropertyDialogOpen(false);
|
|
1367
|
-
setSelectedPropertyKey(void 0);
|
|
1368
|
-
setSelectedPropertyNamespace(void 0);
|
|
1369
|
-
},
|
|
1370
|
-
getData,
|
|
1371
|
-
onDelete: deleteProperty,
|
|
1372
|
-
propertyKey: selectedPropertyKey,
|
|
1373
|
-
propertyNamespace: selectedPropertyNamespace,
|
|
1374
|
-
property: selectedProperty,
|
|
1375
|
-
existingProperty: Boolean(selectedPropertyKey),
|
|
1376
|
-
autoUpdateId: !selectedPropertyKey,
|
|
1377
|
-
autoOpenTypeSelect: !selectedPropertyKey,
|
|
1378
|
-
onPropertyChanged: onPropertyCreated,
|
|
1379
|
-
existingPropertyKeys: selectedPropertyKey ? void 0 : propertiesOrder,
|
|
1380
|
-
propertyConfigs
|
|
1381
|
-
})
|
|
1382
|
-
] });
|
|
1383
|
-
}
|
|
1384
|
-
//#endregion
|
|
1385
|
-
//#region src/collection_editor/ui/collection_editor/properties/RepeatPropertyField.tsx
|
|
1386
|
-
function RepeatPropertyField({ showErrors, existing, disabled, getData, allowDataInference, propertyConfigs }) {
|
|
1387
|
-
const { values, handleChange, errors, setFieldValue, touched } = useFormex();
|
|
1388
|
-
const [propertyDialogOpen, setPropertyDialogOpen] = useState(false);
|
|
1389
|
-
const ofProperty = getIn(values, "of");
|
|
1390
|
-
const ofPropertyError = getIn(touched, "of") && getIn(errors, "of");
|
|
1391
|
-
const onPropertyChanged = ({ id, property, namespace }) => {
|
|
1392
|
-
setFieldValue("of", property);
|
|
1393
|
-
};
|
|
1394
|
-
const widget = ofProperty && getFieldConfig(ofProperty, propertyConfigs);
|
|
1395
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
|
|
1396
|
-
className: "col-span-12",
|
|
1397
|
-
children: [/* @__PURE__ */ jsx(Typography, {
|
|
1398
|
-
variant: "subtitle2",
|
|
1399
|
-
children: "Repeat component"
|
|
1400
|
-
}), /* @__PURE__ */ jsx(Field, {
|
|
1401
|
-
name: "of",
|
|
1402
|
-
value: ofProperty,
|
|
1403
|
-
children: ({}) => /* @__PURE__ */ jsxs(Paper, {
|
|
1404
|
-
className: "p-2 mt-4",
|
|
1405
|
-
children: [
|
|
1406
|
-
ofProperty && /* @__PURE__ */ jsx(PropertyFieldPreview, {
|
|
1407
|
-
property: ofProperty,
|
|
1408
|
-
onClick: disabled ? void 0 : () => setPropertyDialogOpen(true),
|
|
1409
|
-
includeName: false,
|
|
1410
|
-
includeEditButton: true,
|
|
1411
|
-
selected: false,
|
|
1412
|
-
hasError: false
|
|
1413
|
-
}),
|
|
1414
|
-
!disabled && !ofProperty && /* @__PURE__ */ jsxs(Button, {
|
|
1415
|
-
variant: "text",
|
|
1416
|
-
color: ofPropertyError ? "error" : "primary",
|
|
1417
|
-
onClick: () => setPropertyDialogOpen(true),
|
|
1418
|
-
children: ["Edit ", `${widget ? widget.name : "repeat component"}`]
|
|
1419
|
-
}),
|
|
1420
|
-
/* @__PURE__ */ jsx(PropertyFormDialog, {
|
|
1421
|
-
inArray: true,
|
|
1422
|
-
open: propertyDialogOpen,
|
|
1423
|
-
existingProperty: existing,
|
|
1424
|
-
getData,
|
|
1425
|
-
autoUpdateId: !existing,
|
|
1426
|
-
autoOpenTypeSelect: !existing,
|
|
1427
|
-
onOkClicked: () => setPropertyDialogOpen(false),
|
|
1428
|
-
allowDataInference,
|
|
1429
|
-
property: ofProperty,
|
|
1430
|
-
includeIdAndName: false,
|
|
1431
|
-
onPropertyChanged,
|
|
1432
|
-
forceShowErrors: showErrors,
|
|
1433
|
-
propertyConfigs
|
|
1434
|
-
})
|
|
1435
|
-
]
|
|
1436
|
-
})
|
|
1437
|
-
})]
|
|
1438
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
1439
|
-
className: "col-span-12",
|
|
1440
|
-
children: /* @__PURE__ */ jsx(ValidationPanel, { children: /* @__PURE__ */ jsx(ArrayPropertyValidation, { disabled }) })
|
|
1441
|
-
})] });
|
|
1442
|
-
}
|
|
1443
|
-
//#endregion
|
|
1444
|
-
//#region src/collection_editor/ui/collection_editor/properties/CommonPropertyFields.tsx
|
|
1445
|
-
var CommonPropertyFields = React.forwardRef(function CommonPropertyFields({ showErrors, disabledId, disabled, autoUpdateId, isNewProperty }, ref) {
|
|
1446
|
-
const { errors, values, setFieldValue, setFieldTouched, touched, validate } = useFormex();
|
|
1447
|
-
const { t } = useTranslation();
|
|
1448
|
-
const name = "name";
|
|
1449
|
-
const nameError = showErrors && getIn(errors, name);
|
|
1450
|
-
const id = "id";
|
|
1451
|
-
const idError = (showErrors || Boolean(getIn(touched, id))) && getIn(errors, id);
|
|
1452
|
-
const description = "description";
|
|
1453
|
-
const descriptionError = showErrors && getIn(errors, description);
|
|
1454
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
1455
|
-
className: "flex flex-col gap-2 col-span-12",
|
|
1456
|
-
children: [
|
|
1457
|
-
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Field, {
|
|
1458
|
-
name,
|
|
1459
|
-
inputRef: ref,
|
|
1460
|
-
as: DebouncedTextField,
|
|
1461
|
-
value: values[name],
|
|
1462
|
-
onChange: (e) => {
|
|
1463
|
-
const newNameValue = e.target.value;
|
|
1464
|
-
if (!getIn(touched, id) && autoUpdateId) setFieldValue(id, newNameValue ? toSnakeCase(newNameValue) : "", false);
|
|
1465
|
-
setFieldValue(name, newNameValue, true);
|
|
1466
|
-
setFieldTouched(name, true);
|
|
1467
|
-
},
|
|
1468
|
-
style: { fontSize: 20 },
|
|
1469
|
-
placeholder: t("field_name"),
|
|
1470
|
-
required: true,
|
|
1471
|
-
disabled,
|
|
1472
|
-
error: Boolean(nameError)
|
|
1473
|
-
}), /* @__PURE__ */ jsx(FieldCaption, {
|
|
1474
|
-
error: Boolean(nameError),
|
|
1475
|
-
children: nameError
|
|
1476
|
-
})] }),
|
|
1477
|
-
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(DebouncedTextField, {
|
|
1478
|
-
name: id,
|
|
1479
|
-
label: "ID",
|
|
1480
|
-
value: values[id],
|
|
1481
|
-
onChange: (e) => {
|
|
1482
|
-
const newIdValue = e.target.value;
|
|
1483
|
-
if (!getIn(touched, name) && autoUpdateId) setFieldValue(name, newIdValue ? prettifyIdentifier(newIdValue) : "");
|
|
1484
|
-
setFieldValue(id, newIdValue, true);
|
|
1485
|
-
setFieldTouched(id, true);
|
|
1486
|
-
},
|
|
1487
|
-
disabled: disabledId || disabled,
|
|
1488
|
-
required: true,
|
|
1489
|
-
size: "small",
|
|
1490
|
-
error: Boolean(idError)
|
|
1491
|
-
}), /* @__PURE__ */ jsx(FieldCaption, {
|
|
1492
|
-
error: Boolean(idError),
|
|
1493
|
-
children: idError
|
|
1494
|
-
})] }),
|
|
1495
|
-
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Field, {
|
|
1496
|
-
name: description,
|
|
1497
|
-
as: DebouncedTextField,
|
|
1498
|
-
label: t("description"),
|
|
1499
|
-
disabled,
|
|
1500
|
-
error: Boolean(descriptionError)
|
|
1501
|
-
}), /* @__PURE__ */ jsx(FieldCaption, {
|
|
1502
|
-
error: Boolean(descriptionError),
|
|
1503
|
-
children: descriptionError
|
|
1504
|
-
})] })
|
|
1505
|
-
]
|
|
1506
|
-
});
|
|
1507
|
-
});
|
|
1508
|
-
//#endregion
|
|
1509
|
-
//#region src/collection_editor/ui/collection_editor/properties/StringPropertyField.tsx
|
|
1510
|
-
function StringPropertyField({ widgetId, disabled, showErrors }) {
|
|
1511
|
-
const { values, setFieldValue, touched, errors } = useFormex();
|
|
1512
|
-
const { t } = useTranslation();
|
|
1513
|
-
const columnTypePath = "columnType";
|
|
1514
|
-
const columnTypeValue = getIn(values, columnTypePath);
|
|
1515
|
-
const columnTypeError = getIn(touched, columnTypePath) && getIn(errors, columnTypePath);
|
|
1516
|
-
const isIdPath = "isId";
|
|
1517
|
-
const isIdValue = getIn(values, isIdPath);
|
|
1518
|
-
const isIdError = getIn(touched, isIdPath) && getIn(errors, isIdPath);
|
|
1519
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1520
|
-
/* @__PURE__ */ jsx("div", {
|
|
1521
|
-
className: "col-span-12",
|
|
1522
|
-
children: /* @__PURE__ */ jsxs(ValidationPanel, { children: [
|
|
1523
|
-
widgetId === "text_field" && /* @__PURE__ */ jsx(StringPropertyValidation, {
|
|
1524
|
-
disabled,
|
|
1525
|
-
length: true,
|
|
1526
|
-
lowercase: true,
|
|
1527
|
-
matches: true,
|
|
1528
|
-
max: true,
|
|
1529
|
-
min: true,
|
|
1530
|
-
trim: true,
|
|
1531
|
-
uppercase: true,
|
|
1532
|
-
showErrors
|
|
1533
|
-
}),
|
|
1534
|
-
widgetId === "user_select" && /* @__PURE__ */ jsx(StringPropertyValidation, {
|
|
1535
|
-
disabled,
|
|
1536
|
-
showErrors
|
|
1537
|
-
}),
|
|
1538
|
-
widgetId === "multiline" && /* @__PURE__ */ jsx(StringPropertyValidation, {
|
|
1539
|
-
disabled,
|
|
1540
|
-
length: true,
|
|
1541
|
-
lowercase: true,
|
|
1542
|
-
max: true,
|
|
1543
|
-
min: true,
|
|
1544
|
-
trim: true,
|
|
1545
|
-
uppercase: true,
|
|
1546
|
-
showErrors
|
|
1547
|
-
}),
|
|
1548
|
-
widgetId === "email" && /* @__PURE__ */ jsx(StringPropertyValidation, {
|
|
1549
|
-
disabled,
|
|
1550
|
-
max: true,
|
|
1551
|
-
min: true,
|
|
1552
|
-
trim: true,
|
|
1553
|
-
showErrors
|
|
1554
|
-
})
|
|
1555
|
-
] })
|
|
1556
|
-
}),
|
|
1557
|
-
/* @__PURE__ */ jsxs("div", {
|
|
1558
|
-
className: "col-span-12",
|
|
1559
|
-
children: [/* @__PURE__ */ jsxs(Select, {
|
|
1560
|
-
name: columnTypePath,
|
|
1561
|
-
disabled: disabled || Boolean(isIdValue),
|
|
1562
|
-
fullWidth: true,
|
|
1563
|
-
value: isIdValue === "uuid" ? "uuid" : columnTypeValue ?? "_default_",
|
|
1564
|
-
onValueChange: (v) => setFieldValue(columnTypePath, v === "_default_" ? void 0 : v),
|
|
1565
|
-
renderValue: (v) => {
|
|
1566
|
-
if (isIdValue === "uuid") return "uuid (forced by Primary Key)";
|
|
1567
|
-
switch (v) {
|
|
1568
|
-
case "text": return "text (unlimited)";
|
|
1569
|
-
case "char": return "char (fixed length)";
|
|
1570
|
-
case "varchar": return "varchar (variable length)";
|
|
1571
|
-
case "_default_": return "Default (varchar)";
|
|
1572
|
-
default: return "Default (varchar)";
|
|
1573
|
-
}
|
|
1574
|
-
},
|
|
1575
|
-
error: Boolean(columnTypeError),
|
|
1576
|
-
label: t("db_column_type"),
|
|
1577
|
-
children: [
|
|
1578
|
-
isIdValue === "uuid" && /* @__PURE__ */ jsx(SelectItem, {
|
|
1579
|
-
value: "uuid",
|
|
1580
|
-
children: " uuid (forced by Primary Key) "
|
|
1581
|
-
}),
|
|
1582
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
1583
|
-
value: "_default_",
|
|
1584
|
-
children: " Default (varchar) "
|
|
1585
|
-
}),
|
|
1586
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
1587
|
-
value: "varchar",
|
|
1588
|
-
children: " varchar (variable length) "
|
|
1589
|
-
}),
|
|
1590
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
1591
|
-
value: "text",
|
|
1592
|
-
children: " text (unlimited) "
|
|
1593
|
-
}),
|
|
1594
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
1595
|
-
value: "char",
|
|
1596
|
-
children: " char (fixed length) "
|
|
1597
|
-
})
|
|
1598
|
-
]
|
|
1599
|
-
}), /* @__PURE__ */ jsx(FieldCaption, {
|
|
1600
|
-
error: Boolean(columnTypeError),
|
|
1601
|
-
children: columnTypeError ?? "Optional database override for this string field."
|
|
1602
|
-
})]
|
|
1603
|
-
}),
|
|
1604
|
-
/* @__PURE__ */ jsxs("div", {
|
|
1605
|
-
className: "col-span-12",
|
|
1606
|
-
children: [/* @__PURE__ */ jsxs(Select, {
|
|
1607
|
-
name: isIdPath,
|
|
1608
|
-
disabled,
|
|
1609
|
-
fullWidth: true,
|
|
1610
|
-
value: isIdValue === true ? "true" : isIdValue === false ? "false" : isIdValue ?? "_default_",
|
|
1611
|
-
onValueChange: (v) => {
|
|
1612
|
-
if (v === "_default_" || v === "false") setFieldValue(isIdPath, void 0);
|
|
1613
|
-
else if (v === "true") setFieldValue(isIdPath, true);
|
|
1614
|
-
else setFieldValue(isIdPath, v);
|
|
1615
|
-
},
|
|
1616
|
-
renderValue: (v) => {
|
|
1617
|
-
switch (v) {
|
|
1618
|
-
case "true": return "Yes (Auto-generated UUID/String)";
|
|
1619
|
-
case "manual": return "Yes (Manual input)";
|
|
1620
|
-
case "uuid": return "Yes (UUID)";
|
|
1621
|
-
case "cuid": return "Yes (CUID)";
|
|
1622
|
-
case "false":
|
|
1623
|
-
case "_default_": return "No";
|
|
1624
|
-
default: return `Yes (${v})`;
|
|
1625
|
-
}
|
|
1626
|
-
},
|
|
1627
|
-
error: Boolean(isIdError),
|
|
1628
|
-
label: t("primary_key_unique_id"),
|
|
1629
|
-
children: [
|
|
1630
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
1631
|
-
value: "_default_",
|
|
1632
|
-
children: " No "
|
|
1633
|
-
}),
|
|
1634
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
1635
|
-
value: "manual",
|
|
1636
|
-
children: " Yes (Manual input) "
|
|
1637
|
-
}),
|
|
1638
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
1639
|
-
value: "true",
|
|
1640
|
-
children: " Yes (Auto-generated UUID/String) "
|
|
1641
|
-
}),
|
|
1642
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
1643
|
-
value: "uuid",
|
|
1644
|
-
children: " Yes (UUID) "
|
|
1645
|
-
}),
|
|
1646
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
1647
|
-
value: "cuid",
|
|
1648
|
-
children: " Yes (CUID) "
|
|
1649
|
-
})
|
|
1650
|
-
]
|
|
1651
|
-
}), /* @__PURE__ */ jsx(FieldCaption, {
|
|
1652
|
-
error: Boolean(isIdError),
|
|
1653
|
-
children: isIdError ?? "Set as Primary Key and configure ID generation strategy."
|
|
1654
|
-
})]
|
|
1655
|
-
}),
|
|
1656
|
-
/* @__PURE__ */ jsx("div", {
|
|
1657
|
-
className: "col-span-12",
|
|
1658
|
-
children: /* @__PURE__ */ jsx(TextField, {
|
|
1659
|
-
name: "defaultValue",
|
|
1660
|
-
disabled,
|
|
1661
|
-
onChange: (e) => {
|
|
1662
|
-
setFieldValue("defaultValue", e.target.value === "" ? void 0 : e.target.value);
|
|
1663
|
-
},
|
|
1664
|
-
label: t("default_value"),
|
|
1665
|
-
value: getIn(values, "defaultValue") ?? ""
|
|
1666
|
-
})
|
|
1667
|
-
})
|
|
1668
|
-
] });
|
|
1669
|
-
}
|
|
1670
|
-
//#endregion
|
|
1671
|
-
//#region src/collection_editor/ui/collection_editor/properties/BooleanPropertyField.tsx
|
|
1672
|
-
function BooleanPropertyField({ disabled }) {
|
|
1673
|
-
const { values } = useFormex();
|
|
1674
|
-
const defaultValue = getIn(values, "defaultValue");
|
|
1675
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("div", {
|
|
1676
|
-
className: "col-span-12",
|
|
1677
|
-
children: /* @__PURE__ */ jsx(ValidationPanel, { children: /* @__PURE__ */ jsx(GeneralPropertyValidation, { disabled }) })
|
|
1678
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
1679
|
-
className: "col-span-12",
|
|
1680
|
-
children: /* @__PURE__ */ jsx(Field, {
|
|
1681
|
-
name: "defaultValue",
|
|
1682
|
-
children: ({ field, form }) => {
|
|
1683
|
-
return /* @__PURE__ */ jsx(SwitchControl, {
|
|
1684
|
-
size: "medium",
|
|
1685
|
-
label: defaultValue === null || defaultValue === void 0 ? "Default value not set" : "Default value is " + defaultValue.toString(),
|
|
1686
|
-
disabled,
|
|
1687
|
-
allowIndeterminate: true,
|
|
1688
|
-
field,
|
|
1689
|
-
form
|
|
1690
|
-
});
|
|
1691
|
-
}
|
|
1692
|
-
})
|
|
1693
|
-
})] });
|
|
1694
|
-
}
|
|
1695
|
-
//#endregion
|
|
1696
|
-
//#region src/collection_editor/ui/collection_editor/properties/BlockPropertyField.tsx
|
|
1697
|
-
function BlockPropertyField({ disabled, getData, allowDataInference, propertyConfigs }) {
|
|
1698
|
-
const { values, setFieldValue } = useFormex();
|
|
1699
|
-
const [propertyDialogOpen, setPropertyDialogOpen] = useState(false);
|
|
1700
|
-
const [selectedPropertyKey, setSelectedPropertyKey] = useState();
|
|
1701
|
-
const [selectedPropertyNamespace, setSelectedPropertyNamespace] = useState();
|
|
1702
|
-
const onPropertyChanged = ({ id, namespace, property }) => {
|
|
1703
|
-
if (!id) throw Error();
|
|
1704
|
-
setFieldValue("oneOf." + getFullIdPath(id, namespace), property, false);
|
|
1705
|
-
const currentPropertiesOrder = values.oneOf?.propertiesOrder ?? Object.keys(values.oneOf?.properties ?? {});
|
|
1706
|
-
const newPropertiesOrder = currentPropertiesOrder.includes(id) ? currentPropertiesOrder : [...currentPropertiesOrder, id];
|
|
1707
|
-
setFieldValue("oneOf." + namespaceToPropertiesOrderPath(namespace), newPropertiesOrder, false);
|
|
1708
|
-
setPropertyDialogOpen(false);
|
|
1709
|
-
};
|
|
1710
|
-
const selectedPropertyFullId = selectedPropertyKey ? getFullId(selectedPropertyKey, selectedPropertyNamespace) : void 0;
|
|
1711
|
-
const selectedProperty = selectedPropertyFullId ? getIn(values.oneOf?.properties, selectedPropertyFullId.replaceAll(".", ".properties.")) : void 0;
|
|
1712
|
-
const deleteProperty = (propertyKey, namespace) => {
|
|
1713
|
-
const fullId = propertyKey ? getFullId(propertyKey, namespace) : void 0;
|
|
1714
|
-
if (!fullId) throw Error("collection editor miss config");
|
|
1715
|
-
setFieldValue(`oneOf.${idToPropertiesPath(fullId)}`, void 0, false);
|
|
1716
|
-
const propertiesOrderPath = `oneOf.${namespaceToPropertiesOrderPath(namespace)}`;
|
|
1717
|
-
const currentPropertiesOrder = getIn(values, propertiesOrderPath) ?? Object.keys(getIn(values, namespaceToPropertiesPath(namespace)) ?? {});
|
|
1718
|
-
setFieldValue(propertiesOrderPath, currentPropertiesOrder.filter((p) => p !== propertyKey), false);
|
|
1719
|
-
setPropertyDialogOpen(false);
|
|
1720
|
-
setSelectedPropertyKey(void 0);
|
|
1721
|
-
setSelectedPropertyNamespace(void 0);
|
|
1722
|
-
};
|
|
1723
|
-
const addChildButton = /* @__PURE__ */ jsxs(Button, {
|
|
1724
|
-
autoFocus: true,
|
|
1725
|
-
onClick: () => setPropertyDialogOpen(true),
|
|
1726
|
-
startIcon: /* @__PURE__ */ jsx(PlusIcon, {}),
|
|
1727
|
-
children: ["Add property to ", values.name ?? "this block"]
|
|
1728
|
-
});
|
|
1729
|
-
const onPropertyMove = (propertiesOrder, namespace) => {
|
|
1730
|
-
setFieldValue(`oneOf.${namespaceToPropertiesOrderPath(namespace)}`, propertiesOrder, false);
|
|
1731
|
-
};
|
|
1732
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
|
|
1733
|
-
className: "col-span-12",
|
|
1734
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
1735
|
-
className: "flex justify-between items-end mt-8 mb-4",
|
|
1736
|
-
children: [/* @__PURE__ */ jsx(Typography, {
|
|
1737
|
-
variant: "subtitle2",
|
|
1738
|
-
children: "Properties in this block"
|
|
1739
|
-
}), addChildButton]
|
|
1740
|
-
}), /* @__PURE__ */ jsxs(Paper, {
|
|
1741
|
-
className: "p-2 pl-8",
|
|
1742
|
-
children: [/* @__PURE__ */ jsx(PropertyTree, {
|
|
1743
|
-
properties: values.oneOf?.properties ?? {},
|
|
1744
|
-
propertiesOrder: values.oneOf?.propertiesOrder,
|
|
1745
|
-
errors: {},
|
|
1746
|
-
onPropertyClick: disabled ? void 0 : (propertyKey, namespace) => {
|
|
1747
|
-
setSelectedPropertyKey(propertyKey);
|
|
1748
|
-
setSelectedPropertyNamespace(namespace);
|
|
1749
|
-
setPropertyDialogOpen(true);
|
|
1750
|
-
},
|
|
1751
|
-
onPropertyMove: disabled ? void 0 : onPropertyMove
|
|
1752
|
-
}), !disabled && values.oneOf?.propertiesOrder?.length === 0 && /* @__PURE__ */ jsx("div", {
|
|
1753
|
-
className: "h-full flex items-center justify-center p-4",
|
|
1754
|
-
children: "Add the first property to this block"
|
|
1755
|
-
})]
|
|
1756
|
-
})]
|
|
1757
|
-
}), !disabled && /* @__PURE__ */ jsx(PropertyFormDialog, {
|
|
1758
|
-
inArray: false,
|
|
1759
|
-
forceShowErrors: false,
|
|
1760
|
-
open: propertyDialogOpen,
|
|
1761
|
-
getData,
|
|
1762
|
-
allowDataInference,
|
|
1763
|
-
onCancel: () => {
|
|
1764
|
-
setPropertyDialogOpen(false);
|
|
1765
|
-
setSelectedPropertyKey(void 0);
|
|
1766
|
-
setSelectedPropertyNamespace(void 0);
|
|
1767
|
-
},
|
|
1768
|
-
onOkClicked: () => {
|
|
1769
|
-
setPropertyDialogOpen(false);
|
|
1770
|
-
setSelectedPropertyKey(void 0);
|
|
1771
|
-
setSelectedPropertyNamespace(void 0);
|
|
1772
|
-
},
|
|
1773
|
-
onDelete: deleteProperty,
|
|
1774
|
-
propertyKey: selectedPropertyKey,
|
|
1775
|
-
propertyNamespace: selectedPropertyNamespace,
|
|
1776
|
-
property: selectedProperty,
|
|
1777
|
-
existingProperty: Boolean(selectedPropertyKey),
|
|
1778
|
-
autoUpdateId: !selectedPropertyKey,
|
|
1779
|
-
autoOpenTypeSelect: !selectedPropertyKey,
|
|
1780
|
-
onPropertyChanged,
|
|
1781
|
-
existingPropertyKeys: selectedPropertyKey ? void 0 : values.oneOf?.propertiesOrder,
|
|
1782
|
-
propertyConfigs
|
|
1783
|
-
})] });
|
|
1784
|
-
}
|
|
1785
|
-
//#endregion
|
|
1786
|
-
//#region src/collection_editor/ui/collection_editor/properties/validation/NumberPropertyValidation.tsx
|
|
1787
|
-
function NumberPropertyValidation({ disabled }) {
|
|
1788
|
-
const { values, handleChange } = useFormex();
|
|
1789
|
-
const { t } = useTranslation();
|
|
1790
|
-
const validationMin = "validation.min";
|
|
1791
|
-
const validationMax = "validation.max";
|
|
1792
|
-
const validationLessThan = "validation.lessThan";
|
|
1793
|
-
const validationMoreThan = "validation.moreThan";
|
|
1794
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
1795
|
-
className: "grid grid-cols-12 gap-2",
|
|
1796
|
-
children: [
|
|
1797
|
-
/* @__PURE__ */ jsx(GeneralPropertyValidation, { disabled }),
|
|
1798
|
-
/* @__PURE__ */ jsx("div", {
|
|
1799
|
-
className: "col-span-6",
|
|
1800
|
-
children: /* @__PURE__ */ jsx(DebouncedTextField, {
|
|
1801
|
-
value: getIn(values, validationMin),
|
|
1802
|
-
label: t("min_value"),
|
|
1803
|
-
name: validationMin,
|
|
1804
|
-
type: "number",
|
|
1805
|
-
size: "small",
|
|
1806
|
-
disabled,
|
|
1807
|
-
onChange: handleChange
|
|
1808
|
-
})
|
|
1809
|
-
}),
|
|
1810
|
-
/* @__PURE__ */ jsx("div", {
|
|
1811
|
-
className: "col-span-6",
|
|
1812
|
-
children: /* @__PURE__ */ jsx(DebouncedTextField, {
|
|
1813
|
-
value: getIn(values, validationMax),
|
|
1814
|
-
label: t("max_value"),
|
|
1815
|
-
name: validationMax,
|
|
1816
|
-
type: "number",
|
|
1817
|
-
size: "small",
|
|
1818
|
-
disabled,
|
|
1819
|
-
onChange: handleChange
|
|
1820
|
-
})
|
|
1821
|
-
}),
|
|
1822
|
-
/* @__PURE__ */ jsx("div", {
|
|
1823
|
-
className: "col-span-6",
|
|
1824
|
-
children: /* @__PURE__ */ jsx(DebouncedTextField, {
|
|
1825
|
-
value: getIn(values, validationLessThan),
|
|
1826
|
-
label: t("less_than"),
|
|
1827
|
-
name: validationLessThan,
|
|
1828
|
-
type: "number",
|
|
1829
|
-
size: "small",
|
|
1830
|
-
disabled,
|
|
1831
|
-
onChange: handleChange
|
|
1832
|
-
})
|
|
1833
|
-
}),
|
|
1834
|
-
/* @__PURE__ */ jsx("div", {
|
|
1835
|
-
className: "col-span-6",
|
|
1836
|
-
children: /* @__PURE__ */ jsx(DebouncedTextField, {
|
|
1837
|
-
value: getIn(values, validationMoreThan),
|
|
1838
|
-
label: t("more_than"),
|
|
1839
|
-
name: validationMoreThan,
|
|
1840
|
-
type: "number",
|
|
1841
|
-
size: "small",
|
|
1842
|
-
disabled,
|
|
1843
|
-
onChange: handleChange
|
|
1844
|
-
})
|
|
1845
|
-
}),
|
|
1846
|
-
/* @__PURE__ */ jsx("div", {
|
|
1847
|
-
className: "col-span-4",
|
|
1848
|
-
children: /* @__PURE__ */ jsx(Field, {
|
|
1849
|
-
name: "validation.positive",
|
|
1850
|
-
type: "checkbox",
|
|
1851
|
-
children: ({ field, form }) => {
|
|
1852
|
-
return /* @__PURE__ */ jsx(SwitchControl, {
|
|
1853
|
-
label: t("positive_value"),
|
|
1854
|
-
disabled,
|
|
1855
|
-
form,
|
|
1856
|
-
field
|
|
1857
|
-
});
|
|
1858
|
-
}
|
|
1859
|
-
})
|
|
1860
|
-
}),
|
|
1861
|
-
/* @__PURE__ */ jsx("div", {
|
|
1862
|
-
className: "col-span-4",
|
|
1863
|
-
children: /* @__PURE__ */ jsx(Field, {
|
|
1864
|
-
name: "validation.negative",
|
|
1865
|
-
type: "checkbox",
|
|
1866
|
-
children: ({ field, form }) => {
|
|
1867
|
-
return /* @__PURE__ */ jsx(SwitchControl, {
|
|
1868
|
-
label: t("negative_value"),
|
|
1869
|
-
disabled,
|
|
1870
|
-
form,
|
|
1871
|
-
field
|
|
1872
|
-
});
|
|
1873
|
-
}
|
|
1874
|
-
})
|
|
1875
|
-
}),
|
|
1876
|
-
/* @__PURE__ */ jsx("div", {
|
|
1877
|
-
className: "col-span-4",
|
|
1878
|
-
children: /* @__PURE__ */ jsx(Field, {
|
|
1879
|
-
name: "validation.integer",
|
|
1880
|
-
type: "checkbox",
|
|
1881
|
-
children: ({ field, form }) => {
|
|
1882
|
-
return /* @__PURE__ */ jsx(SwitchControl, {
|
|
1883
|
-
label: t("integer_value"),
|
|
1884
|
-
disabled,
|
|
1885
|
-
form,
|
|
1886
|
-
field
|
|
1887
|
-
});
|
|
1888
|
-
}
|
|
1889
|
-
})
|
|
1890
|
-
})
|
|
1891
|
-
]
|
|
1892
|
-
});
|
|
1893
|
-
}
|
|
1894
|
-
//#endregion
|
|
1895
|
-
//#region src/collection_editor/ui/collection_editor/properties/NumberPropertyField.tsx
|
|
1896
|
-
function NumberPropertyField({ disabled }) {
|
|
1897
|
-
const { values, setFieldValue, touched, errors } = useFormex();
|
|
1898
|
-
const { t } = useTranslation();
|
|
1899
|
-
const columnTypePath = "columnType";
|
|
1900
|
-
const columnTypeValue = getIn(values, columnTypePath);
|
|
1901
|
-
const columnTypeError = getIn(touched, columnTypePath) && getIn(errors, columnTypePath);
|
|
1902
|
-
const isIdPath = "isId";
|
|
1903
|
-
const isIdValue = getIn(values, isIdPath);
|
|
1904
|
-
const isIdError = getIn(touched, isIdPath) && getIn(errors, isIdPath);
|
|
1905
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1906
|
-
/* @__PURE__ */ jsx("div", {
|
|
1907
|
-
className: "col-span-12",
|
|
1908
|
-
children: /* @__PURE__ */ jsx(ValidationPanel, { children: /* @__PURE__ */ jsx(NumberPropertyValidation, { disabled }) })
|
|
1909
|
-
}),
|
|
1910
|
-
/* @__PURE__ */ jsxs("div", {
|
|
1911
|
-
className: "col-span-12",
|
|
1912
|
-
children: [/* @__PURE__ */ jsxs(Select, {
|
|
1913
|
-
name: columnTypePath,
|
|
1914
|
-
disabled: disabled || Boolean(isIdValue),
|
|
1915
|
-
fullWidth: true,
|
|
1916
|
-
value: columnTypeValue ?? "_default_",
|
|
1917
|
-
onValueChange: (v) => setFieldValue(columnTypePath, v === "_default_" ? void 0 : v),
|
|
1918
|
-
renderValue: (v) => {
|
|
1919
|
-
switch (v) {
|
|
1920
|
-
case "integer": return "integer";
|
|
1921
|
-
case "real": return "real (float4)";
|
|
1922
|
-
case "double precision": return "double precision (float8)";
|
|
1923
|
-
case "numeric": return "numeric / decimal";
|
|
1924
|
-
case "bigint": return "bigint";
|
|
1925
|
-
case "serial": return "serial";
|
|
1926
|
-
case "bigserial": return "bigserial";
|
|
1927
|
-
case "_default_": return "Default (integer/numeric)";
|
|
1928
|
-
default: return "Default (integer/numeric)";
|
|
1929
|
-
}
|
|
1930
|
-
},
|
|
1931
|
-
error: Boolean(columnTypeError),
|
|
1932
|
-
label: t("db_column_type"),
|
|
1933
|
-
children: [
|
|
1934
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
1935
|
-
value: "_default_",
|
|
1936
|
-
children: " Default (integer/numeric) "
|
|
1937
|
-
}),
|
|
1938
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
1939
|
-
value: "integer",
|
|
1940
|
-
children: " integer "
|
|
1941
|
-
}),
|
|
1942
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
1943
|
-
value: "real",
|
|
1944
|
-
children: " real (float4) "
|
|
1945
|
-
}),
|
|
1946
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
1947
|
-
value: "double precision",
|
|
1948
|
-
children: " double precision (float8) "
|
|
1949
|
-
}),
|
|
1950
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
1951
|
-
value: "numeric",
|
|
1952
|
-
children: " numeric / decimal "
|
|
1953
|
-
}),
|
|
1954
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
1955
|
-
value: "bigint",
|
|
1956
|
-
children: " bigint "
|
|
1957
|
-
}),
|
|
1958
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
1959
|
-
value: "serial",
|
|
1960
|
-
children: " serial "
|
|
1961
|
-
}),
|
|
1962
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
1963
|
-
value: "bigserial",
|
|
1964
|
-
children: " bigserial "
|
|
1965
|
-
})
|
|
1966
|
-
]
|
|
1967
|
-
}), /* @__PURE__ */ jsx(FieldCaption, {
|
|
1968
|
-
error: Boolean(columnTypeError),
|
|
1969
|
-
children: columnTypeError ?? "Optional database override for this number field."
|
|
1970
|
-
})]
|
|
1971
|
-
}),
|
|
1972
|
-
/* @__PURE__ */ jsxs("div", {
|
|
1973
|
-
className: "col-span-12",
|
|
1974
|
-
children: [/* @__PURE__ */ jsxs(Select, {
|
|
1975
|
-
name: isIdPath,
|
|
1976
|
-
disabled,
|
|
1977
|
-
fullWidth: true,
|
|
1978
|
-
value: isIdValue === true ? "true" : isIdValue === false ? "false" : isIdValue ?? "_default_",
|
|
1979
|
-
onValueChange: (v) => {
|
|
1980
|
-
if (v === "_default_" || v === "false") setFieldValue(isIdPath, void 0);
|
|
1981
|
-
else if (v === "true") setFieldValue(isIdPath, true);
|
|
1982
|
-
else setFieldValue(isIdPath, v);
|
|
1983
|
-
},
|
|
1984
|
-
renderValue: (v) => {
|
|
1985
|
-
switch (v) {
|
|
1986
|
-
case "true": return "Yes (Auto-increment/identity)";
|
|
1987
|
-
case "increment": return "Yes (Increment)";
|
|
1988
|
-
case "manual": return "Yes (Manual input)";
|
|
1989
|
-
case "false":
|
|
1990
|
-
case "_default_": return "No";
|
|
1991
|
-
default: return `Yes (${v})`;
|
|
1992
|
-
}
|
|
1993
|
-
},
|
|
1994
|
-
error: Boolean(isIdError),
|
|
1995
|
-
label: t("primary_key_unique_id"),
|
|
1996
|
-
children: [
|
|
1997
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
1998
|
-
value: "_default_",
|
|
1999
|
-
children: " No "
|
|
2000
|
-
}),
|
|
2001
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
2002
|
-
value: "manual",
|
|
2003
|
-
children: " Yes (Manual input) "
|
|
2004
|
-
}),
|
|
2005
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
2006
|
-
value: "true",
|
|
2007
|
-
children: " Yes (Auto-increment/identity) "
|
|
2008
|
-
}),
|
|
2009
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
2010
|
-
value: "increment",
|
|
2011
|
-
children: " Yes (Increment) "
|
|
2012
|
-
})
|
|
2013
|
-
]
|
|
2014
|
-
}), /* @__PURE__ */ jsx(FieldCaption, {
|
|
2015
|
-
error: Boolean(isIdError),
|
|
2016
|
-
children: isIdError ?? "Set as Primary Key and configure ID generation strategy."
|
|
2017
|
-
})]
|
|
2018
|
-
}),
|
|
2019
|
-
/* @__PURE__ */ jsx("div", {
|
|
2020
|
-
className: "col-span-12",
|
|
2021
|
-
children: /* @__PURE__ */ jsx(TextField, {
|
|
2022
|
-
name: "defaultValue",
|
|
2023
|
-
disabled,
|
|
2024
|
-
type: "number",
|
|
2025
|
-
onChange: (e) => {
|
|
2026
|
-
setFieldValue("defaultValue", e.target.value === "" ? void 0 : parseFloat(e.target.value));
|
|
2027
|
-
},
|
|
2028
|
-
label: t("default_value"),
|
|
2029
|
-
value: getIn(values, "defaultValue") ?? ""
|
|
2030
|
-
})
|
|
2031
|
-
})
|
|
2032
|
-
] });
|
|
2033
|
-
}
|
|
2034
|
-
//#endregion
|
|
2035
|
-
//#region src/collection_editor/ui/collection_editor/properties/ReferencePropertyField.tsx
|
|
2036
|
-
function ReferencePropertyField({ existing, multiple, disabled, showErrors, asString }) {
|
|
2037
|
-
const { values, errors, setFieldValue } = useFormex();
|
|
2038
|
-
if (!useCollectionRegistryController().initialised) return /* @__PURE__ */ jsx("div", {
|
|
2039
|
-
className: "col-span-12",
|
|
2040
|
-
children: /* @__PURE__ */ jsx(CircularProgress, {})
|
|
2041
|
-
});
|
|
2042
|
-
const pathPath = asString ? "reference.slug" : multiple ? "of.slug" : "path";
|
|
2043
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", {
|
|
2044
|
-
className: "col-span-12",
|
|
2045
|
-
children: /* @__PURE__ */ jsx(Field, {
|
|
2046
|
-
name: pathPath,
|
|
2047
|
-
pathPath,
|
|
2048
|
-
type: "select",
|
|
2049
|
-
disabled,
|
|
2050
|
-
value: getIn(values, pathPath),
|
|
2051
|
-
error: showErrors && getIn(errors, pathPath),
|
|
2052
|
-
setFieldValue,
|
|
2053
|
-
as: CollectionsSelect
|
|
2054
|
-
})
|
|
2055
|
-
}) });
|
|
2056
|
-
}
|
|
2057
|
-
function CollectionsSelect({ disabled, pathPath, value, setFieldValue, error, ...props }) {
|
|
2058
|
-
const collectionRegistry = useCollectionRegistryController();
|
|
2059
|
-
const { t } = useTranslation();
|
|
2060
|
-
if (!collectionRegistry.initialised) return /* @__PURE__ */ jsx("div", {
|
|
2061
|
-
className: "col-span-12",
|
|
2062
|
-
children: /* @__PURE__ */ jsx(CircularProgress, {})
|
|
2063
|
-
});
|
|
2064
|
-
const collections = collectionRegistry.collections ?? [];
|
|
2065
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Select, {
|
|
2066
|
-
error: Boolean(error),
|
|
2067
|
-
disabled,
|
|
2068
|
-
value: value ?? "",
|
|
2069
|
-
position: "item-aligned",
|
|
2070
|
-
name: pathPath,
|
|
2071
|
-
fullWidth: true,
|
|
2072
|
-
onChange: (e) => setFieldValue(pathPath, e.target.value),
|
|
2073
|
-
label: t("target_collection"),
|
|
2074
|
-
renderValue: (selected) => {
|
|
2075
|
-
const selectedCollection = collections.find((collection) => collection.slug === selected);
|
|
2076
|
-
if (!selectedCollection) return null;
|
|
2077
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
2078
|
-
className: "flex flex-row",
|
|
2079
|
-
children: [/* @__PURE__ */ jsx(IconForView, { collectionOrView: selectedCollection }), /* @__PURE__ */ jsx(Typography, {
|
|
2080
|
-
variant: "subtitle2",
|
|
2081
|
-
className: "ml-4",
|
|
2082
|
-
children: selectedCollection?.name.toUpperCase()
|
|
2083
|
-
})]
|
|
2084
|
-
});
|
|
2085
|
-
},
|
|
2086
|
-
...props,
|
|
2087
|
-
children: collections.map((collection) => {
|
|
2088
|
-
return /* @__PURE__ */ jsx(SelectItem, {
|
|
2089
|
-
value: collection.slug,
|
|
2090
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
2091
|
-
className: "flex flex-row",
|
|
2092
|
-
children: [/* @__PURE__ */ jsx(IconForView, { collectionOrView: collection }), /* @__PURE__ */ jsx(Typography, {
|
|
2093
|
-
variant: "subtitle2",
|
|
2094
|
-
className: "ml-4",
|
|
2095
|
-
children: collection?.name.toUpperCase()
|
|
2096
|
-
})]
|
|
2097
|
-
})
|
|
2098
|
-
}, collection.slug);
|
|
2099
|
-
})
|
|
2100
|
-
}) });
|
|
2101
|
-
}
|
|
2102
|
-
//#endregion
|
|
2103
|
-
//#region src/collection_editor/ui/collection_editor/properties/DateTimePropertyField.tsx
|
|
2104
|
-
var TIMEZONES = [
|
|
2105
|
-
{
|
|
2106
|
-
value: "UTC",
|
|
2107
|
-
label: "UTC (Coordinated Universal Time)"
|
|
2108
|
-
},
|
|
2109
|
-
{
|
|
2110
|
-
value: "America/New_York",
|
|
2111
|
-
label: "New York (US Eastern)"
|
|
2112
|
-
},
|
|
2113
|
-
{
|
|
2114
|
-
value: "America/Chicago",
|
|
2115
|
-
label: "Chicago (US Central)"
|
|
2116
|
-
},
|
|
2117
|
-
{
|
|
2118
|
-
value: "America/Denver",
|
|
2119
|
-
label: "Denver (US Mountain)"
|
|
2120
|
-
},
|
|
2121
|
-
{
|
|
2122
|
-
value: "America/Los_Angeles",
|
|
2123
|
-
label: "Los Angeles (US Pacific)"
|
|
2124
|
-
},
|
|
2125
|
-
{
|
|
2126
|
-
value: "America/Anchorage",
|
|
2127
|
-
label: "Anchorage (Alaska)"
|
|
2128
|
-
},
|
|
2129
|
-
{
|
|
2130
|
-
value: "America/Toronto",
|
|
2131
|
-
label: "Toronto (Canada Eastern)"
|
|
2132
|
-
},
|
|
2133
|
-
{
|
|
2134
|
-
value: "America/Vancouver",
|
|
2135
|
-
label: "Vancouver (Canada Pacific)"
|
|
2136
|
-
},
|
|
2137
|
-
{
|
|
2138
|
-
value: "America/Mexico_City",
|
|
2139
|
-
label: "Mexico City"
|
|
2140
|
-
},
|
|
2141
|
-
{
|
|
2142
|
-
value: "America/Sao_Paulo",
|
|
2143
|
-
label: "São Paulo (Brazil)"
|
|
2144
|
-
},
|
|
2145
|
-
{
|
|
2146
|
-
value: "America/Buenos_Aires",
|
|
2147
|
-
label: "Buenos Aires (Argentina)"
|
|
2148
|
-
},
|
|
2149
|
-
{
|
|
2150
|
-
value: "Europe/London",
|
|
2151
|
-
label: "London (UK)"
|
|
2152
|
-
},
|
|
2153
|
-
{
|
|
2154
|
-
value: "Europe/Paris",
|
|
2155
|
-
label: "Paris (France)"
|
|
2156
|
-
},
|
|
2157
|
-
{
|
|
2158
|
-
value: "Europe/Berlin",
|
|
2159
|
-
label: "Berlin (Germany)"
|
|
2160
|
-
},
|
|
2161
|
-
{
|
|
2162
|
-
value: "Europe/Madrid",
|
|
2163
|
-
label: "Madrid (Spain)"
|
|
2164
|
-
},
|
|
2165
|
-
{
|
|
2166
|
-
value: "Europe/Rome",
|
|
2167
|
-
label: "Rome (Italy)"
|
|
2168
|
-
},
|
|
2169
|
-
{
|
|
2170
|
-
value: "Europe/Amsterdam",
|
|
2171
|
-
label: "Amsterdam (Netherlands)"
|
|
2172
|
-
},
|
|
2173
|
-
{
|
|
2174
|
-
value: "Europe/Brussels",
|
|
2175
|
-
label: "Brussels (Belgium)"
|
|
2176
|
-
},
|
|
2177
|
-
{
|
|
2178
|
-
value: "Europe/Zurich",
|
|
2179
|
-
label: "Zurich (Switzerland)"
|
|
2180
|
-
},
|
|
2181
|
-
{
|
|
2182
|
-
value: "Europe/Stockholm",
|
|
2183
|
-
label: "Stockholm (Sweden)"
|
|
2184
|
-
},
|
|
2185
|
-
{
|
|
2186
|
-
value: "Europe/Vienna",
|
|
2187
|
-
label: "Vienna (Austria)"
|
|
2188
|
-
},
|
|
2189
|
-
{
|
|
2190
|
-
value: "Europe/Warsaw",
|
|
2191
|
-
label: "Warsaw (Poland)"
|
|
2192
|
-
},
|
|
2193
|
-
{
|
|
2194
|
-
value: "Europe/Prague",
|
|
2195
|
-
label: "Prague (Czech Republic)"
|
|
2196
|
-
},
|
|
2197
|
-
{
|
|
2198
|
-
value: "Europe/Athens",
|
|
2199
|
-
label: "Athens (Greece)"
|
|
2200
|
-
},
|
|
2201
|
-
{
|
|
2202
|
-
value: "Europe/Moscow",
|
|
2203
|
-
label: "Moscow (Russia)"
|
|
2204
|
-
},
|
|
2205
|
-
{
|
|
2206
|
-
value: "Europe/Istanbul",
|
|
2207
|
-
label: "Istanbul (Turkey)"
|
|
2208
|
-
},
|
|
2209
|
-
{
|
|
2210
|
-
value: "Asia/Dubai",
|
|
2211
|
-
label: "Dubai (UAE)"
|
|
2212
|
-
},
|
|
2213
|
-
{
|
|
2214
|
-
value: "Asia/Kolkata",
|
|
2215
|
-
label: "Mumbai / Delhi (India)"
|
|
2216
|
-
},
|
|
2217
|
-
{
|
|
2218
|
-
value: "Asia/Bangkok",
|
|
2219
|
-
label: "Bangkok (Thailand)"
|
|
2220
|
-
},
|
|
2221
|
-
{
|
|
2222
|
-
value: "Asia/Singapore",
|
|
2223
|
-
label: "Singapore"
|
|
2224
|
-
},
|
|
2225
|
-
{
|
|
2226
|
-
value: "Asia/Hong_Kong",
|
|
2227
|
-
label: "Hong Kong"
|
|
2228
|
-
},
|
|
2229
|
-
{
|
|
2230
|
-
value: "Asia/Shanghai",
|
|
2231
|
-
label: "Shanghai (China)"
|
|
2232
|
-
},
|
|
2233
|
-
{
|
|
2234
|
-
value: "Asia/Tokyo",
|
|
2235
|
-
label: "Tokyo (Japan)"
|
|
2236
|
-
},
|
|
2237
|
-
{
|
|
2238
|
-
value: "Asia/Seoul",
|
|
2239
|
-
label: "Seoul (South Korea)"
|
|
2240
|
-
},
|
|
2241
|
-
{
|
|
2242
|
-
value: "Asia/Jakarta",
|
|
2243
|
-
label: "Jakarta (Indonesia)"
|
|
2244
|
-
},
|
|
2245
|
-
{
|
|
2246
|
-
value: "Australia/Sydney",
|
|
2247
|
-
label: "Sydney (Australia Eastern)"
|
|
2248
|
-
},
|
|
2249
|
-
{
|
|
2250
|
-
value: "Australia/Melbourne",
|
|
2251
|
-
label: "Melbourne (Australia)"
|
|
2252
|
-
},
|
|
2253
|
-
{
|
|
2254
|
-
value: "Australia/Brisbane",
|
|
2255
|
-
label: "Brisbane (Australia)"
|
|
2256
|
-
},
|
|
2257
|
-
{
|
|
2258
|
-
value: "Australia/Perth",
|
|
2259
|
-
label: "Perth (Australia Western)"
|
|
2260
|
-
},
|
|
2261
|
-
{
|
|
2262
|
-
value: "Pacific/Auckland",
|
|
2263
|
-
label: "Auckland (New Zealand)"
|
|
2264
|
-
},
|
|
2265
|
-
{
|
|
2266
|
-
value: "Africa/Cairo",
|
|
2267
|
-
label: "Cairo (Egypt)"
|
|
2268
|
-
},
|
|
2269
|
-
{
|
|
2270
|
-
value: "Africa/Johannesburg",
|
|
2271
|
-
label: "Johannesburg (South Africa)"
|
|
2272
|
-
},
|
|
2273
|
-
{
|
|
2274
|
-
value: "Africa/Lagos",
|
|
2275
|
-
label: "Lagos (Nigeria)"
|
|
2276
|
-
}
|
|
2277
|
-
];
|
|
2278
|
-
function DateTimePropertyField({ disabled }) {
|
|
2279
|
-
const { values, errors, touched, setFieldValue } = useFormex();
|
|
2280
|
-
const { t } = useTranslation();
|
|
2281
|
-
const modePath = "mode";
|
|
2282
|
-
const modeValue = getIn(values, modePath);
|
|
2283
|
-
const modeError = getIn(touched, modePath) && getIn(errors, modePath);
|
|
2284
|
-
const autoValuePath = "autoValue";
|
|
2285
|
-
const autoValueValue = getIn(values, autoValuePath);
|
|
2286
|
-
const autoValueError = getIn(touched, autoValuePath) && getIn(errors, autoValuePath);
|
|
2287
|
-
const timezonePath = "timezone";
|
|
2288
|
-
const timezoneValue = getIn(values, timezonePath);
|
|
2289
|
-
const timezoneError = getIn(touched, timezonePath) && getIn(errors, timezonePath);
|
|
2290
|
-
const columnTypePath = "columnType";
|
|
2291
|
-
const columnTypeValue = getIn(values, columnTypePath);
|
|
2292
|
-
const columnTypeError = getIn(touched, columnTypePath) && getIn(errors, columnTypePath);
|
|
2293
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2294
|
-
/* @__PURE__ */ jsxs("div", {
|
|
2295
|
-
className: "flex flex-col col-span-12 gap-2",
|
|
2296
|
-
children: [
|
|
2297
|
-
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs(Select, {
|
|
2298
|
-
name: modePath,
|
|
2299
|
-
value: modeValue ?? "date",
|
|
2300
|
-
error: Boolean(modeError),
|
|
2301
|
-
onValueChange: (v) => setFieldValue(modePath, v),
|
|
2302
|
-
label: t("mode"),
|
|
2303
|
-
fullWidth: true,
|
|
2304
|
-
renderValue: (v) => {
|
|
2305
|
-
switch (v) {
|
|
2306
|
-
case "date_time": return "Date/Time";
|
|
2307
|
-
case "date": return "Date";
|
|
2308
|
-
default: return "";
|
|
2309
|
-
}
|
|
2310
|
-
},
|
|
2311
|
-
disabled,
|
|
2312
|
-
children: [/* @__PURE__ */ jsx(SelectItem, {
|
|
2313
|
-
value: "date_time",
|
|
2314
|
-
children: " Date/Time "
|
|
2315
|
-
}), /* @__PURE__ */ jsx(SelectItem, {
|
|
2316
|
-
value: "date",
|
|
2317
|
-
children: " Date "
|
|
2318
|
-
})]
|
|
2319
|
-
}), /* @__PURE__ */ jsx(FieldCaption, {
|
|
2320
|
-
error: Boolean(modeError),
|
|
2321
|
-
children: modeError
|
|
2322
|
-
})] }),
|
|
2323
|
-
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs(Select, {
|
|
2324
|
-
name: autoValuePath,
|
|
2325
|
-
disabled,
|
|
2326
|
-
fullWidth: true,
|
|
2327
|
-
value: autoValueValue ?? "",
|
|
2328
|
-
onValueChange: (v) => setFieldValue(autoValuePath, v === "none" ? null : v),
|
|
2329
|
-
renderValue: (v) => {
|
|
2330
|
-
switch (v) {
|
|
2331
|
-
case "on_create": return "On create";
|
|
2332
|
-
case "on_update": return "On any update";
|
|
2333
|
-
default: return "None";
|
|
2334
|
-
}
|
|
2335
|
-
},
|
|
2336
|
-
error: Boolean(autoValueError),
|
|
2337
|
-
label: t("datetime_automatic_value"),
|
|
2338
|
-
children: [
|
|
2339
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
2340
|
-
value: "none",
|
|
2341
|
-
children: " None "
|
|
2342
|
-
}),
|
|
2343
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
2344
|
-
value: "on_create",
|
|
2345
|
-
children: " On create "
|
|
2346
|
-
}),
|
|
2347
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
2348
|
-
value: "on_update",
|
|
2349
|
-
children: " On any update "
|
|
2350
|
-
})
|
|
2351
|
-
]
|
|
2352
|
-
}), /* @__PURE__ */ jsx(FieldCaption, {
|
|
2353
|
-
error: Boolean(autoValueError),
|
|
2354
|
-
children: autoValueError ?? "Update this field automatically when creating or updating the entity"
|
|
2355
|
-
})] }),
|
|
2356
|
-
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs(Select, {
|
|
2357
|
-
name: timezonePath,
|
|
2358
|
-
disabled,
|
|
2359
|
-
fullWidth: true,
|
|
2360
|
-
value: timezoneValue ?? "__local__",
|
|
2361
|
-
onValueChange: (v) => setFieldValue(timezonePath, v === "__local__" ? void 0 : v),
|
|
2362
|
-
renderValue: (v) => {
|
|
2363
|
-
if (!v || v === "__local__") return "Local timezone";
|
|
2364
|
-
return TIMEZONES.find((t) => t.value === v)?.label ?? v;
|
|
2365
|
-
},
|
|
2366
|
-
error: Boolean(timezoneError),
|
|
2367
|
-
label: t("timezone"),
|
|
2368
|
-
children: [/* @__PURE__ */ jsx(SelectItem, {
|
|
2369
|
-
value: "__local__",
|
|
2370
|
-
children: " Local timezone "
|
|
2371
|
-
}), TIMEZONES.map((tz) => /* @__PURE__ */ jsx(SelectItem, {
|
|
2372
|
-
value: tz.value,
|
|
2373
|
-
children: tz.label
|
|
2374
|
-
}, tz.value))]
|
|
2375
|
-
}), /* @__PURE__ */ jsx(FieldCaption, {
|
|
2376
|
-
error: Boolean(timezoneError),
|
|
2377
|
-
children: timezoneError ?? "Timezone for displaying and inputting dates. Values are always stored in UTC."
|
|
2378
|
-
})] })
|
|
2379
|
-
]
|
|
2380
|
-
}),
|
|
2381
|
-
/* @__PURE__ */ jsxs("div", {
|
|
2382
|
-
className: "col-span-12",
|
|
2383
|
-
children: [/* @__PURE__ */ jsxs(Select, {
|
|
2384
|
-
name: columnTypePath,
|
|
2385
|
-
disabled,
|
|
2386
|
-
fullWidth: true,
|
|
2387
|
-
value: columnTypeValue ?? "_default_",
|
|
2388
|
-
onValueChange: (v) => setFieldValue(columnTypePath, v === "_default_" ? void 0 : v),
|
|
2389
|
-
renderValue: (v) => {
|
|
2390
|
-
switch (v) {
|
|
2391
|
-
case "timestamp": return "timestamp (with timezone)";
|
|
2392
|
-
case "date": return "date";
|
|
2393
|
-
case "time": return "time";
|
|
2394
|
-
case "_default_": return "Default (timestamp)";
|
|
2395
|
-
default: return "Default (timestamp)";
|
|
2396
|
-
}
|
|
2397
|
-
},
|
|
2398
|
-
error: Boolean(columnTypeError),
|
|
2399
|
-
label: t("db_column_type"),
|
|
2400
|
-
children: [
|
|
2401
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
2402
|
-
value: "_default_",
|
|
2403
|
-
children: " Default (timestamp) "
|
|
2404
|
-
}),
|
|
2405
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
2406
|
-
value: "timestamp",
|
|
2407
|
-
children: " timestamp (with timezone) "
|
|
2408
|
-
}),
|
|
2409
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
2410
|
-
value: "date",
|
|
2411
|
-
children: " date "
|
|
2412
|
-
}),
|
|
2413
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
2414
|
-
value: "time",
|
|
2415
|
-
children: " time "
|
|
2416
|
-
})
|
|
2417
|
-
]
|
|
2418
|
-
}), /* @__PURE__ */ jsx(FieldCaption, {
|
|
2419
|
-
error: Boolean(columnTypeError),
|
|
2420
|
-
children: columnTypeError ?? "Optional database override for this date field."
|
|
2421
|
-
})]
|
|
2422
|
-
}),
|
|
2423
|
-
/* @__PURE__ */ jsx("div", {
|
|
2424
|
-
className: "col-span-12",
|
|
2425
|
-
children: /* @__PURE__ */ jsx(ValidationPanel, { children: /* @__PURE__ */ jsx(GeneralPropertyValidation, { disabled }) })
|
|
2426
|
-
})
|
|
2427
|
-
] });
|
|
2428
|
-
}
|
|
2429
|
-
//#endregion
|
|
2430
|
-
//#region src/collection_editor/ui/collection_editor/properties/advanced/AdvancedPropertyValidation.tsx
|
|
2431
|
-
function AdvancedPropertyValidation({ disabled }) {
|
|
2432
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
2433
|
-
className: "grid grid-cols-12 gap-2",
|
|
2434
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
2435
|
-
className: "col-span-12",
|
|
2436
|
-
children: /* @__PURE__ */ jsx(Field, {
|
|
2437
|
-
type: "checkbox",
|
|
2438
|
-
name: "admin.hideFromCollection",
|
|
2439
|
-
children: ({ field, form }) => {
|
|
2440
|
-
return /* @__PURE__ */ jsx(SwitchControl, {
|
|
2441
|
-
label: "Hide from collection",
|
|
2442
|
-
size: "small",
|
|
2443
|
-
disabled,
|
|
2444
|
-
form,
|
|
2445
|
-
tooltip: "Hide this field from the collection view. It will still be visible in the form view",
|
|
2446
|
-
field
|
|
2447
|
-
});
|
|
2448
|
-
}
|
|
2449
|
-
})
|
|
2450
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
2451
|
-
className: "col-span-12",
|
|
2452
|
-
children: /* @__PURE__ */ jsx(Field, {
|
|
2453
|
-
name: "admin.readOnly",
|
|
2454
|
-
type: "checkbox",
|
|
2455
|
-
children: ({ field, form }) => {
|
|
2456
|
-
return /* @__PURE__ */ jsx(SwitchControl, {
|
|
2457
|
-
label: "Read only",
|
|
2458
|
-
size: "small",
|
|
2459
|
-
disabled,
|
|
2460
|
-
tooltip: "Is this a read only field. Display only as a preview",
|
|
2461
|
-
form,
|
|
2462
|
-
field
|
|
2463
|
-
});
|
|
2464
|
-
}
|
|
2465
|
-
})
|
|
2466
|
-
})]
|
|
2467
|
-
});
|
|
2468
|
-
}
|
|
2469
|
-
//#endregion
|
|
2470
|
-
//#region src/collection_editor/ui/collection_editor/properties/VectorPropertyField.tsx
|
|
2471
|
-
function VectorPropertyField({ disabled }) {
|
|
2472
|
-
const { values, setFieldValue, touched, errors } = useFormex();
|
|
2473
|
-
const dimensionsPath = "dimensions";
|
|
2474
|
-
const dimensionsValue = getIn(values, dimensionsPath);
|
|
2475
|
-
const dimensionsError = getIn(touched, dimensionsPath) && getIn(errors, dimensionsPath);
|
|
2476
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
2477
|
-
className: "col-span-12",
|
|
2478
|
-
children: [/* @__PURE__ */ jsx(TextField, {
|
|
2479
|
-
name: dimensionsPath,
|
|
2480
|
-
disabled,
|
|
2481
|
-
type: "number",
|
|
2482
|
-
onChange: (e) => {
|
|
2483
|
-
const parsedVal = parseInt(e.target.value);
|
|
2484
|
-
setFieldValue(dimensionsPath, isNaN(parsedVal) ? void 0 : parsedVal);
|
|
2485
|
-
},
|
|
2486
|
-
label: "Vector Dimensions",
|
|
2487
|
-
value: dimensionsValue ?? "",
|
|
2488
|
-
error: Boolean(dimensionsError)
|
|
2489
|
-
}), /* @__PURE__ */ jsx(FieldCaption, {
|
|
2490
|
-
error: Boolean(dimensionsError),
|
|
2491
|
-
children: dimensionsError ?? "The dimension size of the vector embeddings (e.g., 1536 for OpenAI text-embedding-3-small)."
|
|
2492
|
-
})]
|
|
2493
|
-
});
|
|
2494
|
-
}
|
|
2495
|
-
//#endregion
|
|
2496
|
-
//#region src/collection_editor/ui/collection_editor/properties/KeyValuePropertyField.tsx
|
|
2497
|
-
function KeyValuePropertyField({ disabled }) {
|
|
2498
|
-
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx("div", {
|
|
2499
|
-
className: "col-span-12",
|
|
2500
|
-
children: /* @__PURE__ */ jsx(ValidationPanel, { children: /* @__PURE__ */ jsx(GeneralPropertyValidation, { disabled }) })
|
|
2501
|
-
}) });
|
|
2502
|
-
}
|
|
2503
|
-
//#endregion
|
|
2504
|
-
//#region src/collection_editor/relation_kinds.ts
|
|
2505
|
-
/**
|
|
2506
|
-
* How each relation kind is named and explained in the editor UI.
|
|
2507
|
-
*
|
|
2508
|
-
* One table, shared by every surface that lets someone pick a kind — the
|
|
2509
|
-
* relations tab and the relation property form — so the two cannot describe the
|
|
2510
|
-
* same thing differently, and so a sixth kind added to the union fails to
|
|
2511
|
-
* compile here rather than quietly going missing from a dropdown.
|
|
2512
|
-
*
|
|
2513
|
-
* The descriptions all answer the same question, because it is the only
|
|
2514
|
-
* question that distinguishes the first four: *where is the foreign key?*
|
|
2515
|
-
*/
|
|
2516
|
-
var RELATION_KINDS = {
|
|
2517
|
-
belongsTo: {
|
|
2518
|
-
label: "Belongs to",
|
|
2519
|
-
description: "One target row. The foreign key is a column on this table."
|
|
2520
|
-
},
|
|
2521
|
-
hasOne: {
|
|
2522
|
-
label: "Has one",
|
|
2523
|
-
description: "One target row. The foreign key is a column on the target's table."
|
|
2524
|
-
},
|
|
2525
|
-
hasMany: {
|
|
2526
|
-
label: "Has many",
|
|
2527
|
-
description: "Many target rows. The foreign key is a column on the target's table."
|
|
2528
|
-
},
|
|
2529
|
-
manyToMany: {
|
|
2530
|
-
label: "Many to many",
|
|
2531
|
-
description: "Many target rows, linked through a junction table."
|
|
2532
|
-
},
|
|
2533
|
-
via: {
|
|
2534
|
-
label: "Via a join path",
|
|
2535
|
-
description: "Reached by joining across several tables. Read-only."
|
|
2536
|
-
}
|
|
2537
|
-
};
|
|
2538
|
-
/** The kinds, in the order they are offered. */
|
|
2539
|
-
var RELATION_KIND_ORDER = Object.keys(RELATION_KINDS);
|
|
2540
|
-
/** Which link field, if any, a kind is configured with. */
|
|
2541
|
-
var kindUsesLocalKey = (kind) => kind === "belongsTo";
|
|
2542
|
-
var kindUsesForeignKeyOnTarget = (kind) => kind === "hasOne" || kind === "hasMany";
|
|
2543
|
-
var kindUsesThrough = (kind) => kind === "manyToMany";
|
|
2544
|
-
var kindUsesJoinPath = (kind) => kind === "via";
|
|
2545
|
-
/**
|
|
2546
|
-
* The link fields each kind owns — the only ones a relation of that kind may
|
|
2547
|
-
* carry. The same table the boot validator checks a relation against.
|
|
2548
|
-
*/
|
|
2549
|
-
var LINK_FIELDS_BY_KIND = {
|
|
2550
|
-
belongsTo: ["localKey"],
|
|
2551
|
-
hasOne: ["foreignKeyOnTarget", "sourceKey"],
|
|
2552
|
-
hasMany: ["foreignKeyOnTarget", "sourceKey"],
|
|
2553
|
-
manyToMany: ["through"],
|
|
2554
|
-
via: ["joinPath", "cardinality"]
|
|
2555
|
-
};
|
|
2556
|
-
var LINK_FIELDS = new Set(Object.values(LINK_FIELDS_BY_KIND).flat());
|
|
2557
|
-
/**
|
|
2558
|
-
* `relation` switched to `kind`, without the link fields its old kind owned.
|
|
2559
|
-
*
|
|
2560
|
-
* Switching kind in the property form used to set `kind` and nothing else, so
|
|
2561
|
-
* a junction table filled in before switching to "Belongs to" stayed on the
|
|
2562
|
-
* relation — `through` on a `belongsTo` — and a `localKey` rode along into a
|
|
2563
|
-
* `hasMany`. The boot validator refuses both, and every collection in the
|
|
2564
|
-
* directory stops loading. The name, the target and the referential actions
|
|
2565
|
-
* belong to every kind and are kept.
|
|
2566
|
-
*/
|
|
2567
|
-
function relationWithKind(relation, kind) {
|
|
2568
|
-
const owned = LINK_FIELDS_BY_KIND[kind];
|
|
2569
|
-
return {
|
|
2570
|
-
...Object.fromEntries(Object.entries(relation).filter(([key]) => !LINK_FIELDS.has(key) || owned.includes(key))),
|
|
2571
|
-
kind
|
|
2572
|
-
};
|
|
2573
|
-
}
|
|
2574
|
-
//#endregion
|
|
2575
|
-
//#region src/collection_editor/ui/collection_editor/properties/RelationPropertyField.tsx
|
|
2576
|
-
var ON_ACTION_OPTIONS = [
|
|
2577
|
-
"cascade",
|
|
2578
|
-
"restrict",
|
|
2579
|
-
"no action",
|
|
2580
|
-
"set null",
|
|
2581
|
-
"set default"
|
|
2582
|
-
];
|
|
2583
|
-
function getTargetSlug(target) {
|
|
2584
|
-
if (!target) return "";
|
|
2585
|
-
if (typeof target === "string") return target;
|
|
2586
|
-
try {
|
|
2587
|
-
const resolved = target();
|
|
2588
|
-
if (typeof resolved === "string") return resolved;
|
|
2589
|
-
if (resolved && typeof resolved === "object" && "slug" in resolved && typeof resolved.slug === "string") return resolved.slug;
|
|
2590
|
-
return "";
|
|
2591
|
-
} catch {
|
|
2592
|
-
return "";
|
|
2593
|
-
}
|
|
2594
|
-
}
|
|
2595
|
-
/**
|
|
2596
|
-
* Property editor form for `type: "relation"` properties.
|
|
2597
|
-
*
|
|
2598
|
-
* This component edits the `RelationProperty` fields on the property itself (target, relationName, etc.)
|
|
2599
|
-
*/
|
|
2600
|
-
function RelationPropertyField({ disabled, showErrors }) {
|
|
2601
|
-
const { values, errors, setFieldValue } = useFormex();
|
|
2602
|
-
const collectionRegistry = useCollectionRegistryController();
|
|
2603
|
-
const link = values.relation ?? {};
|
|
2604
|
-
const kind = link.kind ?? "belongsTo";
|
|
2605
|
-
const relationName = link.relationName ?? "";
|
|
2606
|
-
const targetSlug = getTargetSlug(link.target);
|
|
2607
|
-
const localKey = link.localKey ?? "";
|
|
2608
|
-
const foreignKeyOnTarget = link.foreignKeyOnTarget ?? "";
|
|
2609
|
-
const sourceKey = link.sourceKey ?? "";
|
|
2610
|
-
const through = link.through;
|
|
2611
|
-
const throughTable = through?.table ?? "";
|
|
2612
|
-
const throughSourceColumn = through?.sourceColumn ?? "";
|
|
2613
|
-
const throughTargetColumn = through?.targetColumn ?? "";
|
|
2614
|
-
const onUpdate = link.onUpdate ?? "no action";
|
|
2615
|
-
const onDelete = link.onDelete ?? "no action";
|
|
2616
|
-
const showThrough = kindUsesThrough(kind);
|
|
2617
|
-
const showLocalKey = kindUsesLocalKey(kind);
|
|
2618
|
-
const showForeignKey = kindUsesForeignKeyOnTarget(kind);
|
|
2619
|
-
const showJoinPath = kindUsesJoinPath(kind);
|
|
2620
|
-
const setLinkField = useCallback((field, value) => setFieldValue(`relation.${field}`, value === "" ? void 0 : value), [setFieldValue]);
|
|
2621
|
-
const updateThrough = useCallback((patch) => {
|
|
2622
|
-
const next = Object.fromEntries(Object.entries({
|
|
2623
|
-
...link.through ?? {},
|
|
2624
|
-
...patch
|
|
2625
|
-
}).filter(([, value]) => value !== "" && value !== void 0));
|
|
2626
|
-
setFieldValue("relation.through", Object.keys(next).length > 0 ? next : void 0);
|
|
2627
|
-
}, [link.through, setFieldValue]);
|
|
2628
|
-
useEffect(() => {
|
|
2629
|
-
if (!values.relation?.kind) setFieldValue("relation.kind", "belongsTo");
|
|
2630
|
-
}, [values.relation?.kind, setFieldValue]);
|
|
2631
|
-
useEffect(() => {
|
|
2632
|
-
if (targetSlug && !relationName) setFieldValue("relation.relationName", targetSlug);
|
|
2633
|
-
}, [
|
|
2634
|
-
targetSlug,
|
|
2635
|
-
relationName,
|
|
2636
|
-
setFieldValue
|
|
2637
|
-
]);
|
|
2638
|
-
collectionRegistry?.collections;
|
|
2639
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
2640
|
-
/* @__PURE__ */ jsxs("div", {
|
|
2641
|
-
className: "col-span-12",
|
|
2642
|
-
children: [/* @__PURE__ */ jsx(CollectionsSelect, {
|
|
2643
|
-
disabled,
|
|
2644
|
-
pathPath: "target",
|
|
2645
|
-
value: targetSlug,
|
|
2646
|
-
setFieldValue: (_, value) => {
|
|
2647
|
-
setFieldValue("relation.target", value);
|
|
2648
|
-
if (!relationName || relationName === targetSlug) setFieldValue("relation.relationName", value);
|
|
2649
|
-
},
|
|
2650
|
-
error: showErrors && !targetSlug ? "You must select a target collection" : void 0
|
|
2651
|
-
}), /* @__PURE__ */ jsx(FieldCaption, {
|
|
2652
|
-
error: showErrors && !targetSlug,
|
|
2653
|
-
children: showErrors && !targetSlug ? "You must select a target collection" : "The collection this relation points to"
|
|
2654
|
-
})]
|
|
2655
|
-
}),
|
|
2656
|
-
/* @__PURE__ */ jsxs("div", {
|
|
2657
|
-
className: "col-span-12",
|
|
2658
|
-
children: [/* @__PURE__ */ jsx(TextField, {
|
|
2659
|
-
value: relationName,
|
|
2660
|
-
onChange: (e) => setFieldValue("relation.relationName", e.target.value),
|
|
2661
|
-
label: "Relation name",
|
|
2662
|
-
disabled,
|
|
2663
|
-
error: showErrors && !relationName
|
|
2664
|
-
}), /* @__PURE__ */ jsx(FieldCaption, {
|
|
2665
|
-
error: showErrors && !relationName,
|
|
2666
|
-
children: showErrors && !relationName ? "Required" : "Identifier for this relation (used to link the property to the relation config)"
|
|
2667
|
-
})]
|
|
2668
|
-
}),
|
|
2669
|
-
/* @__PURE__ */ jsxs("div", {
|
|
2670
|
-
className: "col-span-12",
|
|
2671
|
-
children: [/* @__PURE__ */ jsx(Select, {
|
|
2672
|
-
value: kind,
|
|
2673
|
-
onValueChange: (v) => setFieldValue("relation", relationWithKind(link, v)),
|
|
2674
|
-
label: "Kind",
|
|
2675
|
-
disabled,
|
|
2676
|
-
fullWidth: true,
|
|
2677
|
-
renderValue: (v) => RELATION_KINDS[v]?.label ?? v,
|
|
2678
|
-
children: RELATION_KIND_ORDER.map((k) => /* @__PURE__ */ jsx(SelectItem, {
|
|
2679
|
-
value: k,
|
|
2680
|
-
children: /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Typography, {
|
|
2681
|
-
variant: "body2",
|
|
2682
|
-
children: RELATION_KINDS[k].label
|
|
2683
|
-
}), /* @__PURE__ */ jsx(Typography, {
|
|
2684
|
-
variant: "caption",
|
|
2685
|
-
color: "secondary",
|
|
2686
|
-
children: RELATION_KINDS[k].description
|
|
2687
|
-
})] })
|
|
2688
|
-
}, k))
|
|
2689
|
-
}), /* @__PURE__ */ jsx(FieldCaption, { children: "Which side holds the key, and whether this yields one row or many" })]
|
|
2690
|
-
}),
|
|
2691
|
-
showLocalKey && /* @__PURE__ */ jsxs("div", {
|
|
2692
|
-
className: "col-span-12",
|
|
2693
|
-
children: [/* @__PURE__ */ jsx(TextField, {
|
|
2694
|
-
value: localKey,
|
|
2695
|
-
onChange: (e) => setLinkField("localKey", e.target.value),
|
|
2696
|
-
label: "Local key (foreign key column on this table)",
|
|
2697
|
-
disabled,
|
|
2698
|
-
placeholder: "e.g. author_id"
|
|
2699
|
-
}), /* @__PURE__ */ jsx(FieldCaption, { children: "Column on this table that references the target's primary key" })]
|
|
2700
|
-
}),
|
|
2701
|
-
showForeignKey && /* @__PURE__ */ jsxs("div", {
|
|
2702
|
-
className: "col-span-12",
|
|
2703
|
-
children: [
|
|
2704
|
-
/* @__PURE__ */ jsx(TextField, {
|
|
2705
|
-
value: foreignKeyOnTarget,
|
|
2706
|
-
onChange: (e) => setLinkField("foreignKeyOnTarget", e.target.value),
|
|
2707
|
-
label: "Foreign key on target table",
|
|
2708
|
-
disabled,
|
|
2709
|
-
placeholder: "e.g. post_id"
|
|
2710
|
-
}),
|
|
2711
|
-
/* @__PURE__ */ jsx(FieldCaption, { children: "Column on the target table that references this table's primary key" }),
|
|
2712
|
-
/* @__PURE__ */ jsx(TextField, {
|
|
2713
|
-
className: "mt-4",
|
|
2714
|
-
value: sourceKey,
|
|
2715
|
-
onChange: (e) => setLinkField("sourceKey", e.target.value),
|
|
2716
|
-
label: "Source key (optional)",
|
|
2717
|
-
disabled,
|
|
2718
|
-
placeholder: "defaults to this table's primary key"
|
|
2719
|
-
}),
|
|
2720
|
-
/* @__PURE__ */ jsxs(FieldCaption, { children: [
|
|
2721
|
-
"Column on ",
|
|
2722
|
-
/* @__PURE__ */ jsx("em", { children: "this" }),
|
|
2723
|
-
" table that the foreign key above points at. Leave empty unless the two sides are joined on a natural key — an external identity id, a SKU — rather than on the row id. It must be unique."
|
|
2724
|
-
] })
|
|
2725
|
-
]
|
|
2726
|
-
}),
|
|
2727
|
-
showJoinPath && /* @__PURE__ */ jsxs("div", {
|
|
2728
|
-
className: "col-span-12",
|
|
2729
|
-
children: [/* @__PURE__ */ jsx(Typography, {
|
|
2730
|
-
variant: "label",
|
|
2731
|
-
className: "mb-2",
|
|
2732
|
-
children: "Join path"
|
|
2733
|
-
}), /* @__PURE__ */ jsxs(FieldCaption, { children: [
|
|
2734
|
-
"A ",
|
|
2735
|
-
/* @__PURE__ */ jsx("code", { children: "via" }),
|
|
2736
|
-
" relation is reached by joining across several tables, and is read-only — Rebase will not guess which hop to write to. Its ",
|
|
2737
|
-
/* @__PURE__ */ jsx("code", { children: "joinPath" }),
|
|
2738
|
-
" ",
|
|
2739
|
-
"is edited in the collection's Relations tab, or in code, where the whole chain is visible at once.",
|
|
2740
|
-
link.joinPath?.length ? ` Currently ${link.joinPath.length} step(s).` : " No steps are configured yet, so this relation will return nothing."
|
|
2741
|
-
] })]
|
|
2742
|
-
}),
|
|
2743
|
-
showThrough && /* @__PURE__ */ jsxs("div", {
|
|
2744
|
-
className: "col-span-12",
|
|
2745
|
-
children: [/* @__PURE__ */ jsx(Typography, {
|
|
2746
|
-
variant: "label",
|
|
2747
|
-
className: "mb-2",
|
|
2748
|
-
children: "Junction table (many-to-many)"
|
|
2749
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
2750
|
-
className: "grid grid-cols-12 gap-4",
|
|
2751
|
-
children: [
|
|
2752
|
-
/* @__PURE__ */ jsxs("div", {
|
|
2753
|
-
className: "col-span-12",
|
|
2754
|
-
children: [/* @__PURE__ */ jsx(TextField, {
|
|
2755
|
-
value: throughTable,
|
|
2756
|
-
onChange: (e) => updateThrough({ table: e.target.value }),
|
|
2757
|
-
label: "Junction table name",
|
|
2758
|
-
disabled,
|
|
2759
|
-
placeholder: "e.g. user_roles"
|
|
2760
|
-
}), /* @__PURE__ */ jsx(FieldCaption, { children: "Name of the intermediate table that connects both collections" })]
|
|
2761
|
-
}),
|
|
2762
|
-
/* @__PURE__ */ jsxs("div", {
|
|
2763
|
-
className: "col-span-12 sm:col-span-6",
|
|
2764
|
-
children: [/* @__PURE__ */ jsx(TextField, {
|
|
2765
|
-
value: throughSourceColumn,
|
|
2766
|
-
onChange: (e) => updateThrough({ sourceColumn: e.target.value }),
|
|
2767
|
-
label: "Source column",
|
|
2768
|
-
disabled,
|
|
2769
|
-
placeholder: "e.g. user_id"
|
|
2770
|
-
}), /* @__PURE__ */ jsx(FieldCaption, { children: "Column in the junction table referencing this table" })]
|
|
2771
|
-
}),
|
|
2772
|
-
/* @__PURE__ */ jsxs("div", {
|
|
2773
|
-
className: "col-span-12 sm:col-span-6",
|
|
2774
|
-
children: [/* @__PURE__ */ jsx(TextField, {
|
|
2775
|
-
value: throughTargetColumn,
|
|
2776
|
-
onChange: (e) => updateThrough({ targetColumn: e.target.value }),
|
|
2777
|
-
label: "Target column",
|
|
2778
|
-
disabled,
|
|
2779
|
-
placeholder: "e.g. role_id"
|
|
2780
|
-
}), /* @__PURE__ */ jsx(FieldCaption, { children: "Column in the junction table referencing the target table" })]
|
|
2781
|
-
})
|
|
2782
|
-
]
|
|
2783
|
-
})]
|
|
2784
|
-
}),
|
|
2785
|
-
/* @__PURE__ */ jsxs("div", {
|
|
2786
|
-
className: "col-span-12 sm:col-span-6",
|
|
2787
|
-
children: [/* @__PURE__ */ jsx(Select, {
|
|
2788
|
-
value: onUpdate,
|
|
2789
|
-
onValueChange: (v) => setFieldValue("relation.onUpdate", v),
|
|
2790
|
-
label: "On update",
|
|
2791
|
-
disabled,
|
|
2792
|
-
fullWidth: true,
|
|
2793
|
-
renderValue: (v) => String(v),
|
|
2794
|
-
children: ON_ACTION_OPTIONS.map((action) => /* @__PURE__ */ jsx(SelectItem, {
|
|
2795
|
-
value: action,
|
|
2796
|
-
children: action
|
|
2797
|
-
}, action))
|
|
2798
|
-
}), /* @__PURE__ */ jsx(FieldCaption, { children: "Action when the referenced record is updated" })]
|
|
2799
|
-
}),
|
|
2800
|
-
/* @__PURE__ */ jsxs("div", {
|
|
2801
|
-
className: "col-span-12 sm:col-span-6",
|
|
2802
|
-
children: [/* @__PURE__ */ jsx(Select, {
|
|
2803
|
-
value: onDelete,
|
|
2804
|
-
onValueChange: (v) => setFieldValue("relation.onDelete", v),
|
|
2805
|
-
label: "On delete",
|
|
2806
|
-
disabled,
|
|
2807
|
-
fullWidth: true,
|
|
2808
|
-
renderValue: (v) => String(v),
|
|
2809
|
-
children: ON_ACTION_OPTIONS.map((action) => /* @__PURE__ */ jsx(SelectItem, {
|
|
2810
|
-
value: action,
|
|
2811
|
-
children: action
|
|
2812
|
-
}, action))
|
|
2813
|
-
}), /* @__PURE__ */ jsx(FieldCaption, { children: "Action when the referenced record is deleted" })]
|
|
2814
|
-
})
|
|
2815
|
-
] });
|
|
2816
|
-
}
|
|
2817
|
-
//#endregion
|
|
2818
|
-
//#region src/collection_editor/ui/collection_editor/utils/update_property_for_widget.ts
|
|
2819
|
-
function updatePropertyFromWidget(propertyData, selectedWidgetId, propertyConfigs) {
|
|
2820
|
-
let updatedProperty;
|
|
2821
|
-
if (selectedWidgetId === "text_field") updatedProperty = mergeDeep(propertyData, {
|
|
2822
|
-
type: "string",
|
|
2823
|
-
propertyConfig: "text_field",
|
|
2824
|
-
storage: void 0,
|
|
2825
|
-
admin: {
|
|
2826
|
-
multiline: void 0,
|
|
2827
|
-
markdown: void 0,
|
|
2828
|
-
urlPreview: void 0
|
|
2829
|
-
},
|
|
2830
|
-
email: void 0,
|
|
2831
|
-
enum: void 0,
|
|
2832
|
-
userSelect: void 0
|
|
2833
|
-
});
|
|
2834
|
-
else if (selectedWidgetId === "user_select") updatedProperty = mergeDeep(propertyData, {
|
|
2835
|
-
type: "string",
|
|
2836
|
-
propertyConfig: "user_select",
|
|
2837
|
-
storage: void 0,
|
|
2838
|
-
admin: {
|
|
2839
|
-
multiline: void 0,
|
|
2840
|
-
markdown: void 0,
|
|
2841
|
-
urlPreview: void 0
|
|
2842
|
-
},
|
|
2843
|
-
email: void 0,
|
|
2844
|
-
enum: void 0,
|
|
2845
|
-
userSelect: true
|
|
2846
|
-
});
|
|
2847
|
-
else if (selectedWidgetId === "multiline") updatedProperty = mergeDeep(propertyData, {
|
|
2848
|
-
type: "string",
|
|
2849
|
-
propertyConfig: "multiline",
|
|
2850
|
-
admin: {
|
|
2851
|
-
multiline: true,
|
|
2852
|
-
markdown: void 0,
|
|
2853
|
-
urlPreview: void 0
|
|
2854
|
-
},
|
|
2855
|
-
storage: void 0,
|
|
2856
|
-
email: void 0,
|
|
2857
|
-
enum: void 0,
|
|
2858
|
-
userSelect: void 0
|
|
2859
|
-
});
|
|
2860
|
-
else if (selectedWidgetId === "markdown") updatedProperty = mergeDeep(propertyData, {
|
|
2861
|
-
type: "string",
|
|
2862
|
-
propertyConfig: "markdown",
|
|
2863
|
-
storage: void 0,
|
|
2864
|
-
admin: {
|
|
2865
|
-
multiline: void 0,
|
|
2866
|
-
markdown: true,
|
|
2867
|
-
urlPreview: void 0
|
|
2868
|
-
},
|
|
2869
|
-
email: void 0,
|
|
2870
|
-
userSelect: void 0
|
|
2871
|
-
});
|
|
2872
|
-
else if (selectedWidgetId === "url") updatedProperty = mergeDeep(propertyData, {
|
|
2873
|
-
type: "string",
|
|
2874
|
-
propertyConfig: "url",
|
|
2875
|
-
storage: void 0,
|
|
2876
|
-
url: true,
|
|
2877
|
-
admin: {
|
|
2878
|
-
multiline: void 0,
|
|
2879
|
-
markdown: void 0
|
|
2880
|
-
},
|
|
2881
|
-
email: void 0,
|
|
2882
|
-
enum: void 0,
|
|
2883
|
-
userSelect: void 0
|
|
2884
|
-
});
|
|
2885
|
-
else if (selectedWidgetId === "email") updatedProperty = mergeDeep(propertyData, {
|
|
2886
|
-
type: "string",
|
|
2887
|
-
propertyConfig: "email",
|
|
2888
|
-
storage: void 0,
|
|
2889
|
-
admin: {
|
|
2890
|
-
multiline: void 0,
|
|
2891
|
-
markdown: void 0,
|
|
2892
|
-
urlPreview: void 0
|
|
2893
|
-
},
|
|
2894
|
-
email: true,
|
|
2895
|
-
enum: void 0,
|
|
2896
|
-
userSelect: void 0
|
|
2897
|
-
});
|
|
2898
|
-
else if (selectedWidgetId === "select") updatedProperty = mergeDeep(propertyData, {
|
|
2899
|
-
type: "string",
|
|
2900
|
-
propertyConfig: "select",
|
|
2901
|
-
storage: void 0,
|
|
2902
|
-
admin: {
|
|
2903
|
-
multiline: void 0,
|
|
2904
|
-
markdown: void 0,
|
|
2905
|
-
urlPreview: void 0
|
|
2906
|
-
},
|
|
2907
|
-
email: void 0,
|
|
2908
|
-
enum: propertyData.enum ?? [],
|
|
2909
|
-
userSelect: void 0
|
|
2910
|
-
});
|
|
2911
|
-
else if (selectedWidgetId === "multi_select") updatedProperty = mergeDeep(propertyData, {
|
|
2912
|
-
type: "array",
|
|
2913
|
-
propertyConfig: "multi_select",
|
|
2914
|
-
of: {
|
|
2915
|
-
type: "string",
|
|
2916
|
-
enum: propertyData.of?.enum ?? []
|
|
2917
|
-
}
|
|
2918
|
-
});
|
|
2919
|
-
else if (selectedWidgetId === "number_input") updatedProperty = mergeDeep(propertyData, {
|
|
2920
|
-
type: "number",
|
|
2921
|
-
propertyConfig: "number_input",
|
|
2922
|
-
enum: void 0
|
|
2923
|
-
});
|
|
2924
|
-
else if (selectedWidgetId === "number_select") updatedProperty = mergeDeep(propertyData, {
|
|
2925
|
-
type: "number",
|
|
2926
|
-
propertyConfig: "number_select",
|
|
2927
|
-
enum: propertyData.enum ?? []
|
|
2928
|
-
});
|
|
2929
|
-
else if (selectedWidgetId === "multi_number_select") updatedProperty = mergeDeep(propertyData, {
|
|
2930
|
-
type: "array",
|
|
2931
|
-
propertyConfig: "multi_number_select",
|
|
2932
|
-
of: {
|
|
2933
|
-
type: "number",
|
|
2934
|
-
enum: propertyData.of?.enum ?? []
|
|
2935
|
-
}
|
|
2936
|
-
});
|
|
2937
|
-
else if (selectedWidgetId === "file_upload") updatedProperty = mergeDeep(propertyData, {
|
|
2938
|
-
type: "string",
|
|
2939
|
-
propertyConfig: "file_upload",
|
|
2940
|
-
storage: { storagePath: "/" }
|
|
2941
|
-
});
|
|
2942
|
-
else if (selectedWidgetId === "multi_file_upload") updatedProperty = mergeDeep(propertyData, {
|
|
2943
|
-
type: "array",
|
|
2944
|
-
propertyConfig: "multi_file_upload",
|
|
2945
|
-
of: {
|
|
2946
|
-
type: "string",
|
|
2947
|
-
storage: propertyData.of?.storage ?? { storagePath: "/" }
|
|
2948
|
-
}
|
|
2949
|
-
});
|
|
2950
|
-
else if (selectedWidgetId === "group") updatedProperty = mergeDeep(propertyData, {
|
|
2951
|
-
type: "map",
|
|
2952
|
-
propertyConfig: "group",
|
|
2953
|
-
keyValue: false,
|
|
2954
|
-
properties: propertyData.properties ?? {}
|
|
2955
|
-
});
|
|
2956
|
-
else if (selectedWidgetId === "key_value") updatedProperty = mergeDeep(propertyData, {
|
|
2957
|
-
type: "map",
|
|
2958
|
-
propertyConfig: "key_value",
|
|
2959
|
-
keyValue: true,
|
|
2960
|
-
properties: void 0
|
|
2961
|
-
});
|
|
2962
|
-
else if (selectedWidgetId === "reference") updatedProperty = mergeDeep(propertyData, {
|
|
2963
|
-
type: "reference",
|
|
2964
|
-
propertyConfig: "reference"
|
|
2965
|
-
});
|
|
2966
|
-
else if (selectedWidgetId === "multi_references") updatedProperty = mergeDeep(propertyData, {
|
|
2967
|
-
type: "array",
|
|
2968
|
-
propertyConfig: "multi_references",
|
|
2969
|
-
of: { type: "reference" }
|
|
2970
|
-
});
|
|
2971
|
-
else if (selectedWidgetId === "switch") updatedProperty = mergeDeep(propertyData, {
|
|
2972
|
-
type: "boolean",
|
|
2973
|
-
propertyConfig: "switch"
|
|
2974
|
-
});
|
|
2975
|
-
else if (selectedWidgetId === "date_time") updatedProperty = mergeDeep(propertyData, {
|
|
2976
|
-
type: "date",
|
|
2977
|
-
propertyConfig: "date_time",
|
|
2978
|
-
mode: "date_time"
|
|
2979
|
-
});
|
|
2980
|
-
else if (selectedWidgetId === "relation") {
|
|
2981
|
-
const { relationName: _misplaced, ...rest } = propertyData ?? {};
|
|
2982
|
-
updatedProperty = mergeDeep(rest, {
|
|
2983
|
-
type: "relation",
|
|
2984
|
-
propertyConfig: "relation",
|
|
2985
|
-
relation: { kind: propertyData?.relation?.kind ?? "belongsTo" }
|
|
2986
|
-
});
|
|
2987
|
-
} else if (selectedWidgetId === "repeat") updatedProperty = mergeDeep(propertyData, {
|
|
2988
|
-
type: "array",
|
|
2989
|
-
propertyConfig: "repeat"
|
|
2990
|
-
});
|
|
2991
|
-
else if (selectedWidgetId === "block") updatedProperty = mergeDeep(propertyData, {
|
|
2992
|
-
type: "array",
|
|
2993
|
-
propertyConfig: "block",
|
|
2994
|
-
oneOf: { properties: {} }
|
|
2995
|
-
});
|
|
2996
|
-
else if (selectedWidgetId && propertyConfigs[selectedWidgetId]) updatedProperty = {
|
|
2997
|
-
...propertyConfigs[selectedWidgetId].property,
|
|
2998
|
-
propertyConfig: selectedWidgetId,
|
|
2999
|
-
...propertyData?.name !== void 0 ? { name: propertyData.name } : {},
|
|
3000
|
-
...propertyData?.description !== void 0 ? { description: propertyData.description } : {},
|
|
3001
|
-
...propertyData?.columnName !== void 0 ? { columnName: propertyData.columnName } : {}
|
|
3002
|
-
};
|
|
3003
|
-
return updatedProperty;
|
|
3004
|
-
}
|
|
3005
|
-
//#endregion
|
|
3006
|
-
//#region src/collection_editor/ui/collection_editor/properties/UrlPropertyField.tsx
|
|
3007
|
-
function UrlPropertyField({ disabled, showErrors }) {
|
|
3008
|
-
const { values, setFieldValue } = useFormex();
|
|
3009
|
-
const urlRawValue = getIn(values, "url");
|
|
3010
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3011
|
-
/* @__PURE__ */ jsx("div", {
|
|
3012
|
-
className: "col-span-12",
|
|
3013
|
-
children: /* @__PURE__ */ jsxs(Select, {
|
|
3014
|
-
disabled,
|
|
3015
|
-
position: "item-aligned",
|
|
3016
|
-
fullWidth: true,
|
|
3017
|
-
onValueChange: (value) => {
|
|
3018
|
-
if (value === "[NONE]") setFieldValue("url", true);
|
|
3019
|
-
else setFieldValue("url", value);
|
|
3020
|
-
},
|
|
3021
|
-
label: "Preview type",
|
|
3022
|
-
renderValue: (value) => {
|
|
3023
|
-
switch (value) {
|
|
3024
|
-
case "image": return "Image";
|
|
3025
|
-
case "video": return "Video";
|
|
3026
|
-
case "audio": return "Audio";
|
|
3027
|
-
default: return "Display URL";
|
|
3028
|
-
}
|
|
3029
|
-
},
|
|
3030
|
-
value: (typeof urlRawValue === "string" ? urlRawValue : "[NONE]") ?? "[NONE]",
|
|
3031
|
-
children: [
|
|
3032
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
3033
|
-
value: "[NONE]",
|
|
3034
|
-
children: "Display URL"
|
|
3035
|
-
}),
|
|
3036
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
3037
|
-
value: "image",
|
|
3038
|
-
children: "Image"
|
|
3039
|
-
}),
|
|
3040
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
3041
|
-
value: "video",
|
|
3042
|
-
children: "Video"
|
|
3043
|
-
}),
|
|
3044
|
-
/* @__PURE__ */ jsx(SelectItem, {
|
|
3045
|
-
value: "audio",
|
|
3046
|
-
children: "Audio"
|
|
3047
|
-
})
|
|
3048
|
-
]
|
|
3049
|
-
})
|
|
3050
|
-
}),
|
|
3051
|
-
/* @__PURE__ */ jsx("div", {
|
|
3052
|
-
className: "col-span-12",
|
|
3053
|
-
children: /* @__PURE__ */ jsx(ValidationPanel, { children: /* @__PURE__ */ jsx(StringPropertyValidation, {
|
|
3054
|
-
disabled,
|
|
3055
|
-
max: true,
|
|
3056
|
-
min: true,
|
|
3057
|
-
trim: true,
|
|
3058
|
-
showErrors
|
|
3059
|
-
}) })
|
|
3060
|
-
}),
|
|
3061
|
-
/* @__PURE__ */ jsx("div", {
|
|
3062
|
-
className: "col-span-12",
|
|
3063
|
-
children: /* @__PURE__ */ jsx(TextField, {
|
|
3064
|
-
name: "defaultValue",
|
|
3065
|
-
disabled,
|
|
3066
|
-
onChange: (e) => {
|
|
3067
|
-
setFieldValue("defaultValue", e.target.value === "" ? void 0 : e.target.value);
|
|
3068
|
-
},
|
|
3069
|
-
label: "Default value",
|
|
3070
|
-
value: getIn(values, "defaultValue") ?? ""
|
|
3071
|
-
})
|
|
3072
|
-
})
|
|
3073
|
-
] });
|
|
3074
|
-
}
|
|
3075
|
-
//#endregion
|
|
3076
|
-
//#region src/collection_editor/ui/collection_editor/utils/supported_fields.tsx
|
|
3077
|
-
var supportedFieldsIds = [
|
|
3078
|
-
"text_field",
|
|
3079
|
-
"multiline",
|
|
3080
|
-
"markdown",
|
|
3081
|
-
"url",
|
|
3082
|
-
"email",
|
|
3083
|
-
"user_select",
|
|
3084
|
-
"select",
|
|
3085
|
-
"multi_select",
|
|
3086
|
-
"number_input",
|
|
3087
|
-
"number_select",
|
|
3088
|
-
"multi_number_select",
|
|
3089
|
-
"file_upload",
|
|
3090
|
-
"multi_file_upload",
|
|
3091
|
-
"reference",
|
|
3092
|
-
"multi_references",
|
|
3093
|
-
"relation",
|
|
3094
|
-
"switch",
|
|
3095
|
-
"date_time",
|
|
3096
|
-
"group",
|
|
3097
|
-
"key_value",
|
|
3098
|
-
"repeat",
|
|
3099
|
-
"block",
|
|
3100
|
-
"vector_input",
|
|
3101
|
-
"geopoint",
|
|
3102
|
-
"binary"
|
|
3103
|
-
];
|
|
3104
|
-
var supportedFields = Object.entries(DEFAULT_FIELD_CONFIGS).filter(([id]) => supportedFieldsIds.includes(id)).map(([id, config]) => ({ [id]: config })).reduce((a, b) => ({
|
|
3105
|
-
...a,
|
|
3106
|
-
...b
|
|
3107
|
-
}), {});
|
|
3108
|
-
//#endregion
|
|
3109
|
-
//#region src/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.tsx
|
|
3110
|
-
function MarkdownPropertyField({ disabled, showErrors }) {
|
|
3111
|
-
const { values, setFieldValue } = useFormex();
|
|
3112
|
-
const { t } = useTranslation();
|
|
3113
|
-
const baseStoragePath = "storage";
|
|
3114
|
-
const fileName = `${baseStoragePath}.fileName`;
|
|
3115
|
-
const maxSize = `${baseStoragePath}.maxSize`;
|
|
3116
|
-
const storagePath = `${baseStoragePath}.storagePath`;
|
|
3117
|
-
const fileNameValue = getIn(values, fileName) ?? "{rand}_{file}";
|
|
3118
|
-
const storagePathValue = getIn(values, storagePath) ?? "/";
|
|
3119
|
-
const maxSizeValue = getIn(values, maxSize);
|
|
3120
|
-
const hasFilenameCallback = typeof fileNameValue === "function";
|
|
3121
|
-
const hasStoragePathCallback = typeof storagePathValue === "function";
|
|
3122
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3123
|
-
/* @__PURE__ */ jsx("div", {
|
|
3124
|
-
className: "col-span-12",
|
|
3125
|
-
children: /* @__PURE__ */ jsx(ValidationPanel, { children: /* @__PURE__ */ jsx(StringPropertyValidation, {
|
|
3126
|
-
disabled,
|
|
3127
|
-
length: true,
|
|
3128
|
-
lowercase: true,
|
|
3129
|
-
max: true,
|
|
3130
|
-
min: true,
|
|
3131
|
-
trim: true,
|
|
3132
|
-
uppercase: true,
|
|
3133
|
-
showErrors
|
|
3134
|
-
}) })
|
|
3135
|
-
}),
|
|
3136
|
-
/* @__PURE__ */ jsx("div", {
|
|
3137
|
-
className: "col-span-12",
|
|
3138
|
-
children: /* @__PURE__ */ jsx(ExpandablePanel, {
|
|
3139
|
-
title: /* @__PURE__ */ jsxs("div", {
|
|
3140
|
-
className: "flex flex-row text-surface-500",
|
|
3141
|
-
children: [/* @__PURE__ */ jsx(UploadCloudIcon, {}), /* @__PURE__ */ jsx(Typography, {
|
|
3142
|
-
variant: "subtitle2",
|
|
3143
|
-
className: "ml-4",
|
|
3144
|
-
children: "File upload config"
|
|
3145
|
-
})]
|
|
3146
|
-
}),
|
|
3147
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
3148
|
-
className: "grid grid-cols-12 gap-2 p-4",
|
|
3149
|
-
children: [
|
|
3150
|
-
/* @__PURE__ */ jsx("div", {
|
|
3151
|
-
className: "col-span-12",
|
|
3152
|
-
children: /* @__PURE__ */ jsx(Field, {
|
|
3153
|
-
name: fileName,
|
|
3154
|
-
as: DebouncedTextField,
|
|
3155
|
-
label: t("storage_file_name"),
|
|
3156
|
-
size: "small",
|
|
3157
|
-
disabled: hasFilenameCallback || disabled,
|
|
3158
|
-
value: hasFilenameCallback ? "-" : fileNameValue
|
|
3159
|
-
})
|
|
3160
|
-
}),
|
|
3161
|
-
/* @__PURE__ */ jsxs("div", {
|
|
3162
|
-
className: "col-span-12",
|
|
3163
|
-
children: [
|
|
3164
|
-
/* @__PURE__ */ jsx(Field, {
|
|
3165
|
-
name: storagePath,
|
|
3166
|
-
as: DebouncedTextField,
|
|
3167
|
-
label: t("storage_path"),
|
|
3168
|
-
disabled: hasStoragePathCallback || disabled,
|
|
3169
|
-
size: "small",
|
|
3170
|
-
value: hasStoragePathCallback ? "-" : storagePathValue
|
|
3171
|
-
}),
|
|
3172
|
-
/* @__PURE__ */ jsxs(Typography, {
|
|
3173
|
-
variant: "caption",
|
|
3174
|
-
className: "ml-3.5 mt-1 mb-2",
|
|
3175
|
-
children: [/* @__PURE__ */ jsx("p", { children: "You can use the following placeholders in the file name and storage path values:" }), /* @__PURE__ */ jsxs("ul", { children: [
|
|
3176
|
-
/* @__PURE__ */ jsx("li", { children: "{file} - Full name of the uploaded file" }),
|
|
3177
|
-
/* @__PURE__ */ jsx("li", { children: "{file.name} - Name of the uploaded file without extension" }),
|
|
3178
|
-
/* @__PURE__ */ jsx("li", { children: "{file.ext} - Extension of the uploaded file" }),
|
|
3179
|
-
/* @__PURE__ */ jsx("li", { children: "{entityId} - ID of the entity" }),
|
|
3180
|
-
/* @__PURE__ */ jsx("li", { children: "{propertyKey} - ID of this field" }),
|
|
3181
|
-
/* @__PURE__ */ jsx("li", { children: "{path} - Path of this entity" }),
|
|
3182
|
-
/* @__PURE__ */ jsx("li", { children: "{rand} - Random value used to avoid name collisions" })
|
|
3183
|
-
] })]
|
|
3184
|
-
}),
|
|
3185
|
-
/* @__PURE__ */ jsx(Typography, {
|
|
3186
|
-
variant: "caption",
|
|
3187
|
-
className: "ml-3.5 mt-1 mb-2",
|
|
3188
|
-
children: "When using Markdown, the URL of the uploaded files are always saved in the text value (not the path)."
|
|
3189
|
-
})
|
|
3190
|
-
]
|
|
3191
|
-
}),
|
|
3192
|
-
/* @__PURE__ */ jsx("div", {
|
|
3193
|
-
className: "col-span-12",
|
|
3194
|
-
children: /* @__PURE__ */ jsx(DebouncedTextField, {
|
|
3195
|
-
name: maxSize,
|
|
3196
|
-
type: "number",
|
|
3197
|
-
label: t("storage_max_size"),
|
|
3198
|
-
size: "small",
|
|
3199
|
-
value: maxSizeValue !== void 0 && maxSizeValue !== null ? maxSizeValue.toString() : "",
|
|
3200
|
-
onChange: (e) => {
|
|
3201
|
-
const value = e.target.value;
|
|
3202
|
-
if (value === "") setFieldValue(maxSize, void 0);
|
|
3203
|
-
else setFieldValue(maxSize, parseInt(value));
|
|
3204
|
-
}
|
|
3205
|
-
})
|
|
3206
|
-
})
|
|
3207
|
-
]
|
|
3208
|
-
})
|
|
3209
|
-
})
|
|
3210
|
-
}),
|
|
3211
|
-
/* @__PURE__ */ jsx("div", {
|
|
3212
|
-
className: "col-span-12",
|
|
3213
|
-
children: /* @__PURE__ */ jsx(TextField, {
|
|
3214
|
-
name: "defaultValue",
|
|
3215
|
-
disabled,
|
|
3216
|
-
onChange: (e) => {
|
|
3217
|
-
setFieldValue("defaultValue", e.target.value === "" ? void 0 : e.target.value);
|
|
3218
|
-
},
|
|
3219
|
-
label: t("default_value"),
|
|
3220
|
-
value: getIn(values, "defaultValue") ?? ""
|
|
3221
|
-
})
|
|
3222
|
-
})
|
|
3223
|
-
] });
|
|
3224
|
-
}
|
|
3225
|
-
//#endregion
|
|
3226
|
-
//#region src/collection_editor/ui/collection_editor/PropertyEditView.tsx
|
|
3227
|
-
var PropertyEditView_exports = /* @__PURE__ */ __exportAll({
|
|
3228
|
-
PropertyForm: () => PropertyForm,
|
|
3229
|
-
PropertyFormDialog: () => PropertyFormDialog,
|
|
3230
|
-
WidgetSelectViewItem: () => WidgetSelectViewItem
|
|
3231
|
-
});
|
|
3232
|
-
var PropertyForm = React.memo(function PropertyForm(props) {
|
|
3233
|
-
const { includeIdAndName = true, autoOpenTypeSelect, existingProperty, autoUpdateId, inArray, propertyKey, existingPropertyKeys, propertyNamespace, property, onPropertyChanged, onPropertyChangedImmediate = true, onDismiss, onDelete, onError, initialErrors, forceShowErrors, allowDataInference, getController, getData, propertyConfigs, propertyTypePresets, hiddenPropertyTypes, renderExtraPropertyFields, collectionValues } = props;
|
|
3234
|
-
const initialValue = {
|
|
3235
|
-
id: "",
|
|
3236
|
-
name: ""
|
|
3237
|
-
};
|
|
3238
|
-
const disabled = Boolean(property && isPropertyBuilder(property));
|
|
3239
|
-
const lastSubmittedProperty = useRef(property ? {
|
|
3240
|
-
id: propertyKey,
|
|
3241
|
-
previousId: propertyKey,
|
|
3242
|
-
property
|
|
3243
|
-
} : void 0);
|
|
3244
|
-
const doOnPropertyChanged = ({ id, property }) => {
|
|
3245
|
-
if (includeIdAndName && id !== lastSubmittedProperty.current?.id && validateId(id, existingPropertyKeys)) return;
|
|
3246
|
-
const params = {
|
|
3247
|
-
id,
|
|
3248
|
-
previousId: lastSubmittedProperty.current?.id,
|
|
3249
|
-
property,
|
|
3250
|
-
namespace: propertyNamespace
|
|
3251
|
-
};
|
|
3252
|
-
lastSubmittedProperty.current = params;
|
|
3253
|
-
onPropertyChanged?.(params);
|
|
3254
|
-
};
|
|
3255
|
-
const formexController = useCreateFormex({
|
|
3256
|
-
debugId: "PROPERTY_FORM",
|
|
3257
|
-
initialValues: property ? {
|
|
3258
|
-
id: propertyKey,
|
|
3259
|
-
...property
|
|
3260
|
-
} : initialValue,
|
|
3261
|
-
initialErrors,
|
|
3262
|
-
validateOnChange: true,
|
|
3263
|
-
validateOnInitialRender: true,
|
|
3264
|
-
onSubmit: (newPropertyWithId, controller) => {
|
|
3265
|
-
const { id, ...property } = newPropertyWithId;
|
|
3266
|
-
doOnPropertyChanged({
|
|
3267
|
-
id,
|
|
3268
|
-
property
|
|
3269
|
-
});
|
|
3270
|
-
if (!existingProperty) controller.resetForm({ values: initialValue });
|
|
3271
|
-
},
|
|
3272
|
-
validation: (values) => {
|
|
3273
|
-
const errors = {};
|
|
3274
|
-
if (includeIdAndName) {
|
|
3275
|
-
if (!values.name) errors.name = "Required";
|
|
3276
|
-
else {
|
|
3277
|
-
const nameError = validateName(values.name);
|
|
3278
|
-
if (nameError) errors.name = nameError;
|
|
3279
|
-
}
|
|
3280
|
-
if (!values.id) errors.id = "Required";
|
|
3281
|
-
else {
|
|
3282
|
-
const idError = validateId(values.id, existingPropertyKeys);
|
|
3283
|
-
if (idError) errors.id = idError;
|
|
3284
|
-
}
|
|
3285
|
-
}
|
|
3286
|
-
if (values.type === "string") {
|
|
3287
|
-
if (values.validation?.matches && !isValidRegExp(values.validation?.matches.toString())) errors.validation = { matches: "Invalid regular expression" };
|
|
3288
|
-
}
|
|
3289
|
-
if (values.type === "reference" && !values.path) errors.slug = "You must specify a target collection for the field";
|
|
3290
|
-
if (values.type === "vector" && (!values.dimensions || isNaN(Number(values.dimensions)) || Number(values.dimensions) <= 0)) errors.dimensions = "Vector dimensions must be a positive number";
|
|
3291
|
-
if (values.propertyConfig === "repeat") {
|
|
3292
|
-
if (!("of" in values) || !values.of) errors.of = "You need to specify a repeat field";
|
|
3293
|
-
}
|
|
3294
|
-
if (values.propertyConfig === "block") {
|
|
3295
|
-
if (!("oneOf" in values) || !values.oneOf) errors.oneOf = "You need to specify the properties of this block";
|
|
3296
|
-
}
|
|
3297
|
-
return errors;
|
|
3298
|
-
}
|
|
3299
|
-
});
|
|
3300
|
-
useEffect(() => {
|
|
3301
|
-
getController?.(formexController);
|
|
3302
|
-
}, [formexController, getController]);
|
|
3303
|
-
return /* @__PURE__ */ jsx(Formex, {
|
|
3304
|
-
value: formexController,
|
|
3305
|
-
children: /* @__PURE__ */ jsx(PropertyEditFormFields, {
|
|
3306
|
-
onPropertyChanged: onPropertyChangedImmediate ? doOnPropertyChanged : void 0,
|
|
3307
|
-
onDelete,
|
|
3308
|
-
includeIdAndTitle: includeIdAndName,
|
|
3309
|
-
propertyNamespace,
|
|
3310
|
-
onError,
|
|
3311
|
-
onDismiss,
|
|
3312
|
-
showErrors: forceShowErrors || formexController.submitCount > 0,
|
|
3313
|
-
existing: existingProperty,
|
|
3314
|
-
autoUpdateId,
|
|
3315
|
-
inArray,
|
|
3316
|
-
autoOpenTypeSelect,
|
|
3317
|
-
disabled,
|
|
3318
|
-
getData,
|
|
3319
|
-
allowDataInference,
|
|
3320
|
-
propertyConfigs,
|
|
3321
|
-
propertyTypePresets,
|
|
3322
|
-
hiddenPropertyTypes,
|
|
3323
|
-
renderExtraPropertyFields,
|
|
3324
|
-
collectionValues,
|
|
3325
|
-
...formexController
|
|
3326
|
-
})
|
|
3327
|
-
});
|
|
3328
|
-
}, (a, b) => a.getData === b.getData && a.propertyKey === b.propertyKey && a.propertyNamespace === b.propertyNamespace && a.includeIdAndName === b.includeIdAndName && a.autoOpenTypeSelect === b.autoOpenTypeSelect && a.autoUpdateId === b.autoUpdateId && a.existingPropertyKeys === b.existingPropertyKeys && a.existingProperty === b.existingProperty);
|
|
3329
|
-
function PropertyFormDialog({ open, onCancel, onOkClicked, onPropertyChanged, getData, ...formProps }) {
|
|
3330
|
-
const formexRef = useRef(void 0);
|
|
3331
|
-
const getController = (helpers) => {
|
|
3332
|
-
formexRef.current = helpers;
|
|
3333
|
-
};
|
|
3334
|
-
return /* @__PURE__ */ jsx(Dialog, {
|
|
3335
|
-
open: open ?? false,
|
|
3336
|
-
maxWidth: "xl",
|
|
3337
|
-
fullWidth: true,
|
|
3338
|
-
children: /* @__PURE__ */ jsxs("form", {
|
|
3339
|
-
noValidate: true,
|
|
3340
|
-
autoComplete: "off",
|
|
3341
|
-
onSubmit: (e) => {
|
|
3342
|
-
e.preventDefault();
|
|
3343
|
-
e.stopPropagation();
|
|
3344
|
-
formexRef.current?.handleSubmit(e);
|
|
3345
|
-
},
|
|
3346
|
-
children: [
|
|
3347
|
-
/* @__PURE__ */ jsx(DialogTitle, {
|
|
3348
|
-
hidden: true,
|
|
3349
|
-
children: "Property edit view"
|
|
3350
|
-
}),
|
|
3351
|
-
/* @__PURE__ */ jsx(DialogContent, { children: /* @__PURE__ */ jsx(PropertyForm, {
|
|
3352
|
-
...formProps,
|
|
3353
|
-
onDismiss: onCancel,
|
|
3354
|
-
onPropertyChanged: (params) => {
|
|
3355
|
-
onPropertyChanged?.(params);
|
|
3356
|
-
onOkClicked?.();
|
|
3357
|
-
},
|
|
3358
|
-
onPropertyChangedImmediate: false,
|
|
3359
|
-
getController,
|
|
3360
|
-
getData
|
|
3361
|
-
}) }),
|
|
3362
|
-
/* @__PURE__ */ jsxs(DialogActions, { children: [onCancel && /* @__PURE__ */ jsx(Button, {
|
|
3363
|
-
variant: "text",
|
|
3364
|
-
onClick: () => {
|
|
3365
|
-
onCancel();
|
|
3366
|
-
formexRef.current?.resetForm();
|
|
3367
|
-
},
|
|
3368
|
-
children: "Cancel"
|
|
3369
|
-
}), /* @__PURE__ */ jsx(Button, {
|
|
3370
|
-
type: "submit",
|
|
3371
|
-
children: "Ok"
|
|
3372
|
-
})] })
|
|
3373
|
-
]
|
|
3374
|
-
})
|
|
3375
|
-
});
|
|
3376
|
-
}
|
|
3377
|
-
function PropertyEditFormFields({ values, errors, setValues, existing, autoUpdateId = false, autoOpenTypeSelect, includeIdAndTitle, onPropertyChanged, onDelete, propertyNamespace, onDismiss, onError, showErrors, disabled, inArray, getData, allowDataInference, propertyConfigs, propertyTypePresets, hiddenPropertyTypes, renderExtraPropertyFields, collectionValues }) {
|
|
3378
|
-
const [selectOpen, setSelectOpen] = useState(autoOpenTypeSelect);
|
|
3379
|
-
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
|
|
3380
|
-
const [selectedFieldConfigId, setSelectedFieldConfigId] = useState(values?.type ? getFieldId(values) : void 0);
|
|
3381
|
-
const deferredValues = useDeferredValue(values);
|
|
3382
|
-
const nameFieldRef = useRef(null);
|
|
3383
|
-
const lastSubmittedProperty = useRef(values);
|
|
3384
|
-
const selectedWidgetError = showErrors && getIn(errors, "selectedWidget");
|
|
3385
|
-
useEffect(() => {
|
|
3386
|
-
if (onPropertyChanged) {
|
|
3387
|
-
if (!includeIdAndTitle || deferredValues.id) {
|
|
3388
|
-
const { id, ...property } = deferredValues;
|
|
3389
|
-
if (!deepEqual(deferredValues, lastSubmittedProperty.current)) {
|
|
3390
|
-
onPropertyChanged({
|
|
3391
|
-
id,
|
|
3392
|
-
property,
|
|
3393
|
-
namespace: propertyNamespace
|
|
3394
|
-
});
|
|
3395
|
-
lastSubmittedProperty.current = deferredValues;
|
|
3396
|
-
}
|
|
3397
|
-
}
|
|
3398
|
-
}
|
|
3399
|
-
}, [
|
|
3400
|
-
deferredValues,
|
|
3401
|
-
includeIdAndTitle,
|
|
3402
|
-
propertyNamespace
|
|
3403
|
-
]);
|
|
3404
|
-
useEffect(() => {
|
|
3405
|
-
if (values?.id && onError) onError(values?.id, propertyNamespace, errors);
|
|
3406
|
-
}, [
|
|
3407
|
-
errors,
|
|
3408
|
-
propertyNamespace,
|
|
3409
|
-
values?.id
|
|
3410
|
-
]);
|
|
3411
|
-
const onWidgetSelectChanged = (newSelectedWidgetId) => {
|
|
3412
|
-
setSelectedFieldConfigId(newSelectedWidgetId);
|
|
3413
|
-
setValues(updatePropertyFromWidget(values, newSelectedWidgetId, propertyConfigs));
|
|
3414
|
-
setTimeout(() => {
|
|
3415
|
-
nameFieldRef.current?.focus();
|
|
3416
|
-
}, 0);
|
|
3417
|
-
};
|
|
3418
|
-
const onPresetSelected = useCallback((preset) => {
|
|
3419
|
-
const widgetId = {
|
|
3420
|
-
"string": "text_field",
|
|
3421
|
-
"number": "number_input",
|
|
3422
|
-
"boolean": "switch",
|
|
3423
|
-
"date": "date_time",
|
|
3424
|
-
"reference": "reference",
|
|
3425
|
-
"relation": "relation",
|
|
3426
|
-
"map": "group",
|
|
3427
|
-
"array": "repeat",
|
|
3428
|
-
"vector": "vector_input",
|
|
3429
|
-
"geopoint": "geopoint",
|
|
3430
|
-
"binary": "binary"
|
|
3431
|
-
}[preset.baseType] || "text_field";
|
|
3432
|
-
setSelectedFieldConfigId(widgetId);
|
|
3433
|
-
setValues({
|
|
3434
|
-
...updatePropertyFromWidget(values, widgetId, propertyConfigs),
|
|
3435
|
-
...preset.defaults,
|
|
3436
|
-
propertyConfig: widgetId
|
|
3437
|
-
});
|
|
3438
|
-
}, [
|
|
3439
|
-
values,
|
|
3440
|
-
propertyConfigs,
|
|
3441
|
-
setValues
|
|
3442
|
-
]);
|
|
3443
|
-
let childComponent;
|
|
3444
|
-
if (selectedFieldConfigId === "text_field" || selectedFieldConfigId === "multiline" || selectedFieldConfigId === "user_select" || selectedFieldConfigId === "email") childComponent = /* @__PURE__ */ jsx(StringPropertyField, {
|
|
3445
|
-
widgetId: selectedFieldConfigId,
|
|
3446
|
-
disabled,
|
|
3447
|
-
showErrors
|
|
3448
|
-
});
|
|
3449
|
-
else if (selectedFieldConfigId === "url") childComponent = /* @__PURE__ */ jsx(UrlPropertyField, {
|
|
3450
|
-
disabled,
|
|
3451
|
-
showErrors
|
|
3452
|
-
});
|
|
3453
|
-
else if (selectedFieldConfigId === "markdown") childComponent = /* @__PURE__ */ jsx(MarkdownPropertyField, {
|
|
3454
|
-
disabled,
|
|
3455
|
-
showErrors
|
|
3456
|
-
});
|
|
3457
|
-
else if (selectedFieldConfigId === "select" || selectedFieldConfigId === "number_select") childComponent = /* @__PURE__ */ jsx(EnumPropertyField, {
|
|
3458
|
-
multiselect: false,
|
|
3459
|
-
allowDataInference,
|
|
3460
|
-
updateIds: !existing,
|
|
3461
|
-
disabled,
|
|
3462
|
-
getData,
|
|
3463
|
-
propertyNamespace,
|
|
3464
|
-
showErrors
|
|
3465
|
-
});
|
|
3466
|
-
else if (selectedFieldConfigId === "multi_select" || selectedFieldConfigId === "multi_number_select") childComponent = /* @__PURE__ */ jsx(EnumPropertyField, {
|
|
3467
|
-
multiselect: true,
|
|
3468
|
-
updateIds: !existing,
|
|
3469
|
-
disabled,
|
|
3470
|
-
allowDataInference,
|
|
3471
|
-
getData,
|
|
3472
|
-
propertyNamespace,
|
|
3473
|
-
showErrors
|
|
3474
|
-
});
|
|
3475
|
-
else if (selectedFieldConfigId === "file_upload") childComponent = /* @__PURE__ */ jsx(StoragePropertyField, {
|
|
3476
|
-
existing,
|
|
3477
|
-
multiple: false,
|
|
3478
|
-
disabled
|
|
3479
|
-
});
|
|
3480
|
-
else if (selectedFieldConfigId === "multi_file_upload") childComponent = /* @__PURE__ */ jsx(StoragePropertyField, {
|
|
3481
|
-
existing,
|
|
3482
|
-
multiple: true,
|
|
3483
|
-
disabled
|
|
3484
|
-
});
|
|
3485
|
-
else if (selectedFieldConfigId === "switch") childComponent = /* @__PURE__ */ jsx(BooleanPropertyField, { disabled });
|
|
3486
|
-
else if (selectedFieldConfigId === "number_input") childComponent = /* @__PURE__ */ jsx(NumberPropertyField, { disabled });
|
|
3487
|
-
else if (selectedFieldConfigId === "group") childComponent = /* @__PURE__ */ jsx(MapPropertyField, {
|
|
3488
|
-
disabled,
|
|
3489
|
-
getData,
|
|
3490
|
-
allowDataInference,
|
|
3491
|
-
propertyConfigs
|
|
3492
|
-
});
|
|
3493
|
-
else if (selectedFieldConfigId === "block") childComponent = /* @__PURE__ */ jsx(BlockPropertyField, {
|
|
3494
|
-
disabled,
|
|
3495
|
-
getData,
|
|
3496
|
-
allowDataInference,
|
|
3497
|
-
propertyConfigs
|
|
3498
|
-
});
|
|
3499
|
-
else if (selectedFieldConfigId === "reference") childComponent = /* @__PURE__ */ jsx(ReferencePropertyField, {
|
|
3500
|
-
showErrors,
|
|
3501
|
-
existing,
|
|
3502
|
-
multiple: false,
|
|
3503
|
-
disabled
|
|
3504
|
-
});
|
|
3505
|
-
else if (selectedFieldConfigId === "date_time") childComponent = /* @__PURE__ */ jsx(DateTimePropertyField, { disabled });
|
|
3506
|
-
else if (selectedFieldConfigId === "multi_references") childComponent = /* @__PURE__ */ jsx(ReferencePropertyField, {
|
|
3507
|
-
showErrors,
|
|
3508
|
-
existing,
|
|
3509
|
-
multiple: true,
|
|
3510
|
-
disabled
|
|
3511
|
-
});
|
|
3512
|
-
else if (selectedFieldConfigId === "repeat") childComponent = /* @__PURE__ */ jsx(RepeatPropertyField, {
|
|
3513
|
-
showErrors,
|
|
3514
|
-
existing,
|
|
3515
|
-
getData,
|
|
3516
|
-
allowDataInference,
|
|
3517
|
-
disabled,
|
|
3518
|
-
propertyConfigs
|
|
3519
|
-
});
|
|
3520
|
-
else if (selectedFieldConfigId === "key_value") childComponent = /* @__PURE__ */ jsx(KeyValuePropertyField, { disabled });
|
|
3521
|
-
else if (selectedFieldConfigId === "relation") childComponent = /* @__PURE__ */ jsx(RelationPropertyField, {
|
|
3522
|
-
showErrors,
|
|
3523
|
-
disabled
|
|
3524
|
-
});
|
|
3525
|
-
else if (selectedFieldConfigId === "vector_input") childComponent = /* @__PURE__ */ jsx(VectorPropertyField, { disabled });
|
|
3526
|
-
else if (selectedFieldConfigId === "geopoint" || selectedFieldConfigId === "binary") childComponent = /* @__PURE__ */ jsx("div", {
|
|
3527
|
-
className: "col-span-12",
|
|
3528
|
-
children: /* @__PURE__ */ jsx(Typography, {
|
|
3529
|
-
variant: "body2",
|
|
3530
|
-
color: "secondary",
|
|
3531
|
-
children: selectedFieldConfigId === "geopoint" ? "A location is stored as a latitude and a longitude. There is nothing further to configure here." : "Binary values are stored as base64. There is nothing further to configure here."
|
|
3532
|
-
})
|
|
3533
|
-
});
|
|
3534
|
-
else childComponent = /* @__PURE__ */ jsx("div", {
|
|
3535
|
-
className: "col-span-12",
|
|
3536
|
-
children: /* @__PURE__ */ jsx(InfoLabel, {
|
|
3537
|
-
mode: "warn",
|
|
3538
|
-
children: values?.type ? `Properties of type "${values.type}" have no editor in the admin panel yet. The fields shown here are the ones every property shares — configure the rest in code.` : "This property has no type yet."
|
|
3539
|
-
})
|
|
3540
|
-
});
|
|
3541
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3542
|
-
disabled && /* @__PURE__ */ jsxs(InfoLabel, {
|
|
3543
|
-
mode: "warn",
|
|
3544
|
-
children: [/* @__PURE__ */ jsx(Typography, { children: "This property can't be edited" }), /* @__PURE__ */ jsx(Typography, {
|
|
3545
|
-
variant: "caption",
|
|
3546
|
-
children: "You may not have permission to edit it or it is defined in code and cannot be modified."
|
|
3547
|
-
})]
|
|
3548
|
-
}),
|
|
3549
|
-
/* @__PURE__ */ jsxs("div", {
|
|
3550
|
-
className: "flex mt-2 items-start justify-between",
|
|
3551
|
-
children: [/* @__PURE__ */ jsxs("div", {
|
|
3552
|
-
className: "w-full flex flex-col gap-2",
|
|
3553
|
-
children: [/* @__PURE__ */ jsx(WidgetSelectView, {
|
|
3554
|
-
initialProperty: values,
|
|
3555
|
-
value: selectedFieldConfigId,
|
|
3556
|
-
onValueChange: (value) => onWidgetSelectChanged(value),
|
|
3557
|
-
open: selectOpen,
|
|
3558
|
-
onOpenChange: (open, hasValue) => {
|
|
3559
|
-
if (!hasValue) onDismiss?.();
|
|
3560
|
-
setSelectOpen(open);
|
|
3561
|
-
},
|
|
3562
|
-
disabled,
|
|
3563
|
-
showError: Boolean(selectedWidgetError),
|
|
3564
|
-
existing,
|
|
3565
|
-
propertyConfigs,
|
|
3566
|
-
inArray,
|
|
3567
|
-
propertyTypePresets,
|
|
3568
|
-
hiddenPropertyTypes,
|
|
3569
|
-
onPresetSelected
|
|
3570
|
-
}), !!selectedWidgetError && /* @__PURE__ */ jsx(Typography, {
|
|
3571
|
-
variant: "caption",
|
|
3572
|
-
className: "ml-3.5",
|
|
3573
|
-
color: "error",
|
|
3574
|
-
children: "Required"
|
|
3575
|
-
})]
|
|
3576
|
-
}), onDelete && values?.id && /* @__PURE__ */ jsx(IconButton, {
|
|
3577
|
-
variant: "ghost",
|
|
3578
|
-
className: "mt-1 shrink-0",
|
|
3579
|
-
disabled,
|
|
3580
|
-
onClick: () => setDeleteDialogOpen(true),
|
|
3581
|
-
children: /* @__PURE__ */ jsx(Trash2Icon, { size: iconSize.small })
|
|
3582
|
-
})]
|
|
3583
|
-
}),
|
|
3584
|
-
/* @__PURE__ */ jsxs("div", {
|
|
3585
|
-
className: "grid grid-cols-12 gap-y-8 mt-6 mb-8",
|
|
3586
|
-
children: [
|
|
3587
|
-
includeIdAndTitle && /* @__PURE__ */ jsx(CommonPropertyFields, {
|
|
3588
|
-
showErrors,
|
|
3589
|
-
disabledId: existing,
|
|
3590
|
-
isNewProperty: !existing,
|
|
3591
|
-
disabled,
|
|
3592
|
-
autoUpdateId,
|
|
3593
|
-
ref: nameFieldRef
|
|
3594
|
-
}),
|
|
3595
|
-
childComponent,
|
|
3596
|
-
renderExtraPropertyFields && collectionValues && /* @__PURE__ */ jsx("div", {
|
|
3597
|
-
className: "col-span-12 mt-4 px-2",
|
|
3598
|
-
children: renderExtraPropertyFields({
|
|
3599
|
-
metadata: values.metadata ?? {},
|
|
3600
|
-
onMetadataChange: (key, value) => {
|
|
3601
|
-
const currentMetadata = values.metadata ?? {};
|
|
3602
|
-
setValues({
|
|
3603
|
-
...values,
|
|
3604
|
-
metadata: {
|
|
3605
|
-
...currentMetadata,
|
|
3606
|
-
[key]: value
|
|
3607
|
-
}
|
|
3608
|
-
});
|
|
3609
|
-
},
|
|
3610
|
-
property: toSerializableProperty(values),
|
|
3611
|
-
collection: toSerializableCollectionConfig(collectionValues)
|
|
3612
|
-
})
|
|
3613
|
-
}),
|
|
3614
|
-
/* @__PURE__ */ jsx("div", {
|
|
3615
|
-
className: "col-span-12",
|
|
3616
|
-
children: /* @__PURE__ */ jsx(AdvancedPropertyValidation, { disabled })
|
|
3617
|
-
})
|
|
3618
|
-
]
|
|
3619
|
-
}),
|
|
3620
|
-
onDelete && /* @__PURE__ */ jsx(ConfirmationDialog, {
|
|
3621
|
-
open: deleteDialogOpen,
|
|
3622
|
-
onAccept: () => onDelete(values?.id, propertyNamespace),
|
|
3623
|
-
onCancel: () => setDeleteDialogOpen(false),
|
|
3624
|
-
title: /* @__PURE__ */ jsx("div", { children: "Delete this property?" }),
|
|
3625
|
-
body: /* @__PURE__ */ jsxs("div", { children: [
|
|
3626
|
-
" This will ",
|
|
3627
|
-
/* @__PURE__ */ jsx("b", { children: "not delete any data" }),
|
|
3628
|
-
", only modify the collection."
|
|
3629
|
-
] })
|
|
3630
|
-
})
|
|
3631
|
-
] });
|
|
3632
|
-
}
|
|
3633
|
-
var idRegEx = /^[a-zA-Z_][a-zA-Z0-9_]*$/;
|
|
3634
|
-
function validateId(value, existingPropertyKeys) {
|
|
3635
|
-
let error;
|
|
3636
|
-
if (!value) error = "You must specify an id for the field";
|
|
3637
|
-
if (value && !value.match(idRegEx)) error = "The id can only contain letters, numbers and underscores (_), and not start with a number";
|
|
3638
|
-
if (value && existingPropertyKeys && existingPropertyKeys.includes(value)) error = "There is another field with this ID already";
|
|
3639
|
-
return error;
|
|
3640
|
-
}
|
|
3641
|
-
function validateName(value) {
|
|
3642
|
-
let error;
|
|
3643
|
-
if (!value) error = "You must specify a title for the field";
|
|
3644
|
-
return error;
|
|
3645
|
-
}
|
|
3646
|
-
var WIDGET_TYPE_MAP = {
|
|
3647
|
-
text_field: "Text",
|
|
3648
|
-
multiline: "Text",
|
|
3649
|
-
markdown: "Text",
|
|
3650
|
-
url: "Text",
|
|
3651
|
-
email: "Text",
|
|
3652
|
-
switch: "Boolean",
|
|
3653
|
-
user_select: "Users",
|
|
3654
|
-
select: "Select",
|
|
3655
|
-
multi_select: "Select",
|
|
3656
|
-
number_input: "Number",
|
|
3657
|
-
number_select: "Select",
|
|
3658
|
-
multi_number_select: "Select",
|
|
3659
|
-
file_upload: "File",
|
|
3660
|
-
multi_file_upload: "File",
|
|
3661
|
-
relation: "Relation",
|
|
3662
|
-
reference: "Reference",
|
|
3663
|
-
multi_references: "Reference",
|
|
3664
|
-
date_time: "Date",
|
|
3665
|
-
group: "Group",
|
|
3666
|
-
key_value: "Group",
|
|
3667
|
-
repeat: "Array",
|
|
3668
|
-
custom_array: "Array",
|
|
3669
|
-
block: "Group",
|
|
3670
|
-
vector_input: "Number",
|
|
3671
|
-
geopoint: "Location",
|
|
3672
|
-
binary: "Binary"
|
|
3673
|
-
};
|
|
3674
|
-
var WIDGET_BASE_TYPE_MAP = {
|
|
3675
|
-
text_field: "string",
|
|
3676
|
-
multiline: "string",
|
|
3677
|
-
markdown: "string",
|
|
3678
|
-
url: "string",
|
|
3679
|
-
email: "string",
|
|
3680
|
-
select: "string",
|
|
3681
|
-
multi_select: "string",
|
|
3682
|
-
file_upload: "string",
|
|
3683
|
-
multi_file_upload: "string",
|
|
3684
|
-
user_select: "string",
|
|
3685
|
-
number_input: "number",
|
|
3686
|
-
number_select: "number",
|
|
3687
|
-
multi_number_select: "number",
|
|
3688
|
-
switch: "boolean",
|
|
3689
|
-
date_time: "date",
|
|
3690
|
-
reference: "reference",
|
|
3691
|
-
multi_references: "reference",
|
|
3692
|
-
relation: "relation",
|
|
3693
|
-
group: "map",
|
|
3694
|
-
key_value: "map",
|
|
3695
|
-
block: "map",
|
|
3696
|
-
repeat: "array",
|
|
3697
|
-
custom_array: "array",
|
|
3698
|
-
vector_input: "vector",
|
|
3699
|
-
geopoint: "geopoint",
|
|
3700
|
-
binary: "binary"
|
|
3701
|
-
};
|
|
3702
|
-
function WidgetSelectView({ initialProperty, value, onValueChange, open, onOpenChange, disabled, showError, existing, propertyConfigs, inArray, propertyTypePresets, hiddenPropertyTypes, onPresetSelected }) {
|
|
3703
|
-
const allSupportedFields = Object.entries(supportedFields).concat(Object.entries(propertyConfigs));
|
|
3704
|
-
const filteredFields = hiddenPropertyTypes && !propertyTypePresets ? allSupportedFields.filter(([key]) => {
|
|
3705
|
-
const baseType = WIDGET_BASE_TYPE_MAP[key];
|
|
3706
|
-
return !baseType || !hiddenPropertyTypes.includes(baseType);
|
|
3707
|
-
}) : allSupportedFields;
|
|
3708
|
-
const displayedWidgets = (inArray ? filteredFields.filter(([_, propertyConfig]) => !isPropertyBuilder(propertyConfig.property) && propertyConfig.property?.type !== "array") : filteredFields).map(([key, propertyConfig]) => ({ [key]: propertyConfig })).reduce((a, b) => {
|
|
3709
|
-
return {
|
|
3710
|
-
...a,
|
|
3711
|
-
...b
|
|
3712
|
-
};
|
|
3713
|
-
}, {});
|
|
3714
|
-
const activePreset = useMemo(() => {
|
|
3715
|
-
if (!propertyTypePresets || !initialProperty) return void 0;
|
|
3716
|
-
return propertyTypePresets.find((p) => p.detect?.(toSerializableProperty(initialProperty)));
|
|
3717
|
-
}, [propertyTypePresets, initialProperty]);
|
|
3718
|
-
const key = value;
|
|
3719
|
-
const propertyConfig = key ? DEFAULT_FIELD_CONFIGS[key] ?? propertyConfigs[key] : void 0;
|
|
3720
|
-
const baseProperty = propertyConfig?.property;
|
|
3721
|
-
const baseFieldConfig = baseProperty && !isPropertyBuilder(baseProperty) ? getFieldConfig(baseProperty, propertyConfigs) : void 0;
|
|
3722
|
-
const computedFieldConfig = baseFieldConfig && propertyConfig ? mergeDeep(baseFieldConfig, propertyConfig) : propertyConfig;
|
|
3723
|
-
const groups = [...new Set(Object.keys(displayedWidgets).map((key) => {
|
|
3724
|
-
const group = WIDGET_TYPE_MAP[key];
|
|
3725
|
-
if (group) return group;
|
|
3726
|
-
return "Custom/Other";
|
|
3727
|
-
}))];
|
|
3728
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs("div", {
|
|
3729
|
-
onClick: () => {
|
|
3730
|
-
if (!disabled) onOpenChange(!open, Boolean(value));
|
|
3731
|
-
},
|
|
3732
|
-
className: cls("select-none rounded-md text-sm py-2 px-1 transition-colors duration-200", !disabled && "hover:bg-surface-hover cursor-pointer", "relative flex items-center mb-2"),
|
|
3733
|
-
children: [!value && /* @__PURE__ */ jsx("em", { children: "Select a property widget" }), value && computedFieldConfig && /* @__PURE__ */ jsxs("div", {
|
|
3734
|
-
className: cls("flex items-center"),
|
|
3735
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
3736
|
-
className: "mr-4",
|
|
3737
|
-
children: /* @__PURE__ */ jsx(PropertyConfigBadge, { propertyConfig: computedFieldConfig })
|
|
3738
|
-
}), /* @__PURE__ */ jsxs("div", {
|
|
3739
|
-
className: "flex flex-col items-start text-left",
|
|
3740
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
3741
|
-
className: "font-semibold text-text-primary dark:text-text-primary-dark tracking-tight",
|
|
3742
|
-
children: computedFieldConfig.name
|
|
3743
|
-
}), /* @__PURE__ */ jsx(Typography, {
|
|
3744
|
-
variant: "caption",
|
|
3745
|
-
className: "text-text-secondary dark:text-text-secondary-dark mt-0.5",
|
|
3746
|
-
children: computedFieldConfig.description
|
|
3747
|
-
})]
|
|
3748
|
-
})]
|
|
3749
|
-
})]
|
|
3750
|
-
}), /* @__PURE__ */ jsxs(Dialog, {
|
|
3751
|
-
open,
|
|
3752
|
-
onOpenChange: (open) => onOpenChange(open, Boolean(value)),
|
|
3753
|
-
maxWidth: "4xl",
|
|
3754
|
-
children: [/* @__PURE__ */ jsx(DialogTitle, { children: propertyTypePresets ? "Select a property type" : "Select a property widget" }), /* @__PURE__ */ jsx(DialogContent, { children: propertyTypePresets ? /* @__PURE__ */ jsx("div", {
|
|
3755
|
-
className: "grid grid-cols-1 md:grid-cols-2 gap-x-4 gap-y-2 mt-4",
|
|
3756
|
-
children: propertyTypePresets.map((preset) => /* @__PURE__ */ jsx(Card, {
|
|
3757
|
-
onClick: () => {
|
|
3758
|
-
onPresetSelected?.(preset);
|
|
3759
|
-
onOpenChange(false, true);
|
|
3760
|
-
},
|
|
3761
|
-
className: cls("flex flex-row items-center px-4 py-2 m-1", activePreset?.id === preset.id && "ring-2 ring-primary"),
|
|
3762
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
3763
|
-
className: cls("flex flex-row items-center text-base min-h-[48px]"),
|
|
3764
|
-
children: [preset.icon && /* @__PURE__ */ jsx("div", {
|
|
3765
|
-
className: "mr-4 text-2xl",
|
|
3766
|
-
children: typeof preset.icon === "string" ? preset.icon : preset.icon
|
|
3767
|
-
}), /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Typography, {
|
|
3768
|
-
variant: "label",
|
|
3769
|
-
children: preset.label
|
|
3770
|
-
}) })]
|
|
3771
|
-
})
|
|
3772
|
-
}, preset.id))
|
|
3773
|
-
}) : /* @__PURE__ */ jsx("div", { children: groups.map((group) => {
|
|
3774
|
-
return /* @__PURE__ */ jsxs("div", {
|
|
3775
|
-
className: "mt-4",
|
|
3776
|
-
children: [/* @__PURE__ */ jsx(Typography, {
|
|
3777
|
-
variant: "label",
|
|
3778
|
-
children: group
|
|
3779
|
-
}), /* @__PURE__ */ jsx("div", {
|
|
3780
|
-
className: "grid grid-cols-1 md:grid-cols-2 gap-x-4 gap-y-2 mt-4",
|
|
3781
|
-
children: Object.entries(displayedWidgets).map(([key, propertyConfig]) => {
|
|
3782
|
-
if (WIDGET_TYPE_MAP[key] === group) return /* @__PURE__ */ jsx(WidgetSelectViewItem, {
|
|
3783
|
-
initialProperty,
|
|
3784
|
-
onClick: () => {
|
|
3785
|
-
onValueChange(key);
|
|
3786
|
-
onOpenChange(false, true);
|
|
3787
|
-
},
|
|
3788
|
-
propertyConfig,
|
|
3789
|
-
existing
|
|
3790
|
-
}, key);
|
|
3791
|
-
return null;
|
|
3792
|
-
})
|
|
3793
|
-
})]
|
|
3794
|
-
}, group);
|
|
3795
|
-
}) }) })]
|
|
3796
|
-
})] });
|
|
3797
|
-
}
|
|
3798
|
-
function WidgetSelectViewItem({ onClick, initialProperty, propertyConfig, existing }) {
|
|
3799
|
-
const baseProperty = propertyConfig.property;
|
|
3800
|
-
const shouldWarnChangingtype = existing && !isPropertyBuilder(baseProperty) && baseProperty.type !== initialProperty?.type;
|
|
3801
|
-
return /* @__PURE__ */ jsx(Card, {
|
|
3802
|
-
onClick,
|
|
3803
|
-
className: "flex flex-row items-center px-4 py-2 m-1",
|
|
3804
|
-
children: /* @__PURE__ */ jsxs("div", {
|
|
3805
|
-
className: cls("flex flex-row items-center text-base min-h-[48px]"),
|
|
3806
|
-
children: [/* @__PURE__ */ jsx("div", {
|
|
3807
|
-
className: "mr-8",
|
|
3808
|
-
children: /* @__PURE__ */ jsx(PropertyConfigBadge, {
|
|
3809
|
-
propertyConfig,
|
|
3810
|
-
disabled: shouldWarnChangingtype
|
|
3811
|
-
})
|
|
3812
|
-
}), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
|
|
3813
|
-
className: "flex flex-row gap-2 items-center",
|
|
3814
|
-
children: [shouldWarnChangingtype && /* @__PURE__ */ jsx(Tooltip, {
|
|
3815
|
-
title: "This widget uses a different data type than the initially selected widget. This can cause errors with existing data.",
|
|
3816
|
-
children: /* @__PURE__ */ jsx(AlertTriangleIcon, {
|
|
3817
|
-
size: iconSize.smallest,
|
|
3818
|
-
className: "w-4"
|
|
3819
|
-
})
|
|
3820
|
-
}), /* @__PURE__ */ jsx(Typography, {
|
|
3821
|
-
variant: "label",
|
|
3822
|
-
color: shouldWarnChangingtype ? "secondary" : void 0,
|
|
3823
|
-
children: propertyConfig.name
|
|
3824
|
-
})]
|
|
3825
|
-
}), /* @__PURE__ */ jsx(Typography, {
|
|
3826
|
-
variant: "caption",
|
|
3827
|
-
color: "secondary",
|
|
3828
|
-
className: "max-w-sm",
|
|
3829
|
-
children: propertyConfig.description
|
|
3830
|
-
})] })]
|
|
3831
|
-
})
|
|
3832
|
-
});
|
|
3833
|
-
}
|
|
3834
|
-
//#endregion
|
|
3835
|
-
export { updatePropertyFromWidget as a, useAIModifiedPaths as c, supportedFields as i, PropertyForm as n, PropertyTree as o, PropertyFormDialog as r, AIModifiedPathsProvider as s, PropertyEditView_exports as t };
|
|
3836
|
-
|
|
3837
|
-
//# sourceMappingURL=PropertyEditView-DDB_X-00.js.map
|