@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,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
  }
@@ -12,6 +12,7 @@ export * from './business/BusinessTax';
12
12
  export * from './business/BusinessUtils';
13
13
  export * from './business/EntityStatus';
14
14
  export * from './business/ProductUnit';
15
+ export * from './business/RepeatOption';
15
16
  export * from './def/ListItem';
16
17
  export * from './dto/IdDto';
17
18
  export * from './dto/IdLabelDto';
package/lib/cjs/index.js CHANGED
@@ -29,6 +29,7 @@ __exportStar(require("./business/BusinessTax"), exports);
29
29
  __exportStar(require("./business/BusinessUtils"), exports);
30
30
  __exportStar(require("./business/EntityStatus"), exports);
31
31
  __exportStar(require("./business/ProductUnit"), exports);
32
+ __exportStar(require("./business/RepeatOption"), exports);
32
33
  // def
33
34
  __exportStar(require("./def/ListItem"), exports);
34
35
  // dto
@@ -51,7 +51,7 @@ AddressRegion.US = new AddressRegion('US', 'USA', '840', AddressContinent.NA, '0
51
51
  * CA - Canada
52
52
  * 加拿大
53
53
  */
54
- AddressRegion.CA = new AddressRegion('CA', 'CAN', '124', AddressContinent.NA, '011', '1', 'USD', ['en-CA', 'fr-CA']);
54
+ AddressRegion.CA = new AddressRegion('CA', 'CAN', '124', AddressContinent.NA, '011', '1', 'CAD', ['en-CA', 'fr-CA']);
55
55
  /**
56
56
  * AU - Australia
57
57
  * 澳大利亚
@@ -71,7 +71,7 @@ AddressRegion.GB = new AddressRegion('GB', 'GBR', '826', AddressContinent.EU, '0
71
71
  * IE - Ireland
72
72
  * 爱尔兰
73
73
  */
74
- AddressRegion.IE = new AddressRegion('IE', 'IRL', '372', AddressContinent.EU, '00', '353', 'IEP', ['en-IE']);
74
+ AddressRegion.IE = new AddressRegion('IE', 'IRL', '372', AddressContinent.EU, '00', '353', 'EUR', ['en-IE']);
75
75
  /**
76
76
  * DE - Germany
77
77
  * 德国
@@ -2,6 +2,7 @@ import { INotifier, NotificationAlign, NotificationCallProps, NotificationConten
2
2
  import { ApiDataError, IApi, IPData } from '@etsoo/restclient';
3
3
  import { DataTypes, DateUtils, IStorage } from '@etsoo/shared';
4
4
  import { AddressRegion } from '../address/AddressRegion';
5
+ import { ProductUnit } from '../business/ProductUnit';
5
6
  import { IdLabelDto } from '../dto/IdLabelDto';
6
7
  import { InitCallDto } from '../dto/InitCallDto';
7
8
  import { IActionResult } from '../result/IActionResult';
@@ -238,7 +239,7 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
238
239
  */
239
240
  getEntityStatusLabel<D extends {
240
241
  entityStatus?: number;
241
- }>(data: D): string;
242
+ }>(data?: D): string;
242
243
  /**
243
244
  * Get all regions
244
245
  * @returns Regions
@@ -255,6 +256,12 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
255
256
  * @returns Time zone
256
257
  */
257
258
  getTimeZone(): string | undefined;
259
+ /**
260
+ * Get product unit and repeat option label
261
+ * @param unit Product unit or repeat option
262
+ * @param isJoined Add the join label like 'per Kg' for Kg
263
+ */
264
+ getUnitLabel(unit?: ProductUnit, isJoined?: boolean): string;
258
265
  /**
259
266
  * Hash message, SHA3 or HmacSHA512, 512 as Base64
260
267
  * https://cryptojs.gitbook.io/docs/
@@ -634,7 +641,7 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
634
641
  */
635
642
  getEntityStatusLabel<D extends {
636
643
  entityStatus?: number;
637
- }>(data: D): string;
644
+ }>(data?: D): string;
638
645
  /**
639
646
  * Get refresh token from response headers
640
647
  * @param rawResponse Raw response from API call
@@ -646,6 +653,12 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
646
653
  * @returns Time zone
647
654
  */
648
655
  getTimeZone(): string | undefined;
