@iobroker/adapter-react-v5 3.1.23 → 3.1.26

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 (139) hide show
  1. package/Components/404.d.ts +3 -0
  2. package/Components/ColorPicker.d.ts +138 -0
  3. package/Components/ComplexCron.d.ts +8 -0
  4. package/Components/CustomModal.d.ts +3 -0
  5. package/Components/FileBrowser.d.ts +125 -0
  6. package/Components/FileBrowser.js +26 -9
  7. package/Components/FileBrowser.js.map +1 -1
  8. package/Components/FileViewer.d.ts +80 -0
  9. package/Components/FileViewer.js +27 -22
  10. package/Components/FileViewer.js.map +1 -1
  11. package/Components/Icon.d.ts +21 -0
  12. package/Components/IconPicker.d.ts +64 -0
  13. package/Components/IconSelector.d.ts +25 -0
  14. package/Components/Image.d.ts +64 -0
  15. package/Components/JsonConfigComponent/ChipInput.d.ts +13 -0
  16. package/Components/JsonConfigComponent/ConfigAlive.d.ts +10 -0
  17. package/Components/JsonConfigComponent/ConfigAutocomplete.d.ts +14 -0
  18. package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.d.ts +14 -0
  19. package/Components/JsonConfigComponent/ConfigCRON.d.ts +15 -0
  20. package/Components/JsonConfigComponent/ConfigCertificateSelect.d.ts +14 -0
  21. package/Components/JsonConfigComponent/ConfigCheckbox.d.ts +14 -0
  22. package/Components/JsonConfigComponent/ConfigChip.d.ts +14 -0
  23. package/Components/JsonConfigComponent/ConfigColor.d.ts +14 -0
  24. package/Components/JsonConfigComponent/ConfigCoordinates.d.ts +14 -0
  25. package/Components/JsonConfigComponent/ConfigCustom.d.ts +26 -0
  26. package/Components/JsonConfigComponent/ConfigDatePicker.d.ts +14 -0
  27. package/Components/JsonConfigComponent/ConfigFile.d.ts +15 -0
  28. package/Components/JsonConfigComponent/ConfigFileSelector.d.ts +3 -0
  29. package/Components/JsonConfigComponent/ConfigFunc.d.ts +14 -0
  30. package/Components/JsonConfigComponent/ConfigGeneric.d.ts +71 -0
  31. package/Components/JsonConfigComponent/ConfigIP.d.ts +14 -0
  32. package/Components/JsonConfigComponent/ConfigImageUpload.d.ts +14 -0
  33. package/Components/JsonConfigComponent/ConfigInstanceSelect.d.ts +14 -0
  34. package/Components/JsonConfigComponent/ConfigJsonEditor.d.ts +14 -0
  35. package/Components/JsonConfigComponent/ConfigLanguage.d.ts +14 -0
  36. package/Components/JsonConfigComponent/ConfigNumber.d.ts +3 -0
  37. package/Components/JsonConfigComponent/ConfigObjectId.d.ts +17 -0
  38. package/Components/JsonConfigComponent/ConfigPanel.d.ts +3 -0
  39. package/Components/JsonConfigComponent/ConfigPassword.d.ts +14 -0
  40. package/Components/JsonConfigComponent/ConfigPattern.d.ts +14 -0
  41. package/Components/JsonConfigComponent/ConfigRoom.d.ts +14 -0
  42. package/Components/JsonConfigComponent/ConfigSelect.d.ts +14 -0
  43. package/Components/JsonConfigComponent/ConfigSelectSendTo.d.ts +17 -0
  44. package/Components/JsonConfigComponent/ConfigSendto.d.ts +18 -0
  45. package/Components/JsonConfigComponent/ConfigSendto.js +171 -9
  46. package/Components/JsonConfigComponent/ConfigSendto.js.map +1 -1
  47. package/Components/JsonConfigComponent/ConfigSetState.d.ts +18 -0
  48. package/Components/JsonConfigComponent/ConfigSlider.d.ts +14 -0
  49. package/Components/JsonConfigComponent/ConfigStaticDivider.d.ts +14 -0
  50. package/Components/JsonConfigComponent/ConfigStaticHeader.d.ts +14 -0
  51. package/Components/JsonConfigComponent/ConfigStaticImage.d.ts +14 -0
  52. package/Components/JsonConfigComponent/ConfigStaticText.d.ts +14 -0
  53. package/Components/JsonConfigComponent/ConfigTable.d.ts +3 -0
  54. package/Components/JsonConfigComponent/ConfigTabs.d.ts +33 -0
  55. package/Components/JsonConfigComponent/ConfigText.d.ts +14 -0
  56. package/Components/JsonConfigComponent/ConfigText.js +24 -3
  57. package/Components/JsonConfigComponent/ConfigText.js.map +1 -1
  58. package/Components/JsonConfigComponent/ConfigTextSendTo.d.ts +10 -0
  59. package/Components/JsonConfigComponent/ConfigTimePicker.d.ts +14 -0
  60. package/Components/JsonConfigComponent/ConfigTopic.d.ts +17 -0
  61. package/Components/JsonConfigComponent/ConfigUser.d.ts +14 -0
  62. package/Components/JsonConfigComponent/index.d.ts +27 -0
  63. package/Components/JsonConfigComponent/index.js +21 -17
  64. package/Components/JsonConfigComponent/index.js.map +1 -1
  65. package/Components/Loader.d.ts +37 -0
  66. package/Components/Loaders/PT.d.ts +41 -0
  67. package/Components/Loaders/Vendor.d.ts +41 -0
  68. package/Components/Logo.d.ts +59 -0
  69. package/Components/MDUtils.d.ts +12 -0
  70. package/Components/ObjectBrowser.d.ts +632 -0
  71. package/Components/ObjectBrowser.js +315 -449
  72. package/Components/ObjectBrowser.js.map +1 -1
  73. package/Components/Router.d.ts +35 -0
  74. package/Components/SaveCloseButtons.d.ts +64 -0
  75. package/Components/Schedule.d.ts +7 -0
  76. package/Components/SelectWithIcon.d.ts +21 -0
  77. package/Components/SimpleCron/cron2text.d.ts +8 -0
  78. package/Components/SimpleCron/cronText.d.ts +2 -0
  79. package/Components/SimpleCron/index.d.ts +8 -0
  80. package/Components/SimpleCron/jquery.cron.locale.d.ts +2 -0
  81. package/Components/TabContainer.d.ts +42 -0
  82. package/Components/TabContent.d.ts +32 -0
  83. package/Components/TabHeader.d.ts +13 -0
  84. package/Components/TableResize.d.ts +14 -0
  85. package/Components/TextWithIcon.d.ts +3 -0
  86. package/Components/ToggleThemeMenu.d.ts +8 -0
  87. package/Components/TreeTable.d.ts +3 -0
  88. package/Components/UploadImage.d.ts +2 -0
  89. package/Components/Utils.d.ts +334 -0
  90. package/Components/copy-to-clipboard.d.ts +2 -0
  91. package/Components/withWidth.d.ts +2 -0
  92. package/Connection.d.ts +761 -0
  93. package/Connection.js +9 -1
  94. package/Connection.js.map +1 -1
  95. package/Dialogs/ComplexCron.d.ts +15 -0
  96. package/Dialogs/Confirm.d.ts +48 -0
  97. package/Dialogs/Cron.d.ts +15 -0
  98. package/Dialogs/Error.d.ts +49 -0
  99. package/Dialogs/FileSelect.d.ts +148 -0
  100. package/Dialogs/Message.d.ts +39 -0
  101. package/Dialogs/SelectID.d.ts +161 -0
  102. package/Dialogs/SimpleCron.d.ts +14 -0
  103. package/Dialogs/TextInput.d.ts +87 -0
  104. package/GenericApp.d.ts +213 -0
  105. package/Prompt.d.ts +5 -0
  106. package/README.md +7 -0
  107. package/Theme.d.ts +7 -0
  108. package/assets/devices/parseNames.d.ts +1 -0
  109. package/assets/rooms/parseNames.d.ts +1 -0
  110. package/i18n/de.json +4 -1
  111. package/i18n/en.json +4 -1
  112. package/i18n/es.json +4 -1
  113. package/i18n/fr.json +4 -1
  114. package/i18n/it.json +4 -1
  115. package/i18n/nl.json +4 -1
  116. package/i18n/pl.json +4 -1
  117. package/i18n/pt.json +4 -1
  118. package/i18n/ru.json +4 -1
  119. package/i18n/zh-cn.json +4 -1
  120. package/i18n.d.ts +92 -0
  121. package/icons/IconAdapter.d.ts +11 -0
  122. package/icons/IconAlias.d.ts +11 -0
  123. package/icons/IconChannel.d.ts +11 -0
  124. package/icons/IconClearFilter.d.ts +11 -0
  125. package/icons/IconClosed.d.ts +11 -0
  126. package/icons/IconCopy.d.ts +38 -0
  127. package/icons/IconDevice.d.ts +11 -0
  128. package/icons/IconDocument.d.ts +11 -0
  129. package/icons/IconDocumentReadOnly.d.ts +11 -0
  130. package/icons/IconExpert.d.ts +38 -0
  131. package/icons/IconFx.d.ts +11 -0
  132. package/icons/IconInstance.d.ts +11 -0
  133. package/icons/IconLogout.d.ts +38 -0
  134. package/icons/IconNoIcon.d.ts +38 -0
  135. package/icons/IconOpen.d.ts +11 -0
  136. package/icons/IconState.d.ts +11 -0
  137. package/index.d.ts +113 -0
  138. package/index.js +1 -0
  139. package/package.json +8 -8
