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