import type { Component, h, VNode } from 'vue'; import type { QdFormProps } from '../form'; export type QdComponentResolver = string | Component | VNode; export type QdComponentRender = (vueH: typeof h, context: Record) => VNode; export type QdComputeFunction = ((context: Record, crudMode: QdConfigRendererProps['crudMode']) => T) & { __qdCompute?: true; __qdId?: string; }; export type QdAsyncFunction = (watchValue: unknown, context: Record, crudMode: QdConfigRendererProps['crudMode']) => Promise; export type QdWatchFunction = (context: Record) => T; export interface QdAsyncComputeOptions { asyncFn: QdAsyncFunction; watch?: QdWatchFunction; __qdAsyncCompute?: true; __qdExecuted?: boolean; __qdId?: string; } export type QdConfigValue = T | QdComputeFunction | QdAsyncComputeOptions; export type Qd2ConfigValue = { [K in keyof T]: T[K] extends (...args: never[]) => unknown ? QdConfigValue : QdConfigValue; }; export interface QdConfigSlotProps { [slotName: string]: QdComponentConfig; } export interface QdComponentConfig { is?: QdComponentResolver; render?: QdComponentRender; context?: Record; options?: QdConfigValue; slots?: QdConfigSlotProps; ifRender?: QdConfigValue; [key: `vModel${string}`]: string; [key: `default${string}`]: unknown; [key: string]: QdConfigValue; } export interface QdConfigRendererProps extends Pick { config: QdComponentConfig; context?: Record; fnInjectCtx?: boolean; }