@etsoo/smarterp-core 1.0.91 → 1.0.93

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.
Files changed (37) hide show
  1. package/lib/cjs/components/index.d.ts +1 -0
  2. package/lib/cjs/components/index.js +1 -0
  3. package/lib/cjs/components/public/ButtonCultures.d.ts +1 -1
  4. package/lib/cjs/components/public/ButtonCultures.js +7 -0
  5. package/lib/cjs/components/public/ButtonRadioRegions.d.ts +3 -0
  6. package/lib/cjs/components/public/ButtonRadioRegions.js +47 -0
  7. package/lib/cjs/components/public/ButtonRegions.d.ts +1 -1
  8. package/lib/cjs/components/public/ButtonRegions.js +7 -0
  9. package/lib/cjs/dto/public/PlaceCommon.d.ts +1 -1
  10. package/lib/cjs/index.d.ts +0 -1
  11. package/lib/cjs/index.js +0 -1
  12. package/lib/cjs/rq/public/PlaceQueryRQ.d.ts +1 -1
  13. package/lib/mjs/components/index.d.ts +1 -0
  14. package/lib/mjs/components/index.js +1 -0
  15. package/lib/mjs/components/public/ButtonCultures.d.ts +1 -1
  16. package/lib/mjs/components/public/ButtonCultures.js +7 -0
  17. package/lib/mjs/components/public/ButtonRadioRegions.d.ts +3 -0
  18. package/lib/mjs/components/public/ButtonRadioRegions.js +41 -0
  19. package/lib/mjs/components/public/ButtonRegions.d.ts +1 -1
  20. package/lib/mjs/components/public/ButtonRegions.js +7 -0
  21. package/lib/mjs/dto/public/PlaceCommon.d.ts +1 -1
  22. package/lib/mjs/index.d.ts +0 -1
  23. package/lib/mjs/index.js +0 -1
  24. package/lib/mjs/rq/public/PlaceQueryRQ.d.ts +1 -1
  25. package/package.json +2 -2
  26. package/src/components/index.ts +1 -0
  27. package/src/components/public/ButtonCultures.tsx +7 -0
  28. package/src/components/public/ButtonRadioRegions.tsx +67 -0
  29. package/src/components/public/ButtonRegions.tsx +7 -0
  30. package/src/dto/public/PlaceCommon.ts +1 -1
  31. package/src/index.ts +0 -1
  32. package/src/rq/public/PlaceQueryRQ.ts +1 -1
  33. package/lib/cjs/dto/public/PlaceLocation.d.ts +0 -14
  34. package/lib/cjs/dto/public/PlaceLocation.js +0 -2
  35. package/lib/mjs/dto/public/PlaceLocation.d.ts +0 -14
  36. package/lib/mjs/dto/public/PlaceLocation.js +0 -1
  37. package/src/dto/public/PlaceLocation.ts +0 -15
@@ -11,6 +11,7 @@ export * from "./org/OrgSwitchPopover";
11
11
  export * from "./org/OrgTiplist";
12
12
  export * from "./public/ButtonCultures";
13
13
  export * from "./public/ButtonCurrencies";
14
+ export * from "./public/ButtonRadioRegions";
14
15
  export * from "./public/ButtonRegions";
15
16
  export * from "./public/CultureList";
16
17
  export * from "./user/UserTiplist";
@@ -31,6 +31,7 @@ __exportStar(require("./org/OrgTiplist"), exports);
31
31
  // public
32
32
  __exportStar(require("./public/ButtonCultures"), exports);
33
33
  __exportStar(require("./public/ButtonCurrencies"), exports);
34
+ __exportStar(require("./public/ButtonRadioRegions"), exports);
34
35
  __exportStar(require("./public/ButtonRegions"), exports);
35
36
  __exportStar(require("./public/CultureList"), exports);
36
37
  // user
@@ -1,3 +1,3 @@
1
1
  import { ButtonPopupCheckboxProps } from "@etsoo/materialui";
2
2
  import { CultureItem } from "@etsoo/appscript";
