@etsoo/react 1.5.7 → 1.5.11
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/app/ReactApp.d.ts +13 -0
- package/lib/app/ReactApp.js +24 -1
- package/lib/app/ServiceApp.d.ts +6 -0
- package/lib/app/ServiceApp.js +8 -0
- package/lib/app/Utils.d.ts +2 -1
- package/lib/app/Utils.js +3 -2
- package/package.json +2 -2
- package/src/app/ReactApp.ts +26 -1
- package/src/app/ServiceApp.ts +9 -0
- package/src/app/Utils.ts +3 -2
package/lib/app/ReactApp.d.ts
CHANGED
|
@@ -108,6 +108,19 @@ export declare class ReactApp<S extends IAppSettings, D extends IUser, P extends
|
|
|
108
108
|
* @param name Application name
|
|
109
109
|
*/
|
|
110
110
|
constructor(settings: S, name: string);
|
|
111
|
+
/**
|
|
112
|
+
* Get parsed Url under bridge host
|
|
113
|
+
* @param url Url
|
|
114
|
+
* @returns Parsed Url
|
|
115
|
+
*/
|
|
116
|
+
protected getHostUrl(url: string): string;
|
|
117
|
+
/**
|
|
118
|
+
* Get parsed Url under bridge host
|
|
119
|
+
* @param url Url
|
|
120
|
+
* @param name App name in the host environment
|
|
121
|
+
* @returns Parsed Url
|
|
122
|
+
*/
|
|
123
|
+
protected getHostUrlBase(url: string, name: string): string;
|
|
111
124
|
/**
|
|
112
125
|
* Override alert action result
|
|
113
126
|
* @param result Action result
|
package/lib/app/ReactApp.js
CHANGED
|
@@ -67,7 +67,7 @@ export class ReactApp extends CoreApp {
|
|
|
67
67
|
this.userState = new UserState();
|
|
68
68
|
this.history =
|
|
69
69
|
window.location.hostname === ''
|
|
70
|
-
? Utils.getMemoryHistory()
|
|
70
|
+
? Utils.getMemoryHistory(this.getHostUrl(window.location.href))
|
|
71
71
|
: undefined;
|
|
72
72
|
this.cultureState = new CultureState(settings.currentCulture);
|
|
73
73
|
this.pageState = new PageState();
|
|
@@ -91,6 +91,29 @@ export class ReactApp extends CoreApp {
|
|
|
91
91
|
ReactApp._notifierProvider = NotifierMU.setup();
|
|
92
92
|
return NotifierMU.instance;
|
|
93
93
|
}
|
|
94
|
+
/**
|
|
95
|
+
* Get parsed Url under bridge host
|
|
96
|
+
* @param url Url
|
|
97
|
+
* @returns Parsed Url
|
|
98
|
+
*/
|
|
99
|
+
getHostUrl(url) {
|
|
100
|
+
return this.getHostUrlBase(url, 'core');
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Get parsed Url under bridge host
|
|
104
|
+
* @param url Url
|
|
105
|
+
* @param name App name in the host environment
|
|
106
|
+
* @returns Parsed Url
|
|
107
|
+
*/
|
|
108
|
+
getHostUrlBase(url, name) {
|
|
109
|
+
if (url.startsWith('/'))
|
|
110
|
+
return url;
|
|
111
|
+
const identifier = `/${name}/`;
|
|
112
|
+
const pos = url.indexOf(identifier);
|
|
113
|
+
if (pos === -1)
|
|
114
|
+
return '/';
|
|
115
|
+
return url.substring(pos + identifier.length - 1);
|
|
116
|
+
}
|
|
94
117
|
/**
|
|
95
118
|
* Override alert action result
|
|
96
119
|
* @param result Action result
|
package/lib/app/ServiceApp.d.ts
CHANGED
|
@@ -32,6 +32,12 @@ export declare class ServiceApp<U extends IServiceUser = IServiceUser, P extends
|
|
|
32
32
|
* @param name Application name
|
|
33
33
|
*/
|
|
34
34
|
constructor(settings: S, name: string);
|
|
35
|
+
/**
|
|
36
|
+
* Get parsed Url under bridge host
|
|
37
|
+
* @param url Url
|
|
38
|
+
* @returns Parsed Url
|
|
39
|
+
*/
|
|
40
|
+
protected getHostUrl(url: string): string;
|
|
35
41
|
/**
|
|
36
42
|
* Go to the login page
|
|
37
43
|
* @param tryLogin Try to login again
|
package/lib/app/ServiceApp.js
CHANGED
|
@@ -39,6 +39,14 @@ export class ServiceApp extends ReactApp {
|
|
|
39
39
|
set serviceUser(value) {
|
|
40
40
|
this._serviceUser = value;
|
|
41
41
|
}
|
|
42
|
+
/**
|
|
43
|
+
* Get parsed Url under bridge host
|
|
44
|
+
* @param url Url
|
|
45
|
+
* @returns Parsed Url
|
|
46
|
+
*/
|
|
47
|
+
getHostUrl(url) {
|
|
48
|
+
return this.getHostUrlBase(url, 's' + this.settings.serviceId);
|
|
49
|
+
}
|
|
42
50
|
/**
|
|
43
51
|
* Go to the login page
|
|
44
52
|
* @param tryLogin Try to login again
|
package/lib/app/Utils.d.ts
CHANGED
|
@@ -12,9 +12,10 @@ export declare namespace Utils {
|
|
|
12
12
|
function formatInputValue(value: unknown): string | number | any[] | undefined;
|
|
13
13
|
/**
|
|
14
14
|
* Get memory history
|
|
15
|
+
* @param initialPath Initial path
|
|
15
16
|
* @returns History
|
|
16
17
|
*/
|
|
17
|
-
function getMemoryHistory(): History;
|
|
18
|
+
function getMemoryHistory(initialPath?: string): History;
|
|
18
19
|
/**
|
|
19
20
|
* Is safe click
|
|
20
21
|
* @param event Mouse event
|
package/lib/app/Utils.js
CHANGED
|
@@ -26,11 +26,12 @@ export var Utils;
|
|
|
26
26
|
Utils.formatInputValue = formatInputValue;
|
|
27
27
|
/**
|
|
28
28
|
* Get memory history
|
|
29
|
+
* @param initialPath Initial path
|
|
29
30
|
* @returns History
|
|
30
31
|
*/
|
|
31
|
-
function getMemoryHistory() {
|
|
32
|
+
function getMemoryHistory(initialPath = '/') {
|
|
32
33
|
if (memoryHistory == null) {
|
|
33
|
-
memoryHistory = createHistory(createMemorySource(
|
|
34
|
+
memoryHistory = createHistory(createMemorySource(initialPath));
|
|
34
35
|
}
|
|
35
36
|
return memoryHistory;
|
|
36
37
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/react",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.11",
|
|
4
4
|
"description": "TypeScript ReactJs framework",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@emotion/react": "^11.7.1",
|
|
51
51
|
"@emotion/style": "^0.8.0",
|
|
52
52
|
"@emotion/styled": "^11.6.0",
|
|
53
|
-
"@etsoo/appscript": "^1.2.
|
|
53
|
+
"@etsoo/appscript": "^1.2.48",
|
|
54
54
|
"@etsoo/notificationbase": "^1.1.1",
|
|
55
55
|
"@etsoo/shared": "^1.1.11",
|
|
56
56
|
"@mui/icons-material": "^5.4.1",
|
package/src/app/ReactApp.ts
CHANGED
|
@@ -223,7 +223,7 @@ export class ReactApp<
|
|
|
223
223
|
);
|
|
224
224
|
this.history =
|
|
225
225
|
window.location.hostname === ''
|
|
226
|
-
? Utils.getMemoryHistory()
|
|
226
|
+
? Utils.getMemoryHistory(this.getHostUrl(window.location.href))
|
|
227
227
|
: undefined;
|
|
228
228
|
this.cultureState = new CultureState(settings.currentCulture);
|
|
229
229
|
this.pageState = new PageState<P>();
|
|
@@ -231,6 +231,31 @@ export class ReactApp<
|
|
|
231
231
|
globalApp = this;
|
|
232
232
|
}
|
|
233
233
|
|
|
234
|
+
/**
|
|
235
|
+
* Get parsed Url under bridge host
|
|
236
|
+
* @param url Url
|
|
237
|
+
* @returns Parsed Url
|
|
238
|
+
*/
|
|
239
|
+
protected getHostUrl(url: string) {
|
|
240
|
+
return this.getHostUrlBase(url, 'core');
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Get parsed Url under bridge host
|
|
245
|
+
* @param url Url
|
|
246
|
+
* @param name App name in the host environment
|
|
247
|
+
* @returns Parsed Url
|
|
248
|
+
*/
|
|
249
|
+
protected getHostUrlBase(url: string, name: string) {
|
|
250
|
+
if (url.startsWith('/')) return url;
|
|
251
|
+
|
|
252
|
+
const identifier = `/${name}/`;
|
|
253
|
+
const pos = url.indexOf(identifier);
|
|
254
|
+
if (pos === -1) return '/';
|
|
255
|
+
|
|
256
|
+
return url.substring(pos + identifier.length - 1);
|
|
257
|
+
}
|
|
258
|
+
|
|
234
259
|
/**
|
|
235
260
|
* Override alert action result
|
|
236
261
|
* @param result Action result
|
package/src/app/ServiceApp.ts
CHANGED
|
@@ -68,6 +68,15 @@ export class ServiceApp<
|
|
|
68
68
|
this.serviceApi = api;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
+
/**
|
|
72
|
+
* Get parsed Url under bridge host
|
|
73
|
+
* @param url Url
|
|
74
|
+
* @returns Parsed Url
|
|
75
|
+
*/
|
|
76
|
+
protected override getHostUrl(url: string) {
|
|
77
|
+
return this.getHostUrlBase(url, 's' + this.settings.serviceId);
|
|
78
|
+
}
|
|
79
|
+
|
|
71
80
|
/**
|
|
72
81
|
* Go to the login page
|
|
73
82
|
* @param tryLogin Try to login again
|
package/src/app/Utils.ts
CHANGED
|
@@ -28,11 +28,12 @@ export namespace Utils {
|
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
30
|
* Get memory history
|
|
31
|
+
* @param initialPath Initial path
|
|
31
32
|
* @returns History
|
|
32
33
|
*/
|
|
33
|
-
export function getMemoryHistory() {
|
|
34
|
+
export function getMemoryHistory(initialPath: string = '/') {
|
|
34
35
|
if (memoryHistory == null) {
|
|
35
|
-
memoryHistory = createHistory(createMemorySource(
|
|
36
|
+
memoryHistory = createHistory(createMemorySource(initialPath));
|
|
36
37
|
}
|
|
37
38
|
return memoryHistory;
|
|
38
39
|
}
|