@etsoo/smarterp-core 1.1.59 → 1.1.61

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 (62) hide show
  1. package/__tests__/OrgApi.ts +48 -7
  2. package/__tests__/tsconfig.json +1 -1
  3. package/lib/cjs/CoreApp.d.ts +43 -0
  4. package/lib/cjs/CoreApp.js +34 -0
  5. package/lib/cjs/OrgApi.d.ts +9 -0
  6. package/lib/cjs/OrgApi.js +9 -0
  7. package/lib/cjs/PublicApi.d.ts +9 -0
  8. package/lib/cjs/PublicApi.js +10 -1
  9. package/lib/cjs/components/index.d.ts +1 -0
  10. package/lib/cjs/components/index.js +1 -0
  11. package/lib/cjs/components/public/TimeZoneList.d.ts +33 -0
  12. package/lib/cjs/components/public/TimeZoneList.js +27 -0
  13. package/lib/cjs/dto/org/OrgReportData.d.ts +38 -0
  14. package/lib/cjs/dto/org/OrgReportData.js +2 -0
  15. package/lib/cjs/dto/public/TimeZoneItem.d.ts +22 -0
  16. package/lib/cjs/dto/public/TimeZoneItem.js +2 -0
  17. package/lib/cjs/i18n/en.json +5 -1
  18. package/lib/cjs/i18n/zh-Hans.json +5 -1
  19. package/lib/cjs/i18n/zh-Hant.json +5 -1
  20. package/lib/cjs/index.d.ts +4 -0
  21. package/lib/cjs/index.js +4 -0
  22. package/lib/cjs/rq/org/OrgUsageReportRQ.d.ts +21 -0
  23. package/lib/cjs/rq/org/OrgUsageReportRQ.js +2 -0
  24. package/lib/cjs/rq/public/TimeZoneRQ.d.ts +14 -0
  25. package/lib/cjs/rq/public/TimeZoneRQ.js +2 -0
  26. package/lib/mjs/CoreApp.d.ts +43 -0
  27. package/lib/mjs/CoreApp.js +36 -2
  28. package/lib/mjs/OrgApi.d.ts +9 -0
  29. package/lib/mjs/OrgApi.js +9 -0
  30. package/lib/mjs/PublicApi.d.ts +9 -0
  31. package/lib/mjs/PublicApi.js +10 -1
  32. package/lib/mjs/components/index.d.ts +1 -0
  33. package/lib/mjs/components/index.js +1 -0
  34. package/lib/mjs/components/public/TimeZoneList.d.ts +33 -0
  35. package/lib/mjs/components/public/TimeZoneList.js +24 -0
  36. package/lib/mjs/dto/org/OrgReportData.d.ts +38 -0
  37. package/lib/mjs/dto/org/OrgReportData.js +1 -0
  38. package/lib/mjs/dto/public/TimeZoneItem.d.ts +22 -0
  39. package/lib/mjs/dto/public/TimeZoneItem.js +1 -0
  40. package/lib/mjs/i18n/en.json +5 -1
  41. package/lib/mjs/i18n/zh-Hans.json +5 -1
  42. package/lib/mjs/i18n/zh-Hant.json +5 -1
  43. package/lib/mjs/index.d.ts +4 -0
  44. package/lib/mjs/index.js +4 -0
  45. package/lib/mjs/rq/org/OrgUsageReportRQ.d.ts +21 -0
  46. package/lib/mjs/rq/org/OrgUsageReportRQ.js +1 -0
  47. package/lib/mjs/rq/public/TimeZoneRQ.d.ts +14 -0
  48. package/lib/mjs/rq/public/TimeZoneRQ.js +1 -0
  49. package/package.json +8 -8
  50. package/src/CoreApp.ts +78 -1
  51. package/src/OrgApi.ts +12 -0
  52. package/src/PublicApi.ts +15 -3
  53. package/src/components/index.ts +1 -0
  54. package/src/components/public/TimeZoneList.tsx +82 -0
  55. package/src/dto/org/OrgReportData.ts +41 -0
  56. package/src/dto/public/TimeZoneItem.ts +25 -0
  57. package/src/i18n/en.json +5 -1
  58. package/src/i18n/zh-Hans.json +5 -1
  59. package/src/i18n/zh-Hant.json +5 -1
  60. package/src/index.ts +4 -0
  61. package/src/rq/org/OrgUsageReportRQ.ts +23 -0
  62. package/src/rq/public/TimeZoneRQ.ts +16 -0
