import { Component } from 'vue'; import { DetailComponentConstructor, DetailRenderer, GridOptions, MasterDetailConfig } from 'photon-grid-core'; /** * `masterDetail.renderer` as accepted by the Vue wrapper: a Vue component * passed directly, or anything the core already accepts (a `DetailComponent` * class, a `(ctx) => HTMLElement | string` function, a static HTML string). * * ```ts * renderer: OrderDetail // a Vue component * renderer: (ctx) => `

${ctx.data.account}

` // core: HTML from a function * renderer: '

Details

' // core: a static HTML string * ``` * * Options-API and `defineComponent` components are plain objects, so they are * detected without ceremony. A **functional** Vue component is a bare function * and is indistinguishable from a core function renderer — wrap that one * explicitly with {@link createVueDetailRenderer}. */ export type VueDetailRenderer = Component | DetailRenderer; /** Core `MasterDetailConfig` with `renderer` widened to the Vue forms above. */ export type VueMasterDetailConfig = Omit & { renderer?: VueDetailRenderer; }; /** * Core `GridOptions` with `masterDetail.renderer` widened to accept Vue * components. Assignment-compatible with the core type, so an existing * `GridOptions` object passes through unchanged. */ export type PhotonGridOptions = Omit & { masterDetail?: VueMasterDetailConfig; }; /** * Wraps a Vue component in a core `DetailComponent` class. * * A class (rather than a `(ctx) => HTMLElement` function) because only the * class form gets `destroy()` — a Vue app that is merely detached from the DOM * is never unmounted, so its watchers and lifecycle hooks would outlive the * collapsed row. * * Each expanded row gets its own app instance mounted into `ctx.containerEl`, * driven by a `reactive` prop bag. `refresh` mutates that bag and returns * `true`, so Vue re-renders the existing component tree rather than the core * tearing it down and rebuilding it. * * Exported for the one case the bare form cannot express: a functional Vue * component, which is indistinguishable from a core function renderer. * `renderer: createVueDetailRenderer(myDetail)` settles it. */ export declare function createVueDetailRenderer(component: Component): DetailComponentConstructor; /** * Resolves a {@link VueDetailRenderer} to a core `DetailRenderer`. Core forms * — a `DetailComponent` class, a function, an HTML string — pass straight * through; the wrapper only adds the Vue form. */ export declare function adaptVueDetailRenderer(renderer: VueDetailRenderer): DetailRenderer; /** * Converts Vue-flavoured grid options into what the core accepts. Returns the * original object untouched when there is nothing Vue to adapt, so the common * case allocates nothing. */ export declare function adaptVueOptions(options: Partial): Partial;