Collection children: A slim navigation of collection children + higher take above target (#20641)
* enforce update of children when collection * only load one above and below collection children * take 50 above a target for default experience * revert reset target * remove old impl
This commit is contained in:
committed by
Niels Lyngsø
parent
973a9573cc
commit
b4220a4d80
@@ -188,6 +188,12 @@ export class UmbTreeItemChildrenManager<
|
|||||||
* @memberof UmbTreeItemChildrenManager
|
* @memberof UmbTreeItemChildrenManager
|
||||||
*/
|
*/
|
||||||
public async loadChildren(): Promise<void> {
|
public async loadChildren(): Promise<void> {
|
||||||
|
const target = this.targetPagination.getBaseTarget();
|
||||||
|
/* If a new target is set we only want to reload children if the new target isn’t among the already loaded items. */
|
||||||
|
if (target && this.isChildLoaded(target)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
return this.#loadChildren();
|
return this.#loadChildren();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,7 +250,7 @@ export class UmbTreeItemChildrenManager<
|
|||||||
? this.targetPagination.getNumberOfCurrentItemsBeforeBaseTarget()
|
? this.targetPagination.getNumberOfCurrentItemsBeforeBaseTarget()
|
||||||
: this.#takeBeforeTarget !== undefined
|
: this.#takeBeforeTarget !== undefined
|
||||||
? this.#takeBeforeTarget
|
? this.#takeBeforeTarget
|
||||||
: 5,
|
: this.targetPagination.getTakeSize(),
|
||||||
takeAfter: reload
|
takeAfter: reload
|
||||||
? this.targetPagination.getNumberOfCurrentItemsAfterBaseTarget()
|
? this.targetPagination.getNumberOfCurrentItemsAfterBaseTarget()
|
||||||
: this.#takeAfterTarget !== undefined
|
: this.#takeAfterTarget !== undefined
|
||||||
|
|||||||
@@ -94,12 +94,6 @@ export class UmbTreeItemTargetExpansionManager<
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If a new target is set we only want to reload children if the new target isn’t among the already loaded items. */
|
|
||||||
const targetIsLoaded = this.#childrenManager.isChildLoaded(target);
|
|
||||||
if (target && targetIsLoaded) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If we already have children and the target didn't change then we don't have to load new children
|
// If we already have children and the target didn't change then we don't have to load new children
|
||||||
const isNewTarget = target !== currentBaseTarget;
|
const isNewTarget = target !== currentBaseTarget;
|
||||||
if (isExpanded && this.#childrenManager.hasLoadedChildren() && !isNewTarget) {
|
if (isExpanded && this.#childrenManager.hasLoadedChildren() && !isNewTarget) {
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ export class UmbDocumentTreeItemContext extends UmbDefaultTreeItemContext<
|
|||||||
this.hasCollection,
|
this.hasCollection,
|
||||||
(hasCollection) => {
|
(hasCollection) => {
|
||||||
if (hasCollection) {
|
if (hasCollection) {
|
||||||
this._treeItemChildrenManager.setTargetTakeSize(2, 2);
|
this._treeItemChildrenManager.setTargetTakeSize(1, 1);
|
||||||
|
|
||||||
this.observe(
|
this.observe(
|
||||||
this.hasActiveDescendant,
|
this.hasActiveDescendant,
|
||||||
|
|||||||
Reference in New Issue
Block a user