@xh/hoist 71.0.0-SNAPSHOT.1733854822950 → 71.0.0-SNAPSHOT.1734551243081
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 +1 -0
- package/build/types/cmp/viewmanager/View.d.ts +5 -0
- package/build/types/cmp/viewmanager/ViewInfo.d.ts +32 -7
- package/build/types/cmp/viewmanager/ViewManagerModel.d.ts +41 -31
- package/build/types/cmp/viewmanager/ViewToBlobApi.d.ts +28 -7
- package/build/types/cmp/viewmanager/index.d.ts +1 -1
- package/build/types/desktop/cmp/viewmanager/ViewManager.d.ts +0 -4
- package/build/types/desktop/cmp/viewmanager/ViewManagerLocalModel.d.ts +11 -0
- package/build/types/desktop/cmp/viewmanager/ViewMenu.d.ts +2 -2
- package/build/types/desktop/cmp/viewmanager/dialog/ManageDialog.d.ts +3 -1
- package/build/types/desktop/cmp/viewmanager/dialog/ManageDialogModel.d.ts +18 -13
- package/build/types/desktop/cmp/viewmanager/dialog/SaveAsDialog.d.ts +1 -1
- package/build/types/{cmp/viewmanager → desktop/cmp/viewmanager/dialog}/SaveAsDialogModel.d.ts +3 -9
- package/build/types/desktop/cmp/viewmanager/dialog/Utils.d.ts +3 -0
- package/build/types/desktop/cmp/viewmanager/dialog/ViewMultiPanel.d.ts +2 -0
- package/build/types/desktop/cmp/viewmanager/dialog/ViewPanel.d.ts +5 -0
- package/build/types/desktop/cmp/viewmanager/dialog/{EditFormModel.d.ts → ViewPanelModel.d.ts} +2 -4
- package/build/types/svc/JsonBlobService.d.ts +1 -1
- package/cmp/viewmanager/View.ts +21 -1
- package/cmp/viewmanager/ViewInfo.ts +58 -11
- package/cmp/viewmanager/ViewManagerModel.ts +109 -82
- package/cmp/viewmanager/ViewToBlobApi.ts +114 -42
- package/cmp/viewmanager/index.ts +1 -1
- package/desktop/cmp/viewmanager/ViewManager.scss +25 -28
- package/desktop/cmp/viewmanager/ViewManager.ts +32 -27
- package/desktop/cmp/viewmanager/ViewManagerLocalModel.ts +33 -0
- package/desktop/cmp/viewmanager/ViewMenu.ts +162 -169
- package/desktop/cmp/viewmanager/dialog/ManageDialog.ts +69 -42
- package/desktop/cmp/viewmanager/dialog/ManageDialogModel.ts +267 -150
- package/desktop/cmp/viewmanager/dialog/SaveAsDialog.ts +30 -9
- package/{cmp/viewmanager → desktop/cmp/viewmanager/dialog}/SaveAsDialogModel.ts +35 -40
- package/desktop/cmp/viewmanager/dialog/Utils.ts +18 -0
- package/desktop/cmp/viewmanager/dialog/ViewMultiPanel.ts +70 -0
- package/desktop/cmp/viewmanager/dialog/ViewPanel.ts +166 -0
- package/desktop/cmp/viewmanager/dialog/ViewPanelModel.ts +116 -0
- package/package.json +1 -1
- package/svc/JsonBlobService.ts +3 -3
- package/svc/storage/BaseStorageService.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/build/types/desktop/cmp/viewmanager/dialog/EditForm.d.ts +0 -5
- package/desktop/cmp/viewmanager/dialog/EditForm.ts +0 -126
- package/desktop/cmp/viewmanager/dialog/EditFormModel.ts +0 -125
package/CHANGELOG.md
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* Handle delete and update collisions more gracefully.
|
|
10
10
|
* Support for `settleTime`,
|
|
11
11
|
* Improved management UI Dialog.
|
|
12
|
+
* Support for "global" views.
|
|
12
13
|
* New `SessionStorageService` and associated persistence provider provides support for saving
|
|
13
14
|
tab local data across reloads.
|
|
14
15
|
|
|
@@ -19,10 +19,15 @@ export declare class View<T extends PlainObject = PlainObject> {
|
|
|
19
19
|
readonly value: Partial<T>;
|
|
20
20
|
private readonly model;
|
|
21
21
|
get name(): string;
|
|
22
|
+
get group(): string;
|
|
23
|
+
get description(): string;
|
|
22
24
|
get token(): string;
|
|
23
25
|
get type(): string;
|
|
24
26
|
get isDefault(): boolean;
|
|
25
27
|
get isGlobal(): boolean;
|
|
28
|
+
get isShared(): boolean;
|
|
29
|
+
get isOwned(): boolean;
|
|
30
|
+
get isCurrentView(): boolean;
|
|
26
31
|
get lastUpdated(): number;
|
|
27
32
|
get typedName(): string;
|
|
28
33
|
static fromBlob<T>(blob: JsonBlob, model: ViewManagerModel): View<T>;
|
|
@@ -1,30 +1,55 @@
|
|
|
1
1
|
import { ViewManagerModel } from './ViewManagerModel';
|
|
2
2
|
import { JsonBlob } from '@xh/hoist/svc';
|
|
3
|
+
import { PlainObject } from '@xh/hoist/core';
|
|
3
4
|
/**
|
|
4
5
|
* Metadata describing {@link View} managed by {@link ViewManagerModel}.
|
|
5
6
|
*/
|
|
6
7
|
export declare class ViewInfo {
|
|
7
8
|
/** Unique Id */
|
|
8
9
|
readonly token: string;
|
|
9
|
-
/** App-defined type discriminator
|
|
10
|
+
/** App-defined type discriminator. */
|
|
10
11
|
readonly type: string;
|
|
11
12
|
/** User-supplied descriptive name. */
|
|
12
13
|
readonly name: string;
|
|
13
14
|
/** Description of the view. **/
|
|
14
15
|
readonly description: string;
|
|
16
|
+
/** User owning this view. Null if the view is global.*/
|
|
17
|
+
readonly owner: string;
|
|
18
|
+
/** Is the owner making this view accessible to others? Always true for global views. */
|
|
19
|
+
readonly isShared: boolean;
|
|
15
20
|
/** True if this view is global and visible to all users. */
|
|
16
21
|
readonly isGlobal: boolean;
|
|
17
|
-
/**
|
|
18
|
-
readonly
|
|
22
|
+
/** Optional group name used for bucketing this view in display. */
|
|
23
|
+
readonly group: string;
|
|
24
|
+
/**
|
|
25
|
+
* Should this view be pinned by users by default?
|
|
26
|
+
* This value is intended to be used for global views only.
|
|
27
|
+
*/
|
|
28
|
+
readonly isDefaultPinned: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Original meta-data on views associated JsonBlob.
|
|
31
|
+
* Not typically used by applications.
|
|
32
|
+
* @internal
|
|
33
|
+
*/
|
|
34
|
+
readonly meta: PlainObject;
|
|
19
35
|
dateCreated: number;
|
|
20
36
|
lastUpdated: number;
|
|
21
37
|
lastUpdatedBy: string;
|
|
22
|
-
|
|
38
|
+
readonly model: ViewManagerModel;
|
|
23
39
|
constructor(blob: JsonBlob, model: ViewManagerModel);
|
|
40
|
+
get isOwned(): boolean;
|
|
41
|
+
get isEditable(): boolean;
|
|
42
|
+
get isCurrentView(): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* True if this view should appear on the users easy access menu.
|
|
45
|
+
*
|
|
46
|
+
* This value is computed with the user persisted state along with the View's
|
|
47
|
+
* `defaultPinned` property.
|
|
48
|
+
*/
|
|
49
|
+
get isPinned(): boolean;
|
|
24
50
|
/**
|
|
25
|
-
*
|
|
26
|
-
* is persisted via `ViewManagerModel.persistWith` and *not* stored in the blob itself.
|
|
51
|
+
* The user indicated pin state for this view, or null if user has not indicated a preference.
|
|
27
52
|
*/
|
|
28
|
-
get
|
|
53
|
+
get isUserPinned(): boolean | null;
|
|
29
54
|
get typedName(): string;
|
|
30
55
|
}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { HoistModel, LoadSpec, PersistOptions, PlainObject, TaskObserver, Thunkable } from '@xh/hoist/core';
|
|
2
2
|
import type { ViewManagerProvider } from '@xh/hoist/core';
|
|
3
|
-
import { SaveAsDialogModel } from './SaveAsDialogModel';
|
|
4
3
|
import { ViewInfo } from './ViewInfo';
|
|
5
4
|
import { View } from './View';
|
|
6
|
-
import { ViewToBlobApi } from './ViewToBlobApi';
|
|
5
|
+
import { ViewToBlobApi, ViewCreateSpec } from './ViewToBlobApi';
|
|
7
6
|
export interface ViewManagerConfig {
|
|
8
7
|
/**
|
|
9
8
|
* True (default) to allow user to opt in to automatically saving changes to their current view.
|
|
@@ -15,8 +14,15 @@ export interface ViewManagerConfig {
|
|
|
15
14
|
* in advance, so that there is a clear initial selection for users without any private views.
|
|
16
15
|
*/
|
|
17
16
|
enableDefault?: boolean;
|
|
18
|
-
/**
|
|
19
|
-
|
|
17
|
+
/**
|
|
18
|
+
* True (default) to enable "global" views - i.e. views that are not owned by a user and are
|
|
19
|
+
* available to all.
|
|
20
|
+
*/
|
|
21
|
+
enableGlobal?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* True (default) to allow users to share their views with other users.
|
|
24
|
+
*/
|
|
25
|
+
enableSharing?: boolean;
|
|
20
26
|
/**
|
|
21
27
|
* Function to determine the initial view for a user, when no view has already been persisted.
|
|
22
28
|
* Will be passed a list of views available to the current user. Implementations where
|
|
@@ -27,11 +33,10 @@ export interface ViewManagerConfig {
|
|
|
27
33
|
*/
|
|
28
34
|
initialViewSpec?: (views: ViewInfo[]) => ViewInfo;
|
|
29
35
|
/**
|
|
30
|
-
* Delay after state has been set on associated components before
|
|
31
|
-
*
|
|
32
|
-
* components such as dashboards or grids that
|
|
33
|
-
*
|
|
34
|
-
* Specified in milliseconds. Default is 250.
|
|
36
|
+
* Delay (in ms) to wait after state has been set on associated components before listening for
|
|
37
|
+
* further state changes. The long default wait 1000ms is intended to avoid a false positive
|
|
38
|
+
* dirty indicator when linking to complex components such as dashboards or grids that can
|
|
39
|
+
* report immediate changes to state due to internal processing or rendering.
|
|
35
40
|
*/
|
|
36
41
|
settleTime?: number;
|
|
37
42
|
/**
|
|
@@ -59,8 +64,8 @@ export interface ViewManagerConfig {
|
|
|
59
64
|
globalDisplayName?: string;
|
|
60
65
|
}
|
|
61
66
|
export interface ViewManagerPersistOptions extends PersistOptions {
|
|
62
|
-
/** True to persist
|
|
63
|
-
|
|
67
|
+
/** True to persist pinning preferences or provide specific PersistOptions. (Default true) */
|
|
68
|
+
persistPinning?: boolean | PersistOptions;
|
|
64
69
|
/** True to include pending value or provide specific PersistOptions. (Default false) */
|
|
65
70
|
persistPendingValue?: boolean | PersistOptions;
|
|
66
71
|
}
|
|
@@ -72,8 +77,8 @@ export interface ViewManagerPersistOptions extends PersistOptions {
|
|
|
72
77
|
* models can be bound to a single ViewManagerModel, allowing a single view to capture the state
|
|
73
78
|
* of multiple components - e.g. grouping and filtering options along with grid state.
|
|
74
79
|
* - Views are persisted back to the server as JsonBlob objects.
|
|
75
|
-
* - Views can be private to their owner, or optionally enabled for
|
|
76
|
-
* - Views can be marked as
|
|
80
|
+
* - Views can be private to their owner, or optionally enabled for sharing to (all) other users.
|
|
81
|
+
* - Views can be marked as pinned for quick access.
|
|
77
82
|
* - See the desktop {@link ViewManager} component - the initial Hoist UI for this model.
|
|
78
83
|
*/
|
|
79
84
|
export declare class ViewManagerModel<T = PlainObject> extends HoistModel {
|
|
@@ -101,7 +106,8 @@ export declare class ViewManagerModel<T = PlainObject> extends HoistModel {
|
|
|
101
106
|
readonly globalDisplayName: string;
|
|
102
107
|
readonly enableAutoSave: boolean;
|
|
103
108
|
readonly enableDefault: boolean;
|
|
104
|
-
readonly
|
|
109
|
+
readonly enableGlobal: boolean;
|
|
110
|
+
readonly enableSharing: boolean;
|
|
105
111
|
readonly manageGlobal: boolean;
|
|
106
112
|
readonly settleTime: number;
|
|
107
113
|
readonly initialViewSpec: (views: ViewInfo[]) => ViewInfo;
|
|
@@ -109,8 +115,13 @@ export declare class ViewManagerModel<T = PlainObject> extends HoistModel {
|
|
|
109
115
|
view: View<T>;
|
|
110
116
|
/** Loaded saved view library - both private and global */
|
|
111
117
|
views: ViewInfo[];
|
|
112
|
-
/**
|
|
113
|
-
|
|
118
|
+
/**
|
|
119
|
+
* Map of user's preferred pinned state for views.
|
|
120
|
+
*
|
|
121
|
+
* Note that the actual pinned state for the views is determined by this value, layered
|
|
122
|
+
* over the default state of the views themselves.
|
|
123
|
+
*/
|
|
124
|
+
userPinned: Record<string, boolean>;
|
|
114
125
|
/**
|
|
115
126
|
* True if user has opted-in to automatically saving changes to personal views (if auto-save
|
|
116
127
|
* generally available as per `enableAutoSave`).
|
|
@@ -121,12 +132,8 @@ export declare class ViewManagerModel<T = PlainObject> extends HoistModel {
|
|
|
121
132
|
* require intensive layout/grid work, consider masking affected components with this task.
|
|
122
133
|
*/
|
|
123
134
|
selectTask: TaskObserver;
|
|
124
|
-
/**
|
|
125
|
-
* TaskObserver linked to {@link saveAsync}.
|
|
126
|
-
*/
|
|
135
|
+
/** TaskObserver linked to {@link saveAsync}. */
|
|
127
136
|
saveTask: TaskObserver;
|
|
128
|
-
manageDialogOpen: boolean;
|
|
129
|
-
saveAsDialogModel: SaveAsDialogModel;
|
|
130
137
|
/** Unsaved changes on the current view.*/
|
|
131
138
|
private pendingValue;
|
|
132
139
|
/**
|
|
@@ -137,7 +144,7 @@ export declare class ViewManagerModel<T = PlainObject> extends HoistModel {
|
|
|
137
144
|
*/
|
|
138
145
|
providers: ViewManagerProvider<any>[];
|
|
139
146
|
/**
|
|
140
|
-
* Data access for persisting views
|
|
147
|
+
* Data access for persisting views.
|
|
141
148
|
* @internal
|
|
142
149
|
*/
|
|
143
150
|
api: ViewToBlobApi<T>;
|
|
@@ -146,9 +153,13 @@ export declare class ViewManagerModel<T = PlainObject> extends HoistModel {
|
|
|
146
153
|
get isViewSavable(): boolean;
|
|
147
154
|
get isViewAutoSavable(): boolean;
|
|
148
155
|
get autoSaveUnavailableReason(): string;
|
|
149
|
-
get
|
|
156
|
+
get pinnedViews(): ViewInfo[];
|
|
157
|
+
/** Views owned by me */
|
|
158
|
+
get ownedViews(): ViewInfo[];
|
|
159
|
+
/** Views shared *with* me */
|
|
160
|
+
get sharedViews(): ViewInfo[];
|
|
161
|
+
/** Global views */
|
|
150
162
|
get globalViews(): ViewInfo[];
|
|
151
|
-
get privateViews(): ViewInfo[];
|
|
152
163
|
/** True if any async tasks are pending. */
|
|
153
164
|
get isLoading(): boolean;
|
|
154
165
|
/**
|
|
@@ -158,18 +169,17 @@ export declare class ViewManagerModel<T = PlainObject> extends HoistModel {
|
|
|
158
169
|
private constructor();
|
|
159
170
|
doLoadAsync(loadSpec: LoadSpec): Promise<void>;
|
|
160
171
|
selectViewAsync(info: ViewInfo): Promise<void>;
|
|
172
|
+
saveAsAsync(spec: ViewCreateSpec): Promise<void>;
|
|
161
173
|
saveAsync(): Promise<void>;
|
|
162
|
-
saveAsAsync(): Promise<void>;
|
|
163
174
|
resetAsync(): Promise<void>;
|
|
164
175
|
getValue(): Partial<T>;
|
|
165
176
|
setValue(value: Partial<T>): void;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
openManageDialog(): void;
|
|
171
|
-
closeManageDialog(): void;
|
|
177
|
+
togglePinned(view: ViewInfo): void;
|
|
178
|
+
userPin(view: ViewInfo): void;
|
|
179
|
+
userUnpin(view: ViewInfo): void;
|
|
180
|
+
isUserPinned(view: ViewInfo): boolean | null;
|
|
172
181
|
validateViewNameAsync(name: string, existing?: ViewInfo): Promise<string>;
|
|
182
|
+
deleteViewsAsync(toDelete: ViewInfo[]): Promise<void>;
|
|
173
183
|
private initAsync;
|
|
174
184
|
private loadViewAsync;
|
|
175
185
|
private maybeAutoSaveAsync;
|
|
@@ -2,19 +2,40 @@ import { PlainObject } from '@xh/hoist/core';
|
|
|
2
2
|
import { ViewInfo } from './ViewInfo';
|
|
3
3
|
import { View } from './View';
|
|
4
4
|
import { ViewManagerModel } from './ViewManagerModel';
|
|
5
|
+
export interface ViewCreateSpec {
|
|
6
|
+
name: string;
|
|
7
|
+
group: string;
|
|
8
|
+
description: string;
|
|
9
|
+
isShared: boolean;
|
|
10
|
+
value?: PlainObject;
|
|
11
|
+
}
|
|
12
|
+
export interface ViewUpdateSpec {
|
|
13
|
+
name: string;
|
|
14
|
+
group: string;
|
|
15
|
+
description: string;
|
|
16
|
+
isShared?: boolean;
|
|
17
|
+
isDefaultPinned?: boolean;
|
|
18
|
+
}
|
|
5
19
|
/**
|
|
6
|
-
* Class for accessing and updating views using
|
|
7
|
-
*
|
|
20
|
+
* Class for accessing and updating views using {@link JsonBlobService}.
|
|
8
21
|
* @internal
|
|
9
22
|
*/
|
|
10
23
|
export declare class ViewToBlobApi<T> {
|
|
11
|
-
private
|
|
12
|
-
constructor(
|
|
24
|
+
private readonly model;
|
|
25
|
+
constructor(model: ViewManagerModel<T>);
|
|
26
|
+
/** Fetch metadata for all views accessible by current user. */
|
|
13
27
|
fetchViewInfosAsync(): Promise<ViewInfo[]>;
|
|
28
|
+
/** Fetch the latest version of a view. */
|
|
14
29
|
fetchViewAsync(info: ViewInfo): Promise<View<T>>;
|
|
15
|
-
|
|
16
|
-
|
|
30
|
+
/** Create a new view, owned by the current user.*/
|
|
31
|
+
createViewAsync(spec: ViewCreateSpec): Promise<View<T>>;
|
|
32
|
+
/** Update all aspects of a view's metadata.*/
|
|
33
|
+
updateViewInfoAsync(view: ViewInfo, updates: ViewUpdateSpec): Promise<View<T>>;
|
|
34
|
+
/** Promote a view to global visibility/ownership status. */
|
|
35
|
+
makeViewGlobalAsync(view: ViewInfo): Promise<View<T>>;
|
|
36
|
+
/** Update a view's value. */
|
|
17
37
|
updateViewValueAsync(view: View<T>, value: Partial<T>): Promise<View<T>>;
|
|
18
|
-
|
|
38
|
+
deleteViewsAsync(views: ViewInfo[]): Promise<void>;
|
|
19
39
|
private trackChange;
|
|
40
|
+
private ensureEditable;
|
|
20
41
|
}
|
|
@@ -21,10 +21,6 @@ export interface ViewManagerProps extends HoistProps<ViewManagerModel> {
|
|
|
21
21
|
showRevertButton?: ViewManagerStateButtonMode;
|
|
22
22
|
/** Side the save and revert buttons should appear on (default 'right') */
|
|
23
23
|
buttonSide?: 'left' | 'right';
|
|
24
|
-
/** True to render private views in sub-menu (Default false) */
|
|
25
|
-
showPrivateViewsInSubMenu?: boolean;
|
|
26
|
-
/** True to render global views in sub-menu (Default false) */
|
|
27
|
-
showGlobalViewsInSubMenu?: boolean;
|
|
28
24
|
}
|
|
29
25
|
/**
|
|
30
26
|
* Desktop ViewManager component - a button-based menu for saving and swapping between named
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { HoistModel } from '@xh/hoist/core';
|
|
2
|
+
import { ManageDialogModel } from './dialog/ManageDialogModel';
|
|
3
|
+
import { SaveAsDialogModel } from './dialog/SaveAsDialogModel';
|
|
4
|
+
import { ViewManagerModel } from '@xh/hoist/cmp/viewmanager';
|
|
5
|
+
export declare class ViewManagerLocalModel extends HoistModel {
|
|
6
|
+
readonly parent: ViewManagerModel;
|
|
7
|
+
readonly manageDialogModel: ManageDialogModel;
|
|
8
|
+
readonly saveAsDialogModel: SaveAsDialogModel;
|
|
9
|
+
isVisible: boolean;
|
|
10
|
+
constructor(parent: ViewManagerModel);
|
|
11
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ViewManagerLocalModel } from './ViewManagerLocalModel';
|
|
2
2
|
/**
|
|
3
3
|
* Default Menu used by ViewManager.
|
|
4
4
|
*/
|
|
5
|
-
export declare const viewMenu: import("@xh/hoist/core").ElementFactory<
|
|
5
|
+
export declare const viewMenu: import("@xh/hoist/core").ElementFactory<import("@xh/hoist/core").DefaultHoistProps<ViewManagerLocalModel>>;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { GridModel } from '@xh/hoist/cmp/grid';
|
|
1
2
|
import { ManageDialogModel } from './ManageDialogModel';
|
|
2
3
|
/**
|
|
3
|
-
* Default management dialog for ViewManager
|
|
4
|
+
* Default management dialog for ViewManager.
|
|
4
5
|
*/
|
|
5
6
|
export declare const manageDialog: import("@xh/hoist/core").ElementFactory<import("@xh/hoist/core").DefaultHoistProps<ManageDialogModel>>;
|
|
7
|
+
export declare const viewsGrid: import("@xh/hoist/core").ElementFactory<import("@xh/hoist/core").DefaultHoistProps<GridModel>>;
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { GridModel } from '@xh/hoist/cmp/grid';
|
|
2
2
|
import { TabContainerModel } from '@xh/hoist/cmp/tab';
|
|
3
|
+
import { ViewInfo, ViewManagerModel, ViewUpdateSpec } from '@xh/hoist/cmp/viewmanager';
|
|
3
4
|
import { HoistModel, LoadSpec, TaskObserver } from '@xh/hoist/core';
|
|
4
5
|
import { FilterTestFn } from '@xh/hoist/data';
|
|
5
|
-
import {
|
|
6
|
-
import { ViewInfo, ViewManagerModel } from '@xh/hoist/cmp/viewmanager';
|
|
6
|
+
import { ViewPanelModel } from './ViewPanelModel';
|
|
7
7
|
/**
|
|
8
8
|
* Backing model for ManageDialog
|
|
9
9
|
*/
|
|
10
10
|
export declare class ManageDialogModel extends HoistModel {
|
|
11
11
|
viewManagerModel: ViewManagerModel;
|
|
12
|
-
|
|
12
|
+
isOpen: boolean;
|
|
13
|
+
ownedGridModel: GridModel;
|
|
13
14
|
globalGridModel: GridModel;
|
|
14
|
-
|
|
15
|
+
sharedGridModel: GridModel;
|
|
16
|
+
viewPanelModel: ViewPanelModel;
|
|
15
17
|
tabContainerModel: TabContainerModel;
|
|
16
18
|
filter: FilterTestFn;
|
|
17
19
|
readonly updateTask: TaskObserver;
|
|
@@ -19,20 +21,23 @@ export declare class ManageDialogModel extends HoistModel {
|
|
|
19
21
|
get gridModel(): GridModel;
|
|
20
22
|
get selectedView(): ViewInfo;
|
|
21
23
|
get selectedViews(): ViewInfo[];
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
get typeDisplayName(): string;
|
|
25
|
-
get globalDisplayName(): string;
|
|
26
|
-
get enableFavorites(): boolean;
|
|
27
|
-
constructor();
|
|
24
|
+
constructor(viewManagerModel: ViewManagerModel);
|
|
25
|
+
open(): void;
|
|
28
26
|
close(): void;
|
|
29
|
-
|
|
27
|
+
activateSelectedViewAndClose(): void;
|
|
30
28
|
doLoadAsync(loadSpec: LoadSpec): Promise<void>;
|
|
31
29
|
deleteAsync(views: ViewInfo[]): Promise<void>;
|
|
32
|
-
updateAsync(view: ViewInfo,
|
|
30
|
+
updateAsync(view: ViewInfo, update: ViewUpdateSpec): Promise<void>;
|
|
31
|
+
makeGlobalAsync(view: ViewInfo): Promise<void>;
|
|
32
|
+
togglePinned(views: ViewInfo[]): void;
|
|
33
|
+
private init;
|
|
33
34
|
private doUpdateAsync;
|
|
34
35
|
private doDeleteAsync;
|
|
35
|
-
|
|
36
|
+
private doMakeGlobalAsync;
|
|
37
|
+
private selectViewAsync;
|
|
36
38
|
private createGridModel;
|
|
37
39
|
private createTabContainerModel;
|
|
40
|
+
private get ownedTabTitle();
|
|
41
|
+
private get globalTabTitle();
|
|
42
|
+
private get sharedTabTitle();
|
|
38
43
|
}
|
package/build/types/{cmp/viewmanager → desktop/cmp/viewmanager/dialog}/SaveAsDialogModel.d.ts
RENAMED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { FormModel } from '@xh/hoist/cmp/form';
|
|
2
2
|
import { HoistModel } from '@xh/hoist/core';
|
|
3
|
-
import {
|
|
4
|
-
import { ViewManagerModel } from './ViewManagerModel';
|
|
3
|
+
import { ViewManagerModel } from '@xh/hoist/cmp/viewmanager';
|
|
5
4
|
/**
|
|
6
5
|
* Backing model for ViewManagerModel's SaveAs
|
|
7
6
|
*/
|
|
@@ -9,15 +8,10 @@ export declare class SaveAsDialogModel extends HoistModel {
|
|
|
9
8
|
readonly parent: ViewManagerModel;
|
|
10
9
|
readonly formModel: FormModel;
|
|
11
10
|
isOpen: boolean;
|
|
12
|
-
private resolveOpen;
|
|
13
|
-
get type(): string;
|
|
14
|
-
get typeDisplayName(): string;
|
|
15
|
-
get globalDisplayName(): string;
|
|
16
11
|
constructor(parent: ViewManagerModel);
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
open(): void;
|
|
13
|
+
close(): void;
|
|
19
14
|
saveAsAsync(): Promise<void>;
|
|
20
15
|
private createFormModel;
|
|
21
16
|
private doSaveAsAsync;
|
|
22
|
-
private close;
|
|
23
17
|
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ViewPanelModel } from '@xh/hoist/desktop/cmp/viewmanager/dialog/ViewPanelModel';
|
|
2
|
+
/**
|
|
3
|
+
* Form to edit or view details on a single saved view within the ViewManager manage dialog.
|
|
4
|
+
*/
|
|
5
|
+
export declare const viewPanel: import("@xh/hoist/core").ElementFactory<import("@xh/hoist/core").DefaultHoistProps<ViewPanelModel>>;
|
package/build/types/desktop/cmp/viewmanager/dialog/{EditFormModel.d.ts → ViewPanelModel.d.ts}
RENAMED
|
@@ -5,13 +5,11 @@ import { ViewInfo } from '@xh/hoist/cmp/viewmanager';
|
|
|
5
5
|
/**
|
|
6
6
|
* Backing model for EditForm
|
|
7
7
|
*/
|
|
8
|
-
export declare class
|
|
8
|
+
export declare class ViewPanelModel extends HoistModel {
|
|
9
9
|
parent: ManageDialogModel;
|
|
10
10
|
formModel: FormModel;
|
|
11
|
-
view: ViewInfo;
|
|
12
|
-
setView(view: ViewInfo): any;
|
|
11
|
+
get view(): ViewInfo;
|
|
13
12
|
get loadTask(): TaskObserver;
|
|
14
|
-
get showSaveButton(): boolean;
|
|
15
13
|
constructor(parent: ManageDialogModel);
|
|
16
14
|
saveAsync(): Promise<void>;
|
|
17
15
|
private createFormModel;
|
|
@@ -50,7 +50,7 @@ export declare class JsonBlobService extends HoistService {
|
|
|
50
50
|
/** Persist a new JSONBlob back to the server. */
|
|
51
51
|
createAsync({ acl, description, type, meta, name, value }: Partial<JsonBlob>): Promise<JsonBlob>;
|
|
52
52
|
/** Modify mutable properties of an existing JSONBlob, as identified by its unique token. */
|
|
53
|
-
updateAsync(token: string, { acl, description, meta, name, value }: Partial<JsonBlob>): Promise<JsonBlob>;
|
|
53
|
+
updateAsync(token: string, { acl, description, meta, name, owner, value }: Partial<JsonBlob>): Promise<JsonBlob>;
|
|
54
54
|
/** Archive (soft-delete) an existing JSONBlob, as identified by its unique token. */
|
|
55
55
|
archiveAsync(token: string): Promise<JsonBlob>;
|
|
56
56
|
}
|
package/cmp/viewmanager/View.ts
CHANGED
|
@@ -27,6 +27,14 @@ export class View<T extends PlainObject = PlainObject> {
|
|
|
27
27
|
return this.info?.name ?? 'Default';
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
get group(): string {
|
|
31
|
+
return this.info?.group;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
get description(): string {
|
|
35
|
+
return this.info?.description;
|
|
36
|
+
}
|
|
37
|
+
|
|
30
38
|
get token(): string {
|
|
31
39
|
return this.info?.token ?? null;
|
|
32
40
|
}
|
|
@@ -43,12 +51,24 @@ export class View<T extends PlainObject = PlainObject> {
|
|
|
43
51
|
return this.info?.isGlobal ?? false;
|
|
44
52
|
}
|
|
45
53
|
|
|
54
|
+
get isShared(): boolean {
|
|
55
|
+
return this.info?.isShared ?? false;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
get isOwned(): boolean {
|
|
59
|
+
return this.info?.isOwned ?? false;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
get isCurrentView(): boolean {
|
|
63
|
+
return this.token === this.model.view.token;
|
|
64
|
+
}
|
|
65
|
+
|
|
46
66
|
get lastUpdated(): number {
|
|
47
67
|
return this.info?.lastUpdated ?? null;
|
|
48
68
|
}
|
|
49
69
|
|
|
50
70
|
get typedName(): string {
|
|
51
|
-
return `${this.model.typeDisplayName}
|
|
71
|
+
return `${this.model.typeDisplayName} "${this.name}"`;
|
|
52
72
|
}
|
|
53
73
|
|
|
54
74
|
static fromBlob<T>(blob: JsonBlob, model: ViewManagerModel): View<T> {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {SECONDS} from '@xh/hoist/utils/datetime';
|
|
2
2
|
import {ViewManagerModel} from './ViewManagerModel';
|
|
3
3
|
import {JsonBlob} from '@xh/hoist/svc';
|
|
4
|
+
import {PlainObject, XH} from '@xh/hoist/core';
|
|
4
5
|
|
|
5
6
|
/**
|
|
6
7
|
* Metadata describing {@link View} managed by {@link ViewManagerModel}.
|
|
@@ -9,7 +10,7 @@ export class ViewInfo {
|
|
|
9
10
|
/** Unique Id */
|
|
10
11
|
readonly token: string;
|
|
11
12
|
|
|
12
|
-
/** App-defined type discriminator
|
|
13
|
+
/** App-defined type discriminator. */
|
|
13
14
|
readonly type: string;
|
|
14
15
|
|
|
15
16
|
/** User-supplied descriptive name. */
|
|
@@ -18,25 +19,50 @@ export class ViewInfo {
|
|
|
18
19
|
/** Description of the view. **/
|
|
19
20
|
readonly description: string;
|
|
20
21
|
|
|
22
|
+
/** User owning this view. Null if the view is global.*/
|
|
23
|
+
readonly owner: string;
|
|
24
|
+
|
|
25
|
+
/** Is the owner making this view accessible to others? Always true for global views. */
|
|
26
|
+
readonly isShared: boolean;
|
|
27
|
+
|
|
21
28
|
/** True if this view is global and visible to all users. */
|
|
22
29
|
readonly isGlobal: boolean;
|
|
23
30
|
|
|
24
|
-
/**
|
|
25
|
-
readonly
|
|
31
|
+
/** Optional group name used for bucketing this view in display. */
|
|
32
|
+
readonly group: string;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Should this view be pinned by users by default?
|
|
36
|
+
* This value is intended to be used for global views only.
|
|
37
|
+
*/
|
|
38
|
+
readonly isDefaultPinned: boolean;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Original meta-data on views associated JsonBlob.
|
|
42
|
+
* Not typically used by applications.
|
|
43
|
+
* @internal
|
|
44
|
+
*/
|
|
45
|
+
readonly meta: PlainObject;
|
|
26
46
|
|
|
27
47
|
dateCreated: number;
|
|
28
48
|
lastUpdated: number;
|
|
29
49
|
lastUpdatedBy: string;
|
|
30
50
|
|
|
31
|
-
|
|
51
|
+
readonly model: ViewManagerModel;
|
|
32
52
|
|
|
33
53
|
constructor(blob: JsonBlob, model: ViewManagerModel) {
|
|
34
54
|
this.token = blob.token;
|
|
35
55
|
this.type = blob.type;
|
|
36
|
-
this.owner = blob.owner;
|
|
37
56
|
this.name = blob.name;
|
|
38
57
|
this.description = blob.description;
|
|
39
|
-
this.
|
|
58
|
+
this.owner = blob.owner;
|
|
59
|
+
this.meta = (blob.meta as PlainObject) ?? {};
|
|
60
|
+
this.isGlobal = !this.owner;
|
|
61
|
+
|
|
62
|
+
this.group = this.meta.group ?? null;
|
|
63
|
+
this.isDefaultPinned = !!(this.isGlobal && this.meta.isDefaultPinned);
|
|
64
|
+
this.isShared = !!(!this.isGlobal && this.meta.isShared);
|
|
65
|
+
|
|
40
66
|
// Round to seconds. See: https://github.com/xh/hoist-core/issues/423
|
|
41
67
|
this.dateCreated = Math.round(blob.dateCreated / SECONDS) * SECONDS;
|
|
42
68
|
this.lastUpdated = Math.round(blob.lastUpdated / SECONDS) * SECONDS;
|
|
@@ -44,15 +70,36 @@ export class ViewInfo {
|
|
|
44
70
|
this.model = model;
|
|
45
71
|
}
|
|
46
72
|
|
|
73
|
+
get isOwned(): boolean {
|
|
74
|
+
return this.owner === XH.getUsername();
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
get isEditable(): boolean {
|
|
78
|
+
return this.isOwned || (this.isGlobal && this.model.manageGlobal);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
get isCurrentView(): boolean {
|
|
82
|
+
return this.token === this.model.view.token;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* True if this view should appear on the users easy access menu.
|
|
87
|
+
*
|
|
88
|
+
* This value is computed with the user persisted state along with the View's
|
|
89
|
+
* `defaultPinned` property.
|
|
90
|
+
*/
|
|
91
|
+
get isPinned(): boolean {
|
|
92
|
+
return this.isUserPinned ?? this.isDefaultPinned;
|
|
93
|
+
}
|
|
94
|
+
|
|
47
95
|
/**
|
|
48
|
-
*
|
|
49
|
-
* is persisted via `ViewManagerModel.persistWith` and *not* stored in the blob itself.
|
|
96
|
+
* The user indicated pin state for this view, or null if user has not indicated a preference.
|
|
50
97
|
*/
|
|
51
|
-
get
|
|
52
|
-
return this.model.
|
|
98
|
+
get isUserPinned(): boolean | null {
|
|
99
|
+
return this.model.isUserPinned(this);
|
|
53
100
|
}
|
|
54
101
|
|
|
55
102
|
get typedName(): string {
|
|
56
|
-
return `${this.model.typeDisplayName}
|
|
103
|
+
return `${this.model.typeDisplayName} "${this.name}"`;
|
|
57
104
|
}
|
|
58
105
|
}
|