@iobroker/adapter-react-v5 6.0.0 → 6.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/Components/CustomModal.d.ts +2 -0
- package/Components/CustomModal.js +3 -3
- package/Components/ObjectBrowser.js +22 -53
- package/Components/Schedule.d.ts +2 -0
- package/Components/Schedule.js +7 -7
- package/Components/TreeTable.d.ts +2 -0
- package/Components/TreeTable.js +5 -5
- package/Dialogs/Cron.d.ts +2 -0
- package/Dialogs/Cron.js +1 -1
- package/README.md +5 -4
- package/package.json +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { IobTheme } from '../types';
|
|
2
3
|
interface CustomModalProps {
|
|
3
4
|
icon?: any;
|
|
4
5
|
open: boolean;
|
|
@@ -19,6 +20,7 @@ interface CustomModalProps {
|
|
|
19
20
|
progress?: boolean;
|
|
20
21
|
textInput?: boolean;
|
|
21
22
|
defaultValue?: string;
|
|
23
|
+
theme: IobTheme;
|
|
22
24
|
}
|
|
23
25
|
declare const CustomModal: (props: CustomModalProps) => React.JSX.Element;
|
|
24
26
|
export default CustomModal;
|
|
@@ -46,11 +46,11 @@ const styles = {
|
|
|
46
46
|
content: {
|
|
47
47
|
fontSize: 16,
|
|
48
48
|
},
|
|
49
|
-
languageButton:
|
|
49
|
+
languageButton: {
|
|
50
50
|
position: 'absolute',
|
|
51
51
|
right: 8,
|
|
52
52
|
top: 8,
|
|
53
|
-
}
|
|
53
|
+
},
|
|
54
54
|
languageButtonActive: (theme) => ({
|
|
55
55
|
color: theme.palette.primary.main,
|
|
56
56
|
}),
|
|
@@ -69,7 +69,7 @@ const CustomModal = (props) => {
|
|
|
69
69
|
title && react_1.default.createElement(material_1.DialogTitle, null,
|
|
70
70
|
icon ? react_1.default.createElement(Icon, { style: styles.titleIcon }) : null,
|
|
71
71
|
title,
|
|
72
|
-
i18n_1.default.getLanguage() !== 'en' && toggleTranslation ? react_1.default.createElement(material_1.IconButton, { size: "large", sx: Utils_1.default.getStyle(styles.languageButton, noTranslation && styles.languageButtonActive), onClick: () => toggleTranslation(), title: i18n_1.default.t('Disable/Enable translation') },
|
|
72
|
+
i18n_1.default.getLanguage() !== 'en' && toggleTranslation ? react_1.default.createElement(material_1.IconButton, { size: "large", sx: Utils_1.default.getStyle(props.theme, styles.languageButton, noTranslation && styles.languageButtonActive), onClick: () => toggleTranslation(), title: i18n_1.default.t('Disable/Enable translation') },
|
|
73
73
|
react_1.default.createElement(icons_material_1.Language, null)) : null),
|
|
74
74
|
react_1.default.createElement(material_1.DialogContent, { style: Object.assign(Object.assign(Object.assign({}, styles.content), (overflowHidden ? styles.overflowHidden : undefined)), { paddingTop: 8 }) },
|
|
75
75
|
textInput && react_1.default.createElement(material_1.TextField
|
|
@@ -719,37 +719,6 @@ const styles = {
|
|
|
719
719
|
display: 'flex',
|
|
720
720
|
},
|
|
721
721
|
};
|
|
722
|
-
function getStyle(theme, ...args) {
|
|
723
|
-
const result = {};
|
|
724
|
-
for (let a = 0; a < args.length; a++) {
|
|
725
|
-
if (typeof args[a] === 'function') {
|
|
726
|
-
Object.assign(result, args[a](theme));
|
|
727
|
-
}
|
|
728
|
-
else if (args[a] && typeof args[a] === 'object') {
|
|
729
|
-
Object.keys(args[a]).forEach((attr) => {
|
|
730
|
-
if (typeof args[a][attr] === 'function') {
|
|
731
|
-
result[attr] = args[a][attr](theme);
|
|
732
|
-
}
|
|
733
|
-
else if (typeof args[a][attr] === 'object') {
|
|
734
|
-
const obj = args[a][attr];
|
|
735
|
-
result[attr] = {};
|
|
736
|
-
Object.keys(obj).forEach((attr1) => {
|
|
737
|
-
if (typeof obj[attr1] === 'function') {
|
|
738
|
-
result[attr][attr1] = obj(theme);
|
|
739
|
-
}
|
|
740
|
-
else if (obj[attr1] || obj[attr1] === 0) {
|
|
741
|
-
result[attr][attr1] = obj[attr1];
|
|
742
|
-
}
|
|
743
|
-
});
|
|
744
|
-
}
|
|
745
|
-
else if (args[a][attr] || args[a][attr] === 0) {
|
|
746
|
-
result[attr] = args[a][attr];
|
|
747
|
-
}
|
|
748
|
-
});
|
|
749
|
-
}
|
|
750
|
-
}
|
|
751
|
-
return result;
|
|
752
|
-
}
|
|
753
722
|
/**
|
|
754
723
|
* Function that walks through all keys of an object or array and applies a function to each key.
|
|
755
724
|
*/
|
|
@@ -2793,7 +2762,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2793
2762
|
return null;
|
|
2794
2763
|
}
|
|
2795
2764
|
return react_1.default.createElement(material_1.Dialog, { onClose: () => this.setState({ columnsSelectorShow: false }), open: !0, sx: {
|
|
2796
|
-
'& .MuiPaper-root': getStyle(this.props.theme, styles.dialogColumns, styles[`transparent_${this.state.columnsDialogTransparent}`]),
|
|
2765
|
+
'& .MuiPaper-root': Utils_1.default.getStyle(this.props.theme, styles.dialogColumns, styles[`transparent_${this.state.columnsDialogTransparent}`]),
|
|
2797
2766
|
} },
|
|
2798
2767
|
react_1.default.createElement(material_1.DialogTitle, { sx: styles.fontSizeTitle }, this.props.t('ra_Configure')),
|
|
2799
2768
|
react_1.default.createElement(material_1.DialogContent, { sx: styles.fontSizeTitle },
|
|
@@ -4440,7 +4409,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4440
4409
|
useDesc = !!oTooltip;
|
|
4441
4410
|
}
|
|
4442
4411
|
}
|
|
4443
|
-
return react_1.default.createElement(material_1.Grid, { container: true, direction: "row", wrap: "nowrap", sx: getStyle(this.props.theme, styles.tableRow, this.state.linesEnabled && styles.tableRowLines, !this.props.dragEnabled && styles.tableRowNoDragging, alias && styles.tableRowAlias, readWriteAlias && styles.tableRowAliasReadWrite, !item.data.visible && styles.filteredOut, item.data.hasVisibleParent &&
|
|
4412
|
+
return react_1.default.createElement(material_1.Grid, { container: true, direction: "row", wrap: "nowrap", sx: Utils_1.default.getStyle(this.props.theme, styles.tableRow, this.state.linesEnabled && styles.tableRowLines, !this.props.dragEnabled && styles.tableRowNoDragging, alias && styles.tableRowAlias, readWriteAlias && styles.tableRowAliasReadWrite, !item.data.visible && styles.filteredOut, item.data.hasVisibleParent &&
|
|
4444
4413
|
!item.data.visible &&
|
|
4445
4414
|
!item.data.hasVisibleChildren &&
|
|
4446
4415
|
styles.filteredParentOut, this.state.selected.includes(id) && styles.itemSelected, this.state.selectedNonObject === id && styles.itemSelected), key: id, id: id, onMouseDown: e => {
|
|
@@ -5341,26 +5310,26 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5341
5310
|
this.unsubscribeTimer && clearTimeout(this.unsubscribeTimer);
|
|
5342
5311
|
if (this.styleTheme !== this.props.themeType) {
|
|
5343
5312
|
this.styles = {
|
|
5344
|
-
cellIdIconFolder: getStyle(this.props.theme, styles.cellIdIconFolder),
|
|
5345
|
-
cellIdIconDocument: getStyle(this.props.theme, styles.cellIdIconDocument),
|
|
5346
|
-
iconDeviceError: getStyle(this.props.theme, styles.iconDeviceError),
|
|
5347
|
-
iconDeviceConnected: getStyle(this.props.theme, styles.iconDeviceConnected),
|
|
5348
|
-
iconDeviceDisconnected: getStyle(this.props.theme, styles.iconDeviceDisconnected),
|
|
5349
|
-
cellButtonsButtonWithCustoms: getStyle(this.props.theme, styles.cellButtonsButtonWithCustoms),
|
|
5350
|
-
invertedBackground: getStyle(this.props.theme, styles.invertedBackground),
|
|
5351
|
-
invertedBackgroundFlex: getStyle(this.props.theme, styles.invertedBackgroundFlex),
|
|
5352
|
-
contextMenuEdit: getStyle(this.props.theme, styles.contextMenuEdit),
|
|
5353
|
-
contextMenuEditValue: getStyle(this.props.theme, styles.contextMenuEditValue),
|
|
5354
|
-
contextMenuView: getStyle(this.props.theme, styles.contextMenuView),
|
|
5355
|
-
contextMenuCustom: getStyle(this.props.theme, styles.contextMenuCustom),
|
|
5356
|
-
contextMenuACL: getStyle(this.props.theme, styles.contextMenuACL),
|
|
5357
|
-
contextMenuRoom: getStyle(this.props.theme, styles.contextMenuRoom),
|
|
5358
|
-
contextMenuRole: getStyle(this.props.theme, styles.contextMenuRole),
|
|
5359
|
-
contextMenuDelete: getStyle(this.props.theme, styles.contextMenuDelete),
|
|
5360
|
-
filterInput: getStyle(this.props.theme, styles.headerCellInput, styles.filterInput),
|
|
5361
|
-
iconCopy: getStyle(this.props.theme, styles.cellButtonsValueButton, styles.cellButtonsValueButtonCopy),
|
|
5362
|
-
aliasReadWrite: getStyle(styles.cellIdAlias, styles.cellIdAliasReadWrite),
|
|
5363
|
-
aliasAlone: getStyle(styles.cellIdAlias, styles.cellIdAliasAlone),
|
|
5313
|
+
cellIdIconFolder: Utils_1.default.getStyle(this.props.theme, styles.cellIdIconFolder),
|
|
5314
|
+
cellIdIconDocument: Utils_1.default.getStyle(this.props.theme, styles.cellIdIconDocument),
|
|
5315
|
+
iconDeviceError: Utils_1.default.getStyle(this.props.theme, styles.iconDeviceError),
|
|
5316
|
+
iconDeviceConnected: Utils_1.default.getStyle(this.props.theme, styles.iconDeviceConnected),
|
|
5317
|
+
iconDeviceDisconnected: Utils_1.default.getStyle(this.props.theme, styles.iconDeviceDisconnected),
|
|
5318
|
+
cellButtonsButtonWithCustoms: Utils_1.default.getStyle(this.props.theme, styles.cellButtonsButtonWithCustoms),
|
|
5319
|
+
invertedBackground: Utils_1.default.getStyle(this.props.theme, styles.invertedBackground),
|
|
5320
|
+
invertedBackgroundFlex: Utils_1.default.getStyle(this.props.theme, styles.invertedBackgroundFlex),
|
|
5321
|
+
contextMenuEdit: Utils_1.default.getStyle(this.props.theme, styles.contextMenuEdit),
|
|
5322
|
+
contextMenuEditValue: Utils_1.default.getStyle(this.props.theme, styles.contextMenuEditValue),
|
|
5323
|
+
contextMenuView: Utils_1.default.getStyle(this.props.theme, styles.contextMenuView),
|
|
5324
|
+
contextMenuCustom: Utils_1.default.getStyle(this.props.theme, styles.contextMenuCustom),
|
|
5325
|
+
contextMenuACL: Utils_1.default.getStyle(this.props.theme, styles.contextMenuACL),
|
|
5326
|
+
contextMenuRoom: Utils_1.default.getStyle(this.props.theme, styles.contextMenuRoom),
|
|
5327
|
+
contextMenuRole: Utils_1.default.getStyle(this.props.theme, styles.contextMenuRole),
|
|
5328
|
+
contextMenuDelete: Utils_1.default.getStyle(this.props.theme, styles.contextMenuDelete),
|
|
5329
|
+
filterInput: Utils_1.default.getStyle(this.props.theme, styles.headerCellInput, styles.filterInput),
|
|
5330
|
+
iconCopy: Utils_1.default.getStyle(this.props.theme, styles.cellButtonsValueButton, styles.cellButtonsValueButtonCopy),
|
|
5331
|
+
aliasReadWrite: Utils_1.default.getStyle(this.props.theme, styles.cellIdAlias, styles.cellIdAliasReadWrite),
|
|
5332
|
+
aliasAlone: Utils_1.default.getStyle(this.props.theme, styles.cellIdAlias, styles.cellIdAliasAlone),
|
|
5364
5333
|
};
|
|
5365
5334
|
this.styleTheme = this.props.themeType;
|
|
5366
5335
|
}
|
package/Components/Schedule.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
|
+
import { IobTheme } from '../types';
|
|
2
3
|
interface ScheduleConfig {
|
|
3
4
|
time: {
|
|
4
5
|
exactTime: boolean;
|
|
@@ -26,6 +27,7 @@ interface ScheduleConfig {
|
|
|
26
27
|
interface ScheduleProps {
|
|
27
28
|
schedule: string | ScheduleConfig;
|
|
28
29
|
onChange: (schedule: string, desc?: string) => void;
|
|
30
|
+
theme: IobTheme;
|
|
29
31
|
}
|
|
30
32
|
interface ScheduleState {
|
|
31
33
|
schedule: ScheduleConfig;
|
package/Components/Schedule.js
CHANGED
|
@@ -705,7 +705,7 @@ class Schedule extends react_1.Component {
|
|
|
705
705
|
}, 1500, e.target.value);
|
|
706
706
|
}, InputLabelProps: { shrink: true }, label: i18n_1.default.t('sch_at'), margin: "normal" }))),
|
|
707
707
|
// ----- days ---
|
|
708
|
-
react_1.default.createElement(material_1.Box, { component: "div", key: "days", sx: Utils_1.default.getStyle(styles.rowDiv, styles.rowDays) },
|
|
708
|
+
react_1.default.createElement(material_1.Box, { component: "div", key: "days", sx: Utils_1.default.getStyle(this.props.theme, styles.rowDiv, styles.rowDays) },
|
|
709
709
|
react_1.default.createElement("div", { style: styles.modeDiv },
|
|
710
710
|
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { style: styles.inputRadio, checked: !!schedule.period.days, onClick: () => {
|
|
711
711
|
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
@@ -741,7 +741,7 @@ class Schedule extends react_1.Component {
|
|
|
741
741
|
</div>,
|
|
742
742
|
*/
|
|
743
743
|
// ----- weeks ---
|
|
744
|
-
react_1.default.createElement(material_1.Box, { component: "div", key: "weeks", sx: Utils_1.default.getStyle(styles.rowDiv, styles.rowDows) },
|
|
744
|
+
react_1.default.createElement(material_1.Box, { component: "div", key: "weeks", sx: Utils_1.default.getStyle(this.props.theme, styles.rowDiv, styles.rowDows) },
|
|
745
745
|
react_1.default.createElement("div", { style: styles.modeDiv },
|
|
746
746
|
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { style: styles.inputRadio, checked: !!schedule.period.weeks, onClick: () => {
|
|
747
747
|
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
@@ -758,9 +758,9 @@ class Schedule extends react_1.Component {
|
|
|
758
758
|
} }), label: i18n_1.default.t('sch_periodWeekly') })),
|
|
759
759
|
react_1.default.createElement(material_1.Box, { component: "div", style: styles.settingsDiv },
|
|
760
760
|
react_1.default.createElement("div", { style: styles.settingsDiv }, this.getPeriodSettingsWeekly()),
|
|
761
|
-
react_1.default.createElement(material_1.Box, { component: "div", sx: Utils_1.default.getStyle(styles.settingsDiv, styles.rowDowsDows) }, this.state.schedule.period.weeks ? this.getPeriodSettingsWeekdays() : null))),
|
|
761
|
+
react_1.default.createElement(material_1.Box, { component: "div", sx: Utils_1.default.getStyle(this.props.theme, styles.settingsDiv, styles.rowDowsDows) }, this.state.schedule.period.weeks ? this.getPeriodSettingsWeekdays() : null))),
|
|
762
762
|
// ----- months ---
|
|
763
|
-
react_1.default.createElement(material_1.Box, { component: "div", key: "months", sx: Utils_1.default.getStyle(styles.rowDiv, styles.rowMonths) },
|
|
763
|
+
react_1.default.createElement(material_1.Box, { component: "div", key: "months", sx: Utils_1.default.getStyle(this.props.theme, styles.rowDiv, styles.rowMonths) },
|
|
764
764
|
react_1.default.createElement("div", { style: styles.modeDiv },
|
|
765
765
|
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { style: styles.inputRadio, checked: !!schedule.period.months, onClick: () => {
|
|
766
766
|
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
@@ -778,7 +778,7 @@ class Schedule extends react_1.Component {
|
|
|
778
778
|
react_1.default.createElement("div", { style: styles.settingsDiv },
|
|
779
779
|
this.getPeriodSettingsMonthly(),
|
|
780
780
|
schedule.period.months ? react_1.default.createElement(material_1.Box, null,
|
|
781
|
-
react_1.default.createElement(material_1.Box, { component: "div", sx: Utils_1.default.getStyle(styles.settingsDiv, styles.rowMonthsDates) },
|
|
781
|
+
react_1.default.createElement(material_1.Box, { component: "div", sx: Utils_1.default.getStyle(this.props.theme, styles.settingsDiv, styles.rowMonthsDates) },
|
|
782
782
|
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Checkbox, { style: styles.inputRadio, checked: !!schedule.period.dates, onClick: () => {
|
|
783
783
|
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
784
784
|
_schedule.period.months = _schedule.period.months || 1;
|
|
@@ -796,9 +796,9 @@ class Schedule extends react_1.Component {
|
|
|
796
796
|
_schedule.period.once = '';
|
|
797
797
|
this.onChange(_schedule);
|
|
798
798
|
} }), label: i18n_1.default.t('sch_periodDates') })),
|
|
799
|
-
react_1.default.createElement(material_1.Box, { component: "div", sx: Utils_1.default.getStyle(styles.settingsDiv, styles.rowMonthsDates) }, this.getPeriodSettingsDates())) : null)),
|
|
799
|
+
react_1.default.createElement(material_1.Box, { component: "div", sx: Utils_1.default.getStyle(this.props.theme, styles.settingsDiv, styles.rowMonthsDates) }, this.getPeriodSettingsDates())) : null)),
|
|
800
800
|
// ----- years ---
|
|
801
|
-
react_1.default.createElement(material_1.Box, { component: "div", key: "years", sx: Utils_1.default.getStyle(styles.rowDiv, styles.rowYears) },
|
|
801
|
+
react_1.default.createElement(material_1.Box, { component: "div", key: "years", sx: Utils_1.default.getStyle(this.props.theme, styles.rowDiv, styles.rowYears) },
|
|
802
802
|
react_1.default.createElement("div", { style: styles.modeDiv },
|
|
803
803
|
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Radio, { style: styles.inputRadio, checked: !!schedule.period.years, onClick: () => {
|
|
804
804
|
const _schedule = JSON.parse(JSON.stringify(this.state.schedule));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import type Connection from '../Connection';
|
|
3
|
+
import { IobTheme } from '../types';
|
|
3
4
|
interface Column {
|
|
4
5
|
cellStyle?: Record<string, any>;
|
|
5
6
|
editComponent?: React.FC<{
|
|
@@ -36,6 +37,7 @@ interface TreeTableProps {
|
|
|
36
37
|
/** Shift in pixels for every level */
|
|
37
38
|
levelShift?: number;
|
|
38
39
|
adapterName: string;
|
|
40
|
+
theme: IobTheme;
|
|
39
41
|
}
|
|
40
42
|
interface TreeTableState {
|
|
41
43
|
opened: string[];
|
package/Components/TreeTable.js
CHANGED
|
@@ -434,19 +434,19 @@ class TreeTable extends react_1.Component {
|
|
|
434
434
|
renderHead() {
|
|
435
435
|
return react_1.default.createElement(material_1.TableHead, null,
|
|
436
436
|
react_1.default.createElement(material_1.TableRow, { key: "headerRow" },
|
|
437
|
-
react_1.default.createElement(material_1.TableCell, { component: "th", sx: Utils_1.default.getStyle(styles.cell, styles.cellHeader, styles.cellExpand) }),
|
|
438
|
-
react_1.default.createElement(material_1.TableCell, { component: "th", sx: Utils_1.default.getStyle(styles.cell, styles.cellHeader, styles[`width_${this.props.columns[0].field.replace(/\./g, '_')}`]), style: this.props.columns[0].headerStyle || this.props.columns[0].cellStyle, sortDirection: this.props.noSort ? false : (this.state.orderBy === this.props.columns[0].field ? this.state.order : false) }, this.props.noSort ? null : react_1.default.createElement(material_1.TableSortLabel, { active: this.state.orderBy === this.props.columns[0].field, direction: this.state.orderBy === this.props.columns[0].field ? this.state.order : 'asc', onClick: () => this.handleRequestSort(this.props.columns[0].field) },
|
|
437
|
+
react_1.default.createElement(material_1.TableCell, { component: "th", sx: Utils_1.default.getStyle(this.props.theme, styles.cell, styles.cellHeader, styles.cellExpand) }),
|
|
438
|
+
react_1.default.createElement(material_1.TableCell, { component: "th", sx: Utils_1.default.getStyle(this.props.theme, styles.cell, styles.cellHeader, styles[`width_${this.props.columns[0].field.replace(/\./g, '_')}`]), style: this.props.columns[0].headerStyle || this.props.columns[0].cellStyle, sortDirection: this.props.noSort ? false : (this.state.orderBy === this.props.columns[0].field ? this.state.order : false) }, this.props.noSort ? null : react_1.default.createElement(material_1.TableSortLabel, { active: this.state.orderBy === this.props.columns[0].field, direction: this.state.orderBy === this.props.columns[0].field ? this.state.order : 'asc', onClick: () => this.handleRequestSort(this.props.columns[0].field) },
|
|
439
439
|
this.props.columns[0].title || this.props.columns[0].field,
|
|
440
440
|
this.state.orderBy === this.props.columns[0].field ?
|
|
441
441
|
react_1.default.createElement("span", { style: styles.visuallyHidden }, this.state.order === 'desc' ? 'sorted descending' : 'sorted ascending') : null)),
|
|
442
|
-
this.props.columns.map((col, i) => (!i && !col.hidden ? null : react_1.default.createElement(material_1.TableCell, { key: col.field, sx: Utils_1.default.getStyle(styles.cell, styles.cellHeader, styles[`width_${col.field.replace(/\./g, '_')}`]), style: col.headerStyle || col.cellStyle, component: "th" }, this.props.noSort ? null : react_1.default.createElement(material_1.TableSortLabel, { active: this.state.orderBy === col.field, direction: this.state.orderBy === col.field ? this.state.order : 'asc', onClick: () => this.handleRequestSort(col.field) },
|
|
442
|
+
this.props.columns.map((col, i) => (!i && !col.hidden ? null : react_1.default.createElement(material_1.TableCell, { key: col.field, sx: Utils_1.default.getStyle(this.props.theme, styles.cell, styles.cellHeader, styles[`width_${col.field.replace(/\./g, '_')}`]), style: col.headerStyle || col.cellStyle, component: "th" }, this.props.noSort ? null : react_1.default.createElement(material_1.TableSortLabel, { active: this.state.orderBy === col.field, direction: this.state.orderBy === col.field ? this.state.order : 'asc', onClick: () => this.handleRequestSort(col.field) },
|
|
443
443
|
col.title || col.field,
|
|
444
444
|
this.state.orderBy === col.field ?
|
|
445
445
|
react_1.default.createElement("span", { style: styles.visuallyHidden }, this.state.order === 'desc' ? 'sorted descending' : 'sorted ascending') : null)))),
|
|
446
|
-
this.props.onUpdate ? react_1.default.createElement(material_1.TableCell, { component: "th", sx: Utils_1.default.getStyle(styles.cell, styles.cellHeader, styles.cellButton) }, !this.props.noAdd ? react_1.default.createElement(material_1.Fab, { color: "primary", size: "small", disabled: this.state.editMode !== false, onClick: () => this.props.onUpdate && this.props.onUpdate(true) },
|
|
446
|
+
this.props.onUpdate ? react_1.default.createElement(material_1.TableCell, { component: "th", sx: Utils_1.default.getStyle(this.props.theme, styles.cell, styles.cellHeader, styles.cellButton) }, !this.props.noAdd ? react_1.default.createElement(material_1.Fab, { color: "primary", size: "small", disabled: this.state.editMode !== false, onClick: () => this.props.onUpdate && this.props.onUpdate(true) },
|
|
447
447
|
react_1.default.createElement(icons_material_1.Add, null)) : null) : null,
|
|
448
448
|
this.props.onDelete || this.props.onUpdate ?
|
|
449
|
-
react_1.default.createElement(material_1.TableCell, { component: "th", sx: Utils_1.default.getStyle(styles.cell, styles.cellHeader, styles.cellButton) }) : null));
|
|
449
|
+
react_1.default.createElement(material_1.TableCell, { component: "th", sx: Utils_1.default.getStyle(this.props.theme, styles.cell, styles.cellHeader, styles.cellButton) }) : null));
|
|
450
450
|
}
|
|
451
451
|
render() {
|
|
452
452
|
const col = this.props.columns.find(_col => _col.field === this.state.orderBy);
|
package/Dialogs/Cron.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { IobTheme } from '../types';
|
|
2
3
|
interface DialogCronProps {
|
|
3
4
|
onClose: () => void;
|
|
4
5
|
onOk: (cron: string) => void;
|
|
@@ -12,6 +13,7 @@ interface DialogCronProps {
|
|
|
12
13
|
complex?: boolean;
|
|
13
14
|
/** do not show wizard */
|
|
14
15
|
noWizard?: boolean;
|
|
16
|
+
theme: IobTheme;
|
|
15
17
|
}
|
|
16
18
|
interface DialogCronState {
|
|
17
19
|
cron: string;
|
package/Dialogs/Cron.js
CHANGED
|
@@ -86,7 +86,7 @@ class DialogCron extends react_1.default.Component {
|
|
|
86
86
|
react_1.default.createElement(material_1.Radio, { key: "complex", checked: this.state.mode === 'complex', onChange: () => this.setMode('complex') }),
|
|
87
87
|
react_1.default.createElement("label", { onClick: () => this.setMode('complex'), style: this.state.mode !== 'complex' ? { color: 'lightgrey' } : {} }, i18n_1.default.t('sc_cron')))) : null,
|
|
88
88
|
this.state.mode === 'simple' && react_1.default.createElement(SimpleCron_1.default, { cronExpression: this.state.cron, onChange: cron => this.setState({ cron }), language: i18n_1.default.getLanguage() }),
|
|
89
|
-
this.state.mode === 'wizard' && react_1.default.createElement(Schedule_1.default, { schedule: this.state.cron, onChange: (cron) => this.setState({ cron }) }),
|
|
89
|
+
this.state.mode === 'wizard' && react_1.default.createElement(Schedule_1.default, { theme: this.props.theme, schedule: this.state.cron, onChange: (cron) => this.setState({ cron }) }),
|
|
90
90
|
this.state.mode === 'complex' && react_1.default.createElement(ComplexCron_1.default, { cronExpression: this.state.cron, onChange: cron => this.setState({ cron }), language: i18n_1.default.getLanguage() })),
|
|
91
91
|
react_1.default.createElement(material_1.DialogActions, null,
|
|
92
92
|
react_1.default.createElement(material_1.Button, { variant: "contained", onClick: () => this.handleOk(), color: "primary", startIcon: react_1.default.createElement(icons_material_1.Check, null) }, this.props.ok || i18n_1.default.t('ra_Ok')),
|
package/README.md
CHANGED
|
@@ -690,7 +690,8 @@ class JsonComponent extends ConfigGeneric {
|
|
|
690
690
|
The main change is that the `withStyles` was removed. So you have to replace all `withStyles` with `sx` or `style` properties.
|
|
691
691
|
|
|
692
692
|
You can read more about sx [here](https://mui.com/system/getting-started/the-sx-prop/).
|
|
693
|
-
|
|
693
|
+
- Remove at start of the file `import { withStyles } from '@mui/styles';`
|
|
694
|
+
- Replace at the very end of the file `export default withStyles(styles)(MyComponent);` with `export default MyComponent;`
|
|
694
695
|
- Modify `const styles`:
|
|
695
696
|
Before:
|
|
696
697
|
```
|
|
@@ -733,11 +734,11 @@ The best practice is to replace `padding` with `p` and `margin` with `m`, so you
|
|
|
733
734
|
- Modify `classes`:
|
|
734
735
|
Before: `<Dialog classes={{ scrollPaper: this.props.classes.dialog, paper: this.props.classes.paper }}>`
|
|
735
736
|
|
|
736
|
-
After: `<Dialog {{ '&.MuiDialog-scrollPaper': styles.dialog, '& .MuiDialog-paper': styles.paper }}>`
|
|
737
|
+
After: `<Dialog sx={{ '&.MuiDialog-scrollPaper': styles.dialog, '& .MuiDialog-paper': styles.paper }}>`
|
|
737
738
|
|
|
738
739
|
Before: `<Dialog classes={{ scrollPaper: this.props.classes.dialog, paper: this.props.classes.paper }}>`
|
|
739
740
|
|
|
740
|
-
After: `<Dialog {{ '&.MuiDialog-scrollPaper': styles.dialog, '& .MuiDialog-paper': styles.paper }}>`
|
|
741
|
+
After: `<Dialog sx={{ '&.MuiDialog-scrollPaper': styles.dialog, '& .MuiDialog-paper': styles.paper }}>`
|
|
741
742
|
|
|
742
743
|
Before: `<ListItem classes={{ root: styles.listItem }} >`
|
|
743
744
|
|
|
@@ -764,7 +765,7 @@ The best practice is to replace `padding` with `p` and `margin` with `m`, so you
|
|
|
764
765
|
-->
|
|
765
766
|
|
|
766
767
|
## Changelog
|
|
767
|
-
### 6.0.
|
|
768
|
+
### 6.0.1 (2024-06-19)
|
|
768
769
|
* (bluefox) Removed the usage of `withStyles` in favor of `sx` and `style` properties (see [Migration from v5 to v6](#migration-from-v5-to-v6)
|
|
769
770
|
* (bluefox) (BREAKING) Higher version of `@mui/material` (5.15.20) is used
|
|
770
771
|
|