Skip to content

Commit

Permalink
Copyright
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Jan 23, 2025
1 parent 8dc3e78 commit 4d42f3e
Show file tree
Hide file tree
Showing 47 changed files with 11,969 additions and 11,969 deletions.
1,106 changes: 553 additions & 553 deletions packages/iobroker.vis-2/src-vis/src/Vis/Widgets/Basic/BasicFilterDropdown.tsx

Large diffs are not rendered by default.

228 changes: 114 additions & 114 deletions packages/iobroker.vis-2/src-vis/src/Vis/Widgets/Basic/BasicHtml.tsx
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;
Loading

0 comments on commit 4d42f3e

Please sign in to comment.