@finos/legend-extension-dsl-data-space 10.4.256 → 10.4.258

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 (86) hide show
  1. package/lib/components/DataSpaceDataAccess.d.ts +1 -1
  2. package/lib/components/DataSpaceDataAccess.d.ts.map +1 -1
  3. package/lib/components/DataSpaceDataAccess.js +7 -16
  4. package/lib/components/DataSpaceDataAccess.js.map +1 -1
  5. package/lib/components/DataSpaceDescription.d.ts.map +1 -1
  6. package/lib/components/DataSpaceDescription.js +2 -6
  7. package/lib/components/DataSpaceDescription.js.map +1 -1
  8. package/lib/components/DataSpaceExecutionContextViewer.d.ts +14 -0
  9. package/lib/components/DataSpaceExecutionContextViewer.d.ts.map +1 -1
  10. package/lib/components/DataSpaceExecutionContextViewer.js +23 -23
  11. package/lib/components/DataSpaceExecutionContextViewer.js.map +1 -1
  12. package/lib/components/DataSpaceQualityEmote.d.ts.map +1 -1
  13. package/lib/components/DataSpaceQualityEmote.js +6 -4
  14. package/lib/components/DataSpaceQualityEmote.js.map +1 -1
  15. package/lib/components/DataSpaceQuickStart.d.ts.map +1 -1
  16. package/lib/components/DataSpaceQuickStart.js +90 -22
  17. package/lib/components/DataSpaceQuickStart.js.map +1 -1
  18. package/lib/components/DataSpaceViewer.d.ts.map +1 -1
  19. package/lib/components/DataSpaceViewer.js +27 -9
  20. package/lib/components/DataSpaceViewer.js.map +1 -1
  21. package/lib/components/DataSpaceViewerActivityBar.d.ts.map +1 -1
  22. package/lib/components/DataSpaceViewerActivityBar.js +9 -5
  23. package/lib/components/DataSpaceViewerActivityBar.js.map +1 -1
  24. package/lib/components/__test-utils__/DataSpaceViewerTestUtils.d.ts +1 -1
  25. package/lib/components/__test-utils__/DataSpaceViewerTestUtils.d.ts.map +1 -1
  26. package/lib/components/__test-utils__/DataSpaceViewerTestUtils.js.map +1 -1
  27. package/lib/components/query-builder/DataSpaceQueryBuilder.d.ts.map +1 -1
  28. package/lib/components/query-builder/DataSpaceQueryBuilder.js +24 -15
  29. package/lib/components/query-builder/DataSpaceQueryBuilder.js.map +1 -1
  30. package/lib/graph-manager/action/analytics/DataSpaceAnalysis.d.ts +16 -0
  31. package/lib/graph-manager/action/analytics/DataSpaceAnalysis.d.ts.map +1 -1
  32. package/lib/graph-manager/action/analytics/DataSpaceAnalysis.js +16 -0
  33. package/lib/graph-manager/action/analytics/DataSpaceAnalysis.js.map +1 -1
  34. package/lib/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.d.ts.map +1 -1
  35. package/lib/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.js +31 -2
  36. package/lib/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.js.map +1 -1
  37. package/lib/graph-manager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.d.ts +18 -0
  38. package/lib/graph-manager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.d.ts.map +1 -1
  39. package/lib/graph-manager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.js +48 -0
  40. package/lib/graph-manager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.js.map +1 -1
  41. package/lib/index.css +2 -2
  42. package/lib/index.css.map +1 -1
  43. package/lib/package.json +1 -1
  44. package/lib/stores/{DataSpaceMappingProviderAccessState.d.ts → DataSpaceDataProductAccessState.d.ts} +16 -10
  45. package/lib/stores/DataSpaceDataProductAccessState.d.ts.map +1 -0
  46. package/lib/stores/{DataSpaceMappingProviderAccessState.js → DataSpaceDataProductAccessState.js} +27 -16
  47. package/lib/stores/DataSpaceDataProductAccessState.js.map +1 -0
  48. package/lib/stores/DataSpaceLayoutState.d.ts +7 -34
  49. package/lib/stores/DataSpaceLayoutState.d.ts.map +1 -1
  50. package/lib/stores/DataSpaceLayoutState.js +22 -159
  51. package/lib/stores/DataSpaceLayoutState.js.map +1 -1
  52. package/lib/stores/DataSpaceViewerDiagramViewerState.js +1 -2
  53. package/lib/stores/DataSpaceViewerDiagramViewerState.js.map +1 -1
  54. package/lib/stores/DataSpaceViewerState.d.ts +54 -24
  55. package/lib/stores/DataSpaceViewerState.d.ts.map +1 -1
  56. package/lib/stores/DataSpaceViewerState.js +139 -55
  57. package/lib/stores/DataSpaceViewerState.js.map +1 -1
  58. package/lib/stores/query/DataSpaceAdvancedSearchState.d.ts.map +1 -1
  59. package/lib/stores/query/DataSpaceAdvancedSearchState.js +7 -1
  60. package/lib/stores/query/DataSpaceAdvancedSearchState.js.map +1 -1
  61. package/lib/stores/query-builder/DataSpaceQueryBuilderState.d.ts +2 -0
  62. package/lib/stores/query-builder/DataSpaceQueryBuilderState.d.ts.map +1 -1
  63. package/lib/stores/query-builder/DataSpaceQueryBuilderState.js +36 -9
  64. package/lib/stores/query-builder/DataSpaceQueryBuilderState.js.map +1 -1
  65. package/package.json +14 -14
  66. package/src/components/DataSpaceDataAccess.tsx +26 -68
  67. package/src/components/DataSpaceDescription.tsx +8 -41
  68. package/src/components/DataSpaceExecutionContextViewer.tsx +68 -69
  69. package/src/components/DataSpaceQualityEmote.tsx +6 -4
  70. package/src/components/DataSpaceQuickStart.tsx +284 -114
  71. package/src/components/DataSpaceViewer.tsx +83 -45
  72. package/src/components/DataSpaceViewerActivityBar.tsx +11 -7
  73. package/src/components/__test-utils__/DataSpaceViewerTestUtils.ts +1 -6
  74. package/src/components/query-builder/DataSpaceQueryBuilder.tsx +117 -101
  75. package/src/graph-manager/action/analytics/DataSpaceAnalysis.ts +19 -0
  76. package/src/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.ts +37 -0
  77. package/src/graph-manager/protocol/pure/v1/engine/analytics/V1_DataSpaceAnalysis.ts +85 -0
  78. package/src/stores/{DataSpaceMappingProviderAccessState.ts → DataSpaceDataProductAccessState.ts} +40 -18
  79. package/src/stores/DataSpaceLayoutState.ts +25 -209
  80. package/src/stores/DataSpaceViewerDiagramViewerState.ts +1 -1
  81. package/src/stores/DataSpaceViewerState.ts +188 -88
  82. package/src/stores/query/DataSpaceAdvancedSearchState.ts +9 -2
  83. package/src/stores/query-builder/DataSpaceQueryBuilderState.ts +48 -12
  84. package/tsconfig.json +1 -1
  85. package/lib/stores/DataSpaceMappingProviderAccessState.d.ts.map +0 -1
  86. package/lib/stores/DataSpaceMappingProviderAccessState.js.map +0 -1
