forked from ioBroker/ioBroker.vis
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8dc3e78
commit 4d42f3e
Showing
47 changed files
with
11,969 additions
and
11,969 deletions.
There are no files selected for viewing
1,106 changes: 553 additions & 553 deletions
1,106
packages/iobroker.vis-2/src-vis/src/Vis/Widgets/Basic/BasicFilterDropdown.tsx
Large diffs are not rendered by default.
Oops, something went wrong.
228 changes: 114 additions & 114 deletions
228
packages/iobroker.vis-2/src-vis/src/Vis/Widgets/Basic/BasicHtml.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,114 +1,114 @@ | ||
/** | ||
* ioBroker.vis-2 | ||
* https://github.com/ioBroker/ioBroker.vis-2 | ||
* | ||
* Copyright (c) 2023-2024 Denis Haev https://github.com/GermanBluefox, | ||
* Creative Common Attribution-NonCommercial (CC BY-NC) | ||
* | ||
* http://creativecommons.org/licenses/by-nc/4.0/ | ||
* | ||
* Short content: | ||
* Licensees may copy, distribute, display and perform the work and make derivative works based on it only if they give the author or licensor the credits in the manner specified by these. | ||
* Licensees may copy, distribute, display, and perform the work and make derivative works based on it only for noncommercial purposes. | ||
* (Free for non-commercial use). | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import type { GetRxDataFromWidget, RxRenderWidgetProps, RxWidgetInfo } from '@iobroker/types-vis-2'; | ||
import VisRxWidget from '../../visRxWidget'; | ||
import DangerousHtmlWithScript from '../Utils/DangerousHtmlWithScript'; | ||
|
||
// eslint-disable-next-line no-use-before-define | ||
type RxData = GetRxDataFromWidget<typeof BasicHtml>; | ||
|
||
class BasicHtml extends VisRxWidget<RxData> { | ||
interval: ReturnType<typeof setInterval> | null = null; | ||
|
||
static getWidgetInfo(): RxWidgetInfo { | ||
return { | ||
id: 'tplHtml', | ||
visSet: 'basic', | ||
visName: 'HTML', | ||
visPrev: 'widgets/basic/img/Prev_HTML.png', | ||
visAttrs: [ | ||
{ | ||
name: 'common', | ||
fields: [ | ||
{ | ||
name: 'html', | ||
type: 'html', | ||
}, | ||
{ | ||
name: 'refreshInterval', | ||
type: 'slider', | ||
min: 0, | ||
max: 180000, | ||
step: 100, | ||
}, | ||
], | ||
}, | ||
], | ||
// visWidgetLabel: 'value_string', // Label of widget | ||
visDefaultStyle: { | ||
width: 200, | ||
height: 130, | ||
}, | ||
} as const; | ||
} | ||
|
||
// eslint-disable-next-line class-methods-use-this | ||
getWidgetInfo(): RxWidgetInfo { | ||
return BasicHtml.getWidgetInfo(); | ||
} | ||
|
||
componentWillUnmount(): void { | ||
if (this.interval) { | ||
clearInterval(this.interval); | ||
this.interval = null; | ||
} | ||
super.componentWillUnmount(); | ||
} | ||
|
||
componentDidMount(): void { | ||
super.componentDidMount(); | ||
if (parseInt(this.state.rxData.refreshInterval as unknown as string, 10)) { | ||
this.interval = setInterval( | ||
() => this.forceUpdate(), | ||
parseInt(this.state.rxData.refreshInterval as unknown as string, 10), | ||
); | ||
} | ||
} | ||
|
||
onRxDataChanged(prevRxData: typeof this.state.rxData): void { | ||
super.onRxDataChanged(prevRxData); | ||
if (this.interval) { | ||
clearInterval(this.interval); | ||
this.interval = null; | ||
} | ||
if (parseInt(this.state.rxData.refreshInterval as unknown as string, 10)) { | ||
this.interval = setInterval( | ||
() => this.forceUpdate(), | ||
parseInt(this.state.rxData.refreshInterval as unknown as string, 10), | ||
); | ||
} | ||
} | ||
|
||
/** | ||
* Renders the widget | ||
*/ | ||
renderWidgetBody(props: RxRenderWidgetProps): React.JSX.Element { | ||
super.renderWidgetBody(props); | ||
|
||
return ( | ||
<DangerousHtmlWithScript | ||
className="vis-widget-body" | ||
html={(this.state.rxData.html || '').toString()} | ||
isDiv | ||
wid={this.props.id} | ||
/> | ||
); | ||
} | ||
} | ||
|
||
export default BasicHtml; | ||
/** | ||
* ioBroker.vis-2 | ||
* https://github.com/ioBroker/ioBroker.vis-2 | ||
* | ||
* Copyright (c) 2023-2025 Denis Haev https://github.com/GermanBluefox, | ||
* Creative Common Attribution-NonCommercial (CC BY-NC) | ||
* | ||
* http://creativecommons.org/licenses/by-nc/4.0/ | ||
* | ||
* Short content: | ||
* Licensees may copy, distribute, display and perform the work and make derivative works based on it only if they give the author or licensor the credits in the manner specified by these. | ||
* Licensees may copy, distribute, display, and perform the work and make derivative works based on it only for noncommercial purposes. | ||
* (Free for non-commercial use). | ||
*/ | ||
|
||
import React from 'react'; | ||
|
||
import type { GetRxDataFromWidget, RxRenderWidgetProps, RxWidgetInfo } from '@iobroker/types-vis-2'; | ||
import VisRxWidget from '../../visRxWidget'; | ||
import DangerousHtmlWithScript from '../Utils/DangerousHtmlWithScript'; | ||
|
||
// eslint-disable-next-line no-use-before-define | ||
type RxData = GetRxDataFromWidget<typeof BasicHtml>; | ||
|
||
class BasicHtml extends VisRxWidget<RxData> { | ||
interval: ReturnType<typeof setInterval> | null = null; | ||
|
||
static getWidgetInfo(): RxWidgetInfo { | ||
return { | ||
id: 'tplHtml', | ||
visSet: 'basic', | ||
visName: 'HTML', | ||
visPrev: 'widgets/basic/img/Prev_HTML.png', | ||
visAttrs: [ | ||
{ | ||
name: 'common', | ||
fields: [ | ||
{ | ||
name: 'html', | ||
type: 'html', | ||
}, | ||
{ | ||
name: 'refreshInterval', | ||
type: 'slider', | ||
min: 0, | ||
max: 180000, | ||
step: 100, | ||
}, | ||
], | ||
}, | ||
], | ||
// visWidgetLabel: 'value_string', // Label of widget | ||
visDefaultStyle: { | ||
width: 200, | ||
height: 130, | ||
}, | ||
} as const; | ||
} | ||
|
||
// eslint-disable-next-line class-methods-use-this | ||
getWidgetInfo(): RxWidgetInfo { | ||
return BasicHtml.getWidgetInfo(); | ||
} | ||
|
||
componentWillUnmount(): void { | ||
if (this.interval) { | ||
clearInterval(this.interval); | ||
this.interval = null; | ||
} | ||
super.componentWillUnmount(); | ||
} | ||
|
||
componentDidMount(): void { | ||
super.componentDidMount(); | ||
if (parseInt(this.state.rxData.refreshInterval as unknown as string, 10)) { | ||
this.interval = setInterval( | ||
() => this.forceUpdate(), | ||
parseInt(this.state.rxData.refreshInterval as unknown as string, 10), | ||
); | ||
} | ||
} | ||
|
||
onRxDataChanged(prevRxData: typeof this.state.rxData): void { | ||
super.onRxDataChanged(prevRxData); | ||
if (this.interval) { | ||
clearInterval(this.interval); | ||
this.interval = null; | ||
} | ||
if (parseInt(this.state.rxData.refreshInterval as unknown as string, 10)) { | ||
this.interval = setInterval( | ||
() => this.forceUpdate(), | ||
parseInt(this.state.rxData.refreshInterval as unknown as string, 10), | ||
); | ||
} | ||
} | ||
|
||
/** | ||
* Renders the widget | ||
*/ | ||
renderWidgetBody(props: RxRenderWidgetProps): React.JSX.Element { | ||
super.renderWidgetBody(props); | ||
|
||
return ( | ||
<DangerousHtmlWithScript | ||
className="vis-widget-body" | ||
html={(this.state.rxData.html || '').toString()} | ||
isDiv | ||
wid={this.props.id} | ||
/> | ||
); | ||
} | ||
} | ||
|
||
export default BasicHtml; |
Oops, something went wrong.