@etsoo/appscript 1.3.66 → 1.3.68

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.
@@ -192,6 +192,13 @@ test('Tests for initCallUpdateLocal', () => {
192
192
  expect(passphrase).not.toBeNull();
193
193
  });
194
194
 
195
+ test('Tests for formatFullName', () => {
196
+ expect(app.formatFullName('亿速', null)).toBe('亿速');
197
+ expect(app.formatFullName(null, null)).toBe('');
198
+ expect(app.formatFullName('亿速', '思维')).toBe('亿速思维');
199
+ expect(app.formatFullName('Xiao', 'Garry')).toBe('Garry Xiao');
200
+ });
201
+
195
202
  test('Tests for getRoles', () => {
196
203
  var roles = app.getRoles(UserRole.User | UserRole.Manager | UserRole.Admin);
197
204
  expect(roles.length).toBe(3);
@@ -322,6 +322,12 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
322
322
  * @param silent Silent without any popups
323
323
  */
324
324
  doRefreshTokenResult(result: RefreshTokenResult, initCallCallback?: (result: boolean) => void, silent?: boolean): void;
325
+ /**
326
+ * Format as full name
327
+ * @param familyName Family name
328
+ * @param givenName Given name
329
+ */
330
+ formatFullName(familyName: string | undefined | null, givenName: string | undefined | null): string;
325
331
  /**
326
332
  * Format refresh token result
327
333
  * @param result Refresh token result
@@ -785,6 +785,22 @@ class CoreApp {
785
785
  this.refreshTokenFailed();
786
786
  });
787
787
  }
788
+ /**
789
+ * Format as full name
790
+ * @param familyName Family name
791
+ * @param givenName Given name
792
+ */
793
+ formatFullName(familyName, givenName) {
794
+ if (!familyName)
795
+ return givenName !== null && givenName !== void 0 ? givenName : '';
796
+ if (!givenName)
797
+ return familyName !== null && familyName !== void 0 ? familyName : '';
798
+ const wf = givenName + ' ' + familyName;
799
+ if (wf.containChinese() || wf.containJapanese() || wf.containKorean()) {
800
+ return familyName + givenName;
801
+ }
802
+ return wf;
803
+ }
788
804
  /**
789
805
  * Format refresh token result
790
806
  * @param result Refresh token result
@@ -252,6 +252,12 @@ export interface IApp {
252
252
  * @param silent Silent without any popups
253
253
  */
254
254
  doRefreshTokenResult(result: RefreshTokenResult, initCallCallback?: (result: boolean) => void, silent?: boolean): void;
255
+ /**
256
+ * Format as full name
257
+ * @param familyName Family name
258
+ * @param givenName Given name
259
+ */
260
+ formatFullName(familyName: string | undefined | null, givenName: string | undefined | null): string;
255
261
  /**
256
262
  * Format refresh token result
257
263
  * @param result Refresh token result
@@ -99,6 +99,7 @@
99
99
  "noData": "No valid data",
100
100
  "none": "None yet",
101
101
  "noOptions": "No options",
102
+ "noRows": "No data",
102
103
  "ok": "OK",
103
104
  "oldValue": "Old value",
104
105
  "open": "Open",
@@ -99,6 +99,7 @@
99
99
  "noData": "没有有效数据",
100
100
  "none": "暂时没有",
101
101
  "noOptions": "没有选项",
102
+ "noRows": "没有数据",
102
103
  "ok": "确定",
103
104
  "oldValue": "旧值",
104
105
  "open": "打开",
@@ -99,6 +99,7 @@
99
99
  "noData": "沒有有效數據",
100
100
  "none": "暫時沒有",
101
101
  "noOptions": "沒有選項",
102
+ "noRows": "沒有數據",
102
103
  "ok": "確定",
103
104
  "oldValue": "舊值",
104
105
  "open": "打開",
@@ -322,6 +322,12 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
322
322
  * @param silent Silent without any popups
323
323
  */
324
324
  doRefreshTokenResult(result: RefreshTokenResult, initCallCallback?: (result: boolean) => void, silent?: boolean): void;
325
+ /**
326
+ * Format as full name
327
+ * @param familyName Family name
328
+ * @param givenName Given name
329
+ */
330
+ formatFullName(familyName: string | undefined | null, givenName: string | undefined | null): string;
325
331
  /**
326
332
  * Format refresh token result
327
333
  * @param result Refresh token result
@@ -782,6 +782,22 @@ export class CoreApp {
782
782
  this.refreshTokenFailed();
783
783
  });
784
784
  }
785
+ /**
786
+ * Format as full name
787
+ * @param familyName Family name
788
+ * @param givenName Given name
789
+ */
790
+ formatFullName(familyName, givenName) {
791
+ if (!familyName)
792
+ return givenName !== null && givenName !== void 0 ? givenName : '';
793
+ if (!givenName)
794
+ return familyName !== null && familyName !== void 0 ? familyName : '';
795
+ const wf = givenName + ' ' + familyName;
796
+ if (wf.containChinese() || wf.containJapanese() || wf.containKorean()) {
797
+ return familyName + givenName;
798
+ }
799
+ return wf;
800
+ }
785
801
  /**
786
802
  * Format refresh token result
787
803
  * @param result Refresh token result
@@ -252,6 +252,12 @@ export interface IApp {
252
252
  * @param silent Silent without any popups
253
253
  */
254
254
  doRefreshTokenResult(result: RefreshTokenResult, initCallCallback?: (result: boolean) => void, silent?: boolean): void;
255
+ /**
256
+ * Format as full name
257
+ * @param familyName Family name
258
+ * @param givenName Given name
259
+ */
260
+ formatFullName(familyName: string | undefined | null, givenName: string | undefined | null): string;
255
261
  /**
256
262
  * Format refresh token result
257
263
  * @param result Refresh token result
@@ -99,6 +99,7 @@
99
99
  "noData": "No valid data",
100
100
  "none": "None yet",
101
101
  "noOptions": "No options",
102
+ "noRows": "No data",
102
103
  "ok": "OK",
103
104
  "oldValue": "Old value",
104
105
  "open": "Open",
@@ -99,6 +99,7 @@
99
99
  "noData": "没有有效数据",
100
100
  "none": "暂时没有",
101
101
  "noOptions": "没有选项",
102
+ "noRows": "没有数据",
102
103
  "ok": "确定",
103
104
  "oldValue": "旧值",
104
105
  "open": "打开",
@@ -99,6 +99,7 @@
99
99
  "noData": "沒有有效數據",
100
100
  "none": "暫時沒有",
101
101
  "noOptions": "沒有選項",
102
+ "noRows": "沒有數據",
102
103
  "ok": "確定",
103
104
  "oldValue": "舊值",
104
105
  "open": "打開",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@etsoo/appscript",
3
- "version": "1.3.66",
3
+ "version": "1.3.68",
4
4
  "description": "Applications shared TypeScript framework",
5
5
  "main": "lib/cjs/index.js",
6
6
  "module": "lib/mjs/index.js",
@@ -52,18 +52,18 @@
52
52
  },
53
53
  "homepage": "https://github.com/ETSOO/AppScript#readme",
54
54
  "dependencies": {
55
- "@etsoo/notificationbase": "^1.1.23",
56
- "@etsoo/restclient": "^1.0.84",
57
- "@etsoo/shared": "^1.1.88",
55
+ "@etsoo/notificationbase": "^1.1.24",
56
+ "@etsoo/restclient": "^1.0.87",
57
+ "@etsoo/shared": "^1.1.89",
58
58
  "@types/crypto-js": "^4.1.1",
59
59
  "crypto-js": "^4.1.1"
60
60
  },
61
61
  "devDependencies": {
62
- "@babel/cli": "^7.20.7",
63
- "@babel/core": "^7.20.12",
64
- "@babel/plugin-transform-runtime": "^7.19.6",
62
+ "@babel/cli": "^7.21.0",
63
+ "@babel/core": "^7.21.0",
64
+ "@babel/plugin-transform-runtime": "^7.21.0",
65
65
  "@babel/preset-env": "^7.20.2",
66
- "@babel/runtime-corejs3": "^7.20.13",
66
+ "@babel/runtime-corejs3": "^7.21.0",
67
67
  "@types/jest": "^29.4.0",
68
68
  "jest": "^29.4.3",
69
69
  "jest-environment-jsdom": "^29.4.3",
@@ -1104,6 +1104,24 @@ export abstract class CoreApp<
1104
1104
  });
1105
1105
  }
1106
1106
 
1107
+ /**
1108
+ * Format as full name
1109
+ * @param familyName Family name
1110
+ * @param givenName Given name
1111
+ */
1112
+ formatFullName(
1113
+ familyName: string | undefined | null,
1114
+ givenName: string | undefined | null
1115
+ ) {
1116
+ if (!familyName) return givenName ?? '';
1117
+ if (!givenName) return familyName ?? '';
1118
+ const wf = givenName + ' ' + familyName;
1119
+ if (wf.containChinese() || wf.containJapanese() || wf.containKorean()) {
1120
+ return familyName + givenName;
1121
+ }
1122
+ return wf;
1123
+ }
1124
+
1107
1125
  /**
1108
1126
  * Format refresh token result
1109
1127
  * @param result Refresh token result
package/src/app/IApp.ts CHANGED
@@ -345,6 +345,16 @@ export interface IApp {
345
345
  silent?: boolean
346
346
  ): void;
347
347
 
348
+ /**
349
+ * Format as full name
350
+ * @param familyName Family name
351
+ * @param givenName Given name
352
+ */
353
+ formatFullName(
354
+ familyName: string | undefined | null,
355
+ givenName: string | undefined | null
356
+ ): string;
357
+
348
358
  /**
349
359
  * Format refresh token result
350
360
  * @param result Refresh token result
package/src/i18n/en.json CHANGED
@@ -99,6 +99,7 @@
99
99
  "noData": "No valid data",
100
100
  "none": "None yet",
101
101
  "noOptions": "No options",
102
+ "noRows": "No data",
102
103
  "ok": "OK",
103
104
  "oldValue": "Old value",
104
105
  "open": "Open",
@@ -99,6 +99,7 @@
99
99
  "noData": "没有有效数据",
100
100
  "none": "暂时没有",
101
101
  "noOptions": "没有选项",
102
+ "noRows": "没有数据",
102
103
  "ok": "确定",
103
104
  "oldValue": "旧值",
104
105
  "open": "打开",
@@ -99,6 +99,7 @@
99
99
  "noData": "沒有有效數據",
100
100
  "none": "暫時沒有",
101
101
  "noOptions": "沒有選項",
102
+ "noRows": "沒有數據",
102
103
  "ok": "確定",
103
104
  "oldValue": "舊值",
104
105
  "open": "打開",