@iobroker/adapter-react-v5 7.2.3 → 7.2.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 (375) hide show
  1. package/README.md +3 -3
  2. package/build/AdminConnection.d.ts +1 -0
  3. package/build/AdminConnection.js +2 -0
  4. package/build/AdminConnection.js.map +1 -0
  5. package/{src/Components/404.tsx → build/Components/404.js} +14 -39
  6. package/build/Components/404.js.map +1 -0
  7. package/{Components → build/Components}/ColorPicker.d.ts +2 -2
  8. package/{Components → build/Components}/ColorPicker.js +50 -65
  9. package/build/Components/ColorPicker.js.map +1 -0
  10. package/{Components → build/Components}/ComplexCron.d.ts +2 -2
  11. package/{Components → build/Components}/ComplexCron.js +43 -71
  12. package/build/Components/ComplexCron.js.map +1 -0
  13. package/{Components → build/Components}/CopyToClipboard.d.ts +1 -2
  14. package/{src/Components/CopyToClipboard.tsx → build/Components/CopyToClipboard.js} +20 -38
  15. package/build/Components/CopyToClipboard.js.map +1 -0
  16. package/{Components → build/Components}/CustomModal.d.ts +3 -3
  17. package/build/Components/CustomModal.js +60 -0
  18. package/build/Components/CustomModal.js.map +1 -0
  19. package/{Components → build/Components}/FileBrowser.d.ts +21 -21
  20. package/{Components → build/Components}/FileBrowser.js +253 -248
  21. package/build/Components/FileBrowser.js.map +1 -0
  22. package/build/Components/FileViewer.d.ts +48 -0
  23. package/build/Components/FileViewer.js +277 -0
  24. package/build/Components/FileViewer.js.map +1 -0
  25. package/{Components → build/Components}/Icon.d.ts +1 -1
  26. package/build/Components/Icon.js +140 -0
  27. package/build/Components/Icon.js.map +1 -0
  28. package/{Components → build/Components}/IconPicker.d.ts +2 -2
  29. package/build/Components/IconPicker.js +73 -0
  30. package/build/Components/IconPicker.js.map +1 -0
  31. package/{Components → build/Components}/IconSelector.d.ts +3 -3
  32. package/{Components → build/Components}/IconSelector.js +29 -57
  33. package/build/Components/IconSelector.js.map +1 -0
  34. package/{Components → build/Components}/Image.d.ts +2 -2
  35. package/{Components → build/Components}/Image.js +16 -22
  36. package/build/Components/Image.js.map +1 -0
  37. package/{Components → build/Components}/Loader.d.ts +2 -2
  38. package/{Components → build/Components}/Loader.js +15 -40
  39. package/build/Components/Loader.js.map +1 -0
  40. package/{Components → build/Components}/Loaders/MV.d.ts +2 -2
  41. package/build/Components/Loaders/MV.js +61 -0
  42. package/build/Components/Loaders/MV.js.map +1 -0
  43. package/{Components → build/Components}/Loaders/PT.d.ts +2 -2
  44. package/{Components → build/Components}/Loaders/PT.js +10 -35
  45. package/build/Components/Loaders/PT.js.map +1 -0
  46. package/{Components → build/Components}/Loaders/Vendor.d.ts +2 -2
  47. package/build/Components/Loaders/Vendor.js +52 -0
  48. package/build/Components/Loaders/Vendor.js.map +1 -0
  49. package/{Components → build/Components}/Logo.d.ts +2 -2
  50. package/build/Components/Logo.js +108 -0
  51. package/build/Components/Logo.js.map +1 -0
  52. package/{Components → build/Components}/MDUtils.d.ts +1 -2
  53. package/{Components → build/Components}/MDUtils.js +4 -9
  54. package/build/Components/MDUtils.js.map +1 -0
  55. package/{Components → build/Components}/ObjectBrowser.d.ts +7 -4
  56. package/{Components → build/Components}/ObjectBrowser.js +1183 -1133
  57. package/build/Components/ObjectBrowser.js.map +1 -0
  58. package/{Components → build/Components}/Router.d.ts +1 -2
  59. package/{Components → build/Components}/Router.js +6 -7
  60. package/build/Components/Router.js.map +1 -0
  61. package/{Components → build/Components}/SaveCloseButtons.d.ts +2 -2
  62. package/build/Components/SaveCloseButtons.js +65 -0
  63. package/build/Components/SaveCloseButtons.js.map +1 -0
  64. package/{Components → build/Components}/Schedule.d.ts +3 -3
  65. package/{Components → build/Components}/Schedule.js +246 -261
  66. package/build/Components/Schedule.js.map +1 -0
  67. package/{Components → build/Components}/SelectWithIcon.d.ts +2 -2
  68. package/build/Components/SelectWithIcon.js +135 -0
  69. package/build/Components/SelectWithIcon.js.map +1 -0
  70. package/build/Components/SimpleCron/cronText.js +15 -0
  71. package/build/Components/SimpleCron/cronText.js.map +1 -0
  72. package/{Components → build/Components}/SimpleCron/index.d.ts +2 -2
  73. package/{Components → build/Components}/SimpleCron/index.js +55 -56
  74. package/build/Components/SimpleCron/index.js.map +1 -0
  75. package/{Components → build/Components}/TabContainer.d.ts +2 -2
  76. package/build/Components/TabContainer.js +23 -0
  77. package/build/Components/TabContainer.js.map +1 -0
  78. package/{Components → build/Components}/TabContent.d.ts +3 -2
  79. package/build/Components/TabContent.js +20 -0
  80. package/build/Components/TabContent.js.map +1 -0
  81. package/build/Components/TabHeader.d.ts +6 -0
  82. package/build/Components/TabHeader.js +6 -0
  83. package/build/Components/TabHeader.js.map +1 -0
  84. package/{Components → build/Components}/TableResize.d.ts +2 -2
  85. package/{src/Components/TableResize.tsx → build/Components/TableResize.js} +64 -134
  86. package/build/Components/TableResize.js.map +1 -0
  87. package/{Components → build/Components}/TextWithIcon.d.ts +2 -2
  88. package/{src/Components/TextWithIcon.tsx → build/Components/TextWithIcon.js} +30 -75
  89. package/build/Components/TextWithIcon.js.map +1 -0
  90. package/{Components → build/Components}/ToggleThemeMenu.d.ts +1 -1
  91. package/build/Components/ToggleThemeMenu.js +13 -0
  92. package/build/Components/ToggleThemeMenu.js.map +1 -0
  93. package/{Components → build/Components}/TreeTable.d.ts +3 -3
  94. package/{Components → build/Components}/TreeTable.js +87 -99
  95. package/build/Components/TreeTable.js.map +1 -0
  96. package/{Components → build/Components}/UploadImage.d.ts +2 -2
  97. package/{Components → build/Components}/UploadImage.js +46 -69
  98. package/build/Components/UploadImage.js.map +1 -0
  99. package/{Components → build/Components}/Utils.d.ts +2 -2
  100. package/{Components → build/Components}/Utils.js +47 -60
  101. package/build/Components/Utils.js.map +1 -0
  102. package/build/Components/withWidth.d.ts +2 -0
  103. package/build/Components/withWidth.js +22 -0
  104. package/build/Components/withWidth.js.map +1 -0
  105. package/build/Connection.d.ts +1 -0
  106. package/build/Connection.js +2 -0
  107. package/build/Connection.js.map +1 -0
  108. package/{Dialogs → build/Dialogs}/ComplexCron.d.ts +2 -2
  109. package/build/Dialogs/ComplexCron.js +85 -0
  110. package/build/Dialogs/ComplexCron.js.map +1 -0
  111. package/{Dialogs → build/Dialogs}/Confirm.d.ts +2 -2
  112. package/build/Dialogs/Confirm.js +83 -0
  113. package/build/Dialogs/Confirm.js.map +1 -0
  114. package/{Dialogs → build/Dialogs}/Cron.d.ts +2 -2
  115. package/build/Dialogs/Cron.js +72 -0
  116. package/build/Dialogs/Cron.js.map +1 -0
  117. package/{Dialogs → build/Dialogs}/Error.d.ts +2 -2
  118. package/build/Dialogs/Error.js +27 -0
  119. package/build/Dialogs/Error.js.map +1 -0
  120. package/{Dialogs → build/Dialogs}/Message.d.ts +2 -2
  121. package/build/Dialogs/Message.js +29 -0
  122. package/build/Dialogs/Message.js.map +1 -0
  123. package/{Dialogs → build/Dialogs}/SelectFile.d.ts +2 -2
  124. package/build/Dialogs/SelectFile.js +116 -0
  125. package/build/Dialogs/SelectFile.js.map +1 -0
  126. package/{Dialogs → build/Dialogs}/SelectID.d.ts +3 -3
  127. package/{Dialogs → build/Dialogs}/SelectID.js +28 -53
  128. package/build/Dialogs/SelectID.js.map +1 -0
  129. package/{Dialogs → build/Dialogs}/SimpleCron.d.ts +2 -2
  130. package/build/Dialogs/SimpleCron.js +46 -0
  131. package/build/Dialogs/SimpleCron.js.map +1 -0
  132. package/build/Dialogs/TextInput.d.ts +2 -0
  133. package/build/Dialogs/TextInput.js +31 -0
  134. package/build/Dialogs/TextInput.js.map +1 -0
  135. package/{GenericApp.d.ts → build/GenericApp.d.ts} +2 -3
  136. package/{GenericApp.js → build/GenericApp.js} +162 -176
  137. package/build/GenericApp.js.map +1 -0
  138. package/{LegacyConnection.d.ts → build/LegacyConnection.d.ts} +69 -4
  139. package/{LegacyConnection.js → build/LegacyConnection.js} +106 -99
  140. package/build/LegacyConnection.js.map +1 -0
  141. package/{Prompt.d.ts → build/Prompt.d.ts} +1 -1
  142. package/{Prompt.js → build/Prompt.js} +3 -4
  143. package/build/Prompt.js.map +1 -0
  144. package/build/Theme.d.ts +5 -0
  145. package/{Theme.js → build/Theme.js} +37 -32
  146. package/build/Theme.js.map +1 -0
  147. package/build/assets/devices/parseNames.d.ts +0 -0
  148. package/build/assets/devices/parseNames.js +35 -0
  149. package/build/assets/devices/parseNames.js.map +1 -0
  150. package/build/assets/rooms/parseNames.d.ts +0 -0
  151. package/build/assets/rooms/parseNames.js +35 -0
  152. package/build/assets/rooms/parseNames.js.map +1 -0
  153. package/build/dictionary.d.ts +1 -0
  154. package/build/dictionary.js +25 -0
  155. package/build/dictionary.js.map +1 -0
  156. package/build/i18n/de.json +449 -0
  157. package/build/i18n/en.json +449 -0
  158. package/build/i18n/es.json +449 -0
  159. package/build/i18n/fr.json +449 -0
  160. package/build/i18n/it.json +449 -0
  161. package/build/i18n/nl.json +449 -0
  162. package/build/i18n/pl.json +449 -0
  163. package/build/i18n/pt.json +449 -0
  164. package/build/i18n/ru.json +449 -0
  165. package/build/i18n/uk.json +449 -0
  166. package/build/i18n/zh-cn.json +449 -0
  167. package/{i18n.d.ts → build/i18n.d.ts} +2 -2
  168. package/{i18n.js → build/i18n.js} +9 -11
  169. package/build/i18n.js.map +1 -0
  170. package/build/icons/IconAdapter.d.ts +3 -0
  171. package/build/icons/IconAdapter.js +6 -0
  172. package/build/icons/IconAdapter.js.map +1 -0
  173. package/build/icons/IconAlias.d.ts +3 -0
  174. package/build/icons/IconAlias.js +6 -0
  175. package/build/icons/IconAlias.js.map +1 -0
  176. package/build/icons/IconChannel.d.ts +3 -0
  177. package/build/icons/IconChannel.js +9 -0
  178. package/build/icons/IconChannel.js.map +1 -0
  179. package/build/icons/IconClearFilter.d.ts +3 -0
  180. package/build/icons/IconClearFilter.js +7 -0
  181. package/build/icons/IconClearFilter.js.map +1 -0
  182. package/build/icons/IconClosed.d.ts +3 -0
  183. package/build/icons/IconClosed.js +6 -0
  184. package/build/icons/IconClosed.js.map +1 -0
  185. package/build/icons/IconCopy.d.ts +3 -0
  186. package/build/icons/IconCopy.js +5 -0
  187. package/build/icons/IconCopy.js.map +1 -0
  188. package/build/icons/IconDevice.d.ts +3 -0
  189. package/build/icons/IconDevice.js +15 -0
  190. package/build/icons/IconDevice.js.map +1 -0
  191. package/build/icons/IconDocument.d.ts +3 -0
  192. package/build/icons/IconDocument.js +6 -0
  193. package/build/icons/IconDocument.js.map +1 -0
  194. package/build/icons/IconDocumentReadOnly.d.ts +3 -0
  195. package/build/icons/IconDocumentReadOnly.js +7 -0
  196. package/build/icons/IconDocumentReadOnly.js.map +1 -0
  197. package/build/icons/IconExpert.d.ts +3 -0
  198. package/build/icons/IconExpert.js +6 -0
  199. package/build/icons/IconExpert.js.map +1 -0
  200. package/build/icons/IconFx.d.ts +3 -0
  201. package/build/icons/IconFx.js +5 -0
  202. package/build/icons/IconFx.js.map +1 -0
  203. package/build/icons/IconInstance.d.ts +3 -0
  204. package/build/icons/IconInstance.js +6 -0
  205. package/build/icons/IconInstance.js.map +1 -0
  206. package/build/icons/IconLogout.d.ts +3 -0
  207. package/build/icons/IconLogout.js +6 -0
  208. package/build/icons/IconLogout.js.map +1 -0
  209. package/build/icons/IconNoIcon.d.ts +3 -0
  210. package/build/icons/IconNoIcon.js +5 -0
  211. package/build/icons/IconNoIcon.js.map +1 -0
  212. package/build/icons/IconOpen.d.ts +3 -0
  213. package/build/icons/IconOpen.js +6 -0
  214. package/build/icons/IconOpen.js.map +1 -0
  215. package/{icons → build/icons}/IconProps.d.ts +1 -1
  216. package/build/icons/IconProps.js +2 -0
  217. package/build/icons/IconProps.js.map +1 -0
  218. package/build/icons/IconState.d.ts +3 -0
  219. package/build/icons/IconState.js +6 -0
  220. package/build/icons/IconState.js.map +1 -0
  221. package/build/index.d.ts +67 -0
  222. package/build/index.js +67 -0
  223. package/build/index.js.map +1 -0
  224. package/{types.d.ts → build/types.d.ts} +1 -1
  225. package/package.json +84 -47
  226. package/AdminConnection.d.ts +0 -2
  227. package/AdminConnection.js +0 -4
  228. package/Components/404.js +0 -101
  229. package/Components/CopyToClipboard.js +0 -163
  230. package/Components/CustomModal.js +0 -88
  231. package/Components/FileViewer.d.ts +0 -10
  232. package/Components/FileViewer.js +0 -305
  233. package/Components/Icon.js +0 -148
  234. package/Components/IconPicker.js +0 -98
  235. package/Components/Loaders/MV.js +0 -66
  236. package/Components/Loaders/Vendor.js +0 -77
  237. package/Components/Logo.js +0 -117
  238. package/Components/SaveCloseButtons.js +0 -69
  239. package/Components/SelectWithIcon.js +0 -168
  240. package/Components/SimpleCron/cronText.js +0 -19
  241. package/Components/TabContainer.js +0 -25
  242. package/Components/TabContent.js +0 -21
  243. package/Components/TabHeader.d.ts +0 -6
  244. package/Components/TabHeader.js +0 -11
  245. package/Components/TableResize.js +0 -226
  246. package/Components/TextWithIcon.js +0 -119
  247. package/Components/ToggleThemeMenu.js +0 -18
  248. package/Components/withWidth.d.ts +0 -3
  249. package/Components/withWidth.js +0 -27
  250. package/Connection.d.ts +0 -3
  251. package/Connection.js +0 -8
  252. package/Dialogs/ComplexCron.js +0 -90
  253. package/Dialogs/Confirm.js +0 -111
  254. package/Dialogs/Cron.js +0 -100
  255. package/Dialogs/Error.js +0 -55
  256. package/Dialogs/Message.js +0 -57
  257. package/Dialogs/SelectFile.js +0 -119
  258. package/Dialogs/SimpleCron.js +0 -51
  259. package/Dialogs/TextInput.d.ts +0 -3
  260. package/Dialogs/TextInput.js +0 -35
  261. package/Theme.d.ts +0 -6
  262. package/i18n/de.json +0 -449
  263. package/i18n/en.json +0 -449
  264. package/i18n/es.json +0 -449
  265. package/i18n/fr.json +0 -449
  266. package/i18n/it.json +0 -449
  267. package/i18n/nl.json +0 -449
  268. package/i18n/pl.json +0 -449
  269. package/i18n/pt.json +0 -449
  270. package/i18n/ru.json +0 -449
  271. package/i18n/uk.json +0 -449
  272. package/i18n/zh-cn.json +0 -449
  273. package/icons/IconAdapter.d.ts +0 -4
  274. package/icons/IconAdapter.js +0 -10
  275. package/icons/IconAlias.d.ts +0 -4
  276. package/icons/IconAlias.js +0 -10
  277. package/icons/IconChannel.d.ts +0 -4
  278. package/icons/IconChannel.js +0 -13
  279. package/icons/IconClearFilter.d.ts +0 -4
  280. package/icons/IconClearFilter.js +0 -11
  281. package/icons/IconClosed.d.ts +0 -4
  282. package/icons/IconClosed.js +0 -10
  283. package/icons/IconCopy.d.ts +0 -4
  284. package/icons/IconCopy.js +0 -9
  285. package/icons/IconDevice.d.ts +0 -4
  286. package/icons/IconDevice.js +0 -19
  287. package/icons/IconDocument.d.ts +0 -4
  288. package/icons/IconDocument.js +0 -10
  289. package/icons/IconDocumentReadOnly.d.ts +0 -4
  290. package/icons/IconDocumentReadOnly.js +0 -11
  291. package/icons/IconExpert.d.ts +0 -4
  292. package/icons/IconExpert.js +0 -10
  293. package/icons/IconFx.d.ts +0 -4
  294. package/icons/IconFx.js +0 -9
  295. package/icons/IconInstance.d.ts +0 -4
  296. package/icons/IconInstance.js +0 -10
  297. package/icons/IconLogout.d.ts +0 -4
  298. package/icons/IconLogout.js +0 -10
  299. package/icons/IconNoIcon.d.ts +0 -4
  300. package/icons/IconNoIcon.js +0 -9
  301. package/icons/IconOpen.d.ts +0 -4
  302. package/icons/IconOpen.js +0 -10
  303. package/icons/IconProps.js +0 -2
  304. package/icons/IconState.d.ts +0 -4
  305. package/icons/IconState.js +0 -10
  306. package/index.d.ts +0 -128
  307. package/index.js +0 -215
  308. package/src/AdminConnection.tsx +0 -3
  309. package/src/Components/ColorPicker.tsx +0 -343
  310. package/src/Components/ComplexCron.tsx +0 -561
  311. package/src/Components/CustomModal.tsx +0 -170
  312. package/src/Components/FileBrowser.tsx +0 -2550
  313. package/src/Components/FileViewer.tsx +0 -412
  314. package/src/Components/Icon.tsx +0 -238
  315. package/src/Components/IconPicker.tsx +0 -165
  316. package/src/Components/IconSelector.tsx +0 -2220
  317. package/src/Components/Image.tsx +0 -193
  318. package/src/Components/Loader.tsx +0 -328
  319. package/src/Components/Logo.tsx +0 -176
  320. package/src/Components/MDUtils.tsx +0 -104
  321. package/src/Components/ObjectBrowser.tsx +0 -8935
  322. package/src/Components/Router.tsx +0 -90
  323. package/src/Components/SaveCloseButtons.tsx +0 -117
  324. package/src/Components/Schedule.tsx +0 -1995
  325. package/src/Components/SelectWithIcon.tsx +0 -239
  326. package/src/Components/TabContainer.tsx +0 -57
  327. package/src/Components/TabContent.tsx +0 -38
  328. package/src/Components/TabHeader.tsx +0 -20
  329. package/src/Components/ToggleThemeMenu.tsx +0 -52
  330. package/src/Components/TreeTable.tsx +0 -1002
  331. package/src/Components/UploadImage.tsx +0 -643
  332. package/src/Components/Utils.tsx +0 -1802
  333. package/src/Components/loader.css +0 -231
  334. package/src/Components/withWidth.tsx +0 -32
  335. package/src/Connection.tsx +0 -5
  336. package/src/Dialogs/ComplexCron.tsx +0 -163
  337. package/src/Dialogs/Confirm.tsx +0 -185
  338. package/src/Dialogs/Cron.tsx +0 -192
  339. package/src/Dialogs/Error.tsx +0 -67
  340. package/src/Dialogs/Message.tsx +0 -73
  341. package/src/Dialogs/SelectFile.tsx +0 -280
  342. package/src/Dialogs/SelectID.tsx +0 -310
  343. package/src/Dialogs/SimpleCron.tsx +0 -101
  344. package/src/Dialogs/TextInput.tsx +0 -99
  345. package/src/GenericApp.tsx +0 -1076
  346. package/src/LegacyConnection.tsx +0 -3720
  347. package/src/Prompt.tsx +0 -22
  348. package/src/Theme.tsx +0 -472
  349. package/src/icons/IconAdapter.tsx +0 -22
  350. package/src/icons/IconAlias.tsx +0 -22
  351. package/src/icons/IconChannel.tsx +0 -60
  352. package/src/icons/IconClearFilter.tsx +0 -24
  353. package/src/icons/IconClosed.tsx +0 -22
  354. package/src/icons/IconCopy.tsx +0 -21
  355. package/src/icons/IconDevice.tsx +0 -126
  356. package/src/icons/IconDocument.tsx +0 -22
  357. package/src/icons/IconDocumentReadOnly.tsx +0 -27
  358. package/src/icons/IconExpert.tsx +0 -26
  359. package/src/icons/IconFx.tsx +0 -38
  360. package/src/icons/IconInstance.tsx +0 -22
  361. package/src/icons/IconLogout.tsx +0 -32
  362. package/src/icons/IconNoIcon.tsx +0 -21
  363. package/src/icons/IconOpen.tsx +0 -22
  364. package/src/icons/IconProps.tsx +0 -16
  365. package/src/icons/IconState.tsx +0 -38
  366. package/src/index.css +0 -56
  367. /package/{Components → build/Components}/404.d.ts +0 -0
  368. /package/{Components → build/Components}/SimpleCron/cronText.d.ts +0 -0
  369. /package/{assets → build/assets}/devices.json +0 -0
  370. /package/{assets → build/assets}/lamp_ceiling.svg +0 -0
  371. /package/{assets → build/assets}/lamp_table.svg +0 -0
  372. /package/{assets → build/assets}/no_icon.svg +0 -0
  373. /package/{assets → build/assets}/rooms.json +0 -0
  374. /package/{index.css → build/index.css} +0 -0
  375. /package/{tasks.js → tasksExample.js} +0 -0
