import React from 'react'; import { ComponentsType, iBoolProps, iProperty, TagType } from '../../base/type'; import IOTSwitch from './IOTSwitch'; import { IOTSwitchProps } from './interface'; import iConfig from 'iot-ui/esm/type'; import iGrapesJSConfig from '../../type'; import { mergeParameters } from '../../base/utils'; import { iIOTSwitchJSON } from '.'; const grapesJSConfig: iGrapesJSConfig = { type: [ComponentsType.BoolType], id: 'IOTSwitch', tag: TagType.IOTSwitch, access: 'rw', render: (jsonData, ...args) => { const props = mergeParameters(jsonData, ...args); return ; }, buildData: (mock: boolean = false, property?: iProperty) => { if (property === undefined) return; //区分类 const props: iIOTSwitchJSON = { type: property?.valuedef?.type, streamId: property.streamName, title: property['display-name'], subTitle: { show: true, value: '副标题', }, icon: { value: 'insideicon-cu-1', show: true, }, curValue: true, disabled: false, streamName: '', }; return props; }, traits: () => { return [ { type: 'option-icon', name: 'icon', label: '显示图标', }, { type: 'text', name: 'title', label: '', }, { type: 'option-text', name: 'subTitle', label: '显示图标', }, ]; }, }; export default grapesJSConfig;