|
1 | 1 | import { Component, computed, inject, input, output } from '@angular/core'; |
2 | | -import { ID_GENERATOR } from './services/id-generator'; |
3 | | -import { decycle, previewString } from './util'; |
4 | | - |
5 | | -/** |
6 | | - * Represents a segment (node) within the JSON tree structure. |
7 | | - * Each segment corresponds to a key-value pair in an object, an item in an |
8 | | - * array, or the root value itself, providing context and state for rendering. |
9 | | - */ |
10 | | -export interface Segment { |
11 | | - /** The key (for objects) or index (for arrays). */ |
12 | | - key: string; |
13 | | - /** The actual JavaScript value represented by this segment. */ |
14 | | - value: any; |
15 | | - /** The JavaScript data type of the value. */ |
16 | | - type?: string; |
17 | | - /** A string representation of the value, used for display purposes. */ |
18 | | - description: string; |
19 | | - /** Indicates whether the segment is expanded in the UI. */ |
20 | | - expanded: boolean; |
21 | | - /** A reference to the parent segment in the JSON tree. Undefined for root. */ |
22 | | - parent?: Segment; |
23 | | - /** |
24 | | - * A dot/bracket notation path string to this specific segment |
25 | | - * (e.g., 'settings.notifications.email', 'items[1].value'). |
26 | | - */ |
27 | | - path: string; |
28 | | -} |
29 | | - |
30 | | -export type IsClickableValueFn = (segment: Segment) => boolean; |
| 2 | +import { ID_GENERATOR } from '../services/id-generator'; |
| 3 | +import { IsClickableValueFn, Segment } from '../types'; |
| 4 | +import { decycle, previewString } from '../util'; |
31 | 5 |
|
32 | 6 | /** |
33 | 7 | * Renders JSON data in an expandable and collapsible tree structure. |
|
0 commit comments