import React from 'react'; import { ComponentsType, DataType, iBoolProps, iProperty, TagType } from '../../base/type'; import IOTExecutePower from './IOTExecutePower'; import { iIOTExecutePowerProps } from './interface'; import iConfig from 'iot-ui/esm/type'; import iGrapesJSConfig from '../../type'; import { iIOTExecutePowerJSON } from '.'; import { mergeParameters } from '../../base/utils'; const grapesJSConfig: iGrapesJSConfig = { type: [ComponentsType.NumberType,ComponentsType.BoolType,ComponentsType.EnumType], id: 'IOTExecutePower', tag: TagType.IOTExecutePower, access: 'rw', render: (jsonData, ...args) => { const props = mergeParameters(jsonData, ...args); return ; }, buildData: (mock: boolean = false, property?: iProperty) => { if (property === undefined) return; // 区分类 const props: iIOTExecutePowerJSON = { title: property['display-name'], subTitle: { value: '副标题', show: true }, icon: { value: 'insideicon-cu-1', show: true }, streamId: property.streamName, type: property?.valuedef?.type, disabled: false }; return props; }, traits: () => { return [ { type: 'option-icon', name: 'icon', label: '显示图标', }, { type: 'text', name: 'title', label: '', }, { type: 'option-text', name: 'subTitle', label: '可选副标题', }, { type: 'select', name: 'executeValue', placeholder:'点击选择要执行的功能', label: '执行指令', options: 'streamId', }, ]; }, }; export default grapesJSConfig;