package/src/PublicApi.ts CHANGED
@@ -22,6 +22,8 @@ import { AcceptInvitationRQ } from "./rq/public/AcceptInvitationRQ";
22
22
  import { ChinaPinData } from "./dto/public/ChinaPinData";
23
23
  import { ParseNameRQ } from "./rq/public/ParseNameRQ";
24
24
  import { NameData } from "./dto/public/NameData";
25
+ import { TimeZoneItem } from "./dto/public/TimeZoneItem";
26
+ import { TimeZoneRQ } from "./rq/public/TimeZoneRQ";
25
27
 
26
28
  const unitPrefix = "unit";
27
29
 
@@ -132,6 +134,16 @@ export class PublicApi extends BaseApi {
132
134
  });
133
135
  }
134
136
 
137
+ /**
138
+ * Get time zones
139
+ * @param rq Request data
140
+ * @param payload Payload
141
+ * @returns Result
142
+ */
143
+ getTimeZones(rq?: TimeZoneRQ, payload?: IApiPayload<TimeZoneItem[]>) {
144
+ return this.api.post("Public/GetTimeZones", rq, payload);
145
+ }
146
+
135
147
  /**
136
148
  * Get product unit's label
137
149
  * Please define the label in culture with key 'unitPC' for ProductUnit.PC like that
@@ -151,10 +163,10 @@ export class PublicApi extends BaseApi {
151
163
 
152
164
  private getUnitJoin(isJoined: boolean | string | undefined) {
153
165
  return typeof isJoined === "string"
154
- ? this.app.get(isJoined) ?? isJoined
166
+ ? (this.app.get(isJoined) ?? isJoined)
155
167
  : isJoined
156
- ? this.app.get("unitJoin")
157
- : undefined;
168
+ ? this.app.get("unitJoin")
169
+ : undefined;
158
170
  }
159
171
 
160
172
  /**
@@ -27,6 +27,7 @@ export * from "./public/ButtonRadioRegions";
27
27
  export * from "./public/ButtonRegions";
28
28
  export * from "./public/CultureList";
29
29
  export * from "./public/ProductBaseUnits";
30
+ export * from "./public/TimeZoneList";
30
31
 
31
32
  // user
32
33
  export * from "./user/UserTiplist";
@@ -0,0 +1,82 @@
1
+ import { Tiplist, TiplistProps } from "@etsoo/materialui";
2
+ import { useRequiredAppContext } from "../../ICoreServiceApp";
3
+ import { TimeZoneItem } from "../../dto/public/TimeZoneItem";
4
+ import { TimeZoneRQ } from "../../rq/public/TimeZoneRQ";
5
+
6
+ /**
7
+ * Time zone tiplist properties
8
+ * 时区提示列表属性
9
+ */
10
+ export type TimeZoneTiplistProps = Omit<
11
+ TiplistProps<TimeZoneItem, "id">,
12
+ "loadData" | "label" | "name"
13
+ > & {
14
+ /**
15
+ * Label
16
+ */
17
+ label?: string;
18
+
19
+ /**
20
+ * Name
21
+ */
22
+ name?: string;
23
+
24
+ /**
25
+ * Default request data
26
+ */
27
+ rq?: Partial<TimeZoneRQ>;
28
+
29
+ /**
30
+ * Load data handler
31
+ * @param rq Request data
32
+ */
33
+ onLoadData?: (rq: TimeZoneRQ) => TimeZoneRQ;
34
+ };
35
+
36
+ /**
37
+ * Time zone tiplist
38
+ * 时区提示列表
39
+ * @param props Properties
40
+ * @returns Component
41
+ */
42
+ export function TimeZoneTiplist(props: TimeZoneTiplistProps) {
43
+ // App
44
+ const app = useRequiredAppContext();
45
+
46
+ // Destruct
47
+ const {
48
+ fullWidth = true,
49
+ label = app.get("timeZone")!,
50
+ maxItems = 10,
51
+ getOptionLabel = (data) => data.displayName,
52
+ onLoadData = (rq) => rq,
53
+ name = "timeZone",
54
+ rq = { enabled: true },
55
+ ...rest
56
+ } = props;
57
+
58
+ // Layout
59
+ return (
60
+ <Tiplist<TimeZoneItem, "id">
61
+ label={label}
62
+ getOptionLabel={getOptionLabel}
63
+ name={name}
64
+ fullWidth={fullWidth}
65
+ maxItems={maxItems}
66
+ loadData={(keyword, id, maxItems) =>
67
+ app.core.publicApi.getTimeZones(
68
+ onLoadData({
69
+ ...rq,
70
+ keyword,
71
+ id,
72
+ queryPaging: {
73
+ batchSize: maxItems
74
+ }
75
+ }),
76
+ { showLoading: false, defaultValue: [] }
77
+ )
78
+ }
79
+ {...rest}
80
+ />
81
+ );
82
+ }
@@ -0,0 +1,41 @@
1
+ /**
2
+ * Organization usage report data
3
+ * 机构使用报告数据
4
+ */
5
+ type OrgUsageReportData = {
6
+ /**
7
+ * Period
8
+ * 周期
9
+ */
10
+ period: number;
11
+
12
+ /**
13
+ * Qty.
14
+ * 数量
15
+ */
16
+ qty: number;
17
+ };
18
+
19
+ /**
20
+ * Organization amount report data
21
+ * 机构金额报告数据
22
+ */
23
+ type OrgAmountReportData = {
24
+ /**
25
+ * Period
26
+ * 周期
27
+ */
28
+ period: number;
29
+
30
+ /**
31
+ * Amount
32
+ * 金额
33
+ */
34
+ amount: number;
35
+ };
36
+
37
+ /**
38
+ * Organization report data
39
+ * 机构报告数据
40
+ */
41
+ export type OrgReportData = OrgUsageReportData | OrgAmountReportData;
@@ -0,0 +1,25 @@
1
+ export type TimeZoneItem = {
2
+ /**
3
+ * IANA Id
4
+ * IANA 编号
5
+ */
6
+ id: string;
7
+
8
+ /**
9
+ * Display name
10
+ * 显示名称
11
+ */
12
+ displayName: string;
13
+
14
+ /**
15
+ * Standard name
16
+ * 标准名称
17
+ */
18
+ standardName: string;
19
+
20
+ /**
21
+ * UTC offset
22
+ * UTC偏移
23
+ */
24
+ utcOffset: string;
25
+ };
package/src/i18n/en.json CHANGED
@@ -106,6 +106,7 @@
106
106
  "roleOperator": "Operator",
