@j2inn/app-react
Version:
React implementation of the j2inn-app framework
69 lines (68 loc) • 1.99 kB
TypeScript
/// <reference types="react" />
import { App, AppEditorProps, AppRootStore, AppView } from '@j2inn/app';
import { HNamespace } from 'haystack-core';
/**
* Application view data.
*/
interface AppViewData {
/**
* The application.
*/
app: App;
/**
* The application view.
*/
view: AppView;
}
/**
* Filter function definition.
*/
interface FilterFunc {
/**
* Return true if the specified app and view should be used to remotely
* load an editor.
*
* If true is always returned then the first compatible editor found will be used.
*
* If false is always returned then the default haystack editor will always be used.
*/
(app: App, view: AppView): boolean;
}
/**
* Find an application and its associated for the specified tag name.
*
* This will use the defs namespace to look up any associated finUi and return
* its details.
*
* @param tag The name of the tag.
* @param namespace The defs namespace.
* @param rootStore The application root store.
* @return Application and view data or undefined if none can be found.
*/
export declare function findRemoteEditorAppView(tag: string, namespace: HNamespace, rootStore: AppRootStore, filter: FilterFunc): AppViewData | undefined;
/**
* The properties for a tag editor.
*/
export interface TagEditorProps extends AppEditorProps {
/**
* The name of the tag being displayed.
*/
tag: string;
/**
* An optional function that enables a caller to filter
* for a particular editor.
*/
filter?: FilterFunc;
/**
* An optional prop that can be passed to the editor component
* and used in a particular editor on need.
*/
[prop: string]: unknown;
}
/**
* An editor for editing a haystack value.
*
* @param props The tag editor properties.
*/
export declare const TagEditor: (props: TagEditorProps) => JSX.Element;
export {};