@etsoo/smarterp-core 1.1.2 → 1.1.3

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.
@@ -9,6 +9,7 @@ export * from "./app/UserRoleList";
9
9
  export * from "./org/ButtonApiServices";
10
10
  export * from "./org/OrgSwitchPopover";
11
11
  export * from "./org/OrgTiplist";
12
+ export * from "./public/AddressTiplist";
12
13
  export * from "./public/ButtonCultures";
13
14
  export * from "./public/ButtonCurrencies";
14
15
  export * from "./public/ButtonRadioRegions";
@@ -29,6 +29,7 @@ __exportStar(require("./org/ButtonApiServices"), exports);
29
29
  __exportStar(require("./org/OrgSwitchPopover"), exports);
30
30
  __exportStar(require("./org/OrgTiplist"), exports);
31
31
  // public
32
+ __exportStar(require("./public/AddressTiplist"), exports);
32
33
  __exportStar(require("./public/ButtonCultures"), exports);
33
34
  __exportStar(require("./public/ButtonCurrencies"), exports);
34
35
  __exportStar(require("./public/ButtonRadioRegions"), exports);
@@ -0,0 +1,12 @@
1
+ import { TiplistProps } from "@etsoo/materialui";
2
+ import { PlaceCommon } from "../../dto/public/PlaceCommon";
3
+ /**
4
+ * Address tiplist component props
5
+ */
6
+ export type AddressTiplistProps = Omit<TiplistProps<PlaceCommon, "placeId">, "idField" | "loadData" | "name" | "label"> & Partial<Pick<TiplistProps<PlaceCommon, "placeId">, "name" | "label">> & {};
7
+ /**
8
+ * Address tiplist component
9
+ * @param props Properties
10
+ * @returns Component
11
+ */
12
+ export declare function AddressTiplist(props: AddressTiplistProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AddressTiplist = AddressTiplist;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const materialui_1 = require("@etsoo/materialui");
6
+ const ICoreServiceApp_1 = require("../../ICoreServiceApp");
7
+ /**
8
+ * Address tiplist component
9
+ * @param props Properties
10
+ * @returns Component
11
+ */
12
+ function AddressTiplist(props) {
13
+ // App
14
+ const app = (0, ICoreServiceApp_1.useRequiredAppContext)();
15
+ // Destruct
16
+ const { fullWidth = true, getOptionLabel = (option) => `${option.name} - ${option.formattedAddress} (${option.postalCode})`, name = "address", label = app.get("address") ?? "Address", maxItems = 10, ...rest } = props;
17
+ return ((0, jsx_runtime_1.jsx)(materialui_1.Tiplist, { fullWidth: fullWidth, getOptionLabel: getOptionLabel, idField: "placeId", label: label, loadData: (keyword, _, maxItems) => keyword
18
+ ? app.core.publicApi.queryPlace({
19
+ language: app.culture,
20
+ query: keyword,
21
+ pageSize: maxItems
22
+ }, { showLoading: false })
23
+ : Promise.resolve([]), name: name, ...rest }));
24
+ }
@@ -55,4 +55,9 @@ export type PlaceQueryRQ = {
55
55
  * 方圆距离,单位为米
56
56
  */
57
57
  radius?: number;
58
+ /**
59
+ * Page size, 1 - 20 suggested
60
+ * 每页记录数,建议1-20
61
+ */
62
+ pageSize?: number;
58
63
  };
@@ -9,6 +9,7 @@ export * from "./app/UserRoleList";
9
9
  export * from "./org/ButtonApiServices";
10
10
  export * from "./org/OrgSwitchPopover";
11
11
  export * from "./org/OrgTiplist";
12
+ export * from "./public/AddressTiplist";
12
13
  export * from "./public/ButtonCultures";
13
14
  export * from "./public/ButtonCurrencies";
14
15
  export * from "./public/ButtonRadioRegions";
@@ -13,6 +13,7 @@ export * from "./org/ButtonApiServices";
13
13
  export * from "./org/OrgSwitchPopover";
14
14
  export * from "./org/OrgTiplist";
15
15
  // public
16
+ export * from "./public/AddressTiplist";
16
17
  export * from "./public/ButtonCultures";
17
18
  export * from "./public/ButtonCurrencies";
18
19
  export * from "./public/ButtonRadioRegions";
@@ -0,0 +1,12 @@
1
+ import { TiplistProps } from "@etsoo/materialui";
2
+ import { PlaceCommon } from "../../dto/public/PlaceCommon";
3
+ /**
4
+ * Address tiplist component props
5
+ */
6
+ export type AddressTiplistProps = Omit<TiplistProps<PlaceCommon, "placeId">, "idField" | "loadData" | "name" | "label"> & Partial<Pick<TiplistProps<PlaceCommon, "placeId">, "name" | "label">> & {};
7
+ /**
8
+ * Address tiplist component
9
+ * @param props Properties
10
+ * @returns Component
11
+ */
12
+ export declare function AddressTiplist(props: AddressTiplistProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Tiplist } from "@etsoo/materialui";
3
+ import { useRequiredAppContext } from "../../ICoreServiceApp";
4
+ /**
5
+ * Address tiplist component
6
+ * @param props Properties
7
+ * @returns Component
8
+ */
9
+ export function AddressTiplist(props) {
10
+ // App
11
+ const app = useRequiredAppContext();
12
+ // Destruct
13
+ const { fullWidth = true, getOptionLabel = (option) => `${option.name} - ${option.formattedAddress} (${option.postalCode})`, name = "address", label = app.get("address") ?? "Address", maxItems = 10, ...rest } = props;
14
+ return (_jsx(Tiplist, { fullWidth: fullWidth, getOptionLabel: getOptionLabel, idField: "placeId", label: label, loadData: (keyword, _, maxItems) => keyword
15
+ ? app.core.publicApi.queryPlace({
16
+ language: app.culture,
17
+ query: keyword,
18
+ pageSize: maxItems
19
+ }, { showLoading: false })
20
+ : Promise.resolve([]), name: name, ...rest }));
21
+ }
@@ -55,4 +55,9 @@ export type PlaceQueryRQ = {
55
55
  * 方圆距离,单位为米
56
56
  */
57
57
  radius?: number;
58
+ /**
59
+ * Page size, 1 - 20 suggested
60
+ * 每页记录数,建议1-20
61
+ */
62
+ pageSize?: number;
58
63
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/smarterp-core",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "TypeScript APIs for SmartERP Core",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -50,18 +50,18 @@
50
50
  "@vitejs/plugin-react": "^5.1.2",
51
51
  "jsdom": "^27.3.0",
52
52
  "typescript": "^5.9.3",
53
- "vitest": "^4.0.15"
53
+ "vitest": "^4.0.16"
54
54
  },
55
55
  "dependencies": {
56
56
  "@etsoo/appscript": "^1.6.49",
57
- "@etsoo/materialui": "^1.5.90",
58
- "@etsoo/react": "^1.8.64",
57
+ "@etsoo/materialui": "^1.5.92",
58
+ "@etsoo/react": "^1.8.65",
59
59
  "@etsoo/shared": "^1.2.80",
60
60
  "@etsoo/toolpad": "^1.0.42",
61
61
  "@mui/material": "^7.3.6",
62
62
  "ajv": "^8.17.1",
63
63
  "ajv-formats": "^3.0.1",
64
- "react": "^19.2.1",
65
- "react-dom": "^19.2.1"
64
+ "react": "^19.2.3",
65
+ "react-dom": "^19.2.3"
66
66
  }
67
67
  }
