CompUtils.ets 801 Bytes
import { Logger } from 'wdKit';
import { LabelDTO } from '../repository/bean/extra/LabelDTO';

const TAG: string = 'CompCornerUtil';

/**
 * 与组件布局(边距/间距/圆角半径)相关的数字
 */
export class CompUtils {
  /**
   * 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 ?? "";
  }
}