656
+ /**
657
+ * Get product unit and repeat option label
658
+ * @param unit Product unit or repeat option
659
+ * @param isJoined Add the join label like 'per Kg' for Kg
660
+ */
661
+ getUnitLabel(unit?: ProductUnit, isJoined?: boolean): string;
649
662
  /**
650
663
  * Hash message, SHA3 or HmacSHA512, 512 as Base64
651
664
  * https://cryptojs.gitbook.io/docs/
@@ -740,6 +740,16 @@ export class CoreApp {
740
740
  // settings.timeZone = Utils.getTimeZone()
741
741
  return (_a = this.settings.timeZone) !== null && _a !== void 0 ? _a : (_b = this.ipData) === null || _b === void 0 ? void 0 : _b.timezone;
742
742
  }
743
+ /**
744
+ * Get product unit and repeat option label
745
+ * @param unit Product unit or repeat option
746
+ * @param isJoined Add the join label like 'per Kg' for Kg
747
+ */
748
+ getUnitLabel(unit, isJoined) {
749
+ if (unit == null)
750
+ return '';
751
+ return BusinessUtils.getUnitLabel(unit, this.labelDelegate, isJoined);
752
+ }
743
753
  /**
744
754
  * Hash message, SHA3 or HmacSHA512, 512 as Base64
745
755
  * https://cryptojs.gitbook.io/docs/
@@ -14,9 +14,16 @@ export declare namespace BusinessUtils {
14
14
  * @returns Items with blank item
15
15
  */
16
16
  function addIdLabelBlankItem<T extends DataTypes.IdType = number>(input: IdLabelDto<T>[], copy?: boolean): IdLabelDto<T>[];
17
+ /**
18
+ * Get currency collection
19
+ * @param currencyNames Names like CNY, USD
20
+ * @param func Label delegate
21
+ * @returns Collection
22
+ */
23
+ function getCurrencies(currencyNames: string[], func: ICultureGet): IdLabelDto<string>[];
17
24
  /**
18
25
  * Get product unit's label
19
- * Please define the label in culture with key 'unitPC' for ProductUnit.PC like that
26
+ * Please define the label in culture with key 'statusNormal' for Normal status
20
27
  * @param unit Unit
21
28
  * @param func Label delegate
22
29
  * @returns Label
@@ -38,13 +45,32 @@ export declare namespace BusinessUtils {
38
45
  * Please define the label in culture with key 'unitPC' for ProductUnit.PC like that
39
46
  * @param unit Unit
40
47
  * @param func Label delegate
48
+ * @param isJoined Add the join label like 'per Kg' for Kg
41
49
  * @returns Label
42
50
  */
43
- function getUnitLabel(unit: ProductUnit, func: ICultureGet): string;
51
+ function getUnitLabel(unit: ProductUnit, func: ICultureGet, isJoined?: boolean): string;
44
52
  /**
45
53
  * Get all product units
46
54
  * @param func Label delegate
47
55
  * @returns Units
48
56
  */
49
57
  function getUnits(func: ICultureGet): IdLabelDto[];
58
+ /**
59
+ *
60
+ * Get all product units
61
+ * @param func Label delegate
62
+ * @param options Define the order and limit the items
63
+ * @param isJoined Add the join label like 'per Kg' for Kg
64
+ * @returns Units
65
+ */
66
+ function getUnits(func: ICultureGet, options?: string[], isJoined?: boolean): IdLabelDto[];
67
+ /**
68
+ *
69
+ * Get all repeat options
70
+ * @param func Label delegate
71
+ * @param options Define the order and limit the items
72
+ * @param isJoined Add the join label like 'per Kg' for Kg
73
+ * @returns Units
74
+ */
75
+ function getRepeatOptions(func: ICultureGet, options?: string[], isJoined?: boolean): IdLabelDto[];
50
76
  }
@@ -1,4 +1,5 @@
1
1
  import { DataTypes } from '@etsoo/shared';
2
+ import { RepeatOption } from '..';
2
3
  import { EntityStatus } from './EntityStatus';
3
4
  import { ProductUnit } from './ProductUnit';
