把Execute动作的第一个参数中的id干掉了

This commit is contained in:
Xu Chang 2022-11-02 17:40:41 +08:00
parent 5361708764
commit 8b1c0a1b72
6 changed files with 6 additions and 6 deletions

View File

@ -198,7 +198,7 @@ export declare class RunningTree<ED extends EntityDict & BaseEntityDict, Cxt ext
getOperations(path: string): Promise<any[] | (ED[keyof ED]["Operation"] & {
entity: keyof ED;
})[] | undefined>;
execute(path: string, operation?: ED[keyof ED]['Operation']): Promise<any[] | (ED[keyof ED]["Operation"] & {
execute<T extends keyof ED>(path: string, operation?: Omit<ED[T]['Operation'], 'id'>): Promise<any[] | (ED[keyof ED]["Operation"] & {
entity: keyof ED;
})[]>;
clean(path: string): Promise<void>;

View File

@ -7,7 +7,7 @@ export declare function onPathSet<ED extends EntityDict & BaseEntityDict, T exte
export declare function reRender<ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends Context<ED>>(this: ComponentFullThisType<ED, T, Cxt>, option: OakComponentOption<ED, T, Cxt, any, any, any, any, any, {}, {}, {}>, extra?: Record<string, any>): Promise<void>;
export declare function refresh<ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends Context<ED>>(this: ComponentFullThisType<ED, T, Cxt>): Promise<void>;
export declare function loadMore<ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends Context<ED>>(this: ComponentFullThisType<ED, T, Cxt>): Promise<void>;
export declare function execute<ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends Context<ED>>(this: ComponentFullThisType<ED, T, Cxt>, operation?: ED[T]['Operation'], path?: string): Promise<any[] | (ED[keyof ED]["Operation"] & {
export declare function execute<ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends Context<ED>>(this: ComponentFullThisType<ED, T, Cxt>, operation?: Omit<ED[T]['Operation'], 'id'>, path?: string): Promise<any[] | (ED[keyof ED]["Operation"] & {
entity: keyof ED;
})[]>;
export declare function callPicker<ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends Context<ED>>(this: ComponentFullThisType<ED, T, Cxt>, attr: string, params?: Record<string, any>): void;

2
lib/types/Page.d.ts vendored
View File

@ -150,7 +150,7 @@ export declare type OakCommonComponentMethods<ED extends EntityDict & BaseEntity
cleanOperation: (path?: string) => void;
t(key: string, params?: object): string;
callPicker: (attr: string, params: Record<string, any>) => void;
execute: (operation?: ED[T]['Operation'], path?: string) => Promise<ED[T]['Operation'][]>;
execute: (operation?: Omit<ED[T]['Operation'], 'id'>, path?: string) => Promise<ED[T]['Operation'][]>;
checkOperation: (ntity: T, action: ED[T]['Action'], filter?: ED[T]['Update']['filter'], checkerTypes?: CheckerType[]) => Promise<boolean>;
tryExecute: (path?: string) => Promise<boolean>;
getOperations: (path?: string) => Promise<ED[T]['Operation'][] | undefined>;

View File

@ -2028,7 +2028,7 @@ export class RunningTree<
}
@Action
async execute(path: string, operation?: ED[keyof ED]['Operation']) {
async execute<T extends keyof ED>(path: string, operation?: Omit<ED[T]['Operation'], 'id'>) {
const node = this.findNode(path)!;
if (operation) {
assert(node instanceof ListNode || node instanceof SingleNode);

View File

@ -280,7 +280,7 @@ export async function execute<
T extends keyof ED,
Cxt extends Context<ED>>(
this: ComponentFullThisType<ED, T, Cxt>,
operation?: ED[T]['Operation'],
operation?: Omit<ED[T]['Operation'], 'id'>,
path?: string) {
if (this.state.oakExecuting) {
throw new Error('请仔细设计按钮状态,不要允许重复点击!');

View File

@ -252,7 +252,7 @@ export type OakCommonComponentMethods<
t(key: string, params?: object): string;
callPicker: (attr: string, params: Record<string, any>) => void;
execute: (operation?: ED[T]['Operation'], path?: string) => Promise<ED[T]['Operation'][]>;
execute: (operation?: Omit<ED[T]['Operation'], 'id'>, path?: string) => Promise<ED[T]['Operation'][]>;
checkOperation: (ntity: T, action: ED[T]['Action'], filter?: ED[T]['Update']['filter'], checkerTypes?: CheckerType[]) => Promise<boolean>;
tryExecute: (path?: string) => Promise<boolean>;
getOperations: (path?: string) => Promise<ED[T]['Operation'][] | undefined>;