config.ts
1.13 KB
import cloneDeep from 'lodash-es/cloneDeep';
import { ThermometerConfig } from '.';
import {
  ConfigType,
  CreateComponentType,
  PublicComponentOptions,
  PublicPresetOptions,
} from '/@/views/visual/packages/index.type';
import { PublicConfigClass, componentInitConfig } from '/@/views/visual/packages/publicConfig';
import { ComponentConfigFieldEnum } from '/@/views/visual/packages/enum';
export const option: PublicPresetOptions = {
  [ComponentConfigFieldEnum.FONT_COLOR]: '#',
  [ComponentConfigFieldEnum.SHOW_DEVICE_NAME]: false,
  [ComponentConfigFieldEnum.SHOW_TIME]: false,
  [ComponentConfigFieldEnum.FONT_SIZE]: 14,
  [ComponentConfigFieldEnum.VALUE_SIZE]: 20,
  [ComponentConfigFieldEnum.MAX_NUMBER]: 120,
};
export default class Config extends PublicConfigClass implements CreateComponentType {
  public key: string = ThermometerConfig.key;
  public attr = { ...componentInitConfig };
  public componentConfig: ConfigType = cloneDeep(ThermometerConfig);
  public persetOption = cloneDeep(option);
  public option: PublicComponentOptions;
  constructor(option: PublicComponentOptions) {
    super();
    this.option = { ...option };
  }
}