key count limit

This commit is contained in:
SPRINX0\prochazka
2025-05-14 12:53:51 +02:00
parent bb076cce5d
commit 2c2a93c440
2 changed files with 26 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
import _omit from 'lodash/omit';
import _sortBy from 'lodash/sortBy';
const SHOW_INCREMENT = 100;
export const DB_KEYS_SHOW_INCREMENT = 100;
export interface DbKeysNodeModelBase {
text?: string;
@@ -247,6 +247,20 @@ export function dbKeys_markNodeExpanded(tree: DbKeysTreeModel, root: string, isE
};
}
export function dbKeys_showNextItems(tree: DbKeysTreeModel, root: string): DbKeysTreeModel {
const node = tree.dirStateByKey[root];
return {
...tree,
dirStateByKey: {
...tree.dirStateByKey,
[root]: {
...node,
visibleCount: (node?.visibleCount ?? DB_KEYS_SHOW_INCREMENT) + DB_KEYS_SHOW_INCREMENT,
},
},
};
}
export function dbKeys_createNewModel(treeKeySeparator: string): DbKeysTreeModel {
const root: DbKeysFolderNodeModel = {
level: 0,
@@ -265,7 +279,7 @@ export function dbKeys_createNewModel(treeKeySeparator: string): DbKeysTreeModel
dirStateByKey: {
'': {
key: '',
visibleCount: SHOW_INCREMENT,
visibleCount: DB_KEYS_SHOW_INCREMENT,
isExpanded: true,
},
},