@xh/hoist 71.0.0-SNAPSHOT.1733198772915 → 71.0.0-SNAPSHOT.1733266596001
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/CHANGELOG.md +8 -2
- package/appcontainer/AppContainerModel.ts +2 -1
- package/build/types/cmp/chart/impl/copyToClipboard.d.ts +1 -2
- package/build/types/cmp/viewmanager/SaveAsDialogModel.d.ts +23 -0
- package/build/types/cmp/viewmanager/View.d.ts +28 -0
- package/build/types/cmp/viewmanager/ViewInfo.d.ts +30 -0
- package/build/types/cmp/viewmanager/ViewManagerModel.d.ts +185 -0
- package/build/types/cmp/viewmanager/index.d.ts +4 -0
- package/build/types/core/XH.d.ts +2 -1
- package/build/types/core/persist/PersistOptions.d.ts +3 -1
- package/build/types/core/persist/index.d.ts +6 -5
- package/build/types/core/persist/{CustomProvider.d.ts → provider/CustomProvider.d.ts} +1 -1
- package/build/types/core/persist/{DashViewProvider.d.ts → provider/DashViewProvider.d.ts} +2 -2
- package/build/types/core/persist/{LocalStorageProvider.d.ts → provider/LocalStorageProvider.d.ts} +1 -1
- package/build/types/core/persist/{PrefProvider.d.ts → provider/PrefProvider.d.ts} +1 -2
- package/build/types/core/persist/provider/SessionStorageProvider.d.ts +10 -0
- package/build/types/core/persist/{viewmanager → provider}/ViewManagerProvider.d.ts +3 -3
- package/build/types/desktop/cmp/viewmanager/ViewManager.d.ts +9 -10
- package/build/types/desktop/cmp/viewmanager/ViewMenu.d.ts +5 -0
- package/build/types/desktop/cmp/viewmanager/dialog/EditForm.d.ts +5 -0
- package/build/types/desktop/cmp/viewmanager/dialog/EditFormModel.d.ts +18 -0
- package/build/types/desktop/cmp/viewmanager/dialog/ManageDialog.d.ts +5 -0
- package/build/types/desktop/cmp/viewmanager/dialog/ManageDialogModel.d.ts +38 -0
- package/build/types/desktop/cmp/viewmanager/dialog/SaveAsDialog.d.ts +5 -0
- package/build/types/svc/JsonBlobService.d.ts +1 -1
- package/build/types/svc/index.d.ts +2 -1
- package/build/types/svc/storage/BaseStorageService.d.ts +21 -0
- package/build/types/svc/storage/LocalStorageService.d.ts +12 -0
- package/build/types/svc/storage/SessionStorageService.d.ts +12 -0
- package/cmp/chart/impl/copyToClipboard.ts +1 -2
- package/cmp/viewmanager/SaveAsDialogModel.ts +97 -0
- package/cmp/viewmanager/View.ts +56 -0
- package/cmp/viewmanager/ViewInfo.ts +58 -0
- package/cmp/viewmanager/ViewManagerModel.ts +710 -0
- package/cmp/viewmanager/index.ts +4 -0
- package/core/XH.ts +2 -0
- package/core/persist/PersistOptions.ts +4 -1
- package/core/persist/PersistenceProvider.ts +5 -0
- package/core/persist/index.ts +6 -5
- package/core/persist/{CustomProvider.ts → provider/CustomProvider.ts} +1 -1
- package/core/persist/{DashViewProvider.ts → provider/DashViewProvider.ts} +1 -1
- package/core/persist/{LocalStorageProvider.ts → provider/LocalStorageProvider.ts} +1 -1
- package/core/persist/{PrefProvider.ts → provider/PrefProvider.ts} +2 -2
- package/core/persist/provider/SessionStorageProvider.ts +35 -0
- package/core/persist/{viewmanager → provider}/ViewManagerProvider.ts +5 -9
- package/desktop/cmp/viewmanager/ViewManager.ts +47 -229
- package/desktop/cmp/viewmanager/ViewMenu.ts +191 -0
- package/desktop/cmp/viewmanager/dialog/EditForm.ts +126 -0
- package/desktop/cmp/viewmanager/dialog/EditFormModel.ts +125 -0
- package/desktop/cmp/viewmanager/dialog/ManageDialog.ts +98 -0
- package/desktop/cmp/viewmanager/dialog/ManageDialogModel.ts +279 -0
- package/desktop/cmp/viewmanager/{impl/SaveDialog.ts → dialog/SaveAsDialog.ts} +20 -12
- package/package.json +1 -1
- package/svc/JsonBlobService.ts +1 -1
- package/svc/index.ts +2 -1
- package/svc/{LocalStorageService.ts → storage/BaseStorageService.ts} +13 -23
- package/svc/storage/LocalStorageService.ts +23 -0
- package/svc/storage/SessionStorageService.ts +23 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/build/types/core/persist/viewmanager/Types.d.ts +0 -48
- package/build/types/core/persist/viewmanager/ViewManagerModel.d.ts +0 -145
- package/build/types/core/persist/viewmanager/impl/BuildViewTree.d.ts +0 -8
- package/build/types/core/persist/viewmanager/impl/ManageDialogModel.d.ts +0 -30
- package/build/types/core/persist/viewmanager/impl/SaveDialogModel.d.ts +0 -23
- package/build/types/core/persist/viewmanager/index.d.ts +0 -2
- package/build/types/desktop/cmp/viewmanager/impl/ManageDialog.d.ts +0 -6
- package/build/types/desktop/cmp/viewmanager/impl/SaveDialog.d.ts +0 -2
- package/build/types/svc/LocalStorageService.d.ts +0 -24
- package/core/persist/viewmanager/Types.ts +0 -53
- package/core/persist/viewmanager/ViewManagerModel.ts +0 -481
- package/core/persist/viewmanager/impl/BuildViewTree.ts +0 -68
- package/core/persist/viewmanager/impl/ManageDialogModel.ts +0 -276
- package/core/persist/viewmanager/impl/SaveDialogModel.ts +0 -112
- package/core/persist/viewmanager/index.ts +0 -2
- package/desktop/cmp/viewmanager/impl/ManageDialog.ts +0 -197
package/CHANGELOG.md
CHANGED
|
@@ -2,9 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
## v71.0.0-SNAPSHOT - unreleased
|
|
4
4
|
|
|
5
|
+
### 🎁 New Features
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
*
|
|
7
|
+
* Major Improvements to ViewManager component
|
|
8
|
+
* Support for persisting pending value.
|
|
9
|
+
* Handle delete and update collisions more gracefully.
|
|
10
|
+
* Support for `settleTime`,
|
|
11
|
+
* Improved management UI Dialog.
|
|
12
|
+
* New `SessionStorageService` and associated persistence provider provides support for saving
|
|
13
|
+
tab local data across reloads.
|
|
8
14
|
|
|
9
15
|
|
|
10
16
|
## v70.0.0 - 2024-11-15
|
|
@@ -36,6 +36,7 @@ import {
|
|
|
36
36
|
JsonBlobService,
|
|
37
37
|
LocalStorageService,
|
|
38
38
|
PrefService,
|
|
39
|
+
SessionStorageService,
|
|
39
40
|
TrackService,
|
|
40
41
|
WebSocketService
|
|
41
42
|
} from '@xh/hoist/svc';
|
|
@@ -217,7 +218,7 @@ export class AppContainerModel extends HoistModel {
|
|
|
217
218
|
}
|
|
218
219
|
|
|
219
220
|
// Complete initialization process
|
|
220
|
-
await installServicesAsync([ConfigService, LocalStorageService]);
|
|
221
|
+
await installServicesAsync([ConfigService, LocalStorageService, SessionStorageService]);
|
|
221
222
|
await installServicesAsync(TrackService);
|
|
222
223
|
await installServicesAsync([EnvironmentService, PrefService, JsonBlobService]);
|
|
223
224
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copy the chart in
|
|
3
|
-
* Works only on webkit based browsers.
|
|
2
|
+
* Copy the chart in its current state to the clipboard - supported for webkit based browsers only.
|
|
4
3
|
* @internal
|
|
5
4
|
*/
|
|
6
5
|
export declare function installCopyToClipboard(Highcharts: any): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { FormModel } from '@xh/hoist/cmp/form';
|
|
2
|
+
import { HoistModel } from '@xh/hoist/core';
|
|
3
|
+
import { View } from './View';
|
|
4
|
+
import { ViewManagerModel } from './ViewManagerModel';
|
|
5
|
+
/**
|
|
6
|
+
* Backing model for ViewManagerModel's SaveAs
|
|
7
|
+
*/
|
|
8
|
+
export declare class SaveAsDialogModel extends HoistModel {
|
|
9
|
+
readonly parent: ViewManagerModel;
|
|
10
|
+
readonly formModel: FormModel;
|
|
11
|
+
isOpen: boolean;
|
|
12
|
+
private resolveOpen;
|
|
13
|
+
get type(): string;
|
|
14
|
+
get typeDisplayName(): string;
|
|
15
|
+
get globalDisplayName(): string;
|
|
16
|
+
constructor(parent: ViewManagerModel);
|
|
17
|
+
openAsync(): Promise<View>;
|
|
18
|
+
cancel(): void;
|
|
19
|
+
saveAsAsync(): Promise<void>;
|
|
20
|
+
private createFormModel;
|
|
21
|
+
private doSaveAsAsync;
|
|
22
|
+
private close;
|
|
23
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { PlainObject } from '@xh/hoist/core';
|
|
2
|
+
import { ViewManagerModel } from './ViewManagerModel';
|
|
3
|
+
import { ViewInfo } from './ViewInfo';
|
|
4
|
+
import { JsonBlob } from '@xh/hoist/svc';
|
|
5
|
+
/**
|
|
6
|
+
* A named saved bundle of state for components.
|
|
7
|
+
*/
|
|
8
|
+
export declare class View<T extends PlainObject = PlainObject> {
|
|
9
|
+
/**
|
|
10
|
+
* Default View representing code state of all contained components.
|
|
11
|
+
* Available for all view managers where `enableDefault` is true.
|
|
12
|
+
*/
|
|
13
|
+
/** Metadata about this View. Null for 'default' view */
|
|
14
|
+
readonly info: ViewInfo;
|
|
15
|
+
/**
|
|
16
|
+
* State for the components in the view. Only state that differs from the initial "code"
|
|
17
|
+
* state of the components is captured.
|
|
18
|
+
*/
|
|
19
|
+
readonly value: Partial<T>;
|
|
20
|
+
get isDefault(): boolean;
|
|
21
|
+
get isGlobal(): boolean;
|
|
22
|
+
get lastUpdated(): number;
|
|
23
|
+
get token(): string;
|
|
24
|
+
static fromBlob<T>(blob: JsonBlob, model: ViewManagerModel): View<T>;
|
|
25
|
+
static createDefault<T>(): View<T>;
|
|
26
|
+
withUpdatedValue(value: Partial<T>): View<T>;
|
|
27
|
+
constructor(info: ViewInfo, value: Partial<T>);
|
|
28
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ViewManagerModel } from './ViewManagerModel';
|
|
2
|
+
import { JsonBlob } from '@xh/hoist/svc';
|
|
3
|
+
/**
|
|
4
|
+
* Metadata describing {@link View} managed by {@link ViewManagerModel}.
|
|
5
|
+
*/
|
|
6
|
+
export declare class ViewInfo {
|
|
7
|
+
/** Unique Id */
|
|
8
|
+
readonly token: string;
|
|
9
|
+
/** App-defined type discriminator, as per {@link ViewManagerConfig.viewType}. */
|
|
10
|
+
readonly type: string;
|
|
11
|
+
/** User-supplied descriptive name. */
|
|
12
|
+
readonly name: string;
|
|
13
|
+
/** Description of the view. **/
|
|
14
|
+
readonly description: string;
|
|
15
|
+
/** True if this view is global and visible to all users. */
|
|
16
|
+
readonly isGlobal: boolean;
|
|
17
|
+
/** Original creator of the view, and the only user with access to it if not global. */
|
|
18
|
+
readonly owner: string;
|
|
19
|
+
dateCreated: number;
|
|
20
|
+
lastUpdated: number;
|
|
21
|
+
lastUpdatedBy: string;
|
|
22
|
+
private readonly model;
|
|
23
|
+
constructor(blob: JsonBlob, model: ViewManagerModel);
|
|
24
|
+
/**
|
|
25
|
+
* True if user has tagged this view as a favorite. Note that a user's list of favorite views
|
|
26
|
+
* is persisted via `ViewManagerModel.persistWith` and *not* stored in the blob itself.
|
|
27
|
+
*/
|
|
28
|
+
get isFavorite(): boolean;
|
|
29
|
+
get typedName(): string;
|
|
30
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { HoistModel, LoadSpec, PersistOptions, PlainObject, TaskObserver, Thunkable } from '@xh/hoist/core';
|
|
2
|
+
import type { ViewManagerProvider } from '@xh/hoist/core';
|
|
3
|
+
import { SaveAsDialogModel } from './SaveAsDialogModel';
|
|
4
|
+
import { ViewInfo } from './ViewInfo';
|
|
5
|
+
import { View } from './View';
|
|
6
|
+
export interface ViewManagerConfig {
|
|
7
|
+
/**
|
|
8
|
+
* True (default) to allow user to opt in to automatically saving changes to their current view.
|
|
9
|
+
*/
|
|
10
|
+
enableAutoSave?: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* True (default) to allow the user to select a "Default" option that restores all persisted
|
|
13
|
+
* objects to their in-code defaults. If not enabled, at least one saved view should be created
|
|
14
|
+
* in advance, so that there is a clear initial selection for users without any private views.
|
|
15
|
+
*/
|
|
16
|
+
enableDefault?: boolean;
|
|
17
|
+
/** True (default) to allow user to mark views as favorites. Requires `persistWith`. */
|
|
18
|
+
enableFavorites?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Function to determine the initial view for a user, when no view has already been persisted.
|
|
21
|
+
* Will be passed a list of views available to the current user. Implementations where
|
|
22
|
+
* enableDefault is set false should typically return some view, if any views are
|
|
23
|
+
* available. If no view is returned, the control will be forced to fall back on the default.
|
|
24
|
+
*
|
|
25
|
+
* Must be set when enableDefault is false.
|
|
26
|
+
*/
|
|
27
|
+
initialViewSpec?: (views: ViewInfo[]) => ViewInfo;
|
|
28
|
+
/**
|
|
29
|
+
* Delay after state has been set on associated components before they will be observed for
|
|
30
|
+
* any further state changes. Larger values may be useful when providing state to complex
|
|
31
|
+
* components such as dashboards or grids that may create dirty state immediately after load.
|
|
32
|
+
*
|
|
33
|
+
* Specified in milliseconds. Default is 250.
|
|
34
|
+
*/
|
|
35
|
+
settleTime?: number;
|
|
36
|
+
/**
|
|
37
|
+
* True to allow the user to publish or edit the global views. Apps are expected to
|
|
38
|
+
* commonly set this based on user roles - e.g. `XH.getUser().hasRole('MANAGE_GRID_VIEWS')`.
|
|
39
|
+
*/
|
|
40
|
+
manageGlobal?: Thunkable<boolean>;
|
|
41
|
+
/** Used to persist the user's state. */
|
|
42
|
+
persistWith?: ViewManagerPersistOptions;
|
|
43
|
+
/**
|
|
44
|
+
* Required discriminator for the particular class of views to be loaded and managed by this
|
|
45
|
+
* model. Set to something descriptive and specific enough to be identifiable and allow for
|
|
46
|
+
* different viewManagers to be added to your app in the future - e.g. `portfolioGridView` or
|
|
47
|
+
* `tradeBlotterDashboard`.
|
|
48
|
+
*/
|
|
49
|
+
viewType: string;
|
|
50
|
+
/**
|
|
51
|
+
* Optional user-facing display name for the view type, displayed in the ViewManager menu
|
|
52
|
+
* and associated management dialogs and prompts. Defaulted from `viewType` if not provided.
|
|
53
|
+
*/
|
|
54
|
+
typeDisplayName?: string;
|
|
55
|
+
/**
|
|
56
|
+
* Optional user-facing display name for describing global views. Defaults to 'global'
|
|
57
|
+
*/
|
|
58
|
+
globalDisplayName?: string;
|
|
59
|
+
}
|
|
60
|
+
export interface ViewManagerPersistOptions extends PersistOptions {
|
|
61
|
+
/** True to persist favorites or provide specific PersistOptions. (Default true) */
|
|
62
|
+
persistFavorites?: boolean | PersistOptions;
|
|
63
|
+
/** True to include pending value or provide specific PersistOptions. (Default false) */
|
|
64
|
+
persistPendingValue?: boolean | PersistOptions;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* ViewManagerModel coordinates the loading, saving, and management of user-defined bundles of
|
|
68
|
+
* {@link Persistable} component/model state.
|
|
69
|
+
*
|
|
70
|
+
* - Models to be persisted are bound to this model via their `persistWith` config. One or more
|
|
71
|
+
* models can be bound to a single ViewManagerModel, allowing a single view to capture the state
|
|
72
|
+
* of multiple components - e.g. grouping and filtering options along with grid state.
|
|
73
|
+
* - Views are persisted back to the server as JsonBlob objects.
|
|
74
|
+
* - Views can be private to their owner, or optionally enabled for global use by (all) other users.
|
|
75
|
+
* - Views can be marked as favorites for quick access.
|
|
76
|
+
* - See the desktop {@link ViewManager} component - the initial Hoist UI for this model.
|
|
77
|
+
*/
|
|
78
|
+
export declare class ViewManagerModel<T = PlainObject> extends HoistModel {
|
|
79
|
+
/**
|
|
80
|
+
* Factory to create new instances of this model and await its initial load before binding to
|
|
81
|
+
* any persistable component models. This ensures that bound models will have the expected
|
|
82
|
+
* initial persisted state applied within their constructor, before their components have
|
|
83
|
+
* rendered, and avoids thrashing of component state during initial load.
|
|
84
|
+
*
|
|
85
|
+
* To minimize the impact this async requirement has on the design and lifecycle of individual
|
|
86
|
+
* components within an app, consider eagerly constructing any viewManagerModels required within
|
|
87
|
+
* your `AppModel.initAsync` method and saving a reference to them there for component models
|
|
88
|
+
* to then use when they are mounted. The VM model instances will then be "ready to go" and
|
|
89
|
+
* usable within model constructors. (Initializing and referencing from one or more app
|
|
90
|
+
* services would be another, similar option.)
|
|
91
|
+
*
|
|
92
|
+
* Note that this method may throw if the ViewManager cannot be initialized successfully,
|
|
93
|
+
* but should generally fail quietly due to the early instantiation.
|
|
94
|
+
*/
|
|
95
|
+
static createAsync(config: ViewManagerConfig): Promise<ViewManagerModel>;
|
|
96
|
+
/** Immutable configuration for this model. */
|
|
97
|
+
readonly viewType: string;
|
|
98
|
+
readonly typeDisplayName: string;
|
|
99
|
+
readonly globalDisplayName: string;
|
|
100
|
+
readonly enableAutoSave: boolean;
|
|
101
|
+
readonly enableDefault: boolean;
|
|
102
|
+
readonly enableFavorites: boolean;
|
|
103
|
+
readonly manageGlobal: boolean;
|
|
104
|
+
readonly settleTime: number;
|
|
105
|
+
readonly initialViewSpec: (views: ViewInfo[]) => ViewInfo;
|
|
106
|
+
/** Current view. Will not include uncommitted changes */
|
|
107
|
+
view: View<T>;
|
|
108
|
+
/** Loaded saved view library - both private and global */
|
|
109
|
+
views: ViewInfo[];
|
|
110
|
+
/** List of tokens for the user's favorite views. */
|
|
111
|
+
favorites: string[];
|
|
112
|
+
/**
|
|
113
|
+
* True if user has opted-in to automatically saving changes to personal views (if auto-save
|
|
114
|
+
* generally available as per `enableAutoSave`).
|
|
115
|
+
*/
|
|
116
|
+
autoSave: boolean;
|
|
117
|
+
/**
|
|
118
|
+
* TaskObserver linked to {@link selectViewAsync}. If a change to the active view is likely to
|
|
119
|
+
* require intensive layout/grid work, consider masking affected components with this task.
|
|
120
|
+
*/
|
|
121
|
+
selectTask: TaskObserver;
|
|
122
|
+
/**
|
|
123
|
+
* TaskObserver linked to {@link saveAsync}.
|
|
124
|
+
*/
|
|
125
|
+
saveTask: TaskObserver;
|
|
126
|
+
manageDialogOpen: boolean;
|
|
127
|
+
readonly saveAsDialogModel: SaveAsDialogModel;
|
|
128
|
+
private pendingValue;
|
|
129
|
+
private lastPushed;
|
|
130
|
+
/**
|
|
131
|
+
* Array of {@link ViewManagerProvider} instances bound to this model. Providers will
|
|
132
|
+
* push themselves onto this array when constructed with a reference to this model. Used to
|
|
133
|
+
* proactively push state to the target components when the model's selected `value` changes.
|
|
134
|
+
*
|
|
135
|
+
* @internal
|
|
136
|
+
*/
|
|
137
|
+
providers: ViewManagerProvider<any>[];
|
|
138
|
+
persistWith: ViewManagerPersistOptions;
|
|
139
|
+
get isValueDirty(): boolean;
|
|
140
|
+
get isViewSavable(): boolean;
|
|
141
|
+
get isViewAutoSavable(): boolean;
|
|
142
|
+
get autoSaveUnavailableReason(): string;
|
|
143
|
+
get favoriteViews(): ViewInfo[];
|
|
144
|
+
get globalViews(): ViewInfo[];
|
|
145
|
+
get privateViews(): ViewInfo[];
|
|
146
|
+
/** True if any async tasks are pending. */
|
|
147
|
+
get isLoading(): boolean;
|
|
148
|
+
/**
|
|
149
|
+
* Use the static {@link createAsync} factory to create an instance of this model and await its
|
|
150
|
+
* initial load before binding to persistable components.
|
|
151
|
+
*/
|
|
152
|
+
private constructor();
|
|
153
|
+
private initAsync;
|
|
154
|
+
doLoadAsync(loadSpec: LoadSpec): Promise<void>;
|
|
155
|
+
selectViewAsync(info: ViewInfo): Promise<void>;
|
|
156
|
+
saveAsync(): Promise<void>;
|
|
157
|
+
saveAsAsync(): Promise<void>;
|
|
158
|
+
resetAsync(): Promise<void>;
|
|
159
|
+
getValue(): Partial<T>;
|
|
160
|
+
setValue(value: Partial<T>): void;
|
|
161
|
+
toggleFavorite(token: string): void;
|
|
162
|
+
addFavorite(token: string): void;
|
|
163
|
+
removeFavorite(token: string): void;
|
|
164
|
+
isFavorite(token: string): boolean;
|
|
165
|
+
openManageDialog(): void;
|
|
166
|
+
closeManageDialog(): void;
|
|
167
|
+
validateViewNameAsync(name: string, existing?: ViewInfo): Promise<string>;
|
|
168
|
+
deleteViewAsync(view: ViewInfo): Promise<void>;
|
|
169
|
+
updateViewAsync(view: ViewInfo, name: string, description: string, isGlobal: boolean): Promise<void>;
|
|
170
|
+
createViewAsync(name: string, description: string, value: PlainObject): Promise<View>;
|
|
171
|
+
private loadViewAsync;
|
|
172
|
+
private fetchViewAsync;
|
|
173
|
+
private fetchViewInfosAsync;
|
|
174
|
+
private maybeAutoSaveAsync;
|
|
175
|
+
private setAsView;
|
|
176
|
+
private handleException;
|
|
177
|
+
private noteSuccess;
|
|
178
|
+
/**
|
|
179
|
+
* Stringify and parse to ensure that any value set here is valid, serializable JSON.
|
|
180
|
+
*/
|
|
181
|
+
private cleanState;
|
|
182
|
+
private confirmDiscardChangesAsync;
|
|
183
|
+
private maybeConfirmSaveAsync;
|
|
184
|
+
private initPersist;
|
|
185
|
+
}
|
package/build/types/core/XH.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { RouterModel } from '@xh/hoist/appcontainer/RouterModel';
|
|
2
2
|
import { HoistAuthModel } from '@xh/hoist/core/HoistAuthModel';
|
|
3
3
|
import { Store } from '@xh/hoist/data';
|
|
4
|
-
import { AlertBannerService, AutoRefreshService, ChangelogService, ConfigService, EnvironmentService, FetchOptions, FetchService, GridAutosizeService, GridExportService, IdentityService, IdleService, InspectorService, JsonBlobService, LocalStorageService, PrefService, TrackService, WebSocketService } from '@xh/hoist/svc';
|
|
4
|
+
import { AlertBannerService, AutoRefreshService, ChangelogService, ConfigService, EnvironmentService, FetchOptions, FetchService, GridAutosizeService, GridExportService, IdentityService, IdleService, InspectorService, JsonBlobService, LocalStorageService, PrefService, SessionStorageService, TrackService, WebSocketService } from '@xh/hoist/svc';
|
|
5
5
|
import { Router, State } from 'router5';
|
|
6
6
|
import { CancelFn } from 'router5/types/types/base';
|
|
7
7
|
import { SetOptional } from 'type-fest';
|
|
@@ -58,6 +58,7 @@ export declare class XHApi {
|
|
|
58
58
|
jsonBlobService: JsonBlobService;
|
|
59
59
|
localStorageService: LocalStorageService;
|
|
60
60
|
prefService: PrefService;
|
|
61
|
+
sessionStorageService: SessionStorageService;
|
|
61
62
|
trackService: TrackService;
|
|
62
63
|
webSocketService: WebSocketService;
|
|
63
64
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DebounceSpec } from '../';
|
|
2
2
|
import type { DashViewModel } from '@xh/hoist/desktop/cmp/dash';
|
|
3
|
-
import type { ViewManagerModel } from '@xh/hoist/
|
|
3
|
+
import type { ViewManagerModel } from '@xh/hoist/cmp/viewmanager';
|
|
4
4
|
export interface PersistOptions {
|
|
5
5
|
/** Dot delimited path to store state. */
|
|
6
6
|
path?: string;
|
|
@@ -15,6 +15,8 @@ export interface PersistOptions {
|
|
|
15
15
|
prefKey?: string;
|
|
16
16
|
/** Browser local storage key used to store state. */
|
|
17
17
|
localStorageKey?: string;
|
|
18
|
+
/** Session (tab-specific) storage key used to store state. */
|
|
19
|
+
sessionStorageKey?: string;
|
|
18
20
|
/** DashViewModel used to read / write view state. */
|
|
19
21
|
dashViewModel?: DashViewModel;
|
|
20
22
|
/** ViewManagerModel used to read / write view state. */
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export * from './Persistable';
|
|
2
2
|
export * from './PersistOptions';
|
|
3
3
|
export * from './PersistenceProvider';
|
|
4
|
-
export * from './LocalStorageProvider';
|
|
5
|
-
export * from './
|
|
6
|
-
export * from './
|
|
7
|
-
export * from './
|
|
8
|
-
export * from './
|
|
4
|
+
export * from './provider/LocalStorageProvider';
|
|
5
|
+
export * from './provider/SessionStorageProvider';
|
|
6
|
+
export * from './provider/DashViewProvider';
|
|
7
|
+
export * from './provider/PrefProvider';
|
|
8
|
+
export * from './provider/CustomProvider';
|
|
9
|
+
export * from './provider/ViewManagerProvider';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PersistenceProvider, PersistenceProviderConfig } from '
|
|
1
|
+
import { PersistenceProvider, PersistenceProviderConfig } from '../PersistenceProvider';
|
|
2
2
|
/**
|
|
3
3
|
* A minimal Persistence provider for use by apps that wish to implement the actual persistence
|
|
4
4
|
* of the backing data via custom handlers.
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { DashViewModel } from '@xh/hoist/desktop/cmp/dash';
|
|
2
|
-
import { PersistenceProvider, PersistenceProviderConfig } from '
|
|
2
|
+
import { PersistenceProvider, PersistenceProviderConfig } from '../PersistenceProvider';
|
|
3
3
|
/**
|
|
4
4
|
* PersistenceProvider that stores state within a DashViewModel.
|
|
5
5
|
*/
|
|
6
6
|
export declare class DashViewProvider<S> extends PersistenceProvider<S> {
|
|
7
7
|
readonly dashViewModel: DashViewModel;
|
|
8
8
|
constructor(cfg: PersistenceProviderConfig<S>);
|
|
9
|
-
readRaw(): import("
|
|
9
|
+
readRaw(): import("../..").PlainObject;
|
|
10
10
|
writeRaw(data: any): void;
|
|
11
11
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { PersistenceProviderConfig } from '../';
|
|
2
|
-
import { PersistenceProvider } from './';
|
|
1
|
+
import { PersistenceProvider, PersistenceProviderConfig } from '../PersistenceProvider';
|
|
3
2
|
/**
|
|
4
3
|
* PersistenceProvider that stores state within the Hoist Preferences system.
|
|
5
4
|
*/
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { PersistenceProvider, PersistenceProviderConfig } from '../PersistenceProvider';
|
|
2
|
+
/**
|
|
3
|
+
* PersistenceProvider that stores state within the Browser's SessionStorage.
|
|
4
|
+
*/
|
|
5
|
+
export declare class SessionStorageProvider<S> extends PersistenceProvider<S> {
|
|
6
|
+
readonly key: string;
|
|
7
|
+
constructor(cfg: PersistenceProviderConfig<S>);
|
|
8
|
+
readRaw(): any;
|
|
9
|
+
writeRaw(data: any): void;
|
|
10
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { PersistenceProvider, PersistenceProviderConfig } from '../
|
|
2
|
-
import type { ViewManagerModel } from '
|
|
1
|
+
import { PersistenceProvider, PersistenceProviderConfig } from '../PersistenceProvider';
|
|
2
|
+
import type { ViewManagerModel } from '@xh/hoist/cmp/viewmanager/ViewManagerModel';
|
|
3
3
|
export declare class ViewManagerProvider<S> extends PersistenceProvider<S> {
|
|
4
4
|
readonly viewManagerModel: ViewManagerModel;
|
|
5
5
|
constructor(cfg: PersistenceProviderConfig<S>);
|
|
6
6
|
pushStateToTarget(): void;
|
|
7
|
-
readRaw(): import("../..").PlainObject
|
|
7
|
+
readRaw(): Partial<import("../..").PlainObject>;
|
|
8
8
|
writeRaw(data: Record<typeof this.path, S>): void;
|
|
9
9
|
destroy(): void;
|
|
10
10
|
}
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { HoistProps } from '@xh/hoist/core';
|
|
3
|
-
import '
|
|
4
|
-
import { ViewManagerModel } from '@xh/hoist/core/persist/viewmanager/ViewManagerModel';
|
|
3
|
+
import { ViewManagerModel } from '@xh/hoist/cmp/viewmanager';
|
|
5
4
|
import { ButtonProps } from '@xh/hoist/desktop/cmp/button';
|
|
5
|
+
import './ViewManager.scss';
|
|
6
6
|
/**
|
|
7
7
|
* Visibility options for save/revert button.
|
|
8
8
|
*
|
|
9
9
|
* 'never' to hide button.
|
|
10
10
|
* 'whenDirty' to only show when persistence state is dirty and button is therefore enabled.
|
|
11
|
-
* 'always' will always show button
|
|
12
|
-
*
|
|
13
|
-
* Note that we never show the button when 'autoSave' is active because it would never be enabled
|
|
14
|
-
* for more than a flash.
|
|
11
|
+
* 'always' will always show button.
|
|
15
12
|
*/
|
|
16
13
|
export type ViewManagerStateButtonMode = 'whenDirty' | 'always' | 'never';
|
|
17
14
|
export interface ViewManagerProps extends HoistProps<ViewManagerModel> {
|
|
@@ -22,14 +19,16 @@ export interface ViewManagerProps extends HoistProps<ViewManagerModel> {
|
|
|
22
19
|
showSaveButton?: ViewManagerStateButtonMode;
|
|
23
20
|
/** Default 'never' */
|
|
24
21
|
showRevertButton?: ViewManagerStateButtonMode;
|
|
25
|
-
/**
|
|
22
|
+
/** Side the save and revert buttons should appear on (default 'right') */
|
|
23
|
+
buttonSide?: 'left' | 'right';
|
|
24
|
+
/** True to render private views in sub-menu (Default false) */
|
|
26
25
|
showPrivateViewsInSubMenu?: boolean;
|
|
27
|
-
/** True to render
|
|
28
|
-
|
|
26
|
+
/** True to render global views in sub-menu (Default false) */
|
|
27
|
+
showGlobalViewsInSubMenu?: boolean;
|
|
29
28
|
}
|
|
30
29
|
/**
|
|
31
30
|
* Desktop ViewManager component - a button-based menu for saving and swapping between named
|
|
32
|
-
* bundles of persisted component state (
|
|
31
|
+
* bundles of persisted component state (e.g. grid views, dashboards, and similar).
|
|
33
32
|
*
|
|
34
33
|
* See {@link ViewManagerModel} for additional details and configuration options.
|
|
35
34
|
*/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FormModel } from '@xh/hoist/cmp/form';
|
|
2
|
+
import { HoistModel, TaskObserver } from '@xh/hoist/core';
|
|
3
|
+
import { ManageDialogModel } from './ManageDialogModel';
|
|
4
|
+
import { ViewInfo } from '@xh/hoist/cmp/viewmanager';
|
|
5
|
+
/**
|
|
6
|
+
* Backing model for EditForm
|
|
7
|
+
*/
|
|
8
|
+
export declare class EditFormModel extends HoistModel {
|
|
9
|
+
parent: ManageDialogModel;
|
|
10
|
+
formModel: FormModel;
|
|
11
|
+
view: ViewInfo;
|
|
12
|
+
setView(view: ViewInfo): any;
|
|
13
|
+
get loadTask(): TaskObserver;
|
|
14
|
+
get showSaveButton(): boolean;
|
|
15
|
+
constructor(parent: ManageDialogModel);
|
|
16
|
+
saveAsync(): Promise<void>;
|
|
17
|
+
private createFormModel;
|
|
18
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { GridModel } from '@xh/hoist/cmp/grid';
|
|
2
|
+
import { TabContainerModel } from '@xh/hoist/cmp/tab';
|
|
3
|
+
import { HoistModel, LoadSpec, TaskObserver } from '@xh/hoist/core';
|
|
4
|
+
import { FilterTestFn } from '@xh/hoist/data';
|
|
5
|
+
import { EditFormModel } from './EditFormModel';
|
|
6
|
+
import { ViewInfo, ViewManagerModel } from '@xh/hoist/cmp/viewmanager';
|
|
7
|
+
/**
|
|
8
|
+
* Backing model for ManageDialog
|
|
9
|
+
*/
|
|
10
|
+
export declare class ManageDialogModel extends HoistModel {
|
|
11
|
+
viewManagerModel: ViewManagerModel;
|
|
12
|
+
privateGridModel: GridModel;
|
|
13
|
+
globalGridModel: GridModel;
|
|
14
|
+
editFormModel: EditFormModel;
|
|
15
|
+
tabContainerModel: TabContainerModel;
|
|
16
|
+
filter: FilterTestFn;
|
|
17
|
+
readonly updateTask: TaskObserver;
|
|
18
|
+
get loadTask(): TaskObserver;
|
|
19
|
+
get gridModel(): GridModel;
|
|
20
|
+
get selectedView(): ViewInfo;
|
|
21
|
+
get selectedViews(): ViewInfo[];
|
|
22
|
+
get canDelete(): boolean;
|
|
23
|
+
get manageGlobal(): boolean;
|
|
24
|
+
get typeDisplayName(): string;
|
|
25
|
+
get globalDisplayName(): string;
|
|
26
|
+
get enableFavorites(): boolean;
|
|
27
|
+
constructor();
|
|
28
|
+
close(): void;
|
|
29
|
+
onLinked(): void;
|
|
30
|
+
doLoadAsync(loadSpec: LoadSpec): Promise<void>;
|
|
31
|
+
deleteAsync(views: ViewInfo[]): Promise<void>;
|
|
32
|
+
updateAsync(view: ViewInfo, name: string, description: string, isGlobal: boolean): Promise<void>;
|
|
33
|
+
private doUpdateAsync;
|
|
34
|
+
private doDeleteAsync;
|
|
35
|
+
selectViewAsync(view: ViewInfo): Promise<void>;
|
|
36
|
+
private createGridModel;
|
|
37
|
+
private createTabContainerModel;
|
|
38
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { HoistService, LoadSpec, PlainObject } from '@xh/hoist/core';
|
|
2
2
|
export interface JsonBlob {
|
|
3
3
|
/** Either null for private blobs or special token "*" for globally shared blobs. */
|
|
4
|
-
acl:
|
|
4
|
+
acl: '*';
|
|
5
5
|
/** True if this blob has been archived (soft-deleted). */
|
|
6
6
|
archived: boolean;
|
|
7
7
|
/** Timestamp indicating when this blob was archived, or special value `0` if not archived. */
|
|
@@ -10,7 +10,8 @@ export * from './IdentityService';
|
|
|
10
10
|
export * from './IdleService';
|
|
11
11
|
export * from './InspectorService';
|
|
12
12
|
export * from './JsonBlobService';
|
|
13
|
-
export * from './LocalStorageService';
|
|
14
13
|
export * from './PrefService';
|
|
15
14
|
export * from './TrackService';
|
|
16
15
|
export * from './WebSocketService';
|
|
16
|
+
export * from './storage/LocalStorageService';
|
|
17
|
+
export * from './storage/SessionStorageService';
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { HoistService } from '@xh/hoist/core';
|
|
2
|
+
import { StoreType } from 'store2';
|
|
3
|
+
/**
|
|
4
|
+
* Service to provide simple key/value access to browser local/session storage, appropriately
|
|
5
|
+
* namespaced by application code and username.
|
|
6
|
+
*
|
|
7
|
+
* In the unexpected case that the core apis are not available, will provide a transient in-memory
|
|
8
|
+
* storage to support its operations and API.
|
|
9
|
+
*/
|
|
10
|
+
export declare abstract class BaseStorageService extends HoistService {
|
|
11
|
+
constructor();
|
|
12
|
+
get(key: string, defaultValue?: any): any;
|
|
13
|
+
set(key: string, value: any): void;
|
|
14
|
+
apply(key: string, newProps: object): void;
|
|
15
|
+
remove(key: string): void;
|
|
16
|
+
removeIf(predicateFn: (s: string) => boolean): void;
|
|
17
|
+
clear(): void;
|
|
18
|
+
keys(): string[];
|
|
19
|
+
get isFake(): boolean;
|
|
20
|
+
protected abstract get storeInstance(): StoreType;
|
|
21
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseStorageService } from '@xh/hoist/svc/storage/BaseStorageService';
|
|
2
|
+
import { StoreType } from 'store2';
|
|
3
|
+
/**
|
|
4
|
+
* Service to provide simple key/value access to browser local storage, appropriately namespaced
|
|
5
|
+
* by application code and username.
|
|
6
|
+
*
|
|
7
|
+
* Relied upon by Hoist persistence mechanisms when using key 'localStorageKey`
|
|
8
|
+
*/
|
|
9
|
+
export declare class LocalStorageService extends BaseStorageService {
|
|
10
|
+
static instance: LocalStorageService;
|
|
11
|
+
protected get storeInstance(): StoreType;
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { BaseStorageService } from '@xh/hoist/svc/storage/BaseStorageService';
|
|
2
|
+
import { StoreType } from 'store2';
|
|
3
|
+
/**
|
|
4
|
+
* Service to provide simple key/value access to browser session storage, appropriately namespaced
|
|
5
|
+
* by application code and username.
|
|
6
|
+
*
|
|
7
|
+
* Relied upon by Hoist persistence mechanisms when using key 'sessionStorageKey`
|
|
8
|
+
*/
|
|
9
|
+
export declare class SessionStorageService extends BaseStorageService {
|
|
10
|
+
static instance: SessionStorageService;
|
|
11
|
+
protected get storeInstance(): StoreType;
|
|
12
|
+
}
|
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
import {XH} from '@xh/hoist/core';
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* Copy the chart in
|
|
11
|
-
* Works only on webkit based browsers.
|
|
10
|
+
* Copy the chart in its current state to the clipboard - supported for webkit based browsers only.
|
|
12
11
|
* @internal
|
|
13
12
|
*/
|
|
14
13
|
export function installCopyToClipboard(Highcharts) {
|