@@ -5,77 +5,44 @@
5
5
  *
6
6
  */
7
7
  import React, { Component } from 'react';
8
-
9
8
  import { Table, Skeleton } from '@mui/material';
10
-
11
- interface TableResizeProps {
12
- name?: string;
13
- ready?: boolean;
14
- stickyHeader?: boolean;
15
- size?: 'small' | 'medium';
16
- className?: string;
17
- sx?: Record<string, any>;
18
- style?: React.CSSProperties;
19
- initialWidths?: (number | 'auto')[];
20
- minWidths?: number[];
21
- dblTitle?: string;
22
- children?: React.ReactNode;
23
- }
24
-
25
- class TableResize extends Component<TableResizeProps> {
26
- private readonly resizerRefTable: React.RefObject<HTMLTableElement>;
27
-
28
- private resizerActiveIndex: number | null;
29
-
30
- private resizerActiveDiv: HTMLDivElement | null;
31
-
32
- private resizerCurrentWidths: (number | 'auto')[];
33
-
34
- private widthFilled: boolean = false;
35
-
36
- private installTimeout: ReturnType<typeof setTimeout> | null = null;
37
-
38
- private resizerMin: number = 0;
39
-
40
- private resizerMinNext: number = 0;
41
-
42
- private resizerPosition: number = 0;
43
-
44
- private resizerOldWidth: number = 0;
45
-
46
- private resizerOldWidthNext: number = 0;
47
-
48
- constructor(props: TableResizeProps) {
9
+ export class TableResize extends Component {
10
+ resizerRefTable;
11
+ resizerActiveIndex;
12
+ resizerActiveDiv;
13
+ resizerCurrentWidths;
14
+ widthFilled = false;
15
+ installTimeout = null;
16
+ resizerMin = 0;
17
+ resizerMinNext = 0;
18
+ resizerPosition = 0;
19
+ resizerOldWidth = 0;
20
+ resizerOldWidthNext = 0;
21
+ constructor(props) {
49
22
  super(props);
50
23
  this.resizerRefTable = React.createRef();
51
24
  this.resizerActiveIndex = null;
52
25
  this.resizerActiveDiv = null;
53
26
  this.resizerCurrentWidths = [];
54
27
  }
55
-
56
- componentDidMount(): void {
28
+ componentDidMount() {
57
29
  this.resizerInstall();
58
30
  }
59
-
60
- componentWillUnmount(): void {
31
+ componentWillUnmount() {
61
32
  this.resizerUninstall();
62
33
  }
63
-
64
- resizerInstall(): void {
65
- if (this.resizerRefTable.current && !(this.resizerRefTable.current as any)._installed) {
66
- (this.resizerRefTable.current as any)._installed = true;
34
+ resizerInstall() {
35
+ if (this.resizerRefTable.current && !this.resizerRefTable.current._installed) {
36
+ this.resizerRefTable.current._installed = true;
67
37
  const ths = this.resizerRefTable.current.querySelectorAll('th');
68
-
69
- const widthsStored = ((window as any)._localStorage || window.localStorage).getItem(
70
- `App.${this.props.name || 'history'}.table`,
71
- );
38
+ const widthsStored = (window._localStorage || window.localStorage).getItem(`App.${this.props.name || 'history'}.table`);
72
39
  this.widthFilled = false;
73
-
74
40
  if (widthsStored) {
75
41
  try {
76
42
  this.resizerCurrentWidths = JSON.parse(widthsStored);
77
43
  this.widthFilled = true;
78
- } catch {
44
+ }
45
+ catch {
79
46
  // ignore
80
47
  }
81
48
  }
@@ -83,13 +50,15 @@ class TableResize extends Component<TableResizeProps> {
83
50
  if (this.resizerCurrentWidths.length !== ths.length) {
84
51
  this.resizerCurrentWidths = [];
85
52
  this.widthFilled = false;
86
- } else {
53
+ }
54
+ else {
87
55
  const tableWidth = this.resizerRefTable.current.offsetWidth;
88
- let storedWidth: number | null = 0;
56
+ let storedWidth = 0;
89
57
  for (let w = 0; w < this.resizerCurrentWidths.length; w++) {
90
- if (window.isFinite(this.resizerCurrentWidths[w] as number)) {
91
- storedWidth += this.resizerCurrentWidths[w] as number;
92
- } else {
58
+ if (window.isFinite(this.resizerCurrentWidths[w])) {
59
+ storedWidth += this.resizerCurrentWidths[w];
60
+ }
61
+ else {
93
62
  storedWidth = null;
94
63
  break;
95
64
  }
@@ -100,10 +69,8 @@ class TableResize extends Component<TableResizeProps> {
100
69
  }
101
70
  }
102
71
  }
103
-
104
72
  for (let i = 0; i < ths.length; i++) {
105
73
  !this.widthFilled && this.resizerCurrentWidths.push(ths[i].offsetWidth);
106
-
107
74
  // last column does need a handle
108
75
  if (i < ths.length - 1) {
109
76
  const div = window.document.createElement('div');
@@ -118,36 +85,30 @@ class TableResize extends Component<TableResizeProps> {
118
85
  if (this.widthFilled) {
119
86
  this.resizerApplyWidths();
120
87
  }
121
- } else {
88
+ }
89
+ else {
122
90
  this.installTimeout = setTimeout(() => {
123
91
  this.installTimeout = null;
124
92
  this.resizerInstall();
125
93
  }, 100);
126
94
  }
127
95
  }
128
-
129
- resizerReset = (): void => {
96
+ resizerReset = () => {
130
97
  for (let c = 0; c < this.resizerCurrentWidths.length; c++) {
131
98
  this.resizerCurrentWidths[c] = (this.props.initialWidths || [])[c] || 'auto';
132
99
  }
133
-
134
- ((window as any)._localStorage || window.localStorage).setItem(
135
- `App.${this.props.name || 'history'}.table`,
136
- JSON.stringify(this.resizerCurrentWidths),
137
- );
100
+ (window._localStorage || window.localStorage).setItem(`App.${this.props.name || 'history'}.table`, JSON.stringify(this.resizerCurrentWidths));
138
101
  this.resizerApplyWidths();
139
102
  };
140
-
141
- resizerUninstall(): void {
103
+ resizerUninstall() {
142
104
  this.installTimeout && clearTimeout(this.installTimeout);
143
105
  this.installTimeout = null;
144
-
145
106
  // resizer
146
- if (this.resizerRefTable.current && (this.resizerRefTable.current as any)._installed) {
147
- (this.resizerRefTable.current as any)._installed = false;
107
+ if (this.resizerRefTable.current && this.resizerRefTable.current._installed) {
108
+ this.resizerRefTable.current._installed = false;
148
109
  const ths = this.resizerRefTable.current.querySelectorAll('th');
149
110
  for (let i = 0; i < ths.length; i++) {
150
- const div: HTMLDivElement | null = ths[i].querySelector('.resize-handle');
111
+ const div = ths[i].querySelector('.resize-handle');
151
112
  if (div) {
152
113
  div.onmousedown = null;
153
114
  div.remove();
@@ -155,74 +116,60 @@ class TableResize extends Component<TableResizeProps> {
155
116
  }
156
117
  }
157
118
  }
158
-
159
- resizerApplyWidths(): string | undefined {
160
- const gridTemplateColumns: string[] = [];
119
+ resizerApplyWidths() {
120
+ const gridTemplateColumns = [];
161
121
  if (this.resizerCurrentWidths.length) {
162
122
  for (let c = 0; c < this.resizerCurrentWidths.length; c++) {
163
123
  if (this.resizerCurrentWidths[c]) {
164
- gridTemplateColumns.push(
165
- this.resizerCurrentWidths[c] !== 'auto' ? `${this.resizerCurrentWidths[c]}px` : 'auto',
166
- );
167
- } else if (this.props.initialWidths && this.props.initialWidths[c]) {
168
- gridTemplateColumns.push(
169
- this.props.initialWidths[c] !== 'auto' ? `${this.props.initialWidths[c]}px` : 'auto',
170
- );
171
- } else {
124
+ gridTemplateColumns.push(this.resizerCurrentWidths[c] !== 'auto' ? `${this.resizerCurrentWidths[c]}px` : 'auto');
125
+ }
126
+ else if (this.props.initialWidths && this.props.initialWidths[c]) {
127
+ gridTemplateColumns.push(this.props.initialWidths[c] !== 'auto' ? `${this.props.initialWidths[c]}px` : 'auto');
128
+ }
129
+ else {
172
130
  gridTemplateColumns.push('auto');
173
131
  }
174
132
  }
175
- } else if (this.props.initialWidths) {
133
+ }
134
+ else if (this.props.initialWidths) {
176
135
  for (let c = 0; c < this.props.initialWidths.length; c++) {
177
136
  if (this.props.initialWidths[c]) {
178
- gridTemplateColumns.push(
179
- this.props.initialWidths[c] !== 'auto' ? `${this.props.initialWidths[c]}px` : 'auto',
180
- );
181
- } else {
137
+ gridTemplateColumns.push(this.props.initialWidths[c] !== 'auto' ? `${this.props.initialWidths[c]}px` : 'auto');
138
+ }
139
+ else {
182
140
  gridTemplateColumns.push('auto');
183
141
  }
184
142
  }
185
143
  }
186
-
187
144
  if (this.resizerRefTable.current && gridTemplateColumns.length) {
188
145
  this.resizerRefTable.current.style.gridTemplateColumns = gridTemplateColumns.join(' ');
189
146
  }
190
-
191
147
  return gridTemplateColumns.length ? gridTemplateColumns.join(' ') : undefined;
192
148
  }
193
-
194
- resizerMouseMove = (e: MouseEvent): void => {
149
+ resizerMouseMove = (e) => {
195
150
  if (this.resizerActiveDiv && this.resizerActiveIndex !== null) {
196
151
  const width = this.resizerOldWidth + e.clientX - this.resizerPosition;
197
152
  const widthNext = this.resizerOldWidthNext - e.clientX + this.resizerPosition;
198
- if (
199
- (!this.resizerMin || width > this.resizerMin) &&
200
- (!this.resizerMinNext || widthNext > this.resizerMinNext)
201
- ) {
153
+ if ((!this.resizerMin || width > this.resizerMin) &&
154
+ (!this.resizerMinNext || widthNext > this.resizerMinNext)) {
202
155
  this.resizerCurrentWidths[this.resizerActiveIndex] = width;
203
156
  this.resizerCurrentWidths[this.resizerActiveIndex + 1] = widthNext;
204
157
  this.resizerApplyWidths();
205
158
  }
206
159
  }
207
160
  };
208
-
209
- resizerMouseUp = (): void => {
210
- ((window as any)._localStorage || window.localStorage).setItem(
211
- `App.${this.props.name || 'history'}.table`,
212
- JSON.stringify(this.resizerCurrentWidths),
213
- );
214
-
161
+ resizerMouseUp = () => {
162
+ (window._localStorage || window.localStorage).setItem(`App.${this.props.name || 'history'}.table`, JSON.stringify(this.resizerCurrentWidths));
215
163
  this.resizerActiveIndex = null;
216
164
  this.resizerActiveDiv = null;
217
165
  window.removeEventListener('mousemove', this.resizerMouseMove);
218
166
  window.removeEventListener('mouseup', this.resizerMouseUp);
219
167
  };
220
-
221
- resizerMouseDown = (e: MouseEvent): void => {
168
+ resizerMouseDown = (e) => {
222
169
  if (this.resizerActiveIndex === null || this.resizerActiveIndex === undefined) {
223
- console.log(`Mouse down ${(e.target as HTMLDivElement)?.dataset.index}`);
224
- this.resizerActiveIndex = parseInt((e.target as HTMLDivElement)?.dataset.index || '0', 10);
225
- this.resizerActiveDiv = e.target as HTMLDivElement;
170
+ console.log(`Mouse down ${e.target?.dataset.index}`);
171
+ this.resizerActiveIndex = parseInt(e.target?.dataset.index || '0', 10);
172
+ this.resizerActiveDiv = e.target;
226
173
  this.resizerMin = this.props.minWidths ? this.props.minWidths[this.resizerActiveIndex] : 0;
227
174
  this.resizerMinNext = this.props.minWidths ? this.props.minWidths[this.resizerActiveIndex + 1] : 0;
228
175
  this.resizerPosition = e.clientX;
@@ -240,35 +187,18 @@ class TableResize extends Component<TableResizeProps> {
240
187
  ths[this.resizerActiveIndex + 1].offsetWidth;
241
188
  }
242
189
  }
243
-
244
- this.resizerOldWidth = this.resizerCurrentWidths[this.resizerActiveIndex] as number;
245
- this.resizerOldWidthNext = this.resizerCurrentWidths[this.resizerActiveIndex + 1] as number;
246
-
190
+ this.resizerOldWidth = this.resizerCurrentWidths[this.resizerActiveIndex];
191
+ this.resizerOldWidthNext = this.resizerCurrentWidths[this.resizerActiveIndex + 1];
247
192
  window.addEventListener('mousemove', this.resizerMouseMove);
248
193
  window.addEventListener('mouseup', this.resizerMouseUp);
249
194
  }
250
195
  };
251
-
252
- render(): React.JSX.Element {
196
+ render() {
253
197
  if (this.props.ready === false) {
254
- return <Skeleton />;
198
+ return React.createElement(Skeleton, null);
255
199
  }
256
-
257
200
  const style = { gridTemplateColumns: this.resizerApplyWidths() };
258
-
259
- return (
260
- <Table
261
- stickyHeader={this.props.stickyHeader}
262
- size={this.props.size || 'small'}
263
- className={this.props.className}
264
- sx={this.props.sx}
265
- ref={this.resizerRefTable}
266
- style={{ ...(this.props.style || undefined), ...style }}
267
- >
268
- {this.props.children}
269
- </Table>
270
- );
201
+ return (React.createElement(Table, { stickyHeader: this.props.stickyHeader, size: this.props.size || 'small', className: this.props.className, sx: this.props.sx, ref: this.resizerRefTable, style: { ...(this.props.style || undefined), ...style } }, this.props.children));
271
202
  }
272
203
  }
273
-
274
- export default TableResize;
204
+ //# sourceMappingURL=TableResize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableResize.js","sourceRoot":"./src/","sources":["Components/TableResize.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEzC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAgBhD,MAAM,OAAO,WAAY,SAAQ,SAA2B;IACvC,eAAe,CAAoC;IAE5D,kBAAkB,CAAgB;IAElC,gBAAgB,CAAwB;IAExC,oBAAoB,CAAsB;IAE1C,WAAW,GAAY,KAAK,CAAC;IAE7B,cAAc,GAAyC,IAAI,CAAC;IAE5D,UAAU,GAAW,CAAC,CAAC;IAEvB,cAAc,GAAW,CAAC,CAAC;IAE3B,eAAe,GAAW,CAAC,CAAC;IAE5B,eAAe,GAAW,CAAC,CAAC;IAE5B,mBAAmB,GAAW,CAAC,CAAC;IAExC,YAAY,KAAuB;QAC/B,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,SAAS,EAAE,CAAC;QACzC,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC;QAC/B,IAAI,CAAC,gBAAgB,GAAG,IAAI,CAAC;QAC7B,IAAI,CAAC,oBAAoB,GAAG,EAAE,CAAC;IACnC,CAAC;IAED,iBAAiB;QACb,IAAI,CAAC,cAAc,EAAE,CAAC;IAC1B,CAAC;IAED,oBAAoB;QAChB,IAAI,CAAC,gBAAgB,EAAE,CAAC;IAC5B,CAAC;IAED,cAAc;QACV,IAAI,IAAI,CAAC,eAAe,CAAC,OAAO,IAAI,CAAE,IAAI,CAAC,eAAe,CAAC,OAAe,CAAC,UAAU,EAAE,CAAC;YACnF,IAAI,CAAC,eAAe,CAAC,OAAe,CAAC,UAAU,GAAG,IAAI,CAAC;YACxD,MAAM,GAAG,GAAG,IA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C,oBAAoB,CAAC,IAAI,CAAC,kBAAkB,CAAW,CAAC;YACpF,IAAI,CAAC,mBAAmB,GAAG,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,kBAAkB,GAAG,CAAC,CAAW,CAAC;YAE5F,MAAM,CAAC,gBAAgB,CAAC,WAAW,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC;YAC5D,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QAC5D,CAAC;IACL,CAAC,CAAC;IAEF,MAAM;QACF,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,KAAK,KAAK,EAAE,CAAC;YAC7B,OAAO,oBAAC,QAAQ,OAAG,CAAC;QACxB,CAAC;QAED,MAAM,KAAK,GAAG,EAAE,mBAAmB,EAAE,IAAI,CAAC,kBAAkB,EAAE,EAAE,CAAC;QAEjE,OAAO,CACH,oBAAC,KAAK,IACF,YAAY,EAAE,IAAI,CAAC,KAAK,CAAC,YAAY,EACrC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,OAAO,EAChC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,EAC/B,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,EAAE,EACjB,GAAG,EAAE,IAAI,CAAC,eAAe,EACzB,KAAK,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,SAAS,CAAC,EAAE,GAAG,KAAK,EAAE,IAEtD,IAAI,CAAC,KAAK,CAAC,QAAQ,CAChB,CACX,CAAC;IACN,CAAC;CACJ","sourcesContent":["/**\n * Copyright 2022-2024, Denis Haev <dogafox@gmail.com>\n *\n * MIT License\n *\n */\nimport React, { Component } from 'react';\n\nimport { Table, Skeleton } from '@mui/material';\n\ninterface TableResizeProps {\n name?: string;\n ready?: boolean;\n stickyHeader?: boolean;\n size?: 'small' | 'medium';\n className?: string;\n sx?: Record<string, any>;\n style?: React.CSSProperties;\n initialWidths?: (number | 'auto')[];\n minWidths?: number[];\n dblTitle?: string;\n children?: React.ReactNode;\n}\n\nexport class TableResize extends Component<TableResizeProps> {\n private readonly resizerRefTable: React.RefObject<HTMLTableElement>;\n\n private resizerActiveIndex: number | null;\n\n private resizerActiveDiv: HTMLDivElement | null;\n\n private resizerCurrentWidths: (number | 'auto')[];\n\n private widthFilled: boolean = false;\n\n private installTimeout: ReturnType<typeof setTimeout> | null = null;\n\n private resizerMin: number = 0;\n\n private resizerMinNext: number = 0;\n\n private resizerPosition: number = 0;\n\n private resizerOldWidth: number = 0;\n\n private resizerOldWidthNext: number = 0;\n\n constructor(props: TableResizeProps) {\n super(props);\n this.resizerRefTable = React.createRef();\n this.resizerActiveIndex = null;\n this.resizerActiveDiv = null;\n this.resizerCurrentWidths = [];\n }\n\n componentDidMount(): void {\n this.resizerInstall();\n }\n\n componentWillUnmount(): void {\n this.resizerUninstall();\n }\n\n resizerInstall(): void {\n if (this.resizerRefTable.current && !(this.resizerRefTable.current as any)._installed) {\n (this.resizerRefTable.current as any)._installed = true;\n const ths = this.resizerRefTable.current.querySelectorAll('th');\n\n const widthsStored = ((window as any)._localStorage || window.localStorage).getItem(\n `App.${this.props.name || 'history'}.table`,\n );\n this.widthFilled = false;\n\n if (widthsStored) {\n try {\n this.resizerCurrentWidths = JSON.parse(widthsStored);\n this.widthFilled = true;\n } catch {\n // ignore\n }\n }\n if (this.widthFilled) {\n if (this.resizerCurrentWidths.length !== ths.length) {\n this.resizerCurrentWidths = [];\n this.widthFilled = false;\n } else {\n const tableWidth = this.resizerRefTable.current.offsetWidth;\n let storedWidth: number | null = 0;\n for (let w = 0; w < this.resizerCurrentWidths.length; w++) {\n if (window.isFinite(this.resizerCurrentWidths[w] as number)) {\n storedWidth += this.resizerCurrentWidths[w] as number;\n } else {\n storedWidth = null;\n break;\n }\n }\n if (storedWidth !== null && Math.abs(storedWidth - tableWidth) > 20) {\n this.resizerCurrentWidths = [];\n this.widthFilled = false;\n }\n }\n }\n\n for (let i = 0; i < ths.length; i++) {\n !this.widthFilled && this.resizerCurrentWidths.push(ths[i].offsetWidth);\n\n // last column does need a handle\n if (i < ths.length - 1) {\n const div = window.document.createElement('div');\n div.dataset.index = i.toString();\n div.onmousedown = this.resizerMouseDown;\n div.ondblclick = this.resizerReset;\n div.title = this.props.dblTitle || 'Double click to reset table layout';\n div.className = 'resize-handle';\n ths[i].appendChild(div);\n }\n }\n if (this.widthFilled) {\n this.resizerApplyWidths();\n }\n } else {\n this.installTimeout = setTimeout(() => {\n this.installTimeout = null;\n this.resizerInstall();\n }, 100);\n }\n }\n\n resizerReset = (): void => {\n for (let c = 0; c < this.resizerCurrentWidths.length; c++) {\n this.resizerCurrentWidths[c] = (this.props.initialWidths || [])[c] || 'auto';\n }\n\n ((window as any)._localStorage || window.localStorage).setItem(\n `App.${this.props.name || 'history'}.table`,\n JSON.stringify(this.resizerCurrentWidths),\n );\n this.resizerApplyWidths();\n };\n\n resizerUninstall(): void {\n this.installTimeout && clearTimeout(this.installTimeout);\n this.installTimeout = null;\n\n // resizer\n if (this.resizerRefTable.current && (this.resizerRefTable.current as any)._installed) {\n (this.resizerRefTable.current as any)._installed = false;\n const ths = this.resizerRefTable.current.querySelectorAll('th');\n for (let i = 0; i < ths.length; i++) {\n const div: HTMLDivElement | null = ths[i].querySelector('.resize-handle');\n if (div) {\n div.onmousedown = null;\n div.remove();\n }\n }\n }\n }\n\n resizerApplyWidths(): string | undefined {\n const gridTemplateColumns: string[] = [];\n if (this.resizerCurrentWidths.length) {\n for (let c = 0; c < this.resizerCurrentWidths.length; c++) {\n if (this.resizerCurrentWidths[c]) {\n gridTemplateColumns.push(\n this.resizerCurrentWidths[c] !== 'auto' ? `${this.resizerCurrentWidths[c]}px` : 'auto',\n );\n } else if (this.props.initialWidths && this.props.initialWidths[c]) {\n gridTemplateColumns.push(\n this.props.initialWidths[c] !== 'auto' ? `${this.props.initialWidths[c]}px` : 'auto',\n );\n } else {\n gridTemplateColumns.push('auto');\n }\n }\n } else if (this.props.initialWidths) {\n for (let c = 0; c < this.props.initialWidths.length; c++) {\n if (this.props.initialWidths[c]) {\n gridTemplateColumns.push(\n this.props.initialWidths[c] !== 'auto' ? `${this.props.initialWidths[c]}px` : 'auto',\n );\n } else {\n gridTemplateColumns.push('auto');\n }\n }\n }\n\n if (this.resizerRefTable.current && gridTemplateColumns.length) {\n this.resizerRefTable.current.style.gridTemplateColumns = gridTemplateColumns.join(' ');\n }\n\n return gridTemplateColumns.length ? gridTemplateColumns.join(' ') : undefined;\n }\n\n resizerMouseMove = (e: MouseEvent): void => {\n if (this.resizerActiveDiv && this.resizerActiveIndex !== null) {\n const width = this.resizerOldWidth + e.clientX - this.resizerPosition;\n const widthNext = this.resizerOldWidthNext - e.clientX + this.resizerPosition;\n if (\n (!this.resizerMin || width > this.resizerMin) &&\n (!this.resizerMinNext || widthNext > this.resizerMinNext)\n ) {\n this.resizerCurrentWidths[this.resizerActiveIndex] = width;\n this.resizerCurrentWidths[this.resizerActiveIndex + 1] = widthNext;\n this.resizerApplyWidths();\n }\n }\n };\n\n resizerMouseUp = (): void => {\n ((window as any)._localStorage || window.localStorage).setItem(\n `App.${this.props.name || 'history'}.table`,\n JSON.stringify(this.resizerCurrentWidths),\n );\n\n this.resizerActiveIndex = null;\n this.resizerActiveDiv = null;\n window.removeEventListener('mousemove', this.resizerMouseMove);\n window.removeEventListener('mouseup', this.resizerMouseUp);\n };\n\n resizerMouseDown = (e: MouseEvent): void => {\n if (this.resizerActiveIndex === null || this.resizerActiveIndex === undefined) {\n console.log(`Mouse down ${(e.target as HTMLDivElement)?.dataset.index}`);\n this.resizerActiveIndex = parseInt((e.target as HTMLDivElement)?.dataset.index || '0', 10);\n this.resizerActiveDiv = e.target as HTMLDivElement;\n this.resizerMin = this.props.minWidths ? this.props.minWidths[this.resizerActiveIndex] : 0;\n this.resizerMinNext = this.props.minWidths ? this.props.minWidths[this.resizerActiveIndex + 1] : 0;\n this.resizerPosition = e.clientX;\n let ths;\n if (this.resizerCurrentWidths[this.resizerActiveIndex] === 'auto') {\n ths = this.resizerRefTable.current?.querySelectorAll('th');\n if (ths) {\n this.resizerCurrentWidths[this.resizerActiveIndex] = ths[this.resizerActiveIndex].offsetWidth;\n }\n }\n if (this.resizerCurrentWidths[this.resizerActiveIndex + 1] === 'auto') {\n ths = ths || this.resizerRefTable.current?.querySelectorAll('th');\n if (ths) {\n this.resizerCurrentWidths[this.resizerActiveIndex + 1] =\n ths[this.resizerActiveIndex + 1].offsetWidth;\n }\n }\n\n this.resizerOldWidth = this.resizerCurrentWidths[this.resizerActiveIndex] as number;\n this.resizerOldWidthNext = this.resizerCurrentWidths[this.resizerActiveIndex + 1] as number;\n\n window.addEventListener('mousemove', this.resizerMouseMove);\n window.addEventListener('mouseup', this.resizerMouseUp);\n }\n };\n\n render(): React.JSX.Element {\n if (this.props.ready === false) {\n return <Skeleton />;\n }\n\n const style = { gridTemplateColumns: this.resizerApplyWidths() };\n\n return (\n <Table\n stickyHeader={this.props.stickyHeader}\n size={this.props.size || 'small'}\n className={this.props.className}\n sx={this.props.sx}\n ref={this.resizerRefTable}\n style={{ ...(this.props.style || undefined), ...style }}\n >\n {this.props.children}\n </Table>\n );\n }\n}\n"]}
@@ -18,5 +18,5 @@ interface TextWithIconProps {
18
18
  icon?: string;
19
19
  color?: string;
20
20
  }
21
- declare const TextWithIcon: (props: TextWithIconProps) => React.JSX.Element;
22
- export default TextWithIcon;
21
+ export declare function TextWithIcon(props: TextWithIconProps): React.JSX.Element;
22
+ export {};
@@ -1,10 +1,7 @@
1
1
  import React from 'react';
2
-
3
- import Icon from './Icon';
4
- import Utils from './Utils';
5
- import type { ThemeType } from '../types';
6
-
7
- const styles: Record<string, React.CSSProperties> = {
2
+ import { Icon } from './Icon';
3
+ import { Utils } from './Utils';
4
+ const styles = {
8
5
  div: {
9
6
  borderRadius: 3,
10
7
  padding: '0 3px',
@@ -26,44 +23,16 @@ const styles: Record<string, React.CSSProperties> = {
26
23
  textOverflow: 'ellipsis',
27
24
  },
28
25
  };
29
-
30
- interface TextWithIconProps {
31
- lang: ioBroker.Languages;
32
- themeType?: ThemeType;
33
- value: string | Record<string, any>;
34
- list?: ioBroker.Object[] | Record<string, ioBroker.Object>;
35
- options?: Record<string, any>;
36
- className?: string;
37
- style?: React.CSSProperties;
38
- title?: string;
39
- removePrefix?: string;
40
- moreClasses?: {
41
- root?: string;
42
- icon?: string;
43
- text?: string;
44
- };
45
- icon?: string;
46
- color?: string;
47
- }
48
-
49
- interface TextWithIconItem {
50
- name: string;
51
- value: string;
52
- icon?: string;
53
- color?: string;
54
- }
55
-
56
- const TextWithIcon = (props: TextWithIconProps): React.JSX.Element => {
26
+ export function TextWithIcon(props) {
57
27
  const value = props.value;
58
- let item: TextWithIconItem;
28
+ let item;
59
29
  const prefix = props.removePrefix || '';
60
-
61
30
  if (typeof value === 'string') {
62
31
  const list = props.list || props.options;
63
32
  if (list) {
64
33
  // if a list is array, then it is list of ioBroker.Object
65
34
  if (Array.isArray(list)) {
66
- const _item: ioBroker.Object = list.find((obj: ioBroker.Object) => obj._id === prefix + value);
35
+ const _item = list.find((obj) => obj._id === prefix + value);
67
36
  if (_item) {
68
37
  item = {
69
38
  name: Utils.getObjectNameFromObj(_item, props.lang).replace('system.group.', ''),
@@ -71,22 +40,25 @@ const TextWithIcon = (props: TextWithIconProps): React.JSX.Element => {
71
40
  icon: props.icon || _item.common?.icon,
72
41
  color: props.color || _item.common?.color,
73
42
  };
74
- } else {
43
+ }
44
+ else {
75
45
  item = {
76
46
  name: value,
77
47
  value: prefix + value,
78
48
  };
79
49
  }
80
- } else if (list[prefix + value]) {
50
+ }
51
+ else if (list[prefix + value]) {
81
52
  // List is object with key-value pairs: {'enum.rooms.1': {common: {name: 'Room 1'}}}
82
- const obj: ioBroker.Object = list[prefix + value];
53
+ const obj = list[prefix + value];
83
54
  item = {
84
55
  name: Utils.getObjectNameFromObj(obj, props.lang).replace('system.group.', ''),
85
56
  value: obj._id,
86
57
  icon: props.icon || obj.common?.icon,
87
58
  color: props.color || obj.common?.color,
88
59
  };
89
- } else {
60
+ }
61
+ else {
90
62
  // value is a string, ignore list
91
63
  item = {
92
64
  name: value,
@@ -95,7 +67,8 @@ const TextWithIcon = (props: TextWithIconProps): React.JSX.Element => {
95
67
  color: props.color,
96
68
  };
97
69
  }
98
- } else {
70
+ }
71
+ else {
99
72
  item = {
100
73
  name: value,
101
74
  value: prefix + value,
@@ -103,16 +76,18 @@ const TextWithIcon = (props: TextWithIconProps): React.JSX.Element => {
103
76
  color: props.color,
104
77
  };
105
78
  }
106
- } else if (!value || typeof value !== 'object') {
79
+ }
80
+ else if (!value || typeof value !== 'object') {
107
81
  item = {
108
82
  name: '',
109
83
  value: '',
110
84
  icon: props.icon,
111
85
  color: props.color,
112
86
  };
113
- } else {
87
+ }
88
+ else {
114
89
  // Item is an ioBroker.Object
115
- const obj: ioBroker.Object = value as ioBroker.Object;
90
+ const obj = value;
116
91
  item = {
117
92
  name: Utils.getObjectNameFromObj(obj, props.lang)
118
93
  .replace('system.group.', '')
@@ -124,36 +99,16 @@ const TextWithIcon = (props: TextWithIconProps): React.JSX.Element => {
124
99
  color: props.color || obj.common?.color,
125
100
  };
126
101
  }
127
-
128
102
  const style = item?.color
129
103
  ? {
130
- border: `1px solid ${Utils.invertColor(item?.color)}`,
131
- color: Utils.getInvertedColor(item?.color, props.themeType || 'light', true) || undefined,
132
- backgroundColor: item?.color,
133
- }
104
+ border: `1px solid ${Utils.invertColor(item?.color)}`,
105
+ color: Utils.getInvertedColor(item?.color, props.themeType || 'light', true) || undefined,
106
+ backgroundColor: item?.color,
107
+ }
134
108
  : {};
135
-
136
- return (
137
- <div
138
- style={{ ...(props.style || undefined), ...styles.div, ...(style || undefined) }}
139
- className={Utils.clsx(props.className, props.moreClasses?.root)}
140
- title={props.title || item.value}
141
- >
142
- {item?.icon ? (
143
- <Icon
144
- src={item?.icon}
145
- className={props.moreClasses?.icon}
146
- style={styles.icon}
147
- />
148
- ) : null}
149
- <div
150
- style={styles.text}
151
- className={props.moreClasses?.text}
152
- >
153
- {item?.name}
154
- </div>
155
- </div>
156
- );
157
- };
158
-
159
- export default TextWithIcon;
109
+ return (React.createElement("div", { style: { ...(props.style || undefined), ...styles.div, ...(style || undefined) }, className: Utils.clsx(props.className, props.moreClasses?.root), title: props.title || item.value },
110
+ item?.icon ? (React.createElement(Icon, { src: item?.icon, className: props.moreClasses?.icon, style: styles.icon })) : null,
111
+ React.createElement("div", { style: styles.text, className: props.moreClasses?.text }, item?.name)));
112
+ }
113
+ ;
114
+ //# sourceMappingURL=TextWithIcon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextWithIcon.js","sourceRoot":"./src/","sources":["Components/TextWithIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAGhC,MAAM,MAAM,GAAwC;IAChD,GAAG,EAAE;QACD,YAAY,EAAE,CAAC;QACf,OAAO,EAAE,OAAO;QAChB,UAAU,EAAE,MAAM;QAClB,UAAU,EAAE,QAAQ;QACpB,QAAQ,EAAE,QAAQ;QAClB,OAAO,EAAE,MAAM;QACf,UAAU,EAAE,QAAQ;KACvB;IACD,IAAI,EAAE;QACF,KAAK,EAAE,EAAE;QACT,MAAM,EAAE,EAAE;QACV,WAAW,EAAE,CAAC;QACd,aAAa,EAAE,QAAQ;KAC1B;IACD,IAAI,EAAE;QACF,OAAO,EAAE,cAAc;QACvB,QAAQ,EAAE,QAAQ;QAClB,YAAY,EAAE,UAAU;KAC3B;CACJ,CAAC;AA4BF,MAAM,UAAU,YAAY,CAAC,KAAwB;IACjD,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;IAC1B,IAAI,IAAsB,CAAC;IAC3B,MAAM,MAAM,GAAG,KAAK,CAAC,YAAY,IAAI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AM,EAAE,IAAI;YACpC,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,GAAG,CAAC,MAAM,EAAE,KAAK;SAC1C,CAAC;IACN,CAAC;IAED,MAAM,KAAK,GAAG,IAAI,EAAE,KAAK;QACrB,CAAC,CAAC;YACI,MAAM,EAAE,aAAa,KAAK,CAAC,WAAW,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE;YACrD,KAAK,EAAE,KAAK,CAAC,gBAAgB,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,SAAS,IAAI,OAAO,EAAE,IAAI,CAAC,IAAI,SAAS;YACzF,eAAe,EAAE,IAAI,EAAE,KAAK;SAC/B;QACH,CAAC,CAAC,EAAE,CAAC;IAET,OAAO,CACH,6BACI,KAAK,EAAE,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,IAAI,SAAS,CAAC,EAAE,GAAG,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,KAAK,IAAI,SAAS,CAAC,EAAE,EAChF,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,WAAW,EAAE,IAAI,CAAC,EAC/D,KAAK,EAAE,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK;QAE/B,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,CACV,oBAAC,IAAI,IACD,GAAG,EAAE,IAAI,EAAE,IAAI,EACf,SAAS,EAAE,KAAK,CAAC,WAAW,EAAE,IAAI,EAClC,KAAK,EAAE,MAAM,CAAC,IAAI,GACpB,CACL,CAAC,CAAC,CAAC,IAAI;QACR,6BACI,KAAK,EAAE,MAAM,CAAC,IAAI,EAClB,SAAS,EAAE,KAAK,CAAC,WAAW,EAAE,IAAI,IAEjC,IAAI,EAAE,IAAI,CACT,CACJ,CACT,CAAC;AACN,CAAC;AAAA,CAAC","sourcesContent":["import React from 'react';\n\nimport { Icon } from './Icon';\nimport { Utils } from './Utils';\nimport type { ThemeType } from '../types';\n\nconst styles: Record<string, React.CSSProperties> = {\n div: {\n borderRadius: 3,\n padding: '0 3px',\n lineHeight: '20px',\n whiteSpace: 'nowrap',\n overflow: 'hidden',\n display: 'flex',\n alignItems: 'center',\n },\n icon: {\n width: 16,\n height: 16,\n marginRight: 8,\n verticalAlign: 'middle',\n },\n text: {\n display: 'inline-block',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n },\n};\n\ninterface TextWithIconProps {\n lang: ioBroker.Languages;\n themeType?: ThemeType;\n value: string | Record<string, any>;\n list?: ioBroker.Object[] | Record<string, ioBroker.Object>;\n options?: Record<string, any>;\n className?: string;\n style?: React.CSSProperties;\n title?: string;\n removePrefix?: string;\n moreClasses?: {\n root?: string;\n icon?: string;\n text?: string;\n };\n icon?: string;\n color?: string;\n}\n\ninterface TextWithIconItem {\n name: string;\n value: string;\n icon?: string;\n color?: string;\n}\n\nexport function TextWithIcon(props: TextWithIconProps): React.JSX.Element {\n const value = props.value;\n let item: TextWithIconItem;\n const prefix = props.removePrefix || '';\n\n if (typeof value === 'string') {\n const list = props.list || props.options;\n if (list) {\n // if a list is array, then it is list of ioBroker.Object\n if (Array.isArray(list)) {\n const _item: ioBroker.Object = list.find((obj: ioBroker.Object) => obj._id === prefix + value);\n if (_item) {\n item = {\n name: Utils.getObjectNameFromObj(_item, props.lang).replace('system.group.', ''),\n value: _item._id,\n icon: props.icon || _item.common?.icon,\n color: props.color || _item.common?.color,\n };\n } else {\n item = {\n name: value,\n value: prefix + value,\n };\n }\n } else if (list[prefix + value]) {\n // List is object with key-value pairs: {'enum.rooms.1': {common: {name: 'Room 1'}}}\n const obj: ioBroker.Object = list[prefix + value];\n item = {\n name: Utils.getObjectNameFromObj(obj, props.lang).replace('system.group.', ''),\n value: obj._id,\n icon: props.icon || obj.common?.icon,\n color: props.color || obj.common?.color,\n };\n } else {\n // value is a string, ignore list\n item = {\n name: value,\n value: prefix + value,\n icon: props.icon,\n color: props.color,\n };\n }\n } else {\n item = {\n name: value,\n value: prefix + value,\n icon: props.icon,\n color: props.color,\n };\n }\n } else if (!value || typeof value !== 'object') {\n item = {\n name: '',\n value: '',\n icon: props.icon,\n color: props.color,\n };\n } else {\n // Item is an ioBroker.Object\n const obj: ioBroker.Object = value as ioBroker.Object;\n item = {\n name: Utils.getObjectNameFromObj(obj, props.lang)\n .replace('system.group.', '')\n .replace('system.user.', '')\n .replace('enum.rooms.', '')\n .replace('enum.functions.', ''),\n value: obj._id,\n icon: props.icon || obj.common?.icon,\n color: props.color || obj.common?.color,\n };\n }\n\n const style = item?.color\n ? {\n border: `1px solid ${Utils.invertColor(item?.color)}`,\n color: Utils.getInvertedColor(item?.color, props.themeType || 'light', true) || undefined,\n backgroundColor: item?.color,\n }\n : {};\n\n return (\n <div\n style={{ ...(props.style || undefined), ...styles.div, ...(style || undefined) }}\n className={Utils.clsx(props.className, props.moreClasses?.root)}\n title={props.title || item.value}\n >\n {item?.icon ? (\n <Icon\n src={item?.icon}\n className={props.moreClasses?.icon}\n style={styles.icon}\n />\n ) : null}\n <div\n style={styles.text}\n className={props.moreClasses?.text}\n >\n {item?.name}\n </div>\n </div>\n );\n};\n"]}
@@ -7,5 +7,5 @@ interface ToggleThemeMenuProps {
7
7
  style?: React.CSSProperties;
8
8
  size?: 'small' | 'medium' | 'large';
9
9
  }
10
- export default function ToggleThemeMenu({ themeName, toggleTheme, t, className, style, size, }: ToggleThemeMenuProps): JSX.Element;
10
+ export declare function ToggleThemeMenu({ themeName, toggleTheme, t, className, style, size, }: ToggleThemeMenuProps): JSX.Element;
11
11
  export {};
@@ -0,0 +1,13 @@
1
+ import React, {} from 'react';
2
+ import { IconButton, Tooltip } from '@mui/material';
3
+ import { Brightness4 as Brightness4Icon, Brightness5 as Brightness5Icon, Brightness6 as Brightness6Icon, Brightness7 as Brightness7Icon, } from '@mui/icons-material';
4
+ export function ToggleThemeMenu({ themeName, toggleTheme, t, className, style, size, }) {
5
+ return (React.createElement("div", { className: className || undefined, style: style || undefined },
6
+ React.createElement(Tooltip, { title: t('ra_Change color theme'), slotProps: { popper: { sx: { pointerEvents: 'none' } } } },
7
+ React.createElement(IconButton, { onClick: () => toggleTheme(), size: size || 'medium' },
8
+ themeName === 'dark' && React.createElement(Brightness4Icon, { className: className }),
9
+ themeName === 'blue' && React.createElement(Brightness5Icon, { className: className }),
10
+ themeName === 'colored' && React.createElement(Brightness6Icon, { className: className }),
11
+ themeName !== 'dark' && themeName !== 'blue' && themeName !== 'colored' && (React.createElement(Brightness7Icon, { className: className }))))));
12
+ }
13
+ //# sourceMappingURL=ToggleThemeMenu.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ToggleThemeMenu.js","sourceRoot":"./src/","sources":["Components/ToggleThemeMenu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAY,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,EACH,WAAW,IAAI,eAAe,EAC9B,WAAW,IAAI,eAAe,EAC9B,WAAW,IAAI,eAAe,EAC9B,WAAW,IAAI,eAAe,GACjC,MAAM,qBAAqB,CAAC;AAW7B,MAAM,UAAU,eAAe,CAAC,EAC5B,SAAS,EACT,WAAW,EACX,CAAC,EACD,SAAS,EACT,KAAK,EACL,IAAI,GACe;IACnB,OAAO,CACH,6BACI,SAAS,EAAE,SAAS,IAAI,SAAS,EACjC,KAAK,EAAE,KAAK,IAAI,SAAS;QAEzB,oBAAC,OAAO,IACJ,KAAK,EAAE,CAAC,CAAC,uBAAuB,CAAC,EACjC,SAAS,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,EAAE,EAAE;YAExD,oBAAC,UAAU,IACP,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,EAAE,EAC5B,IAAI,EAAE,IAAI,IAAI,QAAQ;gBAErB,SAAS,KAAK,MAAM,IAAI,oBAAC,eAAe,IAAC,SAAS,EAAE,SAAS,GAAI;gBACjE,SAAS,KAAK,MAAM,IAAI,oBAAC,eAAe,IAAC,SAAS,EAAE,SAAS,GAAI;gBACjE,SAAS,KAAK,SAAS,IAAI,oBAAC,eAAe,IAAC,SAAS,EAAE,SAAS,GAAI;gBACpE,SAAS,KAAK,MAAM,IAAI,SAAS,KAAK,MAAM,IAAI,SAAS,KAAK,SAAS,IAAI,CACxE,oBAAC,eAAe,IAAC,SAAS,EAAE,SAAS,GAAI,CAC5C,CACQ,CACP,CACR,CACT,CAAC;AACN,CAAC","sourcesContent":["import React, { type JSX } from 'react';\n\nimport { IconButton, Tooltip } from '@mui/material';\n\nimport {\n Brightness4 as Brightness4Icon,\n Brightness5 as Brightness5Icon,\n Brightness6 as Brightness6Icon,\n Brightness7 as Brightness7Icon,\n} from '@mui/icons-material';\n\ninterface ToggleThemeMenuProps {\n themeName: 'dark' | 'blue' | 'colored' | 'light';\n toggleTheme: () => void;\n t: (key: string) => string;\n className?: string;\n style?: React.CSSProperties;\n size?: 'small' | 'medium' | 'large';\n}\n\nexport function ToggleThemeMenu({\n themeName,\n toggleTheme,\n t,\n className,\n style,\n size,\n}: ToggleThemeMenuProps): JSX.Element {\n return (\n <div\n className={className || undefined}\n style={style || undefined}\n >\n <Tooltip\n title={t('ra_Change color theme')}\n slotProps={{ popper: { sx: { pointerEvents: 'none' } } }}\n >\n <IconButton\n onClick={() => toggleTheme()}\n size={size || 'medium'}\n >\n {themeName === 'dark' && <Brightness4Icon className={className} />}\n {themeName === 'blue' && <Brightness5Icon className={className} />}\n {themeName === 'colored' && <Brightness6Icon className={className} />}\n {themeName !== 'dark' && themeName !== 'blue' && themeName !== 'colored' && (\n <Brightness7Icon className={className} />\n )}\n </IconButton>\n </Tooltip>\n </div>\n );\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import React, { Component, type JSX } from 'react';
2
- import type Connection from '../Connection';
2
+ import type { Connection } from '../Connection';
3
3
  import type { IobTheme } from '../types';
4
4
  interface Column {
5
5
  cellStyle?: Record<string, any>;
@@ -52,7 +52,7 @@ interface TreeTableState {
52
52
  showSelectId?: boolean;
53
53
  data?: Record<string, any>[];
54
54
  }
55
- declare class TreeTable extends Component<TreeTableProps, TreeTableState> {
55
+ export declare class TreeTable extends Component<TreeTableProps, TreeTableState> {
56
56
  private selectCallback;
57
57
  private updateTimeout;
58
58
  constructor(props: TreeTableProps);
@@ -76,4 +76,4 @@ declare class TreeTable extends Component<TreeTableProps, TreeTableState> {
76
76
  renderHead(): JSX.Element;
77
77
  render(): JSX.Element | null;
78
78
  }
79
- export default TreeTable;
79
+ export {};