@finos/legend-application 13.0.7 → 13.0.9
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/index.css +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/package.json +3 -3
- package/lib/stores/navigation/NavigationService.d.ts +34 -15
- package/lib/stores/navigation/NavigationService.d.ts.map +1 -1
- package/lib/stores/navigation/NavigationService.js +2 -0
- package/lib/stores/navigation/NavigationService.js.map +1 -1
- package/lib/stores/navigation/WebApplicationNavigator.d.ts +16 -11
- package/lib/stores/navigation/WebApplicationNavigator.d.ts.map +1 -1
- package/lib/stores/navigation/WebApplicationNavigator.js +20 -7
- package/lib/stores/navigation/WebApplicationNavigator.js.map +1 -1
- package/lib/stores/navigation/WebApplicationRouter.d.ts +4 -1
- package/lib/stores/navigation/WebApplicationRouter.d.ts.map +1 -1
- package/lib/stores/navigation/WebApplicationRouter.js +7 -1
- package/lib/stores/navigation/WebApplicationRouter.js.map +1 -1
- package/package.json +7 -7
- package/src/index.ts +6 -1
- package/src/stores/navigation/NavigationService.ts +41 -16
- package/src/stores/navigation/WebApplicationNavigator.ts +44 -24
- package/src/stores/navigation/WebApplicationRouter.ts +22 -1
package/lib/index.css
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export * from './components/ApplicationStoreProviderTestUtils.js';
|
|
|
31
31
|
export * from './components/WebApplicationNavigatorProviderTestUtils.js';
|
|
32
32
|
export * from './stores/ApplicationStore.js';
|
|
33
33
|
export { WebApplicationNavigator } from './stores/navigation/WebApplicationNavigator.js';
|
|
34
|
-
export { NavigationService } from './stores/navigation/NavigationService.js';
|
|
34
|
+
export { NavigationService, type NavigationAddress, type NavigationLocation, type NavigationZone, } from './stores/navigation/NavigationService.js';
|
|
35
35
|
export * from './stores/storage/ApplicationStorage.js';
|
|
36
36
|
export * from './stores/storage/StorageService.js';
|
|
37
37
|
export * from './stores/SettingService.js';
|
package/lib/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,YAAY,CAAC;AAE3B,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC;AACzD,cAAc,iDAAiD,CAAC;AAChE,cAAc,yCAAyC,CAAC;AACxD,cAAc,iDAAiD,CAAC;AAChE,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC;AAC1D,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AAEzF,cAAc,0CAA0C,CAAC;AACzD,cAAc,iDAAiD,CAAC;AAChE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,iDAAiD,CAAC;AAChE,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mDAAmD,CAAC;AAClE,cAAc,0DAA0D,CAAC;AAEzE,cAAc,8BAA8B,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AACzF,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,YAAY,CAAC;AAE3B,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC;AACzD,cAAc,iDAAiD,CAAC;AAChE,cAAc,yCAAyC,CAAC;AACxD,cAAc,iDAAiD,CAAC;AAChE,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC;AAC1D,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AAEzF,cAAc,0CAA0C,CAAC;AACzD,cAAc,iDAAiD,CAAC;AAChE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,iDAAiD,CAAC;AAChE,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mDAAmD,CAAC;AAClE,cAAc,0DAA0D,CAAC;AAEzE,cAAc,8BAA8B,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AACzF,OAAO,EACL,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,cAAc,GACpB,MAAM,0CAA0C,CAAC;AAClD,cAAc,wCAAwC,CAAC;AACvD,cAAc,oCAAoC,CAAC;AACnD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kCAAkC,CAAC;AACjD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6CAA6C,CAAC;AAC5D,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iCAAiC,CAAC;AAChD,cAAc,0BAA0B,CAAC;AACzC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,iDAAiD,CAAC;AAChE,cAAc,qCAAqC,CAAC;AACpD,cAAc,0CAA0C,CAAC;AAEzD,cAAc,uCAAuC,CAAC;AACtD,cAAc,6CAA6C,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAIpE,cAAc,0CAA0C,CAAC;AAEzD;;;GAGG;AACH,cAAc,2DAA2D,CAAC;AAC1E,cAAc,gCAAgC,CAAC;AAE/C,cAAc,wCAAwC,CAAC;AACvD,cAAc,sDAAsD,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACnF,cAAc,yDAAyD,CAAC;AACxE,cAAc,6CAA6C,CAAC;AAE5D,cAAc,mCAAmC,CAAC;AAClD,cAAc,qDAAqD,CAAC;AACpE,cAAc,oCAAoC,CAAC;AACnD,cAAc,kDAAkD,CAAC"}
|
package/lib/index.js
CHANGED
|
@@ -31,7 +31,7 @@ export * from './components/ApplicationStoreProviderTestUtils.js';
|
|
|
31
31
|
export * from './components/WebApplicationNavigatorProviderTestUtils.js';
|
|
32
32
|
export * from './stores/ApplicationStore.js';
|
|
33
33
|
export { WebApplicationNavigator } from './stores/navigation/WebApplicationNavigator.js';
|
|
34
|
-
export { NavigationService } from './stores/navigation/NavigationService.js';
|
|
34
|
+
export { NavigationService, } from './stores/navigation/NavigationService.js';
|
|
35
35
|
export * from './stores/storage/ApplicationStorage.js';
|
|
36
36
|
export * from './stores/storage/StorageService.js';
|
|
37
37
|
export * from './stores/SettingService.js';
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,YAAY,CAAC;AAE3B,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC;AACzD,cAAc,iDAAiD,CAAC;AAChE,cAAc,yCAAyC,CAAC;AACxD,cAAc,iDAAiD,CAAC;AAChE,cAAc,6CAA6C,CAAC;AAC5D,cAAc,2CAA2C,CAAC;AAC1D,OAAO,EAAE,8BAA8B,EAAE,MAAM,yCAAyC,CAAC;AAEzF,cAAc,0CAA0C,CAAC;AACzD,cAAc,iDAAiD,CAAC;AAChE,cAAc,6DAA6D,CAAC;AAC5E,cAAc,iDAAiD,CAAC;AAChE,cAAc,6BAA6B,CAAC;AAC5C,cAAc,mDAAmD,CAAC;AAClE,cAAc,0DAA0D,CAAC;AAEzE,cAAc,8BAA8B,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,gDAAgD,CAAC;AACzF,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,cAAc,YAAY,CAAC;AAE3B,cAAc,oCAAoC,CAAC;AACnD,cAAc,0CAA0C,CAAC;AACzD,cAAc,iDAAiD,CAAC;AAChE,cAAc,yCAAyC,CAAC;AACxD,cAAc,iDAAiD,CAAC;AAChE,cAAc,6C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pE,cAAc,oCAAoC,CAAC;AACnD,cAAc,kDAAkD,CAAC"}
|
package/lib/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finos/legend-application",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.9",
|
|
4
4
|
"description": "Legend application core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"legend",
|
|
@@ -47,13 +47,13 @@
|
|
|
47
47
|
"@finos/legend-graph": "workspace:*",
|
|
48
48
|
"@finos/legend-shared": "workspace:*",
|
|
49
49
|
"@types/css-font-loading-module": "0.0.8",
|
|
50
|
-
"@types/react": "18.0.
|
|
50
|
+
"@types/react": "18.0.33",
|
|
51
51
|
"@types/react-dom": "18.0.11",
|
|
52
52
|
"@types/react-router-dom": "5.3.3",
|
|
53
53
|
"history": "5.3.0",
|
|
54
54
|
"mobx": "6.9.0",
|
|
55
55
|
"mobx-react-lite": "3.4.3",
|
|
56
|
-
"monaco-editor": "0.
|
|
56
|
+
"monaco-editor": "0.37.1",
|
|
57
57
|
"react": "18.2.0",
|
|
58
58
|
"react-dnd": "16.0.1",
|
|
59
59
|
"react-dnd-html5-backend": "16.0.1",
|
|
@@ -13,10 +13,12 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
export type
|
|
17
|
-
export type
|
|
18
|
-
export type
|
|
19
|
-
export type
|
|
16
|
+
export type NavigationAddress = string;
|
|
17
|
+
export type NavigationLocationParameterValue = string | undefined;
|
|
18
|
+
export type NavigationLocation = string;
|
|
19
|
+
export type NavigationZone = string;
|
|
20
|
+
export declare const NAVIGATION_ZONE_SEPARATOR = "__";
|
|
21
|
+
export declare const NAVIGATION_ZONE_PREFIX = "#";
|
|
20
22
|
/**
|
|
21
23
|
* This is an initial attempt to generalize the application navigation to other platforms
|
|
22
24
|
*
|
|
@@ -46,33 +48,50 @@ export interface ApplicationNavigator {
|
|
|
46
48
|
* so application states will not be preserved
|
|
47
49
|
* after navigation
|
|
48
50
|
*/
|
|
49
|
-
goToLocation(location:
|
|
51
|
+
goToLocation(location: NavigationLocation, options?: {
|
|
50
52
|
ignoreBlocking?: boolean | undefined;
|
|
51
53
|
}): void;
|
|
52
54
|
/**
|
|
53
55
|
* Visit the specified address
|
|
54
56
|
*/
|
|
55
|
-
goToAddress(address:
|
|
57
|
+
goToAddress(address: NavigationAddress, options?: {
|
|
56
58
|
ignoreBlocking?: boolean | undefined;
|
|
57
59
|
}): void;
|
|
58
60
|
/**
|
|
59
61
|
* Visit the specified address in a new window
|
|
60
62
|
*/
|
|
61
|
-
visitAddress(address:
|
|
63
|
+
visitAddress(address: NavigationAddress): void;
|
|
64
|
+
/**
|
|
65
|
+
* Generate the address from the current base address and the specified location
|
|
66
|
+
*/
|
|
67
|
+
generateAddress(location: NavigationLocation): NavigationAddress;
|
|
62
68
|
/**
|
|
63
69
|
* Update the current location
|
|
64
70
|
*
|
|
65
71
|
* NOTE: any navigation actions: reload, go to address, go to location, etc.
|
|
66
72
|
* explicitly updates the current location, this action will just update the
|
|
67
|
-
* location without doing any navigation
|
|
73
|
+
* location without doing any navigation.
|
|
74
|
+
*
|
|
75
|
+
* NOTE: we need to reset zone when changing location
|
|
76
|
+
*/
|
|
77
|
+
updateCurrentLocation(location: NavigationLocation): void;
|
|
78
|
+
/**
|
|
79
|
+
* Update the current zone
|
|
80
|
+
*
|
|
81
|
+
* Changing the address and location might potentially already included changing
|
|
82
|
+
* the zone, this action will just update the zone.
|
|
83
|
+
*/
|
|
84
|
+
updateCurrentZone(zone: NavigationZone): void;
|
|
85
|
+
resetZone(): void;
|
|
86
|
+
/**
|
|
87
|
+
* Get the current address base
|
|
68
88
|
*/
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
generateAddress(location: Location): Address;
|
|
89
|
+
getCurrentBaseAddress(): NavigationAddress;
|
|
90
|
+
getCurrentAddress(): NavigationAddress;
|
|
91
|
+
getCurrentLocation(): NavigationLocation;
|
|
92
|
+
getCurrentLocationParameters<T extends Record<string, NavigationLocationParameterValue>>(): T;
|
|
93
|
+
getCurrentLocationParameterValue(key: string): NavigationLocationParameterValue;
|
|
94
|
+
getCurrentZone(): NavigationZone;
|
|
76
95
|
/**
|
|
77
96
|
* Block all kinds of navigation, including going to another location,
|
|
78
97
|
* changing address, and native platform navigation (e.g. in web browser, we will
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationService.d.ts","sourceRoot":"","sources":["../../../src/stores/navigation/NavigationService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"NavigationService.d.ts","sourceRoot":"","sources":["../../../src/stores/navigation/NavigationService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC;AACvC,MAAM,MAAM,gCAAgC,GAAG,MAAM,GAAG,SAAS,CAAC;AAClE,MAAM,MAAM,kBAAkB,GAAG,MAAM,CAAC;AACxC,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC;AAEpC,eAAO,MAAM,yBAAyB,OAAO,CAAC;AAC9C,eAAO,MAAM,sBAAsB,MAAM,CAAC;AAE1C;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;KAAE,GAAG,IAAI,CAAC;IAEjE;;;;;;OAMG;IACH,YAAY,CACV,QAAQ,EAAE,kBAAkB,EAC5B,OAAO,CAAC,EAAE;QAAE,cAAc,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;KAAE,GACjD,IAAI,CAAC;IAER;;OAEG;IACH,WAAW,CACT,OAAO,EAAE,iBAAiB,EAC1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
15
|
*/
|
|
16
|
+
export const NAVIGATION_ZONE_SEPARATOR = '__';
|
|
17
|
+
export const NAVIGATION_ZONE_PREFIX = '#';
|
|
16
18
|
export class NavigationService {
|
|
17
19
|
navigator;
|
|
18
20
|
constructor(navigator) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NavigationService.js","sourceRoot":"","sources":["../../../src/stores/navigation/NavigationService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;
|
|
1
|
+
{"version":3,"file":"NavigationService.js","sourceRoot":"","sources":["../../../src/stores/navigation/NavigationService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,MAAM,CAAC,MAAM,yBAAyB,GAAG,IAAI,CAAC;AAC9C,MAAM,CAAC,MAAM,sBAAsB,GAAG,GAAG,CAAC;AAuG1C,MAAM,OAAO,iBAAiB;IACnB,SAAS,CAAuB;IAEzC,YAAY,SAA+B;QACzC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;IAC7B,CAAC;CACF"}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { History } from 'history';
|
|
17
|
-
import type
|
|
17
|
+
import { type NavigationAddress, type NavigationLocation, type ApplicationNavigator, type NavigationLocationParameterValue, type NavigationZone } from './NavigationService.js';
|
|
18
18
|
export declare class WebApplicationNavigator implements ApplicationNavigator {
|
|
19
19
|
private readonly historyAPI;
|
|
20
20
|
private _isNavigationBlocked;
|
|
@@ -25,23 +25,28 @@ export declare class WebApplicationNavigator implements ApplicationNavigator {
|
|
|
25
25
|
onNativePlatformNavigationBlock?: (() => void) | undefined;
|
|
26
26
|
constructor(historyApiClient: History);
|
|
27
27
|
private get window();
|
|
28
|
-
goToLocation(location:
|
|
28
|
+
goToLocation(location: NavigationLocation, options?: {
|
|
29
29
|
ignoreBlocking?: boolean | undefined;
|
|
30
30
|
}): void;
|
|
31
31
|
reload(options?: {
|
|
32
32
|
ignoreBlocking?: boolean | undefined;
|
|
33
33
|
}): void;
|
|
34
|
-
goToAddress(address:
|
|
34
|
+
goToAddress(address: NavigationAddress, options?: {
|
|
35
35
|
ignoreBlocking?: boolean | undefined;
|
|
36
36
|
}): void;
|
|
37
|
-
visitAddress(address:
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
37
|
+
visitAddress(address: NavigationAddress): void;
|
|
38
|
+
generateAddress(location: NavigationLocation): string;
|
|
39
|
+
updateCurrentLocation(location: NavigationLocation): void;
|
|
40
|
+
updateCurrentZone(zone: NavigationZone): void;
|
|
41
|
+
resetZone(): void;
|
|
42
|
+
getCurrentBaseAddress(options?: {
|
|
43
|
+
withAppRoot?: boolean | undefined;
|
|
44
|
+
}): NavigationAddress;
|
|
45
|
+
getCurrentAddress(): NavigationAddress;
|
|
46
|
+
getCurrentLocation(): NavigationLocation;
|
|
47
|
+
getCurrentLocationParameters<T extends Record<string, NavigationLocationParameterValue>>(): T;
|
|
48
|
+
getCurrentLocationParameterValue(key: string): NavigationLocationParameterValue;
|
|
49
|
+
getCurrentZone(): NavigationZone;
|
|
45
50
|
blockNavigation(blockCheckers: (() => boolean)[], onBlock?: ((onProceed: () => void) => void) | undefined, onNativePlatformNavigationBlock?: (() => void) | undefined): void;
|
|
46
51
|
unblockNavigation(): void;
|
|
47
52
|
get isNavigationBlocked(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebApplicationNavigator.d.ts","sourceRoot":"","sources":["../../../src/stores/navigation/WebApplicationNavigator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAQvC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"WebApplicationNavigator.d.ts","sourceRoot":"","sources":["../../../src/stores/navigation/WebApplicationNavigator.ts"],"names":[],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AAG,IAAI;IAI7C,SAAS,IAAI,IAAI;IAIjB,qBAAqB,CAAC,OAAO,CAAC,EAAE;QAC9B,WAAW,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;KACnC,GAAG,iBAAiB;IAOrB,iBAAiB,IAAI,iBAAiB;IAItC,kBAAkB,IAAI,kBAAkB;IAIxC,4BAA4B,CAC1B,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,gCAAgC,CAAC,KACvD,CAAC;IAWN,gCAAgC,CAC9B,GAAG,EAAE,MAAM,GACV,gCAAgC;IAInC,cAAc,IAAI,cAAc;IAIhC,eAAe,CACb,aAAa,EAAE,CAAC,MAAM,OAAO,CAAC,EAAE,EAChC,OAAO,CAAC,EAAE,CAAC,CAAC,SAAS,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC,GAAG,SAAS,EACvD,+BAA+B,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,GACzD,IAAI;IAuBP,iBAAiB,IAAI,IAAI;IAQzB,IAAI,mBAAmB,IAAI,OAAO,CAEjC;CACF"}
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { getQueryParameterValue, getQueryParameters, guaranteeNonNullable, sanitizeURL, } from '@finos/legend-shared';
|
|
17
17
|
import { action, computed, makeObservable, observable } from 'mobx';
|
|
18
|
+
import { NAVIGATION_ZONE_PREFIX, } from './NavigationService.js';
|
|
18
19
|
export class WebApplicationNavigator {
|
|
19
20
|
historyAPI;
|
|
20
21
|
_isNavigationBlocked = false;
|
|
@@ -95,10 +96,23 @@ export class WebApplicationNavigator {
|
|
|
95
96
|
visitAddress(address) {
|
|
96
97
|
this.window.open(address, '_blank');
|
|
97
98
|
}
|
|
99
|
+
generateAddress(location) {
|
|
100
|
+
return (this.window.location.origin +
|
|
101
|
+
this.historyAPI.createHref({ pathname: location }));
|
|
102
|
+
}
|
|
98
103
|
updateCurrentLocation(location) {
|
|
99
104
|
this.historyAPI.push(location);
|
|
100
105
|
}
|
|
101
|
-
|
|
106
|
+
updateCurrentZone(zone) {
|
|
107
|
+
this.window.location.hash = NAVIGATION_ZONE_PREFIX + zone;
|
|
108
|
+
}
|
|
109
|
+
resetZone() {
|
|
110
|
+
this.updateCurrentLocation(this.getCurrentLocation());
|
|
111
|
+
}
|
|
112
|
+
getCurrentBaseAddress(options) {
|
|
113
|
+
if (options?.withAppRoot) {
|
|
114
|
+
return this.generateAddress('');
|
|
115
|
+
}
|
|
102
116
|
return this.window.location.origin;
|
|
103
117
|
}
|
|
104
118
|
getCurrentAddress() {
|
|
@@ -107,7 +121,7 @@ export class WebApplicationNavigator {
|
|
|
107
121
|
getCurrentLocation() {
|
|
108
122
|
return this.historyAPI.location.pathname;
|
|
109
123
|
}
|
|
110
|
-
|
|
124
|
+
getCurrentLocationParameters() {
|
|
111
125
|
const result = {};
|
|
112
126
|
const parameters = getQueryParameters(sanitizeURL(this.getCurrentAddress()), true);
|
|
113
127
|
Object.keys(parameters).forEach((key) => {
|
|
@@ -115,12 +129,11 @@ export class WebApplicationNavigator {
|
|
|
115
129
|
});
|
|
116
130
|
return result;
|
|
117
131
|
}
|
|
118
|
-
|
|
119
|
-
return this.
|
|
132
|
+
getCurrentLocationParameterValue(key) {
|
|
133
|
+
return this.getCurrentLocationParameters()[key];
|
|
120
134
|
}
|
|
121
|
-
|
|
122
|
-
return
|
|
123
|
-
this.historyAPI.createHref({ pathname: location }));
|
|
135
|
+
getCurrentZone() {
|
|
136
|
+
return this.window.location.hash.substring(NAVIGATION_ZONE_PREFIX.length);
|
|
124
137
|
}
|
|
125
138
|
blockNavigation(blockCheckers, onBlock, onNativePlatformNavigationBlock) {
|
|
126
139
|
this._isNavigationBlocked = true;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebApplicationNavigator.js","sourceRoot":"","sources":["../../../src/stores/navigation/WebApplicationNavigator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"WebApplicationNavigator.js","sourceRoot":"","sources":["../../../src/stores/navigation/WebApplicationNavigator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAGH,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,oBAAoB,EACpB,WAAW,GACZ,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACpE,OAAO,EAML,sBAAsB,GACvB,MAAM,wBAAwB,CAAC;AAEhC,MAAM,OAAO,uBAAuB;IACjB,UAAU,CAAU;IAC7B,oBAAoB,GAAG,KAAK,CAAC;IAC7B,8BAA8B,GAAG,KAAK,CAAC;IACvC,cAAc,GAAsB,EAAE,CAAC;IACvC,qBAAqB,GAAG,CAAC,KAAwB,EAAQ,EAAE;QACjE,IAAI,IAAI,CAAC,8BAA8B,EAAE;YACvC,OAAO;SACR;QACD,IAAI,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,EAAE,CAAC,EAAE;YACpD,4HAA4H;YAC5H,gHAAgH;YAChH,KAAK,CAAC,WAAW,GAAG,EAAE,CAAC;SACxB;IACH,CAAC,CAAC;IAEF,OAAO,CAAiD;IACxD,+BAA+B,CAA4B;IAE3D,YAAY,gBAAyB;QACnC,cAAc,CAAkD,IAAI,EAAE;YACpE,oBAAoB,EAAE,UAAU;YAChC,mBAAmB,EAAE,QAAQ;YAC7B,eAAe,EAAE,MAAM;YACvB,iBAAiB,EAAE,MAAM;SAC1B,CAAC,CAAC;QAEH,IAAI,CAAC,UAAU,GAAG,gBAAgB,CAAC;IACrC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AA0G;QAC1G,iGAAiG;QACjG,iFAAiF;QACjF,IAAI,CAAC,MAAM,CAAC,UAAU,GAAG,GAAG,EAAE;YAC5B,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;YACzB,IAAI,CAAC,+BAA+B,EAAE,EAAE,CAAC;QAC3C,CAAC,CAAC;QAEF,8EAA8E;QAC9E,IAAI,CAAC,cAAc,GAAG,aAAa,CAAC;QACpC,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,cAAc,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;QAC5E,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,cAAc,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;IAC3E,CAAC;IAED,iBAAiB;QACf,IAAI,CAAC,oBAAoB,GAAG,KAAK,CAAC;QAClC,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC;QACzB,IAAI,CAAC,MAAM,CAAC,UAAU,GAAG,IAAI,CAAC;QAC9B,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC;QACzB,IAAI,CAAC,MAAM,CAAC,mBAAmB,CAAC,cAAc,EAAE,IAAI,CAAC,qBAAqB,CAAC,CAAC;IAC9E,CAAC;IAED,IAAI,mBAAmB;QACrB,OAAO,IAAI,CAAC,oBAAoB,CAAC;IACnC,CAAC;CACF"}
|
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { Router, Route, Switch, Redirect, matchPath, generatePath, MemoryRouter, useParams } from 'react-router';
|
|
17
|
+
import { type NavigationZone } from './NavigationService.js';
|
|
16
18
|
export { BrowserRouter } from 'react-router-dom';
|
|
17
|
-
export { Router, Route, Switch, Redirect, useParams, matchPath, generatePath, MemoryRouter, }
|
|
19
|
+
export { Router, Route, Switch, Redirect, useParams, matchPath, generatePath, MemoryRouter, };
|
|
18
20
|
export { createMemoryHistory } from 'history';
|
|
21
|
+
export declare const useNavigationZone: () => NavigationZone;
|
|
19
22
|
//# sourceMappingURL=WebApplicationRouter.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebApplicationRouter.d.ts","sourceRoot":"","sources":["../../../src/stores/navigation/WebApplicationRouter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EACL,MAAM,EACN,KAAK,EACL,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,YAAY,EACZ,YAAY,GACb,
|
|
1
|
+
{"version":3,"file":"WebApplicationRouter.d.ts","sourceRoot":"","sources":["../../../src/stores/navigation/WebApplicationRouter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,MAAM,EACN,KAAK,EACL,MAAM,EACN,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,SAAS,EAEV,MAAM,cAAc,CAAC;AACtB,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EACL,MAAM,EACN,KAAK,EACL,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,YAAY,EACZ,YAAY,GACb,CAAC;AACF,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C,eAAO,MAAM,iBAAiB,QAAO,cAGpC,CAAC"}
|
|
@@ -13,7 +13,13 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { Router, Route, Switch, Redirect, matchPath, generatePath, MemoryRouter, useParams, useLocation, } from 'react-router';
|
|
17
|
+
import { NAVIGATION_ZONE_PREFIX, } from './NavigationService.js';
|
|
16
18
|
export { BrowserRouter } from 'react-router-dom';
|
|
17
|
-
export { Router, Route, Switch, Redirect, useParams, matchPath, generatePath, MemoryRouter, }
|
|
19
|
+
export { Router, Route, Switch, Redirect, useParams, matchPath, generatePath, MemoryRouter, };
|
|
18
20
|
export { createMemoryHistory } from 'history';
|
|
21
|
+
export const useNavigationZone = () => {
|
|
22
|
+
const location = useLocation(); // TODO: this is a temporary hack until we upgrade react-router
|
|
23
|
+
return location.hash.substring(NAVIGATION_ZONE_PREFIX.length);
|
|
24
|
+
};
|
|
19
25
|
//# sourceMappingURL=WebApplicationRouter.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WebApplicationRouter.js","sourceRoot":"","sources":["../../../src/stores/navigation/WebApplicationRouter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EACL,MAAM,EACN,KAAK,EACL,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,YAAY,EACZ,YAAY,GACb,
|
|
1
|
+
{"version":3,"file":"WebApplicationRouter.js","sourceRoot":"","sources":["../../../src/stores/navigation/WebApplicationRouter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,MAAM,EACN,KAAK,EACL,MAAM,EACN,QAAQ,EACR,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,WAAW,GACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,sBAAsB,GAEvB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EACL,MAAM,EACN,KAAK,EACL,MAAM,EACN,QAAQ,EACR,SAAS,EACT,SAAS,EACT,YAAY,EACZ,YAAY,GACb,CAAC;AACF,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAE9C,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAmB,EAAE;IACpD,MAAM,QAAQ,GAAG,WAAW,EAAsB,CAAC,CAAC,+DAA+D;IACnH,OAAO,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,sBAAsB,CAAC,MAAM,CAAC,CAAC;AAChE,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@finos/legend-application",
|
|
3
|
-
"version": "13.0.
|
|
3
|
+
"version": "13.0.9",
|
|
4
4
|
"description": "Legend application core",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"legend",
|
|
@@ -43,17 +43,17 @@
|
|
|
43
43
|
"test:watch": "jest --watch"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@finos/legend-art": "5.0.
|
|
47
|
-
"@finos/legend-graph": "26.0.
|
|
48
|
-
"@finos/legend-shared": "8.0.
|
|
46
|
+
"@finos/legend-art": "5.0.42",
|
|
47
|
+
"@finos/legend-graph": "26.0.2",
|
|
48
|
+
"@finos/legend-shared": "8.0.5",
|
|
49
49
|
"@types/css-font-loading-module": "0.0.8",
|
|
50
|
-
"@types/react": "18.0.
|
|
50
|
+
"@types/react": "18.0.33",
|
|
51
51
|
"@types/react-dom": "18.0.11",
|
|
52
52
|
"@types/react-router-dom": "5.3.3",
|
|
53
53
|
"history": "5.3.0",
|
|
54
54
|
"mobx": "6.9.0",
|
|
55
55
|
"mobx-react-lite": "3.4.3",
|
|
56
|
-
"monaco-editor": "0.
|
|
56
|
+
"monaco-editor": "0.37.1",
|
|
57
57
|
"react": "18.2.0",
|
|
58
58
|
"react-dnd": "16.0.1",
|
|
59
59
|
"react-dnd-html5-backend": "16.0.1",
|
|
@@ -71,7 +71,7 @@
|
|
|
71
71
|
"xterm-addon-webgl": "0.14.0"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"@finos/legend-dev-utils": "2.0.
|
|
74
|
+
"@finos/legend-dev-utils": "2.0.51",
|
|
75
75
|
"@jest/globals": "29.5.0",
|
|
76
76
|
"cross-env": "7.0.3",
|
|
77
77
|
"eslint": "8.37.0",
|
package/src/index.ts
CHANGED
|
@@ -35,7 +35,12 @@ export * from './components/WebApplicationNavigatorProviderTestUtils.js';
|
|
|
35
35
|
|
|
36
36
|
export * from './stores/ApplicationStore.js';
|
|
37
37
|
export { WebApplicationNavigator } from './stores/navigation/WebApplicationNavigator.js';
|
|
38
|
-
export {
|
|
38
|
+
export {
|
|
39
|
+
NavigationService,
|
|
40
|
+
type NavigationAddress,
|
|
41
|
+
type NavigationLocation,
|
|
42
|
+
type NavigationZone,
|
|
43
|
+
} from './stores/navigation/NavigationService.js';
|
|
39
44
|
export * from './stores/storage/ApplicationStorage.js';
|
|
40
45
|
export * from './stores/storage/StorageService.js';
|
|
41
46
|
export * from './stores/SettingService.js';
|
|
@@ -14,10 +14,13 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
export type
|
|
18
|
-
export type
|
|
19
|
-
export type
|
|
20
|
-
export type
|
|
17
|
+
export type NavigationAddress = string;
|
|
18
|
+
export type NavigationLocationParameterValue = string | undefined;
|
|
19
|
+
export type NavigationLocation = string;
|
|
20
|
+
export type NavigationZone = string;
|
|
21
|
+
|
|
22
|
+
export const NAVIGATION_ZONE_SEPARATOR = '__';
|
|
23
|
+
export const NAVIGATION_ZONE_PREFIX = '#';
|
|
21
24
|
|
|
22
25
|
/**
|
|
23
26
|
* This is an initial attempt to generalize the application navigation to other platforms
|
|
@@ -48,7 +51,7 @@ export interface ApplicationNavigator {
|
|
|
48
51
|
* after navigation
|
|
49
52
|
*/
|
|
50
53
|
goToLocation(
|
|
51
|
-
location:
|
|
54
|
+
location: NavigationLocation,
|
|
52
55
|
options?: { ignoreBlocking?: boolean | undefined },
|
|
53
56
|
): void;
|
|
54
57
|
|
|
@@ -56,33 +59,55 @@ export interface ApplicationNavigator {
|
|
|
56
59
|
* Visit the specified address
|
|
57
60
|
*/
|
|
58
61
|
goToAddress(
|
|
59
|
-
address:
|
|
62
|
+
address: NavigationAddress,
|
|
60
63
|
options?: { ignoreBlocking?: boolean | undefined },
|
|
61
64
|
): void;
|
|
62
65
|
|
|
63
66
|
/**
|
|
64
67
|
* Visit the specified address in a new window
|
|
65
68
|
*/
|
|
66
|
-
visitAddress(address:
|
|
69
|
+
visitAddress(address: NavigationAddress): void;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Generate the address from the current base address and the specified location
|
|
73
|
+
*/
|
|
74
|
+
generateAddress(location: NavigationLocation): NavigationAddress;
|
|
67
75
|
|
|
68
76
|
/**
|
|
69
77
|
* Update the current location
|
|
70
78
|
*
|
|
71
79
|
* NOTE: any navigation actions: reload, go to address, go to location, etc.
|
|
72
80
|
* explicitly updates the current location, this action will just update the
|
|
73
|
-
* location without doing any navigation
|
|
81
|
+
* location without doing any navigation.
|
|
82
|
+
*
|
|
83
|
+
* NOTE: we need to reset zone when changing location
|
|
84
|
+
*/
|
|
85
|
+
updateCurrentLocation(location: NavigationLocation): void;
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* Update the current zone
|
|
89
|
+
*
|
|
90
|
+
* Changing the address and location might potentially already included changing
|
|
91
|
+
* the zone, this action will just update the zone.
|
|
92
|
+
*/
|
|
93
|
+
updateCurrentZone(zone: NavigationZone): void;
|
|
94
|
+
resetZone(): void;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Get the current address base
|
|
74
98
|
*/
|
|
75
|
-
|
|
99
|
+
getCurrentBaseAddress(): NavigationAddress;
|
|
100
|
+
getCurrentAddress(): NavigationAddress;
|
|
76
101
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
getAddressParameters<
|
|
81
|
-
T extends Record<AddressParameterKey, AddressParameterValue>,
|
|
102
|
+
getCurrentLocation(): NavigationLocation;
|
|
103
|
+
getCurrentLocationParameters<
|
|
104
|
+
T extends Record<string, NavigationLocationParameterValue>,
|
|
82
105
|
>(): T;
|
|
83
|
-
|
|
106
|
+
getCurrentLocationParameterValue(
|
|
107
|
+
key: string,
|
|
108
|
+
): NavigationLocationParameterValue;
|
|
84
109
|
|
|
85
|
-
|
|
110
|
+
getCurrentZone(): NavigationZone;
|
|
86
111
|
|
|
87
112
|
/**
|
|
88
113
|
* Block all kinds of navigation, including going to another location,
|
|
@@ -22,12 +22,13 @@ import {
|
|
|
22
22
|
sanitizeURL,
|
|
23
23
|
} from '@finos/legend-shared';
|
|
24
24
|
import { action, computed, makeObservable, observable } from 'mobx';
|
|
25
|
-
import
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
ApplicationNavigator,
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
import {
|
|
26
|
+
type NavigationAddress,
|
|
27
|
+
type NavigationLocation,
|
|
28
|
+
type ApplicationNavigator,
|
|
29
|
+
type NavigationLocationParameterValue,
|
|
30
|
+
type NavigationZone,
|
|
31
|
+
NAVIGATION_ZONE_PREFIX,
|
|
31
32
|
} from './NavigationService.js';
|
|
32
33
|
|
|
33
34
|
export class WebApplicationNavigator implements ApplicationNavigator {
|
|
@@ -68,7 +69,7 @@ export class WebApplicationNavigator implements ApplicationNavigator {
|
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
goToLocation(
|
|
71
|
-
location:
|
|
72
|
+
location: NavigationLocation,
|
|
72
73
|
options?: { ignoreBlocking?: boolean | undefined },
|
|
73
74
|
): void {
|
|
74
75
|
if (options?.ignoreBlocking) {
|
|
@@ -107,7 +108,7 @@ export class WebApplicationNavigator implements ApplicationNavigator {
|
|
|
107
108
|
}
|
|
108
109
|
|
|
109
110
|
goToAddress(
|
|
110
|
-
address:
|
|
111
|
+
address: NavigationAddress,
|
|
111
112
|
options?: { ignoreBlocking?: boolean | undefined },
|
|
112
113
|
): void {
|
|
113
114
|
if (options?.ignoreBlocking) {
|
|
@@ -127,32 +128,52 @@ export class WebApplicationNavigator implements ApplicationNavigator {
|
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
130
|
|
|
130
|
-
visitAddress(address:
|
|
131
|
+
visitAddress(address: NavigationAddress): void {
|
|
131
132
|
this.window.open(address, '_blank');
|
|
132
133
|
}
|
|
133
134
|
|
|
134
|
-
|
|
135
|
+
generateAddress(location: NavigationLocation): string {
|
|
136
|
+
return (
|
|
137
|
+
this.window.location.origin +
|
|
138
|
+
this.historyAPI.createHref({ pathname: location })
|
|
139
|
+
);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
updateCurrentLocation(location: NavigationLocation): void {
|
|
135
143
|
this.historyAPI.push(location);
|
|
136
144
|
}
|
|
137
145
|
|
|
138
|
-
|
|
146
|
+
updateCurrentZone(zone: NavigationZone): void {
|
|
147
|
+
this.window.location.hash = NAVIGATION_ZONE_PREFIX + zone;
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
resetZone(): void {
|
|
151
|
+
this.updateCurrentLocation(this.getCurrentLocation());
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
getCurrentBaseAddress(options?: {
|
|
155
|
+
withAppRoot?: boolean | undefined;
|
|
156
|
+
}): NavigationAddress {
|
|
157
|
+
if (options?.withAppRoot) {
|
|
158
|
+
return this.generateAddress('');
|
|
159
|
+
}
|
|
139
160
|
return this.window.location.origin;
|
|
140
161
|
}
|
|
141
162
|
|
|
142
|
-
getCurrentAddress():
|
|
163
|
+
getCurrentAddress(): NavigationAddress {
|
|
143
164
|
return this.window.location.href;
|
|
144
165
|
}
|
|
145
166
|
|
|
146
|
-
getCurrentLocation():
|
|
167
|
+
getCurrentLocation(): NavigationLocation {
|
|
147
168
|
return this.historyAPI.location.pathname;
|
|
148
169
|
}
|
|
149
170
|
|
|
150
|
-
|
|
151
|
-
T extends Record<
|
|
171
|
+
getCurrentLocationParameters<
|
|
172
|
+
T extends Record<string, NavigationLocationParameterValue>,
|
|
152
173
|
>(): T {
|
|
153
|
-
const result: Record<
|
|
174
|
+
const result: Record<string, NavigationLocationParameterValue> = {};
|
|
154
175
|
const parameters = getQueryParameters<
|
|
155
|
-
Record<
|
|
176
|
+
Record<string, NavigationLocationParameterValue>
|
|
156
177
|
>(sanitizeURL(this.getCurrentAddress()), true);
|
|
157
178
|
Object.keys(parameters).forEach((key) => {
|
|
158
179
|
result[key] = getQueryParameterValue(key, parameters);
|
|
@@ -160,15 +181,14 @@ export class WebApplicationNavigator implements ApplicationNavigator {
|
|
|
160
181
|
return result as T;
|
|
161
182
|
}
|
|
162
183
|
|
|
163
|
-
|
|
164
|
-
|
|
184
|
+
getCurrentLocationParameterValue(
|
|
185
|
+
key: string,
|
|
186
|
+
): NavigationLocationParameterValue {
|
|
187
|
+
return this.getCurrentLocationParameters()[key];
|
|
165
188
|
}
|
|
166
189
|
|
|
167
|
-
|
|
168
|
-
return (
|
|
169
|
-
this.window.location.origin +
|
|
170
|
-
this.historyAPI.createHref({ pathname: location })
|
|
171
|
-
);
|
|
190
|
+
getCurrentZone(): NavigationZone {
|
|
191
|
+
return this.window.location.hash.substring(NAVIGATION_ZONE_PREFIX.length);
|
|
172
192
|
}
|
|
173
193
|
|
|
174
194
|
blockNavigation(
|
|
@@ -14,6 +14,22 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
+
import {
|
|
18
|
+
Router,
|
|
19
|
+
Route,
|
|
20
|
+
Switch,
|
|
21
|
+
Redirect,
|
|
22
|
+
matchPath,
|
|
23
|
+
generatePath,
|
|
24
|
+
MemoryRouter,
|
|
25
|
+
useParams,
|
|
26
|
+
useLocation,
|
|
27
|
+
} from 'react-router';
|
|
28
|
+
import {
|
|
29
|
+
NAVIGATION_ZONE_PREFIX,
|
|
30
|
+
type NavigationZone,
|
|
31
|
+
} from './NavigationService.js';
|
|
32
|
+
|
|
17
33
|
export { BrowserRouter } from 'react-router-dom';
|
|
18
34
|
export {
|
|
19
35
|
Router,
|
|
@@ -24,5 +40,10 @@ export {
|
|
|
24
40
|
matchPath,
|
|
25
41
|
generatePath,
|
|
26
42
|
MemoryRouter,
|
|
27
|
-
}
|
|
43
|
+
};
|
|
28
44
|
export { createMemoryHistory } from 'history';
|
|
45
|
+
|
|
46
|
+
export const useNavigationZone = (): NavigationZone => {
|
|
47
|
+
const location = useLocation() as { hash: string }; // TODO: this is a temporary hack until we upgrade react-router
|
|
48
|
+
return location.hash.substring(NAVIGATION_ZONE_PREFIX.length);
|
|
49
|
+
};
|