config.ts
1.63 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
43
44
45
46
47
48
49
50
51
52
53
import cloneDeep from 'lodash-es/cloneDeep';
import { HumidityComponentConfig } from '.';
import {
ConfigType,
CreateComponentType,
PublicComponentOptions,
PublicPresetOptions,
} from '../../../index.type';
import { PublicConfigClass, componentInitConfig } from '../../../publicConfig';
import { ComponentConfigFieldEnum } from '../../../enum';
export enum Gradient {
FIRST = 'first',
SECOND = 'second',
THIRD = 'third',
}
export enum GradientColor {
FIRST = '#67e0e3',
SECOND = '#37a2da',
THIRD = '#fd666d',
}
export const option: PublicPresetOptions = {
[ComponentConfigFieldEnum.FONT_COLOR]: '#FD7347',
[ComponentConfigFieldEnum.SHOW_DEVICE_NAME]: false,
[ComponentConfigFieldEnum.MAX_NUMBER]: 100,
[ComponentConfigFieldEnum.SHOW_TIME]: false,
[ComponentConfigFieldEnum.UNIT]: '%RH',
[ComponentConfigFieldEnum.POINTER_COLOR]: '#15E2C6',
[ComponentConfigFieldEnum.INSTRUMENT_PANEL_COLOR]: '#61D4C5',
[ComponentConfigFieldEnum.FONT_SIZE]: 14,
[ComponentConfigFieldEnum.VALUE_SIZE]: 14,
[ComponentConfigFieldEnum.GRADIENT_INFO]: [
{ key: Gradient.FIRST, value: 0, color: GradientColor.FIRST },
{ key: Gradient.SECOND, value: 1, color: GradientColor.SECOND },
],
};
export default class Config extends PublicConfigClass implements CreateComponentType {
public key: string = HumidityComponentConfig.key;
public attr = { ...componentInitConfig };
public componentConfig: ConfigType = cloneDeep(HumidityComponentConfig);
public persetOption = cloneDeep(option);
public option: PublicComponentOptions;
constructor(option: PublicComponentOptions) {
super();
this.option = { ...option };
}
}