// Copyright (c) Cratis. All rights reserved. // Licensed under the MIT license. See LICENSE file in the project root for full license information. // Runtime-only module: import dynamically beneath ArcRuntimeBoundary, never through the barrel. import type { ComponentProps } from 'react'; import { QueryFor, ObservableQueryFor } from '@cratis/arc/queries'; import { Command } from '@cratis/arc/commands'; import { DataTableForQuery, DataTableForObservableQuery } from '@cratis/components/DataTables'; import { DataPage } from '@cratis/components/DataPage'; import { CommandDialog, StepperCommandDialog } from '@cratis/components/CommandDialog'; import type { BoundConstructor } from './BoundConstructor'; import { requireArcProxy } from './requireArcProxy'; type QueryProps = Omit & { query: BoundConstructor }; type CommandProps = Omit & { command: BoundConstructor }; // Scene carries property names and argument objects, not compile-time row schemas. These adapters // support generated object/collection queries, as required by the Components public prop contracts. export function BoundDataTable({ query, ...props }: QueryProps>) { return , 'query')} />; } export function BoundObservableDataTable({ query, ...props }: QueryProps>) { return , 'observable query')} />; } export function BoundDataPage({ query, ...props }: QueryProps>) { const base = query.prototype instanceof ObservableQueryFor ? ObservableQueryFor : QueryFor; // This chooses only the kind of the supplied constructor, never another registered binding. const proxy = requireArcProxy | ObservableQueryFor>(query, base, 'query'); return ; } export function BoundCommandDialog({ command, ...props }: CommandProps>) { return , 'command')} />; } export function BoundStepperCommandDialog({ command, ...props }: CommandProps>) { return , 'command')} />; }