3
- export declare function ButtonCultures(props: Omit<ButtonPopupCheckboxProps<CultureItem>, "labelField" | "loadData">): import("react/jsx-runtime").JSX.Element;
3
+ export declare function ButtonCultures(props: Omit<ButtonPopupCheckboxProps<CultureItem>, "labelField" | "loadData">): import("react/jsx-runtime").JSX.Element | undefined;
@@ -27,6 +27,13 @@ function ButtonCultures(props) {
27
27
  "ru",
28
28
  "ar"
29
29
  ];
30
+ // Add application cultures, starting from the end
31
+ for (let i = app.settings.cultures.length - 1; i >= 0; i--) {
32
+ const c = app.settings.cultures[i];
33
+ if (defaultCultures.includes(c.name))
34
+ return;
35
+ defaultCultures.unshift(c.name);
36
+ }
30
37
  defaultCultures.sort((a) => (app.culture.startsWith(a) ? -1 : 0));
31
38
  // Load data
32
39
  const loadData = react_1.default.useCallback(async () => (await app.core.publicApi.getCultures(defaultCultures)) ?? [], []);
@@ -0,0 +1,3 @@
1
+ import { ButtonPopupRadioProps } from "@etsoo/materialui";
2
+ import { RegionData } from "../../dto/public/RegionData";
3
+ export declare function ButtonRadioRegions(props: Omit<ButtonPopupRadioProps<RegionData>, "labelField" | "loadData">): import("react/jsx-runtime").JSX.Element | undefined;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.ButtonRadioRegions = ButtonRadioRegions;
7
+ const jsx_runtime_1 = require("react/jsx-runtime");
8
+ const materialui_1 = require("@etsoo/materialui");
9
+ const ICoreServiceApp_1 = require("../../ICoreServiceApp");
10
+ const react_1 = __importDefault(require("react"));
11
+ function ButtonRadioRegions(props) {
12
+ // App
13
+ const app = (0, ICoreServiceApp_1.useRequiredAppContext)();
14
+ // Labels
15
+ const labels = app.getLabels("clickToChoose", "region");
16
+ // Destruct
17
+ const { inputName = "region", label = labels.region, labelEnd = labels.clickToChoose, ...rest } = props;
18
+ const defaultRegions = [
19
+ "CN",
20
+ "US",
21
+ "GB",
22
+ "IE",
23
+ "CA",
24
+ "AU",
25
+ "NZ",
26
+ "DE",
27
+ "FR",
28
+ "JP",
29
+ "SG",
30
+ "HK"
31
+ ];
32
+ // Add application regions, starting from the end
33
+ for (let i = app.settings.regions.length - 1; i >= 0; i--) {
34
+ const r = app.settings.regions[i];
35
+ if (defaultRegions.includes(r))
36
+ return;
37
+ defaultRegions.unshift(r);
38
+ }
39
+ // Load data
40
+ const loadData = react_1.default.useCallback(async () => (await app.core.publicApi.getRegions(defaultRegions)) ?? [], []);
41
+ return ((0, jsx_runtime_1.jsx)(materialui_1.ButtonPopupRadio, { inputName: inputName, label: label, labelFormatter: (data) => `${data.name} (${data.id})`, labelEnd: labelEnd, labelField: "name", loadData: loadData, onAdd: async (ids) => {
42
+ const data = await app.core.publicApi.getRegions(ids);
43
+ if (data == null)
44
+ return false;
45
+ return data;
46
+ }, ...rest }));
47
+ }
@@ -1,3 +1,3 @@
1
1
  import { ButtonPopupCheckboxProps } from "@etsoo/materialui";
2
2
  import { RegionData } from "../../dto/public/RegionData";
3
- export declare function ButtonRegions(props: Omit<ButtonPopupCheckboxProps<RegionData>, "labelField" | "loadData">): import("react/jsx-runtime").JSX.Element;
3
+ export declare function ButtonRegions(props: Omit<ButtonPopupCheckboxProps<RegionData>, "labelField" | "loadData">): import("react/jsx-runtime").JSX.Element | undefined;
@@ -29,6 +29,13 @@ function ButtonRegions(props) {
29
29
  "SG",
30
30
  "HK"
31
31
  ];
