config.ts 1007 Bytes
import cloneDeep from 'lodash-es/cloneDeep';
import { InstrumentComponent1Config } from '.';
import {
  ConfigType,
  CreateComponentType,
  PublicComponentOptions,
  PublicPresetOptions,
} from '../../../index.type';
import { PublicConfigClass, componentInitConfig } from '../../../publicConfig';
import { ComponentConfigFieldEnum } from '../../../enum';

export const option: PublicPresetOptions = {
  [ComponentConfigFieldEnum.FONT_COLOR]: '#FD7347',
  [ComponentConfigFieldEnum.SHOW_DEVICE_NAME]: false,
  [ComponentConfigFieldEnum.UNIT]: '℃',
};

export default class Config extends PublicConfigClass implements CreateComponentType {
  public key: string = InstrumentComponent1Config.key;

  public attr = { ...componentInitConfig };

  public componentConfig: ConfigType = cloneDeep(InstrumentComponent1Config);

  public persetOption = cloneDeep(option);

  public option: PublicComponentOptions;

  constructor(option: PublicComponentOptions) {
    super();
    this.option = { ...option };
  }
}