/* eslint-disable @typescript-eslint/no-use-before-define */ /* eslint-disable @typescript-eslint/class-name-casing */ export interface IComponent { children: React.ReactNode; } /** *组件样式 * * @export * @interface ICompStyle */ export interface ICompStyle { color: string; fontSize: string; display?: string; } /** *字体图标样式 * * @export * @interface IIconStyle */ export interface IIconStyle { color?: string; } /** *icom 图标 * * @export * @interface IIcon */ export interface IIcon { type?: 'font' | 'url'; // 默认字体图标 icon?: any; style?: IIconStyle; } export interface iOptionString { value: string; show: boolean; } export interface iBaseProps { type: string; streamId: string; title?: string; icon?: iOptionString; subTitle?: iOptionString; disabled?: boolean; specs?: any; streamName?: string; source?:'foot' | 'head' | undefined; } export interface iNumberProps extends iBaseProps { min: string; // "最小值,字符串表示", max: string; // "最大值,字符串表示", unit: string; // "单位,字符串表示", unitdesc: string; // "单位描述,字符串表示", step: string; // "步长,字符串表示" intType?:string; } export interface iItem { text: string; value?: string; icon?: string; checked?: boolean; disabled?: boolean; } export interface iEnumProps extends iBaseProps { items: iItem[]; } export const isIntType = (thingModelType: string) => { switch (thingModelType) { case 'uint8': case 'uint16': case 'uint32': case 'int': case 'int8': case 'int16': case 'int32': case 'int64': return true; default: return false; } }; export const getMappingType = (thingModelType: string) => { switch (thingModelType) { case 'uint8': case 'uint16': case 'uint32': case 'int': case 'int8': case 'int16': case 'int32': case 'int64': return DataType.IntType; case 'float': case 'double': return DataType.FloatType; default: break; } return thingModelType; }; export type iBoolProps = iBaseProps; export enum DataType { IntType = 'int', FloatType = 'float', BoolType = 'bool', EnumType = 'enum', } export const getComponentsType = (type: string) => { switch (type) { case 'uint8': case 'uint16': case 'uint32': case 'int': case 'int8': case 'int16': case 'int32': case 'int64': case 'float': case 'double': return ComponentsType.NumberType; default: break; } return type; }; export enum ComponentsType { NumberType = 'number', BoolType = 'bool', EnumType = 'enum', WeatherType = 'weather', Layout = 'Layout', Element = 'Element', Custom = 'Custom', Consumables = 'Consumables', cloudTimer = 'cloudTimer', Navigation = 'Navigation', IOTDataLog = 'IOTDataLog', IOTAlert = 'alert', IOTFaultAlarm = 'IOTFaultAlarm' } export enum TagType { IOTWeather = 'IOTWeather', IOTPower = 'IOTPower', IOTSwitch = 'IOTSwitch', IOTCardMultiText = 'IOTCardMultiText', IOTGrid = 'IOTGrid', IOTCordEntryEnum = "IOTCordEntryEnum", IOTCordEntryNumber = 'IOTCordEntryNumber', IOTIconSlider = 'IOTIconSlider', IOTSlider = 'IOTSlider', IOTTimeSlider = 'IOTTimeSlider', IOTNavBar = 'IOTNavBar', IOTMiniCardText = 'IOTMiniCardText', IOTImg = 'IOTImg', IOTEntry = 'IOTEntry', IOTIcon = 'IOTIcon', IOTDirection = 'IOTDirection', IOTNumberSlider = 'IOTNumberSlider', IOTDoubleButton = 'IOTDoubleButton', IOTPoleSlider = 'IOTPoleSlider', IOTIconGrid = 'IOTIconGrid', IOTExecutePower = 'IOTExecutePower', IOTCustom = 'IOTCustom', IOTAlert = 'IOTAlert', IOTNoPoleSlider = 'IOTNoPoleSlider', IOTConsumables = 'IOTConsumables', IOTTimeTask = 'IOTTimeTask', IOTIconNavigation = 'IOTIconNavigation', IOTFaultAlarm = 'IOTFaultAlarm', IOTDataLog = 'IOTDataLog' } export interface iThingModel { content: iThingModelContent; id: string; updateUserId: string; publishedLatest: number; publishedUserId: string; isLatest: number; createTime: number; updateTime: number; publishedStatus: number; description: string; name: string; thingTypeId: string; thingModelVersion: string; class: string; published: boolean; enhanceContent: iThingModelContent; createUserId: string; } export interface iThingModelContent { models: iModel[]; 'display-name': string; description: string; 'thing-model-version': string; id: string; } export interface iModel { functions: string[]; 'display-name': string; description: string; id: string; type: string; events: string[]; key: string; properties: iProperty[]; } export interface iProperty { description: string; 'display-name': string; id: string; access: string; valuedef: iValuedef; key: string; streamName: string; extension?: string; isShowH5: number; label: string; } export interface iValuedef { specs: iSpecs; type: string; } export interface iSpecs { min: string; // 最小值(数值类型特有) max: string; // 最大值(数值类型特有) step: string; // 步长(数值类型特有) unit: string; // 单位 unitdesc: string; // 单位描述 length: string; // 字符串或16进制的最大长度,默认128;字符串表示 size: number; // 数组大小,默认最大128;数组特有;字符串表示 item: { type: string; specs: any }; // memberss: string; // 这个数组仅用来说明定义,在实际使用时要转译为对像 members: { type: string; key: string; specs: any }[]; values: any; } export interface iTrait { type: string; // 定义哪种属性 label: string; // 属性名称 name: string; // 生成json对应的key tips?: string; // 提示说明 description?: string; // 描述文案 } export interface iFunction { id: string; // 功能唯一标识 title: string; // 功能名称 type: ComponentsType; // 展示组件类型 displayType?: string; // 展示方式 icon?: { value: string; show: boolean }; property?: iProperty; // 关联的物模型属性 }