@genesislcap/foundation-workspace 14.406.0-workspaces.7 → 14.411.0
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/dist/dts/workspace/grid-register/grid-register.d.ts +5 -3
- package/dist/dts/workspace/grid-register/grid-register.d.ts.map +1 -1
- package/dist/dts/workspace/grid-register/grid-register.template.d.ts +1 -1
- package/dist/dts/workspace/grid-register/grid-register.template.d.ts.map +1 -1
- package/dist/dts/workspace/grid-registry.d.ts +11 -11
- package/dist/dts/workspace/grid-registry.d.ts.map +1 -1
- package/dist/dts/workspace/layout-registry.d.ts +2 -1
- package/dist/dts/workspace/layout-registry.d.ts.map +1 -1
- package/dist/dts/workspace/layout-wrapper/layout-wrapper.d.ts +4 -2
- package/dist/dts/workspace/layout-wrapper/layout-wrapper.d.ts.map +1 -1
- package/dist/dts/workspace/layout-wrapper/layout-wrapper.template.d.ts +1 -1
- package/dist/dts/workspace/layout-wrapper/layout-wrapper.template.d.ts.map +1 -1
- package/dist/dts/workspace/workspace.types.d.ts +2 -1
- package/dist/dts/workspace/workspace.types.d.ts.map +1 -1
- package/dist/dts/workspace-components.d.ts +1 -1
- package/dist/dts/workspace-components.d.ts.map +1 -1
- package/dist/dts/workspace-manager/workspace-manager.d.ts +2 -1
- package/dist/dts/workspace-manager/workspace-manager.d.ts.map +1 -1
- package/dist/dts/workspace-manager/workspace-manager.styles.d.ts.map +1 -1
- package/dist/dts/workspace-manager/workspace-manager.template.d.ts +5 -1
- package/dist/dts/workspace-manager/workspace-manager.template.d.ts.map +1 -1
- package/dist/esm/workspace/filter-registry.js +1 -1
- package/dist/esm/workspace/grid-register/grid-register.js +20 -16
- package/dist/esm/workspace/grid-register/grid-register.template.js +1 -1
- package/dist/esm/workspace/grid-registry.js +21 -10
- package/dist/esm/workspace/layout-registry.js +5 -2
- package/dist/esm/workspace/layout-wrapper/layout-wrapper.js +13 -6
- package/dist/esm/workspace/layout-wrapper/layout-wrapper.template.js +1 -1
- package/dist/esm/workspace/workspace-state.js +1 -1
- package/dist/esm/workspace-manager/workspace-manager.js +38 -5
- package/dist/esm/workspace-manager/workspace-manager.styles.js +2 -25
- package/dist/esm/workspace-manager/workspace-manager.template.js +26 -14
- package/dist/foundation-workspace.api.json +74 -8
- package/dist/foundation-workspace.d.ts +14 -10
- package/package.json +16 -17
- package/src/workspace/filter-registry.ts +1 -1
- package/src/workspace/grid-register/grid-register.template.ts +1 -2
- package/src/workspace/grid-register/grid-register.ts +20 -18
- package/src/workspace/grid-registry.ts +35 -21
- package/src/workspace/layout-registry.ts +11 -6
- package/src/workspace/layout-wrapper/layout-wrapper.template.ts +1 -2
- package/src/workspace/layout-wrapper/layout-wrapper.ts +15 -10
- package/src/workspace/workspace-state.ts +1 -1
- package/src/workspace/workspace.types.ts +3 -1
- package/src/workspace-components.ts +1 -1
- package/src/workspace-manager/workspace-manager.styles.ts +2 -25
- package/src/workspace-manager/workspace-manager.template.ts +32 -14
- package/src/workspace-manager/workspace-manager.ts +38 -5
- package/docs/.gitkeep +0 -1
- package/docs/api/foundation-workspace.defaultfilterregistry.md +0 -17
- package/docs/api/foundation-workspace.defaultgridregistry.md +0 -17
- package/docs/api/foundation-workspace.defaultlayoutregistry.md +0 -18
- package/docs/api/foundation-workspace.defaultworkspacestate._constructor_.md +0 -65
- package/docs/api/foundation-workspace.defaultworkspacestate.auth.md +0 -14
- package/docs/api/foundation-workspace.defaultworkspacestate.kvstorage.md +0 -14
- package/docs/api/foundation-workspace.defaultworkspacestate.md +0 -115
- package/docs/api/foundation-workspace.filterregistration.filterkey.md +0 -14
- package/docs/api/foundation-workspace.filterregistration.getfiltervalue.md +0 -14
- package/docs/api/foundation-workspace.filterregistration.md +0 -98
- package/docs/api/foundation-workspace.filterregistration.setfiltervalue.md +0 -14
- package/docs/api/foundation-workspace.filterregistry.applyfiltersvalues.md +0 -53
- package/docs/api/foundation-workspace.filterregistry.getallfiltersvalues.md +0 -18
- package/docs/api/foundation-workspace.filterregistry.md +0 -16
- package/docs/api/foundation-workspace.filterregistry.registerfilter.md +0 -81
- package/docs/api/foundation-workspace.filterregistry.unregisterfilter.md +0 -53
- package/docs/api/foundation-workspace.gridregister.gridkey.md +0 -14
- package/docs/api/foundation-workspace.gridregister.gridregistry.md +0 -14
- package/docs/api/foundation-workspace.gridregister.md +0 -100
- package/docs/api/foundation-workspace.gridregister.workspacestate.md +0 -14
- package/docs/api/foundation-workspace.gridregistration.columnapi.md +0 -14
- package/docs/api/foundation-workspace.gridregistration.gridapi.md +0 -14
- package/docs/api/foundation-workspace.gridregistration.gridkey.md +0 -14
- package/docs/api/foundation-workspace.gridregistration.md +0 -98
- package/docs/api/foundation-workspace.gridregistry.applyallgridssettings.md +0 -53
- package/docs/api/foundation-workspace.gridregistry.applygridsettings.md +0 -72
- package/docs/api/foundation-workspace.gridregistry.getallgridssettings.md +0 -18
- package/docs/api/foundation-workspace.gridregistry.getgrid.md +0 -53
- package/docs/api/foundation-workspace.gridregistry.md +0 -16
- package/docs/api/foundation-workspace.gridregistry.registergrid.md +0 -81
- package/docs/api/foundation-workspace.gridregistry.unregistergrid.md +0 -53
- package/docs/api/foundation-workspace.layoutregistry.applysavedlayouts.md +0 -53
- package/docs/api/foundation-workspace.layoutregistry.getlayoutsconfigs.md +0 -18
- package/docs/api/foundation-workspace.layoutregistry.md +0 -16
- package/docs/api/foundation-workspace.layoutregistry.registerlayout.md +0 -67
- package/docs/api/foundation-workspace.layoutregistry.unregisterlayout.md +0 -53
- package/docs/api/foundation-workspace.layoutwrapper.layoutkey.md +0 -14
- package/docs/api/foundation-workspace.layoutwrapper.layoutregistry.md +0 -14
- package/docs/api/foundation-workspace.layoutwrapper.md +0 -81
- package/docs/api/foundation-workspace.loadmode.md +0 -16
- package/docs/api/foundation-workspace.md +0 -332
- package/docs/api/foundation-workspace.savedfiltervalue.filterkey.md +0 -14
- package/docs/api/foundation-workspace.savedfiltervalue.md +0 -79
- package/docs/api/foundation-workspace.savedfiltervalue.value.md +0 -14
- package/docs/api/foundation-workspace.savedgridsettings.columnstate.md +0 -14
- package/docs/api/foundation-workspace.savedgridsettings.gridkey.md +0 -14
- package/docs/api/foundation-workspace.savedgridsettings.md +0 -99
- package/docs/api/foundation-workspace.savedgridsettings.savedat.md +0 -14
- package/docs/api/foundation-workspace.savedlayout.layout.md +0 -14
- package/docs/api/foundation-workspace.savedlayout.layoutkey.md +0 -14
- package/docs/api/foundation-workspace.savedlayout.md +0 -79
- package/docs/api/foundation-workspace.savedworkspace.description.md +0 -14
- package/docs/api/foundation-workspace.savedworkspace.filters.md +0 -14
- package/docs/api/foundation-workspace.savedworkspace.grids.md +0 -14
- package/docs/api/foundation-workspace.savedworkspace.layouts.md +0 -14
- package/docs/api/foundation-workspace.savedworkspace.md +0 -174
- package/docs/api/foundation-workspace.savedworkspace.name.md +0 -14
- package/docs/api/foundation-workspace.savedworkspace.savedat.md +0 -14
- package/docs/api/foundation-workspace.savedworkspace.username.md +0 -14
- package/docs/api/foundation-workspace.sharedworkspace.createdon.md +0 -14
- package/docs/api/foundation-workspace.sharedworkspace.data.md +0 -14
- package/docs/api/foundation-workspace.sharedworkspace.description.md +0 -14
- package/docs/api/foundation-workspace.sharedworkspace.id.md +0 -14
- package/docs/api/foundation-workspace.sharedworkspace.md +0 -174
- package/docs/api/foundation-workspace.sharedworkspace.modifiedon.md +0 -14
- package/docs/api/foundation-workspace.sharedworkspace.name.md +0 -14
- package/docs/api/foundation-workspace.sharedworkspace.username.md +0 -14
- package/docs/api/foundation-workspace.workspacecomponents.md +0 -29
- package/docs/api/foundation-workspace.workspacemanager.applyingworkspace.md +0 -14
- package/docs/api/foundation-workspace.workspacemanager.auth.md +0 -14
- package/docs/api/foundation-workspace.workspacemanager.canshareworkspace.md +0 -14
- package/docs/api/foundation-workspace.workspacemanager.connect.md +0 -14
- package/docs/api/foundation-workspace.workspacemanager.dialogboundary.md +0 -14
- package/docs/api/foundation-workspace.workspacemanager.filterregistry.md +0 -14
- package/docs/api/foundation-workspace.workspacemanager.gridregistry.md +0 -14
- package/docs/api/foundation-workspace.workspacemanager.isloading.md +0 -14
- package/docs/api/foundation-workspace.workspacemanager.layoutregistry.md +0 -14
- package/docs/api/foundation-workspace.workspacemanager.loadmodal.md +0 -14
- package/docs/api/foundation-workspace.workspacemanager.loadmode.md +0 -14
- package/docs/api/foundation-workspace.workspacemanager.md +0 -442
- package/docs/api/foundation-workspace.workspacemanager.savedworkspaces.md +0 -14
- package/docs/api/foundation-workspace.workspacemanager.savemodal.md +0 -14
- package/docs/api/foundation-workspace.workspacemanager.savemode.md +0 -14
- package/docs/api/foundation-workspace.workspacemanager.selectedworkspacetooverwrite.md +0 -14
- package/docs/api/foundation-workspace.workspacemanager.sharedworkspacedialogboundary.md +0 -14
- package/docs/api/foundation-workspace.workspacemanager.sharedworkspaces.md +0 -14
- package/docs/api/foundation-workspace.workspacemanager.workspacedescription.md +0 -14
- package/docs/api/foundation-workspace.workspacemanager.workspacename.md +0 -14
- package/docs/api/foundation-workspace.workspacemanager.workspacestate.md +0 -14
- package/docs/api/foundation-workspace.workspacemanager.workspacetoshare.md +0 -14
- package/docs/api/foundation-workspace.workspacestate.deleteworkspace.md +0 -53
- package/docs/api/foundation-workspace.workspacestate.getcurrentworkspace.md +0 -18
- package/docs/api/foundation-workspace.workspacestate.getsavedworkspaces.md +0 -18
- package/docs/api/foundation-workspace.workspacestate.loadworkspace.md +0 -53
- package/docs/api/foundation-workspace.workspacestate.md +0 -16
- package/docs/api/foundation-workspace.workspacestate.saveworkspace.md +0 -111
- package/docs/api/foundation-workspace.workspacestate.setcurrentworkspace.md +0 -53
- package/docs/api/index.md +0 -30
- package/docs/api-report.md.api.md +0 -372
- package/temp/api-report.md.api.md +0 -372
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import type { ColumnApi, GridApi } from '@ag-grid-community/core';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { GridPro } from '@genesislcap/grid-pro';
|
|
3
|
+
import { FoundationElement, attr, customElement } from '@genesislcap/web-core';
|
|
4
|
+
import { GridRegistry } from '../grid-registry';
|
|
5
|
+
import { WorkspaceState } from '../workspace-state';
|
|
4
6
|
import { GridRegisterTemplate as template } from './grid-register.template';
|
|
5
7
|
|
|
6
8
|
const name = 'grid-register';
|
|
@@ -13,22 +15,24 @@ const name = 'grid-register';
|
|
|
13
15
|
name,
|
|
14
16
|
template,
|
|
15
17
|
})
|
|
16
|
-
export class GridRegister extends
|
|
18
|
+
export class GridRegister extends FoundationElement {
|
|
17
19
|
@attr({ attribute: 'grid-key' }) gridKey: string;
|
|
20
|
+
@attr({ attribute: 'design-system-prefix' }) designSystemPrefix: string = 'rapid';
|
|
18
21
|
|
|
19
22
|
@GridRegistry gridRegistry: GridRegistry;
|
|
20
23
|
@WorkspaceState workspaceState: WorkspaceState;
|
|
21
24
|
|
|
22
|
-
private gridElement:
|
|
25
|
+
private gridElement: GridPro | null = null;
|
|
23
26
|
private gridApi: GridApi | null = null;
|
|
24
27
|
private columnApi: ColumnApi | null = null;
|
|
25
|
-
private workspaceSettingsApplied: boolean = false;
|
|
26
28
|
|
|
27
29
|
connectedCallback(): void {
|
|
30
|
+
super.connectedCallback();
|
|
28
31
|
this.findAndRegisterGrid();
|
|
29
32
|
}
|
|
30
33
|
|
|
31
34
|
disconnectedCallback(): void {
|
|
35
|
+
super.disconnectedCallback();
|
|
32
36
|
if (this.gridKey) {
|
|
33
37
|
this.gridRegistry.unregisterGrid(this.gridKey);
|
|
34
38
|
}
|
|
@@ -37,20 +41,21 @@ export class GridRegister extends HTMLElement {
|
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
private findAndRegisterGrid(): void {
|
|
40
|
-
|
|
44
|
+
const gridTag = `${this.designSystemPrefix}-grid-pro`;
|
|
45
|
+
this.gridElement = this.querySelector(gridTag) as GridPro;
|
|
41
46
|
|
|
42
47
|
if (this.gridElement) {
|
|
43
48
|
this.gridElement.addEventListener('gridReady', this.handleGridReady as EventListener);
|
|
44
49
|
this.attachToGridApis();
|
|
45
50
|
} else {
|
|
46
51
|
setTimeout(() => {
|
|
47
|
-
this.gridElement = this.querySelector(
|
|
52
|
+
this.gridElement = this.querySelector(gridTag) as GridPro;
|
|
48
53
|
|
|
49
54
|
if (this.gridElement) {
|
|
50
55
|
this.gridElement.addEventListener('gridReady', this.handleGridReady as EventListener);
|
|
51
56
|
this.attachToGridApis();
|
|
52
57
|
} else {
|
|
53
|
-
console.warn(`grid-register:
|
|
58
|
+
console.warn(`grid-register: ${gridTag} element not found`);
|
|
54
59
|
}
|
|
55
60
|
}, 100);
|
|
56
61
|
}
|
|
@@ -65,7 +70,7 @@ export class GridRegister extends HTMLElement {
|
|
|
65
70
|
return;
|
|
66
71
|
}
|
|
67
72
|
|
|
68
|
-
const anyGrid:
|
|
73
|
+
const anyGrid: GridPro = this.gridElement;
|
|
69
74
|
const gridApi = anyGrid.gridApi || null;
|
|
70
75
|
const columnApi = anyGrid.columnApi || null;
|
|
71
76
|
const persistKey = anyGrid?.getAttribute?.('persist-column-state-key') || this.gridKey;
|
|
@@ -76,19 +81,16 @@ export class GridRegister extends HTMLElement {
|
|
|
76
81
|
this.gridApi = gridApi;
|
|
77
82
|
this.columnApi = columnApi;
|
|
78
83
|
|
|
79
|
-
|
|
80
|
-
if (!effectiveGridKey) {
|
|
84
|
+
if (!persistKey) {
|
|
81
85
|
console.warn('grid-register: missing persist-column-state-key; grid state will not be saved');
|
|
82
86
|
} else {
|
|
83
|
-
this.gridRegistry.registerGrid(
|
|
84
|
-
this.gridKey =
|
|
87
|
+
this.gridRegistry.registerGrid(persistKey, gridApi, columnApi);
|
|
88
|
+
this.gridKey = persistKey;
|
|
85
89
|
}
|
|
86
90
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
});
|
|
91
|
-
}
|
|
91
|
+
this.loadWorkspaceColumnState().catch((error) => {
|
|
92
|
+
console.warn(`Failed to apply column state for ${this.gridKey} on gridReady:`, error);
|
|
93
|
+
});
|
|
92
94
|
}
|
|
93
95
|
|
|
94
96
|
private detachFromGridApis(): void {
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
import type { ColumnApi, GridApi } from '@ag-grid-community/core';
|
|
2
|
-
import { DI } from '@
|
|
2
|
+
import { DI } from '@genesislcap/web-core';
|
|
3
3
|
import type { SavedGridSettings } from './workspace.types';
|
|
4
4
|
|
|
5
|
+
/**
|
|
6
|
+
* @alpha
|
|
7
|
+
*/
|
|
8
|
+
export interface GridRegistration {
|
|
9
|
+
gridKey: string;
|
|
10
|
+
gridApi: GridApi;
|
|
11
|
+
columnApi: ColumnApi;
|
|
12
|
+
}
|
|
13
|
+
|
|
5
14
|
/**
|
|
6
15
|
* @alpha
|
|
7
16
|
*/
|
|
8
17
|
export interface GridRegistry {
|
|
9
18
|
registerGrid(gridKey: string, gridApi: unknown, columnApi: unknown): void;
|
|
10
|
-
getGrid(gridKey: string):
|
|
19
|
+
getGrid(gridKey: string): GridRegistration | null;
|
|
11
20
|
unregisterGrid(gridKey: string): void;
|
|
12
21
|
getAllGridsSettings(): SavedGridSettings[];
|
|
13
22
|
applyGridSettings(
|
|
@@ -17,15 +26,6 @@ export interface GridRegistry {
|
|
|
17
26
|
applyAllGridsSettings(gridsSettings: SavedGridSettings[]): Promise<void>;
|
|
18
27
|
}
|
|
19
28
|
|
|
20
|
-
/**
|
|
21
|
-
* @alpha
|
|
22
|
-
*/
|
|
23
|
-
export interface GridRegistration {
|
|
24
|
-
gridKey: string;
|
|
25
|
-
gridApi: GridApi;
|
|
26
|
-
columnApi: ColumnApi;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
29
|
/**
|
|
30
30
|
* @alpha
|
|
31
31
|
*/
|
|
@@ -43,7 +43,7 @@ export class DefaultGridRegistry implements GridRegistry {
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
getGrid(gridKey: string):
|
|
46
|
+
getGrid(gridKey: string): GridRegistration | null {
|
|
47
47
|
return this.grids.get(gridKey) || null;
|
|
48
48
|
}
|
|
49
49
|
|
|
@@ -75,7 +75,7 @@ export class DefaultGridRegistry implements GridRegistry {
|
|
|
75
75
|
): Promise<boolean> {
|
|
76
76
|
const gridRegistration = this.grids.get(gridSetting.gridKey);
|
|
77
77
|
|
|
78
|
-
if (!gridRegistration || !gridRegistration.columnApi
|
|
78
|
+
if (!gridRegistration || (!gridRegistration.columnApi && !gridRegistration.gridApi)) {
|
|
79
79
|
return false;
|
|
80
80
|
}
|
|
81
81
|
|
|
@@ -90,10 +90,23 @@ export class DefaultGridRegistry implements GridRegistry {
|
|
|
90
90
|
|
|
91
91
|
try {
|
|
92
92
|
if (shouldApplyColumns) {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
93
|
+
// Prefer Grid API if available, otherwise fall back to Column API.
|
|
94
|
+
// (AG Grid's Column API definitely supports applyColumnState; this is defensive.)
|
|
95
|
+
const applyColumnStateFn =
|
|
96
|
+
(gridRegistration.gridApi as any)?.applyColumnState?.bind(gridRegistration.gridApi) ??
|
|
97
|
+
(gridRegistration.columnApi as any)?.applyColumnState?.bind(gridRegistration.columnApi);
|
|
98
|
+
|
|
99
|
+
if (applyColumnStateFn) {
|
|
100
|
+
applyColumnStateFn({
|
|
101
|
+
state: gridSetting.columnState,
|
|
102
|
+
applyOrder: true,
|
|
103
|
+
});
|
|
104
|
+
} else {
|
|
105
|
+
console.warn(
|
|
106
|
+
`GridRegistry: applyColumnState not found for ${gridSetting.gridKey} (gridApi/columnApi)`,
|
|
107
|
+
);
|
|
108
|
+
return false;
|
|
109
|
+
}
|
|
97
110
|
}
|
|
98
111
|
|
|
99
112
|
return true;
|
|
@@ -106,7 +119,6 @@ export class DefaultGridRegistry implements GridRegistry {
|
|
|
106
119
|
async applyAllGridsSettings(
|
|
107
120
|
gridsSettings: SavedGridSettings[],
|
|
108
121
|
maxRetries: number = 3,
|
|
109
|
-
delayMs: number = 200,
|
|
110
122
|
): Promise<void> {
|
|
111
123
|
// eslint-disable-next-line no-plusplus
|
|
112
124
|
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
@@ -125,14 +137,16 @@ export class DefaultGridRegistry implements GridRegistry {
|
|
|
125
137
|
break;
|
|
126
138
|
}
|
|
127
139
|
|
|
128
|
-
// await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
129
140
|
gridsSettings = remainingSettings;
|
|
130
141
|
}
|
|
131
142
|
}
|
|
132
143
|
|
|
133
144
|
private getGridSettings(gridKey: string, grid: GridRegistration): SavedGridSettings | null {
|
|
134
145
|
if (grid) {
|
|
135
|
-
|
|
146
|
+
// Prefer Grid API if available, otherwise fall back to Column API.
|
|
147
|
+
// (AG Grid's Column state is typically on ColumnApi; this is defensive.)
|
|
148
|
+
const columnState =
|
|
149
|
+
(grid.gridApi as any)?.getColumnState?.() ?? grid.columnApi?.getColumnState();
|
|
136
150
|
const columnCount = columnState?.length || 0;
|
|
137
151
|
|
|
138
152
|
console.log(`Saved grid settings for ${gridKey}: ${columnCount} columns`);
|
|
@@ -153,5 +167,5 @@ export class DefaultGridRegistry implements GridRegistry {
|
|
|
153
167
|
* @alpha
|
|
154
168
|
*/
|
|
155
169
|
export const GridRegistry = DI.createInterface<GridRegistry>((x) =>
|
|
156
|
-
x.singleton(DefaultGridRegistry
|
|
170
|
+
x.singleton(DefaultGridRegistry),
|
|
157
171
|
);
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { FoundationLayout } from '@genesislcap/foundation-layout';
|
|
2
|
+
import { DI } from '@genesislcap/web-core';
|
|
2
3
|
import type { SavedLayout } from './workspace.types';
|
|
3
4
|
|
|
5
|
+
const LAYOUT_DELAY = 300;
|
|
6
|
+
|
|
4
7
|
/**
|
|
5
8
|
* @alpha
|
|
6
9
|
*/
|
|
@@ -16,9 +19,9 @@ export interface LayoutRegistry {
|
|
|
16
19
|
* @alpha
|
|
17
20
|
*/
|
|
18
21
|
export class DefaultLayoutRegistry implements LayoutRegistry {
|
|
19
|
-
private layouts: Map<string,
|
|
22
|
+
private layouts: Map<string, FoundationLayout> = new Map();
|
|
20
23
|
|
|
21
|
-
registerLayout(layoutKey: string, layout:
|
|
24
|
+
registerLayout(layoutKey: string, layout: FoundationLayout): void {
|
|
22
25
|
if (!layoutKey) {
|
|
23
26
|
return;
|
|
24
27
|
}
|
|
@@ -40,12 +43,14 @@ export class DefaultLayoutRegistry implements LayoutRegistry {
|
|
|
40
43
|
savedLayouts.forEach((s) => {
|
|
41
44
|
const layout = this.layouts.get(s.layoutKey);
|
|
42
45
|
if (layout) {
|
|
43
|
-
layout.loadLayout(s.layout
|
|
46
|
+
layout.loadLayout(s.layout, 'placeholder', true);
|
|
44
47
|
} else {
|
|
45
48
|
console.warn(`layout for ${s.layoutKey} not found`);
|
|
46
49
|
}
|
|
47
50
|
});
|
|
48
|
-
|
|
51
|
+
await new Promise((resolve) => {
|
|
52
|
+
setTimeout(resolve, LAYOUT_DELAY);
|
|
53
|
+
});
|
|
49
54
|
}
|
|
50
55
|
}
|
|
51
56
|
|
|
@@ -54,5 +59,5 @@ export class DefaultLayoutRegistry implements LayoutRegistry {
|
|
|
54
59
|
* @alpha
|
|
55
60
|
*/
|
|
56
61
|
export const LayoutRegistry = DI.createInterface<LayoutRegistry>((x) =>
|
|
57
|
-
x.singleton(DefaultLayoutRegistry
|
|
62
|
+
x.singleton(DefaultLayoutRegistry),
|
|
58
63
|
);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { html } from '@
|
|
2
|
-
import type { ViewTemplate } from '@microsoft/fast-element';
|
|
1
|
+
import { html, ViewTemplate } from '@genesislcap/web-core';
|
|
3
2
|
import type { LayoutWrapper } from './layout-wrapper';
|
|
4
3
|
|
|
5
4
|
export const LayoutWrapperTemplate: ViewTemplate<LayoutWrapper> = html`
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { FoundationLayout } from '@genesislcap/foundation-layout';
|
|
2
|
+
import { FoundationElement, attr, customElement } from '@genesislcap/web-core';
|
|
3
|
+
import { LayoutRegistry } from '../layout-registry';
|
|
3
4
|
import { LayoutWrapperTemplate as template } from './layout-wrapper.template';
|
|
4
5
|
|
|
5
6
|
const name = 'layout-register';
|
|
@@ -12,20 +13,23 @@ const name = 'layout-register';
|
|
|
12
13
|
name,
|
|
13
14
|
template,
|
|
14
15
|
})
|
|
15
|
-
export class LayoutWrapper extends
|
|
16
|
+
export class LayoutWrapper extends FoundationElement {
|
|
16
17
|
@attr({ attribute: 'layout-key' }) layoutKey: string;
|
|
18
|
+
@attr({ attribute: 'design-system-prefix' }) designSystemPrefix: string = 'rapid';
|
|
17
19
|
|
|
18
20
|
@LayoutRegistry layoutRegistry: LayoutRegistry;
|
|
19
21
|
|
|
20
|
-
private layoutElement:
|
|
22
|
+
private layoutElement: FoundationLayout | null = null;
|
|
21
23
|
|
|
22
24
|
connectedCallback(): void {
|
|
25
|
+
super.connectedCallback();
|
|
23
26
|
this.findAndRegisterLayout();
|
|
24
27
|
}
|
|
25
28
|
|
|
26
29
|
disconnectedCallback(): void {
|
|
30
|
+
super.disconnectedCallback();
|
|
27
31
|
const layoutKey =
|
|
28
|
-
|
|
32
|
+
this.layoutElement?.autoSaveKey ??
|
|
29
33
|
this.layoutElement?.getAttribute?.('auto-save-key') ??
|
|
30
34
|
this.layoutKey;
|
|
31
35
|
|
|
@@ -35,16 +39,17 @@ export class LayoutWrapper extends HTMLElement {
|
|
|
35
39
|
}
|
|
36
40
|
|
|
37
41
|
private findAndRegisterLayout(): void {
|
|
38
|
-
|
|
42
|
+
const layoutTag = `${this.designSystemPrefix}-layout`;
|
|
43
|
+
let layoutElement = this.querySelector(layoutTag) as FoundationLayout;
|
|
39
44
|
|
|
40
|
-
const registerLayout = (layout:
|
|
45
|
+
const registerLayout = (layout: FoundationLayout | null) => {
|
|
41
46
|
if (!layout) {
|
|
42
|
-
console.warn(`layout-register:
|
|
47
|
+
console.warn(`layout-register: ${layoutTag} element not found`);
|
|
43
48
|
return;
|
|
44
49
|
}
|
|
45
50
|
this.layoutElement = layout;
|
|
46
51
|
const layoutKeyFromLayout =
|
|
47
|
-
|
|
52
|
+
layout.autoSaveKey ?? layout.getAttribute?.('auto-save-key') ?? this.layoutKey;
|
|
48
53
|
|
|
49
54
|
if (!layoutKeyFromLayout) {
|
|
50
55
|
console.warn('layout-register: missing layout key (auto-save-key/layout-key)');
|
|
@@ -58,7 +63,7 @@ export class LayoutWrapper extends HTMLElement {
|
|
|
58
63
|
registerLayout(layoutElement);
|
|
59
64
|
} else {
|
|
60
65
|
setTimeout(() => {
|
|
61
|
-
layoutElement = this.querySelector(
|
|
66
|
+
layoutElement = this.querySelector(layoutTag) as FoundationLayout;
|
|
62
67
|
registerLayout(layoutElement);
|
|
63
68
|
}, 100);
|
|
64
69
|
}
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
type KVStorage as KVStorageType,
|
|
5
5
|
type Auth as AuthType,
|
|
6
6
|
} from '@genesislcap/foundation-comms';
|
|
7
|
-
import { DI } from '@
|
|
7
|
+
import { DI } from '@genesislcap/web-core';
|
|
8
8
|
import type { SavedWorkspace } from './workspace-state.types';
|
|
9
9
|
import type { SavedFilterValue, SavedGridSettings, SavedLayout } from './workspace.types';
|
|
10
10
|
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { SerialisedLayout } from '@genesislcap/foundation-layout';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Workspace persistence types.
|
|
3
5
|
* Layout and column state use generic shapes so consumers can use foundation-layout and ag-grid types.
|
|
@@ -22,5 +24,5 @@ export interface SavedFilterValue {
|
|
|
22
24
|
*/
|
|
23
25
|
export interface SavedLayout {
|
|
24
26
|
layoutKey: string;
|
|
25
|
-
layout:
|
|
27
|
+
layout: SerialisedLayout;
|
|
26
28
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { css } from '@
|
|
1
|
+
import { css } from '@genesislcap/web-core';
|
|
2
2
|
|
|
3
3
|
export const WorkspaceManagerStyles = css`
|
|
4
4
|
.workspace-manager {
|
|
@@ -64,6 +64,7 @@ export const WorkspaceManagerStyles = css`
|
|
|
64
64
|
cursor: pointer;
|
|
65
65
|
display: flex;
|
|
66
66
|
align-items: center;
|
|
67
|
+
gap: 5px;
|
|
67
68
|
}
|
|
68
69
|
|
|
69
70
|
.workspace-item:hover {
|
|
@@ -101,30 +102,6 @@ export const WorkspaceManagerStyles = css`
|
|
|
101
102
|
line-height: 1.4;
|
|
102
103
|
}
|
|
103
104
|
|
|
104
|
-
.workspace-description-input {
|
|
105
|
-
width: 100%;
|
|
106
|
-
min-height: 60px;
|
|
107
|
-
padding: 8px 12px;
|
|
108
|
-
margin-bottom: 16px;
|
|
109
|
-
font-family: inherit;
|
|
110
|
-
font-size: 14px;
|
|
111
|
-
border: 1px solid var(--neutral-stroke-rest);
|
|
112
|
-
border-radius: 4px;
|
|
113
|
-
background: var(--neutral-fill-rest);
|
|
114
|
-
color: var(--neutral-foreground-rest);
|
|
115
|
-
resize: vertical;
|
|
116
|
-
box-sizing: border-box;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
.workspace-description-input::placeholder {
|
|
120
|
-
color: var(--neutral-foreground-hint);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
.workspace-description-input:focus {
|
|
124
|
-
outline: none;
|
|
125
|
-
border-color: var(--accent-fill-rest);
|
|
126
|
-
}
|
|
127
|
-
|
|
128
105
|
.loading-container {
|
|
129
106
|
display: flex;
|
|
130
107
|
flex-direction: column;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { sync, whenElse } from '@genesislcap/foundation-utils';
|
|
2
|
-
import { ExecutionContext, html, ref, repeat, when } from '@
|
|
2
|
+
import { ExecutionContext, html, ref, repeat, ViewTemplate, when } from '@genesislcap/web-core';
|
|
3
3
|
import { SavedWorkspace, SharedWorkspace } from '../workspace/workspace-state.types';
|
|
4
4
|
import type { WorkspaceManager } from './workspace-manager';
|
|
5
5
|
|
|
6
6
|
export const WORKSPACE_DESCRIPTION_MAX = 200;
|
|
7
7
|
|
|
8
|
-
export const
|
|
8
|
+
export const workspaceHeaderPartial: ViewTemplate<WorkspaceManager> = html`
|
|
9
9
|
<div class="workspace-manager">
|
|
10
10
|
<rapid-button @click=${(x) => x.openSaveDialog()}>
|
|
11
11
|
<rapid-icon name="download"></rapid-icon>
|
|
@@ -16,6 +16,9 @@ export const WorkspaceManagerTemplate = html<WorkspaceManager>`
|
|
|
16
16
|
Load Workspace
|
|
17
17
|
</rapid-button>
|
|
18
18
|
</div>
|
|
19
|
+
`;
|
|
20
|
+
|
|
21
|
+
export const workspaceSaveModalPartial: ViewTemplate<WorkspaceManager> = html`
|
|
19
22
|
<rapid-modal ${ref('saveModal')}>
|
|
20
23
|
<h2 slot="top">Save Workspace</h2>
|
|
21
24
|
<div class="dialog-content">
|
|
@@ -24,7 +27,7 @@ export const WorkspaceManagerTemplate = html<WorkspaceManager>`
|
|
|
24
27
|
<rapid-segmented-item value="create">Create</rapid-segmented-item>
|
|
25
28
|
<rapid-segmented-item value="overwrite">Overwrite</rapid-segmented-item>
|
|
26
29
|
${when(
|
|
27
|
-
(
|
|
30
|
+
() => false,
|
|
28
31
|
html<WorkspaceManager>`
|
|
29
32
|
<rapid-segmented-item value="shared">Share</rapid-segmented-item>
|
|
30
33
|
`,
|
|
@@ -44,14 +47,15 @@ export const WorkspaceManagerTemplate = html<WorkspaceManager>`
|
|
|
44
47
|
<rapid-label>
|
|
45
48
|
Description (optional, max ${WORKSPACE_DESCRIPTION_MAX} characters):
|
|
46
49
|
</rapid-label>
|
|
47
|
-
<
|
|
50
|
+
<rapid-text-area
|
|
48
51
|
class="save-field workspace-description-input"
|
|
52
|
+
maxlength="${WORKSPACE_DESCRIPTION_MAX}"
|
|
49
53
|
:value=${(x) => x.workspaceDescription}
|
|
50
54
|
@input=${(x, c) =>
|
|
51
55
|
x.updateWorkspaceDescription((c.event.target as HTMLTextAreaElement).value)}
|
|
52
56
|
placeholder="Add a description for this workspace"
|
|
53
57
|
rows="3"
|
|
54
|
-
></
|
|
58
|
+
></rapid-text-area>
|
|
55
59
|
${when(
|
|
56
60
|
(x) => x.workspaceName && x.isWorkspaceExisting(x.workspaceName),
|
|
57
61
|
html`
|
|
@@ -100,14 +104,15 @@ export const WorkspaceManagerTemplate = html<WorkspaceManager>`
|
|
|
100
104
|
)}
|
|
101
105
|
</rapid-radio-group>
|
|
102
106
|
<rapid-label>Description (optional):</rapid-label>
|
|
103
|
-
<
|
|
104
|
-
class="save-field
|
|
107
|
+
<rapid-text-area
|
|
108
|
+
class="save-field"
|
|
105
109
|
:value=${(x) => x.workspaceDescription}
|
|
110
|
+
maxlength="${WORKSPACE_DESCRIPTION_MAX}"
|
|
106
111
|
@input=${(x, c) =>
|
|
107
112
|
x.updateWorkspaceDescription((c.event.target as HTMLTextAreaElement).value)}
|
|
108
113
|
placeholder="Add a description for this workspace"
|
|
109
114
|
rows="3"
|
|
110
|
-
></
|
|
115
|
+
></rapid-text-area>
|
|
111
116
|
<div class="warning-message">
|
|
112
117
|
<rapid-icon name="triangle-exclamation"></rapid-icon>
|
|
113
118
|
This will permanently replace the selected workspace. This action cannot be undone.
|
|
@@ -115,7 +120,7 @@ export const WorkspaceManagerTemplate = html<WorkspaceManager>`
|
|
|
115
120
|
`,
|
|
116
121
|
)}
|
|
117
122
|
${when(
|
|
118
|
-
(
|
|
123
|
+
() => false,
|
|
119
124
|
html<WorkspaceManager>`
|
|
120
125
|
<h3>Share existing workspace:</h3>
|
|
121
126
|
${whenElse(
|
|
@@ -230,6 +235,9 @@ export const WorkspaceManagerTemplate = html<WorkspaceManager>`
|
|
|
230
235
|
<div class="workspace-dialog-boundary" ${ref('sharedWorkspaceDialogBoundary')}></div>
|
|
231
236
|
</div>
|
|
232
237
|
</rapid-modal>
|
|
238
|
+
`;
|
|
239
|
+
|
|
240
|
+
export const workspaceLoadModalPartial: ViewTemplate<WorkspaceManager> = html`
|
|
233
241
|
<rapid-modal ${ref('loadModal')}>
|
|
234
242
|
<h2 slot="top">Load Workspace</h2>
|
|
235
243
|
<div class="dialog-content">
|
|
@@ -244,10 +252,16 @@ export const WorkspaceManagerTemplate = html<WorkspaceManager>`
|
|
|
244
252
|
${when(
|
|
245
253
|
(x) => !x.applyingWorkspace,
|
|
246
254
|
html<WorkspaceManager>`
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
<
|
|
250
|
-
|
|
255
|
+
${when(
|
|
256
|
+
() => false,
|
|
257
|
+
html<WorkspaceManager>`
|
|
258
|
+
<rapid-segmented-control value="${sync((x) => x.loadMode)}">
|
|
259
|
+
<rapid-segmented-item value="MY">My Workspaces</rapid-segmented-item>
|
|
260
|
+
|
|
261
|
+
<rapid-segmented-item value="SHARED">Shared Workspaces</rapid-segmented-item>
|
|
262
|
+
</rapid-segmented-control>
|
|
263
|
+
`,
|
|
264
|
+
)}
|
|
251
265
|
${when(
|
|
252
266
|
(x) => x.loadMode === 'MY',
|
|
253
267
|
html`
|
|
@@ -297,7 +311,7 @@ export const WorkspaceManagerTemplate = html<WorkspaceManager>`
|
|
|
297
311
|
`,
|
|
298
312
|
)}
|
|
299
313
|
${when(
|
|
300
|
-
(
|
|
314
|
+
() => false,
|
|
301
315
|
html`
|
|
302
316
|
<div class="workspace-section">
|
|
303
317
|
<div class="workspace-list">
|
|
@@ -350,3 +364,7 @@ export const WorkspaceManagerTemplate = html<WorkspaceManager>`
|
|
|
350
364
|
<div class="workspace-dialog-boundary" ${ref('dialogBoundary')}></div>
|
|
351
365
|
</rapid-modal>
|
|
352
366
|
`;
|
|
367
|
+
|
|
368
|
+
export const WorkspaceManagerTemplate = html<WorkspaceManager>`
|
|
369
|
+
${workspaceHeaderPartial} ${workspaceSaveModalPartial} ${workspaceLoadModalPartial}
|
|
370
|
+
`;
|
|
@@ -4,8 +4,7 @@ import {
|
|
|
4
4
|
showNotificationToast,
|
|
5
5
|
} from '@genesislcap/foundation-notifications';
|
|
6
6
|
import { Modal } from '@genesislcap/foundation-ui';
|
|
7
|
-
import { customElement, observable } from '@
|
|
8
|
-
import { FoundationElement } from '@microsoft/fast-foundation';
|
|
7
|
+
import { FoundationElement, customElement, observable } from '@genesislcap/web-core';
|
|
9
8
|
import {
|
|
10
9
|
LayoutRegistry,
|
|
11
10
|
GridRegistry,
|
|
@@ -61,6 +60,10 @@ export class WorkspaceManager extends FoundationElement {
|
|
|
61
60
|
|
|
62
61
|
@observable canShareWorkspace: boolean;
|
|
63
62
|
|
|
63
|
+
// Shared workspace functionality is currently disabled.
|
|
64
|
+
// Guard all codepaths that would call `connect.request(...)` / `commitEvent(...)`.
|
|
65
|
+
private readonly sharedWorkspacesEnabled = false;
|
|
66
|
+
|
|
64
67
|
private sanitizeDescription(input: string): string {
|
|
65
68
|
const cleaned = (input ?? '')
|
|
66
69
|
// allow only letters, numbers and whitespace
|
|
@@ -91,8 +94,13 @@ export class WorkspaceManager extends FoundationElement {
|
|
|
91
94
|
async connectedCallback(): Promise<void> {
|
|
92
95
|
super.connectedCallback();
|
|
93
96
|
await this.refreshSavedWorkspaces();
|
|
94
|
-
|
|
95
|
-
|
|
97
|
+
if (this.sharedWorkspacesEnabled) {
|
|
98
|
+
await this.refreshSharedWorkspaces();
|
|
99
|
+
this.canShareWorkspace = this.auth.currentUser.hasPermission('SHARE_WORKSPACE');
|
|
100
|
+
} else {
|
|
101
|
+
this.sharedWorkspaces = [];
|
|
102
|
+
this.canShareWorkspace = false;
|
|
103
|
+
}
|
|
96
104
|
}
|
|
97
105
|
|
|
98
106
|
async refreshSavedWorkspaces(): Promise<void> {
|
|
@@ -108,6 +116,10 @@ export class WorkspaceManager extends FoundationElement {
|
|
|
108
116
|
}
|
|
109
117
|
|
|
110
118
|
async refreshSharedWorkspaces(): Promise<void> {
|
|
119
|
+
if (!this.sharedWorkspacesEnabled) {
|
|
120
|
+
this.sharedWorkspaces = [];
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
111
123
|
try {
|
|
112
124
|
const response: any = await this.connect.request('REQ_SHARED_WORKSPACES');
|
|
113
125
|
const rows: any[] = response?.REPLY || [];
|
|
@@ -197,6 +209,9 @@ export class WorkspaceManager extends FoundationElement {
|
|
|
197
209
|
}
|
|
198
210
|
|
|
199
211
|
private async requestSharedWorkspace(SHARED_WORKSPACE_ID: string): Promise<any[]> {
|
|
212
|
+
if (!this.sharedWorkspacesEnabled) {
|
|
213
|
+
return [];
|
|
214
|
+
}
|
|
200
215
|
try {
|
|
201
216
|
const response = await this.connect.request('REQ_LOAD_SHARED_WORKSPACE', {
|
|
202
217
|
REQUEST: { SHARED_WORKSPACE_ID },
|
|
@@ -215,11 +230,15 @@ export class WorkspaceManager extends FoundationElement {
|
|
|
215
230
|
modifiedOn?: string | number;
|
|
216
231
|
data: string;
|
|
217
232
|
}): Promise<void> {
|
|
233
|
+
if (!this.sharedWorkspacesEnabled) {
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
218
236
|
try {
|
|
219
237
|
this.applyingWorkspace = true;
|
|
220
238
|
const sharedData = await this.requestSharedWorkspace(shared.id);
|
|
221
239
|
if (!sharedData?.length) {
|
|
222
240
|
console.warn('workspace has no data');
|
|
241
|
+
this.applyingWorkspace = false;
|
|
223
242
|
return;
|
|
224
243
|
}
|
|
225
244
|
const dataJoined = sharedData.map((d) => d.WORKSPACE_DATA).join('');
|
|
@@ -275,6 +294,9 @@ export class WorkspaceManager extends FoundationElement {
|
|
|
275
294
|
}
|
|
276
295
|
|
|
277
296
|
async modifySharedWorkspace(sharedWorkspace: SharedWorkspace): Promise<void> {
|
|
297
|
+
if (!this.sharedWorkspacesEnabled) {
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
278
300
|
try {
|
|
279
301
|
const layouts = this.layoutRegistry.getLayoutsConfigs();
|
|
280
302
|
const grids: SavedGridSettings[] = this.gridRegistry.getAllGridsSettings();
|
|
@@ -314,6 +336,9 @@ export class WorkspaceManager extends FoundationElement {
|
|
|
314
336
|
}
|
|
315
337
|
|
|
316
338
|
async deleteSharedWorkspace(sharedWorkspace: SharedWorkspace): Promise<void> {
|
|
339
|
+
if (!this.sharedWorkspacesEnabled) {
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
317
342
|
try {
|
|
318
343
|
const response = await this.connect.commitEvent('EVENT_SHARED_WORKSPACE_DELETE', {
|
|
319
344
|
VALIDATE: false,
|
|
@@ -330,6 +355,9 @@ export class WorkspaceManager extends FoundationElement {
|
|
|
330
355
|
}
|
|
331
356
|
|
|
332
357
|
confirmDeleteSharedWorkspace(sharedWorkspace: SharedWorkspace): void {
|
|
358
|
+
if (!this.sharedWorkspacesEnabled) {
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
333
361
|
if (!sharedWorkspace?.name) return;
|
|
334
362
|
this.showDeleteConfirmation(
|
|
335
363
|
'Delete shared workspace',
|
|
@@ -340,6 +368,9 @@ export class WorkspaceManager extends FoundationElement {
|
|
|
340
368
|
}
|
|
341
369
|
|
|
342
370
|
async shareExistingWorkspace(workspaceName: string): Promise<void> {
|
|
371
|
+
if (!this.sharedWorkspacesEnabled) {
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
343
374
|
const name = workspaceName?.trim();
|
|
344
375
|
if (!name) return;
|
|
345
376
|
try {
|
|
@@ -404,7 +435,9 @@ export class WorkspaceManager extends FoundationElement {
|
|
|
404
435
|
}
|
|
405
436
|
|
|
406
437
|
openLoadDialog(): void {
|
|
407
|
-
this.
|
|
438
|
+
if (this.sharedWorkspacesEnabled) {
|
|
439
|
+
this.refreshSharedWorkspaces();
|
|
440
|
+
}
|
|
408
441
|
this.loadModal.show();
|
|
409
442
|
}
|
|
410
443
|
|
package/docs/.gitkeep
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
|