@@ -0,0 +1,80 @@
1
+ export namespace EXTENSIONS {
2
+ const images: string[];
3
+ const code: string[];
4
+ const txt: string[];
5
+ const audio: string[];
6
+ const video: string[];
7
+ }
8
+ export default _export;
9
+ export type FileViewerProps = {
10
+ /**
11
+ * Translation function
12
+ */
13
+ t: import('../types').Translator;
14
+ /**
15
+ * The selected language.
16
+ */
17
+ lang?: ioBroker.Languages;
18
+ /**
19
+ * Is expert mode enabled? (default: false)
20
+ */
21
+ expertMode?: boolean;
22
+ /**
23
+ * Callback when the viewer is closed.
24
+ */
25
+ onClose: () => void;
26
+ /**
27
+ * The URL to the file to be displayed.
28
+ */
29
+ href: string;
30
+ };
31
+ /** @type {typeof FileViewer} */
32
+ declare const _export: typeof FileViewer;
33
+ /**
34
+ * @typedef {object} FileViewerProps
35
+ * @property {import('../types').Translator} t Translation function
36
+ * @property {ioBroker.Languages} [lang] The selected language.
37
+ * @property {boolean} [expertMode] Is expert mode enabled? (default: false)
38
+ * @property {() => void} onClose Callback when the viewer is closed.
39
+ * @property {string} href The URL to the file to be displayed.
40
+ *
41
+ * @extends {React.Component<FileViewerProps>}
42
+ */
43
+ declare class FileViewer extends React.Component<FileViewerProps, any, any> {
44
+ static getEditFile(ext: any): "html" | "json" | "json5" | "javascript";
45
+ /**
46
+ * @param {Readonly<FileViewerProps>} props
47
+ */
48
+ constructor(props: Readonly<FileViewerProps>);
49
+ state: {
50
+ text: any;
51
+ code: any;
52
+ ext: string;
53
+ editing: boolean;
54
+ editingValue: any;
55
+ copyPossible: boolean;
56
+ forceUpdate: number;
57
+ changed: boolean;
58
+ imgError: boolean;
59
+ };
60
+ readFile(): void;
61
+ componentDidMount(): void;
62
+ componentWillUnmount(): void;
63
+ onFileChanged: (id: any, fileName: any, size: any) => void;
64
+ timeout: any;
65
+ writeFile64: () => void;
66
+ getContent(): JSX.Element;
67
+ render(): JSX.Element;
68
+ }
69
+ declare namespace FileViewer {
70
+ namespace propTypes {
71
+ const t: PropTypes.Requireable<(...args: any[]) => any>;
72
+ const lang: PropTypes.Requireable<string>;
73
+ const expertMode: PropTypes.Requireable<boolean>;
74
+ const onClose: PropTypes.Requireable<(...args: any[]) => any>;
75
+ const href: PropTypes.Validator<string>;
76
+ const supportSubscribes: PropTypes.Requireable<boolean>;
77
+ }
78
+ }
79
+ import React from "react";
80
+ import PropTypes from "prop-types";
@@ -29,6 +29,8 @@ var _styles = require("@mui/styles");
29
29
 
30
30
  var _propTypes = _interopRequireDefault(require("prop-types"));
31
31
 
32
+ var _buffer = require("buffer");
33
+
32
34
  var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
33
35
 
34
36
  var _Button = _interopRequireDefault(require("@mui/material/Button"));
