@xh/hoist 70.0.0-SNAPSHOT.1731083521069 → 70.0.0-SNAPSHOT.1731374612473

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.
Files changed (93) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/build/types/cmp/filter/FilterChooserModel.d.ts +17 -12
  3. package/build/types/cmp/grid/GridModel.d.ts +5 -9
  4. package/build/types/cmp/grid/Types.d.ts +7 -19
  5. package/build/types/cmp/grid/columns/Column.d.ts +0 -1
  6. package/build/types/cmp/grid/impl/InitPersist.d.ts +7 -0
  7. package/build/types/cmp/grouping/GroupingChooserModel.d.ts +6 -8
  8. package/build/types/cmp/tab/TabContainerModel.d.ts +10 -4
  9. package/build/types/cmp/zoneGrid/Types.d.ts +6 -6
  10. package/build/types/cmp/zoneGrid/ZoneGridModel.d.ts +0 -2
  11. package/build/types/cmp/zoneGrid/impl/InitPersist.d.ts +7 -0
  12. package/build/types/core/HoistBase.d.ts +1 -1
  13. package/build/types/core/persist/CustomProvider.d.ts +5 -6
  14. package/build/types/core/persist/DashViewProvider.d.ts +6 -6
  15. package/build/types/core/persist/LocalStorageProvider.d.ts +4 -5
  16. package/build/types/core/persist/PersistOptions.d.ts +5 -4
  17. package/build/types/core/persist/Persistable.d.ts +14 -0
  18. package/build/types/core/persist/PersistenceProvider.d.ts +47 -34
  19. package/build/types/core/persist/PrefProvider.d.ts +5 -5
  20. package/build/types/core/persist/index.d.ts +2 -0
  21. package/build/types/core/persist/viewmanager/Types.d.ts +46 -0
  22. package/build/types/core/persist/viewmanager/ViewManagerModel.d.ts +149 -0
  23. package/build/types/core/persist/viewmanager/ViewManagerProvider.d.ts +10 -0
  24. package/build/types/core/persist/viewmanager/impl/ManageDialogModel.d.ts +30 -0
  25. package/build/types/core/persist/viewmanager/impl/SaveDialogModel.d.ts +23 -0
  26. package/build/types/core/persist/viewmanager/index.d.ts +2 -0
  27. package/build/types/desktop/cmp/button/ColAutosizeButton.d.ts +1 -1
  28. package/build/types/desktop/cmp/dash/DashConfig.d.ts +3 -1
  29. package/build/types/desktop/cmp/dash/DashModel.d.ts +1 -2
  30. package/build/types/desktop/cmp/dash/DashViewSpec.d.ts +1 -1
  31. package/build/types/desktop/cmp/dash/canvas/DashCanvasModel.d.ts +10 -2
  32. package/build/types/desktop/cmp/dash/container/DashContainerModel.d.ts +26 -10
  33. package/build/types/desktop/cmp/dash/container/impl/DashContainerUtils.d.ts +4 -2
  34. package/build/types/desktop/cmp/panel/PanelModel.d.ts +8 -4
  35. package/build/types/desktop/cmp/viewmanager/ViewManager.d.ts +22 -0
  36. package/build/types/desktop/cmp/viewmanager/cmp/ManageDialog.d.ts +6 -0
  37. package/build/types/desktop/cmp/viewmanager/cmp/SaveDialog.d.ts +2 -0
  38. package/build/types/desktop/cmp/viewmanager/index.d.ts +3 -0
  39. package/build/types/kit/blueprint/Wrappers.d.ts +1 -1
  40. package/build/types/mobile/cmp/button/ColAutosizeButton.d.ts +1 -1
  41. package/build/types/svc/GridAutosizeService.d.ts +2 -5
  42. package/build/types/svc/JsonBlobService.d.ts +45 -24
  43. package/cmp/filter/FilterChooserModel.ts +142 -125
  44. package/cmp/grid/Grid.ts +2 -10
  45. package/cmp/grid/GridModel.ts +18 -31
  46. package/cmp/grid/Types.ts +7 -21
  47. package/cmp/grid/columns/Column.ts +0 -1
  48. package/cmp/grid/impl/InitPersist.ts +71 -0
  49. package/cmp/grouping/GroupingChooserModel.ts +48 -57
  50. package/cmp/tab/TabContainerModel.ts +22 -36
  51. package/cmp/zoneGrid/Types.ts +6 -6
  52. package/cmp/zoneGrid/ZoneGridModel.ts +2 -7
  53. package/cmp/zoneGrid/impl/InitPersist.ts +70 -0
  54. package/core/HoistBase.ts +14 -22
  55. package/core/HoistBaseDecorators.ts +26 -28
  56. package/core/persist/CustomProvider.ts +7 -10
  57. package/core/persist/DashViewProvider.ts +8 -10
  58. package/core/persist/LocalStorageProvider.ts +9 -12
  59. package/core/persist/PersistOptions.ts +6 -4
  60. package/core/persist/Persistable.ts +23 -0
  61. package/core/persist/PersistenceProvider.ts +159 -79
  62. package/core/persist/PrefProvider.ts +9 -12
  63. package/core/persist/index.ts +2 -0
  64. package/core/persist/viewmanager/Types.ts +51 -0
  65. package/core/persist/viewmanager/ViewManagerModel.ts +515 -0
  66. package/core/persist/viewmanager/ViewManagerProvider.ts +51 -0
  67. package/core/persist/viewmanager/impl/ManageDialogModel.ts +274 -0
  68. package/core/persist/viewmanager/impl/SaveDialogModel.ts +112 -0
  69. package/core/persist/viewmanager/index.ts +2 -0
  70. package/desktop/cmp/button/ColAutosizeButton.ts +1 -1
  71. package/desktop/cmp/dash/DashConfig.ts +3 -1
  72. package/desktop/cmp/dash/DashModel.ts +1 -2
  73. package/desktop/cmp/dash/DashViewSpec.ts +1 -1
  74. package/desktop/cmp/dash/canvas/DashCanvasModel.ts +31 -30
  75. package/desktop/cmp/dash/container/DashContainerModel.ts +68 -43
  76. package/desktop/cmp/dash/container/impl/DashContainerUtils.ts +13 -4
  77. package/desktop/cmp/leftrightchooser/LeftRightChooserFilter.ts +1 -1
  78. package/desktop/cmp/panel/PanelModel.ts +33 -53
  79. package/desktop/cmp/store/impl/StoreFilterField.ts +1 -1
  80. package/desktop/cmp/viewmanager/ViewManager.scss +58 -0
  81. package/desktop/cmp/viewmanager/ViewManager.ts +274 -0
  82. package/desktop/cmp/viewmanager/cmp/ManageDialog.ts +197 -0
  83. package/desktop/cmp/viewmanager/cmp/SaveDialog.ts +89 -0
  84. package/desktop/cmp/viewmanager/index.ts +3 -0
  85. package/mobile/cmp/button/ColAutosizeButton.ts +1 -1
  86. package/package.json +1 -1
  87. package/svc/GridAutosizeService.ts +73 -36
  88. package/svc/JsonBlobService.ts +64 -31
  89. package/tsconfig.tsbuildinfo +1 -1
  90. package/build/types/cmp/grid/impl/GridPersistenceModel.d.ts +0 -41
  91. package/build/types/cmp/zoneGrid/impl/ZoneGridPersistenceModel.d.ts +0 -39
  92. package/cmp/grid/impl/GridPersistenceModel.ts +0 -174
  93. package/cmp/zoneGrid/impl/ZoneGridPersistenceModel.ts +0 -149
