1、修改只有list的第一层子结点不会主动refresh,2、lin-ui的小bug

This commit is contained in:
Xu Chang 2025-07-07 17:59:33 +08:00
parent 4101b58514
commit 28b469b75d
13 changed files with 33 additions and 42 deletions

View File

@ -317,7 +317,7 @@ export declare class RunningTree<ED extends EntityDict & BaseEntityDict> extends
isLoading(path: string): boolean | undefined;
isLoadingMore(path: string): boolean | undefined;
isExecuting(path: string): boolean;
isListDescandentOrStale(path: string): boolean;
isListChildOrStale(path: string): boolean;
private isInModiNextBranch;
refresh(path: string, pageNumber?: number, resetTotal?: boolean): Promise<void>;
loadMore(path: string): Promise<void>;

View File

@ -2180,17 +2180,14 @@ export class RunningTree extends Feature {
const node = this.findNode(path);
return node ? node.isExecuting() : false;
}
isListDescandentOrStale(path) {
isListChildOrStale(path) {
const node = this.findNode(path);
if (node?.isStale()) {
return true;
}
let parent = node?.getParent();
while (parent) {
if (parent instanceof ListNode) {
return true;
}
parent = parent.getParent();
if (parent instanceof ListNode) {
return true;
}
return false;
}

View File

@ -66,9 +66,9 @@ Component({
for (let i = 0; i < children.length; i++) {
let item = children[i];
let id = item.data.itemId === 'default' ? i : item.data.itemId;
if (expandItemId.indexOf(id) > -1 && !item.isExpandContent) {
if (expandItemId.indexOf(id) > -1 && !item.data.isExpandContent) {
await this.setCollapseItemStatus(item, true);
} else if (item.isExpandContent || this.data.type === 'accordion') {
} else if (item.data.isExpandContent || this.data.type === 'accordion') {
await this.setCollapseItemStatus(item, false);
}
}

View File

@ -482,7 +482,7 @@ const oakBehavior = Behavior({
this.oakOption.lifetimes?.ready &&
this.oakOption.lifetimes?.ready.call(this);
const { oakFullpath } = this.state;
if (oakFullpath && !this.features.runningTree.isListDescandentOrStale(oakFullpath)) {
if (oakFullpath && !this.features.runningTree.isListChildOrStale(oakFullpath)) {
await this.refresh();
this.oakOption.lifetimes?.mature && this.oakOption.lifetimes.mature.call(this);
}
@ -788,7 +788,7 @@ export function createComponent(option, features) {
return;
}
const { oakFullpath } = this.state;
if (oakFullpath && !this.features.runningTree.isListDescandentOrStale(oakFullpath)) {
if (oakFullpath && !this.features.runningTree.isListChildOrStale(oakFullpath)) {
try {
await this.refresh();
lifetimes?.mature && lifetimes.mature.call(this);

View File

@ -643,7 +643,7 @@ export function createComponent(option, features) {
}
try {
const { oakFullpath } = this.state;
if (oakFullpath && !this.features.runningTree.isListDescandentOrStale(oakFullpath)) {
if (oakFullpath && !this.features.runningTree.isListChildOrStale(oakFullpath)) {
await this.refresh();
lifetimes?.mature && lifetimes.mature.call(this);
}
@ -702,7 +702,7 @@ export function createComponent(option, features) {
lifetimes?.show && lifetimes.show.call(this);
}
const { oakFullpath } = this.state;
if (oakFullpath && !this.features.runningTree.isListDescandentOrStale(oakFullpath)) {
if (oakFullpath && !this.features.runningTree.isListChildOrStale(oakFullpath)) {
await this.refresh();
lifetimes?.mature && lifetimes.mature.call(this);
}

View File

@ -317,7 +317,7 @@ export declare class RunningTree<ED extends EntityDict & BaseEntityDict> extends
isLoading(path: string): boolean | undefined;
isLoadingMore(path: string): boolean | undefined;
isExecuting(path: string): boolean;
isListDescandentOrStale(path: string): boolean;
isListChildOrStale(path: string): boolean;
private isInModiNextBranch;
refresh(path: string, pageNumber?: number, resetTotal?: boolean): Promise<void>;
loadMore(path: string): Promise<void>;

View File

@ -2183,17 +2183,14 @@ class RunningTree extends Feature_1.Feature {
const node = this.findNode(path);
return node ? node.isExecuting() : false;
}
isListDescandentOrStale(path) {
isListChildOrStale(path) {
const node = this.findNode(path);
if (node?.isStale()) {
return true;
}
let parent = node?.getParent();
while (parent) {
if (parent instanceof ListNode) {
return true;
}
parent = parent.getParent();
if (parent instanceof ListNode) {
return true;
}
return false;
}

View File

@ -485,7 +485,7 @@ const oakBehavior = Behavior({
this.oakOption.lifetimes?.ready &&
this.oakOption.lifetimes?.ready.call(this);
const { oakFullpath } = this.state;
if (oakFullpath && !this.features.runningTree.isListDescandentOrStale(oakFullpath)) {
if (oakFullpath && !this.features.runningTree.isListChildOrStale(oakFullpath)) {
await this.refresh();
this.oakOption.lifetimes?.mature && this.oakOption.lifetimes.mature.call(this);
}
@ -791,7 +791,7 @@ function createComponent(option, features) {
return;
}
const { oakFullpath } = this.state;
if (oakFullpath && !this.features.runningTree.isListDescandentOrStale(oakFullpath)) {
if (oakFullpath && !this.features.runningTree.isListChildOrStale(oakFullpath)) {
try {
await this.refresh();
lifetimes?.mature && lifetimes.mature.call(this);

View File

@ -648,7 +648,7 @@ function createComponent(option, features) {
}
try {
const { oakFullpath } = this.state;
if (oakFullpath && !this.features.runningTree.isListDescandentOrStale(oakFullpath)) {
if (oakFullpath && !this.features.runningTree.isListChildOrStale(oakFullpath)) {
await this.refresh();
lifetimes?.mature && lifetimes.mature.call(this);
}
@ -707,7 +707,7 @@ function createComponent(option, features) {
lifetimes?.show && lifetimes.show.call(this);
}
const { oakFullpath } = this.state;
if (oakFullpath && !this.features.runningTree.isListDescandentOrStale(oakFullpath)) {
if (oakFullpath && !this.features.runningTree.isListChildOrStale(oakFullpath)) {
await this.refresh();
lifetimes?.mature && lifetimes.mature.call(this);
}

View File

@ -673,7 +673,7 @@ class ListNode<
(id) => {
unset(this.sr, id);
if (this.pagination.total) {
this.pagination.total --;
this.pagination.total--;
}
}
);
@ -681,9 +681,9 @@ class ListNode<
if (diffed.length) {
diffed.forEach(
(ele) => {
this.sr[ele] = {};
this.sr[ele] = {};
if (this.pagination.total) {
this.pagination.total ++;
this.pagination.total++;
}
}
);
@ -1623,7 +1623,7 @@ class SingleNode<ED extends EntityDict & BaseEntityDict,
filter: {
id,
},
}, inModiNextBranch ? undefined :{
}, inModiNextBranch ? undefined : {
[id]: this.sr,
});
return result[0];
@ -2404,7 +2404,7 @@ export class RunningTree<ED extends EntityDict & BaseEntityDict> extends Feature
}
else {
const rollback = this.begin();
if (parentNode) {
if (parentNode) {
this.redoBranchModis(fullPath);
this.redoBranchOperations(fullPath);
}
@ -2521,7 +2521,7 @@ export class RunningTree<ED extends EntityDict & BaseEntityDict> extends Feature
if (node instanceof ListNode) {
return node.getFreshValue();
}
else if(node instanceof SingleNode) {
else if (node instanceof SingleNode) {
return node.getFreshValue();
}
}
@ -2653,17 +2653,14 @@ export class RunningTree<ED extends EntityDict & BaseEntityDict> extends Feature
return node ? node.isExecuting() : false;
}
isListDescandentOrStale(path: string) {
isListChildOrStale(path: string) {
const node = this.findNode(path);
if (node?.isStale()) {
return true;
}
let parent = node?.getParent();
while (parent) {
if (parent instanceof ListNode) {
return true;
}
parent = parent.getParent();
if (parent instanceof ListNode) {
return true;
}
return false;
}

View File

@ -66,9 +66,9 @@ Component({
for (let i = 0; i < children.length; i++) {
let item = children[i];
let id = item.data.itemId === 'default' ? i : item.data.itemId;
if (expandItemId.indexOf(id) > -1 && !item.isExpandContent) {
if (expandItemId.indexOf(id) > -1 && !item.data.isExpandContent) {
await this.setCollapseItemStatus(item, true);
} else if (item.isExpandContent || this.data.type === 'accordion') {
} else if (item.data.isExpandContent || this.data.type === 'accordion') {
await this.setCollapseItemStatus(item, false);
}
}

View File

@ -706,7 +706,7 @@ const oakBehavior = Behavior<
this.oakOption.lifetimes?.ready.call(this);
const { oakFullpath } = this.state;
if (oakFullpath && !this.features.runningTree.isListDescandentOrStale(oakFullpath)) {
if (oakFullpath && !this.features.runningTree.isListChildOrStale(oakFullpath)) {
await this.refresh();
this.oakOption.lifetimes?.mature && this.oakOption.lifetimes.mature.call(this);
} else {
@ -1113,7 +1113,7 @@ export function createComponent<
return;
}
const { oakFullpath } = this.state;
if (oakFullpath && !this.features.runningTree.isListDescandentOrStale(oakFullpath)) {
if (oakFullpath && !this.features.runningTree.isListChildOrStale(oakFullpath)) {
try {
await this.refresh();
lifetimes?.mature && lifetimes.mature.call(this);

View File

@ -977,7 +977,7 @@ export function createComponent<
try {
const { oakFullpath } = this.state;
if (oakFullpath && !this.features.runningTree.isListDescandentOrStale(oakFullpath)) {
if (oakFullpath && !this.features.runningTree.isListChildOrStale(oakFullpath)) {
await this.refresh();
lifetimes?.mature && lifetimes.mature.call(this);
}
@ -1046,7 +1046,7 @@ export function createComponent<
lifetimes?.show && lifetimes.show.call(this);
}
const { oakFullpath } = this.state;
if (oakFullpath && !this.features.runningTree.isListDescandentOrStale(oakFullpath)) {
if (oakFullpath && !this.features.runningTree.isListChildOrStale(oakFullpath)) {
await this.refresh();
lifetimes?.mature && lifetimes.mature.call(this);
}