107
107
  "rolePartner": "Channel Partner",
108
108
  "roleUser": "User",
109
+ "samePeriodLastYear": "Same period last year",
109
110
  "slogan": "Slogan",
110
111
  "smarterp": "SmartERP Cloud",
111
112
  "signin": "Sign in",
@@ -132,6 +133,7 @@
132
133
  "templateCMSPODATA": "CMS PO data",
133
134
  "templateCMSSTOCKDATA": "CMS stock data",
134
135
  "templateKind": "Template kind",
136
+ "timeZone": "Time zone",
135
137
  "years5": ["1 year", "2 years", "3 years", "4 years", "5 years"],
136
138
  "uiTypeEmail": "Email",
137
139
  "uiTypeMobile": "Mobile",
@@ -139,5 +141,7 @@
139
141
  "uiTypeAlipay": "Alipay",
140
142
  "uiTypeGoogle": "Google",
141
143
  "uiTypeMicrosoft": "Microsoft",
142
- "updatedAt": "Updated at"
144
+ "updatedAt": "Updated at",
145
+ "usage": "Usage",
146
+ "usageReport": "Usage report"
143
147
  }
@@ -106,6 +106,7 @@
106
106
  "roleOperator": "操作员",
107
107
  "rolePartner": "渠道伙伴",
108
108
  "roleUser": "用户",
109
+ "samePeriodLastYear": "去年同期",
109
110
  "slogan": "标语",
110
111
  "smarterp": "司友®云ERP",
111
112
  "signin": "登录",
@@ -132,6 +133,7 @@
132
133
  "templateCMSPODATA": "CMS采购数据",
133
134
  "templateCMSSTOCKDATA": "CMS库存数据",
134
135
  "templateKind": "模板类型",
136
+ "timeZone": "时区",
135
137
  "years5": ["1年", "2年", "3年", "4年", "5年"],
136
138
  "uiTypeEmail": "电子邮箱",
137
139
  "uiTypeMobile": "手机号",
@@ -139,5 +141,7 @@
139
141
  "uiTypeAlipay": "支付宝",
140
142
  "uiTypeGoogle": "谷歌",
141
143
  "uiTypeMicrosoft": "微软",
142
- "updatedAt": "更新时间"
144
+ "updatedAt": "更新时间",
145
+ "usage": "使用量",
146
+ "usageReport": "使用情况报告"
143
147
  }