4
5
  /**
@@ -20,9 +21,25 @@ export var BusinessUtils;
20
21
  return input;
21
22
  }
22
23
  BusinessUtils.addIdLabelBlankItem = addIdLabelBlankItem;
24
+ /**
25
+ * Get currency collection
26
+ * @param currencyNames Names like CNY, USD
27
+ * @param func Label delegate
28
+ * @returns Collection
29
+ */
30
+ function getCurrencies(currencyNames, func) {
31
+ return currencyNames.map((name) => {
32
+ var _a;
33
+ return ({
34
+ id: name,
35
+ label: (_a = func(`currency${name}`)) !== null && _a !== void 0 ? _a : name
36
+ });
37
+ });
38
+ }
39
+ BusinessUtils.getCurrencies = getCurrencies;
23
40
  /**
24
41
  * Get product unit's label
25
- * Please define the label in culture with key 'unitPC' for ProductUnit.PC like that
42
+ * Please define the label in culture with key 'statusNormal' for Normal status
26
43
  * @param unit Unit
27
44
  * @param func Label delegate
28
45
  * @returns Label
@@ -55,27 +72,52 @@ export var BusinessUtils;
55
72
  * Please define the label in culture with key 'unitPC' for ProductUnit.PC like that
56
73
  * @param unit Unit
57
74
  * @param func Label delegate
75
+ * @param isJoined Add the join label like 'per Kg' for Kg
58
76
  * @returns Label
59
77
  */
60
- function getUnitLabel(unit, func) {
78
+ function getUnitLabel(unit, func, isJoined) {
61
79
  var _a;
62
80
  const key = ProductUnit[unit];
63
- return (_a = func('unit' + key)) !== null && _a !== void 0 ? _a : key;
81
+ const label = (_a = func('unit' + key)) !== null && _a !== void 0 ? _a : key;
82
+ if (isJoined) {
83
+ const jLabel = func('unitJoin');
84
+ if (jLabel)
85
+ return jLabel.format(label);
86
+ }
87
+ return label;
64
88
  }
65
89
  BusinessUtils.getUnitLabel = getUnitLabel;
66
90
  /**
91
+ *
67
92
  * Get all product units
68
93
  * @param func Label delegate
94
+ * @param options Define the order and limit the items
95
+ * @param isJoined Add the join label like 'per Kg' for Kg
69
96
  * @returns Units
70
97
  */
71
- function getUnits(func) {
72
- return DataTypes.getEnumKeys(ProductUnit).map((key) => {
98
+ function getUnits(func, options, isJoined) {
99
+ options !== null && options !== void 0 ? options : (options = DataTypes.getEnumKeys(ProductUnit));
100
+ return options.map((key) => {
73
101
  const id = DataTypes.getEnumByKey(ProductUnit, key);
74
102
  return {
75
103
  id,
76
- label: getUnitLabel(id, func)
104
+ label: getUnitLabel(id, func, isJoined).formatInitial(true)
77
105
  };
78
106
  });
79
107
  }
80
108
  BusinessUtils.getUnits = getUnits;
109
+ /**
110
+ *
111
+ * Get all repeat options
112
+ * @param func Label delegate
113
+ * @param options Define the order and limit the items
114
+ * @param isJoined Add the join label like 'per Kg' for Kg
115
+ * @returns Units
116
+ */
117
+ function getRepeatOptions(func, options, isJoined = true) {
118
+ options !== null && options !== void 0 ? options : (options = DataTypes.getEnumKeys(RepeatOption));
119
+ isJoined !== null && isJoined !== void 0 ? isJoined : (isJoined = true);
120
+ return getUnits(func, options, isJoined);
121
+ }
122
+ BusinessUtils.getRepeatOptions = getRepeatOptions;
81
123
  })(BusinessUtils || (BusinessUtils = {}));
@@ -12,10 +12,22 @@ export declare enum EntityStatus {
12
12
  * Flaged
13
13
  */
14
14
  Flaged = 9,
15
+ /**
16
+ * Approved
17
+ */
18
+ Approved = 100,
19
+ /**
20
+ * Audited
21
+ */
22
+ Audited = 111,
15
23
  /**
16
24
  * Inactivated
17
25
  */
18
26
  Inactivated = 200,
27
+ /**
28
+ * Completed
29
+ */
30
+ Completed = 250,
19
31
  /**
20
32
  * Archived
21
33
  */
@@ -13,10 +13,22 @@ export var EntityStatus;
13
13
  * Flaged
14
14
  */
15
15
  EntityStatus[EntityStatus["Flaged"] = 9] = "Flaged";
16
+ /**
17
+ * Approved
18
+ */
19
+ EntityStatus[EntityStatus["Approved"] = 100] = "Approved";
20
+ /**
21
+ * Audited
22
+ */
23
+ EntityStatus[EntityStatus["Audited"] = 111] = "Audited";
16
24
  /**
17
25
  * Inactivated
18
26
  */
19
27
  EntityStatus[EntityStatus["Inactivated"] = 200] = "Inactivated";
28
+ /**
29
+ * Completed
30
+ */
31
+ EntityStatus[EntityStatus["Completed"] = 250] = "Completed";
20
32
  /**
21
33
  * Archived
22
34
  */
@@ -1,66 +1,68 @@
1
+ import { RepeatOption } from './RepeatOption';
1
2
  /**
2
- * Product units enum
3
- * See com.etsoo.CoreFramework.Business.ProductUnit
3
+ * Product base units
4
+ * 1 - 9
4
5
  */
5
- export declare enum ProductUnit {
6
+ export declare enum ProductBaseUnit {
6
7
  /**
7
8
  * Picese
8
9
  * 件
9
10
  */
10
- PC = 0,
11
+ PC = 1,
11
12
  /**
12
13
  * Set
13
14
  * 套
14
15
  */
15
- SET = 1,
16
- /**
17
- * Year
18
- *
19
- */
20
- YEAR = 10,
21
- /**
22
- * Quater
23
- * 季
24
- */
25
- QUATER = 11,
26
- /**
27
- * Month
28
- * 月
29
- */
30
- MONTH = 12,
31
- /**
32
- * Fortnight
33
- * 两周
34
- */
35
- FORNIGHT = 13,
36
- /**
37
- * Week
38
- * 周
39
- */
40
- WEEK = 14,
41
- /**
42
- * Day
43
- * 天
44
- */
45
- DAY = 15,
16
+ SET = 2
17
+ }
18
+ /**
19
+ * Product weight units
20
+ * Range 40 - 49
21
+ */
22
+ export declare enum ProductWeightUnit {
46
23
  /**
47
- * Hour
48
- * 小时
24
+ * Gram
25
+ *
49
26
  */
50
- HOUR = 16,
27
+ GRAM = 40,
51
28
  /**
52
- * Ton
53
- *
29
+ * Half Kg
30
+ *
54
31
  */
55
- TON = 31,
32
+ JIN = 41,
56
33
  /**
57
34
  * Kilogram
58
35
  * 千克
59
36
  */
60
- KILOGRAM = 32,
37
+ KILOGRAM = 42,
61
38
  /**
62
- * Gram
63
- *
39
+ * Ton
40
+ *
64
41
  */
65
- GRAM = 33
42
+ TON = 49
66
43
  }
44
+ /**
45
+ * Product units enum
46
+ * Repeat options take range 10 - 39
47
+ * See com.etsoo.CoreFramework.Business.ProductUnit
48
+ */
49
+ export declare const ProductUnit: {
50
+ [x: number]: string;
51
+ GRAM: ProductWeightUnit.GRAM;
52
+ JIN: ProductWeightUnit.JIN;
53
+ KILOGRAM: ProductWeightUnit.KILOGRAM;
54
+ TON: ProductWeightUnit.TON;
55
+ HOUR: RepeatOption.HOUR;
56
+ DAY: RepeatOption.DAY;
57
+ YEAR: RepeatOption.YEAR;
58
+ WEEK: RepeatOption.WEEK;
59
+ FORTNIGHT: RepeatOption.FORTNIGHT;
60
+ FOURWEEK: RepeatOption.FOURWEEK;
61
+ MONTH: RepeatOption.MONTH;
62
+ BIMONTH: RepeatOption.BIMONTH;
63
+ QUATER: RepeatOption.QUATER;
64
+ HALFYEAR: RepeatOption.HALFYEAR;
65
+ PC: ProductBaseUnit.PC;
66
+ SET: ProductBaseUnit.SET;
67
+ };
68
+ export declare type ProductUnit = ProductBaseUnit | RepeatOption | ProductWeightUnit;