@xh/hoist 71.0.0-SNAPSHOT.1733791818708 → 71.0.0-SNAPSHOT.1734118787755

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 (42) hide show
  1. package/build/types/cmp/viewmanager/View.d.ts +5 -0
  2. package/build/types/cmp/viewmanager/ViewInfo.d.ts +32 -7
  3. package/build/types/cmp/viewmanager/ViewManagerModel.d.ts +34 -31
  4. package/build/types/cmp/viewmanager/ViewToBlobApi.d.ts +28 -6
  5. package/build/types/cmp/viewmanager/index.d.ts +1 -1
  6. package/build/types/desktop/cmp/viewmanager/ViewManager.d.ts +0 -4
  7. package/build/types/desktop/cmp/viewmanager/ViewManagerLocalModel.d.ts +10 -0
  8. package/build/types/desktop/cmp/viewmanager/ViewMenu.d.ts +2 -2
  9. package/build/types/desktop/cmp/viewmanager/dialog/ManageDialog.d.ts +4 -3
  10. package/build/types/desktop/cmp/viewmanager/dialog/ManageDialogModel.d.ts +19 -10
  11. package/build/types/desktop/cmp/viewmanager/dialog/SaveAsDialog.d.ts +1 -1
  12. package/build/types/{cmp/viewmanager → desktop/cmp/viewmanager/dialog}/SaveAsDialogModel.d.ts +3 -9
  13. package/build/types/desktop/cmp/viewmanager/dialog/Utils.d.ts +3 -0
  14. package/build/types/desktop/cmp/viewmanager/dialog/ViewMultiPanel.d.ts +1 -0
  15. package/build/types/desktop/cmp/viewmanager/dialog/ViewPanel.d.ts +5 -0
  16. package/build/types/desktop/cmp/viewmanager/dialog/{EditFormModel.d.ts → ViewPanelModel.d.ts} +2 -4
  17. package/build/types/svc/JsonBlobService.d.ts +1 -1
  18. package/cmp/viewmanager/View.ts +21 -1
  19. package/cmp/viewmanager/ViewInfo.ts +58 -11
  20. package/cmp/viewmanager/ViewManagerModel.ts +86 -81
  21. package/cmp/viewmanager/ViewToBlobApi.ts +91 -35
  22. package/cmp/viewmanager/index.ts +1 -1
  23. package/desktop/cmp/dash/container/DashContainerModel.ts +17 -5
  24. package/desktop/cmp/viewmanager/ViewManager.scss +25 -28
  25. package/desktop/cmp/viewmanager/ViewManager.ts +28 -26
  26. package/desktop/cmp/viewmanager/ViewManagerLocalModel.ts +28 -0
  27. package/desktop/cmp/viewmanager/ViewMenu.ts +162 -169
  28. package/desktop/cmp/viewmanager/dialog/ManageDialog.ts +67 -40
  29. package/desktop/cmp/viewmanager/dialog/ManageDialogModel.ts +238 -127
  30. package/desktop/cmp/viewmanager/dialog/SaveAsDialog.ts +30 -9
  31. package/{cmp/viewmanager → desktop/cmp/viewmanager/dialog}/SaveAsDialogModel.ts +35 -40
  32. package/desktop/cmp/viewmanager/dialog/Utils.ts +18 -0
  33. package/desktop/cmp/viewmanager/dialog/ViewMultiPanel.ts +70 -0
  34. package/desktop/cmp/viewmanager/dialog/ViewPanel.ts +161 -0
  35. package/desktop/cmp/viewmanager/dialog/ViewPanelModel.ts +116 -0
  36. package/package.json +1 -1
  37. package/svc/JsonBlobService.ts +3 -3
  38. package/svc/storage/BaseStorageService.ts +1 -1
  39. package/tsconfig.tsbuildinfo +1 -1
  40. package/build/types/desktop/cmp/viewmanager/dialog/EditForm.d.ts +0 -5
  41. package/desktop/cmp/viewmanager/dialog/EditForm.ts +0 -126
  42. package/desktop/cmp/viewmanager/dialog/EditFormModel.ts +0 -125
@@ -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, as per {@link ViewManagerConfig.type}. */
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
- /** Original creator of the view, and the only user with access to it if not global. */
18
- readonly owner: string;
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
- private readonly model;
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
- * 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.
51
+ * The user indicated pin state for this view, or null if user has not indicated a preference.
27
52
  */
