@etsoo/appscript 1.2.75 → 1.2.78
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.
- package/__tests__/business/BusinessUtils.ts +9 -0
- package/lib/cjs/app/CoreApp.d.ts +3 -2
- package/lib/cjs/app/CoreApp.js +2 -2
- package/lib/cjs/business/BusinessUtils.d.ts +8 -0
- package/lib/cjs/business/BusinessUtils.js +34 -2
- package/lib/cjs/i18n/en-US.json +3 -0
- package/lib/cjs/i18n/zh-CN.json +3 -0
- package/lib/cjs/i18n/zh-HK.json +3 -0
- package/lib/cjs/index.d.ts +2 -0
- package/lib/cjs/index.js +2 -0
- package/lib/cjs/rq/QueryRQ.d.ts +30 -0
- package/lib/cjs/rq/QueryRQ.js +2 -0
- package/lib/cjs/rq/TiplistRQ.d.ts +22 -0
- package/lib/cjs/rq/TiplistRQ.js +2 -0
- package/lib/mjs/app/CoreApp.d.ts +3 -2
- package/lib/mjs/app/CoreApp.js +2 -2
- package/lib/mjs/business/BusinessUtils.d.ts +8 -0
- package/lib/mjs/business/BusinessUtils.js +33 -1
- package/lib/mjs/i18n/en-US.json +3 -0
- package/lib/mjs/i18n/zh-CN.json +3 -0
- package/lib/mjs/i18n/zh-HK.json +3 -0
- package/lib/mjs/index.d.ts +2 -0
- package/lib/mjs/index.js +2 -0
- package/lib/mjs/rq/QueryRQ.d.ts +30 -0
- package/lib/mjs/rq/QueryRQ.js +1 -0
- package/lib/mjs/rq/TiplistRQ.d.ts +22 -0
- package/lib/mjs/rq/TiplistRQ.js +1 -0
- package/package.json +7 -7
- package/src/app/CoreApp.ts +5 -3
- package/src/business/BusinessUtils.ts +40 -1
- package/src/i18n/en-US.json +3 -0
- package/src/i18n/zh-CN.json +3 -0
- package/src/i18n/zh-HK.json +3 -0
- package/src/index.ts +2 -0
- package/src/rq/QueryRQ.ts +35 -0
- package/src/rq/TiplistRQ.ts +25 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BusinessUtils } from '../../src/business/BusinessUtils';
|
|
2
|
+
|
|
3
|
+
test('Tests for BusinessUtils.formatAvatarTitle', () => {
|
|
4
|
+
// Assert
|
|
5
|
+
expect(BusinessUtils.formatAvatarTitle('Garry Xiao')).toBe('GX');
|
|
6
|
+
expect(BusinessUtils.formatAvatarTitle('Etsoo')).toBe('ME');
|
|
7
|
+
expect(BusinessUtils.formatAvatarTitle('Etsoo', 3, 'E')).toBe('E');
|
|
8
|
+
expect(BusinessUtils.formatAvatarTitle('Etsoo', 5)).toBe('ETSOO');
|
|
9
|
+
});
|
package/lib/cjs/app/CoreApp.d.ts
CHANGED
|
@@ -235,8 +235,9 @@ export interface ICoreApp<U extends IUser, S extends IAppSettings, N, C extends
|
|
|
235
235
|
* Format result text
|
|
236
236
|
* @param result Action result
|
|
237
237
|
* @param forceToLocal Force to local labels
|
|
238
|
+
* @returns Message
|
|
238
239
|
*/
|
|
239
|
-
formatResult(result: IActionResult, forceToLocal?: boolean):
|
|
240
|
+
formatResult(result: IActionResult, forceToLocal?: boolean): string;
|
|
240
241
|
/**
|
|
241
242
|
* Fresh countdown UI
|
|
242
243
|
* @param callback Callback
|
|
@@ -691,7 +692,7 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
|
|
|
691
692
|
* @param result Action result
|
|
692
693
|
* @param forceToLocal Force to local labels
|
|
693
694
|
*/
|
|
694
|
-
formatResult(result: IActionResult, forceToLocal?: boolean):
|
|
695
|
+
formatResult(result: IActionResult, forceToLocal?: boolean): string;
|
|
695
696
|
/**
|
|
696
697
|
* Get culture resource
|
|
697
698
|
* @param key key
|
package/lib/cjs/app/CoreApp.js
CHANGED
|
@@ -421,8 +421,7 @@ class CoreApp {
|
|
|
421
421
|
* @param callback Callback
|
|
422
422
|
*/
|
|
423
423
|
alertResult(result, callback) {
|
|
424
|
-
this.formatResult(result);
|
|
425
|
-
this.notifier.alert(ActionResultError_1.ActionResultError.format(result), callback);
|
|
424
|
+
this.notifier.alert(this.formatResult(result), callback);
|
|
426
425
|
}
|
|
427
426
|
/**
|
|
428
427
|
* Authorize
|
|
@@ -797,6 +796,7 @@ class CoreApp {
|
|
|
797
796
|
if (fieldLabel)
|
|
798
797
|
result.title = result.title.format(fieldLabel);
|
|
799
798
|
}
|
|
799
|
+
return ActionResultError_1.ActionResultError.format(result);
|
|
800
800
|
}
|
|
801
801
|
/**
|
|
802
802
|
* Get culture resource
|
|
@@ -6,6 +6,14 @@ import { ProductUnit } from './ProductUnit';
|
|
|
6
6
|
* Business utils
|
|
7
7
|
*/
|
|
8
8
|
export declare namespace BusinessUtils {
|
|
9
|
+
/**
|
|
10
|
+
* Format avatar title
|
|
11
|
+
* @param title Title
|
|
12
|
+
* @param maxChars Max characters
|
|
13
|
+
* @param defaultTitle Default title
|
|
14
|
+
* @returns Result
|
|
15
|
+
*/
|
|
16
|
+
function formatAvatarTitle(title?: string, maxChars?: number, defaultTitle?: string): string;
|
|
9
17
|
/**
|
|
10
18
|
* Get currency collection
|
|
11
19
|
* @param currencyNames Names like CNY, USD
|
|
@@ -2,13 +2,45 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BusinessUtils = void 0;
|
|
4
4
|
const shared_1 = require("@etsoo/shared");
|
|
5
|
-
const __1 = require("..");
|
|
6
5
|
const ProductUnit_1 = require("./ProductUnit");
|
|
6
|
+
const RepeatOption_1 = require("./RepeatOption");
|
|
7
7
|
/**
|
|
8
8
|
* Business utils
|
|
9
9
|
*/
|
|
10
10
|
var BusinessUtils;
|
|
11
11
|
(function (BusinessUtils) {
|
|
12
|
+
/**
|
|
13
|
+
* Format avatar title
|
|
14
|
+
* @param title Title
|
|
15
|
+
* @param maxChars Max characters
|
|
16
|
+
* @param defaultTitle Default title
|
|
17
|
+
* @returns Result
|
|
18
|
+
*/
|
|
19
|
+
function formatAvatarTitle(title, maxChars = 3, defaultTitle = 'ME') {
|
|
20
|
+
// Just return for empty cases
|
|
21
|
+
if (title == null || title === '')
|
|
22
|
+
return defaultTitle;
|
|
23
|
+
// split with words
|
|
24
|
+
const items = title.trim().split(/\s+/g);
|
|
25
|
+
if (items.length === 1) {
|
|
26
|
+
// 2-3 Chinese names
|
|
27
|
+
const titleLen = title.length;
|
|
28
|
+
if (titleLen <= maxChars)
|
|
29
|
+
return title.toUpperCase();
|
|
30
|
+
// Return default for simplicity
|
|
31
|
+
return defaultTitle;
|
|
32
|
+
}
|
|
33
|
+
// First letter of each item
|
|
34
|
+
var firstLetters = items
|
|
35
|
+
.map((item) => item[0])
|
|
36
|
+
.join('')
|
|
37
|
+
.toUpperCase();
|
|
38
|
+
const flen = firstLetters.length;
|
|
39
|
+
if (flen <= maxChars)
|
|
40
|
+
return firstLetters;
|
|
41
|
+
return defaultTitle;
|
|
42
|
+
}
|
|
43
|
+
BusinessUtils.formatAvatarTitle = formatAvatarTitle;
|
|
12
44
|
/**
|
|
13
45
|
* Get currency collection
|
|
14
46
|
* @param currencyNames Names like CNY, USD
|
|
@@ -90,7 +122,7 @@ var BusinessUtils;
|
|
|
90
122
|
* @returns Units
|
|
91
123
|
*/
|
|
92
124
|
function getRepeatOptions(func, options, isJoined = true) {
|
|
93
|
-
options !== null && options !== void 0 ? options : (options = shared_1.DataTypes.getEnumKeys(
|
|
125
|
+
options !== null && options !== void 0 ? options : (options = shared_1.DataTypes.getEnumKeys(RepeatOption_1.RepeatOption));
|
|
94
126
|
isJoined !== null && isJoined !== void 0 ? isJoined : (isJoined = true);
|
|
95
127
|
return getUnits(func, options, isJoined);
|
|
96
128
|
}
|
package/lib/cjs/i18n/en-US.json
CHANGED
|
@@ -48,11 +48,13 @@
|
|
|
48
48
|
"expiry": "Expiry",
|
|
49
49
|
"failed": "Operation failed",
|
|
50
50
|
"field": "Field",
|
|
51
|
+
"help": "Help",
|
|
51
52
|
"id": "Number#",
|
|
52
53
|
"info": "Info",
|
|
53
54
|
"itemExists": "'{0}' already exists",
|
|
54
55
|
"loading": "Loading...",
|
|
55
56
|
"login": "Login",
|
|
57
|
+
"me": "ME",
|
|
56
58
|
"menuHome": "Home",
|
|
57
59
|
"message": "Message",
|
|
58
60
|
"mobile": "Mobile number",
|
|
@@ -140,6 +142,7 @@
|
|
|
140
142
|
"taxUSEIN": "Employer identification number",
|
|
141
143
|
"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",
|
|
142
144
|
"tokenExpiry": "Your session is about to expire. Click the Cancel button to continue",
|
|
145
|
+
"type": "Type",
|
|
143
146
|
"yes": "Yes",
|
|
144
147
|
"unknownError": "Unknown Error",
|
|
145
148
|
"unitJoin": "per {0}",
|
package/lib/cjs/i18n/zh-CN.json
CHANGED
|
@@ -48,11 +48,13 @@
|
|
|
48
48
|
"expiry": "到期时间",
|
|
49
49
|
"failed": "操作失败",
|
|
50
50
|
"field": "字段",
|
|
51
|
+
"help": "帮助",
|
|
51
52
|
"id": "编号",
|
|
52
53
|
"info": "信息",
|
|
53
54
|
"itemExists": "'{0}'已经存在",
|
|
54
55
|
"loading": "正在加载...",
|
|
55
56
|
"login": "登录",
|
|
57
|
+
"me": "我",
|
|
56
58
|
"menuHome": "首页",
|
|
57
59
|
"message": "留言",
|
|
58
60
|
"mobile": "手机号码",
|
|
@@ -140,6 +142,7 @@
|
|
|
140
142
|
"taxUSEIN": "雇主识别号码(EIN)",
|
|
141
143
|
"timeDifferenceInvalid": "设备时间和服务器时间差为{0},超过{1}秒的限制,请调整设备时间,如果异常请告知管理员",
|
|
142
144
|
"tokenExpiry": "您的会话即将过期。点击 取消 按钮继续使用",
|
|
145
|
+
"type": "类型",
|
|
143
146
|
"yes": "是",
|
|
144
147
|
"unknownError": "未知错误",
|
|
145
148
|
"unitJoin": "每{0}",
|
package/lib/cjs/i18n/zh-HK.json
CHANGED
|
@@ -48,11 +48,13 @@
|
|
|
48
48
|
"expiry": "到期時間",
|
|
49
49
|
"failed": "操作失敗",
|
|
50
50
|
"field": "字段",
|
|
51
|
+
"help": "幫助",
|
|
51
52
|
"id": "編號",
|
|
52
53
|
"info": "信息",
|
|
53
54
|
"itemExists": "'{0}'已经存在",
|
|
54
55
|
"loading": "正在加載...",
|
|
55
56
|
"login": "登錄",
|
|
57
|
+
"me": "我",
|
|
56
58
|
"menuHome": "首頁",
|
|
57
59
|
"message": "留言",
|
|
58
60
|
"mobilePhone": "手機號碼",
|
|
@@ -140,6 +142,7 @@
|
|
|
140
142
|
"taxUSEIN": "雇主識別號碼(EIN)",
|
|
141
143
|
"timeDifferenceInvalid": "設備時間和服務器時間差為{0},超過{1}秒的限制,請調整設備時間,如果異常請告知管理員",
|
|
142
144
|
"tokenExpiry": "您的會話即將過期。點擊 取消 按鈕繼續使用",
|
|
145
|
+
"type": "類型",
|
|
143
146
|
"yes": "是",
|
|
144
147
|
"unknownError": "未知錯誤",
|
|
145
148
|
"unitJoin": "每{0}",
|
package/lib/cjs/index.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export * from './result/IActionResult';
|
|
|
27
27
|
export * from './result/InitCallResult';
|
|
28
28
|
export * from './rq/LoginIdRQ';
|
|
29
29
|
export * from './rq/LoginRQ';
|
|
30
|
+
export * from './rq/QueryRQ';
|
|
31
|
+
export * from './rq/TiplistRQ';
|
|
30
32
|
export * from './state/Culture';
|
|
31
33
|
export * from './state/State';
|
|
32
34
|
export * from './state/User';
|
package/lib/cjs/index.js
CHANGED
|
@@ -55,6 +55,8 @@ __exportStar(require("./result/InitCallResult"), exports);
|
|
|
55
55
|
// rq
|
|
56
56
|
__exportStar(require("./rq/LoginIdRQ"), exports);
|
|
57
57
|
__exportStar(require("./rq/LoginRQ"), exports);
|
|
58
|
+
__exportStar(require("./rq/QueryRQ"), exports);
|
|
59
|
+
__exportStar(require("./rq/TiplistRQ"), exports);
|
|
58
60
|
// state
|
|
59
61
|
__exportStar(require("./state/Culture"), exports);
|
|
60
62
|
__exportStar(require("./state/State"), exports);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Query request data
|
|
3
|
+
* com.etsoo.CoreFramework.Models.QueryRQ
|
|
4
|
+
*/
|
|
5
|
+
export declare type QueryRQ = {
|
|
6
|
+
/**
|
|
7
|
+
* Number id
|
|
8
|
+
*/
|
|
9
|
+
id?: number;
|
|
10
|
+
/**
|
|
11
|
+
* String id
|
|
12
|
+
*/
|
|
13
|
+
sid?: number;
|
|
14
|
+
/**
|
|
15
|
+
* Current page
|
|
16
|
+
*/
|
|
17
|
+
currentPage: number;
|
|
18
|
+
/**
|
|
19
|
+
* Batch size
|
|
20
|
+
*/
|
|
21
|
+
batchSize: number;
|
|
22
|
+
/**
|
|
23
|
+
* Order by field name
|
|
24
|
+
*/
|
|
25
|
+
orderBy?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Order by ascending
|
|
28
|
+
*/
|
|
29
|
+
orderByAsc?: boolean;
|
|
30
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiplist request data
|
|
3
|
+
* com.etsoo.CoreFramework.Models.TiplistRQ
|
|
4
|
+
*/
|
|
5
|
+
export declare type TiplistRQ<T = number> = {
|
|
6
|
+
/**
|
|
7
|
+
* Current id
|
|
8
|
+
*/
|
|
9
|
+
id: T;
|
|
10
|
+
/**
|
|
11
|
+
* Excluded ids
|
|
12
|
+
*/
|
|
13
|
+
excludedIds?: T[];
|
|
14
|
+
/**
|
|
15
|
+
* Filter keyword
|
|
16
|
+
*/
|
|
17
|
+
keyword?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Max items to return
|
|
20
|
+
*/
|
|
21
|
+
items?: number;
|
|
22
|
+
};
|
package/lib/mjs/app/CoreApp.d.ts
CHANGED
|
@@ -235,8 +235,9 @@ export interface ICoreApp<U extends IUser, S extends IAppSettings, N, C extends
|
|
|
235
235
|
* Format result text
|
|
236
236
|
* @param result Action result
|
|
237
237
|
* @param forceToLocal Force to local labels
|
|
238
|
+
* @returns Message
|
|
238
239
|
*/
|
|
239
|
-
formatResult(result: IActionResult, forceToLocal?: boolean):
|
|
240
|
+
formatResult(result: IActionResult, forceToLocal?: boolean): string;
|
|
240
241
|
/**
|
|
241
242
|
* Fresh countdown UI
|
|
242
243
|
* @param callback Callback
|
|
@@ -691,7 +692,7 @@ export declare abstract class CoreApp<U extends IUser, S extends IAppSettings, N
|
|
|
691
692
|
* @param result Action result
|
|
692
693
|
* @param forceToLocal Force to local labels
|
|
693
694
|
*/
|
|
694
|
-
formatResult(result: IActionResult, forceToLocal?: boolean):
|
|
695
|
+
formatResult(result: IActionResult, forceToLocal?: boolean): string;
|
|
695
696
|
/**
|
|
696
697
|
* Get culture resource
|
|
697
698
|
* @param key key
|
package/lib/mjs/app/CoreApp.js
CHANGED
|
@@ -418,8 +418,7 @@ export class CoreApp {
|
|
|
418
418
|
* @param callback Callback
|
|
419
419
|
*/
|
|
420
420
|
alertResult(result, callback) {
|
|
421
|
-
this.formatResult(result);
|
|
422
|
-
this.notifier.alert(ActionResultError.format(result), callback);
|
|
421
|
+
this.notifier.alert(this.formatResult(result), callback);
|
|
423
422
|
}
|
|
424
423
|
/**
|
|
425
424
|
* Authorize
|
|
@@ -794,6 +793,7 @@ export class CoreApp {
|
|
|
794
793
|
if (fieldLabel)
|
|
795
794
|
result.title = result.title.format(fieldLabel);
|
|
796
795
|
}
|
|
796
|
+
return ActionResultError.format(result);
|
|
797
797
|
}
|
|
798
798
|
/**
|
|
799
799
|
* Get culture resource
|
|
@@ -6,6 +6,14 @@ import { ProductUnit } from './ProductUnit';
|
|
|
6
6
|
* Business utils
|
|
7
7
|
*/
|
|
8
8
|
export declare namespace BusinessUtils {
|
|
9
|
+
/**
|
|
10
|
+
* Format avatar title
|
|
11
|
+
* @param title Title
|
|
12
|
+
* @param maxChars Max characters
|
|
13
|
+
* @param defaultTitle Default title
|
|
14
|
+
* @returns Result
|
|
15
|
+
*/
|
|
16
|
+
function formatAvatarTitle(title?: string, maxChars?: number, defaultTitle?: string): string;
|
|
9
17
|
/**
|
|
10
18
|
* Get currency collection
|
|
11
19
|
* @param currencyNames Names like CNY, USD
|
|
@@ -1,11 +1,43 @@
|
|
|
1
1
|
import { DataTypes } from '@etsoo/shared';
|
|
2
|
-
import { RepeatOption } from '..';
|
|
3
2
|
import { ProductUnit } from './ProductUnit';
|
|
3
|
+
import { RepeatOption } from './RepeatOption';
|
|
4
4
|
/**
|
|
5
5
|
* Business utils
|
|
6
6
|
*/
|
|
7
7
|
export var BusinessUtils;
|
|
8
8
|
(function (BusinessUtils) {
|
|
9
|
+
/**
|
|
10
|
+
* Format avatar title
|
|
11
|
+
* @param title Title
|
|
12
|
+
* @param maxChars Max characters
|
|
13
|
+
* @param defaultTitle Default title
|
|
14
|
+
* @returns Result
|
|
15
|
+
*/
|
|
16
|
+
function formatAvatarTitle(title, maxChars = 3, defaultTitle = 'ME') {
|
|
17
|
+
// Just return for empty cases
|
|
18
|
+
if (title == null || title === '')
|
|
19
|
+
return defaultTitle;
|
|
20
|
+
// split with words
|
|
21
|
+
const items = title.trim().split(/\s+/g);
|
|
22
|
+
if (items.length === 1) {
|
|
23
|
+
// 2-3 Chinese names
|
|
24
|
+
const titleLen = title.length;
|
|
25
|
+
if (titleLen <= maxChars)
|
|
26
|
+
return title.toUpperCase();
|
|
27
|
+
// Return default for simplicity
|
|
28
|
+
return defaultTitle;
|
|
29
|
+
}
|
|
30
|
+
// First letter of each item
|
|
31
|
+
var firstLetters = items
|
|
32
|
+
.map((item) => item[0])
|
|
33
|
+
.join('')
|
|
34
|
+
.toUpperCase();
|
|
35
|
+
const flen = firstLetters.length;
|
|
36
|
+
if (flen <= maxChars)
|
|
37
|
+
return firstLetters;
|
|
38
|
+
return defaultTitle;
|
|
39
|
+
}
|
|
40
|
+
BusinessUtils.formatAvatarTitle = formatAvatarTitle;
|
|
9
41
|
/**
|
|
10
42
|
* Get currency collection
|
|
11
43
|
* @param currencyNames Names like CNY, USD
|
package/lib/mjs/i18n/en-US.json
CHANGED
|
@@ -48,11 +48,13 @@
|
|
|
48
48
|
"expiry": "Expiry",
|
|
49
49
|
"failed": "Operation failed",
|
|
50
50
|
"field": "Field",
|
|
51
|
+
"help": "Help",
|
|
51
52
|
"id": "Number#",
|
|
52
53
|
"info": "Info",
|
|
53
54
|
"itemExists": "'{0}' already exists",
|
|
54
55
|
"loading": "Loading...",
|
|
55
56
|
"login": "Login",
|
|
57
|
+
"me": "ME",
|
|
56
58
|
"menuHome": "Home",
|
|
57
59
|
"message": "Message",
|
|
58
60
|
"mobile": "Mobile number",
|
|
@@ -140,6 +142,7 @@
|
|
|
140
142
|
"taxUSEIN": "Employer identification number",
|
|
141
143
|
"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",
|
|
142
144
|
"tokenExpiry": "Your session is about to expire. Click the Cancel button to continue",
|
|
145
|
+
"type": "Type",
|
|
143
146
|
"yes": "Yes",
|
|
144
147
|
"unknownError": "Unknown Error",
|
|
145
148
|
"unitJoin": "per {0}",
|
package/lib/mjs/i18n/zh-CN.json
CHANGED
|
@@ -48,11 +48,13 @@
|
|
|
48
48
|
"expiry": "到期时间",
|
|
49
49
|
"failed": "操作失败",
|
|
50
50
|
"field": "字段",
|
|
51
|
+
"help": "帮助",
|
|
51
52
|
"id": "编号",
|
|
52
53
|
"info": "信息",
|
|
53
54
|
"itemExists": "'{0}'已经存在",
|
|
54
55
|
"loading": "正在加载...",
|
|
55
56
|
"login": "登录",
|
|
57
|
+
"me": "我",
|
|
56
58
|
"menuHome": "首页",
|
|
57
59
|
"message": "留言",
|
|
58
60
|
"mobile": "手机号码",
|
|
@@ -140,6 +142,7 @@
|
|
|
140
142
|
"taxUSEIN": "雇主识别号码(EIN)",
|
|
141
143
|
"timeDifferenceInvalid": "设备时间和服务器时间差为{0},超过{1}秒的限制,请调整设备时间,如果异常请告知管理员",
|
|
142
144
|
"tokenExpiry": "您的会话即将过期。点击 取消 按钮继续使用",
|
|
145
|
+
"type": "类型",
|
|
143
146
|
"yes": "是",
|
|
144
147
|
"unknownError": "未知错误",
|
|
145
148
|
"unitJoin": "每{0}",
|
package/lib/mjs/i18n/zh-HK.json
CHANGED
|
@@ -48,11 +48,13 @@
|
|
|
48
48
|
"expiry": "到期時間",
|
|
49
49
|
"failed": "操作失敗",
|
|
50
50
|
"field": "字段",
|
|
51
|
+
"help": "幫助",
|
|
51
52
|
"id": "編號",
|
|
52
53
|
"info": "信息",
|
|
53
54
|
"itemExists": "'{0}'已经存在",
|
|
54
55
|
"loading": "正在加載...",
|
|
55
56
|
"login": "登錄",
|
|
57
|
+
"me": "我",
|
|
56
58
|
"menuHome": "首頁",
|
|
57
59
|
"message": "留言",
|
|
58
60
|
"mobilePhone": "手機號碼",
|
|
@@ -140,6 +142,7 @@
|
|
|
140
142
|
"taxUSEIN": "雇主識別號碼(EIN)",
|
|
141
143
|
"timeDifferenceInvalid": "設備時間和服務器時間差為{0},超過{1}秒的限制,請調整設備時間,如果異常請告知管理員",
|
|
142
144
|
"tokenExpiry": "您的會話即將過期。點擊 取消 按鈕繼續使用",
|
|
145
|
+
"type": "類型",
|
|
143
146
|
"yes": "是",
|
|
144
147
|
"unknownError": "未知錯誤",
|
|
145
148
|
"unitJoin": "每{0}",
|
package/lib/mjs/index.d.ts
CHANGED
|
@@ -27,6 +27,8 @@ export * from './result/IActionResult';
|
|
|
27
27
|
export * from './result/InitCallResult';
|
|
28
28
|
export * from './rq/LoginIdRQ';
|
|
29
29
|
export * from './rq/LoginRQ';
|
|
30
|
+
export * from './rq/QueryRQ';
|
|
31
|
+
export * from './rq/TiplistRQ';
|
|
30
32
|
export * from './state/Culture';
|
|
31
33
|
export * from './state/State';
|
|
32
34
|
export * from './state/User';
|
package/lib/mjs/index.js
CHANGED
|
@@ -36,6 +36,8 @@ export * from './result/InitCallResult';
|
|
|
36
36
|
// rq
|
|
37
37
|
export * from './rq/LoginIdRQ';
|
|
38
38
|
export * from './rq/LoginRQ';
|
|
39
|
+
export * from './rq/QueryRQ';
|
|
40
|
+
export * from './rq/TiplistRQ';
|
|
39
41
|
// state
|
|
40
42
|
export * from './state/Culture';
|
|
41
43
|
export * from './state/State';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Query request data
|
|
3
|
+
* com.etsoo.CoreFramework.Models.QueryRQ
|
|
4
|
+
*/
|
|
5
|
+
export declare type QueryRQ = {
|
|
6
|
+
/**
|
|
7
|
+
* Number id
|
|
8
|
+
*/
|
|
9
|
+
id?: number;
|
|
10
|
+
/**
|
|
11
|
+
* String id
|
|
12
|
+
*/
|
|
13
|
+
sid?: number;
|
|
14
|
+
/**
|
|
15
|
+
* Current page
|
|
16
|
+
*/
|
|
17
|
+
currentPage: number;
|
|
18
|
+
/**
|
|
19
|
+
* Batch size
|
|
20
|
+
*/
|
|
21
|
+
batchSize: number;
|
|
22
|
+
/**
|
|
23
|
+
* Order by field name
|
|
24
|
+
*/
|
|
25
|
+
orderBy?: string;
|
|
26
|
+
/**
|
|
27
|
+
* Order by ascending
|
|
28
|
+
*/
|
|
29
|
+
orderByAsc?: boolean;
|
|
30
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiplist request data
|
|
3
|
+
* com.etsoo.CoreFramework.Models.TiplistRQ
|
|
4
|
+
*/
|
|
5
|
+
export declare type TiplistRQ<T = number> = {
|
|
6
|
+
/**
|
|
7
|
+
* Current id
|
|
8
|
+
*/
|
|
9
|
+
id: T;
|
|
10
|
+
/**
|
|
11
|
+
* Excluded ids
|
|
12
|
+
*/
|
|
13
|
+
excludedIds?: T[];
|
|
14
|
+
/**
|
|
15
|
+
* Filter keyword
|
|
16
|
+
*/
|
|
17
|
+
keyword?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Max items to return
|
|
20
|
+
*/
|
|
21
|
+
items?: number;
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/appscript",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.78",
|
|
4
4
|
"description": "Applications shared TypeScript framework",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
},
|
|
53
53
|
"homepage": "https://github.com/ETSOO/AppScript#readme",
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@etsoo/notificationbase": "^1.1.
|
|
55
|
+
"@etsoo/notificationbase": "^1.1.6",
|
|
56
56
|
"@etsoo/restclient": "^1.0.70",
|
|
57
|
-
"@etsoo/shared": "^1.1.
|
|
57
|
+
"@etsoo/shared": "^1.1.45",
|
|
58
58
|
"@types/crypto-js": "^4.1.1",
|
|
59
59
|
"crypto-js": "^4.1.1"
|
|
60
60
|
},
|
|
@@ -64,15 +64,15 @@
|
|
|
64
64
|
"@babel/plugin-transform-runtime": "^7.18.10",
|
|
65
65
|
"@babel/preset-env": "^7.18.10",
|
|
66
66
|
"@babel/runtime-corejs3": "^7.18.9",
|
|
67
|
-
"@types/jest": "^28.1.
|
|
68
|
-
"@typescript-eslint/eslint-plugin": "^5.33.
|
|
69
|
-
"@typescript-eslint/parser": "^5.33.
|
|
67
|
+
"@types/jest": "^28.1.7",
|
|
68
|
+
"@typescript-eslint/eslint-plugin": "^5.33.1",
|
|
69
|
+
"@typescript-eslint/parser": "^5.33.1",
|
|
70
70
|
"eslint": "^8.22.0",
|
|
71
71
|
"eslint-config-airbnb-base": "^15.0.0",
|
|
72
72
|
"eslint-plugin-import": "^2.26.0",
|
|
73
73
|
"jest": "^28.1.3",
|
|
74
74
|
"jest-environment-jsdom": "^28.1.3",
|
|
75
|
-
"ts-jest": "^28.0.
|
|
75
|
+
"ts-jest": "^28.0.8",
|
|
76
76
|
"typescript": "^4.7.4"
|
|
77
77
|
}
|
|
78
78
|
}
|
package/src/app/CoreApp.ts
CHANGED
|
@@ -347,8 +347,9 @@ export interface ICoreApp<
|
|
|
347
347
|
* Format result text
|
|
348
348
|
* @param result Action result
|
|
349
349
|
* @param forceToLocal Force to local labels
|
|
350
|
+
* @returns Message
|
|
350
351
|
*/
|
|
351
|
-
formatResult(result: IActionResult, forceToLocal?: boolean):
|
|
352
|
+
formatResult(result: IActionResult, forceToLocal?: boolean): string;
|
|
352
353
|
|
|
353
354
|
/**
|
|
354
355
|
* Fresh countdown UI
|
|
@@ -1109,8 +1110,7 @@ export abstract class CoreApp<
|
|
|
1109
1110
|
* @param callback Callback
|
|
1110
1111
|
*/
|
|
1111
1112
|
alertResult(result: IActionResult, callback?: NotificationReturn<void>) {
|
|
1112
|
-
this.formatResult(result);
|
|
1113
|
-
this.notifier.alert(ActionResultError.format(result), callback);
|
|
1113
|
+
this.notifier.alert(this.formatResult(result), callback);
|
|
1114
1114
|
}
|
|
1115
1115
|
|
|
1116
1116
|
/**
|
|
@@ -1566,6 +1566,8 @@ export abstract class CoreApp<
|
|
|
1566
1566
|
const fieldLabel = this.get(result.field.formatInitial(false));
|
|
1567
1567
|
if (fieldLabel) result.title = result.title.format(fieldLabel);
|
|
1568
1568
|
}
|
|
1569
|
+
|
|
1570
|
+
return ActionResultError.format(result);
|
|
1569
1571
|
}
|
|
1570
1572
|
|
|
1571
1573
|
/**
|
|
@@ -1,13 +1,52 @@
|
|
|
1
1
|
import { DataTypes } from '@etsoo/shared';
|
|
2
|
-
import { RepeatOption } from '..';
|
|
3
2
|
import { IdLabelDto } from '../dto/IdLabelDto';
|
|
4
3
|
import { ICultureGet } from '../state/Culture';
|
|
5
4
|
import { ProductUnit } from './ProductUnit';
|
|
5
|
+
import { RepeatOption } from './RepeatOption';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Business utils
|
|
9
9
|
*/
|
|
10
10
|
export namespace BusinessUtils {
|
|
11
|
+
/**
|
|
12
|
+
* Format avatar title
|
|
13
|
+
* @param title Title
|
|
14
|
+
* @param maxChars Max characters
|
|
15
|
+
* @param defaultTitle Default title
|
|
16
|
+
* @returns Result
|
|
17
|
+
*/
|
|
18
|
+
export function formatAvatarTitle(
|
|
19
|
+
title?: string,
|
|
20
|
+
maxChars: number = 3,
|
|
21
|
+
defaultTitle: string = 'ME'
|
|
22
|
+
): string {
|
|
23
|
+
// Just return for empty cases
|
|
24
|
+
if (title == null || title === '') return defaultTitle;
|
|
25
|
+
|
|
26
|
+
// split with words
|
|
27
|
+
const items = title.trim().split(/\s+/g);
|
|
28
|
+
|
|
29
|
+
if (items.length === 1) {
|
|
30
|
+
// 2-3 Chinese names
|
|
31
|
+
const titleLen = title.length;
|
|
32
|
+
if (titleLen <= maxChars) return title.toUpperCase();
|
|
33
|
+
|
|
34
|
+
// Return default for simplicity
|
|
35
|
+
return defaultTitle;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// First letter of each item
|
|
39
|
+
var firstLetters = items
|
|
40
|
+
.map((item) => item[0])
|
|
41
|
+
.join('')
|
|
42
|
+
.toUpperCase();
|
|
43
|
+
|
|
44
|
+
const flen = firstLetters.length;
|
|
45
|
+
if (flen <= maxChars) return firstLetters;
|
|
46
|
+
|
|
47
|
+
return defaultTitle;
|
|
48
|
+
}
|
|
49
|
+
|
|
11
50
|
/**
|
|
12
51
|
* Get currency collection
|
|
13
52
|
* @param currencyNames Names like CNY, USD
|
package/src/i18n/en-US.json
CHANGED
|
@@ -48,11 +48,13 @@
|
|
|
48
48
|
"expiry": "Expiry",
|
|
49
49
|
"failed": "Operation failed",
|
|
50
50
|
"field": "Field",
|
|
51
|
+
"help": "Help",
|
|
51
52
|
"id": "Number#",
|
|
52
53
|
"info": "Info",
|
|
53
54
|
"itemExists": "'{0}' already exists",
|
|
54
55
|
"loading": "Loading...",
|
|
55
56
|
"login": "Login",
|
|
57
|
+
"me": "ME",
|
|
56
58
|
"menuHome": "Home",
|
|
57
59
|
"message": "Message",
|
|
58
60
|
"mobile": "Mobile number",
|
|
@@ -140,6 +142,7 @@
|
|
|
140
142
|
"taxUSEIN": "Employer identification number",
|
|
141
143
|
"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",
|
|
142
144
|
"tokenExpiry": "Your session is about to expire. Click the Cancel button to continue",
|
|
145
|
+
"type": "Type",
|
|
143
146
|
"yes": "Yes",
|
|
144
147
|
"unknownError": "Unknown Error",
|
|
145
148
|
"unitJoin": "per {0}",
|
package/src/i18n/zh-CN.json
CHANGED
|
@@ -48,11 +48,13 @@
|
|
|
48
48
|
"expiry": "到期时间",
|
|
49
49
|
"failed": "操作失败",
|
|
50
50
|
"field": "字段",
|
|
51
|
+
"help": "帮助",
|
|
51
52
|
"id": "编号",
|
|
52
53
|
"info": "信息",
|
|
53
54
|
"itemExists": "'{0}'已经存在",
|
|
54
55
|
"loading": "正在加载...",
|
|
55
56
|
"login": "登录",
|
|
57
|
+
"me": "我",
|
|
56
58
|
"menuHome": "首页",
|
|
57
59
|
"message": "留言",
|
|
58
60
|
"mobile": "手机号码",
|
|
@@ -140,6 +142,7 @@
|
|
|
140
142
|
"taxUSEIN": "雇主识别号码(EIN)",
|
|
141
143
|
"timeDifferenceInvalid": "设备时间和服务器时间差为{0},超过{1}秒的限制,请调整设备时间,如果异常请告知管理员",
|
|
142
144
|
"tokenExpiry": "您的会话即将过期。点击 取消 按钮继续使用",
|
|
145
|
+
"type": "类型",
|
|
143
146
|
"yes": "是",
|
|
144
147
|
"unknownError": "未知错误",
|
|
145
148
|
"unitJoin": "每{0}",
|
package/src/i18n/zh-HK.json
CHANGED
|
@@ -48,11 +48,13 @@
|
|
|
48
48
|
"expiry": "到期時間",
|
|
49
49
|
"failed": "操作失敗",
|
|
50
50
|
"field": "字段",
|
|
51
|
+
"help": "幫助",
|
|
51
52
|
"id": "編號",
|
|
52
53
|
"info": "信息",
|
|
53
54
|
"itemExists": "'{0}'已经存在",
|
|
54
55
|
"loading": "正在加載...",
|
|
55
56
|
"login": "登錄",
|
|
57
|
+
"me": "我",
|
|
56
58
|
"menuHome": "首頁",
|
|
57
59
|
"message": "留言",
|
|
58
60
|
"mobilePhone": "手機號碼",
|
|
@@ -140,6 +142,7 @@
|
|
|
140
142
|
"taxUSEIN": "雇主識別號碼(EIN)",
|
|
141
143
|
"timeDifferenceInvalid": "設備時間和服務器時間差為{0},超過{1}秒的限制,請調整設備時間,如果異常請告知管理員",
|
|
142
144
|
"tokenExpiry": "您的會話即將過期。點擊 取消 按鈕繼續使用",
|
|
145
|
+
"type": "類型",
|
|
143
146
|
"yes": "是",
|
|
144
147
|
"unknownError": "未知錯誤",
|
|
145
148
|
"unitJoin": "每{0}",
|
package/src/index.ts
CHANGED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Query request data
|
|
3
|
+
* com.etsoo.CoreFramework.Models.QueryRQ
|
|
4
|
+
*/
|
|
5
|
+
export type QueryRQ = {
|
|
6
|
+
/**
|
|
7
|
+
* Number id
|
|
8
|
+
*/
|
|
9
|
+
id?: number;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* String id
|
|
13
|
+
*/
|
|
14
|
+
sid?: number;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Current page
|
|
18
|
+
*/
|
|
19
|
+
currentPage: number;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Batch size
|
|
23
|
+
*/
|
|
24
|
+
batchSize: number;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Order by field name
|
|
28
|
+
*/
|
|
29
|
+
orderBy?: string;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Order by ascending
|
|
33
|
+
*/
|
|
34
|
+
orderByAsc?: boolean;
|
|
35
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tiplist request data
|
|
3
|
+
* com.etsoo.CoreFramework.Models.TiplistRQ
|
|
4
|
+
*/
|
|
5
|
+
export type TiplistRQ<T = number> = {
|
|
6
|
+
/**
|
|
7
|
+
* Current id
|
|
8
|
+
*/
|
|
9
|
+
id: T;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Excluded ids
|
|
13
|
+
*/
|
|
14
|
+
excludedIds?: T[];
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Filter keyword
|
|
18
|
+
*/
|
|
19
|
+
keyword?: string;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Max items to return
|
|
23
|
+
*/
|
|
24
|
+
items?: number;
|
|
25
|
+
};
|