UNPKG

iobroker.js-controller

Version:

Updated by reinstall.js on 2018-06-11T15:19:56.688Z

323 lines • 11.8 kB
/** * Note big parts of this file are copied from https://github.com/ioBroker/ioBroker.vis-2/blob/c8eba766c5a7587135817a5e87f3e90bc4796cdb/packages/iobroker.vis-2/src-vis/src/Vis/visUtils.tsx#L95 */ type StateID = string; type SingleWidgetId = `w${string}`; type GroupWidgetId = `g${string}`; type AnyWidgetId = SingleWidgetId | GroupWidgetId; interface WidgetData { /** Only exists if given by user in a tab general */ name?: string; filterkey?: string; members?: AnyWidgetId[]; bindings?: string[]; [other: string]: any; } type VisBindingOperationType = 'eval' | '*' | '+' | '-' | '/' | '%' | 'min' | 'max' | 'date' | 'momentDate' | 'value' | 'array' | 'pow' | 'round' | 'random' | 'json' | 'sqrt' | 'hex' | 'HEX' | 'HEX2' | 'hex2' | 'floor' | 'ceil' | ''; interface VisBindingOperationArgument { name: string; /** ioBroker state ID plus '.val', '.ts', '.ack' or '.lc' */ visOid: StateID; /** ioBroker state ID */ systemOid: StateID; } interface VisBindingOperation { op: VisBindingOperationType; arg?: VisBindingOperationArgument[] | string | number | string[]; formula?: string; } interface VisBinding { /** ioBroker state ID plus '.val', '.ts', '.ack' or '.lc' */ visOid: StateID; /** ioBroker state ID */ systemOid: StateID; /** Part of the string, like {id.ack} */ token: string; operations?: VisBindingOperation[]; format: string; isSeconds: boolean; } interface VisLinkContextBinding extends VisBinding { type: 'style' | 'data'; attr: string; view: string; widget: AnyWidgetId; } interface VisLinkContextItem { view: string; widget: AnyWidgetId; } interface VisLinkContextSignalItem extends VisLinkContextItem { index: number; } interface VisStateUsage { /** list of widgets, that depends on this state */ visibility: Record<string, VisLinkContextItem[]>; signals: Record<string, VisLinkContextSignalItem[]>; lastChanges: Record<string, VisLinkContextItem[]>; /** list of widgets, that depends on this state */ bindings: Record<StateID, VisLinkContextBinding[]>; IDs: StateID[]; byViews?: Record<string, string[]>; widgetAttrInfo?: Record<string, any>; } interface Permissions { /** Accessible in Runtime */ read: boolean; /** Accessible in Editor */ write: boolean; } interface UserPermissions { /** Which user has read or write access for the project */ [user: string]: Permissions; } interface WidgetStyle { bindings?: string[]; position?: '' | 'absolute' | 'relative' | 'sticky' | 'static' | null; display?: '' | 'inline-block' | null; top?: string | number | null; left?: string | number | null; width?: string | number | null; right?: string | number | null; bottom?: string | number | null; /** if widget become relative, here is stored the original width, so when we toggle it to the absolute width again, it has some width */ absoluteWidth?: string | number | null; height?: string | number | null; 'z-index'?: number | null; 'overflow-x'?: '' | 'visible' | 'hidden' | 'scroll' | 'auto' | 'initial' | 'inherit' | null; 'overflow-y'?: '' | 'visible' | 'hidden' | 'scroll' | 'auto' | 'initial' | 'inherit' | null; opacity?: number | null; cursor?: 'alias' | 'all-scroll' | 'auto' | 'cell' | 'col-resize' | 'context-menu' | 'copy' | 'crosshair' | 'default' | 'e-resize' | 'ew-resize' | 'grab' | 'grabbing' | 'help' | 'move' | 'n-resize' | 'ne-resize' | 'nesw-resize' | 'ns-resize' | 'nw-resize' | 'nwse-resize' | 'no-drop' | 'none' | 'not-allowed' | 'pointer' | 'progress' | 'row-resize' | 's-resize' | 'se-resize' | 'sw-resize' | 'text' | 'vertical-text' | 'w-resize' | 'wait' | 'zoom-in' | 'zoom-out' | 'initial' | 'inherit' | null; transform?: string; color?: string; 'text-align'?: '' | 'left' | 'right' | 'center' | 'justify' | 'initial' | 'inherit' | null; 'text-shadow'?: string | null; 'font-family'?: string | null; 'font-style'?: '' | 'normal' | 'italic' | 'oblique' | 'initial' | 'inherit' | null; 'font-variant'?: '' | 'normal' | 'small-caps' | 'initial' | 'inherit' | null; 'font-weight'?: string; 'font-size'?: string; 'line-height'?: string; 'letter-spacing'?: string; 'word-spacing'?: string; background?: string; 'background-color'?: string; 'background-image'?: string; 'background-repeat'?: '' | 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat' | 'initial' | 'inherit' | null; 'background-position'?: string | null; 'background-size'?: string | null; 'background-clip'?: '' | 'border-box' | 'padding-box' | 'content-box' | 'initial' | 'inherit' | null; 'background-origin'?: '' | 'padding-box' | 'border-box' | 'content-box' | 'initial' | 'inherit' | null; 'border-width'?: string | null; 'border-style'?: '' | 'dotted' | 'dashed' | 'solid' | 'double' | 'groove' | 'ridge' | 'inset' | 'outset' | 'hidden' | null; 'border-color'?: string | null; 'border-radius'?: string | null; padding?: string | null; 'padding-left'?: string | null; 'padding-top'?: string | null; 'padding-right'?: string | null; 'padding-bottom'?: string | null; 'box-shadow'?: string | null; 'margin-left'?: string | null; 'margin-top'?: string | null; 'margin-right'?: string | null; 'margin-bottom'?: string | null; /** relative property, if the widget must be shown on the new line */ newLine?: boolean; 'box-sizing'?: 'content-box' | 'border-box' | 'initial' | 'inherit' | null; noPxToPercent?: boolean; } interface SingleWidget { /** Internal wid */ _id?: string; /** Widget type */ tpl: string; data: WidgetData; style: WidgetStyle; /** @deprecated The widget set Use widgetSet */ set?: string; /** @deprecated The widget set. Use widgetSet */ wSet?: string; /** The widget set name. Groups have widget set null */ widgetSet: string | null; /** The id of the group, if the widget is grouped */ groupid?: GroupWidgetId; /** If the widget is grouped */ grouped?: boolean; /** @deprecated it was typo */ groupped?: boolean; /** Permissions for each user for the widget */ permissions?: UserPermissions; /** This widget was taken from a marketplace */ marketplace?: any; /** Indicator that this widget is used in another widget (e.g., in panel) */ usedInWidget?: boolean; /** CSS for this widget */ css?: string; /** JavaScript for this widget */ js?: string; /** internal cached value */ usedInView?: string; name?: string; isRoot?: boolean; } interface GroupWidget extends SingleWidget { tpl: '_tplGroup'; data: GroupData; } interface GroupData extends WidgetData { /** Widget IDs of the members */ members: AnyWidgetId[]; } interface MarketplaceWidgetRevision { id: string; widget: (GroupWidget | SingleWidget)[]; date: string; widget_id: string; description: string; whatsnew: string; widgetsets: string[]; version: number; rating: any; install_count: number; name: string; is_last: 0 | 1; widgets: string[]; image_id: string; delete_status: 0 | 1; verified: null; revision_id: string; categories: string[]; } interface ProjectSettings { darkReloadScreen: boolean; destroyViewsAfter: number; folders: { id: string; name: string; parentId: string; }[]; openedViews: string[]; reconnectInterval: number; reloadOnEdit: boolean; reloadOnSleep: number; statesDebounceTime: number; scripts: unknown; /** Which user has read or write access for the project */ permissions?: UserPermissions; marketplace?: MarketplaceWidgetRevision[]; ts?: string; bodyOverflow?: string; } interface ViewSettings { /** Permissions for each user for the view */ permissions?: UserPermissions; comment?: string; class?: string; filterkey?: string; group?: string[]; theme?: string; group_action?: 'disabled' | 'hide' | null | ''; useBackground?: boolean; 'bg-image'?: string; 'bg-position-x'?: string; 'bg-position-y'?: string; 'bg-width'?: string; 'bg-height'?: string; 'bg-color'?: string; style?: { display?: 'flex' | 'grid' | 'none' | null | ''; background_class?: string; background?: string; 'background-color'?: string; 'background-image'?: string; 'background-repeat'?: 'repeat' | 'repeat-x' | 'repeat-y' | 'no-repeat' | 'initial' | 'inherit' | null | ''; 'background-attachment'?: 'scroll' | 'fixed' | 'local' | 'initial' | 'inherit' | null | ''; 'background-position'?: 'left top' | 'left center' | 'left bottom' | 'right top' | 'right center' | 'right bottom' | 'center top' | 'center center' | 'center bottom' | 'initial' | 'inherit' | null | ''; 'background-size'?: 'auto' | 'cover' | 'contain' | 'initial' | 'inherit' | null | ''; 'background-clip'?: 'border-box' | 'padding-box' | 'content-box' | 'initial' | 'inherit' | null | ''; 'background-origin'?: 'padding-box' | 'border-box' | 'content-box' | 'initial' | 'inherit' | null | ''; color?: string; 'text-shadow'?: string; 'font-family'?: string; 'font-style'?: string; 'font-variant'?: string; 'font-weight'?: string; 'font-size'?: string; 'line-height'?: string; 'letter-spacing'?: string; 'word-spacing'?: string; }; useAsDefault?: boolean; alwaysRender?: boolean; snapType?: 0 | 1 | 2 | null; snapColor?: string; gridSize?: number; sizex?: number; sizey?: number; limitScreen?: boolean; limitForInstances?: string; limitScreenDesktop?: boolean; limitScreenBorderWidth?: number; limitScreenBorderColor?: string; limitScreenBorderStyle?: string; limitScreenBackgroundColor?: string; navigation?: boolean; navigationTitle?: string; navigationOrder?: number; navigationIcon?: string; navigationImage?: string; navigationOrientation?: 'horizontal' | 'vertical'; navigationOnlyIcon?: boolean; navigationBackground?: string; navigationSelectedBackground?: string; navigationSelectedColor?: string; navigationHeaderTextColor?: string; navigationColor?: string; navigationWidth?: number; navigationChevronColor?: string; navigationHideMenu?: boolean; navigationHideOnSelection?: boolean; navigationHeaderText?: string; navigationNoHide?: boolean; navigationButtonBackground?: string; navigationBar?: boolean; navigationBarColor?: string; navigationBarText?: string; navigationBarIcon?: string; navigationBarImage?: string; columnWidth?: number; columnGap?: number; rowGap?: number | string; /** relative widget order */ order?: AnyWidgetId[]; } interface View { activeWidgets: string[]; filterList: string[]; rerender: boolean; name?: string; /** parent folder */ parentId?: string; settings?: ViewSettings; /** Widgets on this view */ widgets: { [groupId: GroupWidgetId]: GroupWidget; [widgetId: SingleWidgetId]: SingleWidget; }; filterWidgets?: AnyWidgetId[]; filterInvert?: boolean; } interface Project { ___settings: ProjectSettings; [view: string]: View; } /** * Get all used object IDs in the views * * @param views project * @param isByViews is combine IDs for every view */ export declare function getUsedObjectIDs(views: Project, isByViews?: boolean): VisStateUsage | null; export {}; //# sourceMappingURL=visUtils.d.ts.map