@rebasepro/cms 0.30.0 → 0.31.0-canary.g59cd6fd
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -8
- package/dist/collection_editor/ConfigControllerProvider.js +25 -22
- package/dist/collection_editor/ConfigControllerProvider.js.map +1 -1
- package/dist/collection_editor/firestore_callee.d.ts +10 -0
- package/dist/collection_editor/firestore_callee.js +15 -0
- package/dist/collection_editor/firestore_callee.js.map +1 -0
- package/dist/collection_editor/firestore_edit.d.ts +62 -0
- package/dist/collection_editor/firestore_edit.js +339 -0
- package/dist/collection_editor/firestore_edit.js.map +1 -0
- package/dist/collection_editor/index.d.ts +2 -3
- package/dist/collection_editor/liveSchemaClient.d.ts +44 -22
- package/dist/collection_editor/liveSchemaClient.js +9 -3
- package/dist/collection_editor/liveSchemaClient.js.map +1 -1
- package/dist/collection_editor/property_column.d.ts +86 -0
- package/dist/collection_editor/property_column.js +719 -0
- package/dist/collection_editor/property_column.js.map +1 -0
- package/dist/collection_editor/serializable_types.d.ts +2 -24
- package/dist/collection_editor/serializable_utils.d.ts +1 -1
- package/dist/collection_editor/serializable_utils.js +2 -1
- package/dist/collection_editor/serializable_utils.js.map +1 -1
- package/dist/collection_editor/split_edit.d.ts +106 -0
- package/dist/collection_editor/split_edit.js +564 -0
- package/dist/collection_editor/split_edit.js.map +1 -0
- package/dist/collection_editor/split_edit_error.d.ts +25 -0
- package/dist/collection_editor/split_edit_error.js +35 -0
- package/dist/collection_editor/split_edit_error.js.map +1 -0
- package/dist/collection_editor/types/collection_editor_controller.d.ts +1 -1
- package/dist/collection_editor/types/config_controller.d.ts +67 -1
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.d.ts +6 -5
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js +44 -12
- package/dist/collection_editor/ui/collection_editor/CollectionEditorDialog.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js +18 -3
- package/dist/collection_editor/ui/collection_editor/CollectionPropertiesEditorForm.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js +94 -55
- package/dist/collection_editor/ui/collection_editor/CollectionRLSTab.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/CollectionRelationsTab.d.ts +2 -1
- package/dist/collection_editor/ui/collection_editor/DisplaySettingsForm.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/EnumForm.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/EnumForm.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js +3 -3
- package/dist/collection_editor/ui/collection_editor/GeneralSettingsForm.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/KanbanConfigSection.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.d.ts +2 -3
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.js +1 -1
- package/dist/collection_editor/ui/collection_editor/PropertyEditView.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js +1 -1
- package/dist/collection_editor/ui/collection_editor/PropertyFieldPreview.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/PropertyTree.d.ts +7 -4
- package/dist/collection_editor/ui/collection_editor/PropertyTree.js +15 -5
- package/dist/collection_editor/ui/collection_editor/PropertyTree.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/SchemaChangeDialog.js +1 -1
- package/dist/collection_editor/ui/collection_editor/SchemaChangeDialog.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/SchemaEditRefusalView.d.ts +20 -0
- package/dist/collection_editor/ui/collection_editor/SchemaEditRefusalView.js +74 -0
- package/dist/collection_editor/ui/collection_editor/SchemaEditRefusalView.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportDataPreview.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/import/CollectionEditorImportMapping.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/import/clean_import_data.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/BlockPropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/DateTimePropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/EnumPropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/MapPropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/ReferencePropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/RelationPropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/RepeatPropertyField.js.map +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/conditions/ConditionsEditor.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/conditions/EnumConditionsEditor.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/properties/conditions/property_paths.d.ts +1 -1
- package/dist/collection_editor/ui/collection_editor/rlsRuleForm.d.ts +34 -0
- package/dist/collection_editor/ui/collection_editor/rlsRuleForm.js +50 -0
- package/dist/collection_editor/ui/collection_editor/rlsRuleForm.js.map +1 -0
- package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.d.ts +1 -2
- package/dist/collection_editor/ui/collection_editor/utils/update_property_for_widget.js.map +1 -1
- package/dist/collection_editor/useDetachRulesConfirmation.d.ts +16 -0
- package/dist/collection_editor/useDetachRulesConfirmation.js +48 -0
- package/dist/collection_editor/useDetachRulesConfirmation.js.map +1 -0
- package/dist/collection_editor/useLiveSchemaEditing.d.ts +2 -2
- package/dist/collection_editor/useLiveSchemaEditing.js +1 -1
- package/dist/collection_editor/useLiveSchemaEditing.js.map +1 -1
- package/dist/collection_editor/useLocalCollectionsConfigController.d.ts +54 -10
- package/dist/collection_editor/useLocalCollectionsConfigController.js +394 -122
- package/dist/collection_editor/useLocalCollectionsConfigController.js.map +1 -1
- package/dist/collection_editor/validateCollectionJson.js.map +1 -1
- package/dist/components/CollectionPanel.d.ts +10 -9
- package/dist/components/CollectionPanel.js +5 -2
- package/dist/components/CollectionPanel.js.map +1 -1
- package/dist/components/CollectionTableBinding/CollectionRowActions.d.ts +1 -2
- package/dist/components/CollectionTableBinding/CollectionRowActions.js.map +1 -1
- package/dist/components/CollectionTableBinding/CollectionTableBinding.js.map +1 -1
- package/dist/components/CollectionTableBinding/CollectionTableBindingProps.d.ts +3 -5
- package/dist/components/CollectionTableBinding/PropertyTableCell.d.ts +2 -2
- package/dist/components/CollectionTableBinding/PropertyTableCell.js.map +1 -1
- package/dist/components/CollectionTableBinding/column_utils.d.ts +1 -1
- package/dist/components/CollectionTableBinding/column_utils.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.d.ts +2 -2
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js +1 -2
- package/dist/components/CollectionTableBinding/fields/TableMultipleRelationField.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.d.ts +2 -2
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js +2 -2
- package/dist/components/CollectionTableBinding/fields/TableReferenceField.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableRelationField.d.ts +2 -2
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js +1 -2
- package/dist/components/CollectionTableBinding/fields/TableRelationField.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.d.ts +2 -1
- package/dist/components/CollectionTableBinding/fields/TableRelationSelectorField.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/TableStorageUpload.d.ts +2 -2
- package/dist/components/CollectionTableBinding/fields/TableStorageUpload.js.map +1 -1
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.d.ts +1 -1
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js +1 -1
- package/dist/components/CollectionTableBinding/fields/VirtualTableSelect.js.map +1 -1
- package/dist/components/CollectionTableBinding/internal/common.d.ts +1 -2
- package/dist/components/CollectionTableBinding/internal/common.js.map +1 -1
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.d.ts +1 -1
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js +2 -2
- package/dist/components/CollectionTableBinding/internal/popup_field/PopupFormField.js.map +1 -1
- package/dist/components/CollectionTableBinding/table_bindings.d.ts +2 -2
- package/dist/components/CollectionTableBinding/table_bindings.js.map +1 -1
- package/dist/components/CollectionViewBinding/BoardCardBinding.d.ts +1 -1
- package/dist/components/CollectionViewBinding/BoardCardBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.d.ts +1 -2
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js +9 -5
- package/dist/components/CollectionViewBinding/CollectionBoardViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.d.ts +1 -2
- package/dist/components/CollectionViewBinding/CollectionCardViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionEntityActions.d.ts +1 -1
- package/dist/components/CollectionViewBinding/CollectionEntityActions.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.d.ts +1 -2
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js +1 -1
- package/dist/components/CollectionViewBinding/CollectionListViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionToolbar.js +1 -1
- package/dist/components/CollectionViewBinding/CollectionToolbar.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewActions.js +2 -4
- package/dist/components/CollectionViewBinding/CollectionViewActions.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewBinding.d.ts +6 -6
- package/dist/components/CollectionViewBinding/CollectionViewBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewContent.js +1 -2
- package/dist/components/CollectionViewBinding/CollectionViewContent.js.map +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.d.ts +1 -1
- package/dist/components/CollectionViewBinding/CollectionViewStartActions.js.map +1 -1
- package/dist/components/CollectionViewBinding/CustomViewHost.d.ts +1 -2
- package/dist/components/CollectionViewBinding/CustomViewHost.js.map +1 -1
- package/dist/components/CollectionViewBinding/EntitiesCount.js +3 -3
- package/dist/components/CollectionViewBinding/EntitiesCount.js.map +1 -1
- package/dist/components/CollectionViewBinding/EntityCardBinding.d.ts +1 -2
- package/dist/components/CollectionViewBinding/EntityCardBinding.js.map +1 -1
- package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.js +1 -1
- package/dist/components/CollectionViewBinding/EntityIdHeaderWidget.js.map +1 -1
- package/dist/components/CollectionViewBinding/FilterPresetsButton.d.ts +1 -2
- package/dist/components/CollectionViewBinding/FilterPresetsButton.js +1 -1
- package/dist/components/CollectionViewBinding/FilterPresetsButton.js.map +1 -1
- package/dist/components/CollectionViewBinding/FiltersButton.d.ts +1 -2
- package/dist/components/CollectionViewBinding/FiltersButton.js.map +1 -1
- package/dist/components/CollectionViewBinding/FiltersDialog.d.ts +1 -1
- package/dist/components/CollectionViewBinding/FiltersDialog.js.map +1 -1
- package/dist/components/CollectionViewBinding/PluginColumnSlots.d.ts +1 -2
- package/dist/components/CollectionViewBinding/PluginColumnSlots.js.map +1 -1
- package/dist/components/CollectionViewBinding/RowActions.d.ts +1 -2
- package/dist/components/CollectionViewBinding/RowActions.js.map +1 -1
- package/dist/components/CollectionViewBinding/SortButton.d.ts +1 -1
- package/dist/components/CollectionViewBinding/SortButton.js.map +1 -1
- package/dist/components/CollectionViewBinding/SplitListView.d.ts +1 -2
- package/dist/components/CollectionViewBinding/SplitListView.js.map +1 -1
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.d.ts +1 -2
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js +1 -1
- package/dist/components/CollectionViewBinding/hooks/useCollectionInlineEditor.js.map +1 -1
- package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.d.ts +1 -2
- package/dist/components/CollectionViewBinding/hooks/useKanbanDragAndDrop.js.map +1 -1
- package/dist/components/CollectionViewBinding/useBoardDataController.d.ts +2 -1
- package/dist/components/CollectionViewBinding/useBoardDataController.js +3 -3
- package/dist/components/CollectionViewBinding/useBoardDataController.js.map +1 -1
- package/dist/components/CollectionViewBinding/useCollectionViewState.d.ts +2 -4
- package/dist/components/CollectionViewBinding/useCollectionViewState.js +14 -19
- package/dist/components/CollectionViewBinding/useCollectionViewState.js.map +1 -1
- package/dist/components/CollectionViewBinding/usePreviewSlots.d.ts +1 -3
- package/dist/components/CollectionViewBinding/usePreviewSlots.js.map +1 -1
- package/dist/components/CollectionViewBinding/useSelectionController.d.ts +1 -2
- package/dist/components/CollectionViewBinding/useSelectionController.js.map +1 -1
- package/dist/components/CollectionsProvider.d.ts +23 -8
- package/dist/components/CollectionsProvider.js +23 -7
- package/dist/components/CollectionsProvider.js.map +1 -1
- package/dist/components/DefaultDrawer.js +1 -1
- package/dist/components/DeleteEntityDialog.d.ts +1 -1
- package/dist/components/DeleteEntityDialog.js +1 -1
- package/dist/components/DeleteEntityDialog.js.map +1 -1
- package/dist/components/DetailViewBinding.js +3 -3
- package/dist/components/DetailViewBinding.js.map +1 -1
- package/dist/components/EditFormActions.js.map +1 -1
- package/dist/components/EditViewBinding.d.ts +2 -1
- package/dist/components/EditViewBinding.js +6 -6
- package/dist/components/EditViewBinding.js.map +1 -1
- package/dist/components/EntityDisplayHeader.d.ts +1 -2
- package/dist/components/EntityDisplayHeader.js.map +1 -1
- package/dist/components/EntityInspector.d.ts +1 -2
- package/dist/components/EntityInspector.js.map +1 -1
- package/dist/components/EntityPreviewBinding.d.ts +1 -1
- package/dist/components/EntityPreviewBinding.js +1 -1
- package/dist/components/EntityPreviewBinding.js.map +1 -1
- package/dist/components/EntityViewBinding.d.ts +1 -1
- package/dist/components/EntityViewBinding.js.map +1 -1
- package/dist/components/EntityViewBody.d.ts +1 -1
- package/dist/components/EntityViewBody.js +3 -4
- package/dist/components/EntityViewBody.js.map +1 -1
- package/dist/components/FieldValue.js +2 -2
- package/dist/components/FieldValue.js.map +1 -1
- package/dist/components/HomePage/ContentHomePage.js +12 -3
- package/dist/components/HomePage/ContentHomePage.js.map +1 -1
- package/dist/components/InlineEntityPreview.d.ts +1 -1
- package/dist/components/InlineEntityPreview.js.map +1 -1
- package/dist/components/PropertyCollectionView.d.ts +2 -2
- package/dist/components/PropertyCollectionView.js.map +1 -1
- package/dist/components/PropertyConfigBadge.js.map +1 -1
- package/dist/components/RebaseCMS.d.ts +22 -3
- package/dist/components/RebaseCMS.js +32 -14
- package/dist/components/RebaseCMS.js.map +1 -1
- package/dist/components/RebaseNavigation.js +106 -31
- package/dist/components/RebaseNavigation.js.map +1 -1
- package/dist/components/RecordDetail.js +4 -1
- package/dist/components/RecordDetail.js.map +1 -1
- package/dist/components/RecordForm.d.ts +5 -5
- package/dist/components/RecordForm.js +5 -2
- package/dist/components/RecordForm.js.map +1 -1
- package/dist/components/ReferenceTable/SelectionTableBinding.d.ts +2 -2
- package/dist/components/ReferenceTable/SelectionTableBinding.js +1 -1
- package/dist/components/ReferenceTable/SelectionTableBinding.js.map +1 -1
- package/dist/components/ReferenceWidget.d.ts +2 -1
- package/dist/components/ReferenceWidget.js +2 -2
- package/dist/components/ReferenceWidget.js.map +1 -1
- package/dist/components/RelationSelector.d.ts +2 -1
- package/dist/components/RelationSelector.js +2 -3
- package/dist/components/RelationSelector.js.map +1 -1
- package/dist/components/SelectableTable/SelectableTable.d.ts +2 -2
- package/dist/components/SelectableTable/SelectableTable.js.map +1 -1
- package/dist/components/SelectableTable/filters/FilterFieldBinding.d.ts +2 -1
- package/dist/components/SelectableTable/filters/FilterFieldBinding.js +3 -3
- package/dist/components/SelectableTable/filters/FilterFieldBinding.js.map +1 -1
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js +2 -2
- package/dist/components/SelectableTable/filters/ReferenceFilterField.js.map +1 -1
- package/dist/components/SelectableTable/filters/RelationFilterField.d.ts +1 -1
- package/dist/components/SelectableTable/filters/RelationFilterField.js +1 -1
- package/dist/components/SelectableTable/filters/RelationFilterField.js.map +1 -1
- package/dist/components/SelectableTable/filters/StringNumberFilterField.d.ts +1 -1
- package/dist/components/SelectableTable/filters/StringNumberFilterField.js.map +1 -1
- package/dist/components/SelectableTable/filters/null_filter.d.ts +1 -3
- package/dist/components/SelectableTable/filters/null_filter.js.map +1 -1
- package/dist/components/SidePanelBinding.js +1 -1
- package/dist/components/SidePanelBinding.js.map +1 -1
- package/dist/components/field_configs.d.ts +1 -2
- package/dist/components/field_configs.js.map +1 -1
- package/dist/components/field_ids.d.ts +1 -1
- package/dist/components/field_ids.js +1 -1
- package/dist/components/field_ids.js.map +1 -1
- package/dist/components/history/EntityHistoryEntry.js.map +1 -1
- package/dist/components/history/EntityHistoryView.d.ts +1 -2
- package/dist/components/history/EntityHistoryView.js +1 -1
- package/dist/components/history/EntityHistoryView.js.map +1 -1
- package/dist/data_export/export/BasicExportAction.d.ts +1 -1
- package/dist/data_export/export/BasicExportAction.js.map +1 -1
- package/dist/data_export/export/ExportCollectionAction.js +2 -2
- package/dist/data_export/export/ExportCollectionAction.js.map +1 -1
- package/dist/data_export/export/additional_fields.d.ts +1 -1
- package/dist/data_export/export/additional_fields.js.map +1 -1
- package/dist/data_export/export/export.d.ts +1 -1
- package/dist/data_export/export/export.js +1 -1
- package/dist/data_export/export/export.js.map +1 -1
- package/dist/data_export/export/fetch_export_data.d.ts +3 -2
- package/dist/data_export/export/fetch_export_data.js.map +1 -1
- package/dist/data_import/components/DataNewPropertiesMapping.d.ts +1 -1
- package/dist/data_import/components/DataNewPropertiesMapping.js.map +1 -1
- package/dist/data_import/components/ImportNewPropertyFieldPreview.d.ts +1 -1
- package/dist/data_import/components/ImportNewPropertyFieldPreview.js.map +1 -1
- package/dist/data_import/hooks/useImportConfig.js.map +1 -1
- package/dist/data_import/import/ImportCollectionAction.d.ts +2 -2
- package/dist/data_import/import/ImportCollectionAction.js.map +1 -1
- package/dist/data_import/types/column_mapping.d.ts +1 -1
- package/dist/data_import/utils/data.d.ts +1 -2
- package/dist/data_import/utils/data.js +1 -2
- package/dist/data_import/utils/data.js.map +1 -1
- package/dist/data_import/utils/get_import_inference_type.d.ts +1 -1
- package/dist/data_import/utils/get_import_inference_type.js.map +1 -1
- package/dist/data_import/utils/id_column.d.ts +1 -1
- package/dist/data_import/utils/id_column.js.map +1 -1
- package/dist/data_import/utils/import_columns.d.ts +1 -1
- package/dist/data_import/utils/import_columns.js.map +1 -1
- package/dist/data_import/utils/save_entities.d.ts +3 -3
- package/dist/data_import/utils/save_entities.js +1 -1
- package/dist/data_import/utils/save_entities.js.map +1 -1
- package/dist/form/EntityForm.js +2 -1
- package/dist/form/EntityForm.js.map +1 -1
- package/dist/form/EntityFormActions.js.map +1 -1
- package/dist/form/EntityFormBinding.js +2 -2
- package/dist/form/EntityFormBinding.js.map +1 -1
- package/dist/form/FormFieldsContext.d.ts +1 -4
- package/dist/form/FormFieldsContext.js +1 -1
- package/dist/form/FormFieldsContext.js.map +1 -1
- package/dist/form/PropertyFieldBinding.js +6 -8
- package/dist/form/PropertyFieldBinding.js.map +1 -1
- package/dist/form/components/FieldBlock.d.ts +1 -2
- package/dist/form/components/FieldBlock.js.map +1 -1
- package/dist/form/components/FieldHelperText.d.ts +1 -1
- package/dist/form/components/FieldHelperText.js.map +1 -1
- package/dist/form/components/FormRail.d.ts +1 -1
- package/dist/form/components/FormRail.js.map +1 -1
- package/dist/form/components/LocalChangesMenu.d.ts +1 -1
- package/dist/form/components/LocalChangesMenu.js.map +1 -1
- package/dist/form/components/StorageItemPreview.d.ts +1 -1
- package/dist/form/components/StorageItemPreview.js.map +1 -1
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js +1 -1
- package/dist/form/field_bindings/ArrayCustomShapedFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.d.ts +2 -2
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js +2 -2
- package/dist/form/field_bindings/ArrayOfReferencesFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/BinaryFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/BinaryFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/BlockFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/BlockFieldBinding.js +1 -1
- package/dist/form/field_bindings/BlockFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/DateTimeFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/DateTimeFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/GeopointFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/GeopointFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/KeyValueFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/KeyValueFieldBinding.js +1 -2
- package/dist/form/field_bindings/KeyValueFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/MapFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MapFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js +1 -1
- package/dist/form/field_bindings/MarkdownEditorFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/MultiSelectFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MultiSelectFieldBinding.js +1 -1
- package/dist/form/field_bindings/MultiSelectFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/MultipleRelationFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js +2 -2
- package/dist/form/field_bindings/MultipleRelationFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/ReadOnlyFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/ReadOnlyFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/ReferenceFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/ReferenceFieldBinding.js +2 -2
- package/dist/form/field_bindings/ReferenceFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/RelationFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/RelationFieldBinding.js +2 -2
- package/dist/form/field_bindings/RelationFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/RepeatFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/RepeatFieldBinding.js +1 -1
- package/dist/form/field_bindings/RepeatFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/SelectFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/SelectFieldBinding.js +1 -1
- package/dist/form/field_bindings/SelectFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/StorageUploadFieldBinding.d.ts +2 -2
- package/dist/form/field_bindings/StorageUploadFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/SwitchFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/SwitchFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/TextFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/TextFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/UserSelectFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/UserSelectFieldBinding.js.map +1 -1
- package/dist/form/field_bindings/VectorFieldBinding.d.ts +1 -1
- package/dist/form/field_bindings/VectorFieldBinding.js.map +1 -1
- package/dist/form/form_utils.d.ts +3 -3
- package/dist/form/form_utils.js +1 -2
- package/dist/form/form_utils.js.map +1 -1
- package/dist/form/label_placement.d.ts +1 -2
- package/dist/form/label_placement.js.map +1 -1
- package/dist/form/resolve_cell_property.d.ts +1 -2
- package/dist/form/resolve_cell_property.js +1 -1
- package/dist/form/resolve_cell_property.js.map +1 -1
- package/dist/form/resolve_form_properties.d.ts +2 -2
- package/dist/form/resolve_form_properties.js +1 -1
- package/dist/form/resolve_form_properties.js.map +1 -1
- package/dist/form/useClearRestoreValue.d.ts +1 -1
- package/dist/form/useClearRestoreValue.js.map +1 -1
- package/dist/form/validation.d.ts +2 -2
- package/dist/form/validation.js +1 -1
- package/dist/form/validation.js.map +1 -1
- package/dist/hooks/navigation/compose_collections.d.ts +59 -0
- package/dist/hooks/navigation/compose_collections.js +48 -0
- package/dist/hooks/navigation/compose_collections.js.map +1 -0
- package/dist/hooks/navigation/compose_collections_input.d.ts +8 -0
- package/dist/hooks/navigation/compose_collections_input.js +17 -0
- package/dist/hooks/navigation/compose_collections_input.js.map +1 -0
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.d.ts +1 -1
- package/dist/hooks/navigation/contexts/CollectionRegistryContext.js.map +1 -1
- package/dist/hooks/navigation/registered_collection.d.ts +15 -0
- package/dist/hooks/navigation/registered_collection.js +20 -0
- package/dist/hooks/navigation/registered_collection.js.map +1 -0
- package/dist/hooks/navigation/ui_preferences.d.ts +47 -0
- package/dist/hooks/navigation/ui_preferences.js +179 -0
- package/dist/hooks/navigation/ui_preferences.js.map +1 -0
- package/dist/hooks/navigation/useAsyncResolver.d.ts +8 -1
- package/dist/hooks/navigation/useAsyncResolver.js +9 -3
- package/dist/hooks/navigation/useAsyncResolver.js.map +1 -1
- package/dist/hooks/navigation/useBuildCollectionRegistryController.d.ts +1 -3
- package/dist/hooks/navigation/useBuildCollectionRegistryController.js +3 -3
- package/dist/hooks/navigation/useBuildCollectionRegistryController.js.map +1 -1
- package/dist/hooks/navigation/useBuildNavigationStateController.d.ts +9 -5
- package/dist/hooks/navigation/useBuildNavigationStateController.js +2 -1
- package/dist/hooks/navigation/useBuildNavigationStateController.js.map +1 -1
- package/dist/hooks/navigation/useBuildUrlController.d.ts +1 -1
- package/dist/hooks/navigation/useBuildUrlController.js.map +1 -1
- package/dist/hooks/navigation/useNavigationResolution.js +1 -2
- package/dist/hooks/navigation/useNavigationResolution.js.map +1 -1
- package/dist/hooks/navigation/usePanelTables.d.ts +11 -0
- package/dist/hooks/navigation/usePanelTables.js +33 -0
- package/dist/hooks/navigation/usePanelTables.js.map +1 -0
- package/dist/hooks/navigation/useResolvedCollections.d.ts +8 -3
- package/dist/hooks/navigation/useResolvedCollections.js +3 -2
- package/dist/hooks/navigation/useResolvedCollections.js.map +1 -1
- package/dist/hooks/navigation/useResolvedViews.d.ts +1 -2
- package/dist/hooks/navigation/useResolvedViews.js.map +1 -1
- package/dist/hooks/navigation/useTopLevelNavigation.d.ts +1 -2
- package/dist/hooks/navigation/useTopLevelNavigation.js.map +1 -1
- package/dist/hooks/navigation/user_preferences_overlay.d.ts +21 -0
- package/dist/hooks/navigation/user_preferences_overlay.js +101 -0
- package/dist/hooks/navigation/user_preferences_overlay.js.map +1 -0
- package/dist/hooks/navigation/utils.js +1 -1
- package/dist/hooks/navigation/utils.js.map +1 -1
- package/dist/hooks/useAdminContext.d.ts +1 -2
- package/dist/hooks/useAdminContext.js.map +1 -1
- package/dist/hooks/useBuildSidePanel.d.ts +1 -2
- package/dist/hooks/useBuildSidePanel.js +2 -1
- package/dist/hooks/useBuildSidePanel.js.map +1 -1
- package/dist/hooks/useChildViewSource.d.ts +1 -1
- package/dist/hooks/useChildViewSource.js +1 -1
- package/dist/hooks/useChildViewSource.js.map +1 -1
- package/dist/hooks/useEntityDisplay.d.ts +1 -2
- package/dist/hooks/useEntityDisplay.js +1 -1
- package/dist/hooks/useEntityDisplay.js.map +1 -1
- package/dist/hooks/useEntityDisplayTitle.d.ts +2 -2
- package/dist/hooks/useEntityDisplayTitle.js.map +1 -1
- package/dist/hooks/useHistory.js +1 -1
- package/dist/hooks/useHistory.js.map +1 -1
- package/dist/hooks/useRecordActions.d.ts +1 -2
- package/dist/hooks/useRecordActions.js.map +1 -1
- package/dist/hooks/useReferencePaths.d.ts +21 -7
- package/dist/hooks/useReferencePaths.js +23 -6
- package/dist/hooks/useReferencePaths.js.map +1 -1
- package/dist/hooks/useResolvedNavigationFrom.d.ts +3 -3
- package/dist/hooks/useResolvedNavigationFrom.js +1 -1
- package/dist/hooks/useResolvedNavigationFrom.js.map +1 -1
- package/dist/index.d.ts +11 -0
- package/dist/index.js +8 -2
- package/dist/mcp_view/app_modules.d.ts +2 -2
- package/dist/mcp_view/app_modules.js +4 -4
- package/dist/mcp_view/app_modules.js.map +1 -1
- package/dist/mcp_view/index.d.ts +16 -19
- package/dist/mcp_view/index.js +43 -62
- package/dist/mcp_view/index.js.map +1 -1
- package/dist/mcp_view/payload.d.ts +54 -18
- package/dist/mcp_view/payload.js +49 -24
- package/dist/mcp_view/payload.js.map +1 -1
- package/dist/mcp_view/screen.js +11 -11
- package/dist/mcp_view/screen.js.map +1 -1
- package/dist/mcp_view/tool_driver.d.ts +5 -34
- package/dist/mcp_view/tool_driver.js +17 -16
- package/dist/mcp_view/tool_driver.js.map +1 -1
- package/dist/mcp_view/write_review.d.ts +1 -2
- package/dist/mcp_view/write_review.js +1 -1
- package/dist/mcp_view/write_review.js.map +1 -1
- package/dist/preview/PropertyPreview.d.ts +1 -1
- package/dist/preview/PropertyPreview.js +4 -3
- package/dist/preview/PropertyPreview.js.map +1 -1
- package/dist/preview/components/ArrayEnumPreview.d.ts +1 -1
- package/dist/preview/components/ArrayEnumPreview.js.map +1 -1
- package/dist/preview/components/BooleanPreview.d.ts +1 -1
- package/dist/preview/components/BooleanPreview.js.map +1 -1
- package/dist/preview/components/EnumValuesChip.d.ts +1 -1
- package/dist/preview/components/EnumValuesChip.js +1 -1
- package/dist/preview/components/EnumValuesChip.js.map +1 -1
- package/dist/preview/components/ReferencePreview.d.ts +1 -1
- package/dist/preview/components/ReferencePreview.js.map +1 -1
- package/dist/preview/components/RelationPreview.d.ts +1 -1
- package/dist/preview/components/RelationPreview.js.map +1 -1
- package/dist/preview/components/StorageThumbnail.js +2 -1
- package/dist/preview/components/StorageThumbnail.js.map +1 -1
- package/dist/preview/components/UserPreview.d.ts +1 -1
- package/dist/preview/components/UserPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayOfMapsPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOfMapsPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayOfReferencesPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOfReferencesPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayOfRelationsPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOfRelationsPreview.js +2 -1
- package/dist/preview/property_previews/ArrayOfRelationsPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOfStorageComponentsPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayOfStringsPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOfStringsPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayOneOfPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayOneOfPreview.js +1 -1
- package/dist/preview/property_previews/ArrayOneOfPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.js +1 -1
- package/dist/preview/property_previews/ArrayPropertyEnumPreview.js.map +1 -1
- package/dist/preview/property_previews/ArrayPropertyPreview.d.ts +1 -1
- package/dist/preview/property_previews/ArrayPropertyPreview.js +1 -1
- package/dist/preview/property_previews/ArrayPropertyPreview.js.map +1 -1
- package/dist/preview/property_previews/MapPropertyPreview.d.ts +1 -1
- package/dist/preview/property_previews/MapPropertyPreview.js.map +1 -1
- package/dist/preview/property_previews/NumberPropertyPreview.d.ts +1 -1
- package/dist/preview/property_previews/NumberPropertyPreview.js +1 -1
- package/dist/preview/property_previews/NumberPropertyPreview.js.map +1 -1
- package/dist/preview/property_previews/SkeletonPropertyComponent.d.ts +1 -1
- package/dist/preview/property_previews/SkeletonPropertyComponent.js.map +1 -1
- package/dist/preview/property_previews/StringPropertyPreview.d.ts +1 -1
- package/dist/preview/property_previews/StringPropertyPreview.js.map +1 -1
- package/dist/preview/util.d.ts +1 -1
- package/dist/preview/util.js.map +1 -1
- package/dist/routes/RebaseRoute.js +2 -2
- package/dist/routes/RebaseRoute.js.map +1 -1
- package/dist/saved_apps/SavedAppsView.d.ts +1 -1
- package/dist/saved_apps/SavedAppsView.js +1 -1
- package/dist/saved_apps/SavedAppsView.js.map +1 -1
- package/dist/selection/SelectionMenu.d.ts +1 -1
- package/dist/selection/SelectionMenu.js.map +1 -1
- package/dist/selection/resolve_selection.d.ts +3 -3
- package/dist/selection/resolve_selection.js +3 -2
- package/dist/selection/resolve_selection.js.map +1 -1
- package/dist/tables/apply_customization.d.ts +65 -0
- package/dist/tables/apply_customization.js +644 -0
- package/dist/tables/apply_customization.js.map +1 -0
- package/dist/tables/column_property.d.ts +64 -0
- package/dist/tables/column_property.js +549 -0
- package/dist/tables/column_property.js.map +1 -0
- package/dist/tables/customize_table.d.ts +39 -0
- package/dist/tables/customize_table.js +247 -0
- package/dist/tables/customize_table.js.map +1 -0
- package/dist/tables/index.d.ts +12 -0
- package/dist/tables/labels.d.ts +18 -0
- package/dist/tables/labels.js +18 -0
- package/dist/tables/labels.js.map +1 -0
- package/dist/tables/project_table.d.ts +79 -0
- package/dist/tables/project_table.js +148 -0
- package/dist/tables/project_table.js.map +1 -0
- package/dist/tables/relations.d.ts +47 -0
- package/dist/tables/relations.js +112 -0
- package/dist/tables/relations.js.map +1 -0
- package/dist/tables/rls.d.ts +39 -0
- package/dist/tables/rls.js +111 -0
- package/dist/tables/rls.js.map +1 -0
- package/dist/tables/update_record.d.ts +32 -0
- package/dist/tables/update_record.js +40 -0
- package/dist/tables/update_record.js.map +1 -0
- package/dist/types/components/EntityFormActionsProps.d.ts +1 -1
- package/dist/types/components/PropertyPreviewProps.d.ts +2 -2
- package/dist/types/fields.d.ts +2 -2
- package/dist/util/dataControllerAdapter.js.map +1 -1
- package/dist/util/entity_pages.d.ts +2 -1
- package/dist/util/entity_pages.js.map +1 -1
- package/dist/util/find_entities_by_ids.d.ts +2 -2
- package/dist/util/find_entities_by_ids.js +1 -1
- package/dist/util/find_entities_by_ids.js.map +1 -1
- package/dist/util/format_collection_date.d.ts +1 -1
- package/dist/util/format_collection_date.js.map +1 -1
- package/dist/util/identity.d.ts +8 -0
- package/dist/util/identity.js +16 -0
- package/dist/util/identity.js.map +1 -0
- package/dist/util/navigation_utils.js +1 -1
- package/dist/util/navigation_utils.js.map +1 -1
- package/dist/util/previews.js +1 -1
- package/dist/util/previews.js.map +1 -1
- package/dist/util/propertyConfigMapper.d.ts +1 -1
- package/dist/util/propertyConfigMapper.js.map +1 -1
- package/dist/util/property_utils.d.ts +1 -3
- package/dist/util/property_utils.js +1 -1
- package/dist/util/property_utils.js.map +1 -1
- package/dist/util/relations.d.ts +18 -0
- package/dist/util/relations.js +32 -0
- package/dist/util/relations.js.map +1 -0
- package/package.json +12 -10
- package/recipes/README.md +4 -4
- package/recipes/my-preferences.tsx +34 -26
- package/recipes/site-settings.tsx +34 -27
- package/dist/collection_editor/collection_wire.d.ts +0 -13
- package/dist/collection_editor/collection_wire.js +0 -49
- package/dist/collection_editor/collection_wire.js.map +0 -1
- package/dist/collection_editor/useJsonCollectionsConfigController.d.ts +0 -37
- package/dist/collection_editor/useJsonCollectionsConfigController.js +0 -191
- package/dist/collection_editor/useJsonCollectionsConfigController.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SavedAppsView.js","names":[],"sources":["../../src/saved_apps/SavedAppsView.tsx"],"sourcesContent":["/**\n * EXPERIMENTAL. The apps saved to the project (save_app), for the person\n * signed in: theirs, their roles' and the team's. Opening one runs it as\n * Claude runs it, sandboxed (`SavedAppFrame`).\n *\n * Not in the navigation by default. A project that wants it adds the view:\n *\n * ```tsx\n * import { savedAppsView } from \"@rebasepro/cms\";\n * <RebaseCMS
|
|
1
|
+
{"version":3,"file":"SavedAppsView.js","names":[],"sources":["../../src/saved_apps/SavedAppsView.tsx"],"sourcesContent":["/**\n * EXPERIMENTAL. The apps saved to the project (save_app), for the person\n * signed in: theirs, their roles' and the team's. Opening one runs it as\n * Claude runs it, sandboxed (`SavedAppFrame`).\n *\n * Not in the navigation by default. A project that wants it adds the view:\n *\n * ```tsx\n * import { savedAppsView } from \"@rebasepro/cms\";\n * <RebaseCMS tableCustomizations={tableCustomizations} views={[savedAppsView]} />\n * ```\n */\nimport React, { useEffect, useMemo, useState } from \"react\";\nimport type { AppView } from \"@rebasepro/cms-types\";\nimport { useApiBase, useApiConfig } from \"@rebasepro/app\";\nimport { Alert, ArrowLeftIcon, Card, Chip, CircularProgress, Container, IconButton, Typography, cls } from \"@rebasepro/ui\";\nimport { createAdminAppsClient, isRecord } from \"./admin_apps_client\";\nimport { SavedAppFrame } from \"./saved_app_frame\";\n\ninterface AppSummary {\n id: string;\n title: string;\n visibility: \"personal\" | \"roles\" | \"team\";\n roles: string[];\n collections: string[];\n updatedAt: string;\n}\n\n/** Who an app is for, as the list says it. */\nfunction audience(app: AppSummary): string {\n if (app.visibility === \"team\") return \"Team\";\n if (app.visibility === \"roles\") return app.roles.join(\", \");\n return \"Only you\";\n}\n\nfunction summariesOf(result: unknown): AppSummary[] {\n const content = isRecord(result) ? result.structuredContent : undefined;\n const apps = isRecord(content) && Array.isArray(content.apps) ? content.apps : [];\n return apps.filter(isRecord).flatMap(app => typeof app.id === \"string\" && typeof app.title === \"string\"\n ? [{\n id: app.id,\n title: app.title,\n visibility: app.visibility === \"team\" || app.visibility === \"roles\" ? app.visibility : \"personal\",\n roles: Array.isArray(app.roles) ? app.roles.filter((role): role is string => typeof role === \"string\") : [],\n collections: Array.isArray(app.collections) ? app.collections.filter((name): name is string => typeof name === \"string\") : [],\n updatedAt: typeof app.updatedAt === \"string\" ? app.updatedAt : \"\"\n }]\n : []);\n}\n\nexport function SavedAppsView() {\n const apiBase = useApiBase();\n const getAuthToken = useApiConfig()?.getAuthToken;\n const client = useMemo(() => apiBase ? createAdminAppsClient(apiBase, getAuthToken) : undefined, [apiBase, getAuthToken]);\n const [apps, setApps] = useState<AppSummary[]>();\n const [error, setError] = useState<string>();\n const [open, setOpen] = useState<AppSummary>();\n\n useEffect(() => {\n if (!client) return;\n let cancelled = false;\n client.request(\"tools/call\", { name: \"list_apps\", arguments: {} })\n .then(result => {\n if (!cancelled) setApps(summariesOf(result));\n })\n .catch((reason: unknown) => {\n if (!cancelled) setError(reason instanceof Error ? reason.message : String(reason));\n });\n return () => {\n cancelled = true;\n };\n }, [client]);\n\n return (\n <Container maxWidth=\"6xl\" className=\"flex flex-col gap-4 py-6\">\n {open && client ? (\n <>\n <div className=\"flex items-center gap-2\">\n <IconButton size=\"small\" aria-label=\"Back to saved apps\" onClick={() => setOpen(undefined)}>\n <ArrowLeftIcon/>\n </IconButton>\n <Typography variant=\"h6\" className=\"truncate\">{open.title}</Typography>\n <Chip size=\"small\">{audience(open)}</Chip>\n </div>\n <SavedAppFrame client={client} appId={open.id}/>\n </>\n ) : (\n <>\n <div className=\"flex flex-col gap-1\">\n <Typography variant=\"h5\">Saved apps</Typography>\n <Typography variant=\"body2\" color=\"secondary\">\n Apps built with Claude and saved to this project. Each one runs as you, on the data you can reach.\n </Typography>\n </div>\n {!client && <Alert color=\"warning\" size=\"small\">This admin panel has no API address to load saved apps from.</Alert>}\n {error && <Alert color=\"error\" size=\"small\">{error}</Alert>}\n {client && !error && !apps && (\n <div className=\"flex items-center gap-2\"><CircularProgress size=\"small\"/><Typography variant=\"body2\" color=\"secondary\">Loading saved apps…</Typography></div>\n )}\n {apps && apps.length === 0 && (\n <Typography variant=\"body2\" color=\"secondary\">\n No saved apps yet. Ask Claude to build one with show_app, then to save it with save_app.\n </Typography>\n )}\n {apps && apps.length > 0 && (\n <div className=\"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3\">\n {apps.map(app => (\n <Card key={app.id} onClick={() => setOpen(app)} className={cls(\"flex flex-col gap-2 p-4 cursor-pointer hover:bg-surface-card-hover\")}>\n <Typography variant=\"subtitle2\" className=\"truncate\">{app.title}</Typography>\n <Typography variant=\"caption\" color=\"secondary\" className=\"truncate\">{app.collections.join(\", \")}</Typography>\n <div className=\"flex items-center justify-between gap-2\">\n <Chip size=\"small\">{audience(app)}</Chip>\n {app.updatedAt && (\n <Typography variant=\"caption\" color=\"secondary\">\n {new Date(app.updatedAt).toLocaleDateString(undefined, { month: \"short\", day: \"numeric\" })}\n </Typography>\n )}\n </div>\n </Card>\n ))}\n </div>\n )}\n </>\n )}\n </Container>\n );\n}\n\n/** The view to add to `views` for saved apps in the navigation. */\nexport const savedAppsView: AppView = {\n slug: \"apps\",\n name: \"Saved apps\",\n description: \"Apps built with Claude and saved to this project.\",\n icon: \"LayoutDashboard\",\n view: <SavedAppsView/>\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA6BA,SAAS,SAAS,KAAyB;CACvC,IAAI,IAAI,eAAe,QAAQ,OAAO;CACtC,IAAI,IAAI,eAAe,SAAS,OAAO,IAAI,MAAM,KAAK,IAAI;CAC1D,OAAO;AACX;AAEA,SAAS,YAAY,QAA+B;CAChD,MAAM,UAAU,SAAS,MAAM,IAAI,OAAO,oBAAoB,KAAA;CAE9D,QADa,SAAS,OAAO,KAAK,MAAM,QAAQ,QAAQ,IAAI,IAAI,QAAQ,OAAO,CAAC,EAAA,CACpE,OAAO,QAAQ,CAAC,CAAC,SAAQ,QAAO,OAAO,IAAI,OAAO,YAAY,OAAO,IAAI,UAAU,WACzF,CAAC;EACC,IAAI,IAAI;EACR,OAAO,IAAI;EACX,YAAY,IAAI,eAAe,UAAU,IAAI,eAAe,UAAU,IAAI,aAAa;EACvF,OAAO,MAAM,QAAQ,IAAI,KAAK,IAAI,IAAI,MAAM,QAAQ,SAAyB,OAAO,SAAS,QAAQ,IAAI,CAAC;EAC1G,aAAa,MAAM,QAAQ,IAAI,WAAW,IAAI,IAAI,YAAY,QAAQ,SAAyB,OAAO,SAAS,QAAQ,IAAI,CAAC;EAC5H,WAAW,OAAO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AA;CAEC,CAAA;AAEnB;;AAGA,IAAa,gBAAyB;CAClC,MAAM;CACN,MAAM;CACN,aAAa;CACb,MAAM;CACN,MAAM,oBAAC,eAAD,CAAe,CAAA;AACzB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { CollectionConfig } from "@rebasepro/types";
|
|
2
|
+
import type { CollectionConfig } from "@rebasepro/cms-types";
|
|
3
3
|
import { SelectionController, SelectionQuery } from "@rebasepro/cms-types";
|
|
4
4
|
export interface SelectionMenuProps<M extends Record<string, unknown>> {
|
|
5
5
|
selectionController: SelectionController<M>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectionMenu.js","names":[],"sources":["../../src/selection/SelectionMenu.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport type { CollectionConfig } from \"@rebasepro/types\";\nimport { SelectionController, SelectionQuery } from \"@rebasepro/cms-types\";\nimport { Checkbox, ChevronDownIcon, Menu, MenuItem, Tooltip, cls, iconSize } from \"@rebasepro/ui\";\nimport { idOfRow, useTranslation } from \"@rebasepro/app\";\n\nexport interface SelectionMenuProps<M extends Record<string, unknown>> {\n selectionController: SelectionController<M>;\n /** The rows the view is holding right now. */\n loadedRows: Record<string, unknown>[];\n /** The rows' collection: what a row's id is read by. */\n collection: CollectionConfig;\n /** The view's live query — what \"all matching\" stands for. */\n query: SelectionQuery<M>;\n /** The view's filtered count. `undefined` while loading, or where the accessor has none. */\n collectionEntitiesCount?: number;\n collectionName: string;\n}\n\n/**\n * The whole of selecting rows, in one control: a checkbox for the common case\n * and a caret for everything else.\n *\n * The escalation from \"the rows on screen\" to \"every row that matches\" lived in\n * a strip under the toolbar, which was wrong in a way that only shows up in\n * use: it appears the moment you tick a single checkbox, and the list you were\n * reading jumps down by its height. A control that punishes the first click is\n * not worth whatever the strip was explaining.\n *\n * So the escalation is a menu item — clicked deliberately, costing no layout,\n * and in the place you already go to select everything.\n */\nexport function SelectionMenu<M extends Record<string, unknown>>({\n selectionController,\n loadedRows,\n collection,\n query,\n collectionEntitiesCount,\n collectionName\n}: SelectionMenuProps<M>) {\n\n const { t } = useTranslation();\n const {\n selection,\n selectedCount,\n hasSelection,\n isSelected,\n setSelectedRows,\n selectAllMatching,\n clearSelection\n } = selectionController;\n\n const selectedLoaded = useMemo(\n () => loadedRows.filter(row => {\n const id = idOfRow(row, collection);\n return id !== undefined && isSelected(id);\n }).length,\n [loadedRows, collection, isSelected]\n );\n\n const allLoadedSelected = loadedRows.length > 0 && selectedLoaded === loadedRows.length;\n const someSelected = selectedLoaded > 0 && !allLoadedSelected;\n const isQuery = selection.type === \"query\";\n\n // The count can outrun the loaded rows without there being more to select —\n // it is fetched separately and settles at its own pace.\n const moreThanLoaded = collectionEntitiesCount !== undefined\n && collectionEntitiesCount > loadedRows.length;\n\n const label = hasSelection\n ? (t(\"selection_deselect_all\") ?? \"Deselect all\")\n : (t(\"selection_select_all_loaded\") ?? \"Select all loaded rows\");\n\n return (\n <div className={cls(\"flex items-center rounded-md\",\n hasSelection && \"bg-surface-hover\")}>\n\n <Tooltip title={label}>\n <div className=\"pl-1.5 pr-0.5 py-1 flex items-center\">\n <Checkbox\n size=\"small\"\n padding={false}\n aria-label={label}\n disabled={loadedRows.length === 0 && !isQuery}\n checked={allLoadedSelected || isQuery}\n indeterminate={someSelected}\n onCheckedChange={(checked) => {\n if (checked) setSelectedRows(loadedRows);\n else clearSelection();\n }}/>\n </div>\n </Tooltip>\n\n <Menu\n align=\"start\"\n trigger={\n <button\n type=\"button\"\n aria-label={t(\"selection_options\") ?? \"Selection options\"}\n className={cls(\n \"pr-1 pl-0 py-1 flex items-center rounded-r-md\",\n \"hover:bg-surface-hover focus:outline-none\",\n \"text-surface-accent-500 dark:text-surface-accent-300\"\n )}>\n <ChevronDownIcon size={iconSize.smallest}/>\n </button>\n }>\n\n <MenuItem dense onClick={() => setSelectedRows(loadedRows)}>\n {t(\"selection_menu_all_loaded\") ?? \"All on this page\"}\n </MenuItem>\n\n {/* The point of the whole feature, and the only place it is\n offered. Absent when the view already holds every matching\n row, because then it is the item above under another name. */}\n {moreThanLoaded && <MenuItem\n dense\n onClick={() => selectAllMatching(query, collectionEntitiesCount)}>\n {t(\"selection_menu_all_matching\", {\n total: collectionEntitiesCount!.toLocaleString(),\n collection: collectionName\n }) ?? `All ${collectionEntitiesCount!.toLocaleString()} ${collectionName}`}\n </MenuItem>}\n\n <MenuItem dense disabled={!hasSelection} onClick={clearSelection}>\n {t(\"selection_menu_none\") ?? \"None\"}\n </MenuItem>\n </Menu>\n\n {/* What is selected, where the control is — not in a strip that\n moves the rows. `undefined` is \"every matching row, and nobody\n knows how many\", which is why it is not defaulted to a number. */}\n {hasSelection && <span\n data-testid=\"selection-count\"\n className=\"pl-1 pr-2 text-xs font-mono tabular-nums text-text-secondary dark:text-text-secondary-dark\">\n {selectedCount === undefined ? \"…\" : selectedCount.toLocaleString()}\n </span>}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAgCA,SAAgB,cAAiD,EAC7D,qBACA,YACA,YACA,OACA,yBACA,kBACsB;CAEtB,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,EACF,WACA,eACA,cACA,YACA,iBACA,mBACA,mBACA;CAEJ,MAAM,iBAAiB,cACb,WAAW,QAAO,QAAO;EAC3B,MAAM,KAAK,QAAQ,KAAK,UAAU;EAClC,OAAO,OAAO,KAAA,KAAa,WAAW,EAAE;CAC5C,CAAC,CAAC,CAAC,QACH;EAAC;EAAY;EAAY;CAAU,CACvC;CAEA,MAAM,oBAAoB,WAAW,SAAS,KAAK,mBAAmB,WAAW;CACjF,MAAM,eAAe,iBAAiB,KAAK,CAAC;CAC5C,MAAM,UAAU,UAAU,SAAS;CAInC,MAAM,iBAAiB,4BAA4B,KAAA,KAC5C,0BAA0B,WAAW;CAE5C,MAAM,QAAQ,eACP,EAAE,wBAAwB,KAAK,iBAC/B,EAAE,6BAA6B,KAAK;CAE3C,OACI,qBAAC,OAAD;EAAK,WAAW,IAAI,gCAChB,gBAAgB,kBAAkB;YADtC;GAGI,oBAAC,SAAD;IAAS,OAAO;cACZ,oBAAC,OAAD;KAAK,WAAU;eACX,oBAAC,UAAD;MACI,MAAK;MACL,SAAS;MACT,cAAY;MACZ,UAAU,WAAW,WAAW,KAAK,CAAC;MACtC,SAAS,qBAAqB;MAC9B,eAAe;MACf,kBAAkB,YAAY;OAC1B,IAAI,SAAS,gBAAgB,UAAU;YAClC,eAAe;MACxB;KAAG,CAAA;IACN,CAAA;GACA,CAAA;GAET,qBAAC,MAAD;IACI,OAAM;IACN,SACI,oBAAC,UAAD;KACI,MAAK;KACL,cAAY,EAAE,mBAAmB,KAAK;KACtC,WAAW,IACP,iDACA,6CACA,sDACJ;eACA,oBAAC,iBAAD,EAAiB,MAAM,SAAS,SAAU,CAAA;IACtC,CAAA;cAZhB;KAeI,oBAAC,UAAD;MAAU,OAAA;MAAM,eAAe,gBAAgB,UAAU;gBACpD,EAAE,2BAA2B,KAAK;KAC7B,CAAA;KAKT,kBAAkB,oBAAC,UAAD;MACf,OAAA;MACA,eAAe,kBAAkB,OAAO,uBAAuB;gBAC9D,EAAE,+BAA+B;OAC9B,OAAO,wBAAyB,eAAe;OAC/C,YAAY;MAChB,CAAC,KAAK,OAAO,wBAAyB,eAAe,EAAE,GAAG;KACpD,CAAA;KAEV,oBAAC,UAAD;MAAU,OAAA;MAAM,UAAU,CAAC;MAAc,SAAS;gBAC7C,EAAE,qBAAqB,KAAK;KACvB,CAAA;IACR;;GAKL,gBAAgB,oBAAC,QAAD;IACb,eAAY;IACZ,WAAU;cACT,kBAAkB,KAAA,IAAY,MAAM,cAAc,eAAe;GAChE,CAAA;EACL;;AAEb"}
|
|
1
|
+
{"version":3,"file":"SelectionMenu.js","names":[],"sources":["../../src/selection/SelectionMenu.tsx"],"sourcesContent":["import React, { useMemo } from \"react\";\nimport type { CollectionConfig } from \"@rebasepro/cms-types\";\nimport { SelectionController, SelectionQuery } from \"@rebasepro/cms-types\";\nimport { Checkbox, ChevronDownIcon, Menu, MenuItem, Tooltip, cls, iconSize } from \"@rebasepro/ui\";\nimport { idOfRow, useTranslation } from \"@rebasepro/app\";\n\nexport interface SelectionMenuProps<M extends Record<string, unknown>> {\n selectionController: SelectionController<M>;\n /** The rows the view is holding right now. */\n loadedRows: Record<string, unknown>[];\n /** The rows' collection: what a row's id is read by. */\n collection: CollectionConfig;\n /** The view's live query — what \"all matching\" stands for. */\n query: SelectionQuery<M>;\n /** The view's filtered count. `undefined` while loading, or where the accessor has none. */\n collectionEntitiesCount?: number;\n collectionName: string;\n}\n\n/**\n * The whole of selecting rows, in one control: a checkbox for the common case\n * and a caret for everything else.\n *\n * The escalation from \"the rows on screen\" to \"every row that matches\" lived in\n * a strip under the toolbar, which was wrong in a way that only shows up in\n * use: it appears the moment you tick a single checkbox, and the list you were\n * reading jumps down by its height. A control that punishes the first click is\n * not worth whatever the strip was explaining.\n *\n * So the escalation is a menu item — clicked deliberately, costing no layout,\n * and in the place you already go to select everything.\n */\nexport function SelectionMenu<M extends Record<string, unknown>>({\n selectionController,\n loadedRows,\n collection,\n query,\n collectionEntitiesCount,\n collectionName\n}: SelectionMenuProps<M>) {\n\n const { t } = useTranslation();\n const {\n selection,\n selectedCount,\n hasSelection,\n isSelected,\n setSelectedRows,\n selectAllMatching,\n clearSelection\n } = selectionController;\n\n const selectedLoaded = useMemo(\n () => loadedRows.filter(row => {\n const id = idOfRow(row, collection);\n return id !== undefined && isSelected(id);\n }).length,\n [loadedRows, collection, isSelected]\n );\n\n const allLoadedSelected = loadedRows.length > 0 && selectedLoaded === loadedRows.length;\n const someSelected = selectedLoaded > 0 && !allLoadedSelected;\n const isQuery = selection.type === \"query\";\n\n // The count can outrun the loaded rows without there being more to select —\n // it is fetched separately and settles at its own pace.\n const moreThanLoaded = collectionEntitiesCount !== undefined\n && collectionEntitiesCount > loadedRows.length;\n\n const label = hasSelection\n ? (t(\"selection_deselect_all\") ?? \"Deselect all\")\n : (t(\"selection_select_all_loaded\") ?? \"Select all loaded rows\");\n\n return (\n <div className={cls(\"flex items-center rounded-md\",\n hasSelection && \"bg-surface-hover\")}>\n\n <Tooltip title={label}>\n <div className=\"pl-1.5 pr-0.5 py-1 flex items-center\">\n <Checkbox\n size=\"small\"\n padding={false}\n aria-label={label}\n disabled={loadedRows.length === 0 && !isQuery}\n checked={allLoadedSelected || isQuery}\n indeterminate={someSelected}\n onCheckedChange={(checked) => {\n if (checked) setSelectedRows(loadedRows);\n else clearSelection();\n }}/>\n </div>\n </Tooltip>\n\n <Menu\n align=\"start\"\n trigger={\n <button\n type=\"button\"\n aria-label={t(\"selection_options\") ?? \"Selection options\"}\n className={cls(\n \"pr-1 pl-0 py-1 flex items-center rounded-r-md\",\n \"hover:bg-surface-hover focus:outline-none\",\n \"text-surface-accent-500 dark:text-surface-accent-300\"\n )}>\n <ChevronDownIcon size={iconSize.smallest}/>\n </button>\n }>\n\n <MenuItem dense onClick={() => setSelectedRows(loadedRows)}>\n {t(\"selection_menu_all_loaded\") ?? \"All on this page\"}\n </MenuItem>\n\n {/* The point of the whole feature, and the only place it is\n offered. Absent when the view already holds every matching\n row, because then it is the item above under another name. */}\n {moreThanLoaded && <MenuItem\n dense\n onClick={() => selectAllMatching(query, collectionEntitiesCount)}>\n {t(\"selection_menu_all_matching\", {\n total: collectionEntitiesCount!.toLocaleString(),\n collection: collectionName\n }) ?? `All ${collectionEntitiesCount!.toLocaleString()} ${collectionName}`}\n </MenuItem>}\n\n <MenuItem dense disabled={!hasSelection} onClick={clearSelection}>\n {t(\"selection_menu_none\") ?? \"None\"}\n </MenuItem>\n </Menu>\n\n {/* What is selected, where the control is — not in a strip that\n moves the rows. `undefined` is \"every matching row, and nobody\n knows how many\", which is why it is not defaulted to a number. */}\n {hasSelection && <span\n data-testid=\"selection-count\"\n className=\"pl-1 pr-2 text-xs font-mono tabular-nums text-text-secondary dark:text-text-secondary-dark\">\n {selectedCount === undefined ? \"…\" : selectedC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;MAAU,OAAA;MAAM,eAAe,gBAAgB,UAAU;gBACpD,EAAE,2BAA2B,KAAK;KAC7B,CAAA;KAKT,kBAAkB,oBAAC,UAAD;MACf,OAAA;MACA,eAAe,kBAAkB,OAAO,uBAAuB;gBAC9D,EAAE,+BAA+B;OAC9B,OAAO,wBAAyB,eAAe;OAC/C,YAAY;MAChB,CAAC,KAAK,OAAO,wBAAyB,eAAe,EAAE,GAAG;KACpD,CAAA;KAEV,oBAAC,UAAD;MAAU,OAAA;MAAM,UAAU,CAAC;MAAc,SAAS;gBAC7C,EAAE,qBAAqB,KAAK;KACvB,CAAA;IACR;;GAKL,gBAAgB,oBAAC,QAAD;IACb,eAAY;IACZ,WAAU;cACT,kBAAkB,KAAA,IAAY,MAAM,cAAc,eAAe;GAChE,CAAA;EACL;;AAEb"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { EntitySelection, RowSelection, SelectionQuery } from "@rebasepro/cms-types";
|
|
1
|
+
import { FindParams, SDKTableClient } from "@rebasepro/types";
|
|
2
|
+
import { EntitySelection, RowSelection, SelectionQuery, CollectionConfig, Entity } from "@rebasepro/cms-types";
|
|
3
3
|
import { EntityPageAccessor } from "../util/entity_pages.js";
|
|
4
4
|
/**
|
|
5
5
|
* Rows asked for per request while resolving a query selection.
|
|
@@ -41,7 +41,7 @@ export declare function selectionQueryToFindParams<M extends Record<string, unkn
|
|
|
41
41
|
* nothing else.
|
|
42
42
|
*/
|
|
43
43
|
export interface SelectionRowSource {
|
|
44
|
-
|
|
44
|
+
table(slug: string): Pick<SDKTableClient, "find">;
|
|
45
45
|
}
|
|
46
46
|
export interface ResolveSelectionParams<M extends Record<string, unknown>> {
|
|
47
47
|
/** `selectionController.selection`. */
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { walkEntityPages } from "../util/entity_pages.js";
|
|
2
|
-
import {
|
|
2
|
+
import { resolvePrimaryKeys } from "@rebasepro/cms-types";
|
|
3
3
|
import { getRelationIncludeParams } from "@rebasepro/app";
|
|
4
|
+
import { buildCompositeId } from "@rebasepro/common";
|
|
4
5
|
//#region src/selection/resolve_selection.ts
|
|
5
6
|
/**
|
|
6
7
|
* Rows asked for per request while resolving a query selection.
|
|
@@ -71,7 +72,7 @@ async function resolveSelection({ data, collection, selection, ...rest }) {
|
|
|
71
72
|
}
|
|
72
73
|
const keys = resolvePrimaryKeys(collection);
|
|
73
74
|
const path = selection.query.path;
|
|
74
|
-
const flat = data.
|
|
75
|
+
const flat = data.table(path);
|
|
75
76
|
const include = getRelationIncludeParams(collection);
|
|
76
77
|
const accessor = { find: async (findParams) => {
|
|
77
78
|
const page = await flat.find(include ? {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve_selection.js","names":[],"sources":["../../src/selection/resolve_selection.ts"],"sourcesContent":["import { CollectionConfig, Entity, FindParams, OrderByTuple, SDKCollectionClient } from \"@rebasepro/types\";\nimport { EntitySelection, RowSelection, SelectionQuery } from \"@rebasepro/cms-types\";\nimport { buildCompositeId, resolvePrimaryKeys } from \"@rebasepro/common\";\nimport { getRelationIncludeParams } from \"@rebasepro/app\";\nimport { EntityPageAccessor, walkEntityPages } from \"../util/entity_pages\";\n\n/**\n * Rows asked for per request while resolving a query selection.\n *\n * Same ceiling as the export walk, and for the same reason: the server refuses\n * a `limit` above its `MAX_LIST_LIMIT` rather than clamping it.\n */\nexport const SELECTION_PAGE_SIZE = 500;\n\n/**\n * Most rows one query selection will resolve to ids for.\n *\n * The write path is per-row — `deleteMany` loops the single-row delete server\n * side so hooks and row-level security still run for each — so this is a\n * genuine ceiling on the work, not just on memory. Going over it **throws**\n * rather than acting on a prefix, which is the failure that cannot be seen:\n * \"deleted 12,480 rows\" reads identically whether it was all of them or the\n * first page.\n */\nexport const MAX_SELECTION_ROWS = 20_000;\n\n/**\n * A stable string for a selection query, for comparing the query a selection\n * was made against with the one the view is showing now.\n *\n * Filter keys are sorted: `filterValues` is rebuilt on most renders and its key\n * order follows whatever order the user touched the columns in, so a plain\n * `JSON.stringify` would report the same filter as a different one and drop a\n * selection the moment anything re-rendered.\n */\nexport function serializeSelectionQuery<M extends Record<string, unknown>>(query: SelectionQuery<M>): string {\n const filter = query.filterValues\n ? Object.keys(query.filterValues).sort()\n .map(k => `${k}=${JSON.stringify((query.filterValues as Record<string, unknown>)[k])}`)\n .join(\"&\")\n : \"\";\n const order = query.sortBy?.map(([field, direction]) => `${String(field)}:${direction}`).join(\",\") ?? \"\";\n return `${query.path}|${filter}|${order}|${query.searchString ?? \"\"}`;\n}\n\n/** Turn a captured selection query into the `find` params that reproduce it. */\nexport function selectionQueryToFindParams<M extends Record<string, unknown>>(\n query: SelectionQuery<M>\n): Omit<FindParams<M>, \"limit\" | \"offset\" | \"page\"> {\n const where = query.filterValues && Object.keys(query.filterValues).length > 0\n ? query.filterValues\n : undefined;\n const orderBy = query.sortBy && query.sortBy.length > 0\n ? query.sortBy.map(([field, direction]) => [String(field), direction] as OrderByTuple)\n : undefined;\n return {\n where,\n orderBy,\n searchString: query.searchString\n } as Omit<FindParams<M>, \"limit\" | \"offset\" | \"page\">;\n}\n\n/**\n * What {@link resolveSelection} takes: a view's selection, and where its rows\n * are read.\n */\n/**\n * Where a query selection's rows are read: `context.data` is one, and so is\n * anything that can `find` a collection's rows by its slug — the resolve reads\n * nothing else.\n */\nexport interface SelectionRowSource {\n collection(slug: string): Pick<SDKCollectionClient, \"find\">;\n}\n\nexport interface ResolveSelectionParams<M extends Record<string, unknown>> {\n /** `selectionController.selection`. */\n selection: RowSelection<M>;\n /** `context.data`: where a query selection's rows are read. */\n data: SelectionRowSource;\n /** The selection's collection: what a row's id is read by. */\n collection: CollectionConfig;\n pageSize?: number;\n maxRows?: number;\n /** Called after every page, so a long resolve can show where it is. */\n onProgress?: (loaded: number, total: number | undefined) => void;\n /** Checked between pages; aborting returns the rows read so far. */\n signal?: { aborted: boolean };\n}\n\n/**\n * {@link resolveEntitySelection}'s parameters: the admin's own selection and\n * the accessor of its own data.\n *\n * @internal\n */\nexport interface ResolveEntitySelectionParams<M extends Record<string, unknown>> {\n selection: EntitySelection<M>;\n /**\n * Reads the rows a query selection stands for. Only consulted in query\n * mode — an entities selection is already resolved and never hits the\n * network.\n */\n accessor: EntityPageAccessor<M>;\n pageSize?: number;\n maxRows?: number;\n onProgress?: (loaded: number, total: number | undefined) => void;\n signal?: { aborted: boolean };\n}\n\n/**\n * What {@link resolveSelection} hands back: the rows and their ids, as a\n * ticked selection holds them.\n */\nexport interface ResolvedSelection {\n /** The rows, as the server sends them. */\n rows: Record<string, unknown>[];\n /**\n * The id of each of `rows`, at the same position: the record's primary\n * key as a string, a composite one's parts joined by `:::` — what\n * `useRowWrites().update` and `useSidePanel().open` take.\n */\n ids: string[];\n}\n\n/**\n * The rows a selection covers, as the server sends them — ISO dates, a\n * belongsTo as its foreign key, a relation the view loads nested under its\n * name as REST's `include` returns it — one shape in both modes: a query\n * selection's rows are read with the view's own include. Their ids come\n * beside them.\n *\n * This is the *only* way to get rows out of a query selection, and it is why\n * {@link RowSelection} is a union: a bulk action has to call it, which means\n * it has to deal with the wait, the ceiling and the failure. The array this\n * replaced let the same code path read whatever the view had scrolled — 50 rows\n * of 12,480 — and report success.\n *\n * ```ts\n * const { rows, ids } = await resolveSelection({ selection, data: context.data, collection });\n * ```\n *\n * @throws When the query matches more than `maxRows` rows.\n */\nexport async function resolveSelection<M extends Record<string, unknown>>({\n data,\n collection,\n selection,\n ...rest\n}: ResolveSelectionParams<M>): Promise<ResolvedSelection> {\n if (selection.type === \"rows\") {\n rest.onProgress?.(selection.rows.length, selection.rows.length);\n return { rows: selection.rows, ids: selection.ids };\n }\n const keys = resolvePrimaryKeys(collection);\n const path = selection.query.path;\n const flat = data.collection(path);\n // The relations the view reads its rows with, so a row read here is the\n // row a ticked one is.\n const include = getRelationIncludeParams(collection);\n // Walked as records, so the rows ticked off are told apart by the id the\n // view addressed them by; handed back as the rows read.\n const accessor: EntityPageAccessor<Record<string, unknown>> = {\n find: async (findParams) => {\n const page = await flat.find(include ? { ...findParams, include } : findParams);\n return {\n data: page.data.map((row) => ({ id: idOf(row, keys), path, values: row })),\n meta: page.meta\n };\n }\n };\n const excluded = new Set<string>(selection.excludedIds.map(String));\n const entities = await walkQuerySelection<Record<string, unknown>>({\n ...rest,\n query: selection.query,\n count: selection.count,\n excludedCount: selection.excludedIds.length,\n keep: (entity) => !excluded.has(String(entity.id)),\n accessor\n });\n return { rows: entities.map((entity) => entity.values), ids: entities.map((entity) => String(entity.id)) };\n}\n\nfunction idOf(row: Record<string, unknown>, keys: ReturnType<typeof resolvePrimaryKeys>): string {\n if (keys.length > 0) return buildCompositeId(row, keys);\n const id = row.id;\n return typeof id === \"string\" || typeof id === \"number\" ? String(id) : \"\";\n}\n\n/**\n * {@link resolveSelection} for the admin's own selection: the records it\n * covers, in its `Entity` view model, read through `accessor`.\n *\n * @throws When the query matches more than `maxRows` rows.\n * @internal\n */\nexport async function resolveEntitySelection<M extends Record<string, unknown>>({\n selection,\n accessor,\n pageSize = SELECTION_PAGE_SIZE,\n maxRows = MAX_SELECTION_ROWS,\n onProgress,\n signal\n}: ResolveEntitySelectionParams<M>): Promise<Entity<M>[]> {\n\n if (selection.type === \"entities\") {\n onProgress?.(selection.entities.length, selection.entities.length);\n return selection.entities;\n }\n\n const excluded = new Set(selection.excluded.map(e => `${e.path}/${e.id}`));\n return walkQuerySelection<M>({\n accessor,\n query: selection.query,\n count: selection.count,\n excludedCount: selection.excluded.length,\n keep: (e) => !excluded.has(`${e.path}/${e.id}`),\n pageSize,\n maxRows,\n onProgress,\n signal\n });\n}\n\n/**\n * Every row a query selection matches, less the ones ticked off. The ceiling\n * is on the rows left once those are out: the ticked-off rows are read with\n * the rest and dropped, so the walk may read that many past it.\n */\nasync function walkQuerySelection<M extends Record<string, unknown>>({\n accessor,\n query,\n count,\n excludedCount,\n keep,\n pageSize = SELECTION_PAGE_SIZE,\n maxRows = MAX_SELECTION_ROWS,\n onProgress,\n signal\n}: {\n accessor: EntityPageAccessor<M>;\n query: SelectionQuery<M>;\n count: number | undefined;\n excludedCount: number;\n keep: (entity: Entity<M>) => boolean;\n pageSize?: number;\n maxRows?: number;\n onProgress?: (loaded: number, total: number | undefined) => void;\n signal?: { aborted: boolean };\n}): Promise<Entity<M>[]> {\n // The count was taken when the selection was made, so it can only be a\n // forecast — but it is the one the user was shown and agreed to, and\n // refusing before the walk beats refusing forty pages in.\n if (count !== undefined && count - excludedCount > maxRows)\n throw new Error(selectionCeilingMessage(maxRows));\n\n const rows = await walkEntityPages<M>({\n accessor,\n params: selectionQueryToFindParams(query),\n pageSize,\n maxRows: maxRows + excludedCount,\n onProgress,\n signal,\n onCeiling: () => selectionCeilingMessage(maxRows)\n });\n\n if (excludedCount === 0) return rows;\n const kept = rows.filter(keep);\n if (kept.length > maxRows) throw new Error(selectionCeilingMessage(maxRows));\n return kept;\n}\n\nfunction selectionCeilingMessage(maxRows: number): string {\n return `This selection covers more than ${maxRows.toLocaleString()} rows, which is more than ` +\n \"can be acted on from the browser in one go. Filter the collection down first.\";\n}\n"],"mappings":";;;;;;;;;;AAYA,IAAa,sBAAsB;;;;;;;;;;;AAYnC,IAAa,qBAAqB;;;;;;;;;;AAWlC,SAAgB,wBAA2D,OAAkC;CACzG,MAAM,SAAS,MAAM,eACf,OAAO,KAAK,MAAM,YAAY,CAAC,CAAC,KAAK,CAAC,CACnC,KAAI,MAAK,GAAG,EAAE,GAAG,KAAK,UAAW,MAAM,aAAyC,EAAE,GAAG,CAAC,CACtF,KAAK,GAAG,IACX;CACN,MAAM,QAAQ,MAAM,QAAQ,KAAK,CAAC,OAAO,eAAe,GAAG,OAAO,KAAK,EAAE,GAAG,WAAW,CAAC,CAAC,KAAK,GAAG,KAAK;CACtG,OAAO,GAAG,MAAM,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,gBAAgB;AACrE;;AAGA,SAAgB,2BACZ,OACgD;CAOhD,OAAO;EACH,OAPU,MAAM,gBAAgB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"resolve_selection.js","names":[],"sources":["../../src/selection/resolve_selection.ts"],"sourcesContent":["import { FindParams, OrderByTuple, SDKTableClient } from \"@rebasepro/types\";\nimport { EntitySelection, RowSelection, SelectionQuery, CollectionConfig, resolvePrimaryKeys, Entity } from \"@rebasepro/cms-types\";\nimport { buildCompositeId } from \"@rebasepro/common\";\nimport { getRelationIncludeParams } from \"@rebasepro/app\";\nimport { EntityPageAccessor, walkEntityPages } from \"../util/entity_pages\";\n\n/**\n * Rows asked for per request while resolving a query selection.\n *\n * Same ceiling as the export walk, and for the same reason: the server refuses\n * a `limit` above its `MAX_LIST_LIMIT` rather than clamping it.\n */\nexport const SELECTION_PAGE_SIZE = 500;\n\n/**\n * Most rows one query selection will resolve to ids for.\n *\n * The write path is per-row — `deleteMany` loops the single-row delete server\n * side so hooks and row-level security still run for each — so this is a\n * genuine ceiling on the work, not just on memory. Going over it **throws**\n * rather than acting on a prefix, which is the failure that cannot be seen:\n * \"deleted 12,480 rows\" reads identically whether it was all of them or the\n * first page.\n */\nexport const MAX_SELECTION_ROWS = 20_000;\n\n/**\n * A stable string for a selection query, for comparing the query a selection\n * was made against with the one the view is showing now.\n *\n * Filter keys are sorted: `filterValues` is rebuilt on most renders and its key\n * order follows whatever order the user touched the columns in, so a plain\n * `JSON.stringify` would report the same filter as a different one and drop a\n * selection the moment anything re-rendered.\n */\nexport function serializeSelectionQuery<M extends Record<string, unknown>>(query: SelectionQuery<M>): string {\n const filter = query.filterValues\n ? Object.keys(query.filterValues).sort()\n .map(k => `${k}=${JSON.stringify((query.filterValues as Record<string, unknown>)[k])}`)\n .join(\"&\")\n : \"\";\n const order = query.sortBy?.map(([field, direction]) => `${String(field)}:${direction}`).join(\",\") ?? \"\";\n return `${query.path}|${filter}|${order}|${query.searchString ?? \"\"}`;\n}\n\n/** Turn a captured selection query into the `find` params that reproduce it. */\nexport function selectionQueryToFindParams<M extends Record<string, unknown>>(\n query: SelectionQuery<M>\n): Omit<FindParams<M>, \"limit\" | \"offset\" | \"page\"> {\n const where = query.filterValues && Object.keys(query.filterValues).length > 0\n ? query.filterValues\n : undefined;\n const orderBy = query.sortBy && query.sortBy.length > 0\n ? query.sortBy.map(([field, direction]) => [String(field), direction] as OrderByTuple)\n : undefined;\n return {\n where,\n orderBy,\n searchString: query.searchString\n } as Omit<FindParams<M>, \"limit\" | \"offset\" | \"page\">;\n}\n\n/**\n * What {@link resolveSelection} takes: a view's selection, and where its rows\n * are read.\n */\n/**\n * Where a query selection's rows are read: `context.data` is one, and so is\n * anything that can `find` a collection's rows by its slug — the resolve reads\n * nothing else.\n */\nexport interface SelectionRowSource {\n table(slug: string): Pick<SDKTableClient, \"find\">;\n}\n\nexport interface ResolveSelectionParams<M extends Record<string, unknown>> {\n /** `selectionController.selection`. */\n selection: RowSelection<M>;\n /** `context.data`: where a query selection's rows are read. */\n data: SelectionRowSource;\n /** The selection's collection: what a row's id is read by. */\n collection: CollectionConfig;\n pageSize?: number;\n maxRows?: number;\n /** Called after every page, so a long resolve can show where it is. */\n onProgress?: (loaded: number, total: number | undefined) => void;\n /** Checked between pages; aborting returns the rows read so far. */\n signal?: { aborted: boolean };\n}\n\n/**\n * {@link resolveEntitySelection}'s parameters: the admin's own selection and\n * the accessor of its own data.\n *\n * @internal\n */\nexport interface ResolveEntitySelectionParams<M extends Record<string, unknown>> {\n selection: EntitySelection<M>;\n /**\n * Reads the rows a query selection stands for. Only consulted in query\n * mode — an entities selection is already resolved and never hits the\n * network.\n */\n accessor: EntityPageAccessor<M>;\n pageSize?: number;\n maxRows?: number;\n onProgress?: (loaded: number, total: number | undefined) => void;\n signal?: { aborted: boolean };\n}\n\n/**\n * What {@link resolveSelection} hands back: the rows and their ids, as a\n * ticked selection holds them.\n */\nexport interface ResolvedSelection {\n /** The rows, as the server sends them. */\n rows: Record<string, unknown>[];\n /**\n * The id of each of `rows`, at the same position: the record's primary\n * key as a string, a composite one's parts joined by `:::` — what\n * `useRowWrites().update` and `useSidePanel().open` take.\n */\n ids: string[];\n}\n\n/**\n * The rows a selection covers, as the server sends them — ISO dates, a\n * belongsTo as its foreign key, a relation the view loads nested under its\n * name as REST's `include` returns it — one shape in both modes: a query\n * selection's rows are read with the view's own include. Their ids come\n * beside them.\n *\n * This is the *only* way to get rows out of a query selection, and it is why\n * {@link RowSelection} is a union: a bulk action has to call it, which means\n * it has to deal with the wait, the ceiling and the failure. The array this\n * replaced let the same code path read whatever the view had scrolled — 50 rows\n * of 12,480 — and report success.\n *\n * ```ts\n * const { rows, ids } = await resolveSelection({ selection, data: context.data, collection });\n * ```\n *\n * @throws When the query matches more than `maxRows` rows.\n */\nexport async function resolveSelection<M extends Record<string, unknown>>({\n data,\n collection,\n selection,\n ...rest\n}: ResolveSelectionParams<M>): Promise<ResolvedSelection> {\n if (selection.type === \"rows\") {\n rest.onProgress?.(selection.rows.length, selection.rows.length);\n return { rows: selection.rows, ids: selection.ids };\n }\n const keys = resolvePrimaryKeys(collection);\n const path = selection.query.path;\n const flat = data.table(path);\n // The relations the view reads its rows with, so a row read here is the\n // row a ticked one is.\n const include = getRelationIncludeParams(collection);\n // Walked as records, so the rows ticked off are told apart by the id the\n // view addressed them by; handed back as the rows read.\n const accessor: EntityPageAccessor<Record<string, unknown>> = {\n find: async (findParams) => {\n const page = await flat.find(include ? { ...findParams, include } : findParams);\n return {\n data: page.data.map((row) => ({ id: idOf(row, keys), path, values: row })),\n meta: page.meta\n };\n }\n };\n const excluded = new Set<string>(selection.excludedIds.map(String));\n const entities = await walkQuerySelection<Record<string, unknown>>({\n ...rest,\n query: selection.query,\n count: selection.count,\n excludedCount: selection.excludedIds.length,\n keep: (entity) => !excluded.has(String(entity.id)),\n accessor\n });\n return { rows: entities.map((entity) => entity.values), ids: entities.map((entity) => String(entity.id)) };\n}\n\nfunction idOf(row: Record<string, unknown>, keys: ReturnType<typeof resolvePrimaryKeys>): string {\n if (keys.length > 0) return buildCompositeId(row, keys);\n const id = row.id;\n return typeof id === \"string\" || typeof id === \"number\" ? String(id) : \"\";\n}\n\n/**\n * {@link resolveSelection} for the admin's own selection: the records it\n * covers, in its `Entity` view model, read through `accessor`.\n *\n * @throws When the query matches more than `maxRows` rows.\n * @internal\n */\nexport async function resolveEntitySelection<M extends Record<string, unknown>>({\n selection,\n accessor,\n pageSize = SELECTION_PAGE_SIZE,\n maxRows = MAX_SELECTION_ROWS,\n onProgress,\n signal\n}: ResolveEntitySelectionParams<M>): Promise<Entity<M>[]> {\n\n if (selection.type === \"entities\") {\n onProgress?.(selection.entities.length, selection.entities.length);\n return selection.entities;\n }\n\n const excluded = new Set(selection.excluded.map(e => `${e.path}/${e.id}`));\n return walkQuerySelection<M>({\n accessor,\n query: selection.query,\n count: selection.count,\n excludedCount: selection.excluded.length,\n keep: (e) => !excluded.has(`${e.path}/${e.id}`),\n pageSize,\n maxRows,\n onProgress,\n signal\n });\n}\n\n/**\n * Every row a query selection matches, less the ones ticked off. The ceiling\n * is on the rows left once those are out: the ticked-off rows are read with\n * the rest and dropped, so the walk may read that many past it.\n */\nasync function walkQuerySelection<M extends Record<string, unknown>>({\n accessor,\n query,\n count,\n excludedCount,\n keep,\n pageSize = SELECTION_PAGE_SIZE,\n maxRows = MAX_SELECTION_ROWS,\n onProgress,\n signal\n}: {\n accessor: EntityPageAccessor<M>;\n query: SelectionQuery<M>;\n count: number | undefined;\n excludedCount: number;\n keep: (entity: Entity<M>) => boolean;\n pageSize?: number;\n maxRows?: number;\n onProgress?: (loaded: number, total: number | undefined) => void;\n signal?: { aborted: boolean };\n}): Promise<Entity<M>[]> {\n // The count was taken when the selection was made, so it can only be a\n // forecast — but it is the one the user was shown and agreed to, and\n // refusing before the walk beats refusing forty pages in.\n if (count !== undefined && count - excludedCount > maxRows)\n throw new Error(selectionCeilingMessage(maxRows));\n\n const rows = await walkEntityPages<M>({\n accessor,\n params: selectionQueryToFindParams(query),\n pageSize,\n maxRows: maxRows + excludedCount,\n onProgress,\n signal,\n onCeiling: () => selectionCeilingMessage(maxRows)\n });\n\n if (excludedCount === 0) return rows;\n const kept = rows.filter(keep);\n if (kept.length > maxRows) throw new Error(selectionCeilingMessage(maxRows));\n return kept;\n}\n\nfunction selectionCeilingMessage(maxRows: number): string {\n return `This selection covers more than ${maxRows.toLocaleString()} rows, which is more than ` +\n \"can be acted on from the browser in one go. Filter the collection down first.\";\n}\n"],"mappings":";;;;;;;;;;;AAYA,IAAa,sBAAsB;;;;;;;;;;;AAYnC,IAAa,qBAAqB;;;;;;;;;;AAWlC,SAAgB,wBAA2D,OAAkC;CACzG,MAAM,SAAS,MAAM,eACf,OAAO,KAAK,MAAM,YAAY,CAAC,CAAC,KAAK,CAAC,CACnC,KAAI,MAAK,GAAG,EAAE,GAAG,KAAK,UAAW,MAAM,aAAyC,EAAE,GAAG,CAAC,CACtF,KAAK,GAAG,IACX;CACN,MAAM,QAAQ,MAAM,QAAQ,KAAK,CAAC,OAAO,eAAe,GAAG,OAAO,KAAK,EAAE,GAAG,WAAW,CAAC,CAAC,KAAK,GAAG,KAAK;CACtG,OAAO,GAAG,MAAM,KAAK,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,gBAAgB;AACrE;;AAGA,SAAgB,2BACZ,OACgD;CAOhD,OAAO;EACH,OAPU,MAAM,gBAAgB,OAAO,KAAK,MAAM,YAAY,CAAC,CAAC,SAAS,IACvE,MAAM,eACN,KAAA;EAMF,SALY,MAAM,UAAU,MAAM,OAAO,SAAS,IAChD,MAAM,OAAO,KAAK,CAAC,OAAO,eAAe,CAAC,OAAO,KAAK,GAAG,SAAS,CAAiB,IACnF,KAAA;EAIF,cAAc,MAAM;CACxB;AACJ;;;;;;;;;;;;;;;;;;;;AAoFA,eAAsB,iBAAoD,EACtE,MACA,YACA,WACA,GAAG,QACmD;CACtD,IAAI,UAAU,SAAS,QAAQ;EAC3B,KAAK,aAAa,UAAU,KAAK,QAAQ,UAAU,KAAK,MAAM;EAC9D,OAAO;GAAE,MAAM,UAAU;GAAM,KAAK,UAAU;EAAI;CACtD;CACA,MAAM,OAAO,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AsB;EACzB;EACA,OAAO,UAAU;EACjB,OAAO,UAAU;EACjB,eAAe,UAAU,SAAS;EAClC,OAAO,MAAM,CAAC,SAAS,IAAI,GAAG,EAAE,KAAK,GAAG,EAAE,IAAI;EAC9C;EACA;EACA;EACA;CACJ,CAAC;AACL;;;;;;AAOA,eAAe,mBAAsD,EACjE,UACA,OACA,OACA,eACA,MACA,WAAA,KACA,UAAU,oBACV,YACA,UAWqB;CAIrB,IAAI,UAAU,KAAA,KAAa,QAAQ,gBAAgB,SAC/C,MAAM,IAAI,MAAM,wBAAwB,OAAO,CAAC;CAEpD,MAAM,OAAO,MAAM,gBAAmB;EAClC;EACA,QAAQ,2BAA2B,KAAK;EACxC;EACA,SAAS,UAAU;EACnB;EACA;EACA,iBAAiB,wBAAwB,OAAO;CACpD,CAAC;CAED,IAAI,kBAAkB,GAAG,OAAO;CAChC,MAAM,OAAO,KAAK,OAAO,IAAI;CAC7B,IAAI,KAAK,SAAS,SAAS,MAAM,IAAI,MAAM,wBAAwB,OAAO,CAAC;CAC3E,OAAO;AACX;AAEA,SAAS,wBAAwB,SAAyB;CACtD,OAAO,mCAAmC,QAAQ,eAAe,EAAE;AAEvE"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Folds a `customizeTable(...)` result into the collection a table projects
|
|
3
|
+
* to.
|
|
4
|
+
*
|
|
5
|
+
* The panel's views read one view model — a flat collection of `Property`s,
|
|
6
|
+
* with the presentation keys (`propertiesOrder`, `kanban.columnProperty`,
|
|
7
|
+
* `display`, a property's `admin.hideFromCollection` …) where they always
|
|
8
|
+
* were. `customizeTable` speaks the spec's names (`fieldOrder`,
|
|
9
|
+
* `kanban.columnField`, `fields.x.hidden` …); this module is the single place
|
|
10
|
+
* that translates one into the other, so no view changes.
|
|
11
|
+
*
|
|
12
|
+
* A customization is written against the table as its author last saw it, and
|
|
13
|
+
* the server may have redacted a column for this caller or the table may have
|
|
14
|
+
* moved on since. Neither is an error at runtime: what does not match is
|
|
15
|
+
* skipped, and said once, in development.
|
|
16
|
+
*/
|
|
17
|
+
import type { AdminPostgresCollection, TableCustomization, Properties } from "@rebasepro/cms-types";
|
|
18
|
+
/**
|
|
19
|
+
* A table's collection in the panel, after customization.
|
|
20
|
+
*
|
|
21
|
+
* The projected collection's own type, with one difference: its properties
|
|
22
|
+
* may include a `reference` — what a `fields.x.referenceTo` column becomes —
|
|
23
|
+
* which the legacy `PostgresProperties` does not admit, although the planner,
|
|
24
|
+
* the row codec and every view already handle one on a Postgres table.
|
|
25
|
+
*
|
|
26
|
+
* @group Tables
|
|
27
|
+
*/
|
|
28
|
+
export type TableCollection = Omit<AdminPostgresCollection, "properties"> & {
|
|
29
|
+
properties: Properties;
|
|
30
|
+
};
|
|
31
|
+
/** Forget which warnings were shown. For tests. */
|
|
32
|
+
export declare function resetCustomizationWarnings(): void;
|
|
33
|
+
/**
|
|
34
|
+
* A table's projected collection with a customization folded in.
|
|
35
|
+
*
|
|
36
|
+
* Labels, icon, group, views, kanban, display slots, columns, form layout,
|
|
37
|
+
* actions, custom views and every per-field option are written where the
|
|
38
|
+
* panel's views read them; enum labels and colours are merged onto the
|
|
39
|
+
* projected values, so a value the customization does not mention keeps its
|
|
40
|
+
* seeded colour. A field, column or slot the collection does not have — the
|
|
41
|
+
* server redacted it for this caller, or the table changed — is skipped with
|
|
42
|
+
* a warning in development, never an error.
|
|
43
|
+
*
|
|
44
|
+
* A customization for another slug is not applied.
|
|
45
|
+
*
|
|
46
|
+
* @param collection what the table projects to
|
|
47
|
+
* @param customization the result of `customizeTable`
|
|
48
|
+
*
|
|
49
|
+
* @group Tables
|
|
50
|
+
*/
|
|
51
|
+
export declare function applyTableCustomization(collection: TableCollection, customization: TableCustomization): TableCollection;
|
|
52
|
+
/**
|
|
53
|
+
* Every served table's collection, each with its customization folded in.
|
|
54
|
+
*
|
|
55
|
+
* A customization whose table is not among `collections` — not served to this
|
|
56
|
+
* user, or misspelt — is ignored with a warning in development. Two
|
|
57
|
+
* customizations of one table are refused: which one wins would depend on
|
|
58
|
+
* import order.
|
|
59
|
+
*
|
|
60
|
+
* @param collections what the served tables project to
|
|
61
|
+
* @param customizations the `customizeTable` results, as `<RebaseCMS tableCustomizations>` takes them
|
|
62
|
+
*
|
|
63
|
+
* @group Tables
|
|
64
|
+
*/
|
|
65
|
+
export declare function applyTableCustomizations(collections: readonly TableCollection[], customizations: readonly TableCustomization[]): TableCollection[];
|