@etsoo/appscript 1.0.86 → 1.0.90
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/lib/cjs/app/CoreApp.d.ts +10 -0
- package/lib/cjs/app/CoreApp.js +9 -0
- package/lib/cjs/business/ProductUnit.d.ts +18 -0
- package/lib/cjs/business/ProductUnit.js +70 -0
- package/lib/cjs/business/Utils.d.ts +15 -0
- package/lib/cjs/business/Utils.js +23 -0
- package/lib/cjs/state/Culture.d.ts +6 -0
- package/lib/mjs/app/CoreApp.d.ts +10 -0
- package/lib/mjs/app/CoreApp.js +9 -0
- package/lib/mjs/business/ProductUnit.d.ts +18 -0
- package/lib/mjs/business/ProductUnit.js +67 -0
- package/lib/mjs/business/Utils.d.ts +15 -0
- package/lib/mjs/business/Utils.js +20 -0
- package/lib/mjs/state/Culture.d.ts +6 -0
- package/package.json +7 -7
- package/src/app/CoreApp.ts +15 -0
- package/src/business/ProductUnit.ts +77 -0
- package/src/business/Utils.ts +19 -0
- package/src/state/Culture.ts +7 -0
package/lib/cjs/app/CoreApp.d.ts
CHANGED
|
@@ -106,6 +106,11 @@ export interface ICoreApp<S extends IAppSettings, N> {
|
|
|
106
106
|
* @returns response refresh token
|
|
107
107
|
*/
|
|
108
108
|
getResponseToken(rawResponse: any): string | null;
|
|
109
|
+
/**
|
|
110
|
+
* Get time zone
|
|
111
|
+
* @returns Time zone
|
|
112
|
+
*/
|
|
113
|
+
getTimeZone(): string | undefined;
|
|
109
114
|
/**
|
|
110
115
|
* Callback where exit a page
|
|
111
116
|
*/
|
|
@@ -244,6 +249,11 @@ export declare abstract class CoreApp<S extends IAppSettings, N> implements ICor
|
|
|
244
249
|
* @returns response refresh token
|
|
245
250
|
*/
|
|
246
251
|
getResponseToken(rawResponse: any): string | null;
|
|
252
|
+
/**
|
|
253
|
+
* Get time zone
|
|
254
|
+
* @returns Time zone
|
|
255
|
+
*/
|
|
256
|
+
getTimeZone(): string | undefined;
|
|
247
257
|
/**
|
|
248
258
|
* Callback where exit a page
|
|
249
259
|
*/
|
package/lib/cjs/app/CoreApp.js
CHANGED
|
@@ -213,6 +213,15 @@ class CoreApp {
|
|
|
213
213
|
const response = this.api.transformResponse(rawResponse);
|
|
214
214
|
return this.api.getHeaderValue(response.headers, this.headerTokenField);
|
|
215
215
|
}
|
|
216
|
+
/**
|
|
217
|
+
* Get time zone
|
|
218
|
+
* @returns Time zone
|
|
219
|
+
*/
|
|
220
|
+
getTimeZone() {
|
|
221
|
+
var _a, _b;
|
|
222
|
+
// settings.timeZone = Utils.getTimeZone()
|
|
223
|
+
return (_a = this.settings.timeZone) !== null && _a !== void 0 ? _a : (_b = this.ipData) === null || _b === void 0 ? void 0 : _b.timezone;
|
|
224
|
+
}
|
|
216
225
|
/**
|
|
217
226
|
* Callback where exit a page
|
|
218
227
|
*/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Product units enum
|
|
3
|
+
* See com.etsoo.CoreFramework.Business.ProductUnit
|
|
4
|
+
*/
|
|
5
|
+
export declare enum ProductUnit {
|
|
6
|
+
PC = 0,
|
|
7
|
+
SET = 1,
|
|
8
|
+
YEAR = 10,
|
|
9
|
+
QUATER = 11,
|
|
10
|
+
MONTH = 12,
|
|
11
|
+
FORNIGHT = 13,
|
|
12
|
+
WEEK = 14,
|
|
13
|
+
DAY = 15,
|
|
14
|
+
HOUR = 16,
|
|
15
|
+
TON = 31,
|
|
16
|
+
KILOGRAM = 32,
|
|
17
|
+
GRAM = 33
|
|
18
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ProductUnit = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Product units enum
|
|
6
|
+
* See com.etsoo.CoreFramework.Business.ProductUnit
|
|
7
|
+
*/
|
|
8
|
+
var ProductUnit;
|
|
9
|
+
(function (ProductUnit) {
|
|
10
|
+
/// <summary>
|
|
11
|
+
/// Picese
|
|
12
|
+
/// 件
|
|
13
|
+
/// </summary>
|
|
14
|
+
ProductUnit[ProductUnit["PC"] = 0] = "PC";
|
|
15
|
+
/// <summary>
|
|
16
|
+
/// Set
|
|
17
|
+
/// 套
|
|
18
|
+
/// </summary>
|
|
19
|
+
ProductUnit[ProductUnit["SET"] = 1] = "SET";
|
|
20
|
+
/// <summary>
|
|
21
|
+
/// Year
|
|
22
|
+
/// 年
|
|
23
|
+
/// </summary>
|
|
24
|
+
ProductUnit[ProductUnit["YEAR"] = 10] = "YEAR";
|
|
25
|
+
/// <summary>
|
|
26
|
+
/// Quater
|
|
27
|
+
/// 季
|
|
28
|
+
/// </summary>
|
|
29
|
+
ProductUnit[ProductUnit["QUATER"] = 11] = "QUATER";
|
|
30
|
+
/// <summary>
|
|
31
|
+
/// Month
|
|
32
|
+
/// 月
|
|
33
|
+
/// </summary>
|
|
34
|
+
ProductUnit[ProductUnit["MONTH"] = 12] = "MONTH";
|
|
35
|
+
/// <summary>
|
|
36
|
+
/// Fortnight
|
|
37
|
+
/// 两周
|
|
38
|
+
/// </summary>
|
|
39
|
+
ProductUnit[ProductUnit["FORNIGHT"] = 13] = "FORNIGHT";
|
|
40
|
+
/// <summary>
|
|
41
|
+
/// Week
|
|
42
|
+
/// 周
|
|
43
|
+
/// </summary>
|
|
44
|
+
ProductUnit[ProductUnit["WEEK"] = 14] = "WEEK";
|
|
45
|
+
/// <summary>
|
|
46
|
+
/// Day
|
|
47
|
+
/// 天
|
|
48
|
+
/// </summary>
|
|
49
|
+
ProductUnit[ProductUnit["DAY"] = 15] = "DAY";
|
|
50
|
+
/// <summary>
|
|
51
|
+
/// Hour
|
|
52
|
+
/// 小时
|
|
53
|
+
/// </summary>
|
|
54
|
+
ProductUnit[ProductUnit["HOUR"] = 16] = "HOUR";
|
|
55
|
+
/// <summary>
|
|
56
|
+
/// Ton
|
|
57
|
+
/// 吨
|
|
58
|
+
/// </summary>
|
|
59
|
+
ProductUnit[ProductUnit["TON"] = 31] = "TON";
|
|
60
|
+
/// <summary>
|
|
61
|
+
/// Kilogram
|
|
62
|
+
/// 千克
|
|
63
|
+
/// </summary>
|
|
64
|
+
ProductUnit[ProductUnit["KILOGRAM"] = 32] = "KILOGRAM";
|
|
65
|
+
/// <summary>
|
|
66
|
+
/// Gram
|
|
67
|
+
/// 克
|
|
68
|
+
/// </summary>
|
|
69
|
+
ProductUnit[ProductUnit["GRAM"] = 33] = "GRAM";
|
|
70
|
+
})(ProductUnit = exports.ProductUnit || (exports.ProductUnit = {}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ICultureGet } from '../state/Culture';
|
|
2
|
+
import { ProductUnit } from './ProductUnit';
|
|
3
|
+
/**
|
|
4
|
+
* Business utils
|
|
5
|
+
*/
|
|
6
|
+
export declare namespace Utils {
|
|
7
|
+
/**
|
|
8
|
+
* Get product unit's label
|
|
9
|
+
* Please define the label in culture with key 'unitPC' for ProductUnit.PC like that
|
|
10
|
+
* @param unit Unit
|
|
11
|
+
* @param func Label delegate
|
|
12
|
+
* @returns Label
|
|
13
|
+
*/
|
|
14
|
+
function getUnitLabel(unit: ProductUnit, func: ICultureGet): string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Utils = void 0;
|
|
4
|
+
const ProductUnit_1 = require("./ProductUnit");
|
|
5
|
+
/**
|
|
6
|
+
* Business utils
|
|
7
|
+
*/
|
|
8
|
+
var Utils;
|
|
9
|
+
(function (Utils) {
|
|
10
|
+
/**
|
|
11
|
+
* Get product unit's label
|
|
12
|
+
* Please define the label in culture with key 'unitPC' for ProductUnit.PC like that
|
|
13
|
+
* @param unit Unit
|
|
14
|
+
* @param func Label delegate
|
|
15
|
+
* @returns Label
|
|
16
|
+
*/
|
|
17
|
+
function getUnitLabel(unit, func) {
|
|
18
|
+
var _a;
|
|
19
|
+
const key = ProductUnit_1.ProductUnit[unit];
|
|
20
|
+
return (_a = func('unit' + key)) !== null && _a !== void 0 ? _a : key;
|
|
21
|
+
}
|
|
22
|
+
Utils.getUnitLabel = getUnitLabel;
|
|
23
|
+
})(Utils = exports.Utils || (exports.Utils = {}));
|
package/lib/mjs/app/CoreApp.d.ts
CHANGED
|
@@ -106,6 +106,11 @@ export interface ICoreApp<S extends IAppSettings, N> {
|
|
|
106
106
|
* @returns response refresh token
|
|
107
107
|
*/
|
|
108
108
|
getResponseToken(rawResponse: any): string | null;
|
|
109
|
+
/**
|
|
110
|
+
* Get time zone
|
|
111
|
+
* @returns Time zone
|
|
112
|
+
*/
|
|
113
|
+
getTimeZone(): string | undefined;
|
|
109
114
|
/**
|
|
110
115
|
* Callback where exit a page
|
|
111
116
|
*/
|
|
@@ -244,6 +249,11 @@ export declare abstract class CoreApp<S extends IAppSettings, N> implements ICor
|
|
|
244
249
|
* @returns response refresh token
|
|
245
250
|
*/
|
|
246
251
|
getResponseToken(rawResponse: any): string | null;
|
|
252
|
+
/**
|
|
253
|
+
* Get time zone
|
|
254
|
+
* @returns Time zone
|
|
255
|
+
*/
|
|
256
|
+
getTimeZone(): string | undefined;
|
|
247
257
|
/**
|
|
248
258
|
* Callback where exit a page
|
|
249
259
|
*/
|
package/lib/mjs/app/CoreApp.js
CHANGED
|
@@ -210,6 +210,15 @@ export class CoreApp {
|
|
|
210
210
|
const response = this.api.transformResponse(rawResponse);
|
|
211
211
|
return this.api.getHeaderValue(response.headers, this.headerTokenField);
|
|
212
212
|
}
|
|
213
|
+
/**
|
|
214
|
+
* Get time zone
|
|
215
|
+
* @returns Time zone
|
|
216
|
+
*/
|
|
217
|
+
getTimeZone() {
|
|
218
|
+
var _a, _b;
|
|
219
|
+
// settings.timeZone = Utils.getTimeZone()
|
|
220
|
+
return (_a = this.settings.timeZone) !== null && _a !== void 0 ? _a : (_b = this.ipData) === null || _b === void 0 ? void 0 : _b.timezone;
|
|
221
|
+
}
|
|
213
222
|
/**
|
|
214
223
|
* Callback where exit a page
|
|
215
224
|
*/
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Product units enum
|
|
3
|
+
* See com.etsoo.CoreFramework.Business.ProductUnit
|
|
4
|
+
*/
|
|
5
|
+
export declare enum ProductUnit {
|
|
6
|
+
PC = 0,
|
|
7
|
+
SET = 1,
|
|
8
|
+
YEAR = 10,
|
|
9
|
+
QUATER = 11,
|
|
10
|
+
MONTH = 12,
|
|
11
|
+
FORNIGHT = 13,
|
|
12
|
+
WEEK = 14,
|
|
13
|
+
DAY = 15,
|
|
14
|
+
HOUR = 16,
|
|
15
|
+
TON = 31,
|
|
16
|
+
KILOGRAM = 32,
|
|
17
|
+
GRAM = 33
|
|
18
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Product units enum
|
|
3
|
+
* See com.etsoo.CoreFramework.Business.ProductUnit
|
|
4
|
+
*/
|
|
5
|
+
export var ProductUnit;
|
|
6
|
+
(function (ProductUnit) {
|
|
7
|
+
/// <summary>
|
|
8
|
+
/// Picese
|
|
9
|
+
/// 件
|
|
10
|
+
/// </summary>
|
|
11
|
+
ProductUnit[ProductUnit["PC"] = 0] = "PC";
|
|
12
|
+
/// <summary>
|
|
13
|
+
/// Set
|
|
14
|
+
/// 套
|
|
15
|
+
/// </summary>
|
|
16
|
+
ProductUnit[ProductUnit["SET"] = 1] = "SET";
|
|
17
|
+
/// <summary>
|
|
18
|
+
/// Year
|
|
19
|
+
/// 年
|
|
20
|
+
/// </summary>
|
|
21
|
+
ProductUnit[ProductUnit["YEAR"] = 10] = "YEAR";
|
|
22
|
+
/// <summary>
|
|
23
|
+
/// Quater
|
|
24
|
+
/// 季
|
|
25
|
+
/// </summary>
|
|
26
|
+
ProductUnit[ProductUnit["QUATER"] = 11] = "QUATER";
|
|
27
|
+
/// <summary>
|
|
28
|
+
/// Month
|
|
29
|
+
/// 月
|
|
30
|
+
/// </summary>
|
|
31
|
+
ProductUnit[ProductUnit["MONTH"] = 12] = "MONTH";
|
|
32
|
+
/// <summary>
|
|
33
|
+
/// Fortnight
|
|
34
|
+
/// 两周
|
|
35
|
+
/// </summary>
|
|
36
|
+
ProductUnit[ProductUnit["FORNIGHT"] = 13] = "FORNIGHT";
|
|
37
|
+
/// <summary>
|
|
38
|
+
/// Week
|
|
39
|
+
/// 周
|
|
40
|
+
/// </summary>
|
|
41
|
+
ProductUnit[ProductUnit["WEEK"] = 14] = "WEEK";
|
|
42
|
+
/// <summary>
|
|
43
|
+
/// Day
|
|
44
|
+
/// 天
|
|
45
|
+
/// </summary>
|
|
46
|
+
ProductUnit[ProductUnit["DAY"] = 15] = "DAY";
|
|
47
|
+
/// <summary>
|
|
48
|
+
/// Hour
|
|
49
|
+
/// 小时
|
|
50
|
+
/// </summary>
|
|
51
|
+
ProductUnit[ProductUnit["HOUR"] = 16] = "HOUR";
|
|
52
|
+
/// <summary>
|
|
53
|
+
/// Ton
|
|
54
|
+
/// 吨
|
|
55
|
+
/// </summary>
|
|
56
|
+
ProductUnit[ProductUnit["TON"] = 31] = "TON";
|
|
57
|
+
/// <summary>
|
|
58
|
+
/// Kilogram
|
|
59
|
+
/// 千克
|
|
60
|
+
/// </summary>
|
|
61
|
+
ProductUnit[ProductUnit["KILOGRAM"] = 32] = "KILOGRAM";
|
|
62
|
+
/// <summary>
|
|
63
|
+
/// Gram
|
|
64
|
+
/// 克
|
|
65
|
+
/// </summary>
|
|
66
|
+
ProductUnit[ProductUnit["GRAM"] = 33] = "GRAM";
|
|
67
|
+
})(ProductUnit || (ProductUnit = {}));
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ICultureGet } from '../state/Culture';
|
|
2
|
+
import { ProductUnit } from './ProductUnit';
|
|
3
|
+
/**
|
|
4
|
+
* Business utils
|
|
5
|
+
*/
|
|
6
|
+
export declare namespace Utils {
|
|
7
|
+
/**
|
|
8
|
+
* Get product unit's label
|
|
9
|
+
* Please define the label in culture with key 'unitPC' for ProductUnit.PC like that
|
|
10
|
+
* @param unit Unit
|
|
11
|
+
* @param func Label delegate
|
|
12
|
+
* @returns Label
|
|
13
|
+
*/
|
|
14
|
+
function getUnitLabel(unit: ProductUnit, func: ICultureGet): string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ProductUnit } from './ProductUnit';
|
|
2
|
+
/**
|
|
3
|
+
* Business utils
|
|
4
|
+
*/
|
|
5
|
+
export var Utils;
|
|
6
|
+
(function (Utils) {
|
|
7
|
+
/**
|
|
8
|
+
* Get product unit's label
|
|
9
|
+
* Please define the label in culture with key 'unitPC' for ProductUnit.PC like that
|
|
10
|
+
* @param unit Unit
|
|
11
|
+
* @param func Label delegate
|
|
12
|
+
* @returns Label
|
|
13
|
+
*/
|
|
14
|
+
function getUnitLabel(unit, func) {
|
|
15
|
+
var _a;
|
|
16
|
+
const key = ProductUnit[unit];
|
|
17
|
+
return (_a = func('unit' + key)) !== null && _a !== void 0 ? _a : key;
|
|
18
|
+
}
|
|
19
|
+
Utils.getUnitLabel = getUnitLabel;
|
|
20
|
+
})(Utils || (Utils = {}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@etsoo/appscript",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.90",
|
|
4
4
|
"description": "Applications shared TypeScript framework",
|
|
5
5
|
"main": "lib/cjs/index.js",
|
|
6
6
|
"module": "lib/mjs/index.js",
|
|
@@ -47,23 +47,23 @@
|
|
|
47
47
|
},
|
|
48
48
|
"homepage": "https://github.com/ETSOO/NotificationBase#readme",
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@etsoo/notificationbase": "^1.0.
|
|
50
|
+
"@etsoo/notificationbase": "^1.0.78",
|
|
51
51
|
"@etsoo/restclient": "^1.0.51",
|
|
52
52
|
"@etsoo/shared": "^1.0.41"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@babel/cli": "^7.15.
|
|
55
|
+
"@babel/cli": "^7.15.7",
|
|
56
56
|
"@babel/core": "^7.15.5",
|
|
57
57
|
"@babel/plugin-transform-runtime": "^7.15.0",
|
|
58
58
|
"@babel/preset-env": "^7.15.6",
|
|
59
59
|
"@babel/runtime-corejs3": "^7.15.4",
|
|
60
|
-
"@types/jest": "^27.0.
|
|
61
|
-
"@typescript-eslint/eslint-plugin": "^4.
|
|
62
|
-
"@typescript-eslint/parser": "^4.
|
|
60
|
+
"@types/jest": "^27.0.2",
|
|
61
|
+
"@typescript-eslint/eslint-plugin": "^4.32.0",
|
|
62
|
+
"@typescript-eslint/parser": "^4.32.0",
|
|
63
63
|
"eslint": "^7.32.0",
|
|
64
64
|
"eslint-config-airbnb-base": "^14.2.1",
|
|
65
65
|
"eslint-plugin-import": "^2.24.2",
|
|
66
|
-
"jest": "^27.2.
|
|
66
|
+
"jest": "^27.2.3",
|
|
67
67
|
"ts-jest": "^27.0.5",
|
|
68
68
|
"typescript": "^4.4.3"
|
|
69
69
|
}
|
package/src/app/CoreApp.ts
CHANGED
|
@@ -129,6 +129,12 @@ export interface ICoreApp<S extends IAppSettings, N> {
|
|
|
129
129
|
*/
|
|
130
130
|
getResponseToken(rawResponse: any): string | null;
|
|
131
131
|
|
|
132
|
+
/**
|
|
133
|
+
* Get time zone
|
|
134
|
+
* @returns Time zone
|
|
135
|
+
*/
|
|
136
|
+
getTimeZone(): string | undefined;
|
|
137
|
+
|
|
132
138
|
/**
|
|
133
139
|
* Callback where exit a page
|
|
134
140
|
*/
|
|
@@ -453,6 +459,15 @@ export abstract class CoreApp<S extends IAppSettings, N>
|
|
|
453
459
|
return this.api.getHeaderValue(response.headers, this.headerTokenField);
|
|
454
460
|
}
|
|
455
461
|
|
|
462
|
+
/**
|
|
463
|
+
* Get time zone
|
|
464
|
+
* @returns Time zone
|
|
465
|
+
*/
|
|
466
|
+
getTimeZone(): string | undefined {
|
|
467
|
+
// settings.timeZone = Utils.getTimeZone()
|
|
468
|
+
return this.settings.timeZone ?? this.ipData?.timezone;
|
|
469
|
+
}
|
|
470
|
+
|
|
456
471
|
/**
|
|
457
472
|
* Callback where exit a page
|
|
458
473
|
*/
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Product units enum
|
|
3
|
+
* See com.etsoo.CoreFramework.Business.ProductUnit
|
|
4
|
+
*/
|
|
5
|
+
export enum ProductUnit {
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// Picese
|
|
8
|
+
/// 件
|
|
9
|
+
/// </summary>
|
|
10
|
+
PC = 0,
|
|
11
|
+
|
|
12
|
+
/// <summary>
|
|
13
|
+
/// Set
|
|
14
|
+
/// 套
|
|
15
|
+
/// </summary>
|
|
16
|
+
SET = 1,
|
|
17
|
+
|
|
18
|
+
/// <summary>
|
|
19
|
+
/// Year
|
|
20
|
+
/// 年
|
|
21
|
+
/// </summary>
|
|
22
|
+
YEAR = 10,
|
|
23
|
+
|
|
24
|
+
/// <summary>
|
|
25
|
+
/// Quater
|
|
26
|
+
/// 季
|
|
27
|
+
/// </summary>
|
|
28
|
+
QUATER = 11,
|
|
29
|
+
|
|
30
|
+
/// <summary>
|
|
31
|
+
/// Month
|
|
32
|
+
/// 月
|
|
33
|
+
/// </summary>
|
|
34
|
+
MONTH = 12,
|
|
35
|
+
|
|
36
|
+
/// <summary>
|
|
37
|
+
/// Fortnight
|
|
38
|
+
/// 两周
|
|
39
|
+
/// </summary>
|
|
40
|
+
FORNIGHT = 13,
|
|
41
|
+
|
|
42
|
+
/// <summary>
|
|
43
|
+
/// Week
|
|
44
|
+
/// 周
|
|
45
|
+
/// </summary>
|
|
46
|
+
WEEK = 14,
|
|
47
|
+
|
|
48
|
+
/// <summary>
|
|
49
|
+
/// Day
|
|
50
|
+
/// 天
|
|
51
|
+
/// </summary>
|
|
52
|
+
DAY = 15,
|
|
53
|
+
|
|
54
|
+
/// <summary>
|
|
55
|
+
/// Hour
|
|
56
|
+
/// 小时
|
|
57
|
+
/// </summary>
|
|
58
|
+
HOUR = 16,
|
|
59
|
+
|
|
60
|
+
/// <summary>
|
|
61
|
+
/// Ton
|
|
62
|
+
/// 吨
|
|
63
|
+
/// </summary>
|
|
64
|
+
TON = 31,
|
|
65
|
+
|
|
66
|
+
/// <summary>
|
|
67
|
+
/// Kilogram
|
|
68
|
+
/// 千克
|
|
69
|
+
/// </summary>
|
|
70
|
+
KILOGRAM = 32,
|
|
71
|
+
|
|
72
|
+
/// <summary>
|
|
73
|
+
/// Gram
|
|
74
|
+
/// 克
|
|
75
|
+
/// </summary>
|
|
76
|
+
GRAM = 33
|
|
77
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ICultureGet } from '../state/Culture';
|
|
2
|
+
import { ProductUnit } from './ProductUnit';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Business utils
|
|
6
|
+
*/
|
|
7
|
+
export namespace Utils {
|
|
8
|
+
/**
|
|
9
|
+
* Get product unit's label
|
|
10
|
+
* Please define the label in culture with key 'unitPC' for ProductUnit.PC like that
|
|
11
|
+
* @param unit Unit
|
|
12
|
+
* @param func Label delegate
|
|
13
|
+
* @returns Label
|
|
14
|
+
*/
|
|
15
|
+
export function getUnitLabel(unit: ProductUnit, func: ICultureGet) {
|
|
16
|
+
const key = ProductUnit[unit];
|
|
17
|
+
return func('unit' + key) ?? key;
|
|
18
|
+
}
|
|
19
|
+
}
|
package/src/state/Culture.ts
CHANGED