28
- get isFavorite(): boolean;
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,10 @@ 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
- /** True (default) to allow user to mark views as favorites. Requires `persistWith`. */
19
- enableFavorites?: boolean;
17
+ /**
18
+ * True (default) to allow users to share their views with other users.
19
+ */
20
+ enableSharing?: boolean;
20
21
  /**
21
22
  * Function to determine the initial view for a user, when no view has already been persisted.
22
23
  * Will be passed a list of views available to the current user. Implementations where
@@ -27,11 +28,10 @@ export interface ViewManagerConfig {
27
28
  */
28
29
  initialViewSpec?: (views: ViewInfo[]) => ViewInfo;
29
30
  /**
30
- * Delay after state has been set on associated components before they will be observed for
31
- * any further state changes. Larger values may be useful when providing state to complex
32
- * components such as dashboards or grids that may create dirty state immediately after load.
33
- *
34
- * Specified in milliseconds. Default is 250.
31
+ * Delay (in ms) to wait after state has been set on associated components before listening for
32
+ * further state changes. The long default wait 1000ms is intended to avoid a false positive
33
+ * dirty indicator when linking to complex components such as dashboards or grids that can
34
+ * report immediate changes to state due to internal processing or rendering.
35
35
  */
36
36
  settleTime?: number;
37
37
  /**
@@ -59,8 +59,8 @@ export interface ViewManagerConfig {
59
59
  globalDisplayName?: string;
60
60
  }
61
61
  export interface ViewManagerPersistOptions extends PersistOptions {
62
- /** True to persist favorites or provide specific PersistOptions. (Default true) */
63
- persistFavorites?: boolean | PersistOptions;
62
+ /** True to persist pinning preferences or provide specific PersistOptions. (Default true) */
63
+ persistPinning?: boolean | PersistOptions;
64
64
  /** True to include pending value or provide specific PersistOptions. (Default false) */
65
65
  persistPendingValue?: boolean | PersistOptions;
66
66
  }
