@finos/legend-extension-dsl-data-space 10.4.170 → 10.4.172
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/lib/components/DataSpaceWiki.d.ts.map +1 -1
- package/lib/components/DataSpaceWiki.js +2 -2
- package/lib/components/DataSpaceWiki.js.map +1 -1
- package/lib/graph-manager/action/analytics/DataSpaceAnalysis.d.ts +3 -44
- package/lib/graph-manager/action/analytics/DataSpaceAnalysis.d.ts.map +1 -1
- package/lib/graph-manager/action/analytics/DataSpaceAnalysis.js +0 -51
- package/lib/graph-manager/action/analytics/DataSpaceAnalysis.js.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.d.ts.map +1 -1
- package/lib/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.js +14 -13
- package/lib/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.js.map +1 -1
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/package.json +1 -1
- package/lib/stores/DataSpaceModelsDocumentationState.d.ts +2 -78
- package/lib/stores/DataSpaceModelsDocumentationState.d.ts.map +1 -1
- package/lib/stores/DataSpaceModelsDocumentationState.js +3 -400
- package/lib/stores/DataSpaceModelsDocumentationState.js.map +1 -1
- package/package.json +6 -6
- package/src/components/DataSpaceWiki.tsx +6 -3
- package/src/graph-manager/action/analytics/DataSpaceAnalysis.ts +2 -68
- package/src/graph-manager/protocol/pure/v1/V1_DSL_DataSpace_PureGraphManagerExtension.ts +21 -19
- package/src/stores/DataSpaceModelsDocumentationState.ts +3 -597
- package/tsconfig.json +0 -1
- package/lib/components/DataSpaceModelsDocumentation.d.ts +0 -22
- package/lib/components/DataSpaceModelsDocumentation.d.ts.map +0 -1
- package/lib/components/DataSpaceModelsDocumentation.js +0 -389
- package/lib/components/DataSpaceModelsDocumentation.js.map +0 -1
- package/src/components/DataSpaceModelsDocumentation.tsx +0 -1151
|
@@ -14,616 +14,22 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { action, computed, makeObservable, observable } from 'mobx';
|
|
18
17
|
import { type DataSpaceViewerState } from './DataSpaceViewerState.js';
|
|
19
|
-
import { type TreeData, type TreeNodeData } from '@finos/legend-art';
|
|
20
|
-
import {
|
|
21
|
-
ActionState,
|
|
22
|
-
filterByType,
|
|
23
|
-
guaranteeNonNullable,
|
|
24
|
-
FuzzySearchEngine,
|
|
25
|
-
FuzzySearchAdvancedConfigState,
|
|
26
|
-
} from '@finos/legend-shared';
|
|
27
|
-
import {
|
|
28
|
-
DataSpaceAssociationDocumentationEntry,
|
|
29
|
-
DataSpaceClassDocumentationEntry,
|
|
30
|
-
DataSpaceEnumerationDocumentationEntry,
|
|
31
|
-
DataSpaceModelDocumentationEntry,
|
|
32
|
-
type NormalizedDataSpaceDocumentationEntry,
|
|
33
|
-
} from '../graph-manager/action/analytics/DataSpaceAnalysis.js';
|
|
34
|
-
import { CORE_PURE_PATH, ELEMENT_PATH_DELIMITER } from '@finos/legend-graph';
|
|
35
18
|
import type { CommandRegistrar } from '@finos/legend-application';
|
|
36
19
|
import { DSL_DATA_SPACE_LEGEND_APPLICATION_COMMAND_KEY } from '../__lib__/DSL_DataSpace_LegendApplicationCommand.js';
|
|
37
20
|
import { DATA_SPACE_VIEWER_ACTIVITY_MODE } from './DataSpaceViewerNavigation.js';
|
|
38
|
-
|
|
39
|
-
export enum ModelsDocumentationFilterTreeNodeCheckType {
|
|
40
|
-
CHECKED,
|
|
41
|
-
UNCHECKED,
|
|
42
|
-
PARTIALLY_CHECKED,
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export abstract class ModelsDocumentationFilterTreeNodeData
|
|
46
|
-
implements TreeNodeData
|
|
47
|
-
{
|
|
48
|
-
readonly id: string;
|
|
49
|
-
readonly label: string;
|
|
50
|
-
readonly parentNode: ModelsDocumentationFilterTreeNodeData | undefined;
|
|
51
|
-
isOpen = false;
|
|
52
|
-
childrenIds: string[] = [];
|
|
53
|
-
childrenNodes: ModelsDocumentationFilterTreeNodeData[] = [];
|
|
54
|
-
// By default all nodes are checked
|
|
55
|
-
checkType = ModelsDocumentationFilterTreeNodeCheckType.CHECKED;
|
|
56
|
-
|
|
57
|
-
constructor(
|
|
58
|
-
id: string,
|
|
59
|
-
label: string,
|
|
60
|
-
parentNode: ModelsDocumentationFilterTreeNodeData | undefined,
|
|
61
|
-
) {
|
|
62
|
-
makeObservable(this, {
|
|
63
|
-
isOpen: observable,
|
|
64
|
-
checkType: observable,
|
|
65
|
-
setIsOpen: action,
|
|
66
|
-
setCheckType: action,
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
this.id = id;
|
|
70
|
-
this.label = label;
|
|
71
|
-
this.parentNode = parentNode;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
setIsOpen(val: boolean): void {
|
|
75
|
-
this.isOpen = val;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
setCheckType(val: ModelsDocumentationFilterTreeNodeCheckType): void {
|
|
79
|
-
this.checkType = val;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export class ModelsDocumentationFilterTreeRootNodeData extends ModelsDocumentationFilterTreeNodeData {}
|
|
84
|
-
|
|
85
|
-
export class ModelsDocumentationFilterTreePackageNodeData extends ModelsDocumentationFilterTreeNodeData {
|
|
86
|
-
declare parentNode: ModelsDocumentationFilterTreeNodeData;
|
|
87
|
-
packagePath: string;
|
|
88
|
-
|
|
89
|
-
constructor(
|
|
90
|
-
id: string,
|
|
91
|
-
label: string,
|
|
92
|
-
parentNode: ModelsDocumentationFilterTreeNodeData,
|
|
93
|
-
packagePath: string,
|
|
94
|
-
) {
|
|
95
|
-
super(id, label, parentNode);
|
|
96
|
-
this.packagePath = packagePath;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export class ModelsDocumentationFilterTreeElementNodeData extends ModelsDocumentationFilterTreeNodeData {
|
|
101
|
-
declare parentNode: ModelsDocumentationFilterTreeNodeData;
|
|
102
|
-
elementPath: string;
|
|
103
|
-
typePath: CORE_PURE_PATH | undefined;
|
|
104
|
-
|
|
105
|
-
constructor(
|
|
106
|
-
id: string,
|
|
107
|
-
label: string,
|
|
108
|
-
parentNode: ModelsDocumentationFilterTreeNodeData,
|
|
109
|
-
elementPath: string,
|
|
110
|
-
typePath: CORE_PURE_PATH | undefined,
|
|
111
|
-
) {
|
|
112
|
-
super(id, label, parentNode);
|
|
113
|
-
this.elementPath = elementPath;
|
|
114
|
-
this.typePath = typePath;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export class ModelsDocumentationFilterTreeTypeNodeData extends ModelsDocumentationFilterTreeNodeData {
|
|
119
|
-
declare parentNode: ModelsDocumentationFilterTreeNodeData;
|
|
120
|
-
typePath: CORE_PURE_PATH;
|
|
121
|
-
|
|
122
|
-
constructor(
|
|
123
|
-
id: string,
|
|
124
|
-
label: string,
|
|
125
|
-
parentNode: ModelsDocumentationFilterTreeNodeData,
|
|
126
|
-
typePath: CORE_PURE_PATH,
|
|
127
|
-
) {
|
|
128
|
-
super(id, label, parentNode);
|
|
129
|
-
this.typePath = typePath;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
const trickleDownUncheckNodeChildren = (
|
|
134
|
-
node: ModelsDocumentationFilterTreeNodeData,
|
|
135
|
-
): void => {
|
|
136
|
-
node.setCheckType(ModelsDocumentationFilterTreeNodeCheckType.UNCHECKED);
|
|
137
|
-
node.childrenNodes.forEach((childNode) =>
|
|
138
|
-
trickleDownUncheckNodeChildren(childNode),
|
|
139
|
-
);
|
|
140
|
-
};
|
|
141
|
-
|
|
142
|
-
const trickleUpUncheckNode = (
|
|
143
|
-
node: ModelsDocumentationFilterTreeNodeData,
|
|
144
|
-
): void => {
|
|
145
|
-
const parentNode = node.parentNode;
|
|
146
|
-
if (!parentNode) {
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
if (
|
|
150
|
-
parentNode.childrenNodes.some(
|
|
151
|
-
(childNode) =>
|
|
152
|
-
childNode.checkType ===
|
|
153
|
-
ModelsDocumentationFilterTreeNodeCheckType.CHECKED,
|
|
154
|
-
)
|
|
155
|
-
) {
|
|
156
|
-
parentNode.setCheckType(
|
|
157
|
-
ModelsDocumentationFilterTreeNodeCheckType.PARTIALLY_CHECKED,
|
|
158
|
-
);
|
|
159
|
-
} else {
|
|
160
|
-
parentNode.setCheckType(
|
|
161
|
-
ModelsDocumentationFilterTreeNodeCheckType.UNCHECKED,
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
trickleUpUncheckNode(parentNode);
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
export const uncheckFilterTreeNode = (
|
|
169
|
-
node: ModelsDocumentationFilterTreeNodeData,
|
|
170
|
-
): void => {
|
|
171
|
-
trickleDownUncheckNodeChildren(node);
|
|
172
|
-
trickleUpUncheckNode(node);
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
const trickleDownCheckNode = (
|
|
176
|
-
node: ModelsDocumentationFilterTreeNodeData,
|
|
177
|
-
): void => {
|
|
178
|
-
node.setCheckType(ModelsDocumentationFilterTreeNodeCheckType.CHECKED);
|
|
179
|
-
node.childrenNodes.forEach((childNode) => trickleDownCheckNode(childNode));
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
const trickleUpCheckNode = (
|
|
183
|
-
node: ModelsDocumentationFilterTreeNodeData,
|
|
184
|
-
): void => {
|
|
185
|
-
const parentNode = node.parentNode;
|
|
186
|
-
if (!parentNode) {
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
if (
|
|
190
|
-
parentNode.childrenNodes.every(
|
|
191
|
-
(childNode) =>
|
|
192
|
-
childNode.checkType ===
|
|
193
|
-
ModelsDocumentationFilterTreeNodeCheckType.CHECKED,
|
|
194
|
-
)
|
|
195
|
-
) {
|
|
196
|
-
parentNode.setCheckType(ModelsDocumentationFilterTreeNodeCheckType.CHECKED);
|
|
197
|
-
} else {
|
|
198
|
-
parentNode.setCheckType(
|
|
199
|
-
ModelsDocumentationFilterTreeNodeCheckType.PARTIALLY_CHECKED,
|
|
200
|
-
);
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
trickleUpCheckNode(parentNode);
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
export const checkFilterTreeNode = (
|
|
207
|
-
node: ModelsDocumentationFilterTreeNodeData,
|
|
208
|
-
): void => {
|
|
209
|
-
trickleDownCheckNode(node);
|
|
210
|
-
trickleUpCheckNode(node);
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
export const uncheckAllFilterTree = (
|
|
214
|
-
treeData: TreeData<ModelsDocumentationFilterTreeNodeData>,
|
|
215
|
-
): void => {
|
|
216
|
-
treeData.nodes.forEach((node) =>
|
|
217
|
-
node.setCheckType(ModelsDocumentationFilterTreeNodeCheckType.UNCHECKED),
|
|
218
|
-
);
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
const buildTypeFilterTreeData =
|
|
222
|
-
(): TreeData<ModelsDocumentationFilterTreeNodeData> => {
|
|
223
|
-
const rootIds: string[] = [];
|
|
224
|
-
const nodes = new Map<string, ModelsDocumentationFilterTreeNodeData>();
|
|
225
|
-
|
|
226
|
-
// all node
|
|
227
|
-
const allNode = new ModelsDocumentationFilterTreeRootNodeData(
|
|
228
|
-
'all',
|
|
229
|
-
'All Types',
|
|
230
|
-
undefined,
|
|
231
|
-
);
|
|
232
|
-
rootIds.push(allNode.id);
|
|
233
|
-
allNode.setIsOpen(true); // open the root node by default
|
|
234
|
-
nodes.set(allNode.id, allNode);
|
|
235
|
-
|
|
236
|
-
// type nodes
|
|
237
|
-
const classNode = new ModelsDocumentationFilterTreeTypeNodeData(
|
|
238
|
-
'class',
|
|
239
|
-
'Class',
|
|
240
|
-
allNode,
|
|
241
|
-
CORE_PURE_PATH.CLASS,
|
|
242
|
-
);
|
|
243
|
-
allNode.childrenIds.push(classNode.id);
|
|
244
|
-
nodes.set(classNode.id, classNode);
|
|
245
|
-
|
|
246
|
-
const enumerationNode = new ModelsDocumentationFilterTreeTypeNodeData(
|
|
247
|
-
'enumeration',
|
|
248
|
-
'Enumeration',
|
|
249
|
-
allNode,
|
|
250
|
-
CORE_PURE_PATH.ENUMERATION,
|
|
251
|
-
);
|
|
252
|
-
allNode.childrenIds.push(enumerationNode.id);
|
|
253
|
-
nodes.set(enumerationNode.id, enumerationNode);
|
|
254
|
-
|
|
255
|
-
const associationNode = new ModelsDocumentationFilterTreeTypeNodeData(
|
|
256
|
-
'association',
|
|
257
|
-
'Association',
|
|
258
|
-
allNode,
|
|
259
|
-
CORE_PURE_PATH.ASSOCIATION,
|
|
260
|
-
);
|
|
261
|
-
allNode.childrenIds.push(associationNode.id);
|
|
262
|
-
nodes.set(associationNode.id, associationNode);
|
|
263
|
-
allNode.childrenNodes = [classNode, enumerationNode, associationNode];
|
|
264
|
-
|
|
265
|
-
return {
|
|
266
|
-
rootIds,
|
|
267
|
-
nodes,
|
|
268
|
-
};
|
|
269
|
-
};
|
|
270
|
-
|
|
271
|
-
const buildPackageFilterTreeData = (
|
|
272
|
-
modelDocEntries: DataSpaceModelDocumentationEntry[],
|
|
273
|
-
): TreeData<ModelsDocumentationFilterTreeNodeData> => {
|
|
274
|
-
const rootIds: string[] = [];
|
|
275
|
-
const nodes = new Map<string, ModelsDocumentationFilterTreeNodeData>();
|
|
276
|
-
|
|
277
|
-
// all node
|
|
278
|
-
const allNode = new ModelsDocumentationFilterTreeRootNodeData(
|
|
279
|
-
'all',
|
|
280
|
-
'All Packages',
|
|
281
|
-
undefined,
|
|
282
|
-
);
|
|
283
|
-
rootIds.push(allNode.id);
|
|
284
|
-
allNode.setIsOpen(true); // open the root node by default
|
|
285
|
-
nodes.set(allNode.id, allNode);
|
|
286
|
-
|
|
287
|
-
modelDocEntries.forEach((entry) => {
|
|
288
|
-
const path = entry.path;
|
|
289
|
-
const chunks = path.split(ELEMENT_PATH_DELIMITER);
|
|
290
|
-
let currentParentNode = allNode;
|
|
291
|
-
for (let i = 0; i < chunks.length; i++) {
|
|
292
|
-
const chunk = guaranteeNonNullable(chunks[i]);
|
|
293
|
-
const elementPath = `${
|
|
294
|
-
currentParentNode === allNode
|
|
295
|
-
? ''
|
|
296
|
-
: `${currentParentNode.id}${ELEMENT_PATH_DELIMITER}`
|
|
297
|
-
}${chunk}`;
|
|
298
|
-
const nodeId = elementPath;
|
|
299
|
-
let node = nodes.get(nodeId);
|
|
300
|
-
if (!node) {
|
|
301
|
-
if (i === chunks.length - 1) {
|
|
302
|
-
node = new ModelsDocumentationFilterTreeElementNodeData(
|
|
303
|
-
nodeId,
|
|
304
|
-
chunk,
|
|
305
|
-
currentParentNode,
|
|
306
|
-
elementPath,
|
|
307
|
-
entry instanceof DataSpaceClassDocumentationEntry
|
|
308
|
-
? CORE_PURE_PATH.CLASS
|
|
309
|
-
: entry instanceof DataSpaceEnumerationDocumentationEntry
|
|
310
|
-
? CORE_PURE_PATH.ENUMERATION
|
|
311
|
-
: entry instanceof DataSpaceAssociationDocumentationEntry
|
|
312
|
-
? CORE_PURE_PATH.ASSOCIATION
|
|
313
|
-
: undefined,
|
|
314
|
-
);
|
|
315
|
-
} else {
|
|
316
|
-
node = new ModelsDocumentationFilterTreePackageNodeData(
|
|
317
|
-
nodeId,
|
|
318
|
-
chunk,
|
|
319
|
-
currentParentNode,
|
|
320
|
-
elementPath,
|
|
321
|
-
);
|
|
322
|
-
}
|
|
323
|
-
nodes.set(nodeId, node);
|
|
324
|
-
currentParentNode.childrenIds.push(nodeId);
|
|
325
|
-
currentParentNode.childrenNodes.push(node);
|
|
326
|
-
}
|
|
327
|
-
currentParentNode = node;
|
|
328
|
-
}
|
|
329
|
-
});
|
|
330
|
-
|
|
331
|
-
return {
|
|
332
|
-
rootIds,
|
|
333
|
-
nodes,
|
|
334
|
-
};
|
|
335
|
-
};
|
|
21
|
+
import { ViewerModelsDocumentationState } from '@finos/legend-lego/model-documentation';
|
|
336
22
|
|
|
337
23
|
export class DataSpaceViewerModelsDocumentationState
|
|
24
|
+
extends ViewerModelsDocumentationState
|
|
338
25
|
implements CommandRegistrar
|
|
339
26
|
{
|
|
340
27
|
readonly dataSpaceViewerState: DataSpaceViewerState;
|
|
341
28
|
|
|
342
|
-
showHumanizedForm = true;
|
|
343
|
-
|
|
344
|
-
// search text
|
|
345
|
-
private searchInput?: HTMLInputElement | undefined;
|
|
346
|
-
private readonly searchEngine: FuzzySearchEngine<NormalizedDataSpaceDocumentationEntry>;
|
|
347
|
-
searchConfigurationState: FuzzySearchAdvancedConfigState;
|
|
348
|
-
readonly searchState = ActionState.create();
|
|
349
|
-
searchText: string;
|
|
350
|
-
searchResults: NormalizedDataSpaceDocumentationEntry[] = [];
|
|
351
|
-
showSearchConfigurationMenu = false;
|
|
352
|
-
|
|
353
|
-
// filter
|
|
354
|
-
showFilterPanel = true;
|
|
355
|
-
typeFilterTreeData: TreeData<ModelsDocumentationFilterTreeNodeData>;
|
|
356
|
-
packageFilterTreeData: TreeData<ModelsDocumentationFilterTreeNodeData>;
|
|
357
|
-
filterTypes: string[] = [];
|
|
358
|
-
filterPaths: string[] = [];
|
|
359
|
-
|
|
360
29
|
constructor(dataSpaceViewerState: DataSpaceViewerState) {
|
|
361
|
-
|
|
362
|
-
showHumanizedForm: observable,
|
|
363
|
-
searchText: observable,
|
|
364
|
-
// NOTE: we use `observable.struct` for these to avoid unnecessary re-rendering of the grid
|
|
365
|
-
searchResults: observable.struct,
|
|
366
|
-
filterTypes: observable.struct,
|
|
367
|
-
filterPaths: observable.struct,
|
|
368
|
-
showSearchConfigurationMenu: observable,
|
|
369
|
-
showFilterPanel: observable,
|
|
370
|
-
typeFilterTreeData: observable.ref,
|
|
371
|
-
packageFilterTreeData: observable.ref,
|
|
372
|
-
filteredSearchResults: computed,
|
|
373
|
-
isTypeFilterCustomized: computed,
|
|
374
|
-
isPackageFilterCustomized: computed,
|
|
375
|
-
isFilterCustomized: computed,
|
|
376
|
-
setShowHumanizedForm: action,
|
|
377
|
-
setSearchText: action,
|
|
378
|
-
resetSearch: action,
|
|
379
|
-
search: action,
|
|
380
|
-
setShowSearchConfigurationMenu: action,
|
|
381
|
-
setShowFilterPanel: action,
|
|
382
|
-
resetTypeFilterTreeData: action,
|
|
383
|
-
resetPackageFilterTreeData: action,
|
|
384
|
-
updateTypeFilter: action,
|
|
385
|
-
updatePackageFilter: action,
|
|
386
|
-
resetTypeFilter: action,
|
|
387
|
-
resetPackageFilter: action,
|
|
388
|
-
resetAllFilters: action,
|
|
389
|
-
});
|
|
30
|
+
super(dataSpaceViewerState.dataSpaceAnalysisResult.elementDocs);
|
|
390
31
|
|
|
391
32
|
this.dataSpaceViewerState = dataSpaceViewerState;
|
|
392
|
-
this.searchEngine = new FuzzySearchEngine(
|
|
393
|
-
this.dataSpaceViewerState.dataSpaceAnalysisResult.elementDocs,
|
|
394
|
-
{
|
|
395
|
-
includeScore: true,
|
|
396
|
-
// NOTE: we must not sort/change the order in the grid since
|
|
397
|
-
// we want to ensure the element row is on top
|
|
398
|
-
shouldSort: false,
|
|
399
|
-
// Ignore location when computing the search score
|
|
400
|
-
// See https://fusejs.io/concepts/scoring-theory.html
|
|
401
|
-
ignoreLocation: true,
|
|
402
|
-
// This specifies the point the search gives up
|
|
403
|
-
// `0.0` means exact match where `1.0` would match anything
|
|
404
|
-
// We set a relatively low threshold to filter out irrelevant results
|
|
405
|
-
threshold: 0.2,
|
|
406
|
-
keys: [
|
|
407
|
-
{
|
|
408
|
-
name: 'text',
|
|
409
|
-
weight: 3,
|
|
410
|
-
},
|
|
411
|
-
{
|
|
412
|
-
name: 'humanizedText',
|
|
413
|
-
weight: 3,
|
|
414
|
-
},
|
|
415
|
-
{
|
|
416
|
-
name: 'elementEntry.name',
|
|
417
|
-
weight: 3,
|
|
418
|
-
},
|
|
419
|
-
{
|
|
420
|
-
name: 'elementEntry.humanizedName',
|
|
421
|
-
weight: 3,
|
|
422
|
-
},
|
|
423
|
-
{
|
|
424
|
-
name: 'entry.name',
|
|
425
|
-
weight: 2,
|
|
426
|
-
},
|
|
427
|
-
{
|
|
428
|
-
name: 'entry.humanizedName',
|
|
429
|
-
weight: 2,
|
|
430
|
-
},
|
|
431
|
-
{
|
|
432
|
-
name: 'documentation',
|
|
433
|
-
weight: 4,
|
|
434
|
-
},
|
|
435
|
-
],
|
|
436
|
-
// extended search allows for exact word match through single quote
|
|
437
|
-
// See https://fusejs.io/examples.html#extended-search
|
|
438
|
-
useExtendedSearch: true,
|
|
439
|
-
},
|
|
440
|
-
);
|
|
441
|
-
this.searchConfigurationState = new FuzzySearchAdvancedConfigState(
|
|
442
|
-
(): void => this.search(),
|
|
443
|
-
);
|
|
444
|
-
this.searchText = '';
|
|
445
|
-
this.searchResults =
|
|
446
|
-
this.dataSpaceViewerState.dataSpaceAnalysisResult.elementDocs;
|
|
447
|
-
|
|
448
|
-
this.typeFilterTreeData = buildTypeFilterTreeData();
|
|
449
|
-
this.packageFilterTreeData = buildPackageFilterTreeData(
|
|
450
|
-
this.dataSpaceViewerState.dataSpaceAnalysisResult.elementDocs
|
|
451
|
-
.map((entry) => entry.entry)
|
|
452
|
-
.filter(filterByType(DataSpaceModelDocumentationEntry)),
|
|
453
|
-
);
|
|
454
|
-
this.updateTypeFilter();
|
|
455
|
-
this.updatePackageFilter();
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
get filteredSearchResults(): NormalizedDataSpaceDocumentationEntry[] {
|
|
459
|
-
return (
|
|
460
|
-
this.searchResults
|
|
461
|
-
// filter by types
|
|
462
|
-
.filter(
|
|
463
|
-
(result) =>
|
|
464
|
-
(this.filterTypes.includes(CORE_PURE_PATH.CLASS) &&
|
|
465
|
-
result.elementEntry instanceof
|
|
466
|
-
DataSpaceClassDocumentationEntry) ||
|
|
467
|
-
(this.filterTypes.includes(CORE_PURE_PATH.ENUMERATION) &&
|
|
468
|
-
result.elementEntry instanceof
|
|
469
|
-
DataSpaceEnumerationDocumentationEntry) ||
|
|
470
|
-
(this.filterTypes.includes(CORE_PURE_PATH.ASSOCIATION) &&
|
|
471
|
-
result.elementEntry instanceof
|
|
472
|
-
DataSpaceAssociationDocumentationEntry),
|
|
473
|
-
)
|
|
474
|
-
// filter by paths
|
|
475
|
-
.filter((result) => this.filterPaths.includes(result.elementEntry.path))
|
|
476
|
-
);
|
|
477
|
-
}
|
|
478
|
-
|
|
479
|
-
get isTypeFilterCustomized(): boolean {
|
|
480
|
-
return Array.from(this.typeFilterTreeData.nodes.values()).some(
|
|
481
|
-
(node) =>
|
|
482
|
-
node.checkType === ModelsDocumentationFilterTreeNodeCheckType.UNCHECKED,
|
|
483
|
-
);
|
|
484
|
-
}
|
|
485
|
-
|
|
486
|
-
get isPackageFilterCustomized(): boolean {
|
|
487
|
-
return Array.from(this.packageFilterTreeData.nodes.values()).some(
|
|
488
|
-
(node) =>
|
|
489
|
-
node.checkType === ModelsDocumentationFilterTreeNodeCheckType.UNCHECKED,
|
|
490
|
-
);
|
|
491
|
-
}
|
|
492
|
-
|
|
493
|
-
get isFilterCustomized(): boolean {
|
|
494
|
-
return this.isTypeFilterCustomized || this.isPackageFilterCustomized;
|
|
495
|
-
}
|
|
496
|
-
|
|
497
|
-
setShowHumanizedForm(val: boolean): void {
|
|
498
|
-
this.showHumanizedForm = val;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
setSearchText(val: string): void {
|
|
502
|
-
this.searchText = val;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
resetSearch(): void {
|
|
506
|
-
this.searchText = '';
|
|
507
|
-
this.searchResults =
|
|
508
|
-
this.dataSpaceViewerState.dataSpaceAnalysisResult.elementDocs;
|
|
509
|
-
this.searchState.complete();
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
search(): void {
|
|
513
|
-
if (!this.searchText) {
|
|
514
|
-
this.searchResults =
|
|
515
|
-
this.dataSpaceViewerState.dataSpaceAnalysisResult.elementDocs;
|
|
516
|
-
return;
|
|
517
|
-
}
|
|
518
|
-
this.searchState.inProgress();
|
|
519
|
-
this.searchResults = Array.from(
|
|
520
|
-
this.searchEngine
|
|
521
|
-
.search(
|
|
522
|
-
this.searchConfigurationState.generateSearchText(this.searchText),
|
|
523
|
-
)
|
|
524
|
-
.values(),
|
|
525
|
-
).map((result) => result.item);
|
|
526
|
-
|
|
527
|
-
this.searchState.complete();
|
|
528
|
-
}
|
|
529
|
-
|
|
530
|
-
setShowSearchConfigurationMenu(val: boolean): void {
|
|
531
|
-
this.showSearchConfigurationMenu = val;
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
setShowFilterPanel(val: boolean): void {
|
|
535
|
-
this.showFilterPanel = val;
|
|
536
|
-
}
|
|
537
|
-
|
|
538
|
-
resetTypeFilterTreeData(): void {
|
|
539
|
-
this.typeFilterTreeData = { ...this.typeFilterTreeData };
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
resetPackageFilterTreeData(): void {
|
|
543
|
-
this.packageFilterTreeData = { ...this.packageFilterTreeData };
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
updateTypeFilter(): void {
|
|
547
|
-
const types: string[] = [];
|
|
548
|
-
this.typeFilterTreeData.nodes.forEach((node) => {
|
|
549
|
-
if (
|
|
550
|
-
node instanceof ModelsDocumentationFilterTreeTypeNodeData &&
|
|
551
|
-
node.checkType === ModelsDocumentationFilterTreeNodeCheckType.CHECKED
|
|
552
|
-
) {
|
|
553
|
-
types.push(node.typePath);
|
|
554
|
-
}
|
|
555
|
-
});
|
|
556
|
-
// NOTE: sort to avoid unnecessary re-computation of filtered search results
|
|
557
|
-
this.filterTypes = types.toSorted((a, b) => a.localeCompare(b));
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
updatePackageFilter(): void {
|
|
561
|
-
const elementPaths: string[] = [];
|
|
562
|
-
this.packageFilterTreeData.nodes.forEach((node) => {
|
|
563
|
-
if (
|
|
564
|
-
node instanceof ModelsDocumentationFilterTreeElementNodeData &&
|
|
565
|
-
node.checkType === ModelsDocumentationFilterTreeNodeCheckType.CHECKED
|
|
566
|
-
) {
|
|
567
|
-
elementPaths.push(node.elementPath);
|
|
568
|
-
}
|
|
569
|
-
});
|
|
570
|
-
// NOTE: sort to avoid unnecessary re-computation of filtered search results
|
|
571
|
-
this.filterPaths = elementPaths.toSorted((a, b) => a.localeCompare(b));
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
resetTypeFilter(): void {
|
|
575
|
-
this.typeFilterTreeData.nodes.forEach((node) =>
|
|
576
|
-
node.setCheckType(ModelsDocumentationFilterTreeNodeCheckType.CHECKED),
|
|
577
|
-
);
|
|
578
|
-
this.updateTypeFilter();
|
|
579
|
-
this.resetTypeFilterTreeData();
|
|
580
|
-
}
|
|
581
|
-
|
|
582
|
-
resetPackageFilter(): void {
|
|
583
|
-
this.packageFilterTreeData.nodes.forEach((node) =>
|
|
584
|
-
node.setCheckType(ModelsDocumentationFilterTreeNodeCheckType.CHECKED),
|
|
585
|
-
);
|
|
586
|
-
this.updatePackageFilter();
|
|
587
|
-
this.resetPackageFilterTreeData();
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
resetAllFilters(): void {
|
|
591
|
-
this.resetTypeFilter();
|
|
592
|
-
this.resetPackageFilter();
|
|
593
|
-
}
|
|
594
|
-
|
|
595
|
-
hasClassDocumentation(classPath: string): boolean {
|
|
596
|
-
return this.dataSpaceViewerState.dataSpaceAnalysisResult.elementDocs.some(
|
|
597
|
-
(entry) => entry.elementEntry.path === classPath,
|
|
598
|
-
);
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
viewClassDocumentation(classPath: string): void {
|
|
602
|
-
if (this.hasClassDocumentation(classPath)) {
|
|
603
|
-
const classNode = this.packageFilterTreeData.nodes.get(classPath);
|
|
604
|
-
if (classNode) {
|
|
605
|
-
uncheckAllFilterTree(this.packageFilterTreeData);
|
|
606
|
-
trickleDownCheckNode(classNode);
|
|
607
|
-
trickleUpCheckNode(classNode);
|
|
608
|
-
classNode.setCheckType(
|
|
609
|
-
ModelsDocumentationFilterTreeNodeCheckType.CHECKED,
|
|
610
|
-
);
|
|
611
|
-
this.resetSearch();
|
|
612
|
-
this.updatePackageFilter();
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
|
|
617
|
-
setSearchInput(el: HTMLInputElement | undefined): void {
|
|
618
|
-
this.searchInput = el;
|
|
619
|
-
}
|
|
620
|
-
|
|
621
|
-
focusSearchInput(): void {
|
|
622
|
-
this.searchInput?.focus();
|
|
623
|
-
}
|
|
624
|
-
|
|
625
|
-
selectSearchInput(): void {
|
|
626
|
-
this.searchInput?.select();
|
|
627
33
|
}
|
|
628
34
|
|
|
629
35
|
registerCommands(): void {
|
package/tsconfig.json
CHANGED
|
@@ -101,7 +101,6 @@
|
|
|
101
101
|
"./src/components/DataSpaceExecutionContextViewer.tsx",
|
|
102
102
|
"./src/components/DataSpaceInfoPanel.tsx",
|
|
103
103
|
"./src/components/DataSpaceMarkdownTextViewer.tsx",
|
|
104
|
-
"./src/components/DataSpaceModelsDocumentation.tsx",
|
|
105
104
|
"./src/components/DataSpacePlaceholder.tsx",
|
|
106
105
|
"./src/components/DataSpaceQuickStart.tsx",
|
|
107
106
|
"./src/components/DataSpaceSupportPanel.tsx",
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2020-present, Goldman Sachs
|
|
3
|
-
*
|
|
4
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
-
* you may not use this file except in compliance with the License.
|
|
6
|
-
* You may obtain a copy of the License at
|
|
7
|
-
*
|
|
8
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
-
*
|
|
10
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
-
* See the License for the specific language governing permissions and
|
|
14
|
-
* limitations under the License.
|
|
15
|
-
*/
|
|
16
|
-
import { type DataSpaceViewerState } from '../stores/DataSpaceViewerState.js';
|
|
17
|
-
export declare const DataSpaceModelsDocumentation: ((props: {
|
|
18
|
-
dataSpaceViewerState: DataSpaceViewerState;
|
|
19
|
-
}) => import("react/jsx-runtime").JSX.Element) & {
|
|
20
|
-
displayName: string;
|
|
21
|
-
};
|
|
22
|
-
//# sourceMappingURL=DataSpaceModelsDocumentation.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DataSpaceModelsDocumentation.d.ts","sourceRoot":"","sources":["../../src/components/DataSpaceModelsDocumentation.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AA6BH,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AA4/B9E,eAAO,MAAM,4BAA4B,WAC/B;IAAE,oBAAoB,EAAE,oBAAoB,CAAA;CAAE;;CAsFvD,CAAC"}
|