@etsoo/appscript 1.2.24 → 1.2.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.
Files changed (44) hide show
  1. package/__tests__/app/CoreApp.ts +15 -0
  2. package/lib/cjs/address/AddressRegion.js +2 -2
  3. package/lib/cjs/app/CoreApp.d.ts +15 -2
  4. package/lib/cjs/app/CoreApp.js +10 -0
  5. package/lib/cjs/business/BusinessUtils.d.ts +28 -2
  6. package/lib/cjs/business/BusinessUtils.js +48 -6
  7. package/lib/cjs/business/EntityStatus.d.ts +12 -0
  8. package/lib/cjs/business/EntityStatus.js +12 -0
  9. package/lib/cjs/business/ProductUnit.d.ts +47 -45
  10. package/lib/cjs/business/ProductUnit.js +36 -48
  11. package/lib/cjs/business/RepeatOption.d.ts +56 -0
  12. package/lib/cjs/business/RepeatOption.js +60 -0
  13. package/lib/cjs/i18n/en-US.json +43 -0
  14. package/lib/cjs/i18n/zh-CN.json +44 -0
  15. package/lib/cjs/i18n/zh-HK.json +43 -0
  16. package/lib/cjs/index.d.ts +1 -0
  17. package/lib/cjs/index.js +1 -0
  18. package/lib/mjs/address/AddressRegion.js +2 -2
  19. package/lib/mjs/app/CoreApp.d.ts +15 -2
  20. package/lib/mjs/app/CoreApp.js +10 -0
  21. package/lib/mjs/business/BusinessUtils.d.ts +28 -2
  22. package/lib/mjs/business/BusinessUtils.js +48 -6
  23. package/lib/mjs/business/EntityStatus.d.ts +12 -0
  24. package/lib/mjs/business/EntityStatus.js +12 -0
  25. package/lib/mjs/business/ProductUnit.d.ts +47 -45
  26. package/lib/mjs/business/ProductUnit.js +35 -47
  27. package/lib/mjs/business/RepeatOption.d.ts +56 -0
  28. package/lib/mjs/business/RepeatOption.js +57 -0
  29. package/lib/mjs/i18n/en-US.json +43 -0
  30. package/lib/mjs/i18n/zh-CN.json +44 -0
  31. package/lib/mjs/i18n/zh-HK.json +43 -0
  32. package/lib/mjs/index.d.ts +1 -0
  33. package/lib/mjs/index.js +1 -0
  34. package/package.json +10 -10
  35. package/src/address/AddressRegion.ts +2 -2
  36. package/src/app/CoreApp.ts +20 -2
  37. package/src/business/BusinessUtils.ts +82 -7
  38. package/src/business/EntityStatus.ts +15 -0
  39. package/src/business/ProductUnit.ts +35 -51
  40. package/src/business/RepeatOption.ts +65 -0
  41. package/src/i18n/en-US.json +43 -0
  42. package/src/i18n/zh-CN.json +44 -0
  43. package/src/i18n/zh-HK.json +43 -0
  44. package/src/index.ts +1 -0
@@ -1,4 +1,5 @@
1
1
  import { DataTypes } from '@etsoo/shared';
2
+ import { RepeatOption } from '..';
2
3
  import { IdLabelDto } from '../dto/IdLabelDto';
3
4
  import { ICultureGet } from '../state/Culture';
4
5
  import { EntityStatus } from './EntityStatus';
@@ -25,9 +26,25 @@ export namespace BusinessUtils {
25
26
  return input;
26
27
  }
27
28
 