@@ -94,7 +96,7 @@ var styles = function styles(theme) {
94
96
 
95
97
  var EXTENSIONS = {
96
98
  images: ['png', 'jpg', 'svg', 'jpeg', 'bmp'],
97
- code: ['js', 'json', 'md'],
99
+ code: ['js', 'json', 'json5', 'md'],
98
100
  txt: ['log', 'txt', 'html', 'css', 'xml'],
99
101
  audio: ['mp3', 'wav', 'ogg', 'acc'],
100
102
  video: ['mp4', 'mov', 'avi']
@@ -163,7 +165,7 @@ var FileViewer = /*#__PURE__*/function (_Component) {
163
165
  var adapter = parts[0];
164
166
  var name = parts.splice(1).join('/');
165
167
 
166
- _this.props.socket.writeFile64(adapter, name, Buffer.from(data).toString('base64')).then(function (_) {
168
+ _this.props.socket.writeFile64(adapter, name, _buffer.Buffer.from(data).toString('base64')).then(function (_) {
167
169
  return _this.props.onClose();
168
170
  })["catch"](function (e) {
169
171
  return window.alert('Cannot write file: ' + e);
@@ -250,26 +252,6 @@ var FileViewer = /*#__PURE__*/function (_Component) {
250
252
  var name = parts.splice(1).join('/');
251
253
  this.props.supportSubscribes && this.props.socket.subscribeFiles(adapter, name, this.onFileChanged);
252
254
  }
253
- }, {
254
- key: "getEditFile",
255
- value: function getEditFile(ext) {
256
- switch (ext) {
257
- case 'json':
258
- return 'json';
259
-
260
- case 'js':
261
- return 'javascript';
262
-
263
- case 'html':
264
- return 'html';
265
-
266
- case 'txt':
267
- return 'html';
268
-
269
- default:
270
- return 'json';
271
- }
272
- }
273
255
  }, {
274
256
  key: "getContent",
275
257
  value: function getContent() {
@@ -361,6 +343,29 @@ var FileViewer = /*#__PURE__*/function (_Component) {
361
343
  startIcon: /*#__PURE__*/_react["default"].createElement(_Close["default"], null)
362
344
  }, this.props.t('Close'))));
363
345
  }
346
+ }], [{
347
+ key: "getEditFile",
348
+ value: function getEditFile(ext) {
349
+ switch (ext) {
350
+ case 'json':
351
+ return 'json';
352
+
353
+ case 'json5':
354
+ return 'json5';
355
+
356
+ case 'js':
357
+ return 'javascript';
358
+
359
+ case 'html':
360
+ return 'html';
361
+
362
+ case 'txt':
363
+ return 'html';
364
+
365
+ default:
366
+ return 'json';
367
+ }
368
+ }
364
369
  }]);
365
370
  return FileViewer;
366
371
  }(_react.Component);
