@etsoo/smarterp-core 1.0.26 → 1.0.28

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.
@@ -3,7 +3,6 @@ import { isLocalTest, TestApp } from "./app/TestApp";
3
3
  import { EntityStatus } from "@etsoo/appscript";
4
4
  import { OrgApi } from "../src/OrgApi";
5
5
  import { OrgCreateRQ } from "../src/rq/org/OrgCreateRQ";
6
- import { OrgUpdateRQ } from "../src";
7
6
 
8
7
  if (isLocalTest) {
9
8
  const app = new TestApp();
@@ -2,7 +2,6 @@ import { isLocalTest, TestApp } from "./app/TestApp";
2
2
  import { PublicApi } from "../src/PublicApi";
3
3
  import { PinyinFormatType } from "../src/rq/public/PinyinRQ";
4
4
  import { ApiProvider } from "../src/rq/public/PlaceQueryRQ";
5
- import { act } from "react";
6
5
 
7
6
  const app = new TestApp();
8
7
 
@@ -21,7 +21,7 @@ export interface ICoreApp {
21
21
  /**
22
22
  * Application API
23
23
  */
24
- appApi: AppApi;
24
+ readonly appApi: AppApi;
25
25
  /**
26
26
  * Authentication API
27
27
  */
@@ -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({ page: pageTitle });
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
  };
@@ -51,6 +51,7 @@
51
51
  "parentOrg": "Parent org",
52
52
  "pin": "ID",
53
53
  "preferredName": "Preferred name",
54
+ "queryKeyword": "Query keyword",
54
55
  "refreshTime": "Refresh time",
55
56
  "reportTo": "Report to",
56
57
  "role": "Role",
@@ -51,6 +51,7 @@
51
51
  "parentOrg": "上级机构",
52
52
  "pin": "身份证号码",
53
53
  "preferredName": "首选姓名",
54
+ "queryKeyword": "查询关键字",
54
55
  "refreshTime": "刷新时间",
55
56
  "reportTo": "汇报对象",
56
57
  "role": "角色",
@@ -51,6 +51,7 @@
51
51
  "parentOrg": "上級機構",
52
52
  "pin": "身份證號碼",
53
53
  "preferredName": "首選姓名",
54
+ "queryKeyword": "查詢關鍵字",
54
55
  "refreshTime": "刷新時間",
55
56
  "reportTo": "匯報對象",
56
57
  "role": "角色",
@@ -21,7 +21,7 @@ export interface ICoreApp {
21
21
  /**
22
22
  * Application API
23
23
  */
24
- appApi: AppApi;
24
+ readonly appApi: AppApi;
25
25
  /**
26
26
  * Authentication API
27
27
  */
@@ -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({ page: pageTitle });
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
  };
@@ -51,6 +51,7 @@
51
51
  "parentOrg": "Parent org",
52
52
  "pin": "ID",
53
53
  "preferredName": "Preferred name",
54
+ "queryKeyword": "Query keyword",
54
55
  "refreshTime": "Refresh time",
55
56
  "reportTo": "Report to",
56
57
  "role": "Role",
@@ -51,6 +51,7 @@
51
51
  "parentOrg": "上级机构",
52
52
  "pin": "身份证号码",
53
53
  "preferredName": "首选姓名",
54
+ "queryKeyword": "查询关键字",
54
55
  "refreshTime": "刷新时间",
55
56
  "reportTo": "汇报对象",
56
57
  "role": "角色",
@@ -51,6 +51,7 @@
51
51
  "parentOrg": "上級機構",
52
52
  "pin": "身份證號碼",
53
53
  "preferredName": "首選姓名",
54
+ "queryKeyword": "查詢關鍵字",
54
55
  "refreshTime": "刷新時間",
55
56
  "reportTo": "匯報對象",
56
57
  "role": "角色",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/smarterp-core",
3
- "version": "1.0.26",
3
+ "version": "1.0.28",
4
4
  "description": "TypeScript APIs for SmartERP Core",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -45,7 +45,7 @@
45
45
  "@babel/plugin-transform-runtime": "^7.26.10",
46
46
  "@babel/preset-env": "^7.26.9",
47
47
  "@babel/runtime-corejs3": "^7.26.10",
48
- "@types/react": "^18.3.1",
48
+ "@types/react": "^18.3.19",
49
49
  "@types/react-dom": "^18.3.1",
50
50
  "@vitejs/plugin-react": "^4.3.4",
51
51
  "jsdom": "^26.0.0",
@@ -54,10 +54,10 @@
54
54
  },
55
55
  "dependencies": {
56
56
  "@etsoo/appscript": "^1.6.19",
57
- "@etsoo/materialui": "^1.4.99",
57
+ "@etsoo/materialui": "^1.5.2",
58
58
  "@etsoo/react": "^1.8.33",
59
- "@etsoo/shared": "^1.2.62",
60
- "@etsoo/toolpad": "^1.0.19",
59
+ "@etsoo/shared": "^1.2.63",
60
+ "@etsoo/toolpad": "^1.0.21",
61
61
  "@mui/material": "^6.4.8",
62
62
  "react": "^18.3.1",
63
63
  "react-dom": "^18.3.1"
package/src/CoreApp.ts CHANGED
@@ -23,7 +23,7 @@ export interface ICoreApp {
23
23
  /**
24
24
  * Application API
25
25
  */
26
- appApi: AppApi;
26
+ readonly appApi: AppApi;
27
27
 
28
28
  /**
29
29
  * Authentication API
@@ -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({ page: pageTitle });
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();
package/src/i18n/en.json CHANGED
@@ -51,6 +51,7 @@
51
51
  "parentOrg": "Parent org",
52
52
  "pin": "ID",
53
53
  "preferredName": "Preferred name",
54
+ "queryKeyword": "Query keyword",
54
55
  "refreshTime": "Refresh time",
55
56
  "reportTo": "Report to",
56
57
  "role": "Role",
@@ -51,6 +51,7 @@
51
51
  "parentOrg": "上级机构",
52
52
  "pin": "身份证号码",
53
53
  "preferredName": "首选姓名",
54
+ "queryKeyword": "查询关键字",
54
55
  "refreshTime": "刷新时间",
55
56
  "reportTo": "汇报对象",
56
57
  "role": "角色",
@@ -51,6 +51,7 @@
51
51
  "parentOrg": "上級機構",
52
52
  "pin": "身份證號碼",
53
53
  "preferredName": "首選姓名",
54
+ "queryKeyword": "查詢關鍵字",
54
55
  "refreshTime": "刷新時間",
55
56
  "reportTo": "匯報對象",
56
57
  "role": "角色",