@@ -5,20 +5,21 @@
5
5
  * Copyright © 2024 Extremely Heavy Industries Inc.
6
6
  */
7
7
 
8
- import {PersistenceProvider, PersistOptions} from './';
8
+ import {XH} from '@xh/hoist/core';
9
9
  import {throwIf} from '@xh/hoist/utils/js';
10
- import {XH} from '../';
10
+ import {PersistenceProvider, PersistenceProviderConfig} from './';
11
11
 
12
12
  /**
13
13
  * PersistenceProvider that stores state within the Browser's LocalStorage.
14
14
  */
15
- export class LocalStorageProvider extends PersistenceProvider {
16
- key: string;
15
+ export class LocalStorageProvider<S> extends PersistenceProvider<S> {
16
+ readonly key: string;
17
17
 
18
- constructor({localStorageKey: key, ...rest}: PersistOptions) {
19
- throwIf(!key, `LocalStorageProvider requires a 'localStorageKey'.`);
20
- super(rest);
21
- this.key = key;
18
+ constructor(cfg: PersistenceProviderConfig<S>) {
19
+ super(cfg);
20
+ const {localStorageKey} = cfg.persistOptions;
21
+ throwIf(!localStorageKey, `LocalStorageProvider requires a 'localStorageKey'.`);
22
+ this.key = localStorageKey;
22
23
  }
23
24
 
24
25
  //----------------
@@ -31,8 +32,4 @@ export class LocalStorageProvider extends PersistenceProvider {
31
32
  override writeRaw(data) {
32
33
  XH.localStorageService.set(this.key, data);
33
34
  }
34
-
35
- override clearRaw() {
36
- XH.localStorageService.remove(this.key);
37
- }
38
35
  }
@@ -6,10 +6,9 @@
6
6
  */
7
7
 
8
8
  import {DebounceSpec} from '../';
9
+ import type {DashViewModel} from '@xh/hoist/desktop/cmp/dash'; // Import type only
10
+ import type {ViewManagerModel} from '@xh/hoist/core/persist/viewmanager'; // Import type only
9
11
 
10
- /**
11
- * Options governing persistence.
12
- */
13
12
  export interface PersistOptions {
14
13
  /** Dot delimited path to store state. */
15
14
  path?: string;
@@ -30,7 +29,10 @@ export interface PersistOptions {
30
29
  localStorageKey?: string;
31
30
 
32
31
  /** DashViewModel used to read / write view state. */
33
- dashViewModel?: object;
32
+ dashViewModel?: DashViewModel;
33
+
34
+ /** ViewManagerModel used to read / write view state. */
35
+ viewManagerModel?: ViewManagerModel;
34
36
 
35
37
  /**
36
38
  * Function returning blob of data to be used for reading state.
@@ -0,0 +1,23 @@
1
+ import {isEqual} from 'lodash';
2
+
3
+ /**
4
+ * Interface for objects that can be bound to a {@link PersistenceProvider}.
5
+ * @typeParam S - must be serializable to JSON and PersistableState<S> must be observable
6
+ */
7
+ export interface Persistable<S> {
8
+ getPersistableState(): PersistableState<S>;
9
+ setPersistableState(state: PersistableState<S>): void;
10
+ }
11
+
12
+ /** Wrapper for a serializable Persistable state object. */
13
+ export class PersistableState<S> {
14
+ value: S;
15
+
16
+ constructor(value: S) {
17
+ this.value = value;
18
+ }
19
+
20
+ equals(other: PersistableState<S>): boolean {
21
+ return isEqual(this.value, other.value);
22
+ }
23
+ }
@@ -5,24 +5,39 @@
5
5
  * Copyright © 2024 Extremely Heavy Industries Inc.
6
6
  */
7
7
 
8
- import {DebounceSpec, XH} from '../';
9
- import {
10
- LocalStorageProvider,
11
- PrefProvider,
12
- DashViewProvider,
13
- CustomProvider,
14
- PersistOptions
15
- } from './';
8
+ import {logDebug, logError, throwIf} from '@xh/hoist/utils/js';
16
9
  import {
17
10
  cloneDeep,
18
- isUndefined,
11
+ debounce as lodashDebounce,
19
12
  get,
20
- set,
21
- unset,
13
+ isEmpty,
22
14
  isNumber,
23
- debounce as lodashDebounce
15
+ isUndefined,
16
+ set,
17
+ toPath
24
18
  } from 'lodash';
25
- import {throwIf} from '@xh/hoist/utils/js';
19
+ import {IReactionDisposer, reaction} from 'mobx';
20
+ import {DebounceSpec, HoistBase, Persistable, PersistableState, XH} from '../';
21
+ import {
22
+ CustomProvider,
23
+ DashViewProvider,
24
+ LocalStorageProvider,
25
+ PersistOptions,
26
+ PrefProvider,
27
+ ViewManagerProvider
28
+ } from './';
29
+
30
+ export type PersistenceProviderConfig<S> =
31
+ | {
32
+ persistOptions: PersistOptions;
33
+ target: Persistable<S>;
34
+ owner: HoistBase;
35
+ }
36
+ | {
37
+ persistOptions: PersistOptions;
38
+ target: Persistable<S> & HoistBase;
39
+ owner?: HoistBase;
40
+ };
26
41
 
27
42
  /**
28
43
  * Abstract superclass for adaptor objects used by models and components to (re)store state to and
@@ -32,51 +47,130 @@ import {throwIf} from '@xh/hoist/utils/js';
32
47
  * Implementations should take care to incorporate any writes immediately into the readable state.
33
48
  *
34
49
  * Hoist-provided implementations include:
35
- * - {@link PrefProvider} - stores state in a predefined Hoist application Preference.
36
- * - {@link LocalStorageProvider} - stores state in browser local storage under a configured key.
37
- * - {@link DashViewProvider} - stores state with other Dashboard-specific state via a `DashViewModel`.
50
+ * - {@link PrefProvider} - persists to a predefined Hoist JSON Preference.
51
+ * - {@link LocalStorageProvider} - persists to browser local storage under a configured key.
52
+ * - {@link DashViewProvider} - persists to a bound `DashViewModel` to save state for components
53
+ * used within a dashboard widget. For this to be useful, the parent {@link DashModel} must
54
+ * itself be persisted via a different provider - it acts as a collector of the widget-level
55
+ * state managed by its DashViewModels and this provider.
56
+ * - {@link ViewManagerProvider} - persists to saved views managed by {@link ViewManagerModel}.
38
57
  * - {@link CustomProvider} - API for app and components to provide their own storage mechanism.
39
58
  */
40
- export class PersistenceProvider {
41
- get isPersistenceProvider(): boolean {
42
- return true;
43
- }
59
+ export abstract class PersistenceProvider<S> {
60
+ readonly path: string;
61
+ readonly debounce: DebounceSpec;
62
+ readonly owner: HoistBase;
44
63
 
45
- path: string;
46
- debounce: DebounceSpec;
64
+ protected target: Persistable<S>;
65
+ protected defaultState: PersistableState<S>;
66
+
67
+ private disposer: IReactionDisposer;
47
68
 
48
69
  /**
49
70
  * Construct an instance of this class.
71
+ *
72
+ * Will fail gently, returning `null` and logging an error if the provider could not be created
73
+ * due to an unparseable config or failure on initial read.
74
+ *
75
+ * Note: Targets should initialize their default persistable state *before* creating a
76
+ * `PersistenceProvider` and defer creating reactions to persistable state until *after*. This
77
+ * allows the provider to capture the default state and then apply any persisted state to the
78
+ * target without thrashing.
50
79
  */
51
- static create({type, ...rest}: PersistOptions): PersistenceProvider {
52
- if (!type) {
53
- if (rest.prefKey) type = 'pref';
54
- if (rest.localStorageKey) type = 'localStorage';
55
- if (rest.dashViewModel) type = 'dashView';
56
- if (rest.getData || rest.setData) type = 'custom';
57
- }
80
+ static create<S>(cfg: PersistenceProviderConfig<S>): PersistenceProvider<S> {
81
+ cfg = {
82
+ owner: cfg.target instanceof HoistBase ? cfg.target : cfg.owner,
83
+ ...cfg
84
+ };
85
+ const {target, persistOptions} = cfg;
86
+
87
+ let {type, ...rest} = persistOptions,
88
+ ret: PersistenceProvider<S>;
58
89
 
59
- switch (type) {
60
- case 'pref':
61
- return new PrefProvider(rest);
62
- case 'localStorage':
63
- return new LocalStorageProvider(rest);
64
- case `dashView`:
65
- return new DashViewProvider(rest);
66
- case 'custom':
67
- return new CustomProvider(rest);
68
- default:
69
- throw XH.exception(`Unknown Persistence Provider for type: ${type}`);
90
+ try {
91
+ if (!type) {
92
+ if (rest.prefKey) type = 'pref';
93
+ if (rest.localStorageKey) type = 'localStorage';
94
+ if (rest.dashViewModel) type = 'dashView';
95
+ if (rest.viewManagerModel) type = 'viewManager';
96
+ if (rest.getData || rest.setData) type = 'custom';
97
+ }
98
+
99
+ switch (type) {
100
+ case 'pref':
101
+ ret = new PrefProvider(cfg);
102
+ break;
103
+ case 'localStorage':
104
+ ret = new LocalStorageProvider(cfg);
105
+ break;
106
+ case `dashView`:
107
+ ret = new DashViewProvider(cfg);
108
+ break;
109
+ case `viewManager`:
110
+ ret = new ViewManagerProvider(cfg);
111
+ break;
112
+ case 'custom':
113
+ ret = new CustomProvider(cfg);
114
+ break;
115
+ default:
116
+ throw XH.exception(`Unknown Persistence Provider for type: ${type}`);
117
+ }
118
+
119
+ ret.bindToTarget(target);
120
+ return ret;
121
+ } catch (e) {
122
+ logError(e, cfg.owner);
123
+ ret?.destroy();
124
+ return null;
70
125
  }
71
126
  }
72
127
 
73
- /**
74
- * Called by implementations only. See create.
75
- */
76
- protected constructor({path, debounce = 250}: PersistOptions) {
77
- throwIf(isUndefined(path), 'Path not specified in PersistenceProvider.');
128
+ /** Read persisted state at this provider's path. */
129
+ read(): PersistableState<S> {
130
+ const state = get(this.readRaw(), this.path);
131
+ logDebug(['Reading state', state], this.owner);
132
+ return !isUndefined(state) ? new PersistableState(state) : null;
133
+ }
134
+
135
+ /** Persist JSON-serializable state to this provider's path. */
136
+ write(state: S) {
137
+ logDebug(['Writing state', state], this.owner);
138
+ this.writeInternal(state);
139
+ }
140
+
141
+ /** Clear any persisted data at a path. Also clears any parent objects that become empty. */
142
+ clear() {
143
+ logDebug('Clearing state', this.owner);
144
+ const obj = cloneDeep(this.readRaw()),
145
+ path = toPath(this.path);
146
+ do {
147
+ const property = path.pop(),
148
+ parent = isEmpty(path) ? obj : get(obj, path);
149
+ if (parent) delete parent[property];
150
+ if (!isEmpty(parent)) break;
151
+ } while (!isEmpty(path));
152
+ this.writeRaw(obj);
153
+ }
154
+
155
+ destroy() {
156
+ this.disposer?.();
157
+ }
158
+
159
+ //----------------
160
+ // Protected API
161
+ //----------------
162
+ /** Called by implementations only. Use the {@link create} factory instead. */
163
+ protected constructor(cfg: PersistenceProviderConfig<S>) {
164
+ const {owner, persistOptions} = cfg;
165
+ this.owner = owner;
166
+
167
+ const {path, debounce = 250} = persistOptions;
168
+ throwIf(!path, 'Path not specified in PersistenceProvider.');
169
+
78
170
  this.path = path;
79
171
  this.debounce = debounce;
172
+ this.owner.markManaged(this);
173
+
80
174
  if (debounce) {
81
175
  this.writeInternal = isNumber(debounce)
82
176
  ? lodashDebounce(this.writeInternal, debounce)
@@ -84,49 +178,35 @@ export class PersistenceProvider {
84
178
  }
85
179
  }
86
180
 
87
- /**
88
- * Read data at a path
89
- */
90
- read(): any {
91
- return get(this.readRaw(), this.path);
92
- }
181
+ /** Called by factory method to bind this provider to its target. */
182
+ protected bindToTarget(target: Persistable<S>) {
183
+ this.target = target;
184
+ this.defaultState = target.getPersistableState();
93
185
 
94
- /**
95
- * Save data at a path
96
- * @param data - data to be written to the path, must be serializable to JSON.
97
- */
98
- write(data: any) {
99
- this.writeInternal(data);
100
- }
186
+ const state = this.read();
187
+ if (state) target.setPersistableState(state);
101
188
 
102
- /**
103
- * Clear any state saved by this object at a path
104
- */
105
- clear(path: string = this.path) {
106
- const obj = cloneDeep(this.readRaw());
107
- unset(obj, this.path);
108
- this.writeRaw(obj);
189
+ // Direct use of MobX reaction to avoid circular dependency with HoistBase
190
+ this.disposer = reaction(
191
+ () => this.target.getPersistableState(),
192
+ state => {
193
+ if (state.equals(this.defaultState)) {
194
+ this.clear();
195
+ } else {
196
+ this.write(state.value);
197
+ }
198
+ }
199
+ );
109
200
  }
110
201
 
111
- /**
112
- * Clear *all* state held by this object.
113
- */
114
- clearAll() {
115
- this.clearRaw();
116
- }
117
-
118
- //----------------
119
- // Implementation
120
- //----------------
121
- protected writeInternal(data: object) {
202
+ protected writeInternal(data: S) {
122
203
  const obj = cloneDeep(this.readRaw());
123
204
  set(obj, this.path, data);
124
205
  this.writeRaw(obj);
125
206
  }
126
207
 
127
- protected writeRaw(obj: object) {}
128
- protected readRaw(): object {
208
+ protected writeRaw(obj: Record<typeof this.path, S>) {}
209
+ protected readRaw(): Record<typeof this.path, S> {
129
210
  return null;
130
211
  }
131
- protected clearRaw() {}
132
212
  }
@@ -5,20 +5,21 @@
5
5
  * Copyright © 2024 Extremely Heavy Industries Inc.
6
6
  */
7
7
 
8
- import {XH} from '../';
9
- import {PersistenceProvider, PersistOptions} from './';
8
+ import {PersistenceProviderConfig, XH} from '../';
9
+ import {PersistenceProvider} from './';
10
10
  import {throwIf} from '@xh/hoist/utils/js';
11
11
 
12
12
  /**
13
13
  * PersistenceProvider that stores state within the Hoist Preferences system.
14
14
  */
15
- export class PrefProvider extends PersistenceProvider {
16
- key: string;
15
+ export class PrefProvider<S> extends PersistenceProvider<S> {
16
+ readonly key: string;
17
17
 
18
- constructor({prefKey: key, ...rest}: PersistOptions) {
19
- throwIf(!key, `PrefProvider requires a 'prefKey'.`);
20
- super(rest);
21
- this.key = key;
18
+ constructor(cfg: PersistenceProviderConfig<S>) {
19
+ super(cfg);
20
+ const {prefKey} = cfg.persistOptions;
21
+ throwIf(!prefKey, `PrefProvider requires a 'prefKey'.`);
22
+ this.key = prefKey;
22
23
  }
23
24
 
24
25
  //----------------
@@ -31,8 +32,4 @@ export class PrefProvider extends PersistenceProvider {
31
32
  override writeRaw(data) {
32
33
  XH.prefService.set(this.key, data);
33
34
  }
34
-
35
- override clearRaw() {
36
- XH.prefService.unset(this.key);
37
- }
38
35
  }
@@ -1,6 +1,8 @@
1
+ export * from './Persistable';
1
2
  export * from './PersistOptions';
2
3
  export * from './PersistenceProvider';
3
4
  export * from './LocalStorageProvider';
4
5
  export * from './DashViewProvider';
5
6
  export * from './PrefProvider';
6
7
  export * from './CustomProvider';
8
+ export * from './viewmanager/ViewManagerProvider';
@@ -0,0 +1,51 @@
1
+ import {PlainObject} from '@xh/hoist/core';
2
+
3
+ /**
4
+ * Interface for a bundle of {@link PersistableState} managed by {@link ViewManagerModel}.
5
+ * Views are persisted to / loaded from the server as {@link JsonBlob}s.
6
+ */
7
+ export interface View<T extends PlainObject = PlainObject> {
8
+ /** Either null for private views or special token "*" for globally shared views. */
9
+ acl: '*' | null;
10
+ dateCreated: number;
11
+ description: string;
12
+ /** Calculated display group - either "Shared [entityName]" or "My [entityName]". */
13
+ group: string;
14
+ /**
15
+ * True if user has tagged this view as a favorite. Note that a user's list of favorite views is
16
+ * persisted via `ViewManagerModel.persistWith` and *not* stored in the blob itself.
17
+ */
18
+ isFavorite: boolean;
19
+ /** True if this view has been shared (acl == "*") and is visible to all users. */
20
+ isShared: boolean;
21
+ lastUpdated: number;
22
+ lastUpdatedBy: string;
23
+ /** User-supplied descriptive name. */
24
+ name: string;
25
+ /** Original creator of the view, and the only user with access to it if not shared. */
26
+ owner: string;
27
+ token: string;
28
+ /** App-defined type discriminator, as per {@link ViewManagerConfig.viewType}. */
29
+ type: string;
30
+ value: T;
31
+ }
32
+
33
+ /**
34
+ * Abstract representation of ViewManager views available for selection, potentially grouped into
35
+ * hierarchical folders. Lightweight, user-driven organization into "folders" is supported by
36
+ * inserting a "\" in the name of any view.
37
+ */
38
+ export type ViewTree = {
39
+ text: string;
40
+ selected: boolean;
41
+ } & (
42
+ | {
43
+ type: 'folder';
44
+ items: ViewTree[];
45
+ }
46
+ | {
47
+ type: 'view';
48
+ token: string;
49
+ description: string;
50
+ }
51
+ );