@myrmidon/paged-data-browsers 5.1.1 → 5.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myrmidon/paged-data-browsers",
3
- "version": "5.1.1",
3
+ "version": "5.1.3",
4
4
  "description": "Generic simple paged data browsers.",
5
5
  "keywords": [
6
6
  "data browsers"
@@ -14,24 +14,24 @@
14
14
  "name": "Daniele Fusi"
15
15
  },
16
16
  "peerDependencies": {
17
- "@angular/common": "^20.0.0",
18
- "@angular/core": "^20.0.0",
19
- "@angular/forms": "^20.0.0",
20
- "@angular/material": "^20.0.1",
21
- "@myrmidon/ngx-tools": "^2.0.0"
17
+ "@angular/common": "^20.0.0 || ^21.0.0",
18
+ "@angular/core": "^20.0.0 || ^21.0.0",
19
+ "@angular/forms": "^20.0.0 || ^21.0.0",
20
+ "@angular/material": "^20.0.1 || ^21.0.0",
21
+ "@myrmidon/ngx-tools": "^2.0.2"
22
22
  },
23
23
  "dependencies": {
24
24
  "tslib": "^2.3.0"
25
25
  },
26
26
  "sideEffects": false,
27
27
  "module": "fesm2022/myrmidon-paged-data-browsers.mjs",
28
- "typings": "index.d.ts",
28
+ "typings": "types/myrmidon-paged-data-browsers.d.ts",
29
29
  "exports": {
30
30
  "./package.json": {
31
31
  "default": "./package.json"
32
32
  },
33
33
  ".": {
34
- "types": "./index.d.ts",
34
+ "types": "./types/myrmidon-paged-data-browsers.d.ts",
35
35
  "default": "./fesm2022/myrmidon-paged-data-browsers.mjs"
36
36
  }
37
37
  }
@@ -32,7 +32,7 @@ interface PagingInfo {
32
32
  total: number;
33
33
  }
34
34
  /**
35
- * A tree node with paging information, used in NodeBrowserStore.
35
+ * A tree node with paging information, used in PagedTreeStore.
36
36
  */
37
37
  interface PagedTreeNode<F extends TreeNodeFilter> extends TreeNode {
38
38
  paging: PagingInfo;
@@ -40,7 +40,7 @@ interface PagedTreeNode<F extends TreeNodeFilter> extends TreeNode {
40
40
  filter?: F;
41
41
  }
42
42
  /**
43
- * The interface to be implemented by the service used by NodeBrowserStore
43
+ * The interface to be implemented by the service used by PagedTreeStore
44
44
  * to load nodes.
45
45
  */
46
46
  interface PagedTreeStoreService<F extends TreeNodeFilter> {
@@ -194,9 +194,10 @@ declare class PagedTreeStore<E extends PagedTreeNode<F>, F extends TreeNodeFilte
194
194
  * Expand the node with the specified ID. If the node is not expandable,
195
195
  * or it is already expanded, this method does nothing.
196
196
  * @param node The ID of the node to expand.
197
+ * @param silent If true, don't clear hilites (used internally).
197
198
  * @returns Promise with true if the node was expanded, false otherwise.
198
199
  */
199
- expand(id: number): Promise<boolean>;
200
+ expand(id: number, silent?: boolean): Promise<boolean>;
200
201
  /**
201
202
  * Expand all the descendants of the node with the specified ID.
202
203
  *
@@ -233,9 +234,10 @@ declare class PagedTreeStore<E extends PagedTreeNode<F>, F extends TreeNodeFilte
233
234
  * @param parentId The ID of the parent node whose children are inside the page
234
235
  * you want to change.
235
236
  * @param pageNumber The new page number.
237
+ * @param silent If true, don't clear hilites (used internally).
236
238
  * @returns Promise with true if the page was changed, false otherwise.
237
239
  */
238
- changePage(parentId: number, pageNumber: number): Promise<boolean>;
240
+ changePage(parentId: number, pageNumber: number, silent?: boolean): Promise<boolean>;
239
241
  /**
240
242
  * Clear the store. The cache is cleared and the nodes are removed.
241
243
  */
@@ -277,10 +279,10 @@ declare class PagedTreeStore<E extends PagedTreeNode<F>, F extends TreeNodeFilte
277
279
  */
278
280
  private searchNodeAndDescendants;
279
281
  /**
280
- * Ensure a node is visible by expanding all its ancestors.
281
- * @param nodeId The ID of the node to make visible.
282
+ * Ensure all ancestors of a node are expanded (used internally by findLabels).
283
+ * @param nodeId The ID of the node whose ancestors should be expanded.
282
284
  */
283
- private ensureNodeVisible;
285
+ private ensureAncestorsExpandedInternal;
284
286
  private get _isEditable();
285
287
  private get _editableService();
286
288
  /**
@@ -337,6 +339,58 @@ declare class PagedTreeStore<E extends PagedTreeNode<F>, F extends TreeNodeFilte
337
339
  * Clear all unsaved changes.
338
340
  */
339
341
  clearUnsavedChanges(): void;
342
+ /**
343
+ * Ensure that the node with the specified ID is visible in the tree.
344
+ * This method will:
345
+ * 1. Optionally refresh data by clearing cache
346
+ * 2. Find the node and determine which page it's on
347
+ * 3. Expand all ancestor nodes to make it visible
348
+ * 4. Navigate to the page containing the node
349
+ * 5. Optionally set the node's expanded/collapsed state
350
+ *
351
+ * @param id The ID of the node to make visible.
352
+ * @param expanded If true, expand the node; if false, collapse it; if undefined, don't change.
353
+ * @param refresh If true, clear cache to reload data from service.
354
+ * @returns Promise that resolves to true if successful, false otherwise.
355
+ */
356
+ ensureNodeVisible(id: number, expanded?: boolean, refresh?: boolean): Promise<boolean>;
357
+ /**
358
+ * Find and load a node that is not currently visible by querying the service
359
+ * to build the path from root to the target node, then expand only the nodes
360
+ * on that path.
361
+ * @param id The ID of the node to find.
362
+ * @returns The node if found, undefined otherwise.
363
+ */
364
+ private findAndLoadNode;
365
+ /**
366
+ * Find the path from root to a target node by querying the service.
367
+ * @param targetId The ID of the target node.
368
+ * @returns Array of nodes from root to target, or undefined if not found.
369
+ */
370
+ private findNodePath;
371
+ /**
372
+ * Ensure all ancestors of a node are expanded.
373
+ * @param nodeId The ID of the node whose ancestors should be expanded.
374
+ */
375
+ private ensureAncestorsExpanded;
376
+ /**
377
+ * Get all siblings of a node, including those not currently visible.
378
+ * @param node The node whose siblings to retrieve.
379
+ * @returns Array of all siblings.
380
+ */
381
+ private getAllSiblings;
382
+ /**
383
+ * Get the ID of the node that should be selected after deleting the
384
+ * node with the specified ID. This follows the priority:
385
+ * 1. Next sibling of the deleted node
386
+ * 2. Previous sibling of the deleted node
387
+ * 3. Parent node of the deleted node
388
+ * 4. null if none of the above exist
389
+ *
390
+ * @param id The ID of the node to be deleted.
391
+ * @returns The ID of the anchor node, or null if none can be determined.
392
+ */
393
+ getAnchorForDeletedNode(id: number): number | null;
340
394
  }
341
395
 
342
396
  declare class CompactPagerComponent {