@@ -72,8 +72,8 @@ export interface ViewManagerPersistOptions extends PersistOptions {
72
72
  * models can be bound to a single ViewManagerModel, allowing a single view to capture the state
73
73
  * of multiple components - e.g. grouping and filtering options along with grid state.
74
74
  * - Views are persisted back to the server as JsonBlob objects.
75
- * - Views can be private to their owner, or optionally enabled for global use by (all) other users.
76
- * - Views can be marked as favorites for quick access.
75
+ * - Views can be private to their owner, or optionally enabled for sharing to (all) other users.
76
+ * - Views can be marked as pinned for quick access.
77
77
  * - See the desktop {@link ViewManager} component - the initial Hoist UI for this model.
78
78
  */
79
79
  export declare class ViewManagerModel<T = PlainObject> extends HoistModel {
@@ -101,7 +101,7 @@ export declare class ViewManagerModel<T = PlainObject> extends HoistModel {
101
101
  readonly globalDisplayName: string;
102
102
  readonly enableAutoSave: boolean;
103
103
  readonly enableDefault: boolean;
104
- readonly enableFavorites: boolean;
104
+ readonly enableSharing: boolean;
105
105
  readonly manageGlobal: boolean;
106
106
  readonly settleTime: number;
107
107
  readonly initialViewSpec: (views: ViewInfo[]) => ViewInfo;
@@ -109,8 +109,13 @@ export declare class ViewManagerModel<T = PlainObject> extends HoistModel {
109
109
  view: View<T>;
110
110
  /** Loaded saved view library - both private and global */
111
111
  views: ViewInfo[];
112
- /** List of tokens for the user's favorite views. */
113
- favorites: string[];
112
+ /**
113
+ * Map of user's preferred pinned state for views.
114
+ *
115
+ * Note that the actual pinned state for the views is determined by this value, layered
116
+ * over the default state of the views themselves.
117
+ */
118
+ userPinned: Record<string, boolean>;
114
119
  /**
115
120
  * True if user has opted-in to automatically saving changes to personal views (if auto-save
116
121
  * generally available as per `enableAutoSave`).
@@ -121,12 +126,8 @@ export declare class ViewManagerModel<T = PlainObject> extends HoistModel {
121
126
  * require intensive layout/grid work, consider masking affected components with this task.
122
127
  */
123
128
  selectTask: TaskObserver;
124
- /**
125
- * TaskObserver linked to {@link saveAsync}.
126
- */
129
+ /** TaskObserver linked to {@link saveAsync}. */
127
130
  saveTask: TaskObserver;
128
- manageDialogOpen: boolean;
129
- saveAsDialogModel: SaveAsDialogModel;
130
131
  /** Unsaved changes on the current view.*/
131
132
  private pendingValue;
132
133
  /**
@@ -137,7 +138,7 @@ export declare class ViewManagerModel<T = PlainObject> extends HoistModel {
137
138
  */
138
139
  providers: ViewManagerProvider<any>[];
139
140
  /**
140
- * Data access for persisting views
141
+ * Data access for persisting views.
141
142
  * @internal
142
143
  */
143
144
  api: ViewToBlobApi<T>;
@@ -146,9 +147,13 @@ export declare class ViewManagerModel<T = PlainObject> extends HoistModel {
146
147
  get isViewSavable(): boolean;
147
148
  get isViewAutoSavable(): boolean;
148
149
  get autoSaveUnavailableReason(): string;
149
- get favoriteViews(): ViewInfo[];
150
+ get pinnedViews(): ViewInfo[];
151
+ /** Views owned by me */
152
+ get ownedViews(): ViewInfo[];
153
+ /** Views shared *with* me */
154
+ get sharedViews(): ViewInfo[];
155
+ /** Global views */
150
156
  get globalViews(): ViewInfo[];
151
- get privateViews(): ViewInfo[];
152
157
  /** True if any async tasks are pending. */
153
158
  get isLoading(): boolean;
154
159
  /**
@@ -158,17 +163,15 @@ export declare class ViewManagerModel<T = PlainObject> extends HoistModel {
158
163
  private constructor();
159
164
  doLoadAsync(loadSpec: LoadSpec): Promise<void>;
160
165
  selectViewAsync(info: ViewInfo): Promise<void>;
166
+ saveAsAsync(spec: ViewCreateSpec): Promise<void>;
161
167
  saveAsync(): Promise<void>;
162
- saveAsAsync(): Promise<void>;
163
168
  resetAsync(): Promise<void>;
164
169
  getValue(): Partial<T>;
165
170
  setValue(value: Partial<T>): void;
166
- toggleFavorite(token: string): void;
167
- addFavorite(token: string): void;
168
- removeFavorite(token: string): void;
169
- isFavorite(token: string): boolean;
170
- openManageDialog(): void;
171
- closeManageDialog(): void;
171
+ togglePinned(view: ViewInfo): void;
172
+ userPin(view: ViewInfo): void;
173
+ userUnpin(view: ViewInfo): void;
174
+ isUserPinned(view: ViewInfo): boolean | null;
172
175
  validateViewNameAsync(name: string, existing?: ViewInfo): Promise<string>;
173
176
  private initAsync;
174
177
  private loadViewAsync;
@@ -2,19 +2,41 @@ 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 JSON Blobs Service.
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 owner;
12
- constructor(owner: ViewManagerModel<T>);
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
- createViewAsync(name: string, description: string, value: PlainObject): Promise<View<T>>;
16
- updateViewInfoAsync(view: ViewInfo, name: string, description: string, isGlobal: boolean): Promise<View<T>>;
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>>;
38
+ /** Delete a view. */
18
39
  deleteViewAsync(view: ViewInfo): Promise<void>;
19
40
  private trackChange;
41
+ private ensureEditable;
20
42
  }
@@ -1,4 +1,4 @@
1
1
  export * from './ViewManagerModel';
2
2
  export * from './ViewInfo';
3
3
  export * from './View';
4
- export * from './SaveAsDialogModel';
4
+ export * from './ViewToBlobApi';
@@ -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,10 @@
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
+ constructor(parent: ViewManagerModel);
10
+ }
@@ -1,5 +1,5 @@
1
- import { ViewManagerProps } from './ViewManager';
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<ViewManagerProps>;
5
+ export declare const viewMenu: import("@xh/hoist/core").ElementFactory<import("@xh/hoist/core").DefaultHoistProps<ViewManagerLocalModel>>;
@@ -1,5 +1,6 @@
1
- import { ManageDialogModel } from './ManageDialogModel';
1
+ import { GridModel } from '@xh/hoist/cmp/grid';
2
2
  /**
3
- * Default management dialog for ViewManager
3
+ * Default management dialog for ViewManager.
4
4
  */
5
- export declare const manageDialog: import("@xh/hoist/core").ElementFactory<import("@xh/hoist/core").DefaultHoistProps<ManageDialogModel>>;
5
+ export declare const manageDialog: import("@xh/hoist/core").ElementFactory<import("@xh/hoist/core").DefaultHoistProps<any>>;
6
+ 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 { EditFormModel } from './EditFormModel';
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
- privateGridModel: GridModel;
12
+ isOpen: boolean;
13
+ ownedGridModel: GridModel;
13
14
  globalGridModel: GridModel;
14
- editFormModel: EditFormModel;
15
+ sharedGridModel: GridModel;
16
+ viewPanelModel: ViewPanelModel;
15
17
  tabContainerModel: TabContainerModel;
16
18
  filter: FilterTestFn;
17
19
  readonly updateTask: TaskObserver;
@@ -19,20 +21,27 @@ export declare class ManageDialogModel extends HoistModel {
19
21
  get gridModel(): GridModel;
20
22
  get selectedView(): ViewInfo;
21
23
  get selectedViews(): ViewInfo[];
22
- get canDelete(): boolean;
23
24
  get manageGlobal(): boolean;
24
25
  get typeDisplayName(): string;
25
26
  get globalDisplayName(): string;
26
- get enableFavorites(): boolean;
27
- constructor();
27
+ get enableSharing(): boolean;
28
+ constructor(viewManagerModel: ViewManagerModel);
29
+ open(): void;
28
30
  close(): void;
29
- onLinked(): void;
31
+ activateSelectedViewAndClose(): void;
30
32
  doLoadAsync(loadSpec: LoadSpec): Promise<void>;
31
33
  deleteAsync(views: ViewInfo[]): Promise<void>;
32
- updateAsync(view: ViewInfo, name: string, description: string, isGlobal: boolean): Promise<void>;
34
+ updateAsync(view: ViewInfo, update: ViewUpdateSpec): Promise<void>;
35
+ makeGlobalAsync(view: ViewInfo): Promise<void>;
36
+ togglePinned(views: ViewInfo[]): void;
37
+ private init;
33
38
  private doUpdateAsync;
34
39
  private doDeleteAsync;
35
- selectViewAsync(view: ViewInfo): Promise<void>;
40
+ private doMakeGlobalAsync;
41
+ private selectViewAsync;
36
42
  private createGridModel;
37
43
  private createTabContainerModel;
44
+ private get ownedTabTitle();
45
+ private get globalTabTitle();
46
+ private get sharedTabTitle();
38
47
  }
@@ -1,4 +1,4 @@
1
- import { SaveAsDialogModel } from '@xh/hoist/cmp/viewmanager/';
1
+ import { SaveAsDialogModel } from './SaveAsDialogModel';
2
2
  /**
3
3
  * Default Save As dialog used by ViewManager.
4
4
  */
@@ -1,7 +1,6 @@
1
1
  import { FormModel } from '@xh/hoist/cmp/form';
2
2
  import { HoistModel } from '@xh/hoist/core';
3
- import { View } from './View';
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
- openAsync(): Promise<View>;
18
- cancel(): void;
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,3 @@
1
+ import { ViewManagerModel } from '@xh/hoist/cmp/viewmanager';
2
+ import { SelectOption } from '@xh/hoist/core';
3
+ export declare function getGroupOptions(model: ViewManagerModel, type: 'owned' | 'global'): SelectOption[];
@@ -0,0 +1 @@
1
+ export declare const viewMultiPanel: import("@xh/hoist/core").ElementFactory<import("@xh/hoist/core").DefaultHoistProps<any>>;
@@ -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>>;
@@ -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 EditFormModel extends HoistModel {
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
  }
@@ -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} '${this.name}'`;
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, as per {@link ViewManagerConfig.type}. */
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
- /** Original creator of the view, and the only user with access to it if not global. */
25
- readonly owner: string;
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
- private readonly model: ViewManagerModel;
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.isGlobal = blob.acl === '*';
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
- * True if user has tagged this view as a favorite. Note that a user's list of favorite views
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 isFavorite(): boolean {
52
- return this.model.isFavorite(this.token);
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} '${this.name}'`;
103
+ return `${this.model.typeDisplayName} "${this.name}"`;
57
104
  }
58
105
  }