You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

91 lines
2.3 KiB

export declare type Constructor<T> = new (...args: any[]) => T;
/**
* 注册widget
*/
export declare function shortcut(): <U>(Target: Constructor<U> & {
xtype: string;
}) => void;
/**
* 注册provider
*/
export declare function provider(): <U>(Target: Constructor<U> & {
xtype: string;
}) => void;
/**
* 注册model
*/
export declare function model(): <U extends (new (...args: any[]) => {}) & {
xtype: string;
context?: readonly string[] | undefined;
}>(Target: U) => void;
/**
* 类注册_store属性
* @param Model model类
* @param opts 额外条件
*/
export declare function store<T>(Model: Constructor<T> & {
xtype: string;
}, opts?: {
props?(this: unknown): {
[key: string]: unknown;
};
}): <U extends new (...args: any[]) => {}>(constructor: U) => {
new (...args: any[]): {
_store(): any;
};
} & U;
/**
* 注册mixin
* ie8下不能使用
*/
export declare function mixin<T>(): (Target: Constructor<T> & {
xtype: string;
}) => void;
/**
* 类注册mixins属性
* ie8下不能使用
* @param Mixins
*/
export declare function mixins(...Mixins: ({
new (...args: any[]): {};
} & {
xtype: string;
})[]): <U extends new (...args: any[]) => {}>(constructor: U) => {
new (...args: any[]): {
mixins: string[];
};
} & U;
/**
* Model基类
*/
export declare class Model<U extends {
types?: {
[key: string]: unknown;
} | {};
context?: ReadonlyArray<string>;
} = {}> extends Fix.Model {
model: Pick<{
[key in keyof U["types"]]: U["types"][key];
}, U["context"][number]> & {
[key in keyof ReturnType<this["state"]>]: ReturnType<this["state"]>[key];
} & {
[key in keyof this["computed"]]: ReturnType<this["computed"][key]>;
};
store: this["actions"];
state(): {
[key: string]: unknown;
} | {};
context: U["context"];
actions: {
[key: string]: (...args: any[]) => any;
};
childContext: ReadonlyArray<keyof (this["computed"] & ReturnType<this["state"]>)>;
TYPE: Pick<{
[key in keyof this["computed"]]: ReturnType<this["computed"][key]>;
} & {
[key in keyof ReturnType<this["state"]>]: ReturnType<this["state"]>[key];
}, this["childContext"][number]>;
computed: {
[key: string]: () => unknown;
} | {};
}