29
+ /**
30
+ * Get currency collection
31
+ * @param currencyNames Names like CNY, USD
32
+ * @param func Label delegate
33
+ * @returns Collection
34
+ */
35
+ export function getCurrencies(
36
+ currencyNames: string[],
37
+ func: ICultureGet
38
+ ): IdLabelDto<string>[] {
39
+ return currencyNames.map((name) => ({
40
+ id: name,
41
+ label: func(`currency${name}`) ?? name
42
+ }));
43
+ }
44
+
28
45
  /**
29
46
  * Get product unit's label
30
- * Please define the label in culture with key 'unitPC' for ProductUnit.PC like that
47
+ * Please define the label in culture with key 'statusNormal' for Normal status
31
48
  * @param unit Unit
32
49
  * @param func Label delegate
33
50
  * @returns Label
@@ -62,11 +79,21 @@ export namespace BusinessUtils {
62
79
  * Please define the label in culture with key 'unitPC' for ProductUnit.PC like that
63
80
  * @param unit Unit
64
81
  * @param func Label delegate
82
+ * @param isJoined Add the join label like 'per Kg' for Kg
65
83
  * @returns Label
66
84
  */
67
- export function getUnitLabel(unit: ProductUnit, func: ICultureGet) {
85
+ export function getUnitLabel(
86
+ unit: ProductUnit,
87
+ func: ICultureGet,
88
+ isJoined?: boolean
89
+ ) {
68
90
  const key = ProductUnit[unit];
69
- return func('unit' + key) ?? key;
91
+ const label = func('unit' + key) ?? key;
92
+ if (isJoined) {
93
+ const jLabel = func('unitJoin');
94
+ if (jLabel) return jLabel.format(label);
95
+ }
96
+ return label;
70
97
  }
71
98
 
72
99
  /**
@@ -74,13 +101,61 @@ export namespace BusinessUtils {
74
101
  * @param func Label delegate
75
102
  * @returns Units
76
103
  */
77
- export function getUnits(func: ICultureGet): IdLabelDto[] {
78
- return DataTypes.getEnumKeys(ProductUnit).map((key) => {
79
- const id = DataTypes.getEnumByKey(ProductUnit, key)!;
104
+ export function getUnits(func: ICultureGet): IdLabelDto[];
105
+
106
+ /**
107
+ *
108
+ * Get all product units
109
+ * @param func Label delegate
110
+ * @param options Define the order and limit the items
111
+ * @param isJoined Add the join label like 'per Kg' for Kg
112
+ * @returns Units
113
+ */
114
+ export function getUnits(
115
+ func: ICultureGet,
116
+ options?: string[],
117
+ isJoined?: boolean
118
+ ): IdLabelDto[];
119
+
120
+ /**
121
+ *
122
+ * Get all product units
123
+ * @param func Label delegate
124
+ * @param options Define the order and limit the items
125
+ * @param isJoined Add the join label like 'per Kg' for Kg
126
+ * @returns Units
127
+ */
128
+ export function getUnits(
129
+ func: ICultureGet,
130
+ options?: string[],
131
+ isJoined?: boolean
132
+ ): IdLabelDto[] {
133
+ options ??= DataTypes.getEnumKeys(ProductUnit);
134
+ return options.map((key) => {
135
+ const id = DataTypes.getEnumByKey(ProductUnit, key)! as number;
80
136
  return {
81
137
  id,
82
- label: getUnitLabel(id, func)
138
+ label: getUnitLabel(id, func, isJoined).formatInitial(true)
83
139
  };
84
140
  });
85
141
  }
142
+
143
+ /**
144
+ *
145
+ * Get all repeat options
146
+ * @param func Label delegate
147
+ * @param options Define the order and limit the items
148
+ * @param isJoined Add the join label like 'per Kg' for Kg
149
+ * @returns Units
150
+ */
151
+ export function getRepeatOptions(
152
+ func: ICultureGet,
153
+ options?: string[],
154
+ isJoined: boolean = true
155
+ ): IdLabelDto[] {
156
+ options ??= DataTypes.getEnumKeys(RepeatOption);
157
+ isJoined ??= true;
158
+
159
+ return getUnits(func, options, isJoined);
160
+ }
86
161
  }
@@ -14,11 +14,26 @@ export enum EntityStatus {
14
14
  */
15
15
  Flaged = 9,
16
16
 
17
+ /**
18
+ * Approved
19
+ */
20
+ Approved = 100,
21
+
22
+ /**
23
+ * Audited
24
+ */
25
+ Audited = 111,
26
+
17
27
  /**
18
28
  * Inactivated
19
29
  */
20
30
  Inactivated = 200,
21
31
 
32
+ /**
33
+ * Completed
34
+ */
35
+ Completed = 250,
36
+
22
37
  /**
23
38
  * Archived
24
39
  */
@@ -1,77 +1,61 @@
1
+ import { RepeatOption } from './RepeatOption';
2
+
1
3
  /**
2
- * Product units enum
3
- * See com.etsoo.CoreFramework.Business.ProductUnit
4
+ * Product base units
5
+ * 1 - 9
4
6
  */
5
- export enum ProductUnit {
7
+ export enum ProductBaseUnit {
6
8
  /**
7
9
  * Picese
8
10
  * 件
9
11
  */
10
- PC = 0,
12
+ PC = 1,
11
13
 
12
14
  /**
13
15
  * Set
14
16
  * 套
15
17
  */
16
- SET = 1,
17
-
18
- /**
19
- * Year
20
- * 年
21
- */
22
- YEAR = 10,
23
-
24
- /**
25
- * Quater
26
- * 季
27
- */
28
- QUATER = 11,
29
-
30
- /**
31
- * Month
32
- * 月
33
- */
34
- MONTH = 12,
35
-
36
- /**
37
- * Fortnight
38
- * 两周
39
- */
40
- FORNIGHT = 13,
41
-
42
- /**
43
- * Week
44
- * 周
45
- */
46
- WEEK = 14,
47
-
48
- /**
49
- * Day
50
- * 天
51
- */
52
- DAY = 15,
18
+ SET = 2
19
+ }
53
20
 
21
+ /**
22
+ * Product weight units
23
+ * Range 40 - 49
24
+ */
25
+ export enum ProductWeightUnit {
54
26
  /**
55
- * Hour
56
- * 小时
27
+ * Gram
28
+ *
57
29
  */
58
- HOUR = 16,
30
+ GRAM = 40,
59
31
 
60
32
  /**
61
- * Ton
62
- *
33
+ * Half Kg
34
+ *
63
35
  */
64
- TON = 31,
36
+ JIN = 41,
65
37
 
66
38
  /**
67
39
  * Kilogram
68
40
  * 千克
69
41
  */
70
- KILOGRAM = 32,
42
+ KILOGRAM = 42,
71
43
 
72
44
  /**
73
- * Gram
74
- *
45
+ * Ton
46
+ *
75
47
  */
76
- GRAM = 33
48
+ TON = 49
77
49
  }
50
+
51
+ /**
52
+ * Product units enum
53
+ * Repeat options take range 10 - 39
54
+ * See com.etsoo.CoreFramework.Business.ProductUnit
55
+ */
56
+ export const ProductUnit = {
57
+ ...ProductBaseUnit,
58
+ ...RepeatOption,
59
+ ...ProductWeightUnit
60
+ };
61
+ export type ProductUnit = ProductBaseUnit | RepeatOption | ProductWeightUnit;
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Repeat options
3
+ * Part of ProductUnit, range 10 - 39
4
+ */
5
+ export enum RepeatOption {
6
+ /**
7
+ * Hour
8
+ * 小时
9
+ */
10
+ HOUR = 10,
11
+
12
+ /**
13
+ * Day
14
+ * 天
15
+ */
16
+ DAY = 11,
17
+
18
+ /**
19
+ * Year
20
+ * 年
21
+ */
22
+ YEAR = 12,
23
+
24
+ /**
25
+ * Week
26
+ * 周
27
+ */
28
+ WEEK = 21,
29
+
30
+ /**
31
+ * Two weeks
32
+ * 两周
33
+ */
34
+ FORTNIGHT = 22,
35
+
36
+ /**
37
+ * Four weeks
38
+ * 四周
39
+ */
40
+ FOURWEEK = 24,
41
+
42
+ /**
43
+ * Month
44
+ * 月
45
+ */
46
+ MONTH = 31,
47
+
48
+ /**
49
+ * Two months
50
+ * 两月
51
+ */
52
+ BIMONTH = 32,
53
+
54
+ /**
55
+ * Quater(3 months)
56
+ * 季(三个月)
57
+ */
58
+ QUATER = 33,
59
+
60
+ /**
61
+ * Half a year
62
+ * 半年
63
+ */
64
+ HALFYEAR = 36
65
+ }
@@ -1,6 +1,10 @@
1
1
  {
2
+ "accountant": "Accountant",
2
3
  "actions": "Actions",
3
4
  "add": "Add",
5
+ "authorizer": "Authorizer",
6
+ "applicant": "Applicant",
7
+ "approve": "Approve it",
4
8
  "back": "Back",
5
9
  "cancel": "Cancel",
6
10
  "clear": "Clear",
@@ -11,6 +15,16 @@
11
15
  "copy": "Copy",
12
16
  "creation": "Creation",
13
17
  "currency": "Currency",
18
+ "currencyAUD": "Australia Dollar $",
19
+ "currencyCAD": "Canada Dollar $",
20
+ "currencyCNY": "Renminbi(RMB) ¥",
21
+ "currencyEUR": "Euro €",
22
+ "currencyGBP": "British Pound £",
23
+ "currencyHKD": "Hong Kong Dollar $",
24
+ "currencyJPY": "Japan Yen ¥",
25
+ "currencyNZD": "New Zealand Dollar $",
26
+ "currencySGD": "Singapore Dollar $",
27
+ "currencyUSD": "U.S. Dollar $",
14
28
  "delete": "Delete",
15
29
  "deleteConfirm": "Are you sure you want to permanently delete this {0}?",
16
30
  "description": "Description",
@@ -44,6 +58,7 @@
44
58
  "pageNotFound": "Page Not Found",
45
59
  "prompt": "Input",
46
60
  "pullToRefresh": "Pull down to refresh",
61
+ "record": "Record",
47
62
  "refresh": "Refresh",
48
63
  "refreshing": "Refreshing",
49
64
  "releaseToRefresh": "Release to refresh",
@@ -66,17 +81,45 @@
66
81
  "smartERP": "SmartERP",
67
82
  "sortTip": "Drag and drop items to sort",
68
83
  "status": "Status",
84
+ "statusApproved": "Approved",
69
85
  "statusArchived": "Archived",
86
+ "statusAudited": "Audited",
87
+ "statusCompleted": "Completed",
70
88
  "statusDeleted": "Deleted",
71
89
  "statusFlaged": "Flaged",
72
90
  "statusNormal": "Normla",
73
91
  "statusInactivated": "Inactivated",
74
92
  "submit": "Submit",
75
93
  "success": "Success",
94
+ "taxId": "Tax ID number",
95
+ "taxIdHelp": "Used for real-name authentication and invoicing",
96
+ "taxCABN": "Business number",
97
+ "taxCNUSCC": "Unified social credit code",
98
+ "taxHKBRN": "Business registration number",
99
+ "taxNZIRD": "IRD",
100
+ "taxUSEIN": "Employer identification number",
76
101
  "timeDifferenceInvalid": "The time difference between the device and the server is {0}, which exceeds the limit of {1} seconds. Please adjust the device time. If it is abnormal, please inform the administrator",
77
102
  "tokenExpiry": "Your session is about to expire. Click the Cancel button to continue",
78
103
  "yes": "Yes",
79
104
  "unknownError": "Unknown Error",
105
+ "unitJoin": "per {0}",
106
+ "unitPC": "PC",
107
+ "unitSET": "SET",
108
+ "unitHOUR": "Hour",
109
+ "unitDAY": "Day",
110
+ "unitYEAR": "Year",
111
+ "unitWEEK": "Week",
112
+ "unitFORTNIGHT": "Fortnight",
113
+ "unitFOURWEEK": "4-week",
114
+ "unitMONTH": "Month",
115
+ "unitBIMONTH": "2-month",
116
+ "unitQUATER": "Quater",
117
+ "unitHALFYEAR": "6-month",
118
+ "unitGRAM": "g",
119
+ "unitJIN": "½Kg",
120
+ "unitKILOGRAM": "Kg",
121
+ "user": "User",
122
+ "view": "View",
80
123
  "warning": "Warning",
81
124
  "welcome": "{0}, welcome!"
82
125
  }
@@ -1,6 +1,10 @@
1
1
  {
2
+ "accountant": "会计",
2
3
  "actions": "操作",
3
4
  "add": "添加",
5
+ "authorizer": "授权人",
6
+ "applicant": "申请人",
7
+ "approve": "批准",
4
8
  "back": "后退",
5
9
  "cancel": "取消",
6
10
  "clear": "清除",
@@ -11,6 +15,16 @@
11
15
  "copy": "复制",
12
16
  "creation": "登记时间",
13
17
  "currency": "币种",
18
+ "currencyAUD": "澳元$",
19
+ "currencyCAD": "加元$",
20
+ "currencyCNY": "人民币¥",
21
+ "currencyEUR": "欧元€",
22
+ "currencyGBP": "英镑£",
23
+ "currencyHKD": "港币$",
24
+ "currencyJPY": "日元¥",
25
+ "currencyNZD": "纽币$",
26
+ "currencySGD": "新币$",
27
+ "currencyUSD": "美元$",
14
28
  "delete": "删除",
15
29
  "deleteConfirm": "确定要永久删除此{0}吗?",
16
30
  "description": "描述",
@@ -44,6 +58,7 @@
44
58
  "pageNotFound": "找不到页面",
45
59
  "prompt": "输入",
46
60
  "pullToRefresh": "下拉刷新",
61
+ "record": "记录",
47
62
  "refresh": "刷新",
48
63
  "refreshing": "正在刷新",
49
64
  "releaseToRefresh": "释放刷新",
@@ -66,17 +81,46 @@
66
81
  "smartERP": "司友云ERP",
67
82
  "sortTip": "拖拽项目进行排序",
68
83
  "status": "状态",
84
+ "statusApproved": "已批准",
69
85
  "statusArchived": "已归档",
86
+ "statusAudited": "已审核",
87
+ "statusCompleted": "已完成",
70
88
  "statusDeleted": "已删除",
71
89
  "statusFlaged": "已标记",
72
90
  "statusNormal": "正常",
73
91
  "statusInactivated": "已停用",
74
92
  "submit": "提交",
75
93
  "success": "成功",
94
+ "taxId": "税号",
95
+ "taxIdHelp": "用于实名认证和开具发票",
96
+ "taxCABN": "营业编号(BN)",
97
+ "taxCNUSCC": "统一信用代码",
98
+ "taxHKBRN": "商业登记号码(BRN)",
99
+ "taxNZIRD": "IRD",
100
+ "taxUSEIN": "雇主识别号码(EIN)",
76
101
  "timeDifferenceInvalid": "设备时间和服务器时间差为{0},超过{1}秒的限制,请调整设备时间,如果异常请告知管理员",
77
102
  "tokenExpiry": "您的会话即将过期。点击 取消 按钮继续使用",
78
103
  "yes": "是",
79
104
  "unknownError": "未知错误",
105
+ "unitJoin": "每{0}",
106
+ "unitPC": "件",
107
+ "unitSET": "套",
108
+ "unitHOUR": "小时",
109
+ "unitDAY": "天",
110
+ "unitYEAR": "年",
111
+ "unitWEEK": "周",
112
+ "unitFORTNIGHT": "两周",
113
+ "unitFOURWEEK": "四周",
114
+ "unitMONTH": "月",
115
+ "unitBIMONTH": "两月",
116
+ "unitQUATER": "季度",
117
+ "unitHALFYEAR": "半年",
118
+ "unitGRAM": "克",
119
+ "unitJIN": "斤",
120
+ "unitKILOGRAM": "公斤",
121
+ "unitTON": "吨",
122
+ "user": "用户",
123
+ "view": "查看",
80
124
  "warning": "警告",
81
125
  "welcome": "{0}, 欢迎光临!"
82
126
  }
@@ -1,6 +1,10 @@
1
1
  {
2
+ "accountant": "會計",
2
3
  "actions": "操作",
3
4
  "add": "添加",
5
+ "authorizer": "授權人",
6
+ "applicant": "申請人",
7
+ "approve": "批准",
4
8
  "back": "後退",
5
9
  "cancel": "取消",
6
10
  "clear": "清除",
@@ -11,6 +15,16 @@
11
15
  "copy": "複製",
12
16
  "creation": "登記時間",
13
17
  "currency": "幣種",
18
+ "currencyAUD": "澳元$",
19
+ "currencyCAD": "加元$",
20
+ "currencyCNY": "人民幣¥",
21
+ "currencyEUR": "歐元€",
22
+ "currencyGBP": "英鎊£",
23
+ "currencyHKD": "港幣$",
24
+ "currencyJPY": "日元¥",
25
+ "currencyNZD": "紐幣$",
26
+ "currencySGD": "新幣$",
27
+ "currencyUSD": "美元$",
14
28
  "delete": "刪除",
15
29
  "deleteConfirm": "確定要永久刪除此{0}嗎?",
16
30
  "description": "描述",
@@ -44,6 +58,7 @@
44
58
  "pageNotFound": "找不到頁面",
45
59
  "prompt": "輸入",
46
60
  "pullToRefresh": "下拉刷新",
61
+ "record": "記錄",
47
62
  "refresh": "刷新",
48
63
  "refreshing": "正在刷新",
49
64
  "releaseToRefresh": "釋放刷新",
@@ -66,17 +81,45 @@
66
81
  "smartERP": "司友雲ERP",
67
82
  "sortTip": "拖拽項目進行排序",
68
83
  "status": "狀態",
84
+ "statusApproved": "已批准",
69
85
  "statusArchived": "已歸檔",
86
+ "statusAudited": "已審核",
87
+ "statusCompleted": "已完成",
70
88
  "statusDeleted": "已刪除",
71
89
  "statusFlaged": "已標記",
72
90
  "statusNormal": "正常",
73
91
  "statusInactivated": "已停用",
74
92
  "submit": "提交",
75
93
  "success": "成功",
94
+ "taxId": "稅號",
95
+ "taxIdHelp": "用於實名認證和開具發票",
96
+ "taxCABN": "營業編號(BN)",
97
+ "taxCNUSCC": "統一信用代碼",
98
+ "taxHKBRN": "商業登記號碼(BRN)",
99
+ "taxNZIRD": "IRD",
100
+ "taxUSEIN": "雇主識別號碼(EIN)",
76
101
  "timeDifferenceInvalid": "設備時間和服務器時間差為{0},超過{1}秒的限制,請調整設備時間,如果異常請告知管理員",
77
102
  "tokenExpiry": "您的會話即將過期。點擊 取消 按鈕繼續使用",
78
103
  "yes": "是",
79
104
  "unknownError": "未知錯誤",
105
+ "unitJoin": "每{0}",
106
+ "unitPC": "件",
107
+ "unitSET": "套",
108
+ "unitHOUR": "小時",
109
+ "unitDAY": "天",
110
+ "unitYEAR": "年",
111
+ "unitWEEK": "週",
112
+ "unitFORTNIGHT": "兩週",
113
+ "unitFOURWEEK": "四周",
114
+ "unitMONTH": "月",
115
+ "unitBIMONTH": "兩月",
116
+ "unitQUATER": "季度",
117
+ "unitHALFYEAR": "半年",
118
+ "unitGRAM": "克",
119
+ "unitJIN": "斤",
120
+ "unitKILOGRAM": "公斤",
121
+ "user": "用戶",
122
+ "view": "查看",
80
123
  "warning": "警告",
81
124
  "welcome": "{0}, 歡迎光臨!"
82
125
  }
package/src/index.ts CHANGED
@@ -19,6 +19,7 @@ export * from './business/BusinessTax';
19
19
  export * from './business/BusinessUtils';
20
20
  export * from './business/EntityStatus';
21
21
  export * from './business/ProductUnit';
22
+ export * from './business/RepeatOption';
22
23
 
23
24
  // def
24
25
  export * from './def/ListItem';