32
+ // Add application regions, starting from the end
33
+ for (let i = app.settings.regions.length - 1; i >= 0; i--) {
34
+ const r = app.settings.regions[i];
35
+ if (defaultRegions.includes(r))
36
+ return;
37
+ defaultRegions.unshift(r);
38
+ }
32
39
  // Load data
33
40
  const loadData = react_1.default.useCallback(async () => (await app.core.publicApi.getRegions(defaultRegions)) ?? [], []);
34
41
  return ((0, jsx_runtime_1.jsx)(materialui_1.ButtonPopupCheckbox, { inputName: inputName, label: label, labelFormatter: (data) => `${data.name} (${data.id})`, labelEnd: labelEnd, labelField: "name", loadData: loadData, onAdd: async (ids) => {
@@ -1,4 +1,4 @@
1
- import { PlaceLocation } from "./PlaceLocation";
1
+ import { PlaceLocation } from "@etsoo/appscript";
2
2
  /**
3
3
  * Common place
4
4
  * 通用地点
@@ -27,7 +27,6 @@ export * from "./dto/public/ChinaPinData";
27
27
  export * from "./dto/public/CurrencyItem";
28
28
  export * from "./dto/public/MemberInvitationDto";
29
29
  export * from "./dto/public/PlaceCommon";
30
- export * from "./dto/public/PlaceLocation";
31
30
  export * from "./dto/public/RegionData";
32
31
  export * from "./dto/user/AuditHistoryDto";
33
32
  export * from "./dto/user/DeviceListDto";
package/lib/cjs/index.js CHANGED
@@ -44,7 +44,6 @@ __exportStar(require("./dto/public/ChinaPinData"), exports);
44
44
  __exportStar(require("./dto/public/CurrencyItem"), exports);
45
45
  __exportStar(require("./dto/public/MemberInvitationDto"), exports);
46
46
  __exportStar(require("./dto/public/PlaceCommon"), exports);
47
- __exportStar(require("./dto/public/PlaceLocation"), exports);
48
47
  __exportStar(require("./dto/public/RegionData"), exports);
49
48
  __exportStar(require("./dto/user/AuditHistoryDto"), exports);
50
49
  __exportStar(require("./dto/user/DeviceListDto"), exports);
@@ -1,4 +1,4 @@
1
- import { PlaceLocation } from "../../dto/public/PlaceLocation";
1
+ import { PlaceLocation } from "@etsoo/appscript";
2
2
  /**
3
3
  * API output type
4
4
  * API输出类型
@@ -11,6 +11,7 @@ export * from "./org/OrgSwitchPopover";
11
11
  export * from "./org/OrgTiplist";
12
12
  export * from "./public/ButtonCultures";
13
13
  export * from "./public/ButtonCurrencies";
14
+ export * from "./public/ButtonRadioRegions";
14
15
  export * from "./public/ButtonRegions";
15
16
  export * from "./public/CultureList";
16
17
  export * from "./user/UserTiplist";
@@ -15,6 +15,7 @@ export * from "./org/OrgTiplist";
15
15
  // public
16
16
  export * from "./public/ButtonCultures";
17
17
  export * from "./public/ButtonCurrencies";
18
+ export * from "./public/ButtonRadioRegions";
18
19
  export * from "./public/ButtonRegions";
19
20
  export * from "./public/CultureList";
20
21
  // user
@@ -1,3 +1,3 @@
1
1
  import { ButtonPopupCheckboxProps } from "@etsoo/materialui";
2
2
  import { CultureItem } from "@etsoo/appscript";
3
- export declare function ButtonCultures(props: Omit<ButtonPopupCheckboxProps<CultureItem>, "labelField" | "loadData">): import("react/jsx-runtime").JSX.Element;
3
+ export declare function ButtonCultures(props: Omit<ButtonPopupCheckboxProps<CultureItem>, "labelField" | "loadData">): import("react/jsx-runtime").JSX.Element | undefined;
@@ -21,6 +21,13 @@ export function ButtonCultures(props) {
21
21
  "ru",
22
22
  "ar"
23
23
  ];
24
+ // Add application cultures, starting from the end
25
+ for (let i = app.settings.cultures.length - 1; i >= 0; i--) {
26
+ const c = app.settings.cultures[i];
27
+ if (defaultCultures.includes(c.name))
28
+ return;
29
+ defaultCultures.unshift(c.name);
30
+ }
24
31
  defaultCultures.sort((a) => (app.culture.startsWith(a) ? -1 : 0));
25
32
  // Load data
26
33
  const loadData = React.useCallback(async () => (await app.core.publicApi.getCultures(defaultCultures)) ?? [], []);
@@ -0,0 +1,3 @@
1
+ import { ButtonPopupRadioProps } from "@etsoo/materialui";
2
+ import { RegionData } from "../../dto/public/RegionData";
3
+ export declare function ButtonRadioRegions(props: Omit<ButtonPopupRadioProps<RegionData>, "labelField" | "loadData">): import("react/jsx-runtime").JSX.Element | undefined;
@@ -0,0 +1,41 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ButtonPopupRadio } from "@etsoo/materialui";
3
+ import { useRequiredAppContext } from "../../ICoreServiceApp";
4
+ import React from "react";
5
+ export function ButtonRadioRegions(props) {
6
+ // App
7
+ const app = useRequiredAppContext();
8
+ // Labels
9
+ const labels = app.getLabels("clickToChoose", "region");
10
+ // Destruct
11
+ const { inputName = "region", label = labels.region, labelEnd = labels.clickToChoose, ...rest } = props;
12
+ const defaultRegions = [
13
+ "CN",
14
+ "US",
15
+ "GB",
16
+ "IE",
17
+ "CA",
18
+ "AU",
19
+ "NZ",
20
+ "DE",
21
+ "FR",
22
+ "JP",
23
+ "SG",
24
+ "HK"
25
+ ];
26
+ // Add application regions, starting from the end
27
+ for (let i = app.settings.regions.length - 1; i >= 0; i--) {
28
+ const r = app.settings.regions[i];
29
+ if (defaultRegions.includes(r))
30
+ return;
31
+ defaultRegions.unshift(r);
32
+ }
33
+ // Load data
34
+ const loadData = React.useCallback(async () => (await app.core.publicApi.getRegions(defaultRegions)) ?? [], []);
35
+ return (_jsx(ButtonPopupRadio, { inputName: inputName, label: label, labelFormatter: (data) => `${data.name} (${data.id})`, labelEnd: labelEnd, labelField: "name", loadData: loadData, onAdd: async (ids) => {
36
+ const data = await app.core.publicApi.getRegions(ids);
37
+ if (data == null)
38
+ return false;
39
+ return data;
40
+ }, ...rest }));
41
+ }
@@ -1,3 +1,3 @@
1
1
  import { ButtonPopupCheckboxProps } from "@etsoo/materialui";
2
2
  import { RegionData } from "../../dto/public/RegionData";
3
- export declare function ButtonRegions(props: Omit<ButtonPopupCheckboxProps<RegionData>, "labelField" | "loadData">): import("react/jsx-runtime").JSX.Element;
3
+ export declare function ButtonRegions(props: Omit<ButtonPopupCheckboxProps<RegionData>, "labelField" | "loadData">): import("react/jsx-runtime").JSX.Element | undefined;
@@ -23,6 +23,13 @@ export function ButtonRegions(props) {
23
23
  "SG",
24
24
  "HK"
25
25
  ];
26
+ // Add application regions, starting from the end
27
+ for (let i = app.settings.regions.length - 1; i >= 0; i--) {
28
+ const r = app.settings.regions[i];
29
+ if (defaultRegions.includes(r))
30
+ return;
31
+ defaultRegions.unshift(r);
32
+ }
26
33
  // Load data
27
34
  const loadData = React.useCallback(async () => (await app.core.publicApi.getRegions(defaultRegions)) ?? [], []);
28
35
  return (_jsx(ButtonPopupCheckbox, { inputName: inputName, label: label, labelFormatter: (data) => `${data.name} (${data.id})`, labelEnd: labelEnd, labelField: "name", loadData: loadData, onAdd: async (ids) => {
@@ -1,4 +1,4 @@
1
- import { PlaceLocation } from "./PlaceLocation";
1
+ import { PlaceLocation } from "@etsoo/appscript";
2
2
  /**
3
3
  * Common place
4
4
  * 通用地点
@@ -27,7 +27,6 @@ export * from "./dto/public/ChinaPinData";
27
27
  export * from "./dto/public/CurrencyItem";
28
28
  export * from "./dto/public/MemberInvitationDto";
29
29
  export * from "./dto/public/PlaceCommon";
30
- export * from "./dto/public/PlaceLocation";
31
30
  export * from "./dto/public/RegionData";
32
31
  export * from "./dto/user/AuditHistoryDto";
33
32
  export * from "./dto/user/DeviceListDto";
package/lib/mjs/index.js CHANGED
@@ -28,7 +28,6 @@ export * from "./dto/public/ChinaPinData";
28
28
  export * from "./dto/public/CurrencyItem";
29
29
  export * from "./dto/public/MemberInvitationDto";
30
30
  export * from "./dto/public/PlaceCommon";
31
- export * from "./dto/public/PlaceLocation";
32
31
  export * from "./dto/public/RegionData";
33
32
  export * from "./dto/user/AuditHistoryDto";
34
33
  export * from "./dto/user/DeviceListDto";
@@ -1,4 +1,4 @@
1
- import { PlaceLocation } from "../../dto/public/PlaceLocation";
1
+ import { PlaceLocation } from "@etsoo/appscript";
2
2
  /**
3
3
  * API output type
4
4
  * API输出类型
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/smarterp-core",
3
- "version": "1.0.91",
3
+ "version": "1.0.93",
4
4
  "description": "TypeScript APIs for SmartERP Core",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -53,7 +53,7 @@
53
53
  "vitest": "^3.2.4"
54
54
  },
55
55
  "dependencies": {
56
- "@etsoo/appscript": "^1.6.42",
56
+ "@etsoo/appscript": "^1.6.43",
57
57
  "@etsoo/materialui": "^1.5.66",
58
58
  "@etsoo/react": "^1.8.49",
59
59
  "@etsoo/shared": "^1.2.75",
@@ -18,6 +18,7 @@ export * from "./org/OrgTiplist";
18
18
  // public
19
19
  export * from "./public/ButtonCultures";
20
20
  export * from "./public/ButtonCurrencies";
21
+ export * from "./public/ButtonRadioRegions";
21
22
  export * from "./public/ButtonRegions";
22
23
  export * from "./public/CultureList";
23
24
 
@@ -36,6 +36,13 @@ export function ButtonCultures(
36
36
  "ar"
37
37
  ];
38
38
 
39
+ // Add application cultures, starting from the end
40
+ for (let i = app.settings.cultures.length - 1; i >= 0; i--) {
41
+ const c = app.settings.cultures[i];
42
+ if (defaultCultures.includes(c.name)) return;
43
+ defaultCultures.unshift(c.name);
44
+ }
45
+
39
46
  defaultCultures.sort((a) => (app.culture.startsWith(a) ? -1 : 0));
40
47
 
41
48
  // Load data
@@ -0,0 +1,67 @@
1
+ import { ButtonPopupRadio, ButtonPopupRadioProps } from "@etsoo/materialui";
2
+ import { useRequiredAppContext } from "../../ICoreServiceApp";
3
+ import React from "react";
4
+ import { RegionData } from "../../dto/public/RegionData";
5
+
6
+ export function ButtonRadioRegions(
7
+ props: Omit<ButtonPopupRadioProps<RegionData>, "labelField" | "loadData">
8
+ ) {
9
+ // App
10
+ const app = useRequiredAppContext();
11
+
12
+ // Labels
13
+ const labels = app.getLabels("clickToChoose", "region");
14
+
15
+ // Destruct
16
+ const {
17
+ inputName = "region",
18
+ label = labels.region,
19
+ labelEnd = labels.clickToChoose,
20
+ ...rest
21
+ } = props;
22
+
23
+ const defaultRegions = [
24
+ "CN",
25
+ "US",
26
+ "GB",
27
+ "IE",
28
+ "CA",
29
+ "AU",
30
+ "NZ",
31
+ "DE",
32
+ "FR",
33
+ "JP",
34
+ "SG",
35
+ "HK"
36
+ ];
37
+
38
+ // Add application regions, starting from the end
39
+ for (let i = app.settings.regions.length - 1; i >= 0; i--) {
40
+ const r = app.settings.regions[i];
41
+ if (defaultRegions.includes(r)) return;
42
+ defaultRegions.unshift(r);
43
+ }
44
+
45
+ // Load data
46
+ const loadData = React.useCallback(
47
+ async () => (await app.core.publicApi.getRegions(defaultRegions)) ?? [],
48
+ []
49
+ );
50
+
51
+ return (
52
+ <ButtonPopupRadio<RegionData>
53
+ inputName={inputName}
54
+ label={label}
55
+ labelFormatter={(data) => `${data.name} (${data.id})`}
56
+ labelEnd={labelEnd}
57
+ labelField="name"
58
+ loadData={loadData}
59
+ onAdd={async (ids) => {
60
+ const data = await app.core.publicApi.getRegions(ids);
61
+ if (data == null) return false;
62
+ return data;
63
+ }}
64
+ {...rest}
65
+ />
66
+ );
67
+ }
@@ -38,6 +38,13 @@ export function ButtonRegions(
38
38
  "HK"
39
39
  ];
40
40
 
41
+ // Add application regions, starting from the end
42
+ for (let i = app.settings.regions.length - 1; i >= 0; i--) {
43
+ const r = app.settings.regions[i];
44
+ if (defaultRegions.includes(r)) return;
45
+ defaultRegions.unshift(r);
46
+ }
47
+
41
48
  // Load data
42
49
  const loadData = React.useCallback(
43
50
  async () => (await app.core.publicApi.getRegions(defaultRegions)) ?? [],
@@ -1,4 +1,4 @@
1
- import { PlaceLocation } from "./PlaceLocation";
1
+ import { PlaceLocation } from "@etsoo/appscript";
2
2
 
3
3
  /**
4
4
  * Common place
package/src/index.ts CHANGED
@@ -32,7 +32,6 @@ export * from "./dto/public/ChinaPinData";
32
32
  export * from "./dto/public/CurrencyItem";
33
33
  export * from "./dto/public/MemberInvitationDto";
34
34
  export * from "./dto/public/PlaceCommon";
35
- export * from "./dto/public/PlaceLocation";
36
35
  export * from "./dto/public/RegionData";
37
36
 
38
37
  export * from "./dto/user/AuditHistoryDto";
@@ -1,4 +1,4 @@
1
- import { PlaceLocation } from "../../dto/public/PlaceLocation";
1
+ import { PlaceLocation } from "@etsoo/appscript";
2
2
 
3
3
  /**
4
4
  * API output type
@@ -1,14 +0,0 @@
1
- /**
2
- * Place location
3
- * 地点位置
4
- */
5
- export type PlaceLocation = {
6
- /**
7
- * Latitude, 纬度
8
- */
9
- Lat: number;
10
- /**
11
- * Longitude, 经度
12
- */
13
- Lng: number;
14
- };
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,14 +0,0 @@
1
- /**
2
- * Place location
3
- * 地点位置
4
- */
5
- export type PlaceLocation = {
6
- /**
7
- * Latitude, 纬度
8
- */
9
- Lat: number;
10
- /**
11
- * Longitude, 经度
12
- */
13
- Lng: number;
14
- };
@@ -1 +0,0 @@
1
- export {};
@@ -1,15 +0,0 @@
1
- /**
2
- * Place location
3
- * 地点位置
4
- */
5
- export type PlaceLocation = {
6
- /**
7
- * Latitude, 纬度
8
- */
9
- Lat: number;
10
-
11
- /**
12
- * Longitude, 经度
13
- */
14
- Lng: number;
15
- };