@etsoo/appscript 1.3.58 → 1.3.60

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.
@@ -425,6 +425,21 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
425
425
  * @returns Result
426
426
  */
427
427
  hasPermission(roles: number | UserRole | number[] | UserRole[]): boolean;
428
+ /**
429
+ * Is admin user
430
+ * @returns Result
431
+ */
432
+ isAdminUser(): boolean;
433
+ /**
434
+ * Is Finance user
435
+ * @returns Result
436
+ */
437
+ isFinanceUser(): boolean;
438
+ /**
439
+ * Is HR user
440
+ * @returns Result
441
+ */
442
+ isHRUser(): boolean;
428
443
  /**
429
444
  * Navigate to Url or delta
430
445
  * @param url Url or delta
@@ -1019,6 +1019,27 @@ class CoreApp {
1019
1019
  return true;
1020
1020
  return false;
1021
1021
  }
1022
+ /**
1023
+ * Is admin user
1024
+ * @returns Result
1025
+ */
1026
+ isAdminUser() {
1027
+ return this.hasPermission([UserRole_1.UserRole.Admin, UserRole_1.UserRole.Founder]);
1028
+ }
1029
+ /**
1030
+ * Is Finance user
1031
+ * @returns Result
1032
+ */
1033
+ isFinanceUser() {
1034
+ return this.hasPermission(UserRole_1.UserRole.Finance) || this.isAdminUser();
1035
+ }
1036
+ /**
1037
+ * Is HR user
1038
+ * @returns Result
1039
+ */
1040
+ isHRUser() {
1041
+ return this.hasPermission(UserRole_1.UserRole.HRManager) || this.isAdminUser();
1042
+ }
1022
1043
  /**
1023
1044
  * Navigate to Url or delta
1024
1045
  * @param url Url or delta
@@ -352,6 +352,21 @@ export interface IApp {
352
352
  * @returns Result
353
353
  */
354
354
  initCall(callback?: (result: boolean) => void, resetKeys?: boolean): Promise<void>;
355
+ /**
356
+ * Is admin user
357
+ * @returns Result
358
+ */
359
+ isAdminUser(): boolean;
360
+ /**
361
+ * Is Finance user
362
+ * @returns Result
363
+ */
364
+ isFinanceUser(): boolean;
365
+ /**
366
+ * Is HR user
367
+ * @returns Result
368
+ */
369
+ isHRUser(): boolean;
355
370
  /**
356
371
  * Is valid password, override to implement custom check
357
372
  * @param password Input password
@@ -109,6 +109,7 @@
109
109
  "passwordRepeatError": "The two passwords entered are inconsistent",
110
110
  "passwordTip": "The password cannot be less than 6 characters and contains at least one letter and number",
111
111
  "pdf": "PDF",
112
+ "pinYin": "Pinyin Initials",
112
113
  "previousStep": "Previous",
113
114
  "print": "Print",
114
115
  "prompt": "Input",
@@ -108,6 +108,7 @@
108
108
  "passwordChangeSuccess": "密码修改成功,请重新登录",
109
109
  "passwordRepeatError": "两次输入的密码不一致",
110
110
  "passwordTip": "密码不能少于6个字符,且至少包含一个字母和数字",
111
+ "pinYin": "拼音首字母",
111
112
  "pdf": "PDF",
112
113
  "previousStep": "上一步",
113
114
  "print": "打印",
@@ -109,6 +109,7 @@
109
109
  "passwordRepeatError": "兩次輸入的密碼不一致",
110
110
  "passwordTip": "密碼不能少於6個字符,且至少包含一個字母和數字",
111
111
  "pdf": "PDF",
112
+ "pinYin": "拼音首字母",
112
113
  "previousStep": "上一步",
113
114
  "print": "打印",
114
115
  "prompt": "輸入",
@@ -425,6 +425,21 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
425
425
  * @returns Result
426
426
  */
427
427
  hasPermission(roles: number | UserRole | number[] | UserRole[]): boolean;
428
+ /**
429
+ * Is admin user
430
+ * @returns Result
431
+ */
432
+ isAdminUser(): boolean;
433
+ /**
434
+ * Is Finance user
435
+ * @returns Result
436
+ */
437
+ isFinanceUser(): boolean;
438
+ /**
439
+ * Is HR user
440
+ * @returns Result
441
+ */
442
+ isHRUser(): boolean;
428
443
  /**
429
444
  * Navigate to Url or delta
430
445
  * @param url Url or delta
@@ -1016,6 +1016,27 @@ export class CoreApp {
1016
1016
  return true;
1017
1017
  return false;
1018
1018
  }
1019
+ /**
1020
+ * Is admin user
1021
+ * @returns Result
1022
+ */
1023
+ isAdminUser() {
1024
+ return this.hasPermission([UserRole.Admin, UserRole.Founder]);
1025
+ }
1026
+ /**
1027
+ * Is Finance user
1028
+ * @returns Result
1029
+ */
1030
+ isFinanceUser() {
1031
+ return this.hasPermission(UserRole.Finance) || this.isAdminUser();
1032
+ }
1033
+ /**
1034
+ * Is HR user
1035
+ * @returns Result
1036
+ */
1037
+ isHRUser() {
1038
+ return this.hasPermission(UserRole.HRManager) || this.isAdminUser();
1039
+ }
1019
1040
  /**
1020
1041
  * Navigate to Url or delta
1021
1042
  * @param url Url or delta
@@ -352,6 +352,21 @@ export interface IApp {
352
352
  * @returns Result
353
353
  */
354
354
  initCall(callback?: (result: boolean) => void, resetKeys?: boolean): Promise<void>;
