@finos/legend-application 14.0.4 → 15.0.1
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/__lib__/LegendApplicationDocumentation.d.ts.map +1 -0
- package/lib/__lib__/LegendApplicationDocumentation.js.map +1 -0
- package/lib/{application → __lib__}/LegendApplicationEvent.d.ts +0 -1
- package/lib/__lib__/LegendApplicationEvent.d.ts.map +1 -0
- package/lib/{application → __lib__}/LegendApplicationEvent.js +0 -1
- package/lib/__lib__/LegendApplicationEvent.js.map +1 -0
- package/lib/__lib__/LegendApplicationNavigation.d.ts +19 -0
- package/lib/__lib__/LegendApplicationNavigation.d.ts.map +1 -0
- package/lib/__lib__/LegendApplicationNavigation.js +20 -0
- package/lib/__lib__/LegendApplicationNavigation.js.map +1 -0
- package/lib/__lib__/LegendApplicationSetting.d.ts.map +1 -0
- package/lib/__lib__/LegendApplicationSetting.js.map +1 -0
- package/lib/{application → __lib__}/LegendApplicationTelemetry.d.ts +0 -11
- package/lib/__lib__/LegendApplicationTelemetry.d.ts.map +1 -0
- package/lib/{application → __lib__}/LegendApplicationTelemetry.js +0 -4
- package/lib/__lib__/LegendApplicationTelemetry.js.map +1 -0
- package/lib/__lib__/LegendApplicationTheme.d.ts.map +1 -0
- package/lib/__lib__/LegendApplicationTheme.js.map +1 -0
- package/lib/__test__.d.ts +18 -0
- package/lib/__test__.d.ts.map +1 -0
- package/lib/__test__.js +18 -0
- package/lib/__test__.js.map +1 -0
- package/lib/application/LegendApplication.d.ts +7 -4
- package/lib/application/LegendApplication.d.ts.map +1 -1
- package/lib/application/LegendApplication.js +28 -11
- package/lib/application/LegendApplication.js.map +1 -1
- package/lib/application/LegendApplicationConfig.d.ts +8 -1
- package/lib/application/LegendApplicationConfig.d.ts.map +1 -1
- package/lib/application/LegendApplicationConfig.js +6 -2
- package/lib/application/LegendApplicationConfig.js.map +1 -1
- package/lib/browser.d.ts +19 -0
- package/lib/browser.d.ts.map +1 -0
- package/lib/browser.js +19 -0
- package/lib/browser.js.map +1 -0
- package/lib/components/{LegendApplicationComponentFrameworkProvider.d.ts → ApplicationComponentFrameworkProvider.d.ts} +2 -2
- package/lib/components/ApplicationComponentFrameworkProvider.d.ts.map +1 -0
- package/lib/components/{LegendApplicationComponentFrameworkProvider.js → ApplicationComponentFrameworkProvider.js} +3 -3
- package/lib/components/ApplicationComponentFrameworkProvider.js.map +1 -0
- package/lib/components/ApplicationFrameworkProvider.d.ts +21 -0
- package/lib/components/ApplicationFrameworkProvider.d.ts.map +1 -0
- package/lib/components/ApplicationFrameworkProvider.js +39 -0
- package/lib/components/ApplicationFrameworkProvider.js.map +1 -0
- package/lib/components/{shared/DocumentationLink.d.ts → ApplicationPlatformProvider.d.ts} +4 -10
- package/lib/components/ApplicationPlatformProvider.d.ts.map +1 -0
- package/lib/components/{WebApplicationNavigatorProviderTestUtils.d.ts → ApplicationPlatformProvider.js} +5 -7
- package/lib/components/ApplicationPlatformProvider.js.map +1 -0
- package/lib/components/ApplicationStoreProvider.d.ts +3 -4
- package/lib/components/ApplicationStoreProvider.d.ts.map +1 -1
- package/lib/components/ApplicationStoreProvider.js +6 -23
- package/lib/components/ApplicationStoreProvider.js.map +1 -1
- package/lib/components/{WebApplicationNavigatorProvider.d.ts → BrowserEnvironmentProvider.d.ts} +3 -4
- package/lib/components/BrowserEnvironmentProvider.d.ts.map +1 -0
- package/lib/components/BrowserEnvironmentProvider.js +31 -0
- package/lib/components/BrowserEnvironmentProvider.js.map +1 -0
- package/lib/components/VirtualAssistant.d.ts.map +1 -1
- package/lib/components/VirtualAssistant.js +17 -9
- package/lib/components/VirtualAssistant.js.map +1 -1
- package/lib/components/{shared/FuzzySearchAdvancedConfigMenu.d.ts → __test-utils__/BrowserEnvironmentTestUtils.d.ts} +13 -7
- package/lib/components/__test-utils__/BrowserEnvironmentTestUtils.d.ts.map +1 -0
- package/lib/components/__test-utils__/BrowserEnvironmentTestUtils.js +42 -0
- package/lib/components/__test-utils__/BrowserEnvironmentTestUtils.js.map +1 -0
- package/lib/index.css +2 -2
- package/lib/index.css.map +1 -1
- package/lib/index.d.ts +8 -16
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +8 -18
- package/lib/index.js.map +1 -1
- package/lib/package.json +4 -6
- package/lib/stores/{shared/PackageableElementOption.d.ts → ApplicationConfig.d.ts} +6 -7
- package/lib/stores/ApplicationConfig.d.ts.map +1 -0
- package/lib/stores/ApplicationConfig.js +21 -0
- package/lib/stores/ApplicationConfig.js.map +1 -0
- package/lib/stores/ApplicationNavigationContextService.js +1 -1
- package/lib/stores/ApplicationNavigationContextService.js.map +1 -1
- package/lib/stores/ApplicationStore.d.ts +4 -8
- package/lib/stores/ApplicationStore.d.ts.map +1 -1
- package/lib/stores/ApplicationStore.js +14 -14
- package/lib/stores/ApplicationStore.js.map +1 -1
- package/lib/stores/AssistantService.d.ts +3 -3
- package/lib/stores/AssistantService.d.ts.map +1 -1
- package/lib/stores/AssistantService.js +18 -10
- package/lib/stores/AssistantService.js.map +1 -1
- package/lib/stores/CommandService.js +1 -1
- package/lib/stores/CommandService.js.map +1 -1
- package/lib/stores/Core_LegendApplicationPlugin.d.ts.map +1 -1
- package/lib/stores/Core_LegendApplicationPlugin.js +2 -52
- package/lib/stores/Core_LegendApplicationPlugin.js.map +1 -1
- package/lib/stores/DocumentationService.d.ts +1 -1
- package/lib/stores/DocumentationService.d.ts.map +1 -1
- package/lib/stores/DocumentationService.js +4 -5
- package/lib/stores/DocumentationService.js.map +1 -1
- package/lib/stores/LayoutService.js +3 -3
- package/lib/stores/LayoutService.js.map +1 -1
- package/lib/stores/LegendApplicationPlugin.d.ts +1 -15
- package/lib/stores/LegendApplicationPlugin.d.ts.map +1 -1
- package/lib/stores/LegendApplicationPlugin.js +0 -5
- package/lib/stores/LegendApplicationPlugin.js.map +1 -1
- package/lib/stores/SettingService.d.ts +1 -0
- package/lib/stores/SettingService.d.ts.map +1 -1
- package/lib/stores/SettingService.js +1 -1
- package/lib/stores/SettingService.js.map +1 -1
- package/lib/stores/__test-utils__/ApplicationStoreTestUtils.d.ts +18 -0
- package/lib/stores/__test-utils__/ApplicationStoreTestUtils.d.ts.map +1 -0
- package/lib/stores/__test-utils__/ApplicationStoreTestUtils.js +21 -0
- package/lib/stores/__test-utils__/ApplicationStoreTestUtils.js.map +1 -0
- package/lib/stores/navigation/BrowserNavigator.d.ts +64 -0
- package/lib/stores/navigation/BrowserNavigator.d.ts.map +1 -0
- package/lib/stores/navigation/{WebApplicationNavigator.js → BrowserNavigator.js} +22 -3
- package/lib/stores/navigation/BrowserNavigator.js.map +1 -0
- package/lib/stores/navigation/{WebApplicationNavigator.d.ts → DefaultNavigator.d.ts} +3 -12
- package/lib/stores/navigation/DefaultNavigator.d.ts.map +1 -0
- package/lib/stores/navigation/DefaultNavigator.js +74 -0
- package/lib/stores/navigation/DefaultNavigator.js.map +1 -0
- package/lib/stores/navigation/NavigationService.d.ts +7 -0
- package/lib/stores/navigation/NavigationService.d.ts.map +1 -1
- package/lib/stores/navigation/NavigationService.js.map +1 -1
- package/lib/stores/platform/ApplicationPlatform.d.ts +24 -0
- package/lib/stores/platform/ApplicationPlatform.d.ts.map +1 -0
- package/lib/stores/platform/ApplicationPlatform.js +25 -0
- package/lib/stores/platform/ApplicationPlatform.js.map +1 -0
- package/lib/stores/platform/BrowserPlatform.d.ts +29 -0
- package/lib/stores/platform/BrowserPlatform.d.ts.map +1 -0
- package/lib/stores/platform/BrowserPlatform.js +39 -0
- package/lib/stores/platform/BrowserPlatform.js.map +1 -0
- package/lib/stores/storage/StorageService.d.ts +5 -2
- package/lib/stores/storage/StorageService.d.ts.map +1 -1
- package/lib/stores/storage/StorageService.js +20 -10
- package/lib/stores/storage/StorageService.js.map +1 -1
- package/lib/stores/terminal/XTerm.d.ts.map +1 -1
- package/lib/stores/terminal/XTerm.js +5 -5
- package/lib/stores/terminal/XTerm.js.map +1 -1
- package/package.json +7 -9
- package/src/{application → __lib__}/LegendApplicationEvent.ts +1 -1
- package/{lib/stores/shared/PackageableElementOption.js → src/__lib__/LegendApplicationNavigation.ts} +4 -5
- package/src/{application → __lib__}/LegendApplicationTelemetry.ts +0 -24
- package/src/{components.ts → __test__.ts} +2 -7
- package/src/application/LegendApplication.ts +45 -16
- package/src/application/LegendApplicationConfig.ts +13 -2
- package/src/browser.ts +19 -0
- package/src/components/{LegendApplicationComponentFrameworkProvider.tsx → ApplicationComponentFrameworkProvider.tsx} +2 -2
- package/src/components/ApplicationFrameworkProvider.tsx +47 -0
- package/src/components/ApplicationPlatformProvider.tsx +29 -0
- package/src/components/ApplicationStoreProvider.tsx +8 -33
- package/src/components/BrowserEnvironmentProvider.tsx +48 -0
- package/src/components/VirtualAssistant.tsx +53 -11
- package/src/components/__test-utils__/BrowserEnvironmentTestUtils.tsx +63 -0
- package/src/index.ts +12 -24
- package/src/stores/ApplicationConfig.ts +22 -0
- package/src/stores/ApplicationNavigationContextService.ts +1 -1
- package/src/stores/ApplicationStore.ts +18 -19
- package/src/stores/AssistantService.ts +20 -9
- package/src/stores/CommandService.ts +1 -1
- package/src/stores/Core_LegendApplicationPlugin.ts +2 -78
- package/src/stores/DocumentationService.ts +4 -5
- package/src/stores/LayoutService.ts +3 -3
- package/src/stores/LegendApplicationPlugin.ts +1 -21
- package/src/stores/SettingService.ts +2 -1
- package/src/stores/__test-utils__/ApplicationStoreTestUtils.ts +24 -0
- package/src/stores/navigation/{WebApplicationNavigator.ts → BrowserNavigator.ts} +41 -2
- package/src/stores/navigation/DefaultNavigator.ts +150 -0
- package/src/stores/navigation/NavigationService.ts +8 -0
- package/src/stores/{shared/PackageableElementOption.ts → platform/ApplicationPlatform.ts} +14 -11
- package/src/stores/platform/BrowserPlatform.ts +54 -0
- package/src/stores/storage/StorageService.ts +32 -14
- package/src/stores/terminal/XTerm.ts +8 -5
- package/tsconfig.json +19 -23
- package/lib/application/LegendApplicationDocumentation.d.ts.map +0 -1
- package/lib/application/LegendApplicationDocumentation.js.map +0 -1
- package/lib/application/LegendApplicationEvent.d.ts.map +0 -1
- package/lib/application/LegendApplicationEvent.js.map +0 -1
- package/lib/application/LegendApplicationSetting.d.ts.map +0 -1
- package/lib/application/LegendApplicationSetting.js.map +0 -1
- package/lib/application/LegendApplicationTelemetry.d.ts.map +0 -1
- package/lib/application/LegendApplicationTelemetry.js.map +0 -1
- package/lib/application/LegendApplicationTheme.d.ts.map +0 -1
- package/lib/application/LegendApplicationTheme.js.map +0 -1
- package/lib/components/ApplicationStoreProviderTestUtils.d.ts +0 -31
- package/lib/components/ApplicationStoreProviderTestUtils.d.ts.map +0 -1
- package/lib/components/ApplicationStoreProviderTestUtils.js +0 -32
- package/lib/components/ApplicationStoreProviderTestUtils.js.map +0 -1
- package/lib/components/LegendApplicationComponentFrameworkProvider.d.ts.map +0 -1
- package/lib/components/LegendApplicationComponentFrameworkProvider.js.map +0 -1
- package/lib/components/WebApplicationNavigatorProvider.d.ts.map +0 -1
- package/lib/components/WebApplicationNavigatorProvider.js +0 -29
- package/lib/components/WebApplicationNavigatorProvider.js.map +0 -1
- package/lib/components/WebApplicationNavigatorProviderTestUtils.d.ts.map +0 -1
- package/lib/components/WebApplicationNavigatorProviderTestUtils.js +0 -28
- package/lib/components/WebApplicationNavigatorProviderTestUtils.js.map +0 -1
- package/lib/components/shared/DocumentationLink.d.ts.map +0 -1
- package/lib/components/shared/DocumentationLink.js +0 -53
- package/lib/components/shared/DocumentationLink.js.map +0 -1
- package/lib/components/shared/FuzzySearchAdvancedConfigMenu.d.ts.map +0 -1
- package/lib/components/shared/FuzzySearchAdvancedConfigMenu.js +0 -37
- package/lib/components/shared/FuzzySearchAdvancedConfigMenu.js.map +0 -1
- package/lib/components/shared/PackageableElementOptionLabel.d.ts +0 -22
- package/lib/components/shared/PackageableElementOptionLabel.d.ts.map +0 -1
- package/lib/components/shared/PackageableElementOptionLabel.js +0 -46
- package/lib/components/shared/PackageableElementOptionLabel.js.map +0 -1
- package/lib/components/shared/TabManager.d.ts +0 -24
- package/lib/components/shared/TabManager.d.ts.map +0 -1
- package/lib/components/shared/TabManager.js +0 -117
- package/lib/components/shared/TabManager.js.map +0 -1
- package/lib/components.d.ts +0 -21
- package/lib/components.d.ts.map +0 -1
- package/lib/components.js +0 -21
- package/lib/components.js.map +0 -1
- package/lib/const.d.ts +0 -35
- package/lib/const.d.ts.map +0 -1
- package/lib/const.js +0 -39
- package/lib/const.js.map +0 -1
- package/lib/stores/ApplicationStoreTestUtils.d.ts +0 -41
- package/lib/stores/ApplicationStoreTestUtils.d.ts.map +0 -1
- package/lib/stores/ApplicationStoreTestUtils.js +0 -70
- package/lib/stores/ApplicationStoreTestUtils.js.map +0 -1
- package/lib/stores/navigation/WebApplicationNavigator.d.ts.map +0 -1
- package/lib/stores/navigation/WebApplicationNavigator.js.map +0 -1
- package/lib/stores/navigation/WebApplicationRouter.d.ts +0 -22
- package/lib/stores/navigation/WebApplicationRouter.d.ts.map +0 -1
- package/lib/stores/navigation/WebApplicationRouter.js +0 -25
- package/lib/stores/navigation/WebApplicationRouter.js.map +0 -1
- package/lib/stores/pure-language/PureLanguageCodeEditorSupport.d.ts +0 -70
- package/lib/stores/pure-language/PureLanguageCodeEditorSupport.d.ts.map +0 -1
- package/lib/stores/pure-language/PureLanguageCodeEditorSupport.js +0 -237
- package/lib/stores/pure-language/PureLanguageCodeEditorSupport.js.map +0 -1
- package/lib/stores/pure-language/PureLanguageSupport.d.ts +0 -39
- package/lib/stores/pure-language/PureLanguageSupport.d.ts.map +0 -1
- package/lib/stores/pure-language/PureLanguageSupport.js +0 -437
- package/lib/stores/pure-language/PureLanguageSupport.js.map +0 -1
- package/lib/stores/shared/FuzzySearchAdvancedConfigState.d.ts +0 -30
- package/lib/stores/shared/FuzzySearchAdvancedConfigState.d.ts.map +0 -1
- package/lib/stores/shared/FuzzySearchAdvancedConfigState.js +0 -59
- package/lib/stores/shared/FuzzySearchAdvancedConfigState.js.map +0 -1
- package/lib/stores/shared/PackageableElementOption.d.ts.map +0 -1
- package/lib/stores/shared/PackageableElementOption.js.map +0 -1
- package/lib/stores/shared/TabManagerState.d.ts +0 -40
- package/lib/stores/shared/TabManagerState.d.ts.map +0 -1
- package/lib/stores/shared/TabManagerState.js +0 -93
- package/lib/stores/shared/TabManagerState.js.map +0 -1
- package/src/components/ApplicationStoreProviderTestUtils.tsx +0 -59
- package/src/components/WebApplicationNavigatorProvider.tsx +0 -46
- package/src/components/WebApplicationNavigatorProviderTestUtils.tsx +0 -37
- package/src/components/shared/DocumentationLink.tsx +0 -87
- package/src/components/shared/FuzzySearchAdvancedConfigMenu.tsx +0 -73
- package/src/components/shared/PackageableElementOptionLabel.tsx +0 -85
- package/src/components/shared/TabManager.tsx +0 -288
- package/src/const.ts +0 -40
- package/src/stores/ApplicationStoreTestUtils.ts +0 -107
- package/src/stores/navigation/WebApplicationRouter.ts +0 -49
- package/src/stores/pure-language/PureLanguageCodeEditorSupport.ts +0 -338
- package/src/stores/pure-language/PureLanguageSupport.ts +0 -498
- package/src/stores/shared/FuzzySearchAdvancedConfigState.ts +0 -65
- package/src/stores/shared/TabManagerState.ts +0 -124
- /package/lib/{application → __lib__}/LegendApplicationDocumentation.d.ts +0 -0
- /package/lib/{application → __lib__}/LegendApplicationDocumentation.js +0 -0
- /package/lib/{application → __lib__}/LegendApplicationSetting.d.ts +0 -0
- /package/lib/{application → __lib__}/LegendApplicationSetting.js +0 -0
- /package/lib/{application → __lib__}/LegendApplicationTheme.d.ts +0 -0
- /package/lib/{application → __lib__}/LegendApplicationTheme.js +0 -0
- /package/src/{application → __lib__}/LegendApplicationDocumentation.ts +0 -0
- /package/src/{application → __lib__}/LegendApplicationSetting.ts +0 -0
- /package/src/{application → __lib__}/LegendApplicationTheme.ts +0 -0
|
@@ -24,8 +24,8 @@ import {
|
|
|
24
24
|
isNonNullable,
|
|
25
25
|
ActionState,
|
|
26
26
|
FuzzySearchEngine,
|
|
27
|
+
FuzzySearchAdvancedConfigState,
|
|
27
28
|
} from '@finos/legend-shared';
|
|
28
|
-
import { FuzzySearchAdvancedConfigState } from './shared/FuzzySearchAdvancedConfigState.js';
|
|
29
29
|
|
|
30
30
|
export enum VIRTUAL_ASSISTANT_TAB {
|
|
31
31
|
SEARCH = 'SEARCH',
|
|
@@ -48,7 +48,7 @@ export class VirtualAssistantDocumentationEntry {
|
|
|
48
48
|
setIsOpen: action,
|
|
49
49
|
});
|
|
50
50
|
|
|
51
|
-
this.documentationKey = docEntry.
|
|
51
|
+
this.documentationKey = docEntry.key;
|
|
52
52
|
this.title = guaranteeNonEmptyString(docEntry.title);
|
|
53
53
|
this.content = docEntry.markdownText ?? docEntry.text;
|
|
54
54
|
this.url = docEntry.url;
|
|
@@ -106,7 +106,7 @@ export class AssistantService {
|
|
|
106
106
|
* This key is used to allow programmatic re-rendering of the assistant panel
|
|
107
107
|
*/
|
|
108
108
|
panelRenderingKey = uuid();
|
|
109
|
-
isHidden =
|
|
109
|
+
isHidden = true; // hide by default unless specified by the application to show
|
|
110
110
|
isOpen = false;
|
|
111
111
|
selectedTab = VIRTUAL_ASSISTANT_TAB.SEARCH;
|
|
112
112
|
currentDocumentationEntry: VirtualAssistantDocumentationEntry | undefined;
|
|
@@ -211,22 +211,33 @@ export class AssistantService {
|
|
|
211
211
|
: undefined;
|
|
212
212
|
}
|
|
213
213
|
|
|
214
|
-
openDocumentationEntry(
|
|
215
|
-
const
|
|
216
|
-
.getAllDocEntries()
|
|
217
|
-
.find((entry) => entry._documentationKey === docKey);
|
|
214
|
+
openDocumentationEntry(key: string): void {
|
|
215
|
+
const entry = this.applicationStore.documentationService.getDocEntry(key);
|
|
218
216
|
|
|
219
|
-
if (
|
|
217
|
+
if (entry) {
|
|
220
218
|
this.setIsOpen(true);
|
|
221
219
|
this.setIsHidden(false);
|
|
222
220
|
this.currentDocumentationEntry = new VirtualAssistantDocumentationEntry(
|
|
223
|
-
|
|
221
|
+
entry,
|
|
224
222
|
);
|
|
225
223
|
this.currentDocumentationEntry.setIsOpen(true);
|
|
226
224
|
this.resetSearch();
|
|
227
225
|
}
|
|
228
226
|
}
|
|
229
227
|
|
|
228
|
+
openDocumentationEntryLink(key: string): void {
|
|
229
|
+
const entry = this.applicationStore.documentationService.getDocEntry(key);
|
|
230
|
+
if (entry) {
|
|
231
|
+
if (shouldDisplayVirtualAssistantDocumentationEntry(entry)) {
|
|
232
|
+
this.openDocumentationEntry(entry.key);
|
|
233
|
+
} else if (entry.url) {
|
|
234
|
+
this.applicationStore.navigationService.navigator.visitAddress(
|
|
235
|
+
entry.url,
|
|
236
|
+
);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
|
|
230
241
|
setIsHidden(val: boolean): void {
|
|
231
242
|
this.isHidden = val;
|
|
232
243
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import { LogEvent } from '@finos/legend-shared';
|
|
18
18
|
import { action, makeObservable, observable } from 'mobx';
|
|
19
|
-
import { APPLICATION_EVENT } from '../
|
|
19
|
+
import { APPLICATION_EVENT } from '../__lib__/LegendApplicationEvent.js';
|
|
20
20
|
import type { GenericLegendApplicationStore } from './ApplicationStore.js';
|
|
21
21
|
|
|
22
22
|
export interface CommandRegistrar {
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
|
|
17
17
|
import packageJson from '../../package.json';
|
|
18
18
|
import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager.js';
|
|
19
|
-
import { LEGEND_APPLICATION_SETTING_CONFIG } from '../
|
|
19
|
+
import { LEGEND_APPLICATION_SETTING_CONFIG } from '../__lib__/LegendApplicationSetting.js';
|
|
20
20
|
import {
|
|
21
21
|
HIGH_CONTRAST_LIGHT_COLOR_THEME,
|
|
22
22
|
LEGACY_LIGHT_COLOR_THEME,
|
|
23
|
-
} from '../
|
|
23
|
+
} from '../__lib__/LegendApplicationTheme.js';
|
|
24
24
|
import type { ColorTheme } from './LayoutService.js';
|
|
25
25
|
import {
|
|
26
26
|
LegendApplicationPlugin,
|
|
@@ -31,80 +31,7 @@ import {
|
|
|
31
31
|
type SettingConfigurationEntry,
|
|
32
32
|
} from './SettingService.js';
|
|
33
33
|
import { configure as configureMobx } from 'mobx';
|
|
34
|
-
import { KeyCode, KeyMod, editor as monacoEditorAPI } from 'monaco-editor';
|
|
35
|
-
import { MONOSPACED_FONT_FAMILY } from '../const.js';
|
|
36
|
-
import { LogEvent } from '@finos/legend-shared';
|
|
37
|
-
import { APPLICATION_EVENT } from '../application/LegendApplicationEvent.js';
|
|
38
34
|
import { configureComponents } from '@finos/legend-art';
|
|
39
|
-
import type { GenericLegendApplicationStore } from './ApplicationStore.js';
|
|
40
|
-
|
|
41
|
-
const configureCodeEditorComponent = async (
|
|
42
|
-
applicationStore: GenericLegendApplicationStore,
|
|
43
|
-
): Promise<void> => {
|
|
44
|
-
/**
|
|
45
|
-
* Since we use a custom fonts for text-editor, we want to make sure the font is loaded before any text-editor is opened
|
|
46
|
-
* this is to ensure
|
|
47
|
-
*/
|
|
48
|
-
const fontLoadFailureErrorMessage = `Monospaced font '${MONOSPACED_FONT_FAMILY}' has not been loaded properly, text editor display problems might occur`;
|
|
49
|
-
await Promise.all(
|
|
50
|
-
[400, 700].map((weight) =>
|
|
51
|
-
document.fonts.load(`${weight} 1em ${MONOSPACED_FONT_FAMILY}`),
|
|
52
|
-
),
|
|
53
|
-
)
|
|
54
|
-
.then(() => {
|
|
55
|
-
if (document.fonts.check(`1em ${MONOSPACED_FONT_FAMILY}`)) {
|
|
56
|
-
monacoEditorAPI.remeasureFonts();
|
|
57
|
-
applicationStore.logService.info(
|
|
58
|
-
LogEvent.create(APPLICATION_EVENT.LOAD_TEXT_EDITOR_FONT__SUCCESS),
|
|
59
|
-
`Monospaced font '${MONOSPACED_FONT_FAMILY}' has been loaded`,
|
|
60
|
-
);
|
|
61
|
-
} else {
|
|
62
|
-
applicationStore.logService.error(
|
|
63
|
-
LogEvent.create(APPLICATION_EVENT.APPLICATION_SETUP__FAILURE),
|
|
64
|
-
fontLoadFailureErrorMessage,
|
|
65
|
-
);
|
|
66
|
-
}
|
|
67
|
-
})
|
|
68
|
-
.catch(() =>
|
|
69
|
-
applicationStore.logService.error(
|
|
70
|
-
LogEvent.create(APPLICATION_EVENT.APPLICATION_SETUP__FAILURE),
|
|
71
|
-
fontLoadFailureErrorMessage,
|
|
72
|
-
),
|
|
73
|
-
);
|
|
74
|
-
|
|
75
|
-
// override native hotkeys supported by monaco-editor
|
|
76
|
-
// here we map these keys to a dummy command that would just dispatch the key combination
|
|
77
|
-
// to the application keyboard shortcut service, effectively bypassing the command associated
|
|
78
|
-
// with the native keybinding
|
|
79
|
-
const OVERRIDE_DEFAULT_KEYBINDING_COMMAND =
|
|
80
|
-
'legend.code-editor.override-default-keybinding';
|
|
81
|
-
monacoEditorAPI.registerCommand(
|
|
82
|
-
OVERRIDE_DEFAULT_KEYBINDING_COMMAND,
|
|
83
|
-
(accessor, ...args) => {
|
|
84
|
-
applicationStore.keyboardShortcutsService.dispatch(args[0]);
|
|
85
|
-
},
|
|
86
|
-
);
|
|
87
|
-
const hotkeyMapping: [number, string][] = [
|
|
88
|
-
[KeyCode.F1, 'F1'], // show command center
|
|
89
|
-
[KeyCode.F8, 'F8'], // show error
|
|
90
|
-
[KeyCode.F9, 'F9'], // toggle debugger breakpoint
|
|
91
|
-
[KeyMod.WinCtrl | KeyCode.KeyG, 'Control+KeyG'], // go-to line command
|
|
92
|
-
[KeyMod.WinCtrl | KeyCode.KeyB, 'Control+KeyB'], // cursor move (core command)
|
|
93
|
-
[KeyMod.WinCtrl | KeyCode.KeyO, 'Control+KeyO'], // cursor move (core command)
|
|
94
|
-
[KeyMod.WinCtrl | KeyCode.KeyD, 'Control+KeyD'], // cursor move (core command)
|
|
95
|
-
[KeyMod.WinCtrl | KeyCode.KeyP, 'Control+KeyP'], // cursor move (core command)
|
|
96
|
-
[KeyMod.Shift | KeyCode.F10, 'Shift+F10'], // show editor context menu
|
|
97
|
-
[KeyMod.WinCtrl | KeyCode.F2, 'Control+F2'], // change all instances
|
|
98
|
-
[KeyMod.WinCtrl | KeyCode.F12, 'Control+F12'], // go-to definition
|
|
99
|
-
];
|
|
100
|
-
monacoEditorAPI.addKeybindingRules(
|
|
101
|
-
hotkeyMapping.map(([nativeCodeEditorKeyBinding, keyCombination]) => ({
|
|
102
|
-
keybinding: nativeCodeEditorKeyBinding,
|
|
103
|
-
command: OVERRIDE_DEFAULT_KEYBINDING_COMMAND,
|
|
104
|
-
commandArgs: keyCombination,
|
|
105
|
-
})),
|
|
106
|
-
);
|
|
107
|
-
};
|
|
108
35
|
|
|
109
36
|
export class Core_LegendApplicationPlugin extends LegendApplicationPlugin {
|
|
110
37
|
static NAME = packageJson.extensions.applicationPlugin;
|
|
@@ -131,9 +58,6 @@ export class Core_LegendApplicationPlugin extends LegendApplicationPlugin {
|
|
|
131
58
|
enforceActions: 'observed',
|
|
132
59
|
});
|
|
133
60
|
|
|
134
|
-
// configure code editor
|
|
135
|
-
await configureCodeEditorComponent(applicationStore);
|
|
136
|
-
|
|
137
61
|
// configure UI components
|
|
138
62
|
configureComponents();
|
|
139
63
|
},
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
optional,
|
|
30
30
|
primitive,
|
|
31
31
|
} from 'serializr';
|
|
32
|
-
import { APPLICATION_EVENT } from '../
|
|
32
|
+
import { APPLICATION_EVENT } from '../__lib__/LegendApplicationEvent.js';
|
|
33
33
|
import type { GenericLegendApplicationStore } from './ApplicationStore.js';
|
|
34
34
|
|
|
35
35
|
export type DocumentationRegistryEntry = {
|
|
@@ -68,7 +68,7 @@ export type DocumentationEntryData = {
|
|
|
68
68
|
};
|
|
69
69
|
|
|
70
70
|
export class DocumentationEntry {
|
|
71
|
-
readonly
|
|
71
|
+
readonly key!: string;
|
|
72
72
|
|
|
73
73
|
markdownText?: MarkdownText | undefined;
|
|
74
74
|
title?: string | undefined;
|
|
@@ -94,8 +94,7 @@ export class DocumentationEntry {
|
|
|
94
94
|
documentationKey: string,
|
|
95
95
|
): DocumentationEntry {
|
|
96
96
|
const entry = DocumentationEntry.serialization.fromJson(json);
|
|
97
|
-
(entry as Writable<DocumentationEntry>).
|
|
98
|
-
documentationKey;
|
|
97
|
+
(entry as Writable<DocumentationEntry>).key = documentationKey;
|
|
99
98
|
return entry;
|
|
100
99
|
}
|
|
101
100
|
}
|
|
@@ -261,7 +260,7 @@ export class DocumentationService {
|
|
|
261
260
|
publishContextualDocIndex(): ContextualDocumentationConfig {
|
|
262
261
|
const result: ContextualDocumentationConfig = {};
|
|
263
262
|
this.contextualDocIndex.forEach((value, key) => {
|
|
264
|
-
result[key] = value.
|
|
263
|
+
result[key] = value.key;
|
|
265
264
|
});
|
|
266
265
|
return result;
|
|
267
266
|
}
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
|
|
17
17
|
import { action, computed, makeObservable, observable } from 'mobx';
|
|
18
18
|
import type { GenericLegendApplicationStore } from './ApplicationStore.js';
|
|
19
|
-
import { LEGEND_APPLICATION_SETTING_KEY } from '../
|
|
19
|
+
import { LEGEND_APPLICATION_SETTING_KEY } from '../__lib__/LegendApplicationSetting.js';
|
|
20
20
|
import { LogEvent, guaranteeNonNullable } from '@finos/legend-shared';
|
|
21
|
-
import { APPLICATION_EVENT } from '../
|
|
21
|
+
import { APPLICATION_EVENT } from '../__lib__/LegendApplicationEvent.js';
|
|
22
22
|
import {
|
|
23
23
|
DEFAULT_DARK_COLOR_THEME,
|
|
24
24
|
LEGEND_APPLICATION_COLOR_THEME,
|
|
25
|
-
} from '../
|
|
25
|
+
} from '../__lib__/LegendApplicationTheme.js';
|
|
26
26
|
|
|
27
27
|
export type ColorTheme = {
|
|
28
28
|
name: string;
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { AbstractPlugin } from '@finos/legend-shared';
|
|
18
|
-
import type { LegendApplicationPluginManager } from '../application/LegendApplicationPluginManager.js';
|
|
19
18
|
import type { KeyedCommandConfigEntry } from './CommandService.js';
|
|
20
19
|
import type {
|
|
21
20
|
ContextualDocumentationEntry,
|
|
@@ -26,36 +25,17 @@ import type { ColorTheme } from './LayoutService.js';
|
|
|
26
25
|
import type { SettingConfigurationEntry } from './SettingService.js';
|
|
27
26
|
import type { GenericLegendApplicationStore } from './ApplicationStore.js';
|
|
28
27
|
|
|
29
|
-
export type LegendApplicationBootstrap = <T extends LegendApplicationPlugin>(
|
|
30
|
-
pluginManager: LegendApplicationPluginManager<T>,
|
|
31
|
-
) => Promise<void>;
|
|
32
|
-
|
|
33
28
|
export type LegendApplicationSetup = (
|
|
34
29
|
applicationStore: GenericLegendApplicationStore,
|
|
35
30
|
) => Promise<void>;
|
|
36
31
|
|
|
37
|
-
/**
|
|
38
|
-
* Prefix URL patterns coming from extensions with `/extensions/`
|
|
39
|
-
* to avoid potential conflicts with main routes.
|
|
40
|
-
*/
|
|
41
|
-
export const generateExtensionUrlPattern = (pattern: string): string =>
|
|
42
|
-
`/extensions/${pattern}`.replace(/^\/extensions\/\//, '/extensions/');
|
|
43
|
-
|
|
44
32
|
export type ApplicationPageEntry = {
|
|
45
33
|
key: string;
|
|
46
|
-
|
|
34
|
+
addressPatterns: string[];
|
|
47
35
|
renderer: React.FC | React.ReactElement;
|
|
48
36
|
};
|
|
49
37
|
|
|
50
38
|
export abstract class LegendApplicationPlugin extends AbstractPlugin {
|
|
51
|
-
/**
|
|
52
|
-
* Get the list of bootstrap procedures to be run when booting up the application.
|
|
53
|
-
*
|
|
54
|
-
* NOTE: The application will call the bootstrap procedures from all extensions concurrently.
|
|
55
|
-
* These procedures should be idempotent and should not depend on each other.
|
|
56
|
-
*/
|
|
57
|
-
getExtraApplicationBootstraps?(): LegendApplicationBootstrap[];
|
|
58
|
-
|
|
59
39
|
/**
|
|
60
40
|
* Get the list of setup procedures to be run when booting up the application.
|
|
61
41
|
*
|
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
isString,
|
|
23
23
|
LogEvent,
|
|
24
24
|
} from '@finos/legend-shared';
|
|
25
|
-
import { APPLICATION_EVENT } from '../
|
|
25
|
+
import { APPLICATION_EVENT } from '../__lib__/LegendApplicationEvent.js';
|
|
26
26
|
import type { GenericLegendApplicationStore } from './ApplicationStore.js';
|
|
27
27
|
import { StorageStore } from './storage/StorageService.js';
|
|
28
28
|
|
|
@@ -32,6 +32,7 @@ type SettingConfigurationEntryData = {
|
|
|
32
32
|
// See https://github.com/finos/legend-studio/issues/407
|
|
33
33
|
defaultValue: SettingValue;
|
|
34
34
|
};
|
|
35
|
+
export type SettingOverrideConfigData = Record<string, SettingValue>;
|
|
35
36
|
export type SettingConfigurationEntry = {
|
|
36
37
|
key: string;
|
|
37
38
|
defaultValue: SettingValue;
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
|
|
17
|
+
import type { LegendApplicationVersionData } from '../../application/LegendApplicationConfig.js';
|
|
18
|
+
|
|
19
|
+
export const TEST__getApplicationVersionData =
|
|
20
|
+
(): LegendApplicationVersionData => ({
|
|
21
|
+
buildTime: '2000-01-01T00:00:00-0000',
|
|
22
|
+
version: 'test-version',
|
|
23
|
+
commitSHA: 'test-commit-id',
|
|
24
|
+
});
|
|
@@ -16,10 +16,12 @@
|
|
|
16
16
|
|
|
17
17
|
import type { History } from 'history';
|
|
18
18
|
import {
|
|
19
|
+
addQueryParametersToUrl,
|
|
19
20
|
getQueryParameterValue,
|
|
20
21
|
getQueryParameters,
|
|
21
22
|
guaranteeNonNullable,
|
|
22
23
|
sanitizeURL,
|
|
24
|
+
stringifyQueryParams,
|
|
23
25
|
} from '@finos/legend-shared';
|
|
24
26
|
import { action, computed, makeObservable, observable } from 'mobx';
|
|
25
27
|
import {
|
|
@@ -30,8 +32,31 @@ import {
|
|
|
30
32
|
type NavigationZone,
|
|
31
33
|
NAVIGATION_ZONE_PREFIX,
|
|
32
34
|
} from './NavigationService.js';
|
|
35
|
+
import {
|
|
36
|
+
Route,
|
|
37
|
+
Switch,
|
|
38
|
+
Redirect,
|
|
39
|
+
matchPath,
|
|
40
|
+
generatePath,
|
|
41
|
+
useParams,
|
|
42
|
+
useLocation,
|
|
43
|
+
} from 'react-router';
|
|
44
|
+
|
|
45
|
+
export { BrowserRouter } from 'react-router-dom';
|
|
46
|
+
export { Route, Switch, Redirect, useParams, matchPath, generatePath };
|
|
47
|
+
export const useNavigationZone = (): NavigationZone => {
|
|
48
|
+
const location = useLocation() as { hash: string }; // TODO: this is a temporary hack until we upgrade react-router
|
|
49
|
+
return location.hash.substring(NAVIGATION_ZONE_PREFIX.length);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Prefix URL patterns coming from extensions with `/extensions/`
|
|
54
|
+
* to avoid potential conflicts with main routes.
|
|
55
|
+
*/
|
|
56
|
+
export const generateExtensionUrlPattern = (pattern: string): string =>
|
|
57
|
+
`/extensions/${pattern}`.replace(/^\/extensions\/\//, '/extensions/');
|
|
33
58
|
|
|
34
|
-
export class
|
|
59
|
+
export class BrowserNavigator implements ApplicationNavigator {
|
|
35
60
|
private readonly historyAPI: History;
|
|
36
61
|
private _isNavigationBlocked = false;
|
|
37
62
|
private _forceBypassNavigationBlocking = false;
|
|
@@ -51,7 +76,7 @@ export class WebApplicationNavigator implements ApplicationNavigator {
|
|
|
51
76
|
onNativePlatformNavigationBlock?: (() => void) | undefined;
|
|
52
77
|
|
|
53
78
|
constructor(historyApiClient: History) {
|
|
54
|
-
makeObservable<
|
|
79
|
+
makeObservable<BrowserNavigator, '_isNavigationBlocked'>(this, {
|
|
55
80
|
_isNavigationBlocked: observable,
|
|
56
81
|
isNavigationBlocked: computed,
|
|
57
82
|
blockNavigation: action,
|
|
@@ -229,4 +254,18 @@ export class WebApplicationNavigator implements ApplicationNavigator {
|
|
|
229
254
|
get isNavigationBlocked(): boolean {
|
|
230
255
|
return this._isNavigationBlocked;
|
|
231
256
|
}
|
|
257
|
+
|
|
258
|
+
INTERNAL__internalizeTransientParameter(key: string): void {
|
|
259
|
+
const currentZone = this.getCurrentZone();
|
|
260
|
+
const parameters = this.getCurrentLocationParameters();
|
|
261
|
+
delete parameters[key];
|
|
262
|
+
|
|
263
|
+
this.updateCurrentLocation(
|
|
264
|
+
addQueryParametersToUrl(
|
|
265
|
+
this.getCurrentLocation(),
|
|
266
|
+
stringifyQueryParams(parameters),
|
|
267
|
+
),
|
|
268
|
+
);
|
|
269
|
+
this.updateCurrentZone(currentZone);
|
|
270
|
+
}
|
|
232
271
|
}
|
|
@@ -0,0 +1,150 @@
|
|
|
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
|
+
|
|
17
|
+
import { UnsupportedOperationError } from '@finos/legend-shared';
|
|
18
|
+
import {
|
|
19
|
+
type NavigationAddress,
|
|
20
|
+
type NavigationLocation,
|
|
21
|
+
type ApplicationNavigator,
|
|
22
|
+
type NavigationLocationParameterValue,
|
|
23
|
+
type NavigationZone,
|
|
24
|
+
} from './NavigationService.js';
|
|
25
|
+
|
|
26
|
+
export class DefaultNavigator implements ApplicationNavigator {
|
|
27
|
+
goToLocation(
|
|
28
|
+
location: NavigationLocation,
|
|
29
|
+
options?: { ignoreBlocking?: boolean | undefined },
|
|
30
|
+
): void {
|
|
31
|
+
throw new UnsupportedOperationError(
|
|
32
|
+
`Navigator does not support this operation`,
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
reload(options?: { ignoreBlocking?: boolean | undefined }): void {
|
|
37
|
+
throw new UnsupportedOperationError(
|
|
38
|
+
`Navigator does not support this operation`,
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
goToAddress(
|
|
43
|
+
address: NavigationAddress,
|
|
44
|
+
options?: { ignoreBlocking?: boolean | undefined },
|
|
45
|
+
): void {
|
|
46
|
+
throw new UnsupportedOperationError(
|
|
47
|
+
`Navigator does not support this operation`,
|
|
48
|
+
);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
visitAddress(address: NavigationAddress): void {
|
|
52
|
+
throw new UnsupportedOperationError(
|
|
53
|
+
`Navigator does not support this operation`,
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
generateAddress(location: NavigationLocation): string {
|
|
58
|
+
throw new UnsupportedOperationError(
|
|
59
|
+
`Navigator does not support this operation`,
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
updateCurrentLocation(location: NavigationLocation): void {
|
|
64
|
+
throw new UnsupportedOperationError(
|
|
65
|
+
`Navigator does not support this operation`,
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
updateCurrentZone(zone: NavigationZone): void {
|
|
70
|
+
throw new UnsupportedOperationError(
|
|
71
|
+
`Navigator does not support this operation`,
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
resetZone(): void {
|
|
76
|
+
throw new UnsupportedOperationError(
|
|
77
|
+
`Navigator does not support this operation`,
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
getCurrentBaseAddress(options?: {
|
|
82
|
+
withAppRoot?: boolean | undefined;
|
|
83
|
+
}): NavigationAddress {
|
|
84
|
+
throw new UnsupportedOperationError(
|
|
85
|
+
`Navigator does not support this operation`,
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
getCurrentAddress(): NavigationAddress {
|
|
90
|
+
throw new UnsupportedOperationError(
|
|
91
|
+
`Navigator does not support this operation`,
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
getCurrentLocation(): NavigationLocation {
|
|
96
|
+
throw new UnsupportedOperationError(
|
|
97
|
+
`Navigator does not support this operation`,
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
getCurrentLocationParameters<
|
|
102
|
+
T extends Record<string, NavigationLocationParameterValue>,
|
|
103
|
+
>(): T {
|
|
104
|
+
throw new UnsupportedOperationError(
|
|
105
|
+
`Navigator does not support this operation`,
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
getCurrentLocationParameterValue(
|
|
110
|
+
key: string,
|
|
111
|
+
): NavigationLocationParameterValue {
|
|
112
|
+
throw new UnsupportedOperationError(
|
|
113
|
+
`Navigator does not support this operation`,
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
getCurrentZone(): NavigationZone {
|
|
118
|
+
throw new UnsupportedOperationError(
|
|
119
|
+
`Navigator does not support this operation`,
|
|
120
|
+
);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
blockNavigation(
|
|
124
|
+
blockCheckers: (() => boolean)[],
|
|
125
|
+
onBlock?: ((onProceed: () => void) => void) | undefined,
|
|
126
|
+
onNativePlatformNavigationBlock?: (() => void) | undefined,
|
|
127
|
+
): void {
|
|
128
|
+
throw new UnsupportedOperationError(
|
|
129
|
+
`Navigator does not support this operation`,
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
unblockNavigation(): void {
|
|
134
|
+
throw new UnsupportedOperationError(
|
|
135
|
+
`Navigator does not support this operation`,
|
|
136
|
+
);
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
get isNavigationBlocked(): boolean {
|
|
140
|
+
throw new UnsupportedOperationError(
|
|
141
|
+
`Navigator does not support this operation`,
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
INTERNAL__internalizeTransientParameter(key: string): void {
|
|
146
|
+
throw new UnsupportedOperationError(
|
|
147
|
+
`Navigator does not support this operation`,
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
@@ -121,6 +121,14 @@ export interface ApplicationNavigator {
|
|
|
121
121
|
): void;
|
|
122
122
|
unblockNavigation(): void;
|
|
123
123
|
get isNavigationBlocked(): boolean;
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Remove a transient parameter, i.e. parameter that the application reads in and internalize
|
|
127
|
+
* as a state and then remove from the address as it's no longer needed and would dirty the address.
|
|
128
|
+
*
|
|
129
|
+
* NOTE: This is somewhat a non-standard and hacky behavior, please avoid using this unless you know what you are doing.
|
|
130
|
+
*/
|
|
131
|
+
INTERNAL__internalizeTransientParameter(key: string): void;
|
|
124
132
|
}
|
|
125
133
|
|
|
126
134
|
export class NavigationService {
|
|
@@ -14,16 +14,19 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import type {
|
|
17
|
+
import type { GenericLegendApplicationStore } from '../ApplicationStore.js';
|
|
18
|
+
import type { ApplicationNavigator } from '../navigation/NavigationService.js';
|
|
18
19
|
|
|
19
|
-
export
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
export abstract class ApplicationPlatform {
|
|
21
|
+
readonly applicationStore: GenericLegendApplicationStore;
|
|
22
|
+
|
|
23
|
+
constructor(applicationStore: GenericLegendApplicationStore) {
|
|
24
|
+
this.applicationStore = applicationStore;
|
|
25
|
+
}
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
):
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
27
|
+
abstract getNavigator(): ApplicationNavigator;
|
|
28
|
+
|
|
29
|
+
async initialize(): Promise<void> {
|
|
30
|
+
// do nothing
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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
|
+
|
|
17
|
+
import type { History } from 'history';
|
|
18
|
+
import { BrowserNavigator } from '../navigation/BrowserNavigator.js';
|
|
19
|
+
import { ApplicationPlatform } from './ApplicationPlatform.js';
|
|
20
|
+
import type { ApplicationNavigator } from '../navigation/NavigationService.js';
|
|
21
|
+
import type { GenericLegendApplicationStore } from '../ApplicationStore.js';
|
|
22
|
+
import { LEGEND_APPLICATION_PARAM_TOKEN } from '../../__lib__/LegendApplicationNavigation.js';
|
|
23
|
+
|
|
24
|
+
export class BrowserPlatform extends ApplicationPlatform {
|
|
25
|
+
readonly navigator: BrowserNavigator;
|
|
26
|
+
|
|
27
|
+
constructor(
|
|
28
|
+
applicationStore: GenericLegendApplicationStore,
|
|
29
|
+
config: { historyAPI: History },
|
|
30
|
+
) {
|
|
31
|
+
super(applicationStore);
|
|
32
|
+
this.navigator = new BrowserNavigator(config.historyAPI);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
getNavigator(): ApplicationNavigator {
|
|
36
|
+
return this.navigator;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
override async initialize(): Promise<void> {
|
|
40
|
+
// set initial color theme
|
|
41
|
+
// NOTE: we allow this to avoid the flash of default color theme
|
|
42
|
+
// when loading the page from another page/ when using the application in an iframe
|
|
43
|
+
const initialColorTheme =
|
|
44
|
+
this.applicationStore.navigationService.navigator.getCurrentLocationParameterValue(
|
|
45
|
+
LEGEND_APPLICATION_PARAM_TOKEN.INITIAL_COLOR_THEME,
|
|
46
|
+
);
|
|
47
|
+
if (initialColorTheme) {
|
|
48
|
+
this.applicationStore.layoutService.setColorTheme(initialColorTheme);
|
|
49
|
+
this.applicationStore.navigationService.navigator.INTERNAL__internalizeTransientParameter(
|
|
50
|
+
LEGEND_APPLICATION_PARAM_TOKEN.INITIAL_COLOR_THEME,
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|