import React from 'react'; import { ComponentsType, DataType, iProperty, TagType } from '../../base/type'; import IOTIconGrid from './IOTIconGrid'; import { IOTIconGridProps } from './interface'; import iGrapesJSConfig from '../../type'; import { iIOTIconGridJSON } from '.'; import { mergeParameters } from '../../base/utils'; import { getEnumItems } from '../IOTCordEntryEnum/grapesjsConfig'; const grapesJSConfig: iGrapesJSConfig = { type: [ComponentsType.EnumType], id: 'IOTIconGrid', tag: TagType.IOTIconGrid, access: 'rw', render: (jsonData, ...args) => { const props = mergeParameters(jsonData, ...args); return ; }, buildData: (mock: boolean = false, property?: iProperty) => { if (property === undefined) return; //区分类 const props: iIOTIconGridJSON = { title: property['display-name'], icon: { value: 'insideicon-cu-1', show: true }, streamId: property.streamName, type: property?.valuedef?.type, disabled: false, // handler: function (val: any): void { // throw new Error('Function not implemented.'); // }, items: getEnumItems(property), }; return props; }, traits: () => { return [ { type: 'option-icon', name: 'icon', label: '显示图标', }, { type: 'text', name: 'title', label: '', }, { type: 'solt-text', name: 'items', showItemIcon:true, label: '枚举列表', }, ]; }, }; export default grapesJSConfig;