@ohu-mobile/core
Version:
37 lines (36 loc) • 3.54 kB
TypeScript
import Vue from 'vue';
import type { RecordPropsDefinition, ThisTypedComponentOptionsWithRecordProps as ThisTypedComponentOptions } from 'vue/types/options';
import type { ComponentOptionsMixin } from 'vue/types/v3-component-options';
import { type _TsxComponentV3, type PropsForOutside, DeclareProps, RequiredPropNames, type InnerScopedSlots, type ScopedSlotHandlers } from 'vue-tsx-support';
import { BlockContext, CreateBemHelper } from './classHelper';
export { default as props } from 'vue-strict-prop';
export interface ComponentFactory<BaseProps, PrefixedEvents, Events, ScopedSlotArgs, Super extends Vue> {
create<Data, Methods, Computed, Props, SetupBindings, PropsDef extends RecordPropsDefinition<Props>, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin, RequiredProps extends keyof Props = RequiredPropNames<PropsDef> & keyof Props>(options: ThisTypedComponentOptions<Super & Vue & {
_tsx?: DeclareProps<PropsForOutside<Props, RequiredProps> & BaseProps>;
$scopedSlots?: ScopedSlotHandlers<InnerScopedSlots<ScopedSlotArgs>>;
}, Data, Methods, Computed, Props, SetupBindings, Mixin, Extends> & {
props?: PropsDef;
}, requiredPropsNames?: RequiredProps[]): _TsxComponentV3<Super & Data & Methods & Computed & Props, {}, PropsForOutside<Props, RequiredProps> & BaseProps, PrefixedEvents, Events, ScopedSlotArgs>;
mixin<Data, Methods, Computed, Props, SetupBindings, Mixin extends ComponentOptionsMixin, Extends extends ComponentOptionsMixin>(mixinObject: ThisTypedComponentOptions<Vue, Data, Methods, Computed, Props, SetupBindings, Mixin, Extends>): ComponentFactory<BaseProps & Props, PrefixedEvents, Events, ScopedSlotArgs, Super & Data & Methods & Computed & Props>;
mixin<VC extends typeof Vue>(mixinObject: VC): ComponentFactory<BaseProps, PrefixedEvents, Events, ScopedSlotArgs, Super & InstanceType<VC> & {
$scopedSlots: InnerScopedSlots<ScopedSlotArgs>;
}>;
}
export interface OhuComponentInnerProps {
$rootCls: () => BlockContext;
$bem: CreateBemHelper;
}
export declare function createOhuMixin(name: string): {
name: string;
computed: {
$bem(): CreateBemHelper;
$rootCls(): () => BlockContext;
};
};
export declare function defineComponent<TProps = {}, TEvents = {}, TScopedSlots = {}, TInnerProperties = {}, On = {}, Super extends Vue = Vue>(name: string): ComponentFactory<TProps, TEvents, On, TScopedSlots, Super & TInnerProperties & OhuComponentInnerProps>;
export declare function defineAncestorComponent<TProps = {}, TEvents = {}, TScopedSlots = {}, TInnerProperties = {}, Super extends Vue = Vue>(name: string): ComponentFactory<TProps, TEvents, Super, TScopedSlots, Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, any>> & TInnerProperties & OhuComponentInnerProps>;
export declare function defineDescendantComponent<Ancestor = typeof Vue, TProps = {}, TEvents = {}, TScopedSlots = {}, TInnerProperties = {}, Super extends Vue = Vue>(ancestorName: string, name: string): ComponentFactory<TProps, TEvents, Super, TScopedSlots, Vue<Record<string, any>, Record<string, any>, never, never, (event: string, ...args: any[]) => Vue<Record<string, any>, Record<string, any>, never, never, any>> & TInnerProperties & {
ancestor: Ancestor;
} & OhuComponentInnerProps>;
export declare const defineDsc: typeof defineDescendantComponent;
export declare const defineAnc: typeof defineAncestorComponent;