@@ -106,6 +106,7 @@
106
106
  "roleOperator": "操作員",
107
107
  "rolePartner": "渠道夥伴",
108
108
  "roleUser": "用戶",
109
+ "samePeriodLastYear": "去年同期",
109
110
  "signin": "登入",
110
111
  "signout": "登出",
111
112
  "slogan": "標語",
@@ -132,6 +133,7 @@
132
133
  "templateCMSPODATA": "CMS採購數據",
133
134
  "templateCMSSTOCKDATA": "CMS庫存數據",
134
135
  "templateKind": "模板類型",
136
+ "timeZone": "時區",
135
137
  "years5": ["1年", "2年", "3年", "4年", "5年"],
136
138
  "uiTypeEmail": "電子郵件",
137
139
  "uiTypeMobile": "手機號碼",
@@ -139,5 +141,7 @@
139
141
  "uiTypeAlipay": "支付寶",
140
142
  "uiTypeGoogle": "谷歌",
141
143
  "uiTypeMicrosoft": "微軟",
142
- "updatedAt": "更新時間"
144
+ "updatedAt": "更新時間",
145
+ "usage": "使用量",
146
+ "usageReport": "使用情況報告"
143
147
  }
package/src/index.ts CHANGED
@@ -27,6 +27,7 @@ export * from "./dto/org/OrgQueryApiData";
27
27
  export * from "./dto/org/OrgQueryDto";
28
28
  export * from "./dto/org/OrgQueryResourceData";
29
29
  export * from "./dto/org/OrgReadDto";
30
+ export * from "./dto/org/OrgReportData";
30
31
  export * from "./dto/org/OrgResourceItem";
31
32
  export * from "./dto/org/OrgUpdateApiReadDto";
32
33
  export * from "./dto/org/OrgUpdateReadDto";
@@ -39,6 +40,7 @@ export * from "./dto/public/MemberInvitationDto";
39
40
  export * from "./dto/public/NameData";
40
41
  export * from "./dto/public/PlaceCommon";
41
42
  export * from "./dto/public/RegionData";
43
+ export * from "./dto/public/TimeZoneItem";
42
44
 
43
45
  export * from "./dto/user/AuditHistoryDto";
44
46
  export * from "./dto/user/DeviceListDto";
@@ -83,6 +85,7 @@ export * from "./rq/org/OrgQueryApiRQ";
83
85
  export * from "./rq/org/OrgQueryResourceRQ";
84
86
  export * from "./rq/org/OrgQueryRQ";
85
87
  export * from "./rq/org/OrgUpdateApiRQ";
88
+ export * from "./rq/org/OrgUsageReportRQ";
86
89
  export * from "./rq/org/OrgUpdateRQ";
87
90
  export * from "./rq/org/SendEmailMessage";
88
91
  export * from "./rq/org/SendProfileEmailRQ";
@@ -93,6 +96,7 @@ export * from "./rq/public/CreateBarcodeRQ";
93
96
  export * from "./rq/public/ParseNameRQ";
94
97
  export * from "./rq/public/PinyinRQ";
95
98
  export * from "./rq/public/PlaceQueryRQ";
99
+ export * from "./rq/public/TimeZoneRQ";
96
100
 
97
101
  export * from "./rq/user/AuditHistoryRQ";
98
102
  export * from "./rq/user/UserUpdateRQ";
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Organization usage report request data
3
+ * 机构使用报告请求数据
4
+ */
5
+ export type OrgUsageReportRQ = {
6
+ /**
7
+ * Organization id
8
+ * 机构编号
9
+ */
10
+ orgId?: number;
11
+
12
+ /**
13
+ * Year
14
+ * 年
15
+ */
16
+ year?: number;
17
+
18
+ /**
19
+ * Whether to include last year data
20
+ * 是否包含去年数据
21
+ */
22
+ hasLastYear?: boolean;
23
+ };
@@ -0,0 +1,16 @@
1
+ import { QueryRQ } from "@etsoo/appscript";
2
+
3
+ export type TimeZoneRQ = QueryRQ<string> & {
4
+ /**
5
+ * Culture, like "en-US", "zh-CN", etc.
6
+ * If not specified, the current culture will be used.
7
+ * 文化
8
+ */
9
+ culture?: string;
10
+
11
+ /**
12
+ * All system timezones
13
+ * 所有系统时区
14
+ */
15
+ all?: boolean;
16
+ };