355
+ /**
356
+ * Is admin user
357
+ * @returns Result
358
+ */
359
+ isAdminUser(): boolean;
360
+ /**
361
+ * Is Finance user
362
+ * @returns Result
363
+ */
364
+ isFinanceUser(): boolean;
365
+ /**
366
+ * Is HR user
367
+ * @returns Result
368
+ */
369
+ isHRUser(): boolean;
355
370
  /**
356
371
  * Is valid password, override to implement custom check
357
372
  * @param password Input password
@@ -109,6 +109,7 @@
109
109
  "passwordRepeatError": "The two passwords entered are inconsistent",
110
110
  "passwordTip": "The password cannot be less than 6 characters and contains at least one letter and number",
111
111
  "pdf": "PDF",
112
+ "pinYin": "Pinyin Initials",
112
113
  "previousStep": "Previous",
113
114
  "print": "Print",
114
115
  "prompt": "Input",
@@ -108,6 +108,7 @@
108
108
  "passwordChangeSuccess": "密码修改成功,请重新登录",
109
109
  "passwordRepeatError": "两次输入的密码不一致",
110
110
  "passwordTip": "密码不能少于6个字符,且至少包含一个字母和数字",
111
+ "pinYin": "拼音首字母",
111
112
  "pdf": "PDF",
112
113
  "previousStep": "上一步",
113
114
  "print": "打印",
@@ -109,6 +109,7 @@
109
109
  "passwordRepeatError": "兩次輸入的密碼不一致",
110
110
  "passwordTip": "密碼不能少於6個字符,且至少包含一個字母和數字",
111
111
  "pdf": "PDF",
112
+ "pinYin": "拼音首字母",
112
113
  "previousStep": "上一步",
113
114
  "print": "打印",
114
115
  "prompt": "輸入",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.3.58",
3
+ "version": "1.3.60",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -63,11 +63,11 @@
63
63
  "@babel/core": "^7.20.12",
64
64
  "@babel/plugin-transform-runtime": "^7.19.6",
65
65
  "@babel/preset-env": "^7.20.2",
66
- "@babel/runtime-corejs3": "^7.20.7",
67
- "@types/jest": "^29.2.5",
68
- "jest": "^29.3.1",
69
- "jest-environment-jsdom": "^29.3.1",
70
- "ts-jest": "^29.0.4",
66
+ "@babel/runtime-corejs3": "^7.20.13",
67
+ "@types/jest": "^29.4.0",
68
+ "jest": "^29.4.1",
69
+ "jest-environment-jsdom": "^29.4.1",
70
+ "ts-jest": "^29.0.5",
71
71
  "typescript": "^4.9.4"
72
72
  }
73
73
  }
@@ -1361,6 +1361,30 @@ export abstract class CoreApp<
1361
1361
  return false;
1362
1362
  }
1363
1363
 
1364
+ /**
1365
+ * Is admin user
1366
+ * @returns Result
1367
+ */
1368
+ isAdminUser() {
1369
+ return this.hasPermission([UserRole.Admin, UserRole.Founder]);
1370
+ }
1371
+
1372
+ /**
1373
+ * Is Finance user
1374
+ * @returns Result
1375
+ */
1376
+ isFinanceUser() {
1377
+ return this.hasPermission(UserRole.Finance) || this.isAdminUser();
1378
+ }
1379
+
1380
+ /**
1381
+ * Is HR user
1382
+ * @returns Result
1383
+ */
1384
+ isHRUser() {
1385
+ return this.hasPermission(UserRole.HRManager) || this.isAdminUser();
1386
+ }
1387
+
1364
1388
  /**
1365
1389
  * Navigate to Url or delta
1366
1390
  * @param url Url or delta
package/src/app/IApp.ts CHANGED
@@ -457,6 +457,24 @@ export interface IApp {
457
457
  resetKeys?: boolean
458
458
  ): Promise<void>;
459
459
 
460
+ /**
461
+ * Is admin user
462
+ * @returns Result
463
+ */
464
+ isAdminUser(): boolean;
465
+
466
+ /**
467
+ * Is Finance user
468
+ * @returns Result
469
+ */
470
+ isFinanceUser(): boolean;
471
+
472
+ /**
473
+ * Is HR user
474
+ * @returns Result
475
+ */
476
+ isHRUser(): boolean;
477
+
460
478
  /**
461
479
  * Is valid password, override to implement custom check
462
480
  * @param password Input password
package/src/i18n/en.json CHANGED
@@ -109,6 +109,7 @@
109
109
  "passwordRepeatError": "The two passwords entered are inconsistent",
110
110
  "passwordTip": "The password cannot be less than 6 characters and contains at least one letter and number",
111
111
  "pdf": "PDF",
112
+ "pinYin": "Pinyin Initials",
112
113
  "previousStep": "Previous",
113
114
  "print": "Print",
114
115
  "prompt": "Input",
@@ -108,6 +108,7 @@
108
108
  "passwordChangeSuccess": "密码修改成功,请重新登录",
109
109
  "passwordRepeatError": "两次输入的密码不一致",
110
110
  "passwordTip": "密码不能少于6个字符,且至少包含一个字母和数字",
111
+ "pinYin": "拼音首字母",
111
112
  "pdf": "PDF",
112
113
  "previousStep": "上一步",
113
114
  "print": "打印",
@@ -109,6 +109,7 @@
109
109
  "passwordRepeatError": "兩次輸入的密碼不一致",
110
110
  "passwordTip": "密碼不能少於6個字符,且至少包含一個字母和數字",
111
111
  "pdf": "PDF",
112
+ "pinYin": "拼音首字母",
112
113
  "previousStep": "上一步",
113
114
  "print": "打印",
114
115
  "prompt": "輸入",