CompUtils.ets
1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import { LabelDTO } from 'wdBean';
import { Logger } from 'wdKit';
const TAG: string = 'CompCornerUtil';
/**
* 与组件布局(边距/间距/圆角半径)相关的数字
*/
export class CompUtils {
// 高/宽比
public static readonly ASPECT_RATIO_1_1: number = 1;
public static readonly ASPECT_RATIO_2_1: number = 2;
public static readonly ASPECT_RATIO_3_4: number = 3 / 4;
public static readonly ASPECT_RATIO_16_9: number = 16 / 9;
public static readonly ASPECT_RATIO_75_45: number = 75 / 45; // 角标宽高比
/**
* The max lines.
*/
public static readonly MAX_LINES_1: number = 1;
public static readonly MAX_LINES_2: number = 2;
public static readonly MAX_LINES_3: number = 3;
/**
* 获取Label标题
*
* @param component 组件bean
* @return Label标题
*/
static getLabelTitle(extraData?: string): string {
if (!extraData) {
return ""
}
let labelDTO = JSON.parse(extraData) as LabelDTO
if (!labelDTO) {
Logger.info(TAG, 'getLabelTitle, labels is null');
return ""
}
return labelDTO.title ?? "";
}
}