diff --git a/es/features/runningTree.d.ts b/es/features/runningTree.d.ts index 9cf09013..ce8b87f1 100644 --- a/es/features/runningTree.d.ts +++ b/es/features/runningTree.d.ts @@ -50,7 +50,6 @@ declare abstract class Node extends Feat private count; protected executing: boolean; protected dirty?: boolean; - protected loadingMore: boolean; private extraData; private refreshing; private refreshCallbacks; @@ -72,7 +71,6 @@ declare abstract class Node extends Feat setExecuting(executing: boolean): void; protected startRefreshing(num: number): number | Promise; protected endRefreshing(num: number, error?: any): void; - isLoadingMore(): boolean; saveExtraData(key: string, data: any): void; loadExtraData(key: string): any; isStale(): boolean; @@ -102,6 +100,7 @@ declare class ListNode, cache: Cache, fullPath: string, projection?: ED[T]['Projection'] | (() => Promise), parent?: SingleNode | VirtualNode, path?: string, filters?: NamedFilterItem[], sorters?: NamedSorterItem[], getTotal?: number, pagination?: Pick, stale?: boolean); getPagination(): Pagination; setPagination(pagination: Pick, dontRefresh?: true): void; + isLoadingMore(): boolean; addChild(path: string, node: SingleNode): void; removeChild(path: string): void; getChild(path: string): SingleNode; diff --git a/es/features/runningTree.js b/es/features/runningTree.js index 4bde6844..ed5a3d6c 100644 --- a/es/features/runningTree.js +++ b/es/features/runningTree.js @@ -207,7 +207,6 @@ class Node extends Feature { count = 0; executing = false; dirty; - loadingMore = false; extraData = {}; refreshing = 0; refreshCallbacks = []; @@ -282,9 +281,6 @@ class Node extends Feature { }); } } - isLoadingMore() { - return this.loadingMore; - } saveExtraData(key, data) { this.extraData[key] = data; } @@ -312,7 +308,6 @@ class EntityNode extends Node { this.projection = projection; this.parent = parent; this.dirty = undefined; - this.loadingMore = false; this.executing = false; this.ulManager = new UpdateLogManager(this.schema, this.entity); } @@ -362,6 +357,7 @@ class ListNode extends EntityNode { getTotal; pagination = { ...DEFAULT_PAGINATION }; sr = {}; + loadingMore = false; syncHandler; setFiltersAndSortedApplied() { this.filters.forEach(ele => ele.applied = true); @@ -643,6 +639,9 @@ class ListNode extends EntityNode { this.refresh(0, false); } } + isLoadingMore() { + return this.loadingMore; + } addChild(path, node) { assert(!this.children[path]); // assert(path.length > 10, 'List的path改成了id'); @@ -2174,7 +2173,7 @@ export class RunningTree extends Feature { } isLoadingMore(path) { const node = this.findNode(path); - assert(!node || (node instanceof SingleNode || node instanceof ListNode)); + assert(!node || (node instanceof ListNode)); return node?.isLoadingMore(); } isExecuting(path) { diff --git a/lib/features/runningTree.d.ts b/lib/features/runningTree.d.ts index 9cf09013..ce8b87f1 100644 --- a/lib/features/runningTree.d.ts +++ b/lib/features/runningTree.d.ts @@ -50,7 +50,6 @@ declare abstract class Node extends Feat private count; protected executing: boolean; protected dirty?: boolean; - protected loadingMore: boolean; private extraData; private refreshing; private refreshCallbacks; @@ -72,7 +71,6 @@ declare abstract class Node extends Feat setExecuting(executing: boolean): void; protected startRefreshing(num: number): number | Promise; protected endRefreshing(num: number, error?: any): void; - isLoadingMore(): boolean; saveExtraData(key: string, data: any): void; loadExtraData(key: string): any; isStale(): boolean; @@ -102,6 +100,7 @@ declare class ListNode, cache: Cache, fullPath: string, projection?: ED[T]['Projection'] | (() => Promise), parent?: SingleNode | VirtualNode, path?: string, filters?: NamedFilterItem[], sorters?: NamedSorterItem[], getTotal?: number, pagination?: Pick, stale?: boolean); getPagination(): Pagination; setPagination(pagination: Pick, dontRefresh?: true): void; + isLoadingMore(): boolean; addChild(path: string, node: SingleNode): void; removeChild(path: string): void; getChild(path: string): SingleNode; diff --git a/lib/features/runningTree.js b/lib/features/runningTree.js index c84115b4..7a3968ff 100644 --- a/lib/features/runningTree.js +++ b/lib/features/runningTree.js @@ -210,7 +210,6 @@ class Node extends Feature_1.Feature { count = 0; executing = false; dirty; - loadingMore = false; extraData = {}; refreshing = 0; refreshCallbacks = []; @@ -285,9 +284,6 @@ class Node extends Feature_1.Feature { }); } } - isLoadingMore() { - return this.loadingMore; - } saveExtraData(key, data) { this.extraData[key] = data; } @@ -315,7 +311,6 @@ class EntityNode extends Node { this.projection = projection; this.parent = parent; this.dirty = undefined; - this.loadingMore = false; this.executing = false; this.ulManager = new UpdateLogManager(this.schema, this.entity); } @@ -365,6 +360,7 @@ class ListNode extends EntityNode { getTotal; pagination = { ...DEFAULT_PAGINATION }; sr = {}; + loadingMore = false; syncHandler; setFiltersAndSortedApplied() { this.filters.forEach(ele => ele.applied = true); @@ -646,6 +642,9 @@ class ListNode extends EntityNode { this.refresh(0, false); } } + isLoadingMore() { + return this.loadingMore; + } addChild(path, node) { (0, assert_1.assert)(!this.children[path]); // assert(path.length > 10, 'List的path改成了id'); @@ -2177,7 +2176,7 @@ class RunningTree extends Feature_1.Feature { } isLoadingMore(path) { const node = this.findNode(path); - (0, assert_1.assert)(!node || (node instanceof SingleNode || node instanceof ListNode)); + (0, assert_1.assert)(!node || (node instanceof ListNode)); return node?.isLoadingMore(); } isExecuting(path) { diff --git a/src/features/runningTree.ts b/src/features/runningTree.ts index e77c0fd9..811c1575 100644 --- a/src/features/runningTree.ts +++ b/src/features/runningTree.ts @@ -259,7 +259,6 @@ abstract class Node extends Feature { private count: number = 0; protected executing: boolean = false; protected dirty?: boolean; - protected loadingMore: boolean = false; private extraData: Record = {}; private refreshing: number = 0; private refreshCallbacks: Array<[() => void, (error?: any) => void]> = []; @@ -361,10 +360,6 @@ abstract class Node extends Feature { } } - isLoadingMore() { - return this.loadingMore; - } - saveExtraData(key: string, data: any) { this.extraData[key] = data; } @@ -402,7 +397,6 @@ abstract class EntityNode< this.projection = projection; this.parent = parent; this.dirty = undefined; - this.loadingMore = false; this.executing = false; this.ulManager = new UpdateLogManager(this.schema, this.entity); } @@ -467,6 +461,7 @@ class ListNode< private getTotal?: number; private pagination: Pagination = { ...DEFAULT_PAGINATION }; private sr: Record = {}; + private loadingMore: boolean = false; private syncHandler: (records: OpRecord[]) => void; @@ -799,6 +794,11 @@ class ListNode< } } + isLoadingMore() { + return this.loadingMore; + } + + addChild(path: string, node: SingleNode) { assert(!this.children[path]); // assert(path.length > 10, 'List的path改成了id'); @@ -2643,9 +2643,7 @@ export class RunningTree extends Feature isLoadingMore(path: string) { const node = this.findNode(path); - assert( - !node || (node instanceof SingleNode || node instanceof ListNode) - ); + assert(!node || (node instanceof ListNode)); return node?.isLoadingMore(); }