@rebasepro/cms 0.28.2 → 0.29.0-canary.g0e3a0e7
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 -3
- package/dist/collection_editor/_cms_internals.d.ts +0 -1
- package/dist/collection_editor/ui/EditorCollectionAction.d.ts +2 -2
- package/dist/collection_editor/ui/EditorCollectionAction.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js +2 -2
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/MarkdownPropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/StoragePropertyField.js.map +1 -1
- package/dist/components/AdditionalFieldValue.d.ts +9 -3
- package/dist/components/AdditionalFieldValue.js +7 -4
- package/dist/components/AdditionalFieldValue.js.map +1 -1
- package/dist/components/CollectionPanel.d.ts +117 -18
- package/dist/components/CollectionPanel.js +115 -37
- package/dist/components/CollectionPanel.js.map +1 -1
- package/dist/components/CollectionTableBinding/CollectionRowActions.d.ts +5 -5
- package/dist/components/CollectionTableBinding/CollectionRowActions.js +16 -12
- package/dist/components/CollectionTableBinding/CollectionRowActions.js.map +1 -1
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js +33 -8
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js.map +1 -1
- package/dist/components/CollectionTableBinding/CollectionTableBindingProps.d.ts +8 -3
- package/dist/components/CollectionTableBinding/PropertyTableCell.js +2 -2
- package/dist/components/CollectionTableBinding/PropertyTableCell.js.map +1 -1
- package/dist/components/CollectionTableBinding/column_utils.d.ts +9 -1
- package/dist/components/CollectionTableBinding/column_utils.js +6 -3
- package/dist/components/CollectionTableBinding/column_utils.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js +2 -2
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js +2 -2
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js +2 -2
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js.map +1 -1
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.d.ts +3 -2
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js +9 -7
- package/dist/components/CollectionTableBinding/internal/CollectionTableToolbar.js.map +1 -1
- package/dist/components/CollectionTableBinding/internal/common.d.ts +26 -2
- package/dist/components/CollectionTableBinding/internal/common.js +88 -4
- package/dist/components/CollectionTableBinding/internal/common.js.map +1 -1
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js +4 -3
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js.map +1 -1
- package/dist/components/CollectionViewBinding/BoardCardBinding.d.ts +7 -1
- package/dist/components/CollectionViewBinding/BoardCardBinding.js +19 -14
- package/dist/components/CollectionViewBinding/BoardCardBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionAddButton.d.ts +28 -0
- package/dist/components/CollectionViewBinding/CollectionAddButton.js +50 -0
- package/dist/components/CollectionViewBinding/CollectionAddButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.d.ts +11 -3
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js +9 -4
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.d.ts +5 -3
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js +5 -3
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionEntityActions.d.ts +29 -0
- package/dist/components/CollectionViewBinding/CollectionEntityActions.js +112 -0
- package/dist/components/CollectionViewBinding/CollectionEntityActions.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.d.ts +2 -2
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js +58 -16
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionToolbar.d.ts +57 -0
- package/dist/components/CollectionViewBinding/CollectionToolbar.js +146 -0
- package/dist/components/CollectionViewBinding/CollectionToolbar.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewActions.d.ts +2 -2
- package/dist/components/CollectionViewBinding/CollectionViewActions.js +22 -26
- package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewBinding.d.ts +58 -22
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js +81 -1089
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewContent.d.ts +9 -0
- package/dist/components/CollectionViewBinding/CollectionViewContent.js +152 -0
- package/dist/components/CollectionViewBinding/CollectionViewContent.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewDialogs.d.ts +9 -0
- package/dist/components/CollectionViewBinding/CollectionViewDialogs.js +38 -0
- package/dist/components/CollectionViewBinding/CollectionViewDialogs.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewFrame.d.ts +13 -0
- package/dist/components/CollectionViewBinding/CollectionViewFrame.js +32 -0
- package/dist/components/CollectionViewBinding/CollectionViewFrame.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewScope.d.ts +14 -0
- package/dist/components/CollectionViewBinding/CollectionViewScope.js +22 -0
- package/dist/components/CollectionViewBinding/CollectionViewScope.js.map +1 -0
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.d.ts +2 -2
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js +39 -67
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js.map +1 -1
- package/dist/components/CollectionViewBinding/CustomViewHost.d.ts +28 -0
- package/dist/components/CollectionViewBinding/CustomViewHost.js +54 -0
- package/dist/components/CollectionViewBinding/CustomViewHost.js.map +1 -0
- package/dist/components/CollectionViewBinding/EntitiesCount.d.ts +24 -0
- package/dist/components/CollectionViewBinding/EntitiesCount.js +69 -0
- package/dist/components/CollectionViewBinding/EntitiesCount.js.map +1 -0
- package/dist/components/CollectionViewBinding/EntityCardBinding.d.ts +7 -1
- package/dist/components/CollectionViewBinding/EntityCardBinding.js +34 -23
- package/dist/components/CollectionViewBinding/EntityCardBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.d.ts +17 -0
- package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.js +107 -0
- package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.js.map +1 -0
- package/dist/components/CollectionViewBinding/FiltersButton.d.ts +15 -0
- package/dist/components/CollectionViewBinding/FiltersButton.js +49 -0
- package/dist/components/CollectionViewBinding/FiltersButton.js.map +1 -0
- package/dist/components/CollectionViewBinding/PluginColumnSlots.d.ts +35 -0
- package/dist/components/CollectionViewBinding/PluginColumnSlots.js +45 -0
- package/dist/components/CollectionViewBinding/PluginColumnSlots.js.map +1 -0
- package/dist/components/CollectionViewBinding/RowActions.d.ts +40 -0
- package/dist/components/CollectionViewBinding/RowActions.js +60 -0
- package/dist/components/CollectionViewBinding/RowActions.js.map +1 -0
- package/dist/components/CollectionViewBinding/SplitListView.d.ts +7 -4
- package/dist/components/CollectionViewBinding/SplitListView.js +20 -21
- package/dist/components/CollectionViewBinding/SplitListView.js.map +1 -1
- package/dist/components/CollectionViewBinding/builtin_action_props.d.ts +13 -0
- package/dist/components/CollectionViewBinding/fields.d.ts +22 -0
- package/dist/components/CollectionViewBinding/fields.js +47 -0
- package/dist/components/CollectionViewBinding/fields.js.map +1 -0
- package/dist/components/CollectionViewBinding/useBoardDataController.js +6 -7
- package/dist/components/CollectionViewBinding/useBoardDataController.js.map +1 -1
- package/dist/components/CollectionViewBinding/useCollectionLargeLayout.d.ts +19 -0
- package/dist/components/CollectionViewBinding/useCollectionLargeLayout.js +28 -0
- package/dist/components/CollectionViewBinding/useCollectionLargeLayout.js.map +1 -0
- package/dist/components/CollectionViewBinding/useCollectionViewState.d.ts +125 -0
- package/dist/components/CollectionViewBinding/useCollectionViewState.js +844 -0
- package/dist/components/CollectionViewBinding/useCollectionViewState.js.map +1 -0
- package/dist/components/CollectionViewBinding/usePreviewSlots.d.ts +20 -0
- package/dist/components/CollectionViewBinding/usePreviewSlots.js +23 -2
- package/dist/components/CollectionViewBinding/usePreviewSlots.js.map +1 -1
- package/dist/components/CollectionViewBinding/useSelectionController.d.ts +21 -3
- package/dist/components/CollectionViewBinding/useSelectionController.js +37 -6
- package/dist/components/CollectionViewBinding/useSelectionController.js.map +1 -1
- package/dist/components/CollectionsProvider.d.ts +3 -3
- package/dist/components/CollectionsProvider.js +4 -4
- package/dist/components/CollectionsProvider.js.map +1 -1
- package/dist/components/CollectionsScopeContext.d.ts +1 -1
- package/dist/components/CollectionsScopeContext.js +1 -1
- package/dist/components/CollectionsScopeContext.js.map +1 -1
- package/dist/components/DeleteEntityDialog.d.ts +1 -1
- package/dist/components/DeleteEntityDialog.js +2 -2
- package/dist/components/DeleteEntityDialog.js.map +1 -1
- package/dist/components/DetailViewBinding.js +32 -68
- package/dist/components/DetailViewBinding.js.map +1 -1
- package/dist/components/EditFormActions.js +5 -4
- package/dist/components/EditFormActions.js.map +1 -1
- package/dist/components/EditViewBinding.d.ts +2 -2
- package/dist/components/EditViewBinding.js +25 -15
- package/dist/components/EditViewBinding.js.map +1 -1
- package/dist/components/EntityDisplayHeader.js +8 -5
- package/dist/components/EntityDisplayHeader.js.map +1 -1
- package/dist/components/EntityPreviewBinding.js +1 -1
- package/dist/components/EntityPreviewBinding.js.map +1 -1
- package/dist/components/EntityViewBinding.d.ts +8 -1
- package/dist/components/EntityViewBinding.js +43 -14
- package/dist/components/EntityViewBinding.js.map +1 -1
- package/dist/components/EntityViewBody.d.ts +40 -0
- package/dist/components/EntityViewBody.js +90 -0
- package/dist/components/EntityViewBody.js.map +1 -0
- package/dist/components/FieldValue.d.ts +50 -0
- package/dist/components/FieldValue.js +81 -0
- package/dist/components/FieldValue.js.map +1 -0
- package/dist/components/InlineEntityPreview.js +1 -1
- package/dist/components/InlineEntityPreview.js.map +1 -1
- package/dist/components/PanelNotFound.d.ts +5 -0
- package/dist/components/PanelNotFound.js +21 -0
- package/dist/components/PanelNotFound.js.map +1 -0
- package/dist/components/RebaseCMS.d.ts +1 -1
- package/dist/components/RebaseCMS.js +11 -3
- package/dist/components/RebaseCMS.js.map +1 -1
- package/dist/components/RebaseNavigation.js +9 -3
- package/dist/components/RebaseNavigation.js.map +1 -1
- package/dist/components/RebaseShell.js +10 -5
- package/dist/components/RebaseShell.js.map +1 -1
- package/dist/components/RecordDetail.d.ts +61 -0
- package/dist/components/RecordDetail.js +123 -0
- package/dist/components/RecordDetail.js.map +1 -0
- package/dist/components/RecordForm.d.ts +126 -0
- package/dist/components/{EntityFormPanel.js → RecordForm.js} +64 -36
- package/dist/components/RecordForm.js.map +1 -0
- package/dist/components/ReferenceTable/SelectionTableBinding.d.ts +47 -17
- package/dist/components/ReferenceTable/SelectionTableBinding.js +89 -53
- package/dist/components/ReferenceTable/SelectionTableBinding.js.map +1 -1
- package/dist/components/ReferenceWidget.d.ts +5 -3
- package/dist/components/ReferenceWidget.js +10 -7
- package/dist/components/ReferenceWidget.js.map +1 -1
- package/dist/components/RelationSelector.js +4 -4
- package/dist/components/RelationSelector.js.map +1 -1
- package/dist/components/SelectableTable/SelectableTable.js +2 -3
- package/dist/components/SelectableTable/SelectableTable.js.map +1 -1
- package/dist/components/SelectableTable/SelectionStore.d.ts +1 -1
- package/dist/components/SelectableTable/SelectionStore.js +1 -1
- package/dist/components/SelectableTable/SelectionStore.js.map +1 -1
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js +2 -2
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js.map +1 -1
- package/dist/components/SidePanelBinding.js +13 -12
- package/dist/components/SidePanelBinding.js.map +1 -1
- package/dist/components/collection_prop.d.ts +18 -0
- package/dist/components/collection_prop.js +23 -0
- package/dist/components/collection_prop.js.map +1 -0
- package/dist/components/common/default_entity_actions.js +54 -54
- package/dist/components/common/default_entity_actions.js.map +1 -1
- package/dist/components/history/EntityHistoryView.d.ts +4 -1
- package/dist/components/history/EntityHistoryView.js +1 -1
- package/dist/components/history/EntityHistoryView.js.map +1 -1
- package/dist/components/history/LastEditedByFormAction.d.ts +1 -1
- package/dist/components/index.d.ts +4 -2
- package/dist/data_export/export/ExportCollectionAction.d.ts +3 -2
- package/dist/data_export/export/ExportCollectionAction.js +4 -3
- package/dist/data_export/export/ExportCollectionAction.js.map +1 -1
- package/dist/data_export/export/additional_fields.d.ts +6 -3
- package/dist/data_export/export/additional_fields.js +8 -4
- package/dist/data_export/export/additional_fields.js.map +1 -1
- package/dist/data_import/import/ImportCollectionAction.js +2 -2
- package/dist/data_import/import/ImportCollectionAction.js.map +1 -1
- package/dist/form/EntityForm.d.ts +1 -1
- package/dist/form/EntityForm.js +252 -150
- package/dist/form/EntityForm.js.map +1 -1
- package/dist/form/EntityFormActions.js +3 -2
- package/dist/form/EntityFormActions.js.map +1 -1
- package/dist/form/EntityFormBinding.d.ts +1 -1
- package/dist/form/EntityFormBinding.js +22 -11
- package/dist/form/EntityFormBinding.js.map +1 -1
- package/dist/form/FormField.d.ts +36 -0
- package/dist/form/FormField.js +41 -0
- package/dist/form/FormField.js.map +1 -0
- package/dist/form/FormFieldsContext.d.ts +69 -0
- package/dist/form/FormFieldsContext.js +143 -0
- package/dist/form/FormFieldsContext.js.map +1 -0
- package/dist/form/PropertyFieldBinding.js +4 -4
- package/dist/form/PropertyFieldBinding.js.map +1 -1
- package/dist/form/collection_showing.d.ts +8 -0
- package/dist/form/collection_showing.js +29 -0
- package/dist/form/collection_showing.js.map +1 -0
- package/dist/form/components/ErrorFocus.js +2 -1
- package/dist/form/components/ErrorFocus.js.map +1 -1
- package/dist/form/components/FieldBlock.js +3 -1
- package/dist/form/components/FieldBlock.js.map +1 -1
- package/dist/form/components/FormRail.d.ts +5 -1
- package/dist/form/components/FormRail.js +5 -1
- package/dist/form/components/FormRail.js.map +1 -1
- package/dist/form/components/FormSections.d.ts +5 -1
- package/dist/form/components/FormSections.js +11 -4
- package/dist/form/components/FormSections.js.map +1 -1
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js +2 -2
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js +1 -1
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js +2 -2
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/ReadOnlyFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/ReferenceFieldBinding.js +2 -2
- package/dist/form/field_bindings/ReferenceFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/RelationFieldBinding.js +2 -2
- package/dist/form/field_bindings/RelationFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.js +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.js.map +1 -1
- package/dist/form/form_dom_ids.d.ts +25 -0
- package/dist/form/form_dom_ids.js +42 -0
- package/dist/form/form_dom_ids.js.map +1 -0
- package/dist/form/index.d.ts +3 -1
- package/dist/form/resolve_cell_property.d.ts +5 -0
- package/dist/form/resolve_cell_property.js +22 -1
- package/dist/form/resolve_cell_property.js.map +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/navigation/useBuildNavigationStateController.d.ts +2 -2
- package/dist/hooks/navigation/useBuildNavigationStateController.js.map +1 -1
- package/dist/hooks/navigation/useNavigationResolution.d.ts +3 -3
- package/dist/hooks/navigation/useNavigationResolution.js.map +1 -1
- package/dist/hooks/navigation/useResolvedCollections.d.ts +2 -2
- package/dist/hooks/navigation/useResolvedCollections.js.map +1 -1
- package/dist/hooks/navigation/useResolvedViews.d.ts +2 -2
- package/dist/hooks/navigation/useResolvedViews.js.map +1 -1
- package/dist/hooks/useBuildSidePanel.js +9 -9
- package/dist/hooks/useBuildSidePanel.js.map +1 -1
- package/dist/hooks/useEntityDisplay.js +6 -4
- package/dist/hooks/useEntityDisplay.js.map +1 -1
- package/dist/hooks/useRecordActions.js +2 -2
- package/dist/hooks/useRecordActions.js.map +1 -1
- package/dist/hooks/useSelectionDialog.d.ts +20 -7
- package/dist/hooks/useSelectionDialog.js +29 -8
- package/dist/hooks/useSelectionDialog.js.map +1 -1
- package/dist/index.d.ts +8 -3
- package/dist/index.js +15 -9
- package/dist/mcp-view.d.ts +9 -0
- package/dist/mcp-view.js +2 -0
- package/dist/mcp_view/app_modules.d.ts +29 -0
- package/dist/mcp_view/app_modules.js +163 -0
- package/dist/mcp_view/app_modules.js.map +1 -0
- package/dist/mcp_view/bridge.d.ts +90 -0
- package/dist/mcp_view/bridge.js +205 -0
- package/dist/mcp_view/bridge.js.map +1 -0
- package/dist/mcp_view/code_app.d.ts +65 -0
- package/dist/mcp_view/code_app.js +139 -0
- package/dist/mcp_view/code_app.js.map +1 -0
- package/dist/mcp_view/index.d.ts +48 -0
- package/dist/mcp_view/index.js +235 -0
- package/dist/mcp_view/index.js.map +1 -0
- package/dist/mcp_view/payload.d.ts +78 -0
- package/dist/mcp_view/payload.js +155 -0
- package/dist/mcp_view/payload.js.map +1 -0
- package/dist/mcp_view/screen.d.ts +28 -0
- package/dist/mcp_view/screen.js +223 -0
- package/dist/mcp_view/screen.js.map +1 -0
- package/dist/mcp_view/storage_source.d.ts +14 -0
- package/dist/mcp_view/storage_source.js +29 -0
- package/dist/mcp_view/storage_source.js.map +1 -0
- package/dist/mcp_view/store.d.ts +9 -0
- package/dist/mcp_view/store.js +27 -0
- package/dist/mcp_view/store.js.map +1 -0
- package/dist/mcp_view/tool_driver.d.ts +135 -0
- package/dist/mcp_view/tool_driver.js +527 -0
- package/dist/mcp_view/tool_driver.js.map +1 -0
- package/dist/preview/components/DatePreview.d.ts +34 -1
- package/dist/preview/components/DatePreview.js +72 -37
- package/dist/preview/components/DatePreview.js.map +1 -1
- package/dist/routes/RebaseRoute.js +1 -1
- package/dist/routes/RebaseRoute.js.map +1 -1
- package/dist/selection/SelectionMenu.d.ts +5 -3
- package/dist/selection/SelectionMenu.js +16 -9
- package/dist/selection/SelectionMenu.js.map +1 -1
- package/dist/selection/index.d.ts +2 -1
- package/dist/selection/resolve_selection.d.ts +61 -7
- package/dist/selection/resolve_selection.js +93 -11
- package/dist/selection/resolve_selection.js.map +1 -1
- package/dist/types/components/EntityFormProps.d.ts +60 -10
- package/dist/types/fields.d.ts +2 -65
- package/dist/util/dataControllerAdapter.d.ts +8 -0
- package/dist/util/dataControllerAdapter.js +11 -0
- package/dist/util/dataControllerAdapter.js.map +1 -1
- package/dist/util/navigation_utils.d.ts +5 -4
- package/dist/util/navigation_utils.js +6 -6
- package/dist/util/navigation_utils.js.map +1 -1
- package/dist/util/propertyConfigMapper.d.ts +8 -0
- package/dist/util/propertyConfigMapper.js +16 -2
- package/dist/util/propertyConfigMapper.js.map +1 -1
- package/package.json +15 -9
- package/recipes/README.md +79 -26
- package/recipes/approval-queue.tsx +79 -0
- package/recipes/bulk-set-status.tsx +23 -17
- package/recipes/calendar-view.tsx +28 -23
- package/recipes/master-detail.tsx +75 -0
- package/recipes/my-preferences.tsx +3 -3
- package/recipes/orders-dashboard.tsx +58 -84
- package/recipes/site-settings.tsx +4 -4
- package/dist/components/EntityFormPanel.d.ts +0 -63
- package/dist/components/EntityFormPanel.js.map +0 -1
package/dist/form/EntityForm.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { FormDomScopeContext, domScopeFromId } from "./form_dom_ids.js";
|
|
2
|
+
import { formViewer, resolvePropertiesForValidation, withoutUnwritableDefaults } from "./resolve_form_properties.js";
|
|
3
|
+
import { FormUploadsContext, createFormUploadTracker } from "./form_uploads.js";
|
|
4
|
+
import { applyValueTransforms, getEntitySchema, uniqueValueErrors } from "./validation.js";
|
|
5
|
+
import { FormFieldsContext, renderFormField } from "./FormFieldsContext.js";
|
|
4
6
|
import { FormRail, RecordMeta } from "./components/FormRail.js";
|
|
5
7
|
import { FormSections } from "./components/FormSections.js";
|
|
6
8
|
import { useRailVisible } from "./components/useRailVisible.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { applyValueTransforms, getEntitySchema, uniqueValueErrors } from "./validation.js";
|
|
10
|
-
import { PropertyFieldBinding } from "./PropertyFieldBinding.js";
|
|
9
|
+
import { propertiesOfFields } from "./resolve_cell_property.js";
|
|
10
|
+
import { collectionShowing } from "./collection_showing.js";
|
|
11
11
|
import { ErrorFocus } from "./components/ErrorFocus.js";
|
|
12
12
|
import { EntityFormActions } from "./EntityFormActions.js";
|
|
13
13
|
import { getChangedProperties, overlayEdit, serverViolationErrors, withoutUnsetNulls, zodToFormErrors } from "./form_utils.js";
|
|
14
14
|
import { LocalChangesMenu } from "./components/LocalChangesMenu.js";
|
|
15
15
|
import { useUndoableDiscard } from "./useUndoableDiscard.js";
|
|
16
16
|
import { ownsKeystroke, registerKeyboardScope } from "./form_keyboard_scope.js";
|
|
17
|
-
import { Suspense, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
17
|
+
import { Suspense, useCallback, useEffect, useId, useMemo, useRef, useState } from "react";
|
|
18
18
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
19
19
|
import { deepEqual } from "fast-equals";
|
|
20
|
-
import { Alert,
|
|
21
|
-
import {
|
|
22
|
-
import { flattenKeys, getFormFieldKeys,
|
|
20
|
+
import { Alert, Button, CircularProgressCenter, Dialog, DialogActions, DialogContent, DialogTitle, ErrorBoundary, Typography, cls, defaultBorderMixin, isKeyHandled, useDebouncedCallback } from "@rebasepro/ui";
|
|
21
|
+
import { getCopyValues, getDefaultValuesFor, hasEntityId } from "@rebasepro/common";
|
|
22
|
+
import { entityOfRow, flattenKeys, getFormFieldKeys, idOfRow, isDisabled, isReadOnly, resolveFormLayout, rowOfEntity, useAuthController, useCustomizationController, useTranslation } from "@rebasepro/app";
|
|
23
23
|
import { Formex, useCreateFormex } from "@rebasepro/forms";
|
|
24
24
|
//#region src/form/EntityForm.tsx
|
|
25
25
|
/**
|
|
@@ -31,15 +31,21 @@ import { Formex, useCreateFormex } from "@rebasepro/forms";
|
|
|
31
31
|
*
|
|
32
32
|
* @group Components
|
|
33
33
|
*/
|
|
34
|
-
function EntityForm({ path,
|
|
34
|
+
function EntityForm({ path, id: entityIdProp, collection, onValuesModified, onIdChange, onSaved, row: rowProp, initialDirtyValues, onFormContextReady, initialStatus, className, onStatusChange, onRowChange, openEntityMode = "full_screen", formex: formexProp, disabled: disabledProp, Builder, parentCollectionSlugs, parentEntityIds, EntityFormActionsComponent = EntityFormActions, showDefaultActions = true, navigateBack: navigateBackProp, children, fields: fieldsProp, layout: customLayout, compact = false, onSubmit: onSubmitProp, onValuesChangeDeferred: onValuesChangeDeferredProp, onReset: onResetProp, uniqueFieldValidator: uniqueFieldValidatorProp, lockedPropertyKeys, beforeFields, afterFields, pluginActions: pluginActionsProp, computedInitialValues, hasLocalChanges: hasLocalChangesProp, localChangesData, manualApplyLocalChanges, localChangesCacheKey, onClearLocalChanges }) {
|
|
35
35
|
const navigateBack = useCallback(() => {
|
|
36
36
|
if (navigateBackProp) navigateBackProp();
|
|
37
37
|
}, [navigateBackProp]);
|
|
38
38
|
const authController = useAuthController();
|
|
39
39
|
const [status, setStatus] = useState(initialStatus);
|
|
40
|
+
const entityProp = useMemo(() => rowProp ? entityOfRow(rowProp, entityIdProp ?? idOfRow(rowProp, collection) ?? "", path, collection) : void 0, [
|
|
41
|
+
rowProp,
|
|
42
|
+
entityIdProp,
|
|
43
|
+
path,
|
|
44
|
+
collection
|
|
45
|
+
]);
|
|
40
46
|
/**
|
|
41
47
|
* The record as this form last saved it. A create turns the form into the
|
|
42
|
-
* editor of the record it made, and the `
|
|
48
|
+
* editor of the record it made, and the `row` prop names that record
|
|
43
49
|
* only once the caller has caught up — a caller that never does (the form
|
|
44
50
|
* used on its own) left an "existing" form with no record: it re-seeded
|
|
45
51
|
* itself with the defaults and refused the next Save.
|
|
@@ -179,7 +185,10 @@ function EntityForm({ path, entityId: entityIdProp, collection, onValuesModified
|
|
|
179
185
|
* the autosave runs it before each write.
|
|
180
186
|
*/
|
|
181
187
|
async function validateForSave(values) {
|
|
182
|
-
const errors =
|
|
188
|
+
const errors = {
|
|
189
|
+
...await validationErrorsFor(values),
|
|
190
|
+
...unshownRequiredErrors()
|
|
191
|
+
};
|
|
183
192
|
if (status !== "existing" || !entity?.values || Object.keys(errors).length === 0) {
|
|
184
193
|
setPredatingViolations({});
|
|
185
194
|
return errors;
|
|
@@ -226,14 +235,17 @@ function EntityForm({ path, entityId: entityIdProp, collection, onValuesModified
|
|
|
226
235
|
setSavedEntity(updatedEntity);
|
|
227
236
|
onResetProp?.();
|
|
228
237
|
onValuesModified?.(false, updatedEntity.values);
|
|
229
|
-
|
|
238
|
+
onRowChange?.({
|
|
239
|
+
row: rowOfEntity(updatedEntity, collection),
|
|
240
|
+
id: String(updatedEntity.id)
|
|
241
|
+
});
|
|
230
242
|
updateStatus("existing");
|
|
231
243
|
setEntityId(updatedEntity.id);
|
|
232
244
|
if (onSaved) onSaved({
|
|
233
|
-
|
|
245
|
+
row: rowOfEntity(updatedEntity, collection),
|
|
246
|
+
id: String(updatedEntity.id),
|
|
234
247
|
status,
|
|
235
248
|
path,
|
|
236
|
-
entityId: updatedEntity.id,
|
|
237
249
|
collection
|
|
238
250
|
});
|
|
239
251
|
};
|
|
@@ -252,8 +264,10 @@ function EntityForm({ path, entityId: entityIdProp, collection, onValuesModified
|
|
|
252
264
|
return Promise.resolve();
|
|
253
265
|
}
|
|
254
266
|
return Promise.resolve(onSubmitProp(valuesToSave, formex)).then((result) => {
|
|
255
|
-
if (result)
|
|
256
|
-
|
|
267
|
+
if (!result) return;
|
|
268
|
+
const saved = entityOfRow(result.row, result.id, path, collection);
|
|
269
|
+
afterSave(saved);
|
|
270
|
+
return saved;
|
|
257
271
|
}).catch((e) => {
|
|
258
272
|
console.error(e);
|
|
259
273
|
setSavingError(e);
|
|
@@ -262,17 +276,17 @@ function EntityForm({ path, entityId: entityIdProp, collection, onValuesModified
|
|
|
262
276
|
});
|
|
263
277
|
};
|
|
264
278
|
const disabled = formex.isSubmitting || Boolean(disabledProp);
|
|
265
|
-
const
|
|
279
|
+
const row = entity ? rowOfEntity(entity, collection) : void 0;
|
|
266
280
|
const formContext = {
|
|
267
281
|
setFieldValue: useCallback((key, value) => formex.setFieldValue(key, value), []),
|
|
268
282
|
values: formex.values,
|
|
269
283
|
collection,
|
|
270
|
-
entityId,
|
|
284
|
+
id: entityId,
|
|
271
285
|
path,
|
|
272
286
|
save,
|
|
273
287
|
submit: formex.handleSubmit,
|
|
274
288
|
formex,
|
|
275
|
-
|
|
289
|
+
row,
|
|
276
290
|
savingError,
|
|
277
291
|
status,
|
|
278
292
|
openEntityMode,
|
|
@@ -312,9 +326,9 @@ function EntityForm({ path, entityId: entityIdProp, collection, onValuesModified
|
|
|
312
326
|
save: (values) => latestRef.current.save(values),
|
|
313
327
|
submit: () => latestRef.current.formex.handleSubmit(),
|
|
314
328
|
collection,
|
|
315
|
-
entityId,
|
|
329
|
+
id: entityId,
|
|
316
330
|
path,
|
|
317
|
-
|
|
331
|
+
row,
|
|
318
332
|
savingError,
|
|
319
333
|
status,
|
|
320
334
|
openEntityMode,
|
|
@@ -325,7 +339,7 @@ function EntityForm({ path, entityId: entityIdProp, collection, onValuesModified
|
|
|
325
339
|
collection,
|
|
326
340
|
entityId,
|
|
327
341
|
path,
|
|
328
|
-
|
|
342
|
+
row,
|
|
329
343
|
savingError,
|
|
330
344
|
status,
|
|
331
345
|
openEntityMode,
|
|
@@ -381,7 +395,7 @@ function EntityForm({ path, entityId: entityIdProp, collection, onValuesModified
|
|
|
381
395
|
* values being judged.
|
|
382
396
|
*/
|
|
383
397
|
function validationPropertiesFor(values) {
|
|
384
|
-
|
|
398
|
+
const properties = resolvePropertiesForValidation({
|
|
385
399
|
properties: collection.properties,
|
|
386
400
|
isNew: status === "new" || status === "copy",
|
|
387
401
|
values,
|
|
@@ -391,6 +405,17 @@ function EntityForm({ path, entityId: entityIdProp, collection, onValuesModified
|
|
|
391
405
|
propertyConfigs: customizationController.propertyConfigs,
|
|
392
406
|
authController
|
|
393
407
|
});
|
|
408
|
+
const shown = shownFieldKeys();
|
|
409
|
+
if (!shown) return properties;
|
|
410
|
+
return propertiesOfFields(properties, customLayout !== void 0 ? [...shown, ...editedFieldKeys(values)] : shown);
|
|
411
|
+
}
|
|
412
|
+
/** The top-level fields this edit changed from the baseline, or touched. */
|
|
413
|
+
function editedFieldKeys(values) {
|
|
414
|
+
const baseline = baseInitialValues ?? {};
|
|
415
|
+
const current = values;
|
|
416
|
+
const changed = Object.keys(current).filter((key) => !deepEqual(current[key], baseline[key]));
|
|
417
|
+
const touched = Object.entries(formex.touched).filter(([, isTouched]) => isTouched).map(([key]) => key.split("[")[0]);
|
|
418
|
+
return [...changed, ...touched];
|
|
394
419
|
}
|
|
395
420
|
useOnAutoSave(autoSave, formex, lastSavedValues, save);
|
|
396
421
|
/**
|
|
@@ -432,19 +457,21 @@ function EntityForm({ path, entityId: entityIdProp, collection, onValuesModified
|
|
|
432
457
|
return updated;
|
|
433
458
|
});
|
|
434
459
|
}, [baseInitialValues]);
|
|
435
|
-
const
|
|
460
|
+
const shownCollection = useMemo(() => fieldsProp ? collectionShowing(collection, fieldsProp) : collection, [collection, fieldsProp?.join(",")]);
|
|
461
|
+
const formFieldKeys = getFormFieldKeys(shownCollection);
|
|
436
462
|
const layout = useMemo(() => resolveFormLayout({
|
|
437
|
-
collection,
|
|
463
|
+
collection: shownCollection,
|
|
438
464
|
fieldKeys: formFieldKeys,
|
|
439
465
|
status
|
|
440
466
|
}), [
|
|
441
|
-
|
|
467
|
+
shownCollection,
|
|
442
468
|
formFieldKeys.join(","),
|
|
443
469
|
status
|
|
444
470
|
]);
|
|
445
471
|
const formElementRef = useRef(null);
|
|
446
472
|
const railVisible = useRailVisible(formElementRef);
|
|
447
|
-
const
|
|
473
|
+
const generatedFields = !Builder && customLayout === void 0;
|
|
474
|
+
const showRail = generatedFields && layout.hasRail && railVisible && !compact;
|
|
448
475
|
const [collapsedSections, setCollapsedSections] = useState(() => new Set(layout.sections.filter((s) => s.collapsed).map((s) => s.key)));
|
|
449
476
|
const toggleSection = useCallback((key) => {
|
|
450
477
|
setCollapsedSections((prev) => {
|
|
@@ -457,6 +484,7 @@ function EntityForm({ path, entityId: entityIdProp, collection, onValuesModified
|
|
|
457
484
|
const errorKeys = useMemo(() => new Set(formex.submitCount > 0 ? Object.keys(formex.errors) : []), [formex.errors, formex.submitCount]);
|
|
458
485
|
const autoFocusKey = useMemo(() => {
|
|
459
486
|
if (status !== "new" && status !== "copy") return void 0;
|
|
487
|
+
if (!generatedFields) return void 0;
|
|
460
488
|
return [...layout.sections.flatMap((s) => s.fields), ...layout.sidebar].find((field) => {
|
|
461
489
|
const property = collection.properties?.[field.key];
|
|
462
490
|
return property ? !isFieldDisabled(field.key, property) : false;
|
|
@@ -466,99 +494,151 @@ function EntityForm({ path, entityId: entityIdProp, collection, onValuesModified
|
|
|
466
494
|
collection,
|
|
467
495
|
status,
|
|
468
496
|
disabledProp,
|
|
469
|
-
lockedPropertyKeys
|
|
497
|
+
lockedPropertyKeys,
|
|
498
|
+
generatedFields
|
|
470
499
|
]);
|
|
500
|
+
/**
|
|
501
|
+
* Every rule that disables a field but a save in progress, which a field
|
|
502
|
+
* reads from the form itself (see `FormFieldsContext`).
|
|
503
|
+
*/
|
|
471
504
|
function isFieldDisabled(key, property) {
|
|
472
505
|
const isNew = status === "new" || status === "copy";
|
|
473
506
|
const isIdAndAuto = (property.type === "string" || property.type === "number") && "isId" in property && typeof property.isId === "string" && property.isId !== "manual";
|
|
474
|
-
return Boolean(disabledProp ||
|
|
507
|
+
return Boolean(disabledProp || isReadOnly(property) || isDisabled(property) || !isNew && "isId" in property && Boolean(property.isId) || isNew && isIdAndAuto || isNew && lockedPropertyKeys?.includes(key));
|
|
475
508
|
}
|
|
476
|
-
const
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
children: /* @__PURE__ */ jsx(AdditionalFieldValue, {
|
|
488
|
-
field: additionalField,
|
|
489
|
-
entity,
|
|
490
|
-
context: rebaseContext
|
|
491
|
-
})
|
|
492
|
-
});
|
|
493
|
-
return /* @__PURE__ */ jsx("div", {
|
|
494
|
-
className: spanClass(field.span),
|
|
495
|
-
children: /* @__PURE__ */ jsx(FieldBlock, {
|
|
496
|
-
propertyKey: field.key,
|
|
497
|
-
showLabel: true,
|
|
498
|
-
label: additionalField.name,
|
|
499
|
-
icon: /* @__PURE__ */ jsx(AlignLeftIcon, { size: 14 }),
|
|
500
|
-
children: /* @__PURE__ */ jsx("div", {
|
|
501
|
-
className: cls(paperMixin, "w-full min-h-12 p-4 md:p-6 overflow-x-auto no-scrollbar"),
|
|
502
|
-
children: child
|
|
503
|
-
})
|
|
504
|
-
})
|
|
505
|
-
}, `additional_${field.key}`);
|
|
506
|
-
}
|
|
507
|
-
const property = collection.properties?.[field.key];
|
|
508
|
-
if (!property) {
|
|
509
|
-
console.warn(`Property ${field.key} not found in collection ${collection.name} in properties or additional fields. Skipping.`);
|
|
510
|
-
return null;
|
|
511
|
-
}
|
|
512
|
-
if (property.conditions?.hidden || effectiveAccess(property)) {
|
|
513
|
-
const shown = resolveFormProperty({
|
|
514
|
-
propertyKey: field.key,
|
|
515
|
-
property,
|
|
516
|
-
values: formex.values,
|
|
517
|
-
previousValues: baseInitialValues,
|
|
518
|
-
path,
|
|
519
|
-
entityId,
|
|
520
|
-
propertyConfigs: customizationController.propertyConfigs,
|
|
521
|
-
ignoreMissingFields: true,
|
|
522
|
-
authController
|
|
523
|
-
});
|
|
524
|
-
if (!shown || isHidden(shown)) return null;
|
|
525
|
-
}
|
|
526
|
-
const underlyingValueHasChanged = field.key in underlyingChanges && !deepEqual(formex.values[field.key], underlyingChanges[field.key]);
|
|
527
|
-
const disabled = isFieldDisabled(field.key, property);
|
|
528
|
-
const selfLabelling = isSelfLabellingProperty(property);
|
|
529
|
-
const labelInside = !selfLabelling && labelsInsideControl(property, customizationController.propertyConfigs);
|
|
530
|
-
const cmsFormFieldProps = {
|
|
531
|
-
propertyKey: field.key,
|
|
532
|
-
disabled,
|
|
533
|
-
property,
|
|
534
|
-
includeDescription: false,
|
|
535
|
-
hideLabel: !selfLabelling && !labelInside,
|
|
536
|
-
underlyingValueHasChanged: underlyingValueHasChanged && !autoSave,
|
|
537
|
-
context: fieldContext,
|
|
538
|
-
partOfArray: false,
|
|
539
|
-
minimalistView: false,
|
|
540
|
-
size: "large",
|
|
541
|
-
autoFocus: autoFocusKey === field.key
|
|
509
|
+
const registeredFields = useRef(/* @__PURE__ */ new Map());
|
|
510
|
+
const [registeredVersion, setRegisteredVersion] = useState(0);
|
|
511
|
+
const registerField = useCallback((key) => {
|
|
512
|
+
const registered = registeredFields.current;
|
|
513
|
+
registered.set(key, (registered.get(key) ?? 0) + 1);
|
|
514
|
+
setRegisteredVersion((v) => v + 1);
|
|
515
|
+
return () => {
|
|
516
|
+
const count = (registered.get(key) ?? 1) - 1;
|
|
517
|
+
if (count > 0) registered.set(key, count);
|
|
518
|
+
else registered.delete(key);
|
|
519
|
+
setRegisteredVersion((v) => v + 1);
|
|
542
520
|
};
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
521
|
+
}, []);
|
|
522
|
+
/**
|
|
523
|
+
* The fields this form shows, when it shows some and not all: the ones a
|
|
524
|
+
* `layout`'s `<FormField>`s draw, or the ones `fields` names. Undefined
|
|
525
|
+
* for the generated form of every field, which judges them all.
|
|
526
|
+
*/
|
|
527
|
+
function shownFieldKeys() {
|
|
528
|
+
if (customLayout !== void 0) return [...registeredFields.current.keys()];
|
|
529
|
+
if (fieldsProp) return layoutFieldKeys(layout);
|
|
530
|
+
}
|
|
531
|
+
/**
|
|
532
|
+
* What a new record needs that this form will not ask for: a required
|
|
533
|
+
* field it does not show, opening empty — no default, no value handed in,
|
|
534
|
+
* not filled by the server or the database (the validation properties
|
|
535
|
+
* already relax those on create). Such a form can only fail to save, so
|
|
536
|
+
* it says so when it opens.
|
|
537
|
+
*/
|
|
538
|
+
const openingValues = initialModifiedValues ?? baseInitialValues;
|
|
539
|
+
const unshownRequired = useMemo(() => {
|
|
540
|
+
if (status !== "new" && status !== "copy") return [];
|
|
541
|
+
const shown = shownFieldKeys();
|
|
542
|
+
if (!shown) return [];
|
|
543
|
+
const shownSet = new Set(shown);
|
|
544
|
+
const judged = resolvePropertiesForValidation({
|
|
545
|
+
properties: collection.properties,
|
|
546
|
+
isNew: true,
|
|
547
|
+
values: openingValues,
|
|
548
|
+
previousValues: baseInitialValues,
|
|
549
|
+
path,
|
|
550
|
+
entityId,
|
|
551
|
+
propertyConfigs: customizationController.propertyConfigs,
|
|
552
|
+
authController
|
|
553
|
+
});
|
|
554
|
+
return Object.entries(judged).filter(([key, property]) => property.validation?.required && !shownSet.has(key) && !isGeneratedId(property) && isEmptyValue(openingValues[key])).map(([key, property]) => ({
|
|
555
|
+
key,
|
|
556
|
+
label: property.name ?? key
|
|
557
|
+
}));
|
|
558
|
+
}, [
|
|
559
|
+
status,
|
|
560
|
+
customLayout === void 0,
|
|
561
|
+
layout,
|
|
562
|
+
registeredVersion,
|
|
563
|
+
collection,
|
|
564
|
+
openingValues,
|
|
565
|
+
path,
|
|
566
|
+
entityId,
|
|
567
|
+
customizationController.propertyConfigs,
|
|
568
|
+
authController
|
|
569
|
+
]);
|
|
570
|
+
function unshownRequiredErrors() {
|
|
571
|
+
if (unshownRequired.length === 0) return {};
|
|
572
|
+
const message = t("form_required_fields_not_shown", { fields: unshownRequired.map((f) => f.label).join(", ") });
|
|
573
|
+
return Object.fromEntries(unshownRequired.map(({ key }) => [key, message]));
|
|
574
|
+
}
|
|
575
|
+
/**
|
|
576
|
+
* The field for a key: as the generated layout places it, when it holds
|
|
577
|
+
* the key, else at the property's declared span.
|
|
578
|
+
*/
|
|
579
|
+
const fieldFor = useCallback((key) => {
|
|
580
|
+
const placed = [...layout.sections.flatMap((s) => s.fields), ...layout.sidebar].find((f) => f.key === key);
|
|
581
|
+
if (placed) return placed;
|
|
582
|
+
const property = collection.properties?.[key];
|
|
583
|
+
if (property) return {
|
|
584
|
+
key,
|
|
585
|
+
span: property.admin?.span ?? 4,
|
|
586
|
+
additional: false
|
|
587
|
+
};
|
|
588
|
+
if (collection.additionalFields?.some((f) => f.key === key)) return {
|
|
589
|
+
key,
|
|
590
|
+
span: 4,
|
|
591
|
+
additional: true
|
|
592
|
+
};
|
|
593
|
+
}, [layout, collection]);
|
|
594
|
+
const isFieldDisabledRef = useRef(isFieldDisabled);
|
|
595
|
+
isFieldDisabledRef.current = isFieldDisabled;
|
|
596
|
+
const stableIsFieldDisabled = useCallback((key, property) => isFieldDisabledRef.current(key, property), []);
|
|
597
|
+
const fieldsContext = useMemo(() => ({
|
|
598
|
+
collection,
|
|
599
|
+
path,
|
|
600
|
+
entityId,
|
|
601
|
+
entity,
|
|
602
|
+
status,
|
|
603
|
+
fieldContext,
|
|
604
|
+
previousValues: baseInitialValues,
|
|
605
|
+
underlyingChanges,
|
|
606
|
+
autoSave: Boolean(autoSave),
|
|
607
|
+
autoFocusKey,
|
|
608
|
+
fieldSize: compact ? "medium" : "large",
|
|
609
|
+
isFieldDisabled: stableIsFieldDisabled,
|
|
610
|
+
renderField: renderFormField,
|
|
611
|
+
fieldFor,
|
|
612
|
+
register: registerField
|
|
613
|
+
}), [
|
|
614
|
+
collection,
|
|
615
|
+
path,
|
|
616
|
+
entityId,
|
|
617
|
+
entity,
|
|
618
|
+
status,
|
|
619
|
+
fieldContext,
|
|
620
|
+
baseInitialValues,
|
|
621
|
+
underlyingChanges,
|
|
622
|
+
autoSave,
|
|
623
|
+
autoFocusKey,
|
|
624
|
+
compact,
|
|
625
|
+
stableIsFieldDisabled,
|
|
626
|
+
fieldFor,
|
|
627
|
+
registerField,
|
|
628
|
+
disabledProp,
|
|
629
|
+
lockedPropertyKeys
|
|
630
|
+
]);
|
|
631
|
+
const domScope = domScopeFromId(useId());
|
|
554
632
|
const formFields = () => {
|
|
633
|
+
if (customLayout !== void 0) return /* @__PURE__ */ jsx(Fragment, { children: customLayout });
|
|
555
634
|
if (Builder) return /* @__PURE__ */ jsx(Suspense, {
|
|
556
635
|
fallback: /* @__PURE__ */ jsx(CircularProgressCenter, {}),
|
|
557
636
|
children: /* @__PURE__ */ jsx(Builder, {
|
|
558
637
|
collection,
|
|
559
638
|
parentCollectionSlugs,
|
|
560
639
|
parentEntityIds,
|
|
561
|
-
|
|
640
|
+
row,
|
|
641
|
+
id: entity ? String(entity.id) : void 0,
|
|
562
642
|
modifiedValues: formex.values,
|
|
563
643
|
formContext
|
|
564
644
|
})
|
|
@@ -573,9 +653,8 @@ function EntityForm({ path, entityId: entityIdProp, collection, onValuesModified
|
|
|
573
653
|
}],
|
|
574
654
|
collapsed: collapsedSections,
|
|
575
655
|
onToggle: toggleSection,
|
|
576
|
-
errorKeys
|
|
577
|
-
|
|
578
|
-
}), !showRail && layout.showRecordMeta && status === "existing" && entity && /* @__PURE__ */ jsx("div", {
|
|
656
|
+
errorKeys
|
|
657
|
+
}), !showRail && !compact && layout.showRecordMeta && status === "existing" && entity && /* @__PURE__ */ jsx("div", {
|
|
579
658
|
className: cls("mt-8 pt-5 border-t max-w-sm", defaultBorderMixin),
|
|
580
659
|
children: /* @__PURE__ */ jsx(RecordMeta, { entity })
|
|
581
660
|
})] });
|
|
@@ -603,6 +682,12 @@ function EntityForm({ path, entityId: entityIdProp, collection, onValuesModified
|
|
|
603
682
|
outerClassName: "w-full mt-2",
|
|
604
683
|
children: t("fix_errors_before_saving")
|
|
605
684
|
}),
|
|
685
|
+
unshownRequired.length > 0 && /* @__PURE__ */ jsx(Alert, {
|
|
686
|
+
color: "error",
|
|
687
|
+
size: "small",
|
|
688
|
+
outerClassName: "w-full mt-2",
|
|
689
|
+
children: t("form_required_fields_not_shown", { fields: unshownRequired.map((f) => f.label).join(", ") })
|
|
690
|
+
}),
|
|
606
691
|
predatingViolationLines.length > 0 && /* @__PURE__ */ jsxs(Alert, {
|
|
607
692
|
color: "warning",
|
|
608
693
|
size: "small",
|
|
@@ -669,48 +754,65 @@ function EntityForm({ path, entityId: entityIdProp, collection, onValuesModified
|
|
|
669
754
|
value: formex,
|
|
670
755
|
children: /* @__PURE__ */ jsx(FormUploadsContext.Provider, {
|
|
671
756
|
value: uploadTracker,
|
|
672
|
-
children: /* @__PURE__ */
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
className:
|
|
689
|
-
children: [
|
|
690
|
-
className: "flex justify-
|
|
691
|
-
children: /* @__PURE__ */
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
757
|
+
children: /* @__PURE__ */ jsx(FormDomScopeContext.Provider, {
|
|
758
|
+
value: domScope,
|
|
759
|
+
children: /* @__PURE__ */ jsx(FormFieldsContext.Provider, {
|
|
760
|
+
value: fieldsContext,
|
|
761
|
+
children: /* @__PURE__ */ jsxs("form", {
|
|
762
|
+
ref: formElementRef,
|
|
763
|
+
"data-form-path": path,
|
|
764
|
+
onSubmit: formex.handleSubmit,
|
|
765
|
+
onReset: (e) => {
|
|
766
|
+
e.preventDefault();
|
|
767
|
+
if (formex.dirty) setDiscardDialogOpen(true);
|
|
768
|
+
else formex.resetForm({ values: baseInitialValues });
|
|
769
|
+
},
|
|
770
|
+
noValidate: true,
|
|
771
|
+
className: cls("@container/form flex-1 flex flex-col w-full min-h-0", className),
|
|
772
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
773
|
+
className: "flex-1 min-h-0 flex flex-row w-full",
|
|
774
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
775
|
+
className: "flex-1 min-w-0 overflow-y-auto flex justify-center items-start",
|
|
776
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
777
|
+
id: domScope,
|
|
778
|
+
className: cls("@container/col w-full max-w-3xl @7xl/form:max-w-4xl 2xl:max-w-4xl flex flex-col", compact ? "pt-3 pb-4 px-3" : openEntityMode === "dialog" ? "pt-5 pb-8 px-6 sm:px-8" : "pt-6 pb-12 px-5 sm:px-8"),
|
|
779
|
+
children: [manualApplyLocalChanges && hasLocalChanges && localChangesCacheKey && /* @__PURE__ */ jsx("div", {
|
|
780
|
+
className: "flex justify-end mb-3",
|
|
781
|
+
children: /* @__PURE__ */ jsx(LocalChangesMenu, {
|
|
782
|
+
cacheKey: localChangesCacheKey,
|
|
783
|
+
properties: collection.properties,
|
|
784
|
+
cachedData: localChangesData,
|
|
785
|
+
formex,
|
|
786
|
+
onClearLocalChanges: () => {
|
|
787
|
+
setLocalChangesCleared(true);
|
|
788
|
+
onClearLocalChanges?.();
|
|
789
|
+
}
|
|
790
|
+
})
|
|
791
|
+
}), formView]
|
|
700
792
|
})
|
|
701
|
-
}),
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
}), dialogActions]
|
|
793
|
+
}), showRail && /* @__PURE__ */ jsx(FormRail, {
|
|
794
|
+
fields: layout.sidebar,
|
|
795
|
+
showRecordMeta: layout.showRecordMeta && status === "existing",
|
|
796
|
+
entity
|
|
797
|
+
})]
|
|
798
|
+
}), dialogActions]
|
|
799
|
+
})
|
|
800
|
+
})
|
|
710
801
|
})
|
|
711
802
|
})
|
|
712
803
|
});
|
|
713
804
|
}
|
|
805
|
+
/** Every field a resolved layout places, in the column and in the rail. */
|
|
806
|
+
function layoutFieldKeys(layout) {
|
|
807
|
+
return [...layout.sections.flatMap((section) => section.fields), ...layout.sidebar].map((field) => field.key);
|
|
808
|
+
}
|
|
809
|
+
/** An id the data source or the database generates, which no form asks for. */
|
|
810
|
+
function isGeneratedId(property) {
|
|
811
|
+
return "isId" in property && typeof property.isId === "string" && property.isId !== "manual";
|
|
812
|
+
}
|
|
813
|
+
function isEmptyValue(value) {
|
|
814
|
+
return value === void 0 || value === null || value === "" || Array.isArray(value) && value.length === 0;
|
|
815
|
+
}
|
|
714
816
|
function useOnAutoSave(autoSave, formex, lastSavedValues, save) {
|
|
715
817
|
useEffect(() => {
|
|
716
818
|
if (!autoSave) return;
|