import { type EntityBody, type IViewProps, ListVM, ObjectVM, type RuntimeModel } from '@oinone/kunlun-engine'; import { LifeCycleTypes, type ViewEventName } from '@oinone/kunlun-event'; import { type Entity, type IDslNode, type IModel, type IView, ViewElement, type ViewId, ViewType } from '@oinone/kunlun-meta'; import { type Matched } from '@oinone/kunlun-router'; import type { Constructor } from '@oinone/kunlun-shared'; import { type SPIOptions, type SPISingleSelector, type SPITokenFactory } from '@oinone/kunlun-spi'; import { DslNodeWidget } from '../dsl/DslNodeWidget'; export interface IViewFilterOptions extends SPIOptions { id?: ViewId[] | ViewId; name?: string[] | string; type?: ViewType[] | ViewType; model?: string[] | string; widget?: string[] | string; tagName?: string[] | string; } type WatchCb = (value: T, oldValue: T) => void; export declare abstract class ViewWidget extends DslNodeWidget { static Token: SPITokenFactory; static Selector: SPISingleSelector>; protected loading: boolean; protected currentRoute: Matched; rootData: EntityBody; private subjectRoute$; private $$vm; getVM(): VM; setVM($$vm: VM): void; /** * 设置loading */ setBusy(busy: boolean): void; /** * 获取url参数 * * @returns {Record} */ getUrlParams(): any; /** * 获取当前是否处于loading状态 */ getBusy(): boolean; initialize(props: VP): this; protected domain: string; private filter; private parentRootHandlerStr; private currentRootHandlerStr; private get rootHandleStr(); isRootView: boolean; /** * 监听视图的事件 * @param event 事件名 / 事件对象 * @param handler? 回调函数 * * @example * * 单个事件监听 * viewWidget.on('change', (fieldInstance) => {}) * viewWidget.on('blur', (fieldInstance) => {}) */ on(event: { [key in ViewEventName]?: (view: V) => void; }): void; /** * 多个事件监听 * * @example * * viewWidget.on({ * change(fieldInstance) => {}, * blur(fieldInstance) => {}, * }) */ on(event: ViewEventName, handler: (view: V) => void): void; /** * 用来监听视图数据的的变化 * * @param {(value, oldValue):void} cb 监听数据发生变化的回调函数 * @param {object} options 可配置选项 * watchKey -> 当key对应的value发生变化后,才会触发回调用函数 * "如果要监听的数据是对象,那么该参数不会生效" * distinct -> 是否去重(当上一个值跟当前的值相当的时候,就不会处理) * * @example * const widget = this.createWidget(FormWidget, undefined, {....}) * widget.watch((value) => {....}) * */ watch(cb: WatchCb): any; watch(cb: WatchCb, options: { watchKey?: string; distinct?: boolean; }): any; watch(cb: WatchCb, options: { watchKey?: string[]; distinct?: boolean; }): any; /** * 如果没有key,就不做任何处理 * 如果key不是字符串类型,也不是数组类型,那么不做任何处理 */ protected filterWatchData(pre: ViewData, next: ViewData, key: string | string[]): boolean; isDialogView: boolean; /** * 当前的widget是不是更节点 */ get isRoot(): boolean; get useConstruct(): boolean; private selfHandleStr; view: IView; protected model: RuntimeModel | null; protected type: 'FORM' | 'TABLE' | 'UNKNOWN'; /** * 页面默认的参数, A页面跳转到B页面,期望能带入参数过去 */ protected initQueryParams: Record | null; get viewElement(): ViewElement | any; protected resolveTemplate(): void; fetchData(data?: Entity[], options?: any, variables?: Record): unknown; onRowsChange(data: any[]): void; loadData(data: ViewData, reset?: boolean): unknown; /** * 加载`rootData` 数据 */ loadRootData(content: any): void; setRootDataByKey(key: string, value: any): void; submit(): unknown; getData(): ViewData; setData(content: ViewData): void; validator(): Promise; /** * 加载元数据,允许被重写 * * @param {IModel} model 模型 * @param {IDslNode} dslNode? dslNode,如果不传入,会自动创建 * @param {IView} view? 视图,如果不传入,会自动创建 * @param {ViewType} viewType? 指定视图类型 */ loadMetadata(model: IModel, dslNode?: IDslNode, view?: IView, viewType?: ViewType): void; getActiveRecords(): Entity[]; setDomain(domain: string): void; getDomain(): string; setFilter(f: string): void; getFilter(): string; getModel(): IModel; getView(): IView; path: string; getPath(): string; notify(type: LifeCycleTypes): void; $$beforeCreated(): void; $$created(): void; $$beforeMount(): void; $$mounted(): void; $$beforeUpdate(): void; $$updated(): void; $$beforeUnmount(): void; $$unmounted(): void; } /** * @deprecated 移动端未修改,必须移除该定义 */ export declare const ViewSubSymbol: unique symbol; export {};