@@ -15,15 +15,16 @@
15
15
  */
16
16
 
17
17
  import { NAVIGATION_ZONE_SEPARATOR } from '@finos/legend-application';
18
- import { action, computed, makeObservable, observable } from 'mobx';
18
+ import { makeObservable, override } from 'mobx';
19
19
  import { type DataSpaceViewerState } from './DataSpaceViewerState.js';
20
- import { at, guaranteeNonNullable, isNonNullable } from '@finos/legend-shared';
20
+ import { at, guaranteeNonNullable } from '@finos/legend-shared';
21
21
  import {
22
22
  DATA_SPACE_VIEWER_ACTIVITY_MODE,
23
23
  extractActivityFromAnchor,
24
24
  generateAnchorForActivity,
25
25
  generateAnchorForDiagram,
26
26
  } from './DataSpaceViewerNavigation.js';
27
+ import { BaseLayoutState } from '@finos/legend-extension-dsl-data-product';
27
28
 
28
29
  export const DATA_SPACE_WIKI_PAGE_SECTIONS = [
29
30
  DATA_SPACE_VIEWER_ACTIVITY_MODE.DESCRIPTION,
@@ -37,234 +38,49 @@ const DATA_SPACE_WIKI_PAGE_ANCHORS = DATA_SPACE_WIKI_PAGE_SECTIONS.map(
37
38
  (activity) => generateAnchorForActivity(activity),
38
39
  );
39
40
 
40
- type DataSpacePageNavigationCommand = {
41
- anchor: string;
42
- };
43
-
44
- export class CollapseState {
45
- private readonly collapsedKeys = new Set<string>();
41
+ export class DataSpaceLayoutState extends BaseLayoutState {
42
+ private dataSpaceViewerState!: DataSpaceViewerState;
46
43
 
47
44
  constructor() {
48
- makeObservable<CollapseState, 'collapsedKeys'>(this, {
49
- collapsedKeys: observable,
50
- toggleSectionCollapse: action,
51
- toggleAllSectionsCollapse: action,
45
+ super();
46
+ makeObservable(this, {
47
+ isWikiPageFullyRendered: override,
52
48
  });
53
49
  }
54
50
 
55
- isSectionCollapsed(key: string): boolean {
56
- return this.collapsedKeys.has(key);
51
+ setViewerState(dataSpaceViewerState: DataSpaceViewerState): void {
52
+ this.dataSpaceViewerState = dataSpaceViewerState;
57
53
  }
58
54
 
59
- toggleSectionCollapse(key: string): void {
60
- if (this.collapsedKeys.has(key)) {
61
- this.collapsedKeys.delete(key);
62
- } else {
63
- this.collapsedKeys.add(key);
64
- }
55
+ protected getValidAnchors(): string[] {
56
+ return DATA_SPACE_WIKI_PAGE_ANCHORS;
65
57
  }
66
58
 
67
- areAllSectionsCollapsed(keys: string[]): boolean {
68
- return keys.length > 0 && keys.every((key) => this.collapsedKeys.has(key));
59
+ protected get expectedGridCount(): number {
60
+ return 0;
69
61
  }
70
62
 
71
- toggleAllSectionsCollapse(keys: string[]): void {
72
- const shouldCollapse = !this.areAllSectionsCollapsed(keys);
73
- keys.forEach((key) => {
74
- if (shouldCollapse) {
75
- this.collapsedKeys.add(key);
76
- } else {
77
- this.collapsedKeys.delete(key);
78
- }
79
- });
80
- }
81
- }
82
-
83
- export class DataSpaceLayoutState {
84
- readonly dataSpaceViewerState: DataSpaceViewerState;
85
-
86
- currentNavigationZone = '';
87
- isExpandedModeEnabled = false;
88
-
89
- frame?: HTMLElement | undefined;
90
- header?: HTMLElement | undefined;
91
- isTopScrollerVisible = false;
92
-
93
- private wikiPageAnchorIndex = new Map<string, HTMLElement>();
94
- wikiPageNavigationCommand?: DataSpacePageNavigationCommand | undefined;
95
- private wikiPageVisibleAnchors: string[] = [];
96
- private wikiPageScrollIntersectionObserver?: IntersectionObserver | undefined;
97
-
98
- readonly sectionCollapseState = new CollapseState();
99
-
100
- constructor(dataSpaceViewerState: DataSpaceViewerState) {
101
- makeObservable<
102
- DataSpaceLayoutState,
103
- | 'wikiPageAnchorIndex'
104
- | 'wikiPageVisibleAnchors'
105
- | 'updatePageVisibleAnchors'
106
- >(this, {
107
- currentNavigationZone: observable,
108
- isExpandedModeEnabled: observable,
109
- isTopScrollerVisible: observable,
110
- wikiPageAnchorIndex: observable,
111
- wikiPageVisibleAnchors: observable,
112
- frame: observable.ref,
113
- wikiPageNavigationCommand: observable.ref,
114
- isWikiPageFullyRendered: computed,
115
- registerWikiPageScrollObserver: action,
116
- setCurrentNavigationZone: action,
117
- enableExpandedMode: action,
118
- setFrame: action,
119
- setTopScrollerVisible: action,
120
- setWikiPageAnchor: action,
121
- unsetWikiPageAnchor: action,
122
- setWikiPageAnchorToNavigate: action,
123
- updatePageVisibleAnchors: action,
124
- });
125
-
126
- this.dataSpaceViewerState = dataSpaceViewerState;
127
- }
128
-
129
- setCurrentNavigationZone(val: string): void {
130
- this.currentNavigationZone = val;
131
- }
132
-
133
- get isWikiPageFullyRendered(): boolean {
63
+ override get isWikiPageFullyRendered(): boolean {
134
64
  return (
135
- Boolean(this.frame) &&
65
+ super.isWikiPageFullyRendered &&
136
66
  DATA_SPACE_WIKI_PAGE_SECTIONS.includes(
137
67
  this.dataSpaceViewerState.currentActivity,
138
- ) &&
139
- DATA_SPACE_WIKI_PAGE_ANCHORS.every((anchor) =>
140
- this.wikiPageAnchorIndex.has(anchor),
141
- ) &&
142
- Array.from(this.wikiPageAnchorIndex.values()).every(isNonNullable)
68
+ )
143
69
  );
144
70
  }
145
71
 
146
- registerWikiPageScrollObserver(): void {
147
- if (this.frame && this.isWikiPageFullyRendered) {
148
- const wikiPageIntersectionObserver = new IntersectionObserver(
149
- (entries, observer) => {
150
- const anchorsWithVisibilityChanged = entries
151
- .map((entry) => {
152
- for (const [key, element] of this.wikiPageAnchorIndex.entries()) {
153
- if (element === entry.target) {
154
- return { key, isIntersecting: entry.isIntersecting };
155
- }
156
- }
157
- return undefined;
158
- })
159
- .filter(isNonNullable);
160
- anchorsWithVisibilityChanged.forEach((entry) => {
161
- this.updatePageVisibleAnchors(entry.key, entry.isIntersecting);
162
- });
163
- // NOTE: sync scroll with menu/address is quite a delicate piece of work
164
- // as it interferes with programatic scroll operations we do elsewhere.
165
- // This is particularly bad when we do a programatic `smooth` scroll, which
166
- // mimic user scrolling behavior and would tangle up with this observer
167
- // Since currently, there's no good mechanism to detect scroll end event, and as such,
168
- // there is no good way to temporarily disable this logic while doing the programmatic
169
- // smooth scroll as such, we avoid supporting programatic smooth scrolling for now
170
- // See https://github.com/w3c/csswg-drafts/issues/3744
171
- // See https://developer.mozilla.org/en-US/docs/Web/API/Document/scrollend_event
172
- if (
173
- // if current navigation zone is not set, do not update zone
174
- this.currentNavigationZone === '' ||
175
- // if there is no visible anchors, do not update zone
176
- !this.wikiPageVisibleAnchors.length ||
177
- // if some of the current visible anchors match or is parent section of the current
178
- // navigation zone, do not update zone
179
- this.wikiPageVisibleAnchors.some(
180
- (visibleAnchor) =>
181
- this.currentNavigationZone === visibleAnchor ||
182
- this.currentNavigationZone.startsWith(
183
- `${visibleAnchor}${NAVIGATION_ZONE_SEPARATOR}`,
184
- ),
185
- )
186
- ) {
187
- return;
188
- }
189
- const anchor = at(this.wikiPageVisibleAnchors, 0);
190
- this.dataSpaceViewerState.syncZoneWithNavigation(anchor);
191
- const anchorChunks = anchor.split(NAVIGATION_ZONE_SEPARATOR);
192
- const activity = anchorChunks[0];
193
- if (activity) {
194
- this.dataSpaceViewerState.setCurrentActivity(
195
- extractActivityFromAnchor(
196
- activity,
197
- ) as DATA_SPACE_VIEWER_ACTIVITY_MODE,
198
- );
199
- }
200
- },
201
- {
202
- root: this.frame,
203
- threshold: 0.5,
204
- },
205
- );
206
- Array.from(this.wikiPageAnchorIndex.values()).forEach((el) =>
207
- wikiPageIntersectionObserver.observe(el),
72
+ protected override onWikiPageVisibleAnchorsSettled(): void {
73
+ const anchor = at(this.wikiPageVisibleAnchors, 0);
74
+ this.dataSpaceViewerState.syncZoneWithNavigation(anchor);
75
+ const activity = anchor.split(NAVIGATION_ZONE_SEPARATOR)[0];
76
+ if (activity) {
77
+ this.dataSpaceViewerState.setCurrentActivity(
78
+ extractActivityFromAnchor(activity) as DATA_SPACE_VIEWER_ACTIVITY_MODE,
208
79
  );
209
- this.wikiPageScrollIntersectionObserver = wikiPageIntersectionObserver;
210
80
  }
211
81
  }
212
82
 
213
- unregisterWikiPageScrollObserver(): void {
214
- this.wikiPageScrollIntersectionObserver?.disconnect();
215
- this.wikiPageScrollIntersectionObserver = undefined;
216
- this.wikiPageVisibleAnchors = [];
217
- }
218
-
219
- private updatePageVisibleAnchors(
220
- changedAnchor: string,
221
- isIntersecting: boolean,
222
- ): void {
223
- if (isIntersecting) {
224
- const anchors = this.wikiPageVisibleAnchors.filter(
225
- (anchor) => changedAnchor !== anchor,
226
- );
227
- // NOTE: the newly visible anchors should be the furthest one in
228
- // the direction of scroll
229
- anchors.push(changedAnchor);
230
- this.wikiPageVisibleAnchors = anchors;
231
- } else {
232
- this.wikiPageVisibleAnchors = this.wikiPageVisibleAnchors.filter(
233
- (anchor) => changedAnchor !== anchor,
234
- );
235
- }
236
- }
237
-
238
- enableExpandedMode(val: boolean): void {
239
- this.isExpandedModeEnabled = val;
240
- }
241
-
242
- setFrame(val: HTMLElement | undefined): void {
243
- this.frame = val;
244
- }
245
-
246
- setTopScrollerVisible(val: boolean): void {
247
- this.isTopScrollerVisible = val;
248
- }
249
-
250
- setWikiPageAnchor(anchorKey: string, element: HTMLElement): void {
251
- // do not allow overriding existing anchor
252
- if (!this.wikiPageAnchorIndex.has(anchorKey)) {
253
- this.wikiPageAnchorIndex.set(anchorKey, element);
254
- }
255
- }
256
-
257
- unsetWikiPageAnchor(anchorKey: string): void {
258
- this.wikiPageAnchorIndex.delete(anchorKey);
259
- }
260
-
261
- setWikiPageAnchorToNavigate(
262
- val: DataSpacePageNavigationCommand | undefined,
263
- ): void {
264
- this.wikiPageNavigationCommand = val;
265
- }
266
-
267
- navigateWikiPageAnchor(): void {
83
+ override navigateWikiPageAnchor(): void {
268
84
  if (
269
85
  this.frame &&
270
86
  this.wikiPageNavigationCommand &&
@@ -30,9 +30,9 @@ export class DataSpaceViewerDiagramViewerState
30
30
  super(
31
31
  dataSpaceViewerState.applicationStore,
32
32
  dataSpaceViewerState.dataSpaceAnalysisResult.diagrams,
33
+ dataSpaceViewerState.layoutState.sectionCollapseState,
33
34
  {
34
35
  queryClass: dataSpaceViewerState.queryClass,
35
- collapseState: dataSpaceViewerState.layoutState.sectionCollapseState,
36
36
  },
37
37
  );
38
38
  this.dataSpaceViewerState = dataSpaceViewerState;