feat(folders): add curser and the normalized way to get foler's item list. add reverse order

This commit is contained in:
Edouard Vanbelle
2026-05-28 00:44:20 +02:00
parent 1523702ca6
commit 5790a1459f
18 changed files with 1183 additions and 111 deletions
@@ -143,6 +143,9 @@ const sharedWithMeView = {
*/
_groupBy: '',
/** Whether the current sort order is reversed. */
_reversed: false,
// ── Public API ────────────────────────────────────────────────────────────
/**
@@ -167,6 +170,19 @@ const sharedWithMeView = {
this._loadPage();
},
/**
* Flip the sort direction and reload from page 1.
* Calling with the current value is a no-op.
* @param {boolean} reversed
*/
setDirection(reversed) {
if (this._reversed === reversed) return;
this._reversed = reversed;
this._nextCursor = null;
this._component?.clear();
this._loadPage();
},
/**
* (Re-)load from page 1 and render into the existing files container.
* Called every time the user switches to this section.
@@ -175,6 +191,7 @@ const sharedWithMeView = {
this._nextCursor = null;
this._loading = false;
this._groupBy = '';
this._reversed = false;
this._ensureLoadMoreButton();
@@ -275,7 +292,8 @@ const sharedWithMeView = {
resourceTypes: /** @type {ResourceTypeEnum[]} */ (['file', 'folder']),
limit: 50,
cursor: this._nextCursor ?? undefined,
orderBy
orderBy,
reverse: this._reversed
});
this._nextCursor = data.next_cursor ?? null;