@@ -1 +1 @@
1
- {"version":3,"file":"FileViewer.js","names":["styles","theme","dialog","height","paper","content","textAlign","textarea","width","img","objectFit","dialogTitle","justifyContent","display","EXTENSIONS","images","code","txt","audio","video","bufferToBase64","buffer","binary","bytes","Uint8Array","len","byteLength","i","String","fromCharCode","window","btoa","FileViewer","props","id","fileName","size","state","changed","timeout","clearTimeout","setTimeout","alert","text","readFile","setState","forceUpdate","Date","now","parts","href","split","data","editingValue","splice","adapter","name","join","socket","writeFile64","Buffer","from","toString","then","_","onClose","e","ext","Utils","getFileExtension","editing","formatEditFile","copyPossible","includes","imgError","file","undefined","newState","type","detectMimeType","supportSubscribes","subscribeFiles","onFileChanged","clsx","classes","getClassBackgroundImage","target","onerror","newValue","readOnly","scrollPaper","t","setStateBackgroundImage","getContent","copyToClipboard","Component","propTypes","PropTypes","func","lang","string","expertMode","bool","isRequired","_export","withWidth","withStyles"],"sources":["FileViewer.js"],"sourcesContent":["import React, { Component } from 'react';\nimport { withStyles } from '@mui/styles';\nimport PropTypes from 'prop-types';\n\nimport TextField from '@mui/material/TextField';\nimport Button from '@mui/material/Button';\nimport Dialog from '@mui/material/Dialog';\nimport DialogActions from '@mui/material/DialogActions';\nimport DialogContent from '@mui/material/DialogContent';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport { IconButton } from '@mui/material';\n\nimport IconNoIcon from '../icons/IconNoIcon';\nimport withWidth from './withWidth';\nimport Utils from './Utils';\n\n// Icons\nimport { FaCopy as CopyIcon } from 'react-icons/fa';\nimport Brightness5Icon from '@mui/icons-material/Brightness6';\nimport CloseIcon from '@mui/icons-material/Close';\nimport SaveIcon from '@mui/icons-material/Save';\n\nconst styles = theme => ({\n dialog: {\n height: '100%',\n },\n paper: {\n height: 'calc(100% - 64px)',\n },\n content: {\n textAlign: 'center',\n },\n textarea: {\n width: '100%',\n height: '100%',\n },\n img: {\n width: 'auto',\n height: 'calc(100% - 5px)',\n objectFit: 'contain',\n },\n dialogTitle: {\n justifyContent: 'space-between',\n display: 'flex'\n }\n});\n\nexport const EXTENSIONS = {\n images: ['png', 'jpg', 'svg', 'jpeg', 'bmp'],\n code: ['js', 'json', 'md'],\n txt: ['log', 'txt', 'html', 'css', 'xml'],\n audio: ['mp3', 'wav', 'ogg', 'acc'],\n video: ['mp4', 'mov', 'avi'],\n};\n\nfunction bufferToBase64(buffer) {\n let binary = '';\n let bytes = new Uint8Array(buffer);\n let len = bytes.byteLength;\n for (let i = 0; i < len && i < 50; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n return window.btoa(binary);\n}\n\n/**\n * @typedef {object} FileViewerProps\n * @property {import('../types').Translator} t Translation function\n * @property {ioBroker.Languages} [lang] The selected language.\n * @property {boolean} [expertMode] Is expert mode enabled? (default: false)\n * @property {() => void} onClose Callback when the viewer is closed.\n * @property {string} href The URL to the file to be displayed.\n *\n * @extends {React.Component<FileViewerProps>}\n */\nclass FileViewer extends Component {\n /**\n * @param {Readonly<FileViewerProps>} props\n */\n constructor(props) {\n super(props);\n const ext = Utils.getFileExtension(this.props.href);\n\n this.state = {\n text: null,\n code: null,\n ext,\n editing: !!this.props.formatEditFile || false,\n editingValue: null,\n copyPossible: EXTENSIONS.code.includes(ext) || EXTENSIONS.txt.includes(ext),\n forceUpdate: Date.now(),\n changed: false,\n imgError: false,\n };\n }\n\n readFile() {\n if (this.props.href) {\n const parts = this.props.href.split('/');\n parts.splice(0, 2);\n const adapter = parts[0];\n const name = parts.splice(1).join('/');\n\n this.props.socket.readFile(adapter, name)\n .then(data => {\n if (data.file !== undefined) {\n data = data.file;\n }\n\n const newState = {copyPossible: this.state.copyPossible};\n // try to detect valid extension\n if (data.type === 'Buffer') {\n const ext = Utils.detectMimeType(bufferToBase64(data.data));\n if (ext) {\n newState.ext = ext;\n newState.copyPossible = EXTENSIONS.code.includes(ext) || EXTENSIONS.txt.includes(ext);\n }\n }\n\n if (newState.copyPossible) {\n if (EXTENSIONS.txt.includes(this.state.ext)) {\n newState.text = data;\n newState.editingValue = data;\n } else if (EXTENSIONS.code.includes(this.state.ext)) {\n newState.code = data;\n newState.editingValue = data;\n }\n }\n\n this.setState(newState);\n })\n .catch(e => window.alert('Cannot read file: ' + e));\n }\n }\n\n componentDidMount() {\n this.readFile();\n\n const parts = this.props.href.split('/');\n parts.splice(0, 2);\n const adapter = parts[0];\n const name = parts.splice(1).join('/');\n\n this.props.supportSubscribes && this.props.socket.subscribeFiles(adapter, name, this.onFileChanged);\n }\n\n componentWillUnmount() {\n this.timeout && clearTimeout(this.timeout);\n const parts = this.props.href.split('/');\n parts.splice(0, 2);\n const adapter = parts[0];\n const name = parts.splice(1).join('/');\n this.props.supportSubscribes && this.props.socket.subscribeFiles(adapter, name, this.onFileChanged);\n }\n\n onFileChanged = (id, fileName, size) => {\n if (!this.state.changed) {\n this.timeout && clearTimeout(this.timeout);\n this.timeout = setTimeout(() => {\n this.timeout = null;\n if (size === null) {\n window.alert('Show file was deleted!');\n } else if (this.state.text !== null || this.state.code !== null) {\n this.readFile();\n } else {\n this.setState({ forceUpdate: Date.now() });\n }\n }, 300);\n }\n };\n\n writeFile64 = () => {\n const parts = this.props.href.split('/');\n const data = this.state.editingValue;\n parts.splice(0, 2);\n const adapter = parts[0];\n const name = parts.splice(1).join('/');\n this.props.socket.writeFile64(adapter, name, Buffer.from(data).toString('base64'))\n .then(_ => this.props.onClose())\n .catch(e => window.alert('Cannot write file: ' + e));\n }\n\n getEditFile(ext) {\n switch (ext) {\n case 'json':\n return 'json';\n case 'js':\n return 'javascript';\n case 'html':\n return 'html';\n case 'txt':\n return 'html';\n default:\n return 'json';\n }\n }\n\n getContent() {\n if (EXTENSIONS.images.includes(this.state.ext)) {\n if (this.state.imgError) {\n return <IconNoIcon className={Utils.clsx(this.props.classes.img, this.props.getClassBackgroundImage())} />;\n } else {\n return <img\n onError={e => {\n e.target.onerror = null;\n this.setState({ imgError: true });\n }}\n className={Utils.clsx(this.props.classes.img, this.props.getClassBackgroundImage())}\n src={this.props.href + '?ts=' + this.state.forceUpdate}\n alt={this.props.href}\n />;\n }\n } else if (this.state.code !== null || this.state.text !== null || this.state.editing) {\n return <TextField\n variant=\"standard\"\n className={ this.props.classes.textarea }\n multiline\n value={ this.state.editingValue || this.state.code || this.state.text }\n onChange={newValue => this.setState({ editingValue: newValue, changed: true })}\n InputProps={{ readOnly: !this.state.editing,}}\n />;\n }\n }\n\n render() {\n return <Dialog\n classes={{ scrollPaper: this.props.classes.dialog, paper: this.props.classes.paper }}\n scroll=\"paper\"\n open={!!this.props.href}\n onClose={() => this.props.onClose()}\n fullWidth={true}\n maxWidth=\"xl\"\n aria-labelledby=\"form-dialog-title\"\n >\n <div className={this.props.classes.dialogTitle}>\n <DialogTitle id=\"form-dialog-title\">{this.props.t(this.state.editing ? 'Edit' : 'View') + ': ' + this.props.href}</DialogTitle>\n {EXTENSIONS.images.includes(this.state.ext) && <div>\n <IconButton size=\"large\"\n color={'inherit'}\n onClick={this.props.setStateBackgroundImage}\n >\n <Brightness5Icon />\n </IconButton>\n </div>\n }\n </div>\n <DialogContent className={this.props.classes.content}>\n {this.getContent()}\n </DialogContent>\n <DialogActions>\n {this.state.copyPossible ?\n <Button\n color=\"grey\"\n onClick={e => Utils.copyToClipboard(this.state.text || this.state.code, e)}\n startIcon={<CopyIcon />}\n >\n {this.props.t('Copy content')}\n </Button> : null}\n {this.state.editing ?\n <Button\n color=\"grey\"\n disabled={this.state.editingValue === this.state.code || this.state.editingValue === this.state.text}\n variant=\"contained\"\n onClick={this.writeFile64}\n startIcon={<SaveIcon />}\n >\n {this.props.t('Save')}\n </Button> : null}\n <Button\n variant=\"contained\"\n onClick={() => this.props.onClose()}\n color=\"primary\"\n startIcon={<CloseIcon />}\n >\n {this.props.t('Close')}\n </Button>\n </DialogActions>\n </Dialog>;\n }\n}\n\nFileViewer.propTypes = {\n t: PropTypes.func,\n lang: PropTypes.string,\n expertMode: PropTypes.bool,\n onClose: PropTypes.func,\n href: PropTypes.string.isRequired,\n supportSubscribes: PropTypes.bool,\n};\n\n/** @type {typeof FileViewer} */\nconst _export = withWidth()(withStyles(styles)(FileViewer));\nexport default _export;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AAGA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;EAAA,OAAK;IACrBC,MAAM,EAAE;MACJC,MAAM,EAAE;IADJ,CADa;IAIrBC,KAAK,EAAE;MACHD,MAAM,EAAE;IADL,CAJc;IAOrBE,OAAO,EAAE;MACLC,SAAS,EAAE;IADN,CAPY;IAUrBC,QAAQ,EAAE;MACNC,KAAK,EAAE,MADD;MAENL,MAAM,EAAE;IAFF,CAVW;IAcrBM,GAAG,EAAE;MACDD,KAAK,EAAE,MADN;MAEDL,MAAM,EAAE,kBAFP;MAGDO,SAAS,EAAE;IAHV,CAdgB;IAmBrBC,WAAW,EAAE;MACTC,cAAc,EAAE,eADP;MAETC,OAAO,EAAE;IAFA;EAnBQ,CAAL;AAAA,CAApB;;AAyBO,IAAMC,UAAU,GAAG;EACtBC,MAAM,EAAE,CAAC,KAAD,EAAQ,KAAR,EAAe,KAAf,EAAsB,MAAtB,EAA8B,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CAAC,kBAAD;QACI,KAAK,EAAC,MADV;QAEI,QAAQ,EAAE,KAAKjC,KAAL,CAAWgB,YAAX,KAA4B,KAAKhB,KAAL,CAAWrB,IAAvC,IAA+C,KAAKqB,KAAL,CAAWgB,YAAX,KAA4B,KAAKhB,KAAL,CAAWM,IAFpG;QAGI,OAAO,EAAC,WAHZ;QAII,OAAO,EAAE,KAAKgB,WAJlB;QAKI,SAAS,eAAE,gCAAC,gBAAD;MALf,GAOK,KAAK1B,KAAL,CAAW0D,CAAX,CAAa,MAAb,CAPL,CADH,GASe,IAlBpB,eAmBI,gCAAC,kBAAD;QACI,OAAO,EAAC,WADZ;QAEI,OAAO,EAAE;UAAA,OAAM,MAAI,CAAC1D,KAAL,CAAWgC,OAAX,EAAN;QAAA,CAFb;QAGI,KAAK,EAAC,SAHV;QAII,SAAS,eAAE,gCAAC,iBAAD;MAJf,GAMK,KAAKhC,KAAL,CAAW0D,CAAX,CAAa,OAAb,CANL,CAnBJ,CAxBG,CAAP;IAqDH;;;EA3MoBI,gB;;AA8MzB/D,UAAU,CAACgE,SAAX,GAAuB;EACnBL,CAAC,EAAEM,qBAAA,CAAUC,IADM;EAEnBC,IAAI,EAAEF,qBAAA,CAAUG,MAFG;EAGnBC,UAAU,EAAEJ,qBAAA,CAAUK,IAHH;EAInBrC,OAAO,EAAEgC,qBAAA,CAAUC,IAJA;EAKnBhD,IAAI,EAAE+C,qBAAA,CAAUG,MAAV,CAAiBG,UALJ;EAMnBvB,iBAAiB,EAAEiB,qBAAA,CAAUK;AANV,CAAvB;AASA;;AACA,IAAME,OAAO,GAAG,IAAAC,qBAAA,IAAY,IAAAC,kBAAA,EAAW1G,MAAX,EAAmBgC,UAAnB,CAAZ,CAAhB;;eACewE,O"}
1
+ {"version":3,"file":"FileViewer.js","names":["styles","theme","dialog","height","paper","content","textAlign","textarea","width","img","objectFit","dialogTitle","justifyContent","display","EXTENSIONS","images","code","txt","audio","video","bufferToBase64","buffer","binary","bytes","Uint8Array","len","byteLength","i","String","fromCharCode","window","btoa","FileViewer","props","id","fileName","size","state","changed","timeout","clearTimeout","setTimeout","alert","text","readFile","setState","forceUpdate","Date","now","parts","href","split","data","editingValue","splice","adapter","name","join","socket","writeFile64","Buffer","from","toString","then","_","onClose","e","ext","Utils","getFileExtension","editing","formatEditFile","copyPossible","includes","imgError","file","undefined","newState","type","detectMimeType","supportSubscribes","subscribeFiles","onFileChanged","clsx","classes","getClassBackgroundImage","target","onerror","newValue","readOnly","scrollPaper","t","setStateBackgroundImage","getContent","copyToClipboard","Component","propTypes","PropTypes","func","lang","string","expertMode","bool","isRequired","_export","withWidth","withStyles"],"sources":["FileViewer.js"],"sourcesContent":["import React, { Component } from 'react';\nimport { withStyles } from '@mui/styles';\nimport PropTypes from 'prop-types';\n\nimport { Buffer } from 'buffer';\n\nimport TextField from '@mui/material/TextField';\nimport Button from '@mui/material/Button';\nimport Dialog from '@mui/material/Dialog';\nimport DialogActions from '@mui/material/DialogActions';\nimport DialogContent from '@mui/material/DialogContent';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport { IconButton } from '@mui/material';\n\nimport IconNoIcon from '../icons/IconNoIcon';\nimport withWidth from './withWidth';\nimport Utils from './Utils';\n\n// Icons\nimport { FaCopy as CopyIcon } from 'react-icons/fa';\nimport Brightness5Icon from '@mui/icons-material/Brightness6';\nimport CloseIcon from '@mui/icons-material/Close';\nimport SaveIcon from '@mui/icons-material/Save';\n\nconst styles = theme => ({\n dialog: {\n height: '100%',\n },\n paper: {\n height: 'calc(100% - 64px)',\n },\n content: {\n textAlign: 'center',\n },\n textarea: {\n width: '100%',\n height: '100%',\n },\n img: {\n width: 'auto',\n height: 'calc(100% - 5px)',\n objectFit: 'contain',\n },\n dialogTitle: {\n justifyContent: 'space-between',\n display: 'flex'\n }\n});\n\nexport const EXTENSIONS = {\n images: ['png', 'jpg', 'svg', 'jpeg', 'bmp'],\n code: ['js', 'json', 'json5', 'md'],\n txt: ['log', 'txt', 'html', 'css', 'xml'],\n audio: ['mp3', 'wav', 'ogg', 'acc'],\n video: ['mp4', 'mov', 'avi'],\n};\n\nfunction bufferToBase64(buffer) {\n let binary = '';\n let bytes = new Uint8Array(buffer);\n let len = bytes.byteLength;\n for (let i = 0; i < len && i < 50; i++) {\n binary += String.fromCharCode(bytes[i]);\n }\n return window.btoa(binary);\n}\n\n/**\n * @typedef {object} FileViewerProps\n * @property {import('../types').Translator} t Translation function\n * @property {ioBroker.Languages} [lang] The selected language.\n * @property {boolean} [expertMode] Is expert mode enabled? (default: false)\n * @property {() => void} onClose Callback when the viewer is closed.\n * @property {string} href The URL to the file to be displayed.\n *\n * @extends {React.Component<FileViewerProps>}\n */\nclass FileViewer extends Component {\n /**\n * @param {Readonly<FileViewerProps>} props\n */\n constructor(props) {\n super(props);\n const ext = Utils.getFileExtension(this.props.href);\n\n this.state = {\n text: null,\n code: null,\n ext,\n editing: !!this.props.formatEditFile || false,\n editingValue: null,\n copyPossible: EXTENSIONS.code.includes(ext) || EXTENSIONS.txt.includes(ext),\n forceUpdate: Date.now(),\n changed: false,\n imgError: false,\n };\n }\n\n readFile() {\n if (this.props.href) {\n const parts = this.props.href.split('/');\n parts.splice(0, 2);\n const adapter = parts[0];\n const name = parts.splice(1).join('/');\n\n this.props.socket.readFile(adapter, name)\n .then(data => {\n if (data.file !== undefined) {\n data = data.file;\n }\n\n const newState = {copyPossible: this.state.copyPossible};\n // try to detect valid extension\n if (data.type === 'Buffer') {\n const ext = Utils.detectMimeType(bufferToBase64(data.data));\n if (ext) {\n newState.ext = ext;\n newState.copyPossible = EXTENSIONS.code.includes(ext) || EXTENSIONS.txt.includes(ext);\n }\n }\n\n if (newState.copyPossible) {\n if (EXTENSIONS.txt.includes(this.state.ext)) {\n newState.text = data;\n newState.editingValue = data;\n } else if (EXTENSIONS.code.includes(this.state.ext)) {\n newState.code = data;\n newState.editingValue = data;\n }\n }\n\n this.setState(newState);\n })\n .catch(e => window.alert('Cannot read file: ' + e));\n }\n }\n\n componentDidMount() {\n this.readFile();\n\n const parts = this.props.href.split('/');\n parts.splice(0, 2);\n const adapter = parts[0];\n const name = parts.splice(1).join('/');\n\n this.props.supportSubscribes && this.props.socket.subscribeFiles(adapter, name, this.onFileChanged);\n }\n\n componentWillUnmount() {\n this.timeout && clearTimeout(this.timeout);\n const parts = this.props.href.split('/');\n parts.splice(0, 2);\n const adapter = parts[0];\n const name = parts.splice(1).join('/');\n this.props.supportSubscribes && this.props.socket.subscribeFiles(adapter, name, this.onFileChanged);\n }\n\n onFileChanged = (id, fileName, size) => {\n if (!this.state.changed) {\n this.timeout && clearTimeout(this.timeout);\n this.timeout = setTimeout(() => {\n this.timeout = null;\n if (size === null) {\n window.alert('Show file was deleted!');\n } else if (this.state.text !== null || this.state.code !== null) {\n this.readFile();\n } else {\n this.setState({ forceUpdate: Date.now() });\n }\n }, 300);\n }\n };\n\n writeFile64 = () => {\n const parts = this.props.href.split('/');\n const data = this.state.editingValue;\n parts.splice(0, 2);\n const adapter = parts[0];\n const name = parts.splice(1).join('/');\n this.props.socket.writeFile64(adapter, name, Buffer.from(data).toString('base64'))\n .then(_ => this.props.onClose())\n .catch(e => window.alert('Cannot write file: ' + e));\n }\n\n static getEditFile(ext) {\n switch (ext) {\n case 'json':\n return 'json';\n case 'json5':\n return 'json5';\n case 'js':\n return 'javascript';\n case 'html':\n return 'html';\n case 'txt':\n return 'html';\n default:\n return 'json';\n }\n }\n\n getContent() {\n if (EXTENSIONS.images.includes(this.state.ext)) {\n if (this.state.imgError) {\n return <IconNoIcon className={Utils.clsx(this.props.classes.img, this.props.getClassBackgroundImage())} />;\n } else {\n return <img\n onError={e => {\n e.target.onerror = null;\n this.setState({ imgError: true });\n }}\n className={Utils.clsx(this.props.classes.img, this.props.getClassBackgroundImage())}\n src={this.props.href + '?ts=' + this.state.forceUpdate}\n alt={this.props.href}\n />;\n }\n } else if (this.state.code !== null || this.state.text !== null || this.state.editing) {\n return <TextField\n variant=\"standard\"\n className={ this.props.classes.textarea }\n multiline\n value={ this.state.editingValue || this.state.code || this.state.text }\n onChange={newValue => this.setState({ editingValue: newValue, changed: true })}\n InputProps={{ readOnly: !this.state.editing }}\n />;\n }\n }\n\n render() {\n return <Dialog\n classes={{ scrollPaper: this.props.classes.dialog, paper: this.props.classes.paper }}\n scroll=\"paper\"\n open={!!this.props.href}\n onClose={() => this.props.onClose()}\n fullWidth={true}\n maxWidth=\"xl\"\n aria-labelledby=\"form-dialog-title\"\n >\n <div className={this.props.classes.dialogTitle}>\n <DialogTitle id=\"form-dialog-title\">{this.props.t(this.state.editing ? 'Edit' : 'View') + ': ' + this.props.href}</DialogTitle>\n {EXTENSIONS.images.includes(this.state.ext) && <div>\n <IconButton size=\"large\"\n color={'inherit'}\n onClick={this.props.setStateBackgroundImage}\n >\n <Brightness5Icon />\n </IconButton>\n </div>\n }\n </div>\n <DialogContent className={this.props.classes.content}>\n {this.getContent()}\n </DialogContent>\n <DialogActions>\n {this.state.copyPossible ?\n <Button\n color=\"grey\"\n onClick={e => Utils.copyToClipboard(this.state.text || this.state.code, e)}\n startIcon={<CopyIcon />}\n >\n {this.props.t('Copy content')}\n </Button> : null}\n {this.state.editing ?\n <Button\n color=\"grey\"\n disabled={this.state.editingValue === this.state.code || this.state.editingValue === this.state.text}\n variant=\"contained\"\n onClick={this.writeFile64}\n startIcon={<SaveIcon />}\n >\n {this.props.t('Save')}\n </Button> : null}\n <Button\n variant=\"contained\"\n onClick={() => this.props.onClose()}\n color=\"primary\"\n startIcon={<CloseIcon />}\n >\n {this.props.t('Close')}\n </Button>\n </DialogActions>\n </Dialog>;\n }\n}\n\nFileViewer.propTypes = {\n t: PropTypes.func,\n lang: PropTypes.string,\n expertMode: PropTypes.bool,\n onClose: PropTypes.func,\n href: PropTypes.string.isRequired,\n supportSubscribes: PropTypes.bool,\n};\n\n/** @type {typeof FileViewer} */\nconst _export = withWidth()(withStyles(styles)(FileViewer));\nexport default _export;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;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I,OAAO,OAAP;;QACJ,KAAK,IAAL;UACI,OAAO,YAAP;;QACJ,KAAK,MAAL;UACI,OAAO,MAAP;;QACJ,KAAK,KAAL;UACI,OAAO,MAAP;;QACJ;UACI,OAAO,MAAP;MAZR;IAcH;;;EA1HoB4B,gB;;AAgNzB/D,UAAU,CAACgE,SAAX,GAAuB;EACnBL,CAAC,EAAEM,qBAAA,CAAUC,IADM;EAEnBC,IAAI,EAAEF,qBAAA,CAAUG,MAFG;EAGnBC,UAAU,EAAEJ,qBAAA,CAAUK,IAHH;EAInBrC,OAAO,EAAEgC,qBAAA,CAAUC,IAJA;EAKnBhD,IAAI,EAAE+C,qBAAA,CAAUG,MAAV,CAAiBG,UALJ;EAMnBvB,iBAAiB,EAAEiB,qBAAA,CAAUK;AANV,CAAvB;AASA;;AACA,IAAME,OAAO,GAAG,IAAAC,qBAAA,IAAY,IAAAC,kBAAA,EAAW1G,MAAX,EAAmBgC,UAAnB,CAAZ,CAAhB;;eACewE,O"}
@@ -0,0 +1,21 @@
1
+ export function getSystemIcon(obj: any): JSX.Element;
2
+ export function getSelectIdIcon(obj: any, imagePrefix: any): string;
3
+ export default Icon;
4
+ declare class Icon extends React.Component<any, any, any> {
5
+ constructor(props: any);
6
+ constructor(props: any, context: any);
7
+ render(): any;
8
+ }
9
+ declare namespace Icon {
10
+ namespace propTypes {
11
+ const color: PropTypes.Requireable<string>;
12
+ const title: PropTypes.Requireable<string>;
13
+ const src: PropTypes.Validator<string | object>;
14
+ const className: PropTypes.Requireable<string>;
15
+ const imagePrefix: PropTypes.Requireable<string>;
16
+ const style: PropTypes.Requireable<object>;
17
+ const styleUTF8: PropTypes.Requireable<object>;
18
+ }
19
+ }
20
+ import React from "react";
21
+ import PropTypes from "prop-types";
@@ -0,0 +1,64 @@
1
+ export default IconPicker;
2
+ export type IconPickerProps = {
3
+ /**
4
+ * The value.
5
+ */
6
+ value?: string;
7
+ /**
8
+ * The label.
9
+ */
10
+ label?: string;
11
+ /**
12
+ * Set to true to disable the icon picker.
13
+ */
14
+ disabled?: boolean;
15
+ /**
16
+ * The icon change callback.
17
+ */
18
+ onChange: (icon: string) => void;
19
+ /**
20
+ * The socket connection.
21
+ */
22
+ socket: import('../Connection').default;
23
+ /**
24
+ * The image prefix (default: './files/')
25
+ */
26
+ imagePrefix?: string;
27
+ /**
28
+ * Additional styling for this component.
29
+ */
30
+ style?: React.CSSProperties;
31
+ /**
32
+ * The CSS class name.
33
+ */
34
+ className?: string;
35
+ };
36
+ /**
37
+ * @typedef {object} IconPickerProps
38
+ * @property {string} [value] The value.
39
+ * @property {string} [label] The label.
40
+ * @property {boolean} [disabled] Set to true to disable the icon picker.
41
+ * @property {(icon: string) => void} onChange The icon change callback.
42
+ * @property {import('../Connection').default} socket The socket connection.
43
+ * @property {string} [imagePrefix] The image prefix (default: './files/')
44
+ * @property {React.CSSProperties} [style] Additional styling for this component.
45
+ * @property {string} [className] The CSS class name.
46
+ *
47
+ * @extends {React.Component<IconPickerProps>}
48
+ */
49
+ declare function IconPicker(props: any): JSX.Element;
50
+ declare namespace IconPicker {
51
+ namespace propTypes {
52
+ const previewClassName: PropTypes.Requireable<string>;
53
+ const icon: PropTypes.Requireable<object>;
54
+ const customClasses: PropTypes.Requireable<object>;
55
+ const label: PropTypes.Requireable<string>;
56
+ const value: PropTypes.Requireable<any>;
57
+ const disabled: PropTypes.Requireable<boolean>;
58
+ const onChange: PropTypes.Validator<(...args: any[]) => any>;
59
+ const icons: PropTypes.Requireable<any[]>;
60
+ const onlyRooms: PropTypes.Requireable<boolean>;
61
+ const onlyDevices: PropTypes.Requireable<boolean>;
62
+ }
63
+ }
64
+ import PropTypes from "prop-types";
@@ -0,0 +1,25 @@
1
+ export default IconSelector;
2
+ declare class IconSelector extends React.Component<any, any, any> {
3
+ constructor(props: any);
4
+ state: {
5
+ opened: boolean;
6
+ names: any[];
7
+ filter: string;
8
+ icons: any;
9
+ };
10
+ loadAllIcons(): void;
11
+ render(): JSX.Element;
12
+ }
13
+ declare namespace IconSelector {
14
+ namespace propTypes {
15
+ const icons: PropTypes.Requireable<any[]>;
16
+ const onlyRooms: PropTypes.Requireable<boolean>;
17
+ const onlyDevices: PropTypes.Requireable<boolean>;
18
+ const onSelect: PropTypes.Requireable<(...args: any[]) => any>;
19
+ const onChange: PropTypes.Requireable<(...args: any[]) => any>;
20
+ const t: PropTypes.Validator<(...args: any[]) => any>;
21
+ const lang: PropTypes.Validator<string>;
22
+ }
23
+ }
24
+ import React from "react";
25
+ import PropTypes from "prop-types";
@@ -0,0 +1,64 @@
1
+ export default Image;
2
+ export type ImageProps = {
3
+ /**
4
+ * The color.
5
+ */
6
+ color?: string;
7
+ /**
8
+ * The source of the image.
9
+ */
10
+ src?: string;
11
+ /**
12
+ * The image prefix (default: './files/')
13
+ */
14
+ imagePrefix?: string;
15
+ /**
16
+ * The CSS class name.
17
+ */
18
+ className?: string;
19
+ /**
20
+ * Show image errors (or just show no image)?
21
+ */
22
+ showError?: boolean;
23
+ };
24
+ /**
25
+ * @typedef {object} ImageProps
26
+ * @property {string} [color] The color.
27
+ * @property {string} [src] The source of the image.
28
+ * @property {string} [imagePrefix] The image prefix (default: './files/')
29
+ * @property {string} [className] The CSS class name.
30
+ * @property {boolean} [showError] Show image errors (or just show no image)?
31
+ *
32
+ * @extends {React.Component<ImageProps>}
33
+ */
34
+ declare class Image extends React.Component<ImageProps, any, any> {
35
+ static getDerivedStateFromProps(props: any, state: any): {
36
+ src: any;
37
+ svg: any;
38
+ created: boolean;
39
+ color: any;
40
+ showError: any;
41
+ };
42
+ constructor(props: any);
43
+ state: {
44
+ svg: boolean;
45
+ created: boolean;
46
+ color: string;
47
+ src: string;
48
+ imgError: boolean;
49
+ showError: boolean;
50
+ };
51
+ svg: JSX.Element;
52
+ getSvgFromData(src: any): JSX.Element;
53
+ render(): JSX.Element;
54
+ }
55
+ declare namespace Image {
56
+ namespace propTypes {
57
+ const color: PropTypes.Requireable<string>;
58
+ const src: PropTypes.Validator<string>;
59
+ const className: PropTypes.Requireable<string>;
60
+ const imagePrefix: PropTypes.Requireable<string>;
61
+ }
62
+ }
63
+ import React from "react";
64
+ import PropTypes from "prop-types";
@@ -0,0 +1,13 @@
1
+ declare const _default: React.JSXElementConstructor<any>;
2
+ export default _default;
3
+ export function defaultChipRenderer({ value, text, isFocused, isDisabled, isReadOnly, handleClick, handleDelete, className }: {
4
+ value: any;
5
+ text: any;
6
+ isFocused: any;
7
+ isDisabled: any;
8
+ isReadOnly: any;
9
+ handleClick: any;
10
+ handleDelete: any;
11
+ className: any;
12
+ }, key: any): JSX.Element;
13
+ import React from "react";
@@ -0,0 +1,10 @@
1
+ declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
2
+ socket: PropTypes.Validator<object>;
3
+ data: PropTypes.Validator<object>;
4
+ schema: PropTypes.Requireable<object>;
5
+ adapterName: PropTypes.Requireable<string>;
6
+ instance: PropTypes.Requireable<number>;
7
+ }>, "classes"> & import("@mui/styles").StyledComponentProps<"root" | "notAlive"> & object>;
8
+ export default _default;
9
+ import PropTypes from "prop-types";
10
+ import React from "react";
@@ -0,0 +1,14 @@
1
+ declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
2
+ socket: PropTypes.Validator<object>;
3
+ themeType: PropTypes.Requireable<string>;
4
+ themeName: PropTypes.Requireable<string>;
5
+ style: PropTypes.Requireable<object>;
6
+ className: PropTypes.Requireable<string>;
7
+ data: PropTypes.Validator<object>;
8
+ schema: PropTypes.Requireable<object>;
9
+ onError: PropTypes.Requireable<(...args: any[]) => any>;
10
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
11
+ }>, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth"> & object>;
12
+ export default _default;
13
+ import PropTypes from "prop-types";
14
+ import React from "react";
@@ -0,0 +1,14 @@
1
+ declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
2
+ socket: PropTypes.Validator<object>;
3
+ themeType: PropTypes.Requireable<string>;
4
+ themeName: PropTypes.Requireable<string>;
5
+ style: PropTypes.Requireable<object>;
6
+ className: PropTypes.Requireable<string>;
7
+ data: PropTypes.Validator<object>;
8
+ schema: PropTypes.Requireable<object>;
9
+ onError: PropTypes.Requireable<(...args: any[]) => any>;
10
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
11
+ }>, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth"> & object>;
12
+ export default _default;
13
+ import PropTypes from "prop-types";
14
+ import React from "react";
@@ -0,0 +1,15 @@
1
+ declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
2
+ themeType: PropTypes.Requireable<string>;
3
+ themeName: PropTypes.Requireable<string>;
4
+ style: PropTypes.Requireable<object>;
5
+ className: PropTypes.Requireable<string>;
6
+ data: PropTypes.Validator<object>;
7
+ schema: PropTypes.Requireable<object>;
8
+ onError: PropTypes.Requireable<(...args: any[]) => any>;
9
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
10
+ dateFormat: PropTypes.Requireable<string>;
11
+ isFloatComma: PropTypes.Requireable<boolean>;
12
+ }>, "classes"> & import("@mui/styles").StyledComponentProps<"button" | "flex" | "fullWidth"> & object>;
13
+ export default _default;
14
+ import PropTypes from "prop-types";
15
+ import React from "react";
@@ -0,0 +1,14 @@
1
+ declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
2
+ socket: PropTypes.Validator<object>;
3
+ themeType: PropTypes.Requireable<string>;
4
+ themeName: PropTypes.Requireable<string>;
5
+ style: PropTypes.Requireable<object>;
6
+ className: PropTypes.Requireable<string>;
7
+ data: PropTypes.Validator<object>;
8
+ schema: PropTypes.Requireable<object>;
9
+ onError: PropTypes.Requireable<(...args: any[]) => any>;
10
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
11
+ }>, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth"> & object>;
12
+ export default _default;
13
+ import PropTypes from "prop-types";
14
+ import React from "react";
@@ -0,0 +1,14 @@
1
+ declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
2
+ socket: PropTypes.Validator<object>;
3
+ themeType: PropTypes.Requireable<string>;
4
+ themeName: PropTypes.Requireable<string>;
5
+ style: PropTypes.Requireable<object>;
6
+ className: PropTypes.Requireable<string>;
7
+ data: PropTypes.Validator<object>;
8
+ schema: PropTypes.Requireable<object>;
9
+ onError: PropTypes.Requireable<(...args: any[]) => any>;
10
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
11
+ }>, "classes"> & import("@mui/styles").StyledComponentProps<"error"> & object>;
12
+ export default _default;
13
+ import PropTypes from "prop-types";
14
+ import React from "react";
@@ -0,0 +1,14 @@
1
+ declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
2
+ socket: PropTypes.Validator<object>;
3
+ themeType: PropTypes.Requireable<string>;
4
+ themeName: PropTypes.Requireable<string>;
5
+ style: PropTypes.Requireable<object>;
6
+ className: PropTypes.Requireable<string>;
7
+ data: PropTypes.Validator<object>;
8
+ schema: PropTypes.Requireable<object>;
9
+ onError: PropTypes.Requireable<(...args: any[]) => any>;
10
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
11
+ }>, "classes"> & import("@mui/styles").StyledComponentProps<"fullWidth"> & object>;
12
+ export default _default;
13
+ import PropTypes from "prop-types";
14
+ import React from "react";
@@ -0,0 +1,14 @@
1
+ declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
2
+ socket: PropTypes.Validator<object>;
3
+ themeType: PropTypes.Requireable<string>;
4
+ themeName: PropTypes.Requireable<string>;
5
+ style: PropTypes.Requireable<object>;
6
+ className: PropTypes.Requireable<string>;
7
+ data: PropTypes.Validator<object>;
8
+ schema: PropTypes.Requireable<object>;
9
+ onError: PropTypes.Requireable<(...args: any[]) => any>;
10
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
11
+ }>, "classes"> & import("@mui/styles").StyledComponentProps<never> & object>;
12
+ export default _default;
13
+ import PropTypes from "prop-types";
14
+ import React from "react";
@@ -0,0 +1,14 @@
1
+ declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
2
+ socket: PropTypes.Validator<object>;
3
+ themeType: PropTypes.Requireable<string>;
4
+ themeName: PropTypes.Requireable<string>;
5
+ style: PropTypes.Requireable<object>;
6
+ className: PropTypes.Requireable<string>;
7
+ data: PropTypes.Validator<object>;
8
+ schema: PropTypes.Requireable<object>;
9
+ onError: PropTypes.Requireable<(...args: any[]) => any>;
10
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
11
+ }>, "classes"> & import("@mui/styles").StyledComponentProps<"width"> & object>;
12
+ export default _default;
13
+ import PropTypes from "prop-types";
14
+ import React from "react";
@@ -0,0 +1,26 @@
1
+ export default ConfigCustom;
2
+ declare class ConfigCustom extends React.Component<any, any, any> {
3
+ constructor(props: any);
4
+ state: {
5
+ Component: any;
6
+ error: string;
7
+ };
8
+ componentDidMount(): Promise<void>;
9
+ render(): JSX.Element;
10
+ }
11
+ declare namespace ConfigCustom {
12
+ namespace propTypes {
13
+ const socket: PropTypes.Requireable<object>;
14
+ const themeType: PropTypes.Requireable<string>;
15
+ const themeName: PropTypes.Requireable<string>;
16
+ const style: PropTypes.Requireable<object>;
17
+ const className: PropTypes.Requireable<string>;
18
+ const attr: PropTypes.Requireable<string>;
19
+ const data: PropTypes.Validator<object>;
20
+ const schema: PropTypes.Validator<object>;
21
+ const onError: PropTypes.Requireable<(...args: any[]) => any>;
22
+ const onChange: PropTypes.Requireable<(...args: any[]) => any>;
23
+ }
24
+ }
25
+ import React from "react";
26
+ import PropTypes from "prop-types";
@@ -0,0 +1,14 @@
1
+ declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
2
+ socket: PropTypes.Validator<object>;
3
+ themeType: PropTypes.Requireable<string>;
4
+ themeName: PropTypes.Requireable<string>;
5
+ style: PropTypes.Requireable<object>;
6
+ className: PropTypes.Requireable<string>;
7
+ data: PropTypes.Validator<object>;
8
+ schema: PropTypes.Requireable<object>;
9
+ onError: PropTypes.Requireable<(...args: any[]) => any>;
10
+ onChange: PropTypes.Requireable<(...args: any[]) => any>;
11
+ }>, "classes"> & import("@mui/styles").StyledComponentProps<"indeterminate"> & object>;
12
+ export default _default;
13
+ import PropTypes from "prop-types";
14
+ import React from "react";