@@ -16,6 +16,7 @@ export * from "./org/OrgSwitchPopover";
16
16
  export * from "./org/OrgTiplist";
17
17
 
18
18
  // public
19
+ export * from "./public/AddressTiplist";
19
20
  export * from "./public/ButtonCultures";
20
21
  export * from "./public/ButtonCurrencies";
21
22
  export * from "./public/ButtonRadioRegions";
@@ -0,0 +1,56 @@
1
+ import { Tiplist, TiplistProps } from "@etsoo/materialui";
2
+ import { useRequiredAppContext } from "../../ICoreServiceApp";
3
+ import { PlaceCommon } from "../../dto/public/PlaceCommon";
4
+
5
+ /**
6
+ * Address tiplist component props
7
+ */
8
+ export type AddressTiplistProps = Omit<
9
+ TiplistProps<PlaceCommon, "placeId">,
10
+ "idField" | "loadData" | "name" | "label"
11
+ > &
12
+ Partial<Pick<TiplistProps<PlaceCommon, "placeId">, "name" | "label">> & {};
13
+
14
+ /**
15
+ * Address tiplist component
16
+ * @param props Properties
17
+ * @returns Component
18
+ */
19
+ export function AddressTiplist(props: AddressTiplistProps) {
20
+ // App
21
+ const app = useRequiredAppContext();
22
+
23
+ // Destruct
24
+ const {
25
+ fullWidth = true,
26
+ getOptionLabel = (option) =>
27
+ `${option.name} - ${option.formattedAddress} (${option.postalCode})`,
28
+ name = "address",
29
+ label = app.get("address") ?? "Address",
30
+ maxItems = 10,
31
+ ...rest
32
+ } = props;
33
+
34
+ return (
35
+ <Tiplist<PlaceCommon>
36
+ fullWidth={fullWidth}
37
+ getOptionLabel={getOptionLabel}
38
+ idField="placeId"
39
+ label={label}
40
+ loadData={(keyword, _, maxItems) =>
41
+ keyword
42
+ ? app.core.publicApi.queryPlace(
43
+ {
44
+ language: app.culture,
45
+ query: keyword,
46
+ pageSize: maxItems
47
+ },
48
+ { showLoading: false }
49
+ )
50
+ : Promise.resolve([])
51
+ }
52
+ name={name}
53
+ {...rest}
54
+ />
55
+ );
56
+ }
@@ -64,4 +64,10 @@ export type PlaceQueryRQ = {
64
64
  * 方圆距离,单位为米
65
65
  */
66
66
  radius?: number;
67
+
68
+ /**
69
+ * Page size, 1 - 20 suggested
70
+ * 每页记录数,建议1-20
71
+ */
72
+ pageSize?: number;
67
73
  };