@etsoo/appscript 1.2.18 → 1.2.22

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.
@@ -232,6 +232,13 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
232
232
  * @returns Cached token
233
233
  */
234
234
  getCacheToken(): string | undefined;
235
+ /**
236
+ * Get entity status label
237
+ * @param data Input data
238
+ */
239
+ getEntityStatusLabel<D extends {
240
+ entityStatus?: number;
241
+ }>(data: D): string;
235
242
  /**
236
243
  * Get all regions
237
244
  * @returns Regions
@@ -621,6 +628,13 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
621
628
  * @returns Regions
622
629
  */
623
630
  getRegions(): AddressRegion[];
631
+ /**
632
+ * Get entity status label
633
+ * @param data Input data
634
+ */
635
+ getEntityStatusLabel<D extends {
636
+ entityStatus?: number;
637
+ }>(data: D): string;
624
638
  /**
625
639
  * Get refresh token from response headers
626
640
  * @param rawResponse Raw response from API call
@@ -7,6 +7,7 @@ const shared_1 = require("@etsoo/shared");
7
7
  const crypto_js_1 = require("crypto-js");
8
8
  const AddressRegion_1 = require("../address/AddressRegion");
9
9
  const AddressUtils_1 = require("../address/AddressUtils");
10
+ const BusinessUtils_1 = require("../business/BusinessUtils");
10
11
  const ActionResultError_1 = require("../result/ActionResultError");
11
12
  /**
12
13
  * Core application
@@ -650,7 +651,7 @@ class CoreApp {
650
651
  * @param forceToLocal Force to local labels
651
652
  */
652
653
  formatResult(result, forceToLocal) {
653
- var _a, _b;
654
+ var _a;
654
655
  const title = result.title;
655
656
  if (title && /^\w+$/.test(title)) {
656
657
  const key = title.formatInitial(false);
@@ -671,7 +672,7 @@ class CoreApp {
671
672
  if (result.field && ((_a = result.title) === null || _a === void 0 ? void 0 : _a.includes('{0}'))) {
672
673
  const fieldLabel = this.get(result.field.formatInitial(false));
673
674
  if (fieldLabel)
674
- (_b = result.title) === null || _b === void 0 ? void 0 : _b.format(fieldLabel);
675
+ result.title = result.title.format(fieldLabel);
675
676
  }
676
677
  }
677
678
  /**
@@ -715,6 +716,15 @@ class CoreApp {
715
716
  return AddressRegion_1.AddressRegion.getById(id);
716
717
  });
717
718
  }
719
+ /**
720
+ * Get entity status label
721
+ * @param data Input data
722
+ */
723
+ getEntityStatusLabel(data) {
724
+ if (data == null || data.entityStatus == null)
725
+ return '';
726
+ return BusinessUtils_1.BusinessUtils.getEntityStatusLabel(data.entityStatus, this.labelDelegate);
727
+ }
718
728
  /**
719
729
  * Get refresh token from response headers
720
730
  * @param rawResponse Raw response from API call
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Standard entity status enum
3
3
  * com.etsoo.SmartERP.Dto.EntityStatus
4
+ * Labels also included within i18n
4
5
  */
5
6
  export declare enum EntityStatus {
6
7
  /**
@@ -4,6 +4,7 @@ exports.EntityStatus = void 0;
4
4
  /**
5
5
  * Standard entity status enum
6
6
  * com.etsoo.SmartERP.Dto.EntityStatus
7
+ * Labels also included within i18n
7
8
  */
8
9
  var EntityStatus;
9
10
  (function (EntityStatus) {
@@ -10,6 +10,7 @@
10
10
  "completeTip": "{0} completed",
11
11
  "copy": "Copy",
12
12
  "creation": "Creation",
13
+ "currency": "Currency",
13
14
  "delete": "Delete",
14
15
  "description": "Description",
15
16
  "done": "Done",
@@ -59,9 +60,15 @@
59
60
  "send": "Send",
60
61
  "setAsDefault": "Set as default",
61
62
  "settings": "Settings",
63
+ "showIt": "Show it",
62
64
  "signout": "Sign out",
63
65
  "smartERP": "SmartERP",
64
66
  "status": "Status",
67
+ "statusArchived": "Archived",
68
+ "statusDeleted": "Deleted",
69
+ "statusFlaged": "Flaged",
70
+ "statusNormal": "Normla",
71
+ "statusInactivated": "Inactivated",
65
72
  "submit": "Submit",
66
73
  "success": "Success",
67
74
  "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",
@@ -10,13 +10,14 @@
10
10
  "completeTip": "已完成 {0}",
11
11
  "copy": "复制",
12
12
  "creation": "登记时间",
13
+ "currency": "币种",
13
14
  "delete": "删除",
14
15
  "description": "描述",
15
16
  "done": "完成",
16
17
  "edit": "修改",
17
18
  "email": "电子邮箱",
18
19
  "emailAddresses": "电子邮箱",
19
- "enabled": "启用",
20
+ "enabled": "已启用",
20
21
  "etsoo": "亿速思维",
21
22
  "expiry": "到期时间",
22
23
  "failed": "操作失败",
@@ -59,9 +60,15 @@
59
60
  "send": "发送",
60
61
  "setAsDefault": "设为默认",
61
62
  "settings": "系统设置",
63
+ "showIt": "显示",
62
64
  "signout": "退出",
63
65
  "smartERP": "司友云ERP",
64
66
  "status": "状态",
67
+ "statusArchived": "已归档",
68
+ "statusDeleted": "已删除",
69
+ "statusFlaged": "已标记",
70
+ "statusNormal": "正常",
71
+ "statusInactivated": "已停用",
65
72
  "submit": "提交",
66
73
  "success": "成功",
67
74
  "timeDifferenceInvalid": "设备时间和服务器时间差为{0},超过{1}秒的限制,请调整设备时间,如果异常请告知管理员",
@@ -10,13 +10,14 @@
10
10
  "completeTip": "已完成 {0}",
11
11
  "copy": "複製",
12
12
  "creation": "登記時間",
13
+ "currency": "幣種",
13
14
  "delete": "刪除",
14
15
  "description": "描述",
15
16
  "done": "完成",
16
17
  "edit": "修改",
17
18
  "email": "電子郵箱",
18
19
  "emailAddresses": "電子郵箱",
19
- "enabled": "啟用",
20
+ "enabled": "已啟用",
20
21
  "etsoo": "億速思維",
21
22
  "expiry": "到期時間",
22
23
  "failed": "操作失敗",
@@ -59,9 +60,15 @@
59
60
  "send": "發送",
60
61
  "setAsDefault": "設為默認",
61
62
  "settings": "系統設置",
63
+ "showIt": "顯示",
62
64
  "signout": "退出",
63
65
  "smartERP": "司友雲ERP",
64
66
  "status": "狀態",
67
+ "statusArchived": "已歸檔",
68
+ "statusDeleted": "已刪除",
69
+ "statusFlaged": "已標記",
70
+ "statusNormal": "正常",
71
+ "statusInactivated": "已停用",
65
72
  "submit": "提交",
66
73
  "success": "成功",
67
74
  "timeDifferenceInvalid": "設備時間和服務器時間差為{0},超過{1}秒的限制,請調整設備時間,如果異常請告知管理員",
@@ -232,6 +232,13 @@ export interface ICoreApp<S extends IAppSettings, N, C extends NotificationCallP
232
232
  * @returns Cached token
233
233
  */
234
234
  getCacheToken(): string | undefined;
235
+ /**
236
+ * Get entity status label
237
+ * @param data Input data
238
+ */
239
+ getEntityStatusLabel<D extends {
240
+ entityStatus?: number;
241
+ }>(data: D): string;
235
242
  /**
236
243
  * Get all regions
237
244
  * @returns Regions
@@ -621,6 +628,13 @@ export declare abstract class CoreApp<S extends IAppSettings, N, C extends Notif
621
628
  * @returns Regions
622
629
  */
623
630
  getRegions(): AddressRegion[];
631
+ /**
632
+ * Get entity status label
633
+ * @param data Input data
634
+ */
635
+ getEntityStatusLabel<D extends {
636
+ entityStatus?: number;
637
+ }>(data: D): string;
624
638
  /**
625
639
  * Get refresh token from response headers
626
640
  * @param rawResponse Raw response from API call
@@ -4,6 +4,7 @@ import { DateUtils, DomUtils, NumberUtils, Utils } from '@etsoo/shared';
4
4
  import { AES, algo, enc, HmacSHA512, lib, mode, pad, PBKDF2, SHA3 } from 'crypto-js';
5
5
  import { AddressRegion } from '../address/AddressRegion';
6
6
  import { AddressUtils } from '../address/AddressUtils';
7
+ import { BusinessUtils } from '../business/BusinessUtils';
7
8
  import { ActionResultError } from '../result/ActionResultError';
8
9
  /**
9
10
  * Core application
@@ -647,7 +648,7 @@ export class CoreApp {
647
648
  * @param forceToLocal Force to local labels
648
649
  */
649
650
  formatResult(result, forceToLocal) {
650
- var _a, _b;
651
+ var _a;
651
652
  const title = result.title;
652
653
  if (title && /^\w+$/.test(title)) {
653
654
  const key = title.formatInitial(false);
@@ -668,7 +669,7 @@ export class CoreApp {
668
669
  if (result.field && ((_a = result.title) === null || _a === void 0 ? void 0 : _a.includes('{0}'))) {
669
670
  const fieldLabel = this.get(result.field.formatInitial(false));
670
671
  if (fieldLabel)
671
- (_b = result.title) === null || _b === void 0 ? void 0 : _b.format(fieldLabel);
672
+ result.title = result.title.format(fieldLabel);
672
673
  }
673
674
  }
674
675
  /**
@@ -712,6 +713,15 @@ export class CoreApp {
712
713
  return AddressRegion.getById(id);
713
714
  });
714
715
  }
716
+ /**
717
+ * Get entity status label
718
+ * @param data Input data
719
+ */
720
+ getEntityStatusLabel(data) {
721
+ if (data == null || data.entityStatus == null)
722
+ return '';
723
+ return BusinessUtils.getEntityStatusLabel(data.entityStatus, this.labelDelegate);
724
+ }
715
725
  /**
716
726
  * Get refresh token from response headers
717
727
  * @param rawResponse Raw response from API call
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Standard entity status enum
3
3
  * com.etsoo.SmartERP.Dto.EntityStatus
4
+ * Labels also included within i18n
4
5
  */
5
6
  export declare enum EntityStatus {
6
7
  /**
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Standard entity status enum
3
3
  * com.etsoo.SmartERP.Dto.EntityStatus
4
+ * Labels also included within i18n
4
5
  */
5
6
  export var EntityStatus;
6
7
  (function (EntityStatus) {
@@ -10,6 +10,7 @@
10
10
  "completeTip": "{0} completed",
11
11
  "copy": "Copy",
12
12
  "creation": "Creation",
13
+ "currency": "Currency",
13
14
  "delete": "Delete",
14
15
  "description": "Description",
15
16
  "done": "Done",
@@ -59,9 +60,15 @@
59
60
  "send": "Send",
60
61
  "setAsDefault": "Set as default",
61
62
  "settings": "Settings",
63
+ "showIt": "Show it",
62
64
  "signout": "Sign out",
63
65
  "smartERP": "SmartERP",
64
66
  "status": "Status",
67
+ "statusArchived": "Archived",
68
+ "statusDeleted": "Deleted",
69
+ "statusFlaged": "Flaged",
70
+ "statusNormal": "Normla",
71
+ "statusInactivated": "Inactivated",
65
72
  "submit": "Submit",
66
73
  "success": "Success",
67
74
  "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",
@@ -10,13 +10,14 @@
10
10
  "completeTip": "已完成 {0}",
11
11
  "copy": "复制",
12
12
  "creation": "登记时间",
13
+ "currency": "币种",
13
14
  "delete": "删除",
14
15
  "description": "描述",
15
16
  "done": "完成",
16
17
  "edit": "修改",
17
18
  "email": "电子邮箱",
18
19
  "emailAddresses": "电子邮箱",
19
- "enabled": "启用",
20
+ "enabled": "已启用",
20
21
  "etsoo": "亿速思维",
21
22
  "expiry": "到期时间",
22
23
  "failed": "操作失败",
@@ -59,9 +60,15 @@
59
60
  "send": "发送",
60
61
  "setAsDefault": "设为默认",
61
62
  "settings": "系统设置",
63
+ "showIt": "显示",
62
64
  "signout": "退出",
63
65
  "smartERP": "司友云ERP",
64
66
  "status": "状态",
67
+ "statusArchived": "已归档",
68
+ "statusDeleted": "已删除",
69
+ "statusFlaged": "已标记",
70
+ "statusNormal": "正常",
71
+ "statusInactivated": "已停用",
65
72
  "submit": "提交",
66
73
  "success": "成功",
67
74
  "timeDifferenceInvalid": "设备时间和服务器时间差为{0},超过{1}秒的限制,请调整设备时间,如果异常请告知管理员",
@@ -10,13 +10,14 @@
10
10
  "completeTip": "已完成 {0}",
11
11
  "copy": "複製",
12
12
  "creation": "登記時間",
13
+ "currency": "幣種",
13
14
  "delete": "刪除",
14
15
  "description": "描述",
15
16
  "done": "完成",
16
17
  "edit": "修改",
17
18
  "email": "電子郵箱",
18
19
  "emailAddresses": "電子郵箱",
19
- "enabled": "啟用",
20
+ "enabled": "已啟用",
20
21
  "etsoo": "億速思維",
21
22
  "expiry": "到期時間",
22
23
  "failed": "操作失敗",
@@ -59,9 +60,15 @@
59
60
  "send": "發送",
60
61
  "setAsDefault": "設為默認",
61
62
  "settings": "系統設置",
63
+ "showIt": "顯示",
62
64
  "signout": "退出",
63
65
  "smartERP": "司友雲ERP",
64
66
  "status": "狀態",
67
+ "statusArchived": "已歸檔",
68
+ "statusDeleted": "已刪除",
69
+ "statusFlaged": "已標記",
70
+ "statusNormal": "正常",
71
+ "statusInactivated": "已停用",
65
72
  "submit": "提交",
66
73
  "success": "成功",
67
74
  "timeDifferenceInvalid": "設備時間和服務器時間差為{0},超過{1}秒的限制,請調整設備時間,如果異常請告知管理員",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.2.18",
3
+ "version": "1.2.22",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -54,23 +54,23 @@
54
54
  "dependencies": {
55
55
  "@etsoo/notificationbase": "^1.1.0",
56
56
  "@etsoo/restclient": "^1.0.64",
57
- "@etsoo/shared": "^1.1.0",
57
+ "@etsoo/shared": "^1.1.3",
58
58
  "@types/crypto-js": "^4.1.0",
59
59
  "crypto-js": "^4.1.1"
60
60
  },
61
61
  "devDependencies": {
62
- "@babel/cli": "^7.16.7",
62
+ "@babel/cli": "^7.16.8",
63
63
  "@babel/core": "^7.16.7",
64
- "@babel/plugin-transform-runtime": "^7.16.7",
65
- "@babel/preset-env": "^7.16.7",
66
- "@babel/runtime-corejs3": "^7.16.7",
64
+ "@babel/plugin-transform-runtime": "^7.16.8",
65
+ "@babel/preset-env": "^7.16.8",
66
+ "@babel/runtime-corejs3": "^7.16.8",
67
67
  "@types/jest": "^27.4.0",
68
- "@typescript-eslint/eslint-plugin": "^5.9.0",
69
- "@typescript-eslint/parser": "^5.9.0",
68
+ "@typescript-eslint/eslint-plugin": "^5.9.1",
69
+ "@typescript-eslint/parser": "^5.9.1",
70
70
  "eslint": "^8.6.0",
71
71
  "eslint-config-airbnb-base": "^15.0.0",
72
72
  "eslint-plugin-import": "^2.25.4",
73
- "jest": "^27.4.5",
73
+ "jest": "^27.4.7",
74
74
  "ts-jest": "^27.1.2",
75
75
  "typescript": "^4.5.4"
76
76
  }
@@ -29,6 +29,7 @@ import {
29
29
  } from 'crypto-js';
30
30
  import { AddressRegion } from '../address/AddressRegion';
31
31
  import { AddressUtils } from '../address/AddressUtils';
32
+ import { BusinessUtils } from '../business/BusinessUtils';
32
33
  import { IdLabelDto } from '../dto/IdLabelDto';
33
34
  import { InitCallDto } from '../dto/InitCallDto';
34
35
  import { ActionResultError } from '../result/ActionResultError';
@@ -330,6 +331,12 @@ export interface ICoreApp<
330
331
  */
331
332
  getCacheToken(): string | undefined;
332
333
 
334
+ /**
335
+ * Get entity status label
336
+ * @param data Input data
337
+ */
338
+ getEntityStatusLabel<D extends { entityStatus?: number }>(data: D): string;
339
+
333
340
  /**
334
341
  * Get all regions
335
342
  * @returns Regions
@@ -1335,7 +1342,7 @@ export abstract class CoreApp<
1335
1342
  // When title contains {0}, replace with the field label
1336
1343
  if (result.field && result.title?.includes('{0}')) {
1337
1344
  const fieldLabel = this.get(result.field.formatInitial(false));
1338
- if (fieldLabel) result.title?.format(fieldLabel);
1345
+ if (fieldLabel) result.title = result.title.format(fieldLabel);
1339
1346
  }
1340
1347
  }
1341
1348
 
@@ -1386,6 +1393,18 @@ export abstract class CoreApp<
1386
1393
  });
1387
1394
  }
1388
1395
 
1396
+ /**
1397
+ * Get entity status label
1398
+ * @param data Input data
1399
+ */
1400
+ getEntityStatusLabel<D extends { entityStatus?: number }>(data: D) {
1401
+ if (data == null || data.entityStatus == null) return '';
1402
+ return BusinessUtils.getEntityStatusLabel(
1403
+ data.entityStatus,
1404
+ this.labelDelegate
1405
+ );
1406
+ }
1407
+
1389
1408
  /**
1390
1409
  * Get refresh token from response headers
1391
1410
  * @param rawResponse Raw response from API call
@@ -1,6 +1,7 @@
1
1
  /**
2
2
  * Standard entity status enum
3
3
  * com.etsoo.SmartERP.Dto.EntityStatus
4
+ * Labels also included within i18n
4
5
  */
5
6
  export enum EntityStatus {
6
7
  /**
@@ -10,6 +10,7 @@
10
10
  "completeTip": "{0} completed",
11
11
  "copy": "Copy",
12
12
  "creation": "Creation",
13
+ "currency": "Currency",
13
14
  "delete": "Delete",
14
15
  "description": "Description",
15
16
  "done": "Done",
@@ -59,9 +60,15 @@
59
60
  "send": "Send",
60
61
  "setAsDefault": "Set as default",
61
62
  "settings": "Settings",
63
+ "showIt": "Show it",
62
64
  "signout": "Sign out",
63
65
  "smartERP": "SmartERP",
64
66
  "status": "Status",
67
+ "statusArchived": "Archived",
68
+ "statusDeleted": "Deleted",
69
+ "statusFlaged": "Flaged",
70
+ "statusNormal": "Normla",
71
+ "statusInactivated": "Inactivated",
65
72
  "submit": "Submit",
66
73
  "success": "Success",
67
74
  "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",
@@ -10,13 +10,14 @@
10
10
  "completeTip": "已完成 {0}",
11
11
  "copy": "复制",
12
12
  "creation": "登记时间",
13
+ "currency": "币种",
13
14
  "delete": "删除",
14
15
  "description": "描述",
15
16
  "done": "完成",
16
17
  "edit": "修改",
17
18
  "email": "电子邮箱",
18
19
  "emailAddresses": "电子邮箱",
19
- "enabled": "启用",
20
+ "enabled": "已启用",
20
21
  "etsoo": "亿速思维",
21
22
  "expiry": "到期时间",
22
23
  "failed": "操作失败",
@@ -59,9 +60,15 @@
59
60
  "send": "发送",
60
61
  "setAsDefault": "设为默认",
61
62
  "settings": "系统设置",
63
+ "showIt": "显示",
62
64
  "signout": "退出",
63
65
  "smartERP": "司友云ERP",
64
66
  "status": "状态",
67
+ "statusArchived": "已归档",
68
+ "statusDeleted": "已删除",
69
+ "statusFlaged": "已标记",
70
+ "statusNormal": "正常",
71
+ "statusInactivated": "已停用",
65
72
  "submit": "提交",
66
73
  "success": "成功",
67
74
  "timeDifferenceInvalid": "设备时间和服务器时间差为{0},超过{1}秒的限制,请调整设备时间,如果异常请告知管理员",
@@ -10,13 +10,14 @@
10
10
  "completeTip": "已完成 {0}",
11
11
  "copy": "複製",
12
12
  "creation": "登記時間",
13
+ "currency": "幣種",
13
14
  "delete": "刪除",
14
15
  "description": "描述",
15
16
  "done": "完成",
16
17
  "edit": "修改",
17
18
  "email": "電子郵箱",
18
19
  "emailAddresses": "電子郵箱",
19
- "enabled": "啟用",
20
+ "enabled": "已啟用",
20
21
  "etsoo": "億速思維",
21
22
  "expiry": "到期時間",
22
23
  "failed": "操作失敗",
@@ -59,9 +60,15 @@
59
60
  "send": "發送",
60
61
  "setAsDefault": "設為默認",
61
62
  "settings": "系統設置",
63
+ "showIt": "顯示",
62
64
  "signout": "退出",
63
65
  "smartERP": "司友雲ERP",
64
66
  "status": "狀態",
67
+ "statusArchived": "已歸檔",
68
+ "statusDeleted": "已刪除",
69
+ "statusFlaged": "已標記",
70
+ "statusNormal": "正常",
71
+ "statusInactivated": "已停用",
65
72
  "submit": "提交",
66
73
  "success": "成功",
67
74
  "timeDifferenceInvalid": "設備時間和服務器時間差為{0},超過{1}秒的限制,請調整設備時間,如果異常請告知管理員",