@etsoo/smarterp-core 1.0.27 → 1.0.29
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.
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IServiceApp } from "@etsoo/materialui";
|
|
2
2
|
import { ICoreApp } from "./CoreApp";
|
|
3
3
|
import { DependencyList } from "react";
|
|
4
|
+
import { PageData } from "@etsoo/toolpad";
|
|
4
5
|
/**
|
|
5
6
|
* Get core service application context hook
|
|
6
7
|
* @returns Application
|
|
@@ -9,10 +10,17 @@ export declare function useRequiredAppContext(): ICoreServiceApp;
|
|
|
9
10
|
/**
|
|
10
11
|
* Use page data
|
|
11
12
|
* @param app Application
|
|
12
|
-
* @param pageTitle Page title
|
|
13
|
+
* @param pageTitle Page title or true for reset
|
|
13
14
|
* @param deps Dependencies
|
|
14
15
|
*/
|
|
15
|
-
export declare function usePageData(app: ICoreServiceApp, pageTitle?: string, deps?: DependencyList): void;
|
|
16
|
+
export declare function usePageData(app: ICoreServiceApp, pageTitle?: string | true, deps?: DependencyList): void;
|
|
17
|
+
/**
|
|
18
|
+
* Use page data
|
|
19
|
+
* @param app Application
|
|
20
|
+
* @param pageData Page data
|
|
21
|
+
* @param deps Dependencies
|
|
22
|
+
*/
|
|
23
|
+
export declare function usePageData(app: ICoreServiceApp, pageData?: PageData, deps?: DependencyList): void;
|
|
16
24
|
/**
|
|
17
25
|
* Use page data empty
|
|
18
26
|
* @param app Application
|
|
@@ -20,17 +20,15 @@ function useRequiredAppContext() {
|
|
|
20
20
|
// Assume the app is core service app
|
|
21
21
|
return app;
|
|
22
22
|
}
|
|
23
|
-
|
|
24
|
-
* Use page data
|
|
25
|
-
* @param app Application
|
|
26
|
-
* @param pageTitle Page title
|
|
27
|
-
* @param deps Dependencies
|
|
28
|
-
*/
|
|
29
|
-
function usePageData(app, pageTitle, deps) {
|
|
23
|
+
function usePageData(app, pageDataOrTitle, deps) {
|
|
30
24
|
const { dispatch } = react_2.default.useContext(toolpad_1.PageDataContext);
|
|
31
25
|
react_2.default.useEffect(() => {
|
|
32
26
|
// Page title
|
|
33
|
-
dispatch(
|
|
27
|
+
dispatch(typeof pageDataOrTitle === "object"
|
|
28
|
+
? pageDataOrTitle
|
|
29
|
+
: typeof pageDataOrTitle === "boolean"
|
|
30
|
+
? pageDataOrTitle
|
|
31
|
+
: { page: pageDataOrTitle });
|
|
34
32
|
return () => {
|
|
35
33
|
app.pageExit();
|
|
36
34
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { IServiceApp } from "@etsoo/materialui";
|
|
2
2
|
import { ICoreApp } from "./CoreApp";
|
|
3
3
|
import { DependencyList } from "react";
|
|
4
|
+
import { PageData } from "@etsoo/toolpad";
|
|
4
5
|
/**
|
|
5
6
|
* Get core service application context hook
|
|
6
7
|
* @returns Application
|
|
@@ -9,10 +10,17 @@ export declare function useRequiredAppContext(): ICoreServiceApp;
|
|
|
9
10
|
/**
|
|
10
11
|
* Use page data
|
|
11
12
|
* @param app Application
|
|
12
|
-
* @param pageTitle Page title
|
|
13
|
+
* @param pageTitle Page title or true for reset
|
|
13
14
|
* @param deps Dependencies
|
|
14
15
|
*/
|
|
15
|
-
export declare function usePageData(app: ICoreServiceApp, pageTitle?: string, deps?: DependencyList): void;
|
|
16
|
+
export declare function usePageData(app: ICoreServiceApp, pageTitle?: string | true, deps?: DependencyList): void;
|
|
17
|
+
/**
|
|
18
|
+
* Use page data
|
|
19
|
+
* @param app Application
|
|
20
|
+
* @param pageData Page data
|
|
21
|
+
* @param deps Dependencies
|
|
22
|
+
*/
|
|
23
|
+
export declare function usePageData(app: ICoreServiceApp, pageData?: PageData, deps?: DependencyList): void;
|
|
16
24
|
/**
|
|
17
25
|
* Use page data empty
|
|
18
26
|
* @param app Application
|
|
@@ -12,17 +12,15 @@ export function useRequiredAppContext() {
|
|
|
12
12
|
// Assume the app is core service app
|
|
13
13
|
return app;
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
* Use page data
|
|
17
|
-
* @param app Application
|
|
18
|
-
* @param pageTitle Page title
|
|
19
|
-
* @param deps Dependencies
|
|
20
|
-
*/
|
|
21
|
-
export function usePageData(app, pageTitle, deps) {
|
|
15
|
+
export function usePageData(app, pageDataOrTitle, deps) {
|
|
22
16
|
const { dispatch } = React.useContext(PageDataContext);
|
|
23
17
|
React.useEffect(() => {
|
|
24
18
|
// Page title
|
|
25
|
-
dispatch(
|
|
19
|
+
dispatch(typeof pageDataOrTitle === "object"
|
|
20
|
+
? pageDataOrTitle
|
|
21
|
+
: typeof pageDataOrTitle === "boolean"
|
|
22
|
+
? pageDataOrTitle
|
|
23
|
+
: { page: pageDataOrTitle });
|
|
26
24
|
return () => {
|
|
27
25
|
app.pageExit();
|
|
28
26
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/smarterp-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.29",
|
|
4
4
|
"description": "TypeScript APIs for SmartERP Core",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@etsoo/materialui": "^1.5.2",
|
|
58
58
|
"@etsoo/react": "^1.8.33",
|
|
59
59
|
"@etsoo/shared": "^1.2.63",
|
|
60
|
-
"@etsoo/toolpad": "^1.0.
|
|
60
|
+
"@etsoo/toolpad": "^1.0.22",
|
|
61
61
|
"@mui/material": "^6.4.8",
|
|
62
62
|
"react": "^18.3.1",
|
|
63
63
|
"react-dom": "^18.3.1"
|
package/src/ICoreServiceApp.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { IServiceApp, ReactAppContext } from "@etsoo/materialui";
|
|
|
2
2
|
import { ICoreApp } from "./CoreApp";
|
|
3
3
|
import { useRequiredContext } from "@etsoo/react";
|
|
4
4
|
import React, { DependencyList } from "react";
|
|
5
|
-
import { PageDataContext } from "@etsoo/toolpad";
|
|
5
|
+
import { PageData, PageDataContext } from "@etsoo/toolpad";
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Get core service application context hook
|
|
@@ -19,18 +19,42 @@ export function useRequiredAppContext(): ICoreServiceApp {
|
|
|
19
19
|
/**
|
|
20
20
|
* Use page data
|
|
21
21
|
* @param app Application
|
|
22
|
-
* @param pageTitle Page title
|
|
22
|
+
* @param pageTitle Page title or true for reset
|
|
23
23
|
* @param deps Dependencies
|
|
24
24
|
*/
|
|
25
25
|
export function usePageData(
|
|
26
26
|
app: ICoreServiceApp,
|
|
27
|
-
pageTitle?: string,
|
|
27
|
+
pageTitle?: string | true,
|
|
28
|
+
deps?: DependencyList
|
|
29
|
+
): void;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Use page data
|
|
33
|
+
* @param app Application
|
|
34
|
+
* @param pageData Page data
|
|
35
|
+
* @param deps Dependencies
|
|
36
|
+
*/
|
|
37
|
+
export function usePageData(
|
|
38
|
+
app: ICoreServiceApp,
|
|
39
|
+
pageData?: PageData,
|
|
40
|
+
deps?: DependencyList
|
|
41
|
+
): void;
|
|
42
|
+
|
|
43
|
+
export function usePageData(
|
|
44
|
+
app: ICoreServiceApp,
|
|
45
|
+
pageDataOrTitle?: string | true | PageData,
|
|
28
46
|
deps?: DependencyList
|
|
29
47
|
) {
|
|
30
48
|
const { dispatch } = React.useContext(PageDataContext);
|
|
31
49
|
React.useEffect(() => {
|
|
32
50
|
// Page title
|
|
33
|
-
dispatch(
|
|
51
|
+
dispatch(
|
|
52
|
+
typeof pageDataOrTitle === "object"
|
|
53
|
+
? pageDataOrTitle
|
|
54
|
+
: typeof pageDataOrTitle === "boolean"
|
|
55
|
+
? pageDataOrTitle
|
|
56
|
+
: { page: pageDataOrTitle }
|
|
57
|
+
);
|
|
34
58
|
|
|
35
59
|
return () => {
|
|
36
60
|
app.pageExit();
|