config.ts
1021 Bytes
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
import { cloneDeep } from 'lodash-es'
import { ImageConfig } from '.'
import { ModeEnum } from '@/enums/modeEnum'
import type {
ConfigPresetOptionsType,
CreateComponentParamsType,
CreateComponentType,
} from '@/core/Library/types'
const options: ConfigPresetOptionsType = {
publicFormSetting: {
dataSourceSetting: false,
eventSetting: true,
actSetting: {
FLASH: true,
DISPLAY: true,
ROTATE: true,
},
},
}
export default class Config implements CreateComponentType {
public key: string = ImageConfig.key
public presetOption = cloneDeep(options)
public mode = ModeEnum.EDIT
public category = ImageConfig.category
constructor(
params: CreateComponentParamsType = {} as CreateComponentParamsType,
) {
type Keys = keyof CreateComponentParamsType
const keys = Object.keys(params) as Keys[]
for (const key of keys) {
((this as CreateComponentParamsType)[
key
] as CreateComponentParamsType[typeof key]) = params[key]
}
}
}