增加了store的obscure选项
This commit is contained in:
parent
b5bab4b536
commit
99104d9e58
|
|
@ -7,9 +7,9 @@ export declare abstract class CascadeStore<ED extends {
|
|||
[E: string]: EntityDef;
|
||||
}> extends RowStore<ED> {
|
||||
constructor(storageSchema: StorageSchema<ED>);
|
||||
protected abstract selectAbjointRow<T extends keyof ED>(entity: T, selection: Omit<ED[T]['Selection'], 'indexFrom' | 'count' | 'data' | 'sorter'>, context: Context<ED>, params?: Object): Promise<Array<ED[T]['OpSchema']>>;
|
||||
protected abstract selectAbjointRow<T extends keyof ED>(entity: T, selection: Omit<ED[T]['Selection'], 'indexFrom' | 'count' | 'data' | 'sorter'>, context: Context<ED>, params?: OperateParams): Promise<Array<ED[T]['OpSchema']>>;
|
||||
protected abstract updateAbjointRow<T extends keyof ED>(entity: T, operation: DeduceCreateSingleOperation<ED[T]['Schema']> | DeduceUpdateOperation<ED[T]['Schema']> | DeduceRemoveOperation<ED[T]['Schema']>, context: Context<ED>, params?: OperateParams): Promise<void>;
|
||||
protected cascadeSelect<T extends keyof ED>(entity: T, selection: ED[T]['Selection'], context: Context<ED>, params?: Object): Promise<Array<ED[T]['Schema']>>;
|
||||
protected cascadeSelect<T extends keyof ED>(entity: T, selection: ED[T]['Selection'], context: Context<ED>, params?: OperateParams): Promise<Array<ED[T]['Schema']>>;
|
||||
/**
|
||||
* 级联更新
|
||||
* A --> B
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ declare type SelectOption = {
|
|||
};
|
||||
export declare type OperateParams = {
|
||||
notCollect?: boolean;
|
||||
obscure?: boolean;
|
||||
};
|
||||
export declare type FormUpdateData<SH extends GeneralEntityShape> = Partial<Omit<SH, InstinctiveAttributes>>;
|
||||
export declare type FormCreateData<SH extends GeneralEntityShape> = Omit<SH, InstinctiveAttributes> & {
|
||||
|
|
|
|||
|
|
@ -127,5 +127,5 @@ export declare function isCompareExpression<A>(expression: any): expression is C
|
|||
export declare function isMathExpression<A>(expression: any): expression is MathExpression<A>;
|
||||
export declare function isExpression<A>(expression: any): expression is Expression<A>;
|
||||
export declare function opMultipleParams(op: string): boolean;
|
||||
export declare function execOp(op: string, params: any): ExpressionConstant;
|
||||
export declare function execOp(op: string, params: any, obscure?: boolean): ExpressionConstant;
|
||||
export {};
|
||||
|
|
|
|||
|
|
@ -111,7 +111,10 @@ function opMultipleParams(op) {
|
|||
'$dayOfWeek', '$dayOfYear', '$not', '$true', '$false', '$abs', '$round', '$floor', '$ceil'].includes(op);
|
||||
}
|
||||
exports.opMultipleParams = opMultipleParams;
|
||||
function execOp(op, params) {
|
||||
function execOp(op, params, obscure) {
|
||||
if (obscure && (params === undefined || params.includes(undefined))) {
|
||||
return true;
|
||||
}
|
||||
switch (op) {
|
||||
case '$gt': {
|
||||
return params[0] > params[1];
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ export abstract class CascadeStore<ED extends {
|
|||
entity: T,
|
||||
selection: Omit<ED[T]['Selection'], 'indexFrom' | 'count' | 'data' | 'sorter'>,
|
||||
context: Context<ED>,
|
||||
params?: Object): Promise<Array<ED[T]['OpSchema']>>;
|
||||
params?: OperateParams): Promise<Array<ED[T]['OpSchema']>>;
|
||||
|
||||
protected abstract updateAbjointRow<T extends keyof ED>(
|
||||
entity: T,
|
||||
|
|
@ -30,7 +30,7 @@ export abstract class CascadeStore<ED extends {
|
|||
protected async cascadeSelect<T extends keyof ED>(
|
||||
entity: T,
|
||||
selection: ED[T]['Selection'],
|
||||
context: Context<ED>, params?: Object): Promise<Array<ED[T]['Schema']>> {
|
||||
context: Context<ED>, params?: OperateParams): Promise<Array<ED[T]['Schema']>> {
|
||||
const { data } = selection;
|
||||
|
||||
const projection: ED[T]['Selection']['data'] = {};
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ type SelectOption = {
|
|||
|
||||
export type OperateParams = {
|
||||
notCollect?: boolean;
|
||||
obscure?: boolean; // 如果为置为true,则在filter过程中因数据不完整而不能判断为真的时候都假设为真(前端缓存)
|
||||
};
|
||||
|
||||
export type FormUpdateData<SH extends GeneralEntityShape> = Partial<Omit<SH, InstinctiveAttributes>>;
|
||||
|
|
|
|||
|
|
@ -214,7 +214,10 @@ export function opMultipleParams(op: string) {
|
|||
'$dayOfWeek', '$dayOfYear', '$not', '$true', '$false', '$abs', '$round', '$floor', '$ceil'].includes(op);
|
||||
}
|
||||
|
||||
export function execOp(op: string, params: any): ExpressionConstant {
|
||||
export function execOp(op: string, params: any, obscure?: boolean): ExpressionConstant {
|
||||
if (obscure && (params === undefined || params.includes(undefined))) {
|
||||
return true;
|
||||
}
|
||||
switch (op) {
|
||||
case '$gt': {
|
||||
return params[0] > params[1];
|
||||
|
|
|
|||
Loading…
Reference in New Issue