修改了一些小的bug
This commit is contained in:
parent
68df3ac9e9
commit
90b20ecb56
|
|
@ -22,7 +22,9 @@ export declare class Cache<ED extends EntityDict & BaseEntityDict, Cxt extends C
|
|||
* @param operation
|
||||
* @returns
|
||||
*/
|
||||
tryRedoOperations<T extends keyof ED>(entity: T, operations: ED[T]['Operation'][]): Promise<boolean>;
|
||||
tryRedoOperations<T extends keyof ED>(operations: (ED[T]['Operation'] & {
|
||||
entity: T;
|
||||
})[]): Promise<boolean>;
|
||||
checkOperation<T extends keyof ED>(entity: T, action: ED[T]['Action'], filter?: ED[T]['Update']['filter'], checkerTypes?: CheckerType[]): Promise<boolean>;
|
||||
/**
|
||||
* 尝试在cache中重做一些动作,然后选择重做后的数据(为了实现modi)
|
||||
|
|
|
|||
|
|
@ -119,9 +119,9 @@ var Cache = /** @class */ (function (_super) {
|
|||
* @param operation
|
||||
* @returns
|
||||
*/
|
||||
Cache.prototype.tryRedoOperations = function (entity, operations) {
|
||||
Cache.prototype.tryRedoOperations = function (operations) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var context, operations_1, operations_1_1, operation, e_1_1, err_1;
|
||||
var context, operations_1, operations_1_1, operation, entity, e_1_1, err_1;
|
||||
var e_1, _a;
|
||||
return tslib_1.__generator(this, function (_b) {
|
||||
switch (_b.label) {
|
||||
|
|
@ -141,9 +141,11 @@ var Cache = /** @class */ (function (_super) {
|
|||
case 4:
|
||||
if (!!operations_1_1.done) return [3 /*break*/, 7];
|
||||
operation = operations_1_1.value;
|
||||
entity = operation.entity;
|
||||
return [4 /*yield*/, this.cacheStore.operate(entity, (0, lodash_1.cloneDeep)(operation), context, {
|
||||
dontCollect: true,
|
||||
dontCreateOper: true,
|
||||
blockTrigger: true,
|
||||
dontCreateModi: true,
|
||||
})];
|
||||
case 5:
|
||||
|
|
@ -242,6 +244,7 @@ var Cache = /** @class */ (function (_super) {
|
|||
return [4 /*yield*/, this.cacheStore.operate(oper.entity, (0, lodash_1.cloneDeep)(oper.operation), context, {
|
||||
dontCollect: true,
|
||||
dontCreateOper: true,
|
||||
blockTrigger: true,
|
||||
dontCreateModi: true,
|
||||
})];
|
||||
case 4:
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ declare abstract class Node<ED extends EntityDict & BaseEntityDict, T extends ke
|
|||
protected entity: T;
|
||||
protected schema: StorageSchema<ED>;
|
||||
protected projection: ED[T]['Selection']['data'] | (() => Promise<ED[T]['Selection']['data']>);
|
||||
protected parent?: Node<ED, keyof ED, Cxt, AD>;
|
||||
protected parent?: Node<ED, keyof ED, Cxt, AD> | VirtualNode;
|
||||
protected dirty?: boolean;
|
||||
protected cache: Cache<ED, Cxt, AD>;
|
||||
protected loading: boolean;
|
||||
|
|
@ -22,11 +22,13 @@ declare abstract class Node<ED extends EntityDict & BaseEntityDict, T extends ke
|
|||
protected executing: boolean;
|
||||
protected operations: Operation<ED, T>[];
|
||||
protected modies: BaseEntityDict['modi']['OpSchema'][];
|
||||
constructor(entity: T, schema: StorageSchema<ED>, cache: Cache<ED, Cxt, AD>, projection: ED[T]['Selection']['data'] | (() => Promise<ED[T]['Selection']['data']>), parent?: Node<ED, keyof ED, Cxt, AD>);
|
||||
constructor(entity: T, schema: StorageSchema<ED>, cache: Cache<ED, Cxt, AD>, projection: ED[T]['Selection']['data'] | (() => Promise<ED[T]['Selection']['data']>), parent?: Node<ED, keyof ED, Cxt, AD> | VirtualNode);
|
||||
getEntity(): T;
|
||||
getSchema(): StorageSchema<ED>;
|
||||
protected abstract getChildPath(child: Node<ED, keyof ED, Cxt, AD>): string;
|
||||
abstract doBeforeTrigger(): Promise<void>;
|
||||
abstract doAfterTrigger(): Promise<void>;
|
||||
abstract checkIfClean(): void;
|
||||
/**
|
||||
* 这个函数从某个结点向父亲查询,看所在路径上是否有需要被应用的modi
|
||||
*/
|
||||
|
|
@ -37,7 +39,7 @@ declare abstract class Node<ED extends EntityDict & BaseEntityDict, T extends ke
|
|||
isLoadingMore(): boolean;
|
||||
isExecuting(): boolean;
|
||||
setExecuting(executing: boolean): void;
|
||||
getParent(): Node<ED, keyof ED, Cxt, AD> | undefined;
|
||||
getParent(): Node<ED, keyof ED, Cxt, AD> | VirtualNode | undefined;
|
||||
protected getProjection(): Promise<ED[T]["Selection"]["data"]>;
|
||||
protected judgeRelation(attr: string): string | 0 | 2 | string[] | 1;
|
||||
protected contains(filter: ED[T]['Selection']['filter'], conditionalFilter: ED[T]['Selection']['filter']): boolean;
|
||||
|
|
@ -51,9 +53,10 @@ declare class ListNode<ED extends EntityDict & BaseEntityDict, T extends keyof E
|
|||
private ids;
|
||||
private syncHandler;
|
||||
protected getChildPath(child: Node<ED, keyof ED, Cxt, AD>): string;
|
||||
checkIfClean(): void;
|
||||
onCacheSync(records: OpRecord<ED>[]): Promise<void>;
|
||||
destroy(): void;
|
||||
constructor(entity: T, schema: StorageSchema<ED>, cache: Cache<ED, Cxt, AD>, projection: ED[T]['Selection']['data'] | (() => Promise<ED[T]['Selection']['data']>), projectionShape: ED[T]['Selection']['data'], parent?: Node<ED, keyof ED, Cxt, AD>, filters?: NamedFilterItem<ED, T>[], sorters?: NamedSorterItem<ED, T>[], pagination?: Pagination);
|
||||
constructor(entity: T, schema: StorageSchema<ED>, cache: Cache<ED, Cxt, AD>, projection: ED[T]['Selection']['data'] | (() => Promise<ED[T]['Selection']['data']>), parent?: Node<ED, keyof ED, Cxt, AD> | VirtualNode, filters?: NamedFilterItem<ED, T>[], sorters?: NamedSorterItem<ED, T>[], pagination?: Pagination);
|
||||
getPagination(): Pagination;
|
||||
setPagination(pagination: Pagination): Promise<void>;
|
||||
getChild(path: string, newBorn?: true): SingleNode<ED, T, Cxt, AD> | undefined;
|
||||
|
|
@ -76,9 +79,12 @@ declare class ListNode<ED extends EntityDict & BaseEntityDict, T extends keyof E
|
|||
addOperation(oper: Omit<ED[T]['Operation'], 'id'>, beforeExecute?: Operation<ED, T>['beforeExecute'], afterExecute?: Operation<ED, T>['afterExecute']): Promise<void>;
|
||||
doBeforeTrigger(): Promise<void>;
|
||||
doAfterTrigger(): Promise<void>;
|
||||
composeOperations(): Promise<ED[T]["Operation"][] | undefined>;
|
||||
composeOperations(): Promise<(ED[T]["Operation"] & {
|
||||
entity: T;
|
||||
})[] | undefined>;
|
||||
getProjection(): Promise<ED[T]['Selection']['data']>;
|
||||
constructSelection(withParent?: true): Promise<{
|
||||
disabled: boolean;
|
||||
data: ED[T]["Selection"]["data"];
|
||||
filters: ED[T]["Selection"]["filter"][];
|
||||
sorter: DeduceSorterItem<ED[T]["Schema"]>[];
|
||||
|
|
@ -91,8 +97,9 @@ declare class ListNode<ED extends EntityDict & BaseEntityDict, T extends keyof E
|
|||
declare class SingleNode<ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends Context<ED>, AD extends CommonAspectDict<ED, Cxt>> extends Node<ED, T, Cxt, AD> {
|
||||
private id?;
|
||||
private children;
|
||||
constructor(entity: T, schema: StorageSchema<ED>, cache: Cache<ED, Cxt, AD>, projection: ED[T]['Selection']['data'] | (() => Promise<ED[T]['Selection']['data']>), projectionShape: ED[T]['Selection']['data'], parent?: Node<ED, keyof ED, Cxt, AD>);
|
||||
constructor(entity: T, schema: StorageSchema<ED>, cache: Cache<ED, Cxt, AD>, projection: ED[T]['Selection']['data'] | (() => Promise<ED[T]['Selection']['data']>), parent?: Node<ED, keyof ED, Cxt, AD> | VirtualNode, id?: string);
|
||||
protected getChildPath(child: Node<ED, keyof ED, Cxt, AD>): string;
|
||||
checkIfClean(): void;
|
||||
destroy(): void;
|
||||
getChild(path: string): SingleNode<ED, keyof ED, Cxt, AD> | ListNode<ED, keyof ED, Cxt, AD>;
|
||||
setId(id: string): Promise<void>;
|
||||
|
|
@ -105,18 +112,41 @@ declare class SingleNode<ED extends EntityDict & BaseEntityDict, T extends keyof
|
|||
doBeforeTrigger(): Promise<void>;
|
||||
doAfterTrigger(): Promise<void>;
|
||||
addOperation(oper: Omit<ED[T]['Operation'], 'id'>, beforeExecute?: Operation<ED, T>['beforeExecute'], afterExecute?: Operation<ED, T>['afterExecute']): Promise<void>;
|
||||
composeOperations(): Promise<ED[T]["Operation"][] | undefined>;
|
||||
composeOperations(): Promise<(ED[T]["Operation"] & {
|
||||
entity: T;
|
||||
})[] | undefined>;
|
||||
private getFilter;
|
||||
getProjection(): Promise<ED[T]["Selection"]["data"]>;
|
||||
refresh(): Promise<void>;
|
||||
clean(): void;
|
||||
getOtmFilter<T2 extends keyof ED>(childNode: ListNode<ED, keyof ED, Cxt, AD>): ED[T2]['Selection']['filter'];
|
||||
getParentFilter<T2 extends keyof ED>(childNode: Node<ED, keyof ED, Cxt, AD>): ED[T2]['Selection']['filter'] | undefined;
|
||||
}
|
||||
declare class VirtualNode {
|
||||
private dirty;
|
||||
private children;
|
||||
constructor();
|
||||
getModies(child: any): BaseEntityDict['modi']['OpSchema'][];
|
||||
setDirty(): void;
|
||||
addChild(path: string, child: SingleNode<any, any, any, any> | ListNode<any, any, any, any>): void;
|
||||
getChild(path: string): SingleNode<any, any, any, any> | ListNode<any, any, any, any> | undefined;
|
||||
getParent(): undefined;
|
||||
destroy(): void;
|
||||
getFreshValue(): Promise<undefined>;
|
||||
isDirty(): boolean;
|
||||
refresh(): Promise<void[]>;
|
||||
composeOperations(): Promise<any[]>;
|
||||
setExecuting(executing: boolean): void;
|
||||
doBeforeTrigger(): Promise<void>;
|
||||
doAfterTrigger(): Promise<void>;
|
||||
clean(): void;
|
||||
checkIfClean(): void;
|
||||
}
|
||||
export declare type CreateNodeOptions<ED extends EntityDict & BaseEntityDict, T extends keyof ED> = {
|
||||
path: string;
|
||||
entity: T;
|
||||
entity?: T;
|
||||
isList?: boolean;
|
||||
isPicker?: boolean;
|
||||
projection: ED[T]['Selection']['data'] | (() => Promise<ED[T]['Selection']['data']>);
|
||||
projection?: ED[T]['Selection']['data'] | (() => Promise<ED[T]['Selection']['data']>);
|
||||
pagination?: Pagination;
|
||||
filters?: NamedFilterItem<ED, T>[];
|
||||
sorters?: NamedSorterItem<ED, T>[];
|
||||
|
|
@ -129,7 +159,7 @@ export declare class RunningTree<ED extends EntityDict & BaseEntityDict, Cxt ext
|
|||
private schema;
|
||||
private root;
|
||||
constructor(aspectWrapper: AspectWrapper<ED, Cxt, AD>, cache: Cache<ED, Cxt, AD>, schema: StorageSchema<ED>);
|
||||
createNode<T extends keyof ED>(options: CreateNodeOptions<ED, T>): Promise<ListNode<ED, T, Cxt, AD> | SingleNode<ED, T, Cxt, AD> | undefined>;
|
||||
createNode<T extends keyof ED>(options: CreateNodeOptions<ED, T>): Promise<VirtualNode | ListNode<ED, T, Cxt, AD> | SingleNode<ED, T, Cxt, AD> | undefined>;
|
||||
private findNode;
|
||||
destroyNode(path: string): void;
|
||||
getFreshValue(path: string): Promise<SelectRowShape<ED[keyof ED]["Schema"], ED[keyof ED]["Selection"]["data"]> | undefined> | Promise<SelectRowShape<ED[keyof ED]["Schema"], ED[keyof ED]["Selection"]["data"]>[]> | undefined;
|
||||
|
|
@ -157,8 +187,10 @@ export declare class RunningTree<ED extends EntityDict & BaseEntityDict, Cxt ext
|
|||
removeNamedSorter<T extends keyof ED>(path: string, sorter: NamedSorterItem<ED, T>, refresh?: boolean): Promise<void>;
|
||||
removeNamedSorterByName<T extends keyof ED>(path: string, name: string, refresh?: boolean): Promise<void>;
|
||||
tryExecute(path: string): Promise<boolean>;
|
||||
execute(path: string, operation?: ED[keyof ED]['Operation']): Promise<ED[keyof ED]["Operation"][] | undefined>;
|
||||
execute(path: string, operation?: ED[keyof ED]['Operation']): Promise<any[] | (ED[keyof ED]["Operation"] & {
|
||||
entity: keyof ED;
|
||||
})[]>;
|
||||
clean(path: string): void;
|
||||
getRoot(): Record<string, SingleNode<ED, keyof ED, Cxt, AD> | ListNode<ED, keyof ED, Cxt, AD>>;
|
||||
getRoot(): Record<string, VirtualNode | SingleNode<ED, keyof ED, Cxt, AD> | ListNode<ED, keyof ED, Cxt, AD>>;
|
||||
}
|
||||
export {};
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -7,7 +7,9 @@ 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']): Promise<ED[keyof ED]["Operation"][] | undefined>;
|
||||
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']): 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;
|
||||
export declare function setUpdateData<ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends Context<ED>>(this: ComponentFullThisType<ED, T, Cxt>, attr: string, data: any): Promise<void>;
|
||||
export declare function setMultiAttrUpdateData<ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends Context<ED>>(this: ComponentFullThisType<ED, T, Cxt>, data: Record<string, any>): Promise<void>;
|
||||
|
|
|
|||
|
|
@ -21,15 +21,18 @@ function unsubscribe() {
|
|||
exports.unsubscribe = unsubscribe;
|
||||
function onPathSet(option) {
|
||||
return tslib_1.__awaiter(this, void 0, void 0, function () {
|
||||
var _a, props, state, oakEntity, oakPath, oakProjection, oakIsPicker, oakFilters, oakSorters, oakId, entity, path, projection, isList, filters, sorters, pagination, features, filters2, oakFilters2, _loop_1, filters_1, filters_1_1, ele, proj, sorters2, oakSorters2, _loop_2, sorters_1, sorters_1_1, ele, oakPath2;
|
||||
var _a, props, state, oakPath, oakProjection, oakIsPicker, oakFilters, oakSorters, oakId, entity, path, projection, isList, filters, sorters, pagination, features, oakPath2, entity2, filters2, oakFilters2, _loop_1, filters_1, filters_1_1, ele, proj, sorters2, oakSorters2, _loop_2, sorters_1, sorters_1_1, ele;
|
||||
var e_1, _b, e_2, _c;
|
||||
return tslib_1.__generator(this, function (_d) {
|
||||
switch (_d.label) {
|
||||
case 0:
|
||||
_a = this, props = _a.props, state = _a.state;
|
||||
oakEntity = props.oakEntity, oakPath = props.oakPath, oakProjection = props.oakProjection, oakIsPicker = props.oakIsPicker, oakFilters = props.oakFilters, oakSorters = props.oakSorters, oakId = props.oakId;
|
||||
oakPath = props.oakPath, oakProjection = props.oakProjection, oakIsPicker = props.oakIsPicker, oakFilters = props.oakFilters, oakSorters = props.oakSorters, oakId = props.oakId;
|
||||
entity = option.entity, path = option.path, projection = option.projection, isList = option.isList, filters = option.filters, sorters = option.sorters, pagination = option.pagination;
|
||||
features = this.features;
|
||||
oakPath2 = oakPath || path;
|
||||
if (!entity) return [3 /*break*/, 2];
|
||||
entity2 = entity instanceof Function ? entity.call(this) : entity;
|
||||
filters2 = [];
|
||||
if (oakFilters) {
|
||||
oakFilters2 = typeof oakFilters === 'string' ? JSON.parse(oakFilters) : oakFilters;
|
||||
|
|
@ -116,48 +119,43 @@ function onPathSet(option) {
|
|||
finally { if (e_2) throw e_2.error; }
|
||||
}
|
||||
}
|
||||
oakPath2 = oakPath || path;
|
||||
(0, assert_1.assert)(oakPath2, '没有正确的path信息,请检查是否配置正确');
|
||||
return [4 /*yield*/, features.runningTree.createNode({
|
||||
path: oakPath2,
|
||||
entity: (oakEntity || entity),
|
||||
entity: entity2,
|
||||
isList: isList,
|
||||
isPicker: oakIsPicker,
|
||||
projection: proj,
|
||||
pagination: pagination,
|
||||
filters: filters2,
|
||||
sorters: sorters2,
|
||||
id: oakId,
|
||||
})];
|
||||
case 1:
|
||||
_d.sent();
|
||||
Object.assign(this.state, {
|
||||
oakEntity: (oakEntity || entity),
|
||||
oakEntity: entity2,
|
||||
oakFullpath: oakPath2,
|
||||
oakIsReady: true,
|
||||
});
|
||||
if (!isList) return [3 /*break*/, 3];
|
||||
return [4 /*yield*/, features.runningTree.refresh(oakPath2)];
|
||||
return [3 /*break*/, 4];
|
||||
case 2:
|
||||
_d.sent();
|
||||
return [3 /*break*/, 6];
|
||||
Object.assign(this.state, {
|
||||
oakFullpath: oakPath2,
|
||||
oakIsReady: true,
|
||||
});
|
||||
// 创建virtualNode
|
||||
return [4 /*yield*/, features.runningTree.createNode({
|
||||
path: oakPath2,
|
||||
})];
|
||||
case 3:
|
||||
if (!oakId) return [3 /*break*/, 5];
|
||||
return [4 /*yield*/, features.runningTree.setId(oakPath2, oakId)];
|
||||
case 4:
|
||||
// 创建virtualNode
|
||||
_d.sent();
|
||||
return [3 /*break*/, 6];
|
||||
_d.label = 4;
|
||||
case 4: return [4 /*yield*/, this.refresh()];
|
||||
case 5:
|
||||
if (oakEntity || entity) {
|
||||
this.reRender();
|
||||
}
|
||||
else {
|
||||
// 啥都没有也要为了oakFullpath刷新一次
|
||||
this.setState({
|
||||
oakFullpath: oakPath2,
|
||||
});
|
||||
}
|
||||
_d.label = 6;
|
||||
case 6: return [2 /*return*/];
|
||||
_d.sent();
|
||||
return [2 /*return*/];
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
@ -293,7 +291,7 @@ function refresh() {
|
|||
return tslib_1.__generator(this, function (_a) {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
if (!(this.state.oakEntity && this.state.oakFullpath)) return [3 /*break*/, 4];
|
||||
if (!this.state.oakFullpath) return [3 /*break*/, 4];
|
||||
_a.label = 1;
|
||||
case 1:
|
||||
_a.trys.push([1, 3, , 4]);
|
||||
|
|
|
|||
|
|
@ -146,13 +146,13 @@ var OakComponentBase = /** @class */ (function (_super) {
|
|||
};
|
||||
OakComponentBase.prototype.setProps = function (props, usingState) {
|
||||
var url = window.location.pathname;
|
||||
var search = window.location.search;
|
||||
if (usingState) {
|
||||
return this.props.navigate(url, { replace: true, state: props });
|
||||
return this.props.navigate("".concat(url).concat(search), { replace: true, state: props });
|
||||
}
|
||||
else {
|
||||
// 这里nodejs的url用不了,先简单写一个
|
||||
var url2 = void 0;
|
||||
var search = window.location.search;
|
||||
if (!search) {
|
||||
var search_1 = '';
|
||||
for (var k in props) {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import { NotificationProps } from './Notification';
|
|||
import { MessageProps } from './Message';
|
||||
declare type RowSelected<ED extends EntityDict & BaseEntityDict, T extends keyof ED, Proj extends ED[T]['Selection']['data'] = Required<ED[T]['Selection']['data']>> = SelectRowShape<ED[T]['Schema'], Proj> | undefined;
|
||||
interface ComponentOption<ED extends EntityDict & BaseEntityDict, T extends keyof ED, Cxt extends Context<ED>, AD extends Record<string, Aspect<ED, Cxt>>, FD extends Record<string, Feature<ED, Cxt, AD & CommonAspectDict<ED, Cxt>>>, Proj extends ED[T]['Selection']['data'], FormedData extends Record<string, any>, IsList extends boolean, TProperty extends WechatMiniprogram.Component.PropertyOption = {}> {
|
||||
entity?: T;
|
||||
entity?: T | (() => T);
|
||||
path?: string;
|
||||
isList: IsList;
|
||||
projection?: Proj | ((options: {
|
||||
|
|
@ -88,7 +88,6 @@ export declare type OakComponentOption<ED extends EntityDict & BaseEntityDict, T
|
|||
};
|
||||
}> & ThisType<ComponentPublicThisType<ED, T, Cxt, AD, FD, FormedData, IsList, TData, TProperty, TMethod>>;
|
||||
export declare type OakComponentProperties = {
|
||||
oakEntity: StringConstructor;
|
||||
oakPath: StringConstructor;
|
||||
oakId: StringConstructor;
|
||||
oakProjection: ObjectConstructor;
|
||||
|
|
@ -157,6 +156,7 @@ export declare type OakCommonComponentMethods<ED extends EntityDict & BaseEntity
|
|||
refresh: (extra?: any) => Promise<void>;
|
||||
setUpdateData: (data: string, attr: any) => Promise<void>;
|
||||
setMultiAttrUpdateData: (data: Record<string, any>) => Promise<void>;
|
||||
setId: (id: string) => Promise<void>;
|
||||
};
|
||||
export declare type OakListComponentMethods<ED extends EntityDict & BaseEntityDict, T extends keyof ED> = {
|
||||
loadMore: () => Promise<void>;
|
||||
|
|
|
|||
|
|
@ -1489,7 +1489,7 @@ class VirtualNode {
|
|||
assert(path === entity || path.startsWith(`${entity}:`), `oakPath「${path}」不符合命名规范,请以「${entity}」为命名起始标识`);
|
||||
}
|
||||
else {
|
||||
assert(path === entity || path.startsWith(`${entity}s:`), `oakPath「${path}」不符合命名规范,请以「${entity}s」为命名起始标识`);
|
||||
assert(path === `${entity}s` || path.startsWith(`${entity}s:`), `oakPath「${path}」不符合命名规范,请以「${entity}s」为命名起始标识`);
|
||||
}
|
||||
this.children[path] = child;
|
||||
}
|
||||
|
|
@ -1570,7 +1570,7 @@ class VirtualNode {
|
|||
}
|
||||
}
|
||||
checkIfClean() {
|
||||
for (const ele in this.children) {
|
||||
for (const k in this.children) {
|
||||
if (this.children[k].isDirty()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -206,13 +206,13 @@ abstract class OakComponentBase<
|
|||
|
||||
setProps(props: Record<string, any>, usingState?: true) {
|
||||
const url = window.location.pathname;
|
||||
const search = window.location.search;
|
||||
if (usingState) {
|
||||
return this.props.navigate(url, { replace: true, state: props });
|
||||
return this.props.navigate(`${url}${search}`, { replace: true, state: props });
|
||||
}
|
||||
else {
|
||||
// 这里nodejs的url用不了,先简单写一个
|
||||
let url2: string;
|
||||
const search = window.location.search;
|
||||
if (!search) {
|
||||
let search = '';
|
||||
for (const k in props) {
|
||||
|
|
|
|||
|
|
@ -257,6 +257,7 @@ export type OakCommonComponentMethods<
|
|||
refresh: (extra?: any) => Promise<void>;
|
||||
setUpdateData: (data: string, attr: any) => Promise<void>;
|
||||
setMultiAttrUpdateData: (data: Record<string, any>) => Promise<void>;
|
||||
setId: (id: string) => Promise<void>;
|
||||
};
|
||||
|
||||
export type OakListComponentMethods<ED extends EntityDict & BaseEntityDict, T extends keyof ED> = {
|
||||
|
|
|
|||
Loading…
Reference in New Issue