@etsoo/smarterp-core 1.1.1 → 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.
@@ -11,6 +11,10 @@ on:
11
11
  # release:
12
12
  # types: [created]
13
13
 
14
+ permissions:
15
+ id-token: write # Required for OIDC
16
+ contents: read
17
+
14
18
  jobs:
15
19
  # Publish to NPM
16
20
  publish-npm:
@@ -52,9 +56,8 @@ jobs:
52
56
  - name: Publish if necessary
53
57
  id: publish
54
58
  if: ${{ steps.check.outputs.exists == '0' }} # package version doesn't yet exist, ship it!
55
- run: npm publish --access public
56
- env:
57
- NODE_AUTH_TOKEN: ${{ secrets.ETSOONpmToken }}
59
+ run: npm publish
60
+
58
61
  - name: Report publish status
59
62
  if: ${{ steps.check.outputs.exists == '1' }}
60
63
  run: 'echo "package version already exists on npm registry"'
@@ -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.1",
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",
@@ -24,7 +24,7 @@
24
24
  },
25
25
  "repository": {
26
26
  "type": "git",
27
- "url": "git+https://github.com/ETSOO/etsoo-smarterp-core.git"
27
+ "url": "git+https://github.com/ETSOO/smarterp-core.git"
28
28
  },
29
29
  "keywords": [
30
30
  "TypeScript",
@@ -38,30 +38,30 @@
38
38
  ],
39
39
  "author": "ETSOO",
40
40
  "license": "MIT",
41
- "homepage": "https://github.com/ETSOO/etsoo-smarterp-core#readme",
41
+ "homepage": "https://github.com/ETSOO/smarterp-core#readme",
42
42
  "devDependencies": {
43
43
  "@babel/cli": "^7.28.3",
44
44
  "@babel/core": "^7.28.5",
45
45
  "@babel/plugin-transform-runtime": "^7.28.5",
46
46
  "@babel/preset-env": "^7.28.5",
47
47
  "@babel/runtime-corejs3": "^7.28.4",
48
- "@types/react": "^19.2.5",
48
+ "@types/react": "^19.2.7",
49
49
  "@types/react-dom": "^19.2.3",
50
- "@vitejs/plugin-react": "^5.1.1",
51
- "jsdom": "^27.2.0",
50
+ "@vitejs/plugin-react": "^5.1.2",
51
+ "jsdom": "^27.3.0",
52
52
  "typescript": "^5.9.3",
53
- "vitest": "^4.0.9"
53
+ "vitest": "^4.0.16"
54
54
  },
55
55
  "dependencies": {
56
- "@etsoo/appscript": "^1.6.48",
57
- "@etsoo/materialui": "^1.5.88",
58
- "@etsoo/react": "^1.8.63",
59
- "@etsoo/shared": "^1.2.79",
56
+ "@etsoo/appscript": "^1.6.49",
57
+ "@etsoo/materialui": "^1.5.92",
58
+ "@etsoo/react": "^1.8.65",
59
+ "@etsoo/shared": "^1.2.80",
60
60
  "@etsoo/toolpad": "^1.0.42",
61
- "@mui/material": "^7.3.5",
61
+ "@mui/material": "^7.3.6",
62
62
  "ajv": "^8.17.1",
63
63
  "ajv-formats": "^3.0.1",
64
- "react": "^19.2.0",
65
- "react-dom": "^19.2.0"
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
  };