UNPKG

2.84 kBTypeScriptView Raw
1import { ArrayUtils } from '../../../common/types';
2import { TreeNode } from '../tree';
3import { ExpandableTreeNode } from '../tree-expansion';
4export interface CompressionParent extends ExpandableTreeNode {
5 children: [CompressionChild];
6}
7export interface CompressionChild extends ExpandableTreeNode {
8 parent: CompressionParent;
9}
10export declare type CompressionParticipant = CompressionChild | CompressionParent;
11export interface CompressionHead extends CompressionParent {
12 parent: ExpandableTreeNode;
13}
14export interface CompressionTail extends CompressionChild {
15}
16export declare const CompressionToggle: unique symbol;
17export interface CompressionToggle {
18 compress: boolean;
19}
20export declare class TreeCompressionService {
21 /**
22 * @returns `true` if the node has a single child that is a CompositeTreeNode
23 * In that case, the child can be shown in the same row as the parent.
24 */
25 isCompressionParent(node?: unknown): node is CompressionParent;
26 protected isVisibleExpandableNode(node?: unknown): node is ExpandableTreeNode;
27 /**
28 * @returns `true` if the node is a CompositeTreeNode and is its parent's sole child
29 * In that case, the node can be shown in the same row as its parent.
30 */
31 isCompressionChild(node?: TreeNode): node is CompressionChild;
32 /**
33 * @returns `true` if the node is a CompositeTreeNode with a sole child, and the same is not true of its parent.
34 * In that case, the node will appear as the first member of a compressed row.
35 */
36 isCompressionHead(node?: unknown): node is CompressionHead;
37 /**
38 * @returns `true` if the node's parent is a CompositeTreeNode with a sole child, and the same is not true of the node.
39 * In that case, the node will appear as the last member of a compressed row.
40 */
41 isCompressionTail(node?: TreeNode): node is CompressionTail;
42 /**
43 * @returns `true` if the node is part of a compression row, either a {@link CompressionChild} or {@link CompressionParent}
44 */
45 isCompressionParticipant(node?: TreeNode): node is CompressionParticipant;
46 /**
47 * @returns a sequence of compressed items for the node if it is a {@link CompressionHead}.
48 */
49 getCompressedChildren(node?: CompressionHead): ArrayUtils.Tail<CompressionChild>;
50 /**
51 * @returns The {@link CompressionHead} of the node's compression chain, or undefined if the node is not a {@link CompressionParticipant}.
52 */
53 getCompressionHead(node?: TreeNode): CompressionHead | undefined;
54 /**
55 * @returns The compression chain of which the `node` is a part, or `undefined` if the `node` is not a {@link CompressionParticipant}
56 */
57 getCompressionChain(node?: TreeNode): ArrayUtils.HeadAndTail<CompressionParticipant> | undefined;
58}
59//# sourceMappingURL=tree-compression-service.d.ts.map
\No newline at end of file