import { ExtractPropTypes, PropType, Ref, UnwrapRef, VNode, WatchOptions, getCurrentInstance } from "vue-demi"; //#region \0rolldown/runtime.js //#endregion //#region use/constant.d.ts type Events = { /** * 重置事件 * @param {string} type 监听事件类型 * @param {(...args: any[]) => (() => void | any)} callback 事件逻辑执行前触发, 可返回一个函数在逻辑执行后执行 * @return {() => void} 返回一个移除监听的函数 */ reset: () => ((() => void) | void); }; type EventsWithInstance = { /** * 监听指定类型事件 * @param {ReturnType} instance vue 实例 * @param {string} type 监听事件类型 * @param {(...args: any[]) => (() => void | any)} fn 事件逻辑执行前触发, 可返回一个函数在逻辑执行后执行 * @return {() => void} 返回一个移除监听的函数 */ on: (instance: ReturnType, type: K, fn: Events[K]) => () => void; /** * 移除指定类型事件 * @param {ReturnType} instance vue 实例 * @param {string} type 监听事件类型 * @param {(...args: any[]) => any} [fn] 监听事件回调函数 */ off: (instance: ReturnType, type: K, fn?: Events[K]) => void; /** * 移除所有事件 * @param {ReturnType} instance vue 实例 */ clear: (instance: ReturnType) => void; }; type EventsWithoutInstance = { [K in keyof T]: T[K] extends ((_: any, ...args: infer P) => infer R) ? (...args: P) => R : never }; /** 判断是否是 2.7.* 版本, 监听生命周期需对该版本做处理 */ declare const IS_COMPOSITION_VERSION: boolean; /** 容器注入的 key */ declare const provideKey = "json-form-wrapper"; /** 容器注入值的类型 */ interface ProvideValue = Record, Options extends Record = Record, FormInstance = any> { /** 表单是否只读 */ readonly?: Ref; /** 表单是否禁用 */ disabled?: Ref; /** * 是否实时触发 */ realtime: Ref; /** 表单实例 */ formRef: FormInstance; /** * 子组件需主动注册组件, 否则不会生效 * @param {CommonMethod} config 提供父组件校验, 重置等方法 * * @returns {() => void} 取消注册 - 默认会自动取消, 如果是异步任务内注册, 需自己手动取消 */ register: (config: CommonMethod) => () => void; /** 子组件更新 query 前调用函数(内部方法, 外部请勿调用, 随时可能会调整) */ beforeUpdateQueryValue: () => void; /** 子组件更新 query 后调用函数(内部方法, 外部请勿调用, 随时可能会调整) */ afterUpdateQueryValue: () => void; /** * 提供给组件内部的直接触发到外部的搜索事件 */ search: () => Promise | string | void; /** 重置表单 */ reset: (target?: Record) => void; /** 所有条件的 options 数据 */ options: Options; /** 事件监听 - 需传 vue 实例 */ emitterWithInstance: EventsWithInstance; /** 事件监听, 组件卸载时自动移除相关事件 - 无需传 vue 实例 */ emitter: EventsWithoutInstance; } /** 获取容器注入的值 */ declare function getProvideValue = Record, Options extends Record = Record, FormInstance = any>(): ProvideValue | undefined; declare function defineProvideValue(option: T): T; /** 子组件需暴露出来的公共属性 */ interface CommonMethod { /** 当前条件项的字段 */ field?: string; /** 重置 */ reset: (query?: Record) => void; /** 校验方法 */ validator?: (query: Record) => Promise | any; /** 在 watch 中 backfill 改变后, 需要执行回调 */ onBackfillChange?: (backfill: Record, oldBackfill: Record, isChange: boolean) => void; /** model 引用发生变化后, 需要执行的回调 */ onModelChange?: (model: Record, oldModel: Record | undefined) => void; /** 尝试设置默认值 */ trySetDefaultValue: (query: Record) => boolean; } declare function defineCommonMethod(option: T): T; //#endregion //#region use/assist.d.ts type Tail = T extends [infer _, ...infer Rest] ? Rest : T; /** * 转换当前事件循环内更新标识 * @param {boolean} initialValue 初始状态 */ declare function useFlag(initialValue?: boolean): { flag: Ref; updateFlag: () => void; }; /** 对赋值进行处理 - 防止 vue2 对新增属性不响应 */ declare function vueSet(initial: T, path: string, value: K): void; /** * 事件包装器 */ declare function useCreateEmitter any>>(): { on: (instance: ReturnType, type: K, fn: Events[K]) => () => void; off: (instance: ReturnType, type: K, fn?: Events[K]) => void; emit: (type: K, ...args: Parameters) => ReturnType[]; clear: (instance?: ReturnType) => void; }; /** * 包装监听事件, 在 cb 执行时, 将 vue 实例作为首参传入 * @param {Function} cb 监听的回调事件 * @return {Function} */ declare function useWithCurrentInstance, ...args: any[]) => any>(cb: T): (...args: Tail>) => ReturnType; /** * 通用的事件处理方法 * @param {object} wrapper 实例 */ declare function useEmitter(wrapper: T | undefined): { /** 监听事件 - 将事件绑定到当前组件的生命周期上 */on: (type: "reset", fn: () => ((() => void) | void)) => () => void; /** 解除监听事件 - 将事件绑定到当前组件的生命周期上 */ off: (type: "reset", fn?: (() => ((() => void) | void)) | undefined) => void; /** 删除所有的监听事件 - 将事件绑定到当前组件的生命周期上 */ clear: () => void; }; //#endregion //#region ../../node_modules/.pnpm/utility-types@3.11.0/node_modules/utility-types/dist/mapped-types.d.ts /** * UnionToIntersection * @desc Get intersection type given union type `U` * Credit: jcalz * @see https://stackoverflow.com/a/50375286/7381355 * @example * // Expect: { name: string } & { age: number } & { visible: boolean } * UnionToIntersection<{ name: string } | { age: number } | { visible: boolean }> */ declare type UnionToIntersection = (U extends any ? (k: U) => void : never) extends ((k: infer I) => void) ? I : never; //#endregion //#region utils/base.d.ts /** * 将 emits 转为 props * @param {object | undefined | null} props 待合并的 props * @param {(string[] | object | null)[]} emits 待转换的 emits * @tip * props 尽量用 as const, 防止内部的 required 选项无法被识别 * 当 emits 为数组时, 需要用 as const, 否则无法识别出事件名称 * * @example * ```ts * const typeDef = { type: Function }; * emits = { click: noop, dataChange: noop }; // return { onClick: typeDef, onDataChange: typeDef } * emits = ['click', 'data-change']; // return { onClick: typeDef, onDataChange: typeDef } * ``` */ declare function emits2props | undefined | null, E extends (string[] | Record | null | undefined)[]>(props: T, ...emits: E): (T extends null | undefined ? {} : T) & UnionToIntersection extends infer T_1 ? T_1 extends NonNullable ? T_1 extends string[] ? Record, PropType<(...args: any[]) => void>> : { [P in keyof T_1 as CamelCase<`on-${string & P}`>]: T_1 extends Partial any>> ? { type: PropType<(...args: Parameters>) => void>; } : never } : never : never>>; type Emits2Props = UnionToIntersection, PropType<(...args: any[]) => void>> : { [P in keyof T as CamelCase<`on-${string & P}`>]: T extends Partial any>> ? { type: PropType<(...args: Parameters>) => void>; } : never }>; /** * 将数组类型 emits 转为对象 * @param {(string[] | object | null)[]} emits 待转换的 emits * @tip * 当 emits 为数组时, 需要用 as const, 否则无法识别出事件名称 * * @example * ```ts * emits = { click: noop, dataChange: noop }; // return { click: noop, dataChange: noop } * emits = ['click', 'data-change']; // return { click: noop, dataChange: noop } * ``` */ declare function emits2obj | null | undefined), R = (E extends string[] ? { [P in E[number] as CamelCase]: () => true } : E extends null | undefined ? {} : E)>(emits: E): ExtractEvents; /** * 由于高版本 vue 对类型进行了调整 * 因此抽取一个变量来提取组件中暴露的事件 * ```typescript * // 高版本类型定义 * type emits = (E | EE[]) & ThisType; * // 经过 emits2obj 函数处理但未经改方法调整提取出来的结果 * type Result1 = * | {} * | ({ * '事件1': (...args: any[]) => void; * '事件2': (...args: any[]) => void; * } & ThisType<...>) * | { * [x: string]: () => true * } * type Result2 = {} | Record<'事件1' | '事件2', () => true>; * type Result3 = {} | (Record & ThisType) | { [x: string]: () => true; } * * // 经过改方法调整提取出来的结果 * type Result1 = Record<'事件1' | '事件2', (...args: any) => void> & ThisType<...>; * type Result2 = Record<'事件1' | '事件2', () => true>; * type Result3 = Partial & ThisType & { [x: string]: () => true; }>; * ``` */ type ExtractEvents = UnionToIntersection extends never ? U : Exclude : U>; type FuncNoopType = Record true>; /** 转为小驼峰 */ type CamelCase = T extends `${infer A}-${infer B}` ? CamelCase<`${A}${Capitalize}`> : T; /** 转为 - 连接 */ type Hyphenate = S extends `${infer First}${infer Rest}` ? `${Lowercase}${Rest extends Uncapitalize ? Hyphenate : `-${Hyphenate>}`}` : S; /** 将对象转为 vue props */ type Obj2Props = { [K in keyof T]-?: { type: PropType>; validator: undefined; } }; //#endregion //#region utils/index.d.ts /** 空函数 */ declare function noop(): void; /** 获取类型 */ declare function getType(value: any): string; /** 是否是数组 */ declare function isArray(value: any): value is any[]; /** 是否是纯对象 */ declare function isPlainObject(value: any): value is Record; /** * 空值转为提供的默认值 * @param {*} val 值为空时转为默认值 * @param {*} defaultVal */ declare function emptyToValue(val: any, defaultVal: T): any; /** 判断是否不是空值(null, undefined, '') */ declare function isNotEmptyValue(val: any): boolean; /** 判断是否是空值(null, undefined, '') */ declare function isEmptyValue(val: any): boolean; /** 判断两个值是否一致 */ declare function isEqual(x: any, y: any): boolean; /** 判断是否是原始类型(number , string , boolean , symbol, bigint, undefined, null) */ declare function isPrimitive(value: any): boolean; /** 拷贝 */ declare function clone(obj: T, deep?: boolean): T; /** * 获取指定层级的父级(包括自身) * @param {Record[]} data 数据源 * @param {(item) => boolean} cb 当前数据项是否匹配 */ declare function getChained>(data: T[], cb: (item: T) => boolean, childrenKey?: string): T[]; /** * 获取渲染节点 * @param {string | number | object | Function} node 需渲染元素 */ declare function getNode(node: string | number | Record | ((...args: any[]) => VNode) | undefined | null): {}; /** * 判断对象是否存在指定属性 * @example hasOwn({}, 'a') */ declare function hasOwn, K extends keyof T = keyof T>(obj: T, key: K): boolean; /** 将驼峰转为 - 连接 */ declare const hyphenate: (str: T) => Hyphenate; /** * 版本比较, 比较两个语义化版本号(支持预发布标签: alpha/beta/rc 等; 支持 `v` 前缀) * @param {string} version1 待比较版本1 * @param {string} version2 待比较版本2 * @returns {number} 比较结果: -1 表示 version1 < version2, 0 表示相等, 1 表示 version1 > version2 * @example * ```ts * compareVersion('1.1.0-beta.16', '1.1.0') // -1 * compareVersion('2.10.7', '2.9.9') // 1 * compareVersion('v1.0.0', '1.0.0') // 0 * ``` */ declare function compareVersion(version1: string, version2: string): number; /** * 检查版本是否满足条件 * @param {string} currentVersion 当前版本 * @param {string} requiredVersion 要求的版本 * @param {string} operator 比较操作符 ('>=', '>', '<=', '<', '=', '==') */ declare function checkVersion(currentVersion: string, requiredVersion: string, operator: '>=' | '>' | '<=' | '<' | '=' | '=='): boolean; /** * 根据字符串路径获取值 * * @example get(person, 'friends[0].name') */ declare function get(value: any, path: string, defaultValue?: TDefault): TDefault; /** * 根据字符串路径设置值 * * @example * set({}, 'name', 'ra') // => { name: 'ra' } * set({}, 'cards[0].value', 2) // => { cards: [{ value: 2 }] } */ declare function set(initial: T, path: string, value: K, assign?: (obj: Record, key: string, value: any) => void): void; //#endregion //#region use/plain/types.d.ts /** 组件额外的钩子选项 */ interface HookOption, OptionQuery extends Record> { /** 组件创建前触发的钩子, 可在内部监听生命周期, 获取实例, 以及操作该组件内的各种属性 */ created?: (option: { props: Record; plain: ReturnType>; wrapper: ProvideValue | undefined; } & EventsWithoutInstance) => void; /** 依赖项发生变化时触发 - 语法糖钩子, 可通过 create 钩子监听指定数据源(watch(() => option.props.query[field], callback)) */ dependChange?: (option: { props: Record; plain: ReturnType>; }) => void; /** 依赖项数据源发生变动时触发 - 语法糖钩子, 可通过 create 钩子监听指定数据源(watch(() => option.plain.wrapper.options[field], callback)) */ optionsDependChange?: (option: { props: Record; plain: ReturnType>; }) => void; /** 回填对象发生改变时触发(由外部触发才会发生改变, 内部搜索然后默认同步时, 不触发该事件) */ backfillChange?: (backfill: Record, oldBackfill: Record, option: { props: Record; plain: ReturnType>; }) => void; } /** 扁平条件类 props - 泛型 */ declare function plainPropsGeneric, OptionQuery extends Record = Record>(): { /** 提交的字段 */readonly field: { readonly type: PropType; readonly required: true; }; /** 字段集(多选时, 每个下标对应的字段可能不一样) */ readonly fields: { readonly type: PropType; }; /** 当前条件对象 */ readonly query: { readonly type: PropType; readonly required: true; }; /** * 该配置项根据 query[field] 的值动态生成时, 传递的属性((内部处理, 外部无需传递)) * 应用场景, 比如表单通过 query[field].splice(0, 1) 删除时, 由于卸载会重置字段 * 但是根据引用会找到 query[field][1] 的值, 导致操作错误的对象 */ readonly parentQuery: { readonly type: PropType>; }; /** 是否依赖其它字段 */ readonly depend: { readonly type: PropType; readonly default: undefined; }; /** 依赖字段发生变化后是否重置值 */ readonly resetByDependValueChange: { readonly type: PropType boolean)>; readonly default: true; }; /** 依赖字段 */ readonly dependFields: { readonly type: PropType; }; /** 依赖字段监听选项 */ readonly dependWatchOption: { readonly type: PropType; }; /** 是否依赖其它字段的数据源 - 数据发生变动时触发 getOptions */ readonly optionsDepend: { readonly type: PropType; }; /** 数据源依赖字段 - 不传取 dependFields */ readonly optionsDependFields: { readonly type: PropType; }; /** 校验函数, 返回字符串不通过, 会触发提示 - 提交时触发 */ readonly validator: { readonly type: PropType<(query: Query) => any | Promise>; }; /** 初始值 - 初始或重置时设置的值, 优先级高于 defaultValue(重置时取该字段, 依赖变化后的重置默认值), 可被清空 */ readonly initialValue: { readonly type: PropType<((option: { query: Query; }) => any) | any>; readonly default: undefined; }; /** 默认值 - 初始或重置时设置的值, 当对应字段的值为空值时, 会用该值替换 */ readonly defaultValue: { readonly type: PropType<((option: { query: Query; }) => any) | any>; readonly default: undefined; }; /** 重置时当前值与默认值/初始值相同时, 自定义赋值逻辑(默认不改变) */ readonly defaultValueConflictCallback: { readonly type: PropType<(value: any, checked: Ref) => void>; readonly default: typeof noop; }; /** 数据源 */ readonly options: { readonly type: PropType; readonly default: () => never[]; }; /** 动态获取数据源 */ readonly getOptions: { readonly type: PropType>; }; /** * 如果是组件是存在于数组中的, 需要传递一个唯一值(内部处理, 外部无需传递) * 防止依赖本数组其它下标中的值时, 如果前一项被删除, 导致依赖误触发 */ readonly uniqueValue: { readonly type: PropType; }; /** 组件额外的钩子() */ readonly hooks: { readonly type: PropType>; readonly default: undefined; }; }; /** 扁平条件类 props */ declare const plainProps: { /** 提交的字段 */readonly field: { readonly type: PropType; readonly required: true; }; /** 字段集(多选时, 每个下标对应的字段可能不一样) */ readonly fields: { readonly type: PropType; }; /** 当前条件对象 */ readonly query: { readonly type: PropType>; readonly required: true; }; /** * 该配置项根据 query[field] 的值动态生成时, 传递的属性((内部处理, 外部无需传递)) * 应用场景, 比如表单通过 query[field].splice(0, 1) 删除时, 由于卸载会重置字段 * 但是根据引用会找到 query[field][1] 的值, 导致操作错误的对象 */ readonly parentQuery: { readonly type: PropType>; }; /** 是否依赖其它字段 */ readonly depend: { readonly type: PropType; readonly default: undefined; }; /** 依赖字段发生变化后是否重置值 */ readonly resetByDependValueChange: { readonly type: PropType) => boolean)>; readonly default: true; }; /** 依赖字段 */ readonly dependFields: { readonly type: PropType; }; /** 依赖字段监听选项 */ readonly dependWatchOption: { readonly type: PropType; }; /** 是否依赖其它字段的数据源 - 数据发生变动时触发 getOptions */ readonly optionsDepend: { readonly type: PropType; }; /** 数据源依赖字段 - 不传取 dependFields */ readonly optionsDependFields: { readonly type: PropType; }; /** 校验函数, 返回字符串不通过, 会触发提示 - 提交时触发 */ readonly validator: { readonly type: PropType<(query: Record) => any | Promise>; }; /** 初始值 - 初始或重置时设置的值, 优先级高于 defaultValue(重置时取该字段, 依赖变化后的重置默认值), 可被清空 */ readonly initialValue: { readonly type: PropType<((option: { query: Query; }) => any) | any>; readonly default: undefined; }; /** 默认值 - 初始或重置时设置的值, 当对应字段的值为空值时, 会用该值替换 */ readonly defaultValue: { readonly type: PropType<((option: { query: Query; }) => any) | any>; readonly default: undefined; }; /** 重置时当前值与默认值/初始值相同时, 自定义赋值逻辑(默认不改变) */ readonly defaultValueConflictCallback: { readonly type: PropType<(value: any, checked: Ref) => void>; readonly default: typeof noop; }; /** 数据源 */ readonly options: { readonly type: PropType; readonly default: () => never[]; }; /** 动态获取数据源 */ readonly getOptions: { readonly type: PropType, Record>>; }; /** * 如果是组件是存在于数组中的, 需要传递一个唯一值(内部处理, 外部无需传递) * 防止依赖本数组其它下标中的值时, 如果前一项被删除, 导致依赖误触发 */ readonly uniqueValue: { readonly type: PropType; }; /** 组件额外的钩子() */ readonly hooks: { readonly type: PropType, Record>>; readonly default: undefined; }; }; /** 扁平条件类 props */ type PlainProps, OptionQuery extends Record = Record> = OmitFieldRequired>>; /** 取消 field 的必填声明(暴露给用户是可选的, 框架层才是必填的, 防止框架层改动过大, 故在此调整) */ type OmitFieldRequired = { [K in keyof T]: K extends 'field' ? Omit : T[K] }; /** 当新的赋值与当前值相等时异步赋值 */ declare function defaultValueConflictCallback(checked: Ref, value: any): void; /** 获取远程数据源 */ interface GetOptions, OptionQuery extends Record> { (/** 数据执行后的回调 */ cb: (data: any) => void, /** 当前 query 对象 */ query: Query, /** 额外的配置项 */ option: TriggerOption): any; } /** 改变当前条件值触发方式 */ interface TriggerOption, OptionQuery extends Record> { /** * 触发来源 * @enum {('initial'|'depend'|'other')} initial(初始化), depend(依赖项改变) */ trigger: string; /** 用于下拉框等存在筛选值的组件 */ filterValue?: string; /** * 所有条件的数据源 * @enum {Record[]>} */ options: OptionQuery; /** 仅更改默认值 */ changeDefaultValue: (value: any) => this; /** 仅更改初始值 */ changeInitialValue: (value: any) => this; /** * 仅改变内部的值, 不触发搜索事件 * @param {*} value 需改变的值 * @param {object} [option] * @param {boolean} [option.updateInitialValue] 是否将该值设为初始值 * @param {boolean} [option.updateDefaultValue] 是否将该值设为默认值 */ change: (value: any, option?: Partial>) => this; /** * 触发搜索事件 * @param {*} value 需改变的值 * @param {object} [option] * @param {boolean} [option.updateInitialValue] 是否将该值设为初始值 * @param {boolean} [option.updateDefaultValue] 是否将该值设为默认值 */ search: (value: any, option?: Partial>) => this; [index: string]: any; } //#endregion //#region use/plain/index.d.ts /** 外部需传递的 props */ type _PlainProps, OptionQuery extends Record> = ExtractPropTypes>; type MaybeRef = T | Ref; /** 封装扁平组件必备的信息 */ declare function usePlain = Record, OptionQuery extends Record = Record>(props: MaybeRef<_PlainProps>): { on: (type: "reset", fn: () => ((() => void) | void)) => () => void; off: (type: "reset", fn?: (() => ((() => void) | void)) | undefined) => void; clear: () => void; /** 覆盖 props 的最新的值(defaultValue, initialValue) */ coverProps: Ref<{ initialValue: any; defaultValue: any; }, Record<"initialValue" | "defaultValue", any> | { initialValue: any; defaultValue: any; }>; /** * 内部表单实例, 包含了更新表单值, 触发搜索事件等方法 */ wrapper: ProvideValue, Record, any> | undefined; /** * 表单项实例, 包含了重置, 更新表单值, 获取表单值等方法 */ option: { readonly field: string | undefined; reset(this: void, query?: Record): void; readonly validator: any; onBackfillChange: (backfill: Record, oldBackfill: Record, isChange: boolean) => void; onModelChange: (model: Record, oldModel: Record | undefined) => void; trySetDefaultValue(_query: Record): boolean; }; /** 数据源获取状态 */ loading: Ref; /** 主动更新数据源 */ getOptions: (trigger: "initial" | "depend" | "other", option?: { filterValue?: string; callback?: (data: any[]) => void; }) => Promise; /** 当前表单项的值 */ checked: import("vue").WritableComputedRef; /** 远程获取的数据源 */ remoteOption: Ref; /** 获取最终渲染的数据源 */ finalOption: import("vue").ComputedRef; /** 更新值并触发搜索事件(为实时搜索时, 会触发搜索事件) */ change: (value: any) => void; /** 搜索事件(直接触发搜索事件, 不受实时搜索影响) */ search: typeof noop; /** 重置表单字段 */ reset: (this: void, query?: Record) => void; /** 表单级别的只读 */ globalReadonly: Ref; /** 表单级别的禁用 */ globalDisabled: Ref; }; //#endregion //#region use/wrapper/types.d.ts interface onBackfillChange { (backfill: Record, oldBackfill: Record, expose: ReturnType): void; } type WrapperArrayable = T | T[]; /** 容器类 props - 泛型 */ declare function wrapperPropsGeneric(): { /** 是否在数据发生变动后实时触发搜索事件 - 仅针对 backfill, model 不生效 */readonly realtime: { readonly type: PropType; readonly default: undefined; }; /** 回填信息 */ readonly backfill: { readonly type: PropType>; }; /** 回填信息发生变化时触发(由外部触发才会发生改变, 内部搜索然后默认同步时, 不触发该事件) - 仅针对 backfill, model 不生效 */ readonly onBackfillChange: { readonly type: PropType>; }; /** 表单形式的没必要用 backfill, 直接用 model 同步即可 */ readonly model: { readonly type: PropType>; }; /** * 是否浅监听 model, 当外部会通过 Object.assign(query.value, { 字段1, 字段2 }) 这种批量赋值时 * 可启用此属性来规避 depend 重置 */ readonly shallowWatchModel: { readonly type: PropType; readonly default: undefined; }; /** 自定义校验函数(内部校验通过后会触发此函数) */ readonly validator: { readonly type: PropType<(query: Record) => any | Promise>; readonly default: undefined; }; /** 校验失败时产生的提示 */ readonly toast: { readonly type: PropType<(msg: string) => void>; readonly default: undefined; }; /** 表单是否只读(元素没有只读属性的直接禁用) */ readonly readonly: { readonly type: PropType; readonly default: undefined; }; /** 表单是否禁用 */ readonly disabled: { readonly type: PropType; readonly default: undefined; }; /** 搜索事件, 触发内部 query 对象更新 - 仅针对 backfill, model 不会触发 */ readonly onSearch: { readonly type: PropType) => void>>; }; }; /** 容器类 props */ declare const wrapperProps: { /** 是否在数据发生变动后实时触发搜索事件 - 仅针对 backfill, model 不生效 */readonly realtime: { readonly type: PropType; readonly default: undefined; }; /** 回填信息 */ readonly backfill: { readonly type: PropType>; }; /** 回填信息发生变化时触发(由外部触发才会发生改变, 内部搜索然后默认同步时, 不触发该事件) - 仅针对 backfill, model 不生效 */ readonly onBackfillChange: { readonly type: PropType>; }; /** 表单形式的没必要用 backfill, 直接用 model 同步即可 */ readonly model: { readonly type: PropType>; }; /** * 是否浅监听 model, 当外部会通过 Object.assign(query.value, { 字段1, 字段2 }) 这种批量赋值时 * 可启用此属性来规避 depend 重置 */ readonly shallowWatchModel: { readonly type: PropType; readonly default: undefined; }; /** 自定义校验函数(内部校验通过后会触发此函数) */ readonly validator: { readonly type: PropType<(query: Record) => any | Promise>; readonly default: undefined; }; /** 校验失败时产生的提示 */ readonly toast: { readonly type: PropType<(msg: string) => void>; readonly default: undefined; }; /** 表单是否只读(元素没有只读属性的直接禁用) */ readonly readonly: { readonly type: PropType; readonly default: undefined; }; /** 表单是否禁用 */ readonly disabled: { readonly type: PropType; readonly default: undefined; }; /** 搜索事件, 触发内部 query 对象更新 - 仅针对 backfill, model 不会触发 */ readonly onSearch: { readonly type: PropType) => void>>; }; }; type WrapperProps = ReturnType; //#endregion //#region use/wrapper/index.d.ts /** 外部需传递的 props */ type WrapperProps$2 = ExtractPropTypes; /** 用来给 v2 版本做兼容 */ interface Config { formRef?: T; /** model 的字段 */ modelField?: string; /** backfill 发生变化后的回调 */ onBackfillChange?: (backfill: Record, oldBackfill: Record, expose: ReturnType) => void; /** 搜索回调 */ onSearch?: (query: Record) => void; } /** 封装 wrapper 组件必备的信息(config 用来给 v2版本做兼容) */ declare function useWrapper(props: WrapperProps$2, config?: Config): { child: CommonMethod[]; wrapperInstance: { readonly: import("vue").Ref; disabled: import("vue").Ref; realtime: import("vue").Ref; formRef: T | undefined; reset: (target?: Record) => void; register(compOption: CommonMethod): () => void; beforeUpdateQueryValue(): void; afterUpdateQueryValue(): void; search: () => Promise; options: Record; emitterWithInstance: { on: (instance: ReturnType, type: K, fn: Events[K]) => () => void; off: (instance: ReturnType, type: K, fn?: Events[K] | undefined) => void; emit: (type: K, ...args: Parameters) => ReturnType[]; clear: (instance?: ReturnType) => void; }; emitter: { on: (type: "reset", fn: () => ((() => void) | void)) => () => void; off: (type: "reset", fn?: (() => ((() => void) | void)) | undefined) => void; clear: () => void; }; }; query: import("vue").Ref, Record>; getQuery: () => { [x: string]: string; }; search: () => Promise; reset: (target?: Record) => void; validateToast: () => Promise | any; }; /** * 执行 on 相关的回调事件 * @param {Function} events 待执行的回调 * @param {any[]} args 传递的参数 */ declare function execOnCallback any>(events: undefined | T | T[], ...args: Parameters): any; declare namespace interface_d_exports { export { BuiltInField, Merge, OmitDefaultKey, PlainProps$1 as PlainProps, ToRaw, WrapperProps$1 as WrapperProps }; } type BuiltInField = 'query' | 'uniqueValue' | 'parentQuery'; /** 获取实际值(去除 ref 引用) */ type ToRaw = UnwrapRef; interface WrapperProps$1 extends Omit>, BuiltInField> {} /** */ interface PlainProps$1, Option, OptionQuery extends Record> extends Omit>>, BuiltInField> {} type OmitDefaultKey = T extends Record ? { [K in keyof T]: T[K] extends { default: any; } ? Omit : T[K] } : T; /** 交叉类型合并为一个对象 */ type Merge> = { [K in keyof T]: T[K] } & {}; //#endregion //#region version.d.ts /** 版本号 */ declare const version = "0.2.8"; //#endregion export { CamelCase, CommonMethod, interface_d_exports as CoreOption, Emits2Props, Events, EventsWithInstance, EventsWithoutInstance, ExtractEvents, FuncNoopType, GetOptions, HookOption, Hyphenate, IS_COMPOSITION_VERSION, Obj2Props, OmitFieldRequired, PlainProps, ProvideValue, Tail, TriggerOption, WrapperArrayable, WrapperProps, checkVersion, clone, compareVersion, defaultValueConflictCallback, defineCommonMethod, defineProvideValue, emits2obj, emits2props, emptyToValue, execOnCallback, get, getChained, getNode, getProvideValue, getType, hasOwn, hyphenate, isArray, isEmptyValue, isEqual, isNotEmptyValue, isPlainObject, isPrimitive, noop, onBackfillChange, plainProps, plainPropsGeneric, provideKey, set, useCreateEmitter, useEmitter, useFlag, usePlain, useWithCurrentInstance, useWrapper, version, vueSet, wrapperProps, wrapperPropsGeneric };