@iobroker/adapter-react-v5 6.1.3 → 6.1.6

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.
Files changed (74) hide show
  1. package/README.md +6 -0
  2. package/craco-module-federation.js +1 -1
  3. package/package.json +1 -1
  4. package/src/AdminConnection.tsx +3 -0
  5. package/src/Components/404.tsx +121 -0
  6. package/src/Components/ColorPicker.tsx +315 -0
  7. package/src/Components/ComplexCron.tsx +507 -0
  8. package/src/Components/CopyToClipboard.tsx +165 -0
  9. package/src/Components/CustomModal.tsx +163 -0
  10. package/src/Components/FileBrowser.tsx +2394 -0
  11. package/src/Components/FileViewer.tsx +384 -0
  12. package/src/Components/Icon.tsx +210 -0
  13. package/src/Components/IconPicker.tsx +149 -0
  14. package/src/Components/IconSelector.tsx +2202 -0
  15. package/src/Components/Image.tsx +176 -0
  16. package/src/Components/Loader.tsx +304 -0
  17. package/src/Components/Logo.tsx +166 -0
  18. package/src/Components/MDUtils.tsx +100 -0
  19. package/src/Components/ObjectBrowser.tsx +7915 -0
  20. package/src/Components/Router.tsx +90 -0
  21. package/src/Components/SaveCloseButtons.tsx +113 -0
  22. package/src/Components/Schedule.tsx +1724 -0
  23. package/src/Components/SelectWithIcon.tsx +197 -0
  24. package/src/Components/TabContainer.tsx +55 -0
  25. package/src/Components/TabContent.tsx +37 -0
  26. package/src/Components/TabHeader.tsx +19 -0
  27. package/src/Components/TableResize.tsx +259 -0
  28. package/src/Components/TextWithIcon.tsx +148 -0
  29. package/src/Components/ToggleThemeMenu.tsx +34 -0
  30. package/src/Components/TreeTable.tsx +919 -0
  31. package/src/Components/UploadImage.tsx +599 -0
  32. package/src/Components/Utils.tsx +1794 -0
  33. package/src/Components/loader.css +222 -0
  34. package/src/Components/withWidth.tsx +21 -0
  35. package/src/Connection.tsx +7 -0
  36. package/src/Dialogs/ComplexCron.tsx +129 -0
  37. package/src/Dialogs/Confirm.tsx +162 -0
  38. package/src/Dialogs/Cron.tsx +182 -0
  39. package/src/Dialogs/Error.tsx +72 -0
  40. package/src/Dialogs/Message.tsx +71 -0
  41. package/src/Dialogs/SelectFile.tsx +270 -0
  42. package/src/Dialogs/SelectID.tsx +298 -0
  43. package/src/Dialogs/SimpleCron.tsx +100 -0
  44. package/src/Dialogs/TextInput.tsx +107 -0
  45. package/src/GenericApp.tsx +976 -0
  46. package/src/LegacyConnection.tsx +3589 -0
  47. package/src/Prompt.tsx +20 -0
  48. package/src/Theme.tsx +479 -0
  49. package/src/icons/IconAdapter.tsx +20 -0
  50. package/src/icons/IconAlias.tsx +20 -0
  51. package/src/icons/IconChannel.tsx +21 -0
  52. package/src/icons/IconClearFilter.tsx +22 -0
  53. package/src/icons/IconClosed.tsx +17 -0
  54. package/src/icons/IconCopy.tsx +16 -0
  55. package/src/icons/IconDevice.tsx +27 -0
  56. package/src/icons/IconDocument.tsx +17 -0
  57. package/src/icons/IconDocumentReadOnly.tsx +18 -0
  58. package/src/icons/IconExpert.tsx +18 -0
  59. package/src/icons/IconFx.tsx +36 -0
  60. package/src/icons/IconInstance.tsx +20 -0
  61. package/src/icons/IconLogout.tsx +30 -0
  62. package/src/icons/IconNoIcon.tsx +19 -0
  63. package/src/icons/IconOpen.tsx +17 -0
  64. package/src/icons/IconProps.tsx +15 -0
  65. package/src/icons/IconState.tsx +17 -0
  66. package/src/index.css +55 -0
  67. package/assets/devices/list.json +0 -994
  68. package/assets/devices/names.txt +0 -63
  69. package/assets/devices/parseNames.d.ts +0 -0
  70. package/assets/devices/parseNames.js +0 -34
  71. package/assets/rooms/list.json +0 -946
  72. package/assets/rooms/names.txt +0 -60
  73. package/assets/rooms/parseNames.d.ts +0 -0
  74. package/assets/rooms/parseNames.js +0 -34
@@ -0,0 +1,197 @@
1
+ import React, { Component } from 'react';
2
+
3
+ import {
4
+ FormControl, InputLabel, MenuItem, Select,
5
+ } from '@mui/material';
6
+ import { InputProps } from '@mui/material/Input';
7
+
8
+ import { ThemeType, Translate } from '../types';
9
+
10
+ import Icon from './Icon';
11
+ import Utils from './Utils';
12
+ import I18n from '../i18n';
13
+
14
+ const styles: Record<string, React.CSSProperties> = {
15
+ different: {
16
+ opacity: 0.5,
17
+ },
18
+ icon: {
19
+ width: 16,
20
+ height: 16,
21
+ marginRight: 8,
22
+ },
23
+ };
24
+
25
+ interface SelectWithIconProps {
26
+ t: Translate;
27
+ lang: ioBroker.Languages;
28
+ themeType: ThemeType;
29
+ value?: string;
30
+ onChange: (id: string) => void;
31
+ disabled?: boolean;
32
+ list?: ioBroker.Object[] | Record<string, ioBroker.Object>; // one of "list"(Array) or "options"(object) is required
33
+ options?: Record<string, any>; // one of "list"(Array) or "options"(object) is required
34
+ different?: string | boolean;
35
+ label?: string;
36
+ fullWidth?: boolean;
37
+ className?: string;
38
+ style?: React.CSSProperties;
39
+ removePrefix?: string;
40
+ allowNone?: boolean;
41
+ inputProps?: InputProps['inputProps'];
42
+ dense?: boolean;
43
+ }
44
+
45
+ interface TextWithIconItem {
46
+ name: string;
47
+ value: string;
48
+ icon?: string;
49
+ color?: string;
50
+ }
51
+
52
+ interface SelectWithIconState {
53
+ list: TextWithIconItem[];
54
+ }
55
+
56
+ class SelectWithIcon extends Component<SelectWithIconProps, SelectWithIconState> {
57
+ private readonly wordDifferent: string | undefined;
58
+
59
+ private timeout: ReturnType<typeof setTimeout> | null = null;
60
+
61
+ constructor(props: SelectWithIconProps) {
62
+ super(props);
63
+
64
+ if (props.different) {
65
+ this.wordDifferent = props.t('ra___different__');
66
+ }
67
+
68
+ let list: TextWithIconItem[];
69
+ if (Array.isArray(props.list || props.options)) {
70
+ list = ((props.list || props.options) as ioBroker.Object[])
71
+ .map(obj => ({
72
+ name: Utils.getObjectNameFromObj(obj, props.lang)
73
+ .replace('system.group.', '')
74
+ .replace('system.user.', '')
75
+ .replace('enum.rooms.', '')
76
+ .replace('enum.functions.', ''),
77
+ value: obj._id,
78
+ icon: obj.common?.icon,
79
+ color: obj.common?.color,
80
+ }));
81
+ } else {
82
+ list = Object.values((props.list || props.options) as Record<string, ioBroker.Object>)
83
+ .map(obj => ({
84
+ name: Utils.getObjectNameFromObj(obj, props.lang)
85
+ .replace('system.group.', '')
86
+ .replace('system.user.', '')
87
+ .replace('enum.rooms.', '')
88
+ .replace('enum.functions.', ''),
89
+ value: obj._id,
90
+ icon: obj.common?.icon,
91
+ color: obj.common?.color,
92
+ }));
93
+ }
94
+
95
+ if (props.different && props.value === props.different) {
96
+ list.unshift({ value: props.different, name: this.wordDifferent || '' });
97
+ }
98
+
99
+ if (props.allowNone) {
100
+ list.unshift({ value: '', name: I18n.t('ra_none') });
101
+ }
102
+
103
+ this.state = {
104
+ list,
105
+ };
106
+ }
107
+
108
+ render() {
109
+ if (this.props.allowNone && !this.state.list.find(obj => obj.value === '')) {
110
+ this.timeout = this.timeout || setTimeout(() => {
111
+ this.timeout = null;
112
+ const list = JSON.parse(JSON.stringify(this.state.list));
113
+ list.unshift({ value: '', name: I18n.t('ra_none') });
114
+ this.setState({ list });
115
+ }, 100);
116
+ } else if (!this.props.allowNone && this.state.list.find(obj => obj.value === '')) {
117
+ this.timeout = this.timeout || setTimeout(() => {
118
+ this.timeout = null;
119
+ const list = JSON.parse(JSON.stringify(this.state.list));
120
+ const i = this.state.list.findIndex(obj => obj.value === '');
121
+ list.splice(i, 1);
122
+ this.setState({ list });
123
+ }, 100);
124
+ }
125
+
126
+ const item = this.state.list.find(it => it.value === this.props.value || (this.props.removePrefix && it.value.replace(this.props.removePrefix, '') === this.props.value));
127
+
128
+ const style = this.props.value === this.props.different ? {} : {
129
+ color: item?.color || undefined,
130
+ backgroundColor: Utils.getInvertedColor(item?.color || '', this.props.themeType),
131
+ };
132
+
133
+ if (this.props.dense && this.props.style) {
134
+ Object.assign(style, this.props.style);
135
+ }
136
+
137
+ const select = <Select
138
+ variant="standard"
139
+ disabled={this.props.disabled}
140
+ value={this.props.value}
141
+ inputProps={this.props.inputProps}
142
+ renderValue={(/* value */) => <span>
143
+ {item?.icon ? <Icon src={item?.icon} style={styles.icon} /> : null}
144
+ {item?.name}
145
+ </span>}
146
+ sx={{
147
+ '&.MuiSelect-root': this.props.value === this.props.different ? styles.different : {},
148
+ }}
149
+ classes={{
150
+ root: this.props.dense ? this.props.className : '',
151
+ }}
152
+ style={style}
153
+ onChange={el => {
154
+ if (this.props.different && el.target.value !== this.props.different) {
155
+ let pos = null;
156
+ for (let i = 0; i < this.state.list.length; i++) {
157
+ if (this.state.list[i].value === this.props.different) {
158
+ pos = i;
159
+ break;
160
+ }
161
+ }
162
+ if (pos !== null) {
163
+ const list: TextWithIconItem[] = Utils.clone(this.state.list) as TextWithIconItem[];
164
+ list.splice(pos, 1);
165
+ this.setState({ list }, () => this.props.onChange(el.target.value));
166
+ return;
167
+ }
168
+ }
169
+
170
+ this.props.onChange(this.props.removePrefix ? el.target.value.replace(this.props.removePrefix, '') : el.target.value);
171
+ }}
172
+ >
173
+ {this.state.list.map(el => <MenuItem
174
+ style={this.props.different && el.value === this.props.different ? styles.different : {
175
+ color: el.color || undefined,
176
+ backgroundColor: Utils.getInvertedColor(el.color || '', this.props.themeType),
177
+ }}
178
+ key={el.value}
179
+ value={el.value}
180
+ >
181
+ {el.icon ? <Icon src={el.icon} style={styles.icon} /> : null}
182
+ {el.name}
183
+ </MenuItem>)}
184
+ </Select>;
185
+
186
+ if (this.props.dense) {
187
+ return select;
188
+ }
189
+
190
+ return <FormControl variant="standard" fullWidth={!!this.props.fullWidth} style={this.props.style} className={this.props.className}>
191
+ <InputLabel>{this.props.label}</InputLabel>
192
+ {select}
193
+ </FormControl>;
194
+ }
195
+ }
196
+
197
+ export default SelectWithIcon;
@@ -0,0 +1,55 @@
1
+ import React from 'react';
2
+
3
+ import { Grid, Paper } from '@mui/material';
4
+
5
+ const styles: Record<string, React.CSSProperties> = {
6
+ root: {
7
+ width: '100%',
8
+ height: '100%',
9
+ },
10
+ overflowHidden: {
11
+ overflow: 'hidden',
12
+ },
13
+ container: {
14
+ height: '100%',
15
+ },
16
+ };
17
+
18
+ interface TabContainerProps {
19
+ /* The elevation of the tab container. */
20
+ elevation?: number;
21
+ /* Set to 'visible' show the overflow. */
22
+ overflow?: string;
23
+ styles?: {
24
+ root?: React.CSSProperties;
25
+ container?: React.CSSProperties;
26
+ };
27
+ onKeyDown?: (event: React.KeyboardEvent<HTMLDivElement>) => void;
28
+ tabIndex?: number;
29
+ /** The content of the component. */
30
+ children: React.ReactNode;
31
+ }
32
+
33
+ function TabContainer(props: TabContainerProps) {
34
+ return <Paper
35
+ elevation={!Number.isNaN(props.elevation) ? props.elevation : 1}
36
+ style={{
37
+ ...styles.root,
38
+ ...(props.styles?.root || undefined),
39
+ ...(props.overflow !== 'visible' ? styles.overflowHidden : undefined),
40
+ }}
41
+ onKeyDown={props.onKeyDown}
42
+ tabIndex={props.tabIndex}
43
+ >
44
+ <Grid
45
+ container
46
+ direction="column"
47
+ wrap="nowrap"
48
+ sx={styles.container}
49
+ >
50
+ {props.children}
51
+ </Grid>
52
+ </Paper>;
53
+ }
54
+
55
+ export default TabContainer;
@@ -0,0 +1,37 @@
1
+ // please do not delete React, as without it other projects could not be compiled: ReferenceError: React is not defined
2
+ import React from 'react';
3
+ import { Grid } from '@mui/material';
4
+
5
+ const styles: Record<string, React.CSSProperties> = {
6
+ root: {
7
+ height: '100%',
8
+ overflow: 'hidden',
9
+ },
10
+ overflowAuto: {
11
+ overflow: 'auto',
12
+ },
13
+ };
14
+
15
+ interface TabContentProps {
16
+ /** The content of the component. */
17
+ children: React.JSX.Element | (React.JSX.Element | null | React.JSX.Element[])[];
18
+ /** Overflow behavior */
19
+ overflow?: 'auto';
20
+
21
+ style?: React.CSSProperties;
22
+ }
23
+
24
+ function TabContent(props: TabContentProps) {
25
+ return <Grid
26
+ item
27
+ sx={{
28
+ ...styles.root,
29
+ ...(props?.style || undefined),
30
+ ...(props.overflow === 'auto' ? styles.overflowAuto : undefined),
31
+ }}
32
+ >
33
+ {props.children}
34
+ </Grid>;
35
+ }
36
+
37
+ export default TabContent;
@@ -0,0 +1,19 @@
1
+ import React from 'react';
2
+
3
+ import { Grid } from '@mui/material';
4
+
5
+ interface TabHeaderProps {
6
+ children: React.ReactNode;
7
+ }
8
+
9
+ function TabHeader(props: TabHeaderProps) {
10
+ return <Grid
11
+ item
12
+ container
13
+ alignItems="center"
14
+ >
15
+ {props.children}
16
+ </Grid>;
17
+ }
18
+
19
+ export default TabHeader;
@@ -0,0 +1,259 @@
1
+ /**
2
+ * Copyright 2022-2024, Denis Haev <dogafox@gmail.com>
3
+ *
4
+ * MIT License
5
+ *
6
+ * */
7
+ import React, { Component } from 'react';
8
+
9
+ import {
10
+ Table,
11
+ Skeleton,
12
+ } from '@mui/material';
13
+
14
+ interface TableResizeProps {
15
+ name?: string;
16
+ ready?: boolean;
17
+ stickyHeader?: boolean;
18
+ size?: 'small' | 'medium';
19
+ className?: string;
20
+ sx?: Record<string, any>;
21
+ style?: React.CSSProperties;
22
+ initialWidths?: (number | 'auto')[];
23
+ minWidths?: number[];
24
+ dblTitle?: string;
25
+ children?: React.ReactNode;
26
+ }
27
+
28
+ class TableResize extends Component<TableResizeProps> {
29
+ private readonly resizerRefTable: React.RefObject<HTMLTableElement>;
30
+
31
+ private resizerActiveIndex: number | null;
32
+
33
+ private resizerActiveDiv: HTMLDivElement | null;
34
+
35
+ private resizerCurrentWidths: (number | 'auto')[];
36
+
37
+ private widthFilled: boolean = false;
38
+
39
+ private installTimeout: ReturnType<typeof setTimeout> | null = null;
40
+
41
+ private resizerMin: number = 0;
42
+
43
+ private resizerMinNext: number = 0;
44
+
45
+ private resizerPosition: number = 0;
46
+
47
+ private resizerOldWidth: number = 0;
48
+
49
+ private resizerOldWidthNext: number = 0;
50
+
51
+ constructor(props: TableResizeProps) {
52
+ super(props);
53
+ this.resizerRefTable = React.createRef();
54
+ this.resizerActiveIndex = null;
55
+ this.resizerActiveDiv = null;
56
+ this.resizerCurrentWidths = [];
57
+ }
58
+
59
+ componentDidMount() {
60
+ this.resizerInstall();
61
+ }
62
+
63
+ componentWillUnmount() {
64
+ this.resizerUninstall();
65
+ }
66
+
67
+ resizerInstall() {
68
+ if (this.resizerRefTable.current && !(this.resizerRefTable.current as any)._installed) {
69
+ (this.resizerRefTable.current as any)._installed = true;
70
+ const ths = this.resizerRefTable.current.querySelectorAll('th');
71
+
72
+ const widthsStored = ((window as any)._localStorage || window.localStorage).getItem(`App.${this.props.name || 'history'}.table`);
73
+ this.widthFilled = false;
74
+
75
+ if (widthsStored) {
76
+ try {
77
+ this.resizerCurrentWidths = JSON.parse(widthsStored);
78
+ this.widthFilled = true;
79
+ } catch (e) {
80
+ // ignore
81
+ }
82
+ }
83
+ if (this.widthFilled) {
84
+ if (this.resizerCurrentWidths.length !== ths.length) {
85
+ this.resizerCurrentWidths = [];
86
+ this.widthFilled = false;
87
+ } else {
88
+ const tableWidth = this.resizerRefTable.current.offsetWidth;
89
+ let storedWidth: number | null = 0;
90
+ for (let w = 0; w < this.resizerCurrentWidths.length; w++) {
91
+ // eslint-disable-next-line no-restricted-properties
92
+ if (window.isFinite(this.resizerCurrentWidths[w] as number)) {
93
+ storedWidth += this.resizerCurrentWidths[w] as number;
94
+ } else {
95
+ storedWidth = null;
96
+ break;
97
+ }
98
+ }
99
+ if (storedWidth !== null && Math.abs(storedWidth - tableWidth) > 20) {
100
+ this.resizerCurrentWidths = [];
101
+ this.widthFilled = false;
102
+ }
103
+ }
104
+ }
105
+
106
+ for (let i = 0; i < ths.length; i++) {
107
+ !this.widthFilled && this.resizerCurrentWidths.push(ths[i].offsetWidth);
108
+
109
+ // last column does need a handle
110
+ if (i < ths.length - 1) {
111
+ const div = window.document.createElement('div');
112
+ div.dataset.index = i.toString();
113
+ div.onmousedown = this.resizerMouseDown;
114
+ div.ondblclick = this.resizerReset;
115
+ div.title = this.props.dblTitle || 'Double click to reset table layout';
116
+ div.className = 'resize-handle';
117
+ ths[i].appendChild(div);
118
+ }
119
+ }
120
+ if (this.widthFilled) {
121
+ this.resizerApplyWidths();
122
+ }
123
+ } else {
124
+ this.installTimeout = setTimeout(() => {
125
+ this.installTimeout = null;
126
+ this.resizerInstall();
127
+ }, 100);
128
+ }
129
+ }
130
+
131
+ resizerReset = () => {
132
+ for (let c = 0; c < this.resizerCurrentWidths.length; c++) {
133
+ this.resizerCurrentWidths[c] = (this.props.initialWidths || [])[c] || 'auto';
134
+ }
135
+
136
+ ((window as any)._localStorage || window.localStorage).setItem(`App.${this.props.name || 'history'}.table`, JSON.stringify(this.resizerCurrentWidths));
137
+ this.resizerApplyWidths();
138
+ };
139
+
140
+ resizerUninstall() {
141
+ this.installTimeout && clearTimeout(this.installTimeout);
142
+ this.installTimeout = null;
143
+
144
+ // resizer
145
+ if (this.resizerRefTable.current && (this.resizerRefTable.current as any)._installed) {
146
+ (this.resizerRefTable.current as any)._installed = false;
147
+ const ths = this.resizerRefTable.current.querySelectorAll('th');
148
+ for (let i = 0; i < ths.length; i++) {
149
+ const div: HTMLDivElement | null = ths[i].querySelector('.resize-handle');
150
+ if (div) {
151
+ div.onmousedown = null;
152
+ div.remove();
153
+ }
154
+ }
155
+ }
156
+ }
157
+
158
+ resizerApplyWidths() {
159
+ const gridTemplateColumns = [];
160
+ if (this.resizerCurrentWidths.length) {
161
+ for (let c = 0; c < this.resizerCurrentWidths.length; c++) {
162
+ if (this.resizerCurrentWidths[c]) {
163
+ gridTemplateColumns.push(this.resizerCurrentWidths[c] !== 'auto' ? `${this.resizerCurrentWidths[c]}px` : 'auto');
164
+ } else if (this.props.initialWidths && this.props.initialWidths[c]) {
165
+ gridTemplateColumns.push(this.props.initialWidths[c] !== 'auto' ? `${this.props.initialWidths[c]}px` : 'auto');
166
+ } else {
167
+ gridTemplateColumns.push('auto');
168
+ }
169
+ }
170
+ } else if (this.props.initialWidths) {
171
+ for (let c = 0; c < this.props.initialWidths.length; c++) {
172
+ if (this.props.initialWidths[c]) {
173
+ gridTemplateColumns.push(this.props.initialWidths[c] !== 'auto' ? `${this.props.initialWidths[c]}px` : 'auto');
174
+ } else {
175
+ gridTemplateColumns.push('auto');
176
+ }
177
+ }
178
+ }
179
+
180
+ if (this.resizerRefTable.current && gridTemplateColumns.length) {
181
+ this.resizerRefTable.current.style.gridTemplateColumns = gridTemplateColumns.join(' ');
182
+ }
183
+
184
+ return gridTemplateColumns.length ? gridTemplateColumns.join(' ') : undefined;
185
+ }
186
+
187
+ resizerMouseMove = (e: MouseEvent) => {
188
+ if (this.resizerActiveDiv && this.resizerActiveIndex !== null) {
189
+ const width = this.resizerOldWidth + e.clientX - this.resizerPosition;
190
+ const widthNext = this.resizerOldWidthNext - e.clientX + this.resizerPosition;
191
+ if ((!this.resizerMin || width > this.resizerMin) &&
192
+ (!this.resizerMinNext || widthNext > this.resizerMinNext)) {
193
+ this.resizerCurrentWidths[this.resizerActiveIndex] = width;
194
+ this.resizerCurrentWidths[this.resizerActiveIndex + 1] = widthNext;
195
+ this.resizerApplyWidths();
196
+ }
197
+ }
198
+ };
199
+
200
+ resizerMouseUp = () => {
201
+ ((window as any)._localStorage || window.localStorage).setItem(`App.${this.props.name || 'history'}.table`, JSON.stringify(this.resizerCurrentWidths));
202
+
203
+ this.resizerActiveIndex = null;
204
+ this.resizerActiveDiv = null;
205
+ window.removeEventListener('mousemove', this.resizerMouseMove);
206
+ window.removeEventListener('mouseup', this.resizerMouseUp);
207
+ };
208
+
209
+ resizerMouseDown = (e: MouseEvent) => {
210
+ if (this.resizerActiveIndex === null || this.resizerActiveIndex === undefined) {
211
+ console.log(`Mouse down ${(e.target as HTMLDivElement)?.dataset.index}`);
212
+ this.resizerActiveIndex = parseInt((e.target as HTMLDivElement)?.dataset.index || '0', 10);
213
+ this.resizerActiveDiv = e.target as HTMLDivElement;
214
+ this.resizerMin = this.props.minWidths ? this.props.minWidths[this.resizerActiveIndex] : 0;
215
+ this.resizerMinNext = this.props.minWidths ? this.props.minWidths[this.resizerActiveIndex + 1] : 0;
216
+ this.resizerPosition = e.clientX;
217
+ let ths;
218
+ if (this.resizerCurrentWidths[this.resizerActiveIndex] === 'auto') {
219
+ ths = this.resizerRefTable.current?.querySelectorAll('th');
220
+ if (ths) {
221
+ this.resizerCurrentWidths[this.resizerActiveIndex] = ths[this.resizerActiveIndex].offsetWidth;
222
+ }
223
+ }
224
+ if (this.resizerCurrentWidths[this.resizerActiveIndex + 1] === 'auto') {
225
+ ths = ths || this.resizerRefTable.current?.querySelectorAll('th');
226
+ if (ths) {
227
+ this.resizerCurrentWidths[this.resizerActiveIndex + 1] = ths[this.resizerActiveIndex + 1].offsetWidth;
228
+ }
229
+ }
230
+
231
+ this.resizerOldWidth = this.resizerCurrentWidths[this.resizerActiveIndex] as number;
232
+ this.resizerOldWidthNext = this.resizerCurrentWidths[this.resizerActiveIndex + 1] as number;
233
+
234
+ window.addEventListener('mousemove', this.resizerMouseMove);
235
+ window.addEventListener('mouseup', this.resizerMouseUp);
236
+ }
237
+ };
238
+
239
+ render() {
240
+ if (this.props.ready === false) {
241
+ return <Skeleton />;
242
+ }
243
+
244
+ const style = { gridTemplateColumns: this.resizerApplyWidths() };
245
+
246
+ return <Table
247
+ stickyHeader={this.props.stickyHeader}
248
+ size={this.props.size || 'small'}
249
+ className={this.props.className}
250
+ sx={this.props.sx}
251
+ ref={this.resizerRefTable}
252
+ style={({ ...(this.props.style || undefined), ...style })}
253
+ >
254
+ {this.props.children}
255
+ </Table>;
256
+ }
257
+ }
258
+
259
+ export default TableResize;