config.ts 1.12 KB
import cloneDeep from 'lodash-es/cloneDeep';
import { SwitchStatusConfig } 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.ICON]: 'shuiwen',
  [ComponentConfigFieldEnum.ICON_COLOR]: '#367bff',
  [ComponentConfigFieldEnum.ICON_CLOSE]: 'shuiwen',
  [ComponentConfigFieldEnum.ICON_COLOR_CLOSE]: '#CCCCCC',
  [ComponentConfigFieldEnum.SHOW_DEVICE_NAME]: false,
};

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

  public attr = { ...componentInitConfig };

  public componentConfig: ConfigType = cloneDeep(SwitchStatusConfig);

  public persetOption = cloneDeep(option);

  public option: PublicComponentOptions;

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