@iobroker/dm-gui-components 6.17.13 → 7.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +59 -59
- package/build/Communication.d.ts +18 -11
- package/build/Communication.js +102 -19
- package/build/Communication.js.map +1 -1
- package/build/DeviceActionButton.d.ts +3 -3
- package/build/DeviceActionButton.js +8 -4
- package/build/DeviceActionButton.js.map +1 -1
- package/build/DeviceCard.d.ts +7 -8
- package/build/DeviceCard.js +8 -7
- package/build/DeviceCard.js.map +1 -1
- package/build/DeviceControl.d.ts +16 -15
- package/build/DeviceControl.js +15 -16
- package/build/DeviceControl.js.map +1 -1
- package/build/DeviceList.d.ts +7 -10
- package/build/DeviceList.js +0 -9
- package/build/DeviceList.js.map +1 -1
- package/build/DeviceStatus.d.ts +2 -1
- package/build/DeviceStatus.js +0 -4
- package/build/DeviceStatus.js.map +1 -1
- package/build/InstanceActionButton.d.ts +3 -2
- package/build/InstanceActionButton.js +2 -2
- package/build/InstanceActionButton.js.map +1 -1
- package/build/JsonConfig.d.ts +4 -4
- package/build/JsonConfig.js +3 -3
- package/build/JsonConfig.js.map +1 -1
- package/build/Utils.d.ts +6 -4
- package/build/Utils.js +112 -94
- package/build/Utils.js.map +1 -1
- package/build/i18n/de.json +2 -1
- package/build/i18n/en.json +2 -1
- package/build/i18n/es.json +2 -1
- package/build/i18n/fr.json +2 -1
- package/build/i18n/it.json +2 -1
- package/build/i18n/nl.json +2 -1
- package/build/i18n/pl.json +2 -1
- package/build/i18n/pt.json +2 -1
- package/build/i18n/ru.json +2 -1
- package/build/i18n/uk.json +2 -1
- package/build/i18n/zh-cn.json +2 -1
- package/package.json +53 -51
- package/src/Communication.tsx +0 -443
- package/src/DeviceActionButton.tsx +0 -31
- package/src/DeviceCard.tsx +0 -511
- package/src/DeviceControl.tsx +0 -196
- package/src/DeviceImageUpload.tsx +0 -92
- package/src/DeviceList.tsx +0 -344
- package/src/DeviceStatus.tsx +0 -156
- package/src/InstanceActionButton.tsx +0 -25
- package/src/JsonConfig.tsx +0 -99
- package/src/TooltipButton.tsx +0 -34
- package/src/Utils.tsx +0 -187
- package/src/i18n/de.json +0 -21
- package/src/i18n/en.json +0 -21
- package/src/i18n/es.json +0 -21
- package/src/i18n/fr.json +0 -21
- package/src/i18n/i18n.d.ts +0 -26
- package/src/i18n/it.json +0 -21
- package/src/i18n/nl.json +0 -21
- package/src/i18n/pl.json +0 -21
- package/src/i18n/pt.json +0 -21
- package/src/i18n/ru.json +0 -21
- package/src/i18n/uk.json +0 -21
- package/src/i18n/zh-cn.json +0 -21
- package/src/index.ts +0 -3
package/src/DeviceStatus.tsx
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Tooltip } from '@mui/material';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
Link as LinkIcon,
|
|
6
|
-
LinkOff as LinkOffIcon,
|
|
7
|
-
NetworkCheck as NetworkCheckIcon,
|
|
8
|
-
Battery20 as Battery20Icon,
|
|
9
|
-
Battery30 as Battery30Icon,
|
|
10
|
-
Battery50 as Battery50Icon,
|
|
11
|
-
Battery60 as Battery60Icon,
|
|
12
|
-
Battery80 as Battery80Icon,
|
|
13
|
-
Battery90 as Battery90Icon,
|
|
14
|
-
BatteryFull as BatteryFullIcon,
|
|
15
|
-
BatteryAlert as BatteryAlertIcon,
|
|
16
|
-
Warning as WarningIcon,
|
|
17
|
-
BatteryCharging50 as BatteryCharging50Icon,
|
|
18
|
-
} from '@mui/icons-material';
|
|
19
|
-
|
|
20
|
-
import { getTranslation } from './Utils';
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
interface DeviceStatusProps {
|
|
24
|
-
status: any;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Device Status component
|
|
28
|
-
* @param {object} params - Parameters
|
|
29
|
-
* @param {object} params.status - Status object, e.g. { connection: 'connected', battery: 100, rssi: -50 }
|
|
30
|
-
* @returns {React.JSX.Element|null}
|
|
31
|
-
* @constructor
|
|
32
|
-
*/
|
|
33
|
-
export default function DeviceStatus(params: DeviceStatusProps): React.JSX.Element | null {
|
|
34
|
-
if (!params.status) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
let status;
|
|
39
|
-
|
|
40
|
-
if (typeof params.status === 'string') {
|
|
41
|
-
status = {
|
|
42
|
-
connection: params.status,
|
|
43
|
-
};
|
|
44
|
-
} else {
|
|
45
|
-
status = params.status;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/** @type {object} */
|
|
49
|
-
const iconStyleOK = {
|
|
50
|
-
fill: '#00ac00',
|
|
51
|
-
};
|
|
52
|
-
/** @type {object} */
|
|
53
|
-
const iconStyleNotOK = {
|
|
54
|
-
fill: '#ff0000',
|
|
55
|
-
};
|
|
56
|
-
/** @type {object} */
|
|
57
|
-
const iconStyleWarning = {
|
|
58
|
-
fill: '#ff9900',
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
/** @type {object} */
|
|
62
|
-
let batteryIconTooltip;
|
|
63
|
-
if (typeof status.battery === 'number') {
|
|
64
|
-
if (status.battery >= 96 && status.battery <= 100) {
|
|
65
|
-
batteryIconTooltip = <BatteryFullIcon style={iconStyleOK} />;
|
|
66
|
-
} else if (status.battery >= 90 && status.battery <= 95) {
|
|
67
|
-
batteryIconTooltip = <Battery90Icon style={iconStyleOK} />;
|
|
68
|
-
} else if (status.battery >= 80 && status.battery <= 89) {
|
|
69
|
-
batteryIconTooltip = <Battery80Icon style={iconStyleOK} />;
|
|
70
|
-
} else if (status.battery >= 60 && status.battery <= 79) {
|
|
71
|
-
batteryIconTooltip = <Battery60Icon style={iconStyleOK} />;
|
|
72
|
-
} else if (status.battery >= 50 && status.battery <= 59) {
|
|
73
|
-
batteryIconTooltip = <Battery50Icon style={iconStyleOK} />;
|
|
74
|
-
} else if (status.battery >= 30 && status.battery <= 49) {
|
|
75
|
-
batteryIconTooltip = <Battery30Icon style={iconStyleOK} />;
|
|
76
|
-
} else if (status.battery >= 20 && status.battery <= 29) {
|
|
77
|
-
batteryIconTooltip = <Battery20Icon style={iconStyleNotOK} />;
|
|
78
|
-
} else {
|
|
79
|
-
batteryIconTooltip = <BatteryAlertIcon style={iconStyleNotOK} />;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return <div style={{ display: 'flex', alignItems: 'center' }}>
|
|
84
|
-
{status.connection === 'connected' && <div style={{ display: 'flex', alignItems: 'center' }}>
|
|
85
|
-
<Tooltip title={getTranslation('connectedIconTooltip')}>
|
|
86
|
-
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
|
|
87
|
-
<LinkIcon style={iconStyleOK} />
|
|
88
|
-
</div>
|
|
89
|
-
</Tooltip>
|
|
90
|
-
</div>}
|
|
91
|
-
|
|
92
|
-
{status.connection === 'disconnected' && <div style={{ display: 'flex', alignItems: 'center' }}>
|
|
93
|
-
<Tooltip title={getTranslation('disconnectedIconTooltip')}>
|
|
94
|
-
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
|
|
95
|
-
<LinkOffIcon style={iconStyleNotOK} />
|
|
96
|
-
</div>
|
|
97
|
-
</Tooltip>
|
|
98
|
-
</div>}
|
|
99
|
-
|
|
100
|
-
{status.rssi && <div style={{ display: 'flex', alignItems: 'center' }}>
|
|
101
|
-
<Tooltip title="RSSI">
|
|
102
|
-
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
|
|
103
|
-
<NetworkCheckIcon />
|
|
104
|
-
<p style={{ fontSize: 'small', margin: 0 }}>{status.rssi}</p>
|
|
105
|
-
</div>
|
|
106
|
-
</Tooltip>
|
|
107
|
-
</div>}
|
|
108
|
-
|
|
109
|
-
{typeof status.battery === 'number' && <div style={{ display: 'flex', alignItems: 'center' }}>
|
|
110
|
-
<Tooltip title={getTranslation('batteryTooltip')}>
|
|
111
|
-
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
|
|
112
|
-
{batteryIconTooltip}
|
|
113
|
-
<p style={{ fontSize: 'small', margin: 0 }}>
|
|
114
|
-
{status.battery}
|
|
115
|
-
%
|
|
116
|
-
</p>
|
|
117
|
-
</div>
|
|
118
|
-
</Tooltip>
|
|
119
|
-
</div>}
|
|
120
|
-
|
|
121
|
-
{typeof status.battery === 'string' && <div style={{ display: 'flex', alignItems: 'center' }}>
|
|
122
|
-
<Tooltip title={getTranslation('batteryTooltip')}>
|
|
123
|
-
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
|
|
124
|
-
{status.battery === 'charging' ? <BatteryCharging50Icon /> : <BatteryFullIcon />}
|
|
125
|
-
{status.battery !== 'charging' ? (status.battery.includes('V') || status.battery.includes('mV') ?
|
|
126
|
-
<p style={{ fontSize: 'small', margin: 0 }}>{status.battery}</p> :
|
|
127
|
-
<p style={{ fontSize: 'small', margin: 0 }}>
|
|
128
|
-
<span style={{ marginRight: 4 }}>{status.battery}</span>
|
|
129
|
-
mV
|
|
130
|
-
</p>) : null}
|
|
131
|
-
</div>
|
|
132
|
-
</Tooltip>
|
|
133
|
-
</div>}
|
|
134
|
-
|
|
135
|
-
{typeof status.battery === 'boolean' && <div style={{ display: 'flex', alignItems: 'center' }}>
|
|
136
|
-
<Tooltip title={getTranslation('batteryTooltip')}>
|
|
137
|
-
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
|
|
138
|
-
{status.battery ? <BatteryFullIcon style={iconStyleOK} /> :
|
|
139
|
-
<BatteryAlertIcon style={iconStyleNotOK} />}
|
|
140
|
-
</div>
|
|
141
|
-
</Tooltip>
|
|
142
|
-
</div>}
|
|
143
|
-
|
|
144
|
-
{status.warning && <div style={{ display: 'flex', alignItems: 'center' }}>
|
|
145
|
-
{typeof status.warning === 'string' || typeof status.warning === 'object' ?
|
|
146
|
-
<Tooltip title={getTranslation(status.warning)}>
|
|
147
|
-
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
|
|
148
|
-
<WarningIcon style={iconStyleWarning} />
|
|
149
|
-
</div>
|
|
150
|
-
</Tooltip> :
|
|
151
|
-
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'center' }}>
|
|
152
|
-
<WarningIcon style={iconStyleWarning} />
|
|
153
|
-
</div>}
|
|
154
|
-
</div>}
|
|
155
|
-
</div>;
|
|
156
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import TooltipButton from './TooltipButton';
|
|
3
|
-
import { renderIcon, getTranslation } from './Utils';
|
|
4
|
-
|
|
5
|
-
interface InstanceActionButtonProps {
|
|
6
|
-
action: any;
|
|
7
|
-
instanceHandler: (action: any) => () => void;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export default function InstanceActionButton(params: InstanceActionButtonProps): React.JSX.Element | null {
|
|
11
|
-
const { action, instanceHandler } = params;
|
|
12
|
-
|
|
13
|
-
const tooltip = getTranslation(action?.description ? action.description : '');
|
|
14
|
-
const title = getTranslation(action?.title ? action.title : '');
|
|
15
|
-
|
|
16
|
-
const icon = renderIcon(action);
|
|
17
|
-
|
|
18
|
-
return <TooltipButton
|
|
19
|
-
tooltip={tooltip}
|
|
20
|
-
label={title}
|
|
21
|
-
disabled={action.disabled}
|
|
22
|
-
Icon={icon}
|
|
23
|
-
onClick={instanceHandler(action)}
|
|
24
|
-
/>;
|
|
25
|
-
}
|
package/src/JsonConfig.tsx
DELETED
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { AdminConnection, JsonConfigComponent } from '@iobroker/adapter-react-v5';
|
|
3
|
-
import type { ThemeName, ThemeType } from '@iobroker/adapter-react-v5/types';
|
|
4
|
-
|
|
5
|
-
interface JsonConfigProps {
|
|
6
|
-
instanceId: string;
|
|
7
|
-
socket: AdminConnection;
|
|
8
|
-
schema: Record<string, any>;
|
|
9
|
-
data: Record<string, any>;
|
|
10
|
-
onChange: (data: Record<string, any>) => void;
|
|
11
|
-
themeName: ThemeName;
|
|
12
|
-
themeType: ThemeType;
|
|
13
|
-
isFloatComma?: boolean;
|
|
14
|
-
dateFormat?: string;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export default function JsonConfig(props: JsonConfigProps): React.JSX.Element | null {
|
|
18
|
-
const {
|
|
19
|
-
instanceId, socket, schema, data, onChange,
|
|
20
|
-
} = props;
|
|
21
|
-
console.log('JsonConfig', props);
|
|
22
|
-
const [error, setError] = useState(false);
|
|
23
|
-
|
|
24
|
-
if (schema === undefined) {
|
|
25
|
-
return null;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
const [adapterName, instance] = instanceId.split('.', 2);
|
|
29
|
-
|
|
30
|
-
return <>
|
|
31
|
-
{error && <div>{error}</div>}
|
|
32
|
-
<JsonConfigComponent
|
|
33
|
-
socket={socket}
|
|
34
|
-
adapterName={adapterName}
|
|
35
|
-
instance={parseInt(instance)}
|
|
36
|
-
schema={schema}
|
|
37
|
-
data={data}
|
|
38
|
-
onError={setError}
|
|
39
|
-
onChange={(_data: Record<string, any>) => onChange(_data)}
|
|
40
|
-
embedded
|
|
41
|
-
themeName={props.themeName}
|
|
42
|
-
themeType={props.themeType}
|
|
43
|
-
isFloatComma={props.isFloatComma === undefined ? props.socket.systemConfig.common.isFloatComma : props.isFloatComma}
|
|
44
|
-
dateFormat={props.dateFormat === undefined ? props.socket.systemConfig.common.dateFormat : props.dateFormat}
|
|
45
|
-
/>
|
|
46
|
-
</>;
|
|
47
|
-
|
|
48
|
-
/*
|
|
49
|
-
JSON adapter config:
|
|
50
|
-
className={classes.scroll}
|
|
51
|
-
socket={socket}
|
|
52
|
-
theme={this.props.theme}
|
|
53
|
-
themeName={this.props.themeName}
|
|
54
|
-
themeType={this.props.themeType}
|
|
55
|
-
adapterName={this.props.adapterName}
|
|
56
|
-
instance={this.props.instance}
|
|
57
|
-
isFloatComma={this.props.isFloatComma}
|
|
58
|
-
dateFormat={this.props.dateFormat}
|
|
59
|
-
schema={this.state.schema}
|
|
60
|
-
common={this.state.common}
|
|
61
|
-
data={this.state.data}
|
|
62
|
-
updateData={this.state.updateData}
|
|
63
|
-
onError={(error) => this.setState({ error })}
|
|
64
|
-
onChange={(data, changed) => this.setState({ data, changed })}
|
|
65
|
-
customs={{ configCustomEasyAccess: ConfigCustomEasyAccess }}
|
|
66
|
-
Object custom:
|
|
67
|
-
instanceObj={instanceObj}
|
|
68
|
-
customObj={customObj}
|
|
69
|
-
custom={true}
|
|
70
|
-
className={ '' }
|
|
71
|
-
adapterName={adapter}
|
|
72
|
-
instance={parseInt(instance.split('.').pop(), 10) || 0}
|
|
73
|
-
socket={this.props.socket}
|
|
74
|
-
theme={this.props.theme}
|
|
75
|
-
themeName={this.props.themeName}
|
|
76
|
-
themeType={this.props.themeType}
|
|
77
|
-
multiEdit={this.props.objectIDs.length > 1}
|
|
78
|
-
|
|
79
|
-
schema={this.jsonConfigs[adapter].json}
|
|
80
|
-
data={data}
|
|
81
|
-
onError={error =>
|
|
82
|
-
this.setState({error}, () => this.props.onError && this.props.onError(error))}
|
|
83
|
-
onValueChange={(attr, value) => {
|
|
84
|
-
console.log(attr + ' => ' + value);
|
|
85
|
-
const newValues = JSON.parse(JSON.stringify(this.state.newValues));
|
|
86
|
-
newValues[instance] = newValues[instance] || {};
|
|
87
|
-
if (this.commonConfig[instance][attr] === value) {
|
|
88
|
-
delete newValues[instance][attr];
|
|
89
|
-
if (!Object.keys(newValues[instance]).length) {
|
|
90
|
-
delete newValues[instance];
|
|
91
|
-
}
|
|
92
|
-
} else {
|
|
93
|
-
newValues[instance][attr] = value;
|
|
94
|
-
}
|
|
95
|
-
this.setState({newValues, hasChanges: this.isChanged(newValues)}, () =>
|
|
96
|
-
this.props.onChange && this.props.onChange(this.state.hasChanges));
|
|
97
|
-
}}
|
|
98
|
-
*/
|
|
99
|
-
}
|
package/src/TooltipButton.tsx
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { IconButton, Tooltip, Typography } from '@mui/material';
|
|
3
|
-
|
|
4
|
-
interface TooltipButtonProps {
|
|
5
|
-
tooltip?: string;
|
|
6
|
-
label?: string;
|
|
7
|
-
disabled?: boolean;
|
|
8
|
-
Icon: React.JSX.Element | null;
|
|
9
|
-
onClick?: () => void;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export default function TooltipButton(props: TooltipButtonProps): React.JSX.Element {
|
|
13
|
-
const {
|
|
14
|
-
tooltip, label, disabled, Icon, onClick
|
|
15
|
-
} = props;
|
|
16
|
-
|
|
17
|
-
const text = !!label && <Typography variant="button" style={{ marginLeft: 4 }}>{label}</Typography>;
|
|
18
|
-
|
|
19
|
-
if (tooltip) {
|
|
20
|
-
return <Tooltip title={tooltip}>
|
|
21
|
-
<span>
|
|
22
|
-
<IconButton onClick={onClick} disabled={disabled} size="small">
|
|
23
|
-
{Icon}
|
|
24
|
-
{text}
|
|
25
|
-
</IconButton>
|
|
26
|
-
</span>
|
|
27
|
-
</Tooltip>;
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return <IconButton onClick={onClick} disabled={disabled} size="small">
|
|
31
|
-
{Icon}
|
|
32
|
-
{text}
|
|
33
|
-
</IconButton>;
|
|
34
|
-
}
|
package/src/Utils.tsx
DELETED
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
|
|
3
|
-
import type { ControlBase } from '@iobroker/dm-utils/build/types/base';
|
|
4
|
-
import {
|
|
5
|
-
Add, Delete, Edit,
|
|
6
|
-
Refresh, Search,
|
|
7
|
-
Wifi, WifiOff, Bluetooth,
|
|
8
|
-
BluetoothDisabled,
|
|
9
|
-
Visibility,
|
|
10
|
-
LinkOff, Link as LinkIcon,
|
|
11
|
-
NotListedLocation,
|
|
12
|
-
PlayArrow,
|
|
13
|
-
Stop,
|
|
14
|
-
FastForward,
|
|
15
|
-
FastRewind,
|
|
16
|
-
Pause,
|
|
17
|
-
Lightbulb,
|
|
18
|
-
Power,
|
|
19
|
-
Fluorescent,
|
|
20
|
-
WbIncandescent,
|
|
21
|
-
Settings
|
|
22
|
-
} from '@mui/icons-material';
|
|
23
|
-
|
|
24
|
-
import {
|
|
25
|
-
I18n,
|
|
26
|
-
Icon,
|
|
27
|
-
} from '@iobroker/adapter-react-v5';
|
|
28
|
-
|
|
29
|
-
export function renderIcon(
|
|
30
|
-
action: ControlBase,
|
|
31
|
-
colors?: { primary: string, secondary: string },
|
|
32
|
-
value?: string | number | boolean | null,
|
|
33
|
-
): React.JSX.Element | null {
|
|
34
|
-
if (!action) {
|
|
35
|
-
return null;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
let color = (value && action.colorOn) || action.color || (action.state ? 'primary' : 'inherit');
|
|
39
|
-
|
|
40
|
-
if (colors) {
|
|
41
|
-
if (color === 'primary') {
|
|
42
|
-
color = colors.primary;
|
|
43
|
-
} else if (color === 'secondary') {
|
|
44
|
-
color = colors.secondary;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (action.icon?.startsWith('fa-') || action.icon?.startsWith('fas')) {
|
|
49
|
-
const iconStyle = action.icon.split(' ').map(s => s.trim()).filter(s => s !== 'fa-solid');
|
|
50
|
-
|
|
51
|
-
if (iconStyle.includes('fa-trash-can') || iconStyle.includes('fa-trash')) {
|
|
52
|
-
return <Delete style={{ color }} />;
|
|
53
|
-
}
|
|
54
|
-
if (iconStyle.includes('fa-pen')) {
|
|
55
|
-
return <Edit style={{ color }} />;
|
|
56
|
-
}
|
|
57
|
-
if (iconStyle.includes('fa-redo-alt')) {
|
|
58
|
-
return <Refresh style={{ color }} />;
|
|
59
|
-
}
|
|
60
|
-
if (iconStyle.includes('fa-plus')) {
|
|
61
|
-
return <Add style={{ color }} />;
|
|
62
|
-
}
|
|
63
|
-
if (iconStyle.includes('fa-wifi')) {
|
|
64
|
-
return <Wifi style={{ color }} />;
|
|
65
|
-
}
|
|
66
|
-
if (iconStyle.includes('fa-wifi-slash')) {
|
|
67
|
-
return <WifiOff style={{ color }} />;
|
|
68
|
-
}
|
|
69
|
-
if (iconStyle.includes('fa-bluetooth')) {
|
|
70
|
-
return <Bluetooth style={{ color }} />;
|
|
71
|
-
}
|
|
72
|
-
if (iconStyle.includes('fa-bluetooth-slash')) {
|
|
73
|
-
return <BluetoothDisabled style={{ color }} />;
|
|
74
|
-
}
|
|
75
|
-
if (iconStyle.includes('fa-eye')) {
|
|
76
|
-
return <Visibility style={{ color }} />;
|
|
77
|
-
}
|
|
78
|
-
if (iconStyle.includes('fa-search')) {
|
|
79
|
-
return <Search style={{ color }} />;
|
|
80
|
-
}
|
|
81
|
-
if (iconStyle.includes('fa-unlink')) {
|
|
82
|
-
return <LinkOff style={{ color }} />;
|
|
83
|
-
}
|
|
84
|
-
if (iconStyle.includes('fa-link')) {
|
|
85
|
-
return <LinkIcon style={{ color }} />;
|
|
86
|
-
}
|
|
87
|
-
if (iconStyle.includes('fa-search-location')) {
|
|
88
|
-
return <NotListedLocation style={{ color }} />;
|
|
89
|
-
}
|
|
90
|
-
if (iconStyle.includes('fa-play')) {
|
|
91
|
-
return <PlayArrow style={{ color }} />;
|
|
92
|
-
}
|
|
93
|
-
if (iconStyle.includes('fa-stop')) {
|
|
94
|
-
return <Stop style={{ color }} />;
|
|
95
|
-
}
|
|
96
|
-
if (iconStyle.includes('fa-pause')) {
|
|
97
|
-
return <Pause style={{ color }} />;
|
|
98
|
-
}
|
|
99
|
-
if (iconStyle.includes('forward') || iconStyle.includes('fa-forward')) {
|
|
100
|
-
return <FastForward style={{ color }} />;
|
|
101
|
-
}
|
|
102
|
-
if (iconStyle.includes('rewind') || iconStyle.includes('fa-rewind')) {
|
|
103
|
-
return <FastRewind style={{ color }} />;
|
|
104
|
-
}
|
|
105
|
-
return null;
|
|
106
|
-
}
|
|
107
|
-
if (value && action.iconOn?.startsWith('data:image')) {
|
|
108
|
-
return <Icon src={action.iconOn} style={{ color }} />;
|
|
109
|
-
}
|
|
110
|
-
if (action.icon?.startsWith('data:image')) {
|
|
111
|
-
return <Icon src={action.icon} style={{ color }} />;
|
|
112
|
-
}
|
|
113
|
-
if (action.id === 'edit' || action.id === 'rename') {
|
|
114
|
-
return <Edit style={{ color }} />;
|
|
115
|
-
}
|
|
116
|
-
if (action.id === 'delete') {
|
|
117
|
-
return <Delete style={{ color }} />;
|
|
118
|
-
}
|
|
119
|
-
if (action.id === 'refresh') {
|
|
120
|
-
return <Refresh style={{ color }} />;
|
|
121
|
-
}
|
|
122
|
-
if (action.id === 'newDevice' || action.id === 'new' || action.id === 'add') {
|
|
123
|
-
return <Add style={{ color }} />;
|
|
124
|
-
}
|
|
125
|
-
if (action.id === 'discover' || action.id === 'search') {
|
|
126
|
-
return <Search style={{ color }} />;
|
|
127
|
-
}
|
|
128
|
-
if (action.id === 'unpairDevice') {
|
|
129
|
-
return <LinkOff style={{ color }} />;
|
|
130
|
-
}
|
|
131
|
-
if (action.id === 'pairDevice') {
|
|
132
|
-
return <LinkIcon style={{ color }} />;
|
|
133
|
-
}
|
|
134
|
-
if (action.id === 'identify') {
|
|
135
|
-
return <NotListedLocation style={{ color }} />;
|
|
136
|
-
}
|
|
137
|
-
if (action.id === 'play') {
|
|
138
|
-
return <PlayArrow style={{ color }} />;
|
|
139
|
-
}
|
|
140
|
-
if (action.id === 'stop') {
|
|
141
|
-
return <Stop style={{ color }} />;
|
|
142
|
-
}
|
|
143
|
-
if (action.id === 'pause') {
|
|
144
|
-
return <Pause style={{ color }} />;
|
|
145
|
-
}
|
|
146
|
-
if (action.id === 'forward' || action.id === 'next') {
|
|
147
|
-
return <FastForward style={{ color }} />;
|
|
148
|
-
}
|
|
149
|
-
if (action.id === 'rewind' || action.id === 'previous') {
|
|
150
|
-
return <FastRewind style={{ color }} />;
|
|
151
|
-
}
|
|
152
|
-
if (action.id === 'lamp' || action.id === 'light') {
|
|
153
|
-
return <Lightbulb style={{ color }} />;
|
|
154
|
-
}
|
|
155
|
-
if (action.id === 'backlight') {
|
|
156
|
-
return <Fluorescent style={{ color }} />;
|
|
157
|
-
}
|
|
158
|
-
if (action.id === 'dimmer') {
|
|
159
|
-
return <WbIncandescent style={{ color }} />;
|
|
160
|
-
}
|
|
161
|
-
if (action.id === 'socket') {
|
|
162
|
-
return <Power style={{ color }} />;
|
|
163
|
-
}
|
|
164
|
-
if (action.id === 'settings') {
|
|
165
|
-
return <Settings style={{ color }} />;
|
|
166
|
-
}
|
|
167
|
-
return null;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
let language: ioBroker.Languages;
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* Get Translation
|
|
174
|
-
* @param {string | object} text - Text to translate
|
|
175
|
-
* @returns {string}
|
|
176
|
-
*/
|
|
177
|
-
export function getTranslation(text: ioBroker.StringOrTranslated): string {
|
|
178
|
-
language = language || I18n.getLanguage();
|
|
179
|
-
|
|
180
|
-
if (typeof text === 'object') {
|
|
181
|
-
const words = text as ioBroker.StringOrTranslated;
|
|
182
|
-
// @ts-ignore
|
|
183
|
-
return words[language] || text.en;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
return I18n.t(text);
|
|
187
|
-
}
|
package/src/i18n/de.json
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"manufacturer": "Hersteller",
|
|
3
|
-
"model": "Modell",
|
|
4
|
-
"batteryTooltip": "Batterie",
|
|
5
|
-
"connectedIconTooltip": "Verbunden",
|
|
6
|
-
"disconnectedIconTooltip": "Getrennt",
|
|
7
|
-
"cancelButtonText": "Abbrechen",
|
|
8
|
-
"okButtonText": "OK",
|
|
9
|
-
"yesButtonText": "Ja",
|
|
10
|
-
"noButtonText": "Nein",
|
|
11
|
-
"noInstanceSelectedText": "Bitte Instanz auswählen",
|
|
12
|
-
"filterLabelText": "Nach Name filtern",
|
|
13
|
-
"instanceLabelText": "Instanz",
|
|
14
|
-
"refreshInstanceList": "Instanzliste aktualisieren",
|
|
15
|
-
"copied": "Kopiert",
|
|
16
|
-
"toClipboard": "in die Zwischenablage kopiert",
|
|
17
|
-
"allDevicesFilteredOut": "Alle Geräte herausgefiltert",
|
|
18
|
-
"closeButtonText": "Schließen",
|
|
19
|
-
"instanceNotAlive": "Instanz ist nicht aktiv",
|
|
20
|
-
"noDevicesFoundText": "Keine Geräte gefunden"
|
|
21
|
-
}
|
package/src/i18n/en.json
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"manufacturer": "Manufacturer",
|
|
3
|
-
"model": "Model",
|
|
4
|
-
"batteryTooltip": "Battery",
|
|
5
|
-
"connectedIconTooltip": "Connected",
|
|
6
|
-
"disconnectedIconTooltip": "Disconnected",
|
|
7
|
-
"cancelButtonText": "Cancel",
|
|
8
|
-
"closeButtonText": "Close",
|
|
9
|
-
"okButtonText": "OK",
|
|
10
|
-
"yesButtonText": "Yes",
|
|
11
|
-
"noButtonText": "No",
|
|
12
|
-
"noInstanceSelectedText": "Please select instance",
|
|
13
|
-
"filterLabelText": "Filter by name",
|
|
14
|
-
"instanceLabelText": "Instance",
|
|
15
|
-
"refreshInstanceList": "Refresh instance list",
|
|
16
|
-
"noDevicesFoundText": "No devices found",
|
|
17
|
-
"copied": "Copied",
|
|
18
|
-
"toClipboard": "to clipboard",
|
|
19
|
-
"instanceNotAlive": "Instance is not alive",
|
|
20
|
-
"allDevicesFilteredOut": "All devices filtered out"
|
|
21
|
-
}
|
package/src/i18n/es.json
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"manufacturer": "Fabricante",
|
|
3
|
-
"model": "Modelo",
|
|
4
|
-
"batteryTooltip": "Batería",
|
|
5
|
-
"connectedIconTooltip": "Conectado",
|
|
6
|
-
"allDevicesFilteredOut": "Todos los dispositivos filtrados",
|
|
7
|
-
"cancelButtonText": "Cancelar",
|
|
8
|
-
"closeButtonText": "Cerca",
|
|
9
|
-
"copied": "copiado",
|
|
10
|
-
"disconnectedIconTooltip": "Desconectado",
|
|
11
|
-
"filterLabelText": "Filtrar por nombre",
|
|
12
|
-
"instanceLabelText": "Instancia",
|
|
13
|
-
"instanceNotAlive": "La instancia no está viva.",
|
|
14
|
-
"noButtonText": "No",
|
|
15
|
-
"noDevicesFoundText": "No se encontraron dispositivos",
|
|
16
|
-
"noInstanceSelectedText": "Por favor seleccione instancia",
|
|
17
|
-
"okButtonText": "DE ACUERDO",
|
|
18
|
-
"refreshInstanceList": "Actualizar lista de instancias",
|
|
19
|
-
"toClipboard": "al portapapeles",
|
|
20
|
-
"yesButtonText": "Sí"
|
|
21
|
-
}
|
package/src/i18n/fr.json
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"manufacturer": "Fabricant",
|
|
3
|
-
"model": "Modèle",
|
|
4
|
-
"batteryTooltip": "Batterie",
|
|
5
|
-
"connectedIconTooltip": "Connecté",
|
|
6
|
-
"allDevicesFilteredOut": "Tous les appareils filtrés",
|
|
7
|
-
"cancelButtonText": "Annuler",
|
|
8
|
-
"closeButtonText": "Fermer",
|
|
9
|
-
"copied": "Copié",
|
|
10
|
-
"disconnectedIconTooltip": "Débranché",
|
|
11
|
-
"filterLabelText": "Filtrer par nom",
|
|
12
|
-
"instanceLabelText": "Exemple",
|
|
13
|
-
"instanceNotAlive": "L'instance n'est pas vivante",
|
|
14
|
-
"noButtonText": "Non",
|
|
15
|
-
"noDevicesFoundText": "Aucun périphérique trouvé",
|
|
16
|
-
"noInstanceSelectedText": "Veuillez sélectionner une instance",
|
|
17
|
-
"okButtonText": "D'ACCORD",
|
|
18
|
-
"refreshInstanceList": "Actualiser la liste des instances",
|
|
19
|
-
"toClipboard": "au presse-papiers",
|
|
20
|
-
"yesButtonText": "Oui"
|
|
21
|
-
}
|
package/src/i18n/i18n.d.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* This file loads the translations keys from `i18n/en.json` file and overrides
|
|
3
|
-
* the declarations for the translate function `I18n.t` available in "@iobroker/adapter-react/i18n".
|
|
4
|
-
* Using these definitions it is ensured that all used translations in the React
|
|
5
|
-
* context are defined at least in the english translations file.
|
|
6
|
-
* This will add no overhead in the generated code since it just reexports the
|
|
7
|
-
* I18n class but with a more typed `t` function.
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/*
|
|
11
|
-
* DO NOT add any imports or exports in this file or it will stop working!
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Available words in `i18n/en.json`.
|
|
16
|
-
*/
|
|
17
|
-
declare type AdminWord = keyof typeof import('./en.json');
|
|
18
|
-
|
|
19
|
-
declare module '@iobroker/adapter-react/i18n' {
|
|
20
|
-
/**
|
|
21
|
-
* Translate the given string to the selected language.
|
|
22
|
-
* @param word The (key) word to look up the string. Has to be defined at least in `i18n/en.json`.
|
|
23
|
-
* @param args Optional arguments which will replace the first (second, third, ...) occurence of %s
|
|
24
|
-
*/
|
|
25
|
-
function t(word: AdminWord, ...args: string[]): string;
|
|
26
|
-
}
|
package/src/i18n/it.json
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"manufacturer": "Produttore",
|
|
3
|
-
"model": "Modello",
|
|
4
|
-
"batteryTooltip": "Batteria",
|
|
5
|
-
"connectedIconTooltip": "Connesso",
|
|
6
|
-
"allDevicesFilteredOut": "Tutti i dispositivi sono stati filtrati",
|
|
7
|
-
"cancelButtonText": "Annulla",
|
|
8
|
-
"closeButtonText": "Vicino",
|
|
9
|
-
"copied": "Copiato",
|
|
10
|
-
"disconnectedIconTooltip": "Disconnesso",
|
|
11
|
-
"filterLabelText": "Filtra per nome",
|
|
12
|
-
"instanceLabelText": "Esempio",
|
|
13
|
-
"instanceNotAlive": "L'istanza non è viva",
|
|
14
|
-
"noButtonText": "NO",
|
|
15
|
-
"noDevicesFoundText": "Nessun dispositivo trovato",
|
|
16
|
-
"noInstanceSelectedText": "Seleziona l'istanza",
|
|
17
|
-
"okButtonText": "OK",
|
|
18
|
-
"refreshInstanceList": "Aggiorna l'elenco delle istanze",
|
|
19
|
-
"toClipboard": "negli appunti",
|
|
20
|
-
"yesButtonText": "SÌ"
|
|
21
|
-
}
|
package/src/i18n/nl.json
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"manufacturer": "Fabrikant",
|
|
3
|
-
"model": "Model",
|
|
4
|
-
"batteryTooltip": "Batterij",
|
|
5
|
-
"connectedIconTooltip": "Verbonden",
|
|
6
|
-
"allDevicesFilteredOut": "Alle apparaten zijn eruit gefilterd",
|
|
7
|
-
"cancelButtonText": "Annuleren",
|
|
8
|
-
"closeButtonText": "Dichtbij",
|
|
9
|
-
"copied": "Gekopieerd",
|
|
10
|
-
"disconnectedIconTooltip": "Losgekoppeld",
|
|
11
|
-
"filterLabelText": "Filter op naam",
|
|
12
|
-
"instanceLabelText": "Voorbeeld",
|
|
13
|
-
"instanceNotAlive": "Instantie leeft niet",
|
|
14
|
-
"noButtonText": "Nee",
|
|
15
|
-
"noDevicesFoundText": "Geen apparaten gevonden",
|
|
16
|
-
"noInstanceSelectedText": "Selecteer een exemplaar",
|
|
17
|
-
"okButtonText": "OK",
|
|
18
|
-
"refreshInstanceList": "Ververs de exemplaarlijst",
|
|
19
|
-
"toClipboard": "naar klembord",
|
|
20
|
-
"yesButtonText": "Ja"
|
|
21
|
-
}
|