@iobroker/adapter-react-v5 3.1.3 → 3.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/Components/FileBrowser.js +277 -237
  2. package/Components/FileBrowser.js.map +1 -1
  3. package/Components/FileViewer.js +3 -1
  4. package/Components/FileViewer.js.map +1 -1
  5. package/Components/JsonConfigComponent/ConfigAutocomplete.js +5 -3
  6. package/Components/JsonConfigComponent/ConfigAutocomplete.js.map +1 -1
  7. package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js +5 -3
  8. package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +1 -1
  9. package/Components/JsonConfigComponent/ConfigCertificateSelect.js +16 -2
  10. package/Components/JsonConfigComponent/ConfigCertificateSelect.js.map +1 -1
  11. package/Components/JsonConfigComponent/ConfigCustom.js +148 -25
  12. package/Components/JsonConfigComponent/ConfigCustom.js.map +1 -1
  13. package/Components/JsonConfigComponent/ConfigFile.js +183 -0
  14. package/Components/JsonConfigComponent/ConfigFile.js.map +1 -0
  15. package/Components/JsonConfigComponent/ConfigFileSelector.js +747 -0
  16. package/Components/JsonConfigComponent/ConfigFileSelector.js.map +1 -0
  17. package/Components/JsonConfigComponent/ConfigGeneric.js +105 -20
  18. package/Components/JsonConfigComponent/ConfigGeneric.js.map +1 -1
  19. package/Components/JsonConfigComponent/ConfigInstanceSelect.js +132 -46
  20. package/Components/JsonConfigComponent/ConfigInstanceSelect.js.map +1 -1
  21. package/Components/JsonConfigComponent/ConfigLanguage.js +25 -1
  22. package/Components/JsonConfigComponent/ConfigLanguage.js.map +1 -1
  23. package/Components/JsonConfigComponent/ConfigNumber.js +5 -4
  24. package/Components/JsonConfigComponent/ConfigNumber.js.map +1 -1
  25. package/Components/JsonConfigComponent/ConfigObjectId.js +3 -2
  26. package/Components/JsonConfigComponent/ConfigObjectId.js.map +1 -1
  27. package/Components/JsonConfigComponent/ConfigPanel.js +51 -40
  28. package/Components/JsonConfigComponent/ConfigPanel.js.map +1 -1
  29. package/Components/JsonConfigComponent/ConfigPattern.js +1 -1
  30. package/Components/JsonConfigComponent/ConfigPattern.js.map +1 -1
  31. package/Components/JsonConfigComponent/ConfigSelect.js +4 -2
  32. package/Components/JsonConfigComponent/ConfigSelect.js.map +1 -1
  33. package/Components/JsonConfigComponent/ConfigSendto.js +2 -2
  34. package/Components/JsonConfigComponent/ConfigSendto.js.map +1 -1
  35. package/Components/JsonConfigComponent/ConfigSetState.js +2 -2
  36. package/Components/JsonConfigComponent/ConfigSetState.js.map +1 -1
  37. package/Components/JsonConfigComponent/ConfigStaticHeader.js +31 -8
  38. package/Components/JsonConfigComponent/ConfigStaticHeader.js.map +1 -1
  39. package/Components/JsonConfigComponent/ConfigStaticImage.js +1 -1
  40. package/Components/JsonConfigComponent/ConfigStaticImage.js.map +1 -1
  41. package/Components/JsonConfigComponent/ConfigTable.js +1 -1
  42. package/Components/JsonConfigComponent/ConfigTable.js.map +1 -1
  43. package/Components/JsonConfigComponent/ConfigTabs.js +12 -3
  44. package/Components/JsonConfigComponent/ConfigTabs.js.map +1 -1
  45. package/Components/JsonConfigComponent/ConfigText.js +4 -2
  46. package/Components/JsonConfigComponent/ConfigText.js.map +1 -1
  47. package/Components/JsonConfigComponent/ConfigTopic.js.map +1 -1
  48. package/Components/JsonConfigComponent/index.js +12 -4
  49. package/Components/JsonConfigComponent/index.js.map +1 -1
  50. package/Components/ObjectBrowser.js +228 -222
  51. package/Components/ObjectBrowser.js.map +1 -1
  52. package/Components/TableResize.js +34 -16
  53. package/Components/TableResize.js.map +1 -1
  54. package/Components/TreeTable.js +2 -2
  55. package/Components/TreeTable.js.map +1 -1
  56. package/Components/Utils.js +5 -5
  57. package/Components/Utils.js.map +1 -1
  58. package/Dialogs/Confirm.js +3 -3
  59. package/Dialogs/Confirm.js.map +1 -1
  60. package/Dialogs/FileSelect.js +259 -0
  61. package/Dialogs/FileSelect.js.map +1 -0
  62. package/Dialogs/SelectID.js +15 -16
  63. package/Dialogs/SelectID.js.map +1 -1
  64. package/GenericApp.js +3 -3
  65. package/GenericApp.js.map +1 -1
  66. package/README.md +3 -0
  67. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"Confirm.js","names":["styles","suppress","fontSize","suppressRoot","marginTop","DialogConfirm","props","dialogName","suppressQuestionMinutes","Error","parseInt","window","localStorage","getItem","Date","now","removeItem","state","setItem","onClose","setTimeout","event","reason","handleCancel","title","I18n","t","icon","text","label","classes","root","setState","suppressText","handleOk","ok","cancel","React","Component","propTypes","PropTypes","func","isRequired","string","object","number","_export","withStyles"],"sources":["Confirm.js"],"sourcesContent":["/**\n * Copyright 2019-2022 bluefox <dogafox@gmail.com>\n *\n * MIT License\n *\n **/\n\n// please do not delete React, as without it other projects could not be compiled: ReferenceError: React is not defined\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport withStyles from '@mui/styles/withStyles';\n\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 DialogContentText from '@mui/material/DialogContentText';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport FormControlLabel from '@mui/material/FormControlLabel';\nimport Checkbox from '@mui/material/Checkbox';\n\nimport IconCheck from '@mui/icons-material/Check';\nimport IconClose from '@mui/icons-material/Close';\n\nimport I18n from '../i18n';\n\nconst styles = {\n suppress: {\n fontSize: 12,\n },\n suppressRoot: {\n marginTop: 16\n }\n};\n\n/**\n * @typedef {object} DialogConfirmProps\n * @property {string} [key] The key to identify this component.\n * @property {string} [title] The dialog title; default: Are you sure? (translated)\n * @property {string} text The dialog text.\n * @property {string} [ok] The ok button text; default: OK (translated)\n * @property {string} [cancel] The cancel button text; default: Cancel (translated)\n * @property {string} [suppressQuestionMinutes] interval in minutes for which the confirm dialog will be suppressed if activated.\n * @property {string} [suppressText] The suppress checkbox text; default: Suppress question for next %s minutes (translated)\n * @property {string} [dialogName] Name of the dialog. Used only with suppressQuestionMinutes to store the user choice\n * @property {(ok: boolean) => void} [onClose] Close handler.\n *\n * @extends {React.Component<DialogConfirmProps>}\n */\nclass DialogConfirm extends React.Component {\n constructor(props) {\n super(props);\n\n if (!this.props.dialogName && this.props.suppressQuestionMinutes) {\n throw new Error('dialogName required if suppressQuestionMinutes used');\n }\n let suppress = false;\n\n if (this.props.suppressQuestionMinutes) {\n suppress = parseInt(window.localStorage.getItem(this.props.dialogName), 10) || 0;\n\n if (!suppress) {\n suppress = false;\n } else if (Date.now() > suppress) {\n window.localStorage.removeItem(this.props.dialogName);\n suppress = false;\n }\n }\n\n this.state = {\n suppress,\n };\n }\n\n handleOk() {\n if (this.state.suppress) {\n window.localStorage.setItem(this.props.dialogName, Date.now() + this.props.suppressQuestionMinutes * 60000);\n }\n this.props.onClose && this.props.onClose(true);\n };\n\n handleCancel() {\n this.props.onClose && this.props.onClose(false);\n };\n\n render() {\n if (typeof this.state.suppress === 'number') {\n setTimeout(() => this.props.onClose && this.props.onClose(true), 100);\n return null;\n }\n\n return <Dialog\n open={true}\n maxWidth=\"md\"\n fullWidth={true}\n onClose={(event, reason) => {\n if (reason !== 'backdropClick' && reason !== 'escapeKeyDown') {\n this.handleCancel()\n }\n }}\n aria-labelledby=\"confirmation-dialog-title\"\n aria-describedby=\"confirmation-dialog-description\"\n >\n <DialogTitle id=\"confirmation-dialog-title\">{this.props.title || I18n.t('ra_Are you sure?')}</DialogTitle>\n <DialogContent>\n <DialogContentText id=\"confirmation-dialog-description\">\n {this.props.icon || null}\n {this.props.text}\n {this.props.suppressQuestionMinutes ? <br/> : null}\n {this.props.suppressQuestionMinutes ?\n <FormControlLabel\n classes={{label: this.props.classes.suppress, root: this.props.classes.suppressRoot}}\n control={<Checkbox checked={!!this.state.suppress} onChange={() => this.setState({suppress: !this.state.suppress})} />}\n label={this.props.suppressText || I18n.t('ra_Suppress question for next %s minutes', this.props.suppressQuestionMinutes)}\n /> :\n null}\n </DialogContentText>\n </DialogContent>\n <DialogActions>\n <Button variant=\"contained\" onClick={() => this.handleOk()} color=\"primary\" autoFocus startIcon={<IconCheck />}>{this.props.ok || I18n.t('ra_Ok')}</Button>\n <Button variant=\"contained\" onClick={() => this.handleCancel()} color=\"grey\" startIcon={<IconClose />}>{this.props.cancel || I18n.t('ra_Cancel')}</Button>\n </DialogActions>\n </Dialog>;\n }\n}\n\nDialogConfirm.propTypes = {\n onClose: PropTypes.func.isRequired,\n title: PropTypes.string,\n text: PropTypes.string,\n ok: PropTypes.string,\n cancel: PropTypes.string,\n icon: PropTypes.object,\n suppressQuestionMinutes: PropTypes.number,\n suppressText: PropTypes.string,\n dialogName: PropTypes.string,\n};\n\nconst _export = withStyles(styles)(DialogConfirm);\nexport default _export;"],"mappings":";;;;;;;;;;;;;;;;;;;AAQA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;;;;;AAEA,IAAMA,MAAM,GAAG;EACXC,QAAQ,EAAE;IACNC,QAAQ,EAAE;EADJ,CADC;EAIXC,YAAY,EAAE;IACVC,SAAS,EAAE;EADD;AAJH,CAAf;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;IACMC,a;;;;;EACF,uBAAYC,KAAZ,EAAmB;IAAA;;IAAA;IACf,0BAAMA,KAAN;;IAEA,IAAI,CAAC,MAAKA,KAAL,CAAWC,UAAZ,IAA0B,MAAKD,KAAL,CAAWE,uBAAzC,EAAkE;MAC9D,MAAM,IAAIC,KAAJ,CAAU,qDAAV,CAAN;IACH;;IACD,IAAIR,QAAQ,GAAG,KAAf;;IAEA,IAAI,MAAKK,KAAL,CAAWE,uBAAf,EAAwC;MACpCP,QAAQ,GAAGS,QAAQ,CAACC,MAAM,CAACC,YAAP,CAAoBC,OAApB,CAA4B,MAAKP,KAAL,CAAWC,UAAvC,CAAD,EAAqD,EAArD,CAAR,IAAoE,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C,iBAAD;MAAjG,GAAiH,KAAK5B,KAAL,CAAW6B,EAAX,IAAiBV,gBAAA,CAAKC,CAAL,CAAO,OAAP,CAAlI,CADJ,eAEI,gCAAC,kBAAD;QAAQ,OAAO,EAAC,WAAhB;QAA4B,OAAO,EAAE;UAAA,OAAM,MAAI,CAACH,YAAL,EAAN;QAAA,CAArC;QAAgE,KAAK,EAAC,MAAtE;QAA6E,SAAS,eAAE,gCAAC,iBAAD;MAAxF,GAAwG,KAAKjB,KAAL,CAAW8B,MAAX,IAAqBX,gBAAA,CAAKC,CAAL,CAAO,WAAP,CAA7H,CAFJ,CA3BG,CAAP;IAgCH;;;EA1EuBW,iBAAA,CAAMC,S;;AA6ElCjC,aAAa,CAACkC,SAAd,GAA0B;EACtBpB,OAAO,EAAEqB,qBAAA,CAAUC,IAAV,CAAeC,UADF;EAEtBlB,KAAK,EAAEgB,qBAAA,CAAUG,MAFK;EAGtBf,IAAI,EAAEY,qBAAA,CAAUG,MAHM;EAItBR,EAAE,EAAEK,qBAAA,CAAUG,MAJQ;EAKtBP,MAAM,EAAEI,qBAAA,CAAUG,MALI;EAMtBhB,IAAI,EAAEa,qBAAA,CAAUI,MANM;EAOtBpC,uBAAuB,EAAEgC,qBAAA,CAAUK,MAPb;EAQtBZ,YAAY,EAAEO,qBAAA,CAAUG,MARF;EAStBpC,UAAU,EAAEiC,qBAAA,CAAUG;AATA,CAA1B;;AAYA,IAAMG,OAAO,GAAG,IAAAC,sBAAA,EAAW/C,MAAX,EAAmBK,aAAnB,CAAhB;;eACeyC,O"}
1
+ {"version":3,"file":"Confirm.js","names":["styles","suppress","fontSize","suppressRoot","marginTop","DialogConfirm","props","dialogName","suppressQuestionMinutes","Error","parseInt","window","_localStorage","localStorage","getItem","Date","now","removeItem","state","setItem","onClose","setTimeout","event","reason","handleCancel","title","I18n","t","icon","text","label","classes","root","setState","suppressText","handleOk","ok","cancel","React","Component","propTypes","PropTypes","func","isRequired","string","object","number","_export","withStyles"],"sources":["Confirm.js"],"sourcesContent":["/**\n * Copyright 2019-2022 bluefox <dogafox@gmail.com>\n *\n * MIT License\n *\n **/\n\n// please do not delete React, as without it other projects could not be compiled: ReferenceError: React is not defined\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport withStyles from '@mui/styles/withStyles';\n\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 DialogContentText from '@mui/material/DialogContentText';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport FormControlLabel from '@mui/material/FormControlLabel';\nimport Checkbox from '@mui/material/Checkbox';\n\nimport IconCheck from '@mui/icons-material/Check';\nimport IconClose from '@mui/icons-material/Close';\n\nimport I18n from '../i18n';\n\nconst styles = {\n suppress: {\n fontSize: 12,\n },\n suppressRoot: {\n marginTop: 16\n }\n};\n\n/**\n * @typedef {object} DialogConfirmProps\n * @property {string} [key] The key to identify this component.\n * @property {string} [title] The dialog title; default: Are you sure? (translated)\n * @property {string} text The dialog text.\n * @property {string} [ok] The ok button text; default: OK (translated)\n * @property {string} [cancel] The cancel button text; default: Cancel (translated)\n * @property {string} [suppressQuestionMinutes] interval in minutes for which the confirm dialog will be suppressed if activated.\n * @property {string} [suppressText] The suppress checkbox text; default: Suppress question for next %s minutes (translated)\n * @property {string} [dialogName] Name of the dialog. Used only with suppressQuestionMinutes to store the user choice\n * @property {(ok: boolean) => void} [onClose] Close handler.\n *\n * @extends {React.Component<DialogConfirmProps>}\n */\nclass DialogConfirm extends React.Component {\n constructor(props) {\n super(props);\n\n if (!this.props.dialogName && this.props.suppressQuestionMinutes) {\n throw new Error('dialogName required if suppressQuestionMinutes used');\n }\n let suppress = false;\n\n if (this.props.suppressQuestionMinutes) {\n suppress = parseInt((window._localStorage || window.localStorage).getItem(this.props.dialogName), 10) || 0;\n\n if (!suppress) {\n suppress = false;\n } else if (Date.now() > suppress) {\n (window._localStorage || window.localStorage).removeItem(this.props.dialogName);\n suppress = false;\n }\n }\n\n this.state = {\n suppress,\n };\n }\n\n handleOk() {\n if (this.state.suppress) {\n (window._localStorage || window.localStorage).setItem(this.props.dialogName, Date.now() + this.props.suppressQuestionMinutes * 60000);\n }\n this.props.onClose && this.props.onClose(true);\n };\n\n handleCancel() {\n this.props.onClose && this.props.onClose(false);\n };\n\n render() {\n if (typeof this.state.suppress === 'number') {\n setTimeout(() => this.props.onClose && this.props.onClose(true), 100);\n return null;\n }\n\n return <Dialog\n open={true}\n maxWidth=\"md\"\n fullWidth={true}\n onClose={(event, reason) => {\n if (reason !== 'backdropClick' && reason !== 'escapeKeyDown') {\n this.handleCancel()\n }\n }}\n aria-labelledby=\"confirmation-dialog-title\"\n aria-describedby=\"confirmation-dialog-description\"\n >\n <DialogTitle id=\"confirmation-dialog-title\">{this.props.title || I18n.t('ra_Are you sure?')}</DialogTitle>\n <DialogContent>\n <DialogContentText id=\"confirmation-dialog-description\">\n {this.props.icon || null}\n {this.props.text}\n {this.props.suppressQuestionMinutes ? <br/> : null}\n {this.props.suppressQuestionMinutes ?\n <FormControlLabel\n classes={{label: this.props.classes.suppress, root: this.props.classes.suppressRoot}}\n control={<Checkbox checked={!!this.state.suppress} onChange={() => this.setState({suppress: !this.state.suppress})} />}\n label={this.props.suppressText || I18n.t('ra_Suppress question for next %s minutes', this.props.suppressQuestionMinutes)}\n /> :\n null}\n </DialogContentText>\n </DialogContent>\n <DialogActions>\n <Button variant=\"contained\" onClick={() => this.handleOk()} color=\"primary\" autoFocus startIcon={<IconCheck />}>{this.props.ok || I18n.t('ra_Ok')}</Button>\n <Button variant=\"contained\" onClick={() => this.handleCancel()} color=\"grey\" startIcon={<IconClose />}>{this.props.cancel || I18n.t('ra_Cancel')}</Button>\n </DialogActions>\n </Dialog>;\n }\n}\n\nDialogConfirm.propTypes = {\n onClose: PropTypes.func.isRequired,\n title: PropTypes.string,\n text: PropTypes.string,\n ok: PropTypes.string,\n cancel: PropTypes.string,\n icon: PropTypes.object,\n suppressQuestionMinutes: PropTypes.number,\n suppressText: PropTypes.string,\n dialogName: PropTypes.string,\n};\n\nconst _export = withStyles(styles)(DialogConfirm);\nexport default _export;"],"mappings":";;;;;;;;;;;;;;;;;;;AAQA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;;;;;AAEA,IAAMA,MAAM,GAAG;EACXC,QAAQ,EAAE;IACNC,QAAQ,EAAE;EADJ,CADC;EAIXC,YAAY,EAAE;IACVC,SAAS,EAAE;EADD;AAJH,CAAf;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;IACMC,a;;;;;EACF,uBAAYC,KAAZ,EAAmB;IAAA;;IAAA;IACf,0BAAMA,KAAN;;IAEA,IAAI,CAAC,MAAKA,KAAL,CAAWC,UAAZ,IAA0B,MAAKD,KAAL,CAAWE,uBAAzC,EAAkE;MAC9D,MAAM,IAAIC,KAAJ,CAAU,qDAAV,CAAN;IACH;;IACD,IAAIR,QAAQ,GAAG,KAAf;;IAEA,IAAI,MAAKK,KAAL,CAAWE,uBAAf,EAAwC;MACpCP,QAAQ,GAAGS,QAAQ,CAAC,CAACC,MAAM,CAACC,aAAP,IAAwBD,MAAM,CAACE,YAAhC,EAA8CC,OAA9C,CAAsD,MAAKR,KAAL,CAAWC,UAAjE,CAAD,EAA+E,EAA/E,CAAR,IAA8F,CAAzG;;MAEA,IAAI,CAACN,QAAL,EAAe;QACXA,QAAQ,GAAG,KAAX;MACH,CAFD,MAEO,IAAIc,IAAI,CAACC,GAAL,KAAaf,QAAjB,EAA2B;QAC9B,CAACU,MAAM,CAACC,aAAP,IAAwBD,MAAM,CAACE,YAAhC,EAA8CI,UAA9C,CAAyD,MAAKX,KAAL,CAAWC,UAApE;QACAN,QAAQ,GAAG,KAAX;MACH;IACJ;;IAED,MAAKiB,KAAL,GAAa;MACTjB,QAAQ,EAARA;IADS,CAAb;IAnBe;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AAC,iBAAD;MAAxF,GAAwG,KAAKlB,KAAL,CAAW+B,MAAX,IAAqBX,gBAAA,CAAKC,CAAL,CAAO,WAAP,CAA7H,CAFJ,CA3BG,CAAP;IAgCH;;;EA1EuBW,iBAAA,CAAMC,S;;AA6ElClC,aAAa,CAACmC,SAAd,GAA0B;EACtBpB,OAAO,EAAEqB,qBAAA,CAAUC,IAAV,CAAeC,UADF;EAEtBlB,KAAK,EAAEgB,qBAAA,CAAUG,MAFK;EAGtBf,IAAI,EAAEY,qBAAA,CAAUG,MAHM;EAItBR,EAAE,EAAEK,qBAAA,CAAUG,MAJQ;EAKtBP,MAAM,EAAEI,qBAAA,CAAUG,MALI;EAMtBhB,IAAI,EAAEa,qBAAA,CAAUI,MANM;EAOtBrC,uBAAuB,EAAEiC,qBAAA,CAAUK,MAPb;EAQtBZ,YAAY,EAAEO,qBAAA,CAAUG,MARF;EAStBrC,UAAU,EAAEkC,qBAAA,CAAUG;AATA,CAA1B;;AAYA,IAAMG,OAAO,GAAG,IAAAC,sBAAA,EAAWhD,MAAX,EAAmBK,aAAnB,CAAhB;;eACe0C,O"}
@@ -0,0 +1,259 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+
10
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
11
+
12
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
13
+
14
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
15
+
16
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
17
+
18
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
19
+
20
+ var _react = _interopRequireDefault(require("react"));
21
+
22
+ var _propTypes = _interopRequireDefault(require("prop-types"));
23
+
24
+ var _withStyles = _interopRequireDefault(require("@mui/styles/withStyles"));
25
+
26
+ var _Button = _interopRequireDefault(require("@mui/material/Button"));
27
+
28
+ var _DialogTitle = _interopRequireDefault(require("@mui/material/DialogTitle"));
29
+
30
+ var _DialogContent = _interopRequireDefault(require("@mui/material/DialogContent"));
31
+
32
+ var _DialogActions = _interopRequireDefault(require("@mui/material/DialogActions"));
33
+
34
+ var _Dialog = _interopRequireDefault(require("@mui/material/Dialog"));
35
+
36
+ var _Cancel = _interopRequireDefault(require("@mui/icons-material/Cancel"));
37
+
38
+ var _Check = _interopRequireDefault(require("@mui/icons-material/Check"));
39
+
40
+ var _i18n = _interopRequireDefault(require("../i18n"));
41
+
42
+ var _Utils = _interopRequireDefault(require("../Components/Utils"));
43
+
44
+ var _FileBrowser = _interopRequireDefault(require("../Components/FileBrowser"));
45
+
46
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
47
+
48
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
49
+
50
+ var styles = function styles(theme) {
51
+ return {
52
+ headerID: {
53
+ fontWeight: 'bold',
54
+ fontStyle: 'italic'
55
+ },
56
+ dialog: {
57
+ height: '95%'
58
+ },
59
+ dialogMobile: {
60
+ padding: 4,
61
+ width: '100%',
62
+ maxWidth: '100%',
63
+ maxHeight: 'calc(100% - 16px)',
64
+ height: '100%'
65
+ },
66
+ content: {
67
+ height: '100%',
68
+ overflow: 'hidden'
69
+ },
70
+ contentMobile: {
71
+ padding: '8px 4px'
72
+ },
73
+ titleRoot: {
74
+ whiteSpace: 'nowrap',
75
+ width: 'calc(100% - 72px)',
76
+ overflow: 'hidden',
77
+ display: 'inline-block',
78
+ textOverflow: 'ellipsis'
79
+ }
80
+ };
81
+ };
82
+ /**
83
+ * @typedef {object} FileSelectDialogProps
84
+ * @property {string} [dialogName] The internal name of the dialog; default: "default"
85
+ * @property {string} [title] The dialog title; default: Please select object ID... (translated)
86
+ * @property {string} [imagePrefix] Prefix (default: '.')
87
+ * @property {boolean} [dialogName] PropTypes.string, // where to store settings in localStorage
88
+ * @property {boolean} [selected] Pre-selected file
89
+ * @property {() => void} onClose Close handler that is always called when the dialog is closed.
90
+ * @property {(selected: string | undefined) => void} onOk Handler that is called when the user presses OK.
91
+ * @property {string} [ok] The ok button text; default: OK (translated)
92
+ * @property {string} [cancel] The cancel button text; default: Cancel (translated)
93
+ * @property {boolean} [socket] Socket class (required)
94
+ * @property {boolean} [allowUpload] If download of files enabled
95
+ * @property {boolean} [allowDownload] If download of files enabled
96
+ * @property {boolean} [allowCreateFolder] If creation of folders enabled
97
+ * @property {boolean} [allowDelete] If creation of folders enabled
98
+ * @property {boolean} [allowView] if tile view enabled (default true)
99
+ * @property {boolean} [showToolbar] Show toolbar (default true)
100
+ * @property {array} [limitPath] Limit file browser to one specific objectID of type meta and following path (like vis.0/main)
101
+ * @property {array} [filterFiles] like `['png', 'svg', 'bmp', 'jpg', 'jpeg']`
102
+ * @property {string} [filterByType] images, code, txt, audio, video
103
+ * @property {bool} [selectOnlyFolders] allow only folders selection
104
+ *
105
+ * @extends {React.Component<FileSelectDialogProps>}
106
+ */
107
+
108
+
109
+ var DialogFileSelect = /*#__PURE__*/function (_React$Component) {
110
+ (0, _inherits2["default"])(DialogFileSelect, _React$Component);
111
+
112
+ var _super = _createSuper(DialogFileSelect);
113
+
114
+ /**
115
+ * @param {FileSelectDialogProps} props
116
+ */
117
+ function DialogFileSelect(props) {
118
+ var _this;
119
+
120
+ (0, _classCallCheck2["default"])(this, DialogFileSelect);
121
+ _this = _super.call(this, props);
122
+ _this.dialogName = _this.props.dialogName || 'default';
123
+ _this.dialogName = 'FileSelect.' + _this.dialogName;
124
+ _this.filters = (window._localStorage || window.localStorage).getItem(_this.dialogName) || '{}';
125
+
126
+ try {
127
+ _this.filters = JSON.parse(_this.filters);
128
+ } catch (e) {
129
+ _this.filters = {};
130
+ }
131
+
132
+ _this.state = {
133
+ selected: _this.props.selected || '',
134
+ isFolder: false,
135
+ name: '',
136
+ isMobile: window.innerWidth < 800
137
+ };
138
+ return _this;
139
+ }
140
+
141
+ (0, _createClass2["default"])(DialogFileSelect, [{
142
+ key: "handleCancel",
143
+ value: function handleCancel() {
144
+ this.props.onClose();
145
+ }
146
+ }, {
147
+ key: "handleOk",
148
+ value: function handleOk() {
149
+ this.props.onOk(this.state.selected || '');
150
+ this.props.onClose();
151
+ }
152
+ }, {
153
+ key: "render",
154
+ value: function render() {
155
+ var _this2 = this;
156
+
157
+ var title;
158
+
159
+ if (this.state.name || this.state.selected.length) {
160
+ title = [/*#__PURE__*/_react["default"].createElement("span", {
161
+ key: "selected"
162
+ }, _i18n["default"].t('ra_Selected'), " "), /*#__PURE__*/_react["default"].createElement("span", {
163
+ key: "id",
164
+ className: this.props.classes.headerID
165
+ }, this.state.selected)];
166
+ } else {
167
+ title = this.props.title || _i18n["default"].t('ra_Please select file...');
168
+ }
169
+
170
+ return /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
171
+ onClose: function onClose() {},
172
+ maxWidth: false,
173
+ classes: {
174
+ paper: _Utils["default"].clsx(this.props.classes.dialog, this.props.classes.dialogMobile)
175
+ },
176
+ fullWidth: true,
177
+ open: true,
178
+ "aria-labelledby": "file-dialog-title"
179
+ }, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], {
180
+ id: "file-dialog-title",
181
+ classes: {
182
+ root: this.props.classes.titleRoot
183
+ }
184
+ }, title), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], {
185
+ className: _Utils["default"].clsx(this.props.classes.content, this.props.classes.contentMobile)
186
+ }, /*#__PURE__*/_react["default"].createElement(_FileBrowser["default"], {
187
+ ready: true,
188
+ imagePrefix: this.props.imagePrefix,
189
+ allowUpload: !!this.props.allowUpload,
190
+ allowDownload: this.props.allowDownload !== false,
191
+ allowCreateFolder: !!this.props.allowCreateFolder,
192
+ allowDelete: !!this.props.allowDelete,
193
+ showViewTypeButton: this.props.allowView !== false,
194
+ showToolbar: this.props.showToolbar !== false,
195
+ limitPath: this.props.limitPath,
196
+ filterFiles: this.props.filterFiles,
197
+ filterByType: this.props.filterByType,
198
+ selected: this.props.selected,
199
+ onSelect: function onSelect(selected, isDoubleClick, isFolder) {
200
+ _this2.setState({
201
+ selected: selected,
202
+ isFolder: isFolder
203
+ }, function () {
204
+ return isDoubleClick && (_this2.props.selectOnlyFolders && isFolder || !_this2.props.selectOnlyFolders && !isFolder) && _this2.handleOk();
205
+ });
206
+ },
207
+ t: _i18n["default"].t,
208
+ lang: _i18n["default"].getLanguage(),
209
+ socket: this.props.socket
210
+ })), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
211
+ variant: "contained",
212
+ onClick: function onClick() {
213
+ return _this2.handleOk();
214
+ },
215
+ startIcon: /*#__PURE__*/_react["default"].createElement(_Check["default"], null),
216
+ disabled: !this.state.selected || this.props.selectOnlyFolders && !this.state.isFolder || !this.props.selectOnlyFolders && this.state.isFolder,
217
+ color: "primary"
218
+ }, this.props.ok || _i18n["default"].t('ra_Ok')), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
219
+ color: "grey",
220
+ variant: "contained",
221
+ onClick: function onClick() {
222
+ return _this2.handleCancel();
223
+ },
224
+ startIcon: /*#__PURE__*/_react["default"].createElement(_Cancel["default"], null)
225
+ }, this.props.cancel || _i18n["default"].t('ra_Cancel'))));
226
+ }
227
+ }]);
228
+ return DialogFileSelect;
229
+ }(_react["default"].Component);
230
+
231
+ DialogFileSelect.propTypes = {
232
+ imagePrefix: _propTypes["default"].string,
233
+ dialogName: _propTypes["default"].string,
234
+ // where to store settings in localStorage
235
+ selected: _propTypes["default"].string,
236
+ onClose: _propTypes["default"].func.isRequired,
237
+ onOk: _propTypes["default"].func.isRequired,
238
+ ok: _propTypes["default"].string,
239
+ cancel: _propTypes["default"].string,
240
+ socket: _propTypes["default"].object.isRequired,
241
+ allowUpload: _propTypes["default"].bool,
242
+ allowDownload: _propTypes["default"].bool,
243
+ allowCreateFolder: _propTypes["default"].bool,
244
+ allowDelete: _propTypes["default"].bool,
245
+ allowView: _propTypes["default"].bool,
246
+ showToolbar: _propTypes["default"].bool,
247
+ objectID: _propTypes["default"].string,
248
+ filterFiles: _propTypes["default"].arrayOf(_propTypes["default"].string),
249
+ filterByType: _propTypes["default"].string,
250
+ limitPath: _propTypes["default"].string,
251
+ selectOnlyFolders: _propTypes["default"].bool
252
+ };
253
+ /** @type {typeof DialogFileSelect} */
254
+
255
+ var _export = (0, _withStyles["default"])(styles)(DialogFileSelect);
256
+
257
+ var _default = _export;
258
+ exports["default"] = _default;
259
+ //# sourceMappingURL=FileSelect.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileSelect.js","names":["styles","theme","headerID","fontWeight","fontStyle","dialog","height","dialogMobile","padding","width","maxWidth","maxHeight","content","overflow","contentMobile","titleRoot","whiteSpace","display","textOverflow","DialogFileSelect","props","dialogName","filters","window","_localStorage","localStorage","getItem","JSON","parse","e","state","selected","isFolder","name","isMobile","innerWidth","onClose","onOk","title","length","I18n","t","classes","paper","Utils","clsx","root","imagePrefix","allowUpload","allowDownload","allowCreateFolder","allowDelete","allowView","showToolbar","limitPath","filterFiles","filterByType","isDoubleClick","setState","selectOnlyFolders","handleOk","getLanguage","socket","ok","handleCancel","cancel","React","Component","propTypes","PropTypes","string","func","isRequired","object","bool","objectID","arrayOf","_export","withStyles"],"sources":["FileSelect.js"],"sourcesContent":["/**\n * Copyright 2022 bluefox <dogafox@gmail.com>\n *\n * MIT License\n *\n **/\n// please do not delete React, as without it other projects could not be compiled: ReferenceError: React is not defined\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport withStyles from '@mui/styles/withStyles';\n\nimport Button from '@mui/material/Button';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport DialogContent from '@mui/material/DialogContent';\nimport DialogActions from '@mui/material/DialogActions';\nimport Dialog from '@mui/material/Dialog';\n\nimport IconCancel from '@mui/icons-material/Cancel';\nimport IconOk from '@mui/icons-material/Check';\n\nimport I18n from '../i18n';\nimport Utils from '../Components/Utils';\nimport FileBrowser from '../Components/FileBrowser';\n\nconst styles = theme => ({\n headerID: {\n fontWeight: 'bold',\n fontStyle: 'italic'\n },\n dialog: {\n height: '95%'\n },\n dialogMobile: {\n padding: 4,\n width: '100%',\n maxWidth: '100%',\n maxHeight: 'calc(100% - 16px)',\n height: '100%'\n },\n content: {\n height: '100%',\n overflow: 'hidden'\n },\n contentMobile: {\n padding: '8px 4px'\n },\n titleRoot: {\n whiteSpace: 'nowrap',\n width: 'calc(100% - 72px)',\n overflow: 'hidden',\n display: 'inline-block',\n textOverflow: 'ellipsis',\n }\n});\n\n/**\n * @typedef {object} FileSelectDialogProps\n * @property {string} [dialogName] The internal name of the dialog; default: \"default\"\n * @property {string} [title] The dialog title; default: Please select object ID... (translated)\n * @property {string} [imagePrefix] Prefix (default: '.')\n * @property {boolean} [dialogName] PropTypes.string, // where to store settings in localStorage\n * @property {boolean} [selected] Pre-selected file\n * @property {() => void} onClose Close handler that is always called when the dialog is closed.\n * @property {(selected: string | undefined) => void} onOk Handler that is called when the user presses OK.\n * @property {string} [ok] The ok button text; default: OK (translated)\n * @property {string} [cancel] The cancel button text; default: Cancel (translated)\n * @property {boolean} [socket] Socket class (required)\n * @property {boolean} [allowUpload] If download of files enabled\n * @property {boolean} [allowDownload] If download of files enabled\n * @property {boolean} [allowCreateFolder] If creation of folders enabled\n * @property {boolean} [allowDelete] If creation of folders enabled\n * @property {boolean} [allowView] if tile view enabled (default true)\n * @property {boolean} [showToolbar] Show toolbar (default true)\n * @property {array} [limitPath] Limit file browser to one specific objectID of type meta and following path (like vis.0/main)\n * @property {array} [filterFiles] like `['png', 'svg', 'bmp', 'jpg', 'jpeg']`\n * @property {string} [filterByType] images, code, txt, audio, video\n * @property {bool} [selectOnlyFolders] allow only folders selection\n *\n * @extends {React.Component<FileSelectDialogProps>}\n */\nclass DialogFileSelect extends React.Component {\n /**\n * @param {FileSelectDialogProps} props\n */\n constructor(props) {\n super(props);\n this.dialogName = this.props.dialogName || 'default';\n this.dialogName = 'FileSelect.' + this.dialogName;\n\n this.filters = (window._localStorage || window.localStorage).getItem(this.dialogName) || '{}';\n\n try {\n this.filters = JSON.parse(this.filters);\n } catch (e) {\n this.filters = {};\n }\n\n this.state = {\n selected: this.props.selected || '',\n isFolder: false,\n name: '',\n isMobile: window.innerWidth < 800\n };\n }\n\n handleCancel() {\n this.props.onClose();\n };\n\n handleOk() {\n this.props.onOk(this.state.selected || '');\n this.props.onClose();\n };\n\n render() {\n let title;\n if (this.state.name || this.state.selected.length) {\n title = [\n <span key=\"selected\">{ I18n.t('ra_Selected') } </span>,\n <span key=\"id\" className={ this.props.classes.headerID }>{this.state.selected}</span>\n ];\n } else {\n title = this.props.title || I18n.t('ra_Please select file...');\n }\n\n return <Dialog\n onClose={() => {}}\n maxWidth={false}\n classes={{ paper: Utils.clsx(this.props.classes.dialog, this.props.classes.dialogMobile) }}\n fullWidth={true}\n open={true}\n aria-labelledby=\"file-dialog-title\"\n >\n <DialogTitle id=\"file-dialog-title\" classes={{ root: this.props.classes.titleRoot }}>{ title }</DialogTitle>\n <DialogContent className={Utils.clsx(this.props.classes.content, this.props.classes.contentMobile)}>\n <FileBrowser\n ready\n imagePrefix={this.props.imagePrefix}\n allowUpload={!!this.props.allowUpload}\n allowDownload={this.props.allowDownload !== false}\n allowCreateFolder={!!this.props.allowCreateFolder}\n allowDelete={!!this.props.allowDelete}\n showViewTypeButton={this.props.allowView !== false}\n showToolbar={this.props.showToolbar !== false}\n limitPath={this.props.limitPath}\n filterFiles={this.props.filterFiles}\n filterByType={this.props.filterByType}\n selected={this.props.selected}\n onSelect={(selected, isDoubleClick, isFolder) => {\n this.setState({ selected, isFolder }, () =>\n isDoubleClick && ((this.props.selectOnlyFolders && isFolder) || (!this.props.selectOnlyFolders && !isFolder)) && this.handleOk());\n }}\n t={I18n.t}\n lang={I18n.getLanguage()}\n socket={this.props.socket}\n />\n </DialogContent>\n <DialogActions>\n <Button variant=\"contained\" onClick={ () => this.handleOk() } startIcon={<IconOk />} disabled={ !this.state.selected || ((this.props.selectOnlyFolders && !this.state.isFolder) || (!this.props.selectOnlyFolders && this.state.isFolder)) } color=\"primary\">{ this.props.ok || I18n.t('ra_Ok') }</Button>\n <Button color=\"grey\" variant=\"contained\" onClick={ () => this.handleCancel() } startIcon={<IconCancel />}>{ this.props.cancel || I18n.t('ra_Cancel') }</Button>\n </DialogActions>\n </Dialog>;\n }\n}\n\nDialogFileSelect.propTypes = {\n imagePrefix: PropTypes.string,\n dialogName: PropTypes.string, // where to store settings in localStorage\n selected: PropTypes.string,\n onClose: PropTypes.func.isRequired,\n onOk: PropTypes.func.isRequired,\n ok: PropTypes.string,\n cancel: PropTypes.string,\n socket: PropTypes.object.isRequired,\n allowUpload: PropTypes.bool,\n allowDownload: PropTypes.bool,\n allowCreateFolder: PropTypes.bool,\n allowDelete: PropTypes.bool,\n allowView: PropTypes.bool,\n showToolbar: PropTypes.bool,\n objectID: PropTypes.string,\n filterFiles: PropTypes.arrayOf(PropTypes.string),\n filterByType: PropTypes.string,\n limitPath: PropTypes.string,\n selectOnlyFolders: PropTypes.bool,\n};\n\n/** @type {typeof DialogFileSelect} */\nconst _export = withStyles(styles)(DialogFileSelect);\nexport default _export;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAOA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAEA;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;EAEzBjD,UAAU,EAAEgD,qBAAA,CAAUC,MAFG;EAEK;EAC9BvC,QAAQ,EAAEsC,qBAAA,CAAUC,MAHK;EAIzBlC,OAAO,EAAEiC,qBAAA,CAAUE,IAAV,CAAeC,UAJC;EAKzBnC,IAAI,EAAEgC,qBAAA,CAAUE,IAAV,CAAeC,UALI;EAMzBT,EAAE,EAAEM,qBAAA,CAAUC,MANW;EAOzBL,MAAM,EAAEI,qBAAA,CAAUC,MAPO;EAQzBR,MAAM,EAAEO,qBAAA,CAAUI,MAAV,CAAiBD,UARA;EASzBxB,WAAW,EAAEqB,qBAAA,CAAUK,IATE;EAUzBzB,aAAa,EAAEoB,qBAAA,CAAUK,IAVA;EAWzBxB,iBAAiB,EAAEmB,qBAAA,CAAUK,IAXJ;EAYzBvB,WAAW,EAAEkB,qBAAA,CAAUK,IAZE;EAazBtB,SAAS,EAAEiB,qBAAA,CAAUK,IAbI;EAczBrB,WAAW,EAAEgB,qBAAA,CAAUK,IAdE;EAezBC,QAAQ,EAAEN,qBAAA,CAAUC,MAfK;EAgBzBf,WAAW,EAAEc,qBAAA,CAAUO,OAAV,CAAkBP,qBAAA,CAAUC,MAA5B,CAhBY;EAiBzBd,YAAY,EAAEa,qBAAA,CAAUC,MAjBC;EAkBzBhB,SAAS,EAAEe,qBAAA,CAAUC,MAlBI;EAmBzBX,iBAAiB,EAAEU,qBAAA,CAAUK;AAnBJ,CAA7B;AAsBA;;AACA,IAAMG,OAAO,GAAG,IAAAC,sBAAA,EAAW9E,MAAX,EAAmBmB,gBAAnB,CAAhB;;eACe0D,O"}
@@ -82,8 +82,7 @@ var styles = function styles(theme) {
82
82
  };
83
83
  };
84
84
  /**
85
- * @typedef {object} SelectIDProps
86
- * @property {string} [key] The key to identify this component.
85
+ * @typedef {object} DialogSelectIDProps
87
86
  * @property {string} [dialogName] The internal name of the dialog; default: "default"
88
87
  * @property {string} [title] The dialog title; default: Please select object ID... (translated)
89
88
  * @property {boolean} [multiSelect] Set to true to allow the selection of multiple IDs.
@@ -105,26 +104,26 @@ var styles = function styles(theme) {
105
104
  * @property {(selected: string | string[] | undefined, name: string) => void} onOk Handler that is called when the user presses OK.
106
105
  * @property {{headerID: string; dialog: string; content: string}} [classes] The styling class names.
107
106
  *
108
- * @extends {React.Component<SelectIDProps>}
107
+ * @extends {React.Component<DialogSelectIDProps>}
109
108
  */
110
109
 
111
110
 
112
- var SelectID = /*#__PURE__*/function (_React$Component) {
113
- (0, _inherits2["default"])(SelectID, _React$Component);
111
+ var DialogSelectID = /*#__PURE__*/function (_React$Component) {
112
+ (0, _inherits2["default"])(DialogSelectID, _React$Component);
114
113
 
115
- var _super = _createSuper(SelectID);
114
+ var _super = _createSuper(DialogSelectID);
116
115
 
117
116
  /**
118
- * @param {SelectIDProps} props
117
+ * @param {DialogSelectIDProps} props
119
118
  */
120
- function SelectID(props) {
119
+ function DialogSelectID(props) {
121
120
  var _this;
122
121
 
123
- (0, _classCallCheck2["default"])(this, SelectID);
122
+ (0, _classCallCheck2["default"])(this, DialogSelectID);
124
123
  _this = _super.call(this, props);
125
124
  _this.dialogName = _this.props.dialogName || 'default';
126
125
  _this.dialogName = 'SelectID.' + _this.dialogName;
127
- _this.filters = window.localStorage.getItem(_this.dialogName) || '{}';
126
+ _this.filters = (window._localStorage || window.localStorage).getItem(_this.dialogName) || '{}';
128
127
 
129
128
  try {
130
129
  _this.filters = JSON.parse(_this.filters);
@@ -149,7 +148,7 @@ var SelectID = /*#__PURE__*/function (_React$Component) {
149
148
  return _this;
150
149
  }
151
150
 
152
- (0, _createClass2["default"])(SelectID, [{
151
+ (0, _createClass2["default"])(DialogSelectID, [{
153
152
  key: "handleCancel",
154
153
  value: function handleCancel() {
155
154
  this.props.onClose();
@@ -228,7 +227,7 @@ var SelectID = /*#__PURE__*/function (_React$Component) {
228
227
  customFilter: this.props.customFilter,
229
228
  onFilterChanged: function onFilterChanged(filterConfig) {
230
229
  _this2.filters = filterConfig;
231
- window.localStorage.setItem(_this2.dialogName, JSON.stringify(filterConfig));
230
+ (window._localStorage || window.localStorage).setItem(_this2.dialogName, JSON.stringify(filterConfig));
232
231
  },
233
232
  onSelect: function onSelect(selected, name, isDouble) {
234
233
  if (JSON.stringify(selected) !== JSON.stringify(_this2.state.selected)) {
@@ -261,7 +260,7 @@ var SelectID = /*#__PURE__*/function (_React$Component) {
261
260
  }, this.props.cancel || _i18n["default"].t('ra_Cancel'))));
262
261
  }
263
262
  }]);
264
- return SelectID;
263
+ return DialogSelectID;
265
264
  }(_react["default"].Component);
266
265
 
267
266
  SelectID.propTypes = {
@@ -292,13 +291,13 @@ SelectID.propTypes = {
292
291
  // optional ['state', 'instance', 'channel']
293
292
  columns: _propTypes["default"].array,
294
293
  // optional ['name', 'type', 'role', 'room', 'func', 'val', 'buttons']
295
- filterFunc: _propTypes["default"].func // function to filter out all unneccessary objects. It cannot be used together with "types"
294
+ filterFunc: _propTypes["default"].func // function to filter out all unnecessary objects. It cannot be used together with "types"
296
295
  // Example for function: `obj => obj.common && obj.common.type === 'boolean'` to show only boolean states
297
296
 
298
297
  };
299
- /** @type {typeof SelectID} */
298
+ /** @type {typeof DialogSelectID} */
300
299
 
301
- var _export = (0, _withStyles["default"])(styles)(SelectID);
300
+ var _export = (0, _withStyles["default"])(styles)(DialogSelectID);
302
301
 
303
302
  var _default = _export;
304
303
  exports["default"] = _default;
@@ -1 +1 @@
1
- {"version":3,"file":"SelectID.js","names":["styles","theme","headerID","fontWeight","fontStyle","dialog","height","dialogMobile","padding","width","maxWidth","maxHeight","content","overflow","contentMobile","titleRoot","whiteSpace","display","textOverflow","SelectID","props","dialogName","filters","window","localStorage","getItem","JSON","parse","e","selected","filter","id","state","name","isMobile","innerWidth","onClose","onOk","multiSelect","title","length","I18n","t","classes","paper","Utils","clsx","root","foldersFirst","imagePrefix","prefix","showExpertButton","undefined","columns","types","lang","getLanguage","socket","notEditable","themeName","themeType","customFilter","filterConfig","setItem","stringify","isDouble","setState","handleOk","filterFunc","ok","handleCancel","cancel","React","Component","propTypes","PropTypes","string","object","bool","func","isRequired","isFloatComma","dateFormat","oneOfType","array","statesOnly","_export","withStyles"],"sources":["SelectID.js"],"sourcesContent":["/**\n * Copyright 2018-2022 bluefox <dogafox@gmail.com>\n *\n * MIT License\n *\n **/\n// please do not delete React, as without it other projects could not be compiled: ReferenceError: React is not defined\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport withStyles from '@mui/styles/withStyles';\n\nimport Button from '@mui/material/Button';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport DialogContent from '@mui/material/DialogContent';\nimport DialogActions from '@mui/material/DialogActions';\nimport Dialog from '@mui/material/Dialog';\n\nimport IconCancel from '@mui/icons-material/Cancel';\nimport IconOk from '@mui/icons-material/Check';\n\nimport Utils from '../Components/Utils';\nimport I18n from '../i18n';\nimport ObjectBrowser from '../Components/ObjectBrowser';\n\nconst styles = theme => ({\n headerID: {\n fontWeight: 'bold',\n fontStyle: 'italic'\n },\n dialog: {\n height: '95%'\n },\n dialogMobile: {\n padding: 4,\n width: '100%',\n maxWidth: '100%',\n maxHeight: 'calc(100% - 16px)',\n height: '100%'\n },\n content: {\n height: '100%',\n overflow: 'hidden'\n },\n contentMobile: {\n padding: '8px 4px'\n },\n titleRoot: {\n whiteSpace: 'nowrap',\n width: 'calc(100% - 72px)',\n overflow: 'hidden',\n display: 'inline-block',\n textOverflow: 'ellipsis',\n }\n});\n\n/**\n * @typedef {object} SelectIDProps\n * @property {string} [key] The key to identify this component.\n * @property {string} [dialogName] The internal name of the dialog; default: \"default\"\n * @property {string} [title] The dialog title; default: Please select object ID... (translated)\n * @property {boolean} [multiSelect] Set to true to allow the selection of multiple IDs.\n * @property {boolean} [foldersFirst] Show folders before any leaves.\n * @property {string} [imagePrefix] Prefix (default: '.')\n * @property {boolean} [showExpertButton] Show the expert button?\n * @property {import('../Components/types').ObjectBrowserColumn[]} [columns] Columns to display; default: 'name', 'type', 'role', 'room', 'func', 'val'\n * @property {import('../Components/types').ObjectBrowserType[]} [types] Object types to show; default: 'state' only\n * @property {ioBroker.Languages} [lang] The language.\n * @property {import('../Connection').default} socket The socket connection.\n * @property {boolean} [notEditable] Can't objects be edited? (default: true)\n * @property {string} [themeName] Theme name.\n * @property {string} [themeType] Theme type.\n * @property {import('../Components/types').ObjectBrowserCustomFilter} [customFilter] Custom filter.\n * @property {string | string[]} [selected] The selected IDs.\n * @property {string} [ok] The ok button text; default: OK (translated)\n * @property {string} [cancel] The cancel button text; default: Cancel (translated)\n * @property {() => void} onClose Close handler that is always called when the dialog is closed.\n * @property {(selected: string | string[] | undefined, name: string) => void} onOk Handler that is called when the user presses OK.\n * @property {{headerID: string; dialog: string; content: string}} [classes] The styling class names.\n *\n * @extends {React.Component<SelectIDProps>}\n */\nclass SelectID extends React.Component {\n /**\n * @param {SelectIDProps} props\n */\n constructor(props) {\n super(props);\n this.dialogName = this.props.dialogName || 'default';\n this.dialogName = 'SelectID.' + this.dialogName;\n\n this.filters = window.localStorage.getItem(this.dialogName) || '{}';\n\n try {\n this.filters = JSON.parse(this.filters);\n } catch (e) {\n this.filters = {};\n }\n\n let selected = this.props.selected || [];\n if (typeof selected !== 'object') {\n selected = [selected];\n }\n selected = selected.filter(id => id);\n\n this.state = {\n selected,\n name: '',\n isMobile: window.innerWidth < 800\n };\n }\n\n handleCancel() {\n this.props.onClose();\n };\n\n handleOk() {\n this.props.onOk(this.props.multiSelect ? this.state.selected : this.state.selected[0] || '', this.state.name);\n this.props.onClose();\n };\n\n render() {\n let title;\n if (this.state.name || this.state.selected.length) {\n if (this.state.selected.length === 1) {\n title = [\n <span key=\"selected\">{ I18n.t('ra_Selected') } </span>,\n <span key=\"id\" className={ this.props.classes.headerID }>{\n (this.state.name || this.state.selected) + (this.state.name ? ' [' + this.state.selected + ']' : '')\n }</span>\n ];\n } else {\n title = [\n <span key=\"selected\">{ I18n.t('ra_Selected') } </span>,\n <span key=\"id\" className={ this.props.classes.headerID }>{\n I18n.t('%s items', this.state.selected.length)\n }</span>\n ];\n }\n } else {\n title = this.props.title || I18n.t('ra_Please select object ID...');\n }\n\n return <Dialog\n onClose={() => {}}\n maxWidth={false}\n classes={{paper: Utils.clsx(this.props.classes.dialog, this.props.classes.dialogMobile)}}\n fullWidth={true}\n open={true}\n aria-labelledby=\"selectid-dialog-title\"\n >\n <DialogTitle id=\"selectid-dialog-title\" classes={{root: this.props.classes.titleRoot}}>{ title }</DialogTitle>\n <DialogContent className={Utils.clsx(this.props.classes.content, this.props.classes.contentMobile)}>\n <ObjectBrowser\n foldersFirst={ this.props.foldersFirst }\n imagePrefix={ this.props.imagePrefix || this.props.prefix } // prefix is for back compatibility\n defaultFilters={ this.filters }\n dialogName={this.dialogName}\n showExpertButton={ this.props.showExpertButton !== undefined ? this.props.showExpertButton : true }\n style={ {width: '100%', height: '100%'} }\n columns={ this.props.columns || ['name', 'type', 'role', 'room', 'func', 'val'] }\n types={ this.props.types || ['state'] }\n t={ I18n.t }\n lang={ this.props.lang || I18n.getLanguage() }\n socket={ this.props.socket }\n selected={ this.state.selected }\n multiSelect={ this.props.multiSelect }\n notEditable={ this.props.notEditable === undefined ? true : this.props.notEditable }\n name={ this.state.name }\n themeName={ this.props.themeName }\n themeType={ this.props.themeType }\n customFilter={ this.props.customFilter }\n onFilterChanged={ filterConfig => {\n this.filters = filterConfig;\n window.localStorage.setItem(this.dialogName, JSON.stringify(filterConfig));\n } }\n onSelect={ (selected, name, isDouble) => {\n if (JSON.stringify(selected) !== JSON.stringify(this.state.selected)) {\n this.setState({selected, name}, () =>\n isDouble && this.handleOk());\n } else if (isDouble) {\n this.handleOk();\n }\n } }\n filterFunc={this.props.filterFunc}\n />\n </DialogContent>\n <DialogActions>\n <Button variant=\"contained\" onClick={ () => this.handleOk() } startIcon={<IconOk />} disabled={ !this.state.selected.length } color=\"primary\">{ this.props.ok || I18n.t('ra_Ok') }</Button>\n <Button color=\"grey\" variant=\"contained\" onClick={ () => this.handleCancel() } startIcon={<IconCancel />}>{ this.props.cancel || I18n.t('ra_Cancel') }</Button>\n </DialogActions>\n </Dialog>;\n }\n}\n\nSelectID.propTypes = {\n dialogName: PropTypes.string, // where to store settings in localStorage\n classes: PropTypes.object,\n notEditable: PropTypes.bool,\n onClose: PropTypes.func.isRequired,\n onOk: PropTypes.func.isRequired,\n title: PropTypes.string,\n lang: PropTypes.string,\n foldersFirst: PropTypes.bool,\n isFloatComma: PropTypes.bool,\n dateFormat: PropTypes.string,\n selected: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.array\n ]),\n customFilter: PropTypes.object, // optional {common: {custom: true}} or {common: {custom: 'sql.0'}}\n statesOnly: PropTypes.bool,\n socket: PropTypes.object.isRequired,\n cancel: PropTypes.string,\n imagePrefix: PropTypes.string,\n ok: PropTypes.string,\n themeName: PropTypes.string,\n themeType: PropTypes.string,\n showExpertButton: PropTypes.bool,\n multiSelect: PropTypes.bool,\n types: PropTypes.array, // optional ['state', 'instance', 'channel']\n columns: PropTypes.array, // optional ['name', 'type', 'role', 'room', 'func', 'val', 'buttons']\n\n filterFunc: PropTypes.func, // function to filter out all unneccessary objects. It cannot be used together with \"types\"\n // Example for function: `obj => obj.common && obj.common.type === 'boolean'` to show only boolean states\n};\n\n/** @type {typeof SelectID} */\nconst _export = withStyles(styles)(SelectID);\nexport default _export;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAOA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;EAAA,OAAK;IACrBC,QAAQ,EAAE;MACNC,UAAU,EAAE,MADN;MAENC,SAAS,EAAE;IAFL,CADW;IAKrBC,MAAM,EAAE;MACJC,MAAM,EAAE;IADJ,CALa;IAQrBC,YAAY,EAAE;MACVC,OAAO,EAAE,CADC;MAEVC,KAAK,EAAE,MAFG;MAGVC,QAAQ,EAAE,MAHA;MAIVC,SAAS,EAAE,mBAJD;MAKVL,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","height","dialogMobile","padding","width","maxWidth","maxHeight","content","overflow","contentMobile","titleRoot","whiteSpace","display","textOverflow","DialogSelectID","props","dialogName","filters","window","_localStorage","localStorage","getItem","JSON","parse","e","selected","filter","id","state","name","isMobile","innerWidth","onClose","onOk","multiSelect","title","length","I18n","t","classes","paper","Utils","clsx","root","foldersFirst","imagePrefix","prefix","showExpertButton","undefined","columns","types","lang","getLanguage","socket","notEditable","themeName","themeType","customFilter","filterConfig","setItem","stringify","isDouble","setState","handleOk","filterFunc","ok","handleCancel","cancel","React","Component","SelectID","propTypes","PropTypes","string","object","bool","func","isRequired","isFloatComma","dateFormat","oneOfType","array","statesOnly","_export","withStyles"],"sources":["SelectID.js"],"sourcesContent":["/**\n * Copyright 2018-2022 bluefox <dogafox@gmail.com>\n *\n * MIT License\n *\n **/\n// please do not delete React, as without it other projects could not be compiled: ReferenceError: React is not defined\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport withStyles from '@mui/styles/withStyles';\n\nimport Button from '@mui/material/Button';\nimport DialogTitle from '@mui/material/DialogTitle';\nimport DialogContent from '@mui/material/DialogContent';\nimport DialogActions from '@mui/material/DialogActions';\nimport Dialog from '@mui/material/Dialog';\n\nimport IconCancel from '@mui/icons-material/Cancel';\nimport IconOk from '@mui/icons-material/Check';\n\nimport Utils from '../Components/Utils';\nimport I18n from '../i18n';\nimport ObjectBrowser from '../Components/ObjectBrowser';\n\nconst styles = theme => ({\n headerID: {\n fontWeight: 'bold',\n fontStyle: 'italic'\n },\n dialog: {\n height: '95%'\n },\n dialogMobile: {\n padding: 4,\n width: '100%',\n maxWidth: '100%',\n maxHeight: 'calc(100% - 16px)',\n height: '100%'\n },\n content: {\n height: '100%',\n overflow: 'hidden'\n },\n contentMobile: {\n padding: '8px 4px'\n },\n titleRoot: {\n whiteSpace: 'nowrap',\n width: 'calc(100% - 72px)',\n overflow: 'hidden',\n display: 'inline-block',\n textOverflow: 'ellipsis',\n }\n});\n\n/**\n * @typedef {object} DialogSelectIDProps\n * @property {string} [dialogName] The internal name of the dialog; default: \"default\"\n * @property {string} [title] The dialog title; default: Please select object ID... (translated)\n * @property {boolean} [multiSelect] Set to true to allow the selection of multiple IDs.\n * @property {boolean} [foldersFirst] Show folders before any leaves.\n * @property {string} [imagePrefix] Prefix (default: '.')\n * @property {boolean} [showExpertButton] Show the expert button?\n * @property {import('../Components/types').ObjectBrowserColumn[]} [columns] Columns to display; default: 'name', 'type', 'role', 'room', 'func', 'val'\n * @property {import('../Components/types').ObjectBrowserType[]} [types] Object types to show; default: 'state' only\n * @property {ioBroker.Languages} [lang] The language.\n * @property {import('../Connection').default} socket The socket connection.\n * @property {boolean} [notEditable] Can't objects be edited? (default: true)\n * @property {string} [themeName] Theme name.\n * @property {string} [themeType] Theme type.\n * @property {import('../Components/types').ObjectBrowserCustomFilter} [customFilter] Custom filter.\n * @property {string | string[]} [selected] The selected IDs.\n * @property {string} [ok] The ok button text; default: OK (translated)\n * @property {string} [cancel] The cancel button text; default: Cancel (translated)\n * @property {() => void} onClose Close handler that is always called when the dialog is closed.\n * @property {(selected: string | string[] | undefined, name: string) => void} onOk Handler that is called when the user presses OK.\n * @property {{headerID: string; dialog: string; content: string}} [classes] The styling class names.\n *\n * @extends {React.Component<DialogSelectIDProps>}\n */\nclass DialogSelectID extends React.Component {\n /**\n * @param {DialogSelectIDProps} props\n */\n constructor(props) {\n super(props);\n this.dialogName = this.props.dialogName || 'default';\n this.dialogName = 'SelectID.' + this.dialogName;\n\n this.filters = (window._localStorage || window.localStorage).getItem(this.dialogName) || '{}';\n\n try {\n this.filters = JSON.parse(this.filters);\n } catch (e) {\n this.filters = {};\n }\n\n let selected = this.props.selected || [];\n if (typeof selected !== 'object') {\n selected = [selected];\n }\n selected = selected.filter(id => id);\n\n this.state = {\n selected,\n name: '',\n isMobile: window.innerWidth < 800\n };\n }\n\n handleCancel() {\n this.props.onClose();\n };\n\n handleOk() {\n this.props.onOk(this.props.multiSelect ? this.state.selected : this.state.selected[0] || '', this.state.name);\n this.props.onClose();\n };\n\n render() {\n let title;\n if (this.state.name || this.state.selected.length) {\n if (this.state.selected.length === 1) {\n title = [\n <span key=\"selected\">{ I18n.t('ra_Selected') } </span>,\n <span key=\"id\" className={ this.props.classes.headerID }>{\n (this.state.name || this.state.selected) + (this.state.name ? ' [' + this.state.selected + ']' : '')\n }</span>\n ];\n } else {\n title = [\n <span key=\"selected\">{ I18n.t('ra_Selected') } </span>,\n <span key=\"id\" className={ this.props.classes.headerID }>{\n I18n.t('%s items', this.state.selected.length)\n }</span>\n ];\n }\n } else {\n title = this.props.title || I18n.t('ra_Please select object ID...');\n }\n\n return <Dialog\n onClose={() => {}}\n maxWidth={false}\n classes={{paper: Utils.clsx(this.props.classes.dialog, this.props.classes.dialogMobile)}}\n fullWidth={true}\n open={true}\n aria-labelledby=\"selectid-dialog-title\"\n >\n <DialogTitle id=\"selectid-dialog-title\" classes={{root: this.props.classes.titleRoot}}>{ title }</DialogTitle>\n <DialogContent className={Utils.clsx(this.props.classes.content, this.props.classes.contentMobile)}>\n <ObjectBrowser\n foldersFirst={ this.props.foldersFirst }\n imagePrefix={ this.props.imagePrefix || this.props.prefix } // prefix is for back compatibility\n defaultFilters={ this.filters }\n dialogName={this.dialogName}\n showExpertButton={ this.props.showExpertButton !== undefined ? this.props.showExpertButton : true }\n style={ {width: '100%', height: '100%'} }\n columns={ this.props.columns || ['name', 'type', 'role', 'room', 'func', 'val'] }\n types={ this.props.types || ['state'] }\n t={ I18n.t }\n lang={ this.props.lang || I18n.getLanguage() }\n socket={ this.props.socket }\n selected={ this.state.selected }\n multiSelect={ this.props.multiSelect }\n notEditable={ this.props.notEditable === undefined ? true : this.props.notEditable }\n name={ this.state.name }\n themeName={ this.props.themeName }\n themeType={ this.props.themeType }\n customFilter={ this.props.customFilter }\n onFilterChanged={ filterConfig => {\n this.filters = filterConfig;\n (window._localStorage || window.localStorage).setItem(this.dialogName, JSON.stringify(filterConfig));\n } }\n onSelect={ (selected, name, isDouble) => {\n if (JSON.stringify(selected) !== JSON.stringify(this.state.selected)) {\n this.setState({selected, name}, () =>\n isDouble && this.handleOk());\n } else if (isDouble) {\n this.handleOk();\n }\n } }\n filterFunc={this.props.filterFunc}\n />\n </DialogContent>\n <DialogActions>\n <Button variant=\"contained\" onClick={ () => this.handleOk() } startIcon={<IconOk />} disabled={ !this.state.selected.length } color=\"primary\">{ this.props.ok || I18n.t('ra_Ok') }</Button>\n <Button color=\"grey\" variant=\"contained\" onClick={ () => this.handleCancel() } startIcon={<IconCancel />}>{ this.props.cancel || I18n.t('ra_Cancel') }</Button>\n </DialogActions>\n </Dialog>;\n }\n}\n\nSelectID.propTypes = {\n dialogName: PropTypes.string, // where to store settings in localStorage\n classes: PropTypes.object,\n notEditable: PropTypes.bool,\n onClose: PropTypes.func.isRequired,\n onOk: PropTypes.func.isRequired,\n title: PropTypes.string,\n lang: PropTypes.string,\n foldersFirst: PropTypes.bool,\n isFloatComma: PropTypes.bool,\n dateFormat: PropTypes.string,\n selected: PropTypes.oneOfType([\n PropTypes.string,\n PropTypes.array\n ]),\n customFilter: PropTypes.object, // optional {common: {custom: true}} or {common: {custom: 'sql.0'}}\n statesOnly: PropTypes.bool,\n socket: PropTypes.object.isRequired,\n cancel: PropTypes.string,\n imagePrefix: PropTypes.string,\n ok: PropTypes.string,\n themeName: PropTypes.string,\n themeType: PropTypes.string,\n showExpertButton: PropTypes.bool,\n multiSelect: PropTypes.bool,\n types: PropTypes.array, // optional ['state', 'instance', 'channel']\n columns: PropTypes.array, // optional ['name', 'type', 'role', 'room', 'func', 'val', 'buttons']\n\n filterFunc: PropTypes.func, // function to filter out all unnecessary objects. It cannot be used together with \"types\"\n // Example for function: `obj => obj.common && obj.common.type === 'boolean'` to show only boolean states\n};\n\n/** @type {typeof DialogSelectID} */\nconst _export = withStyles(styles)(DialogSelectID);\nexport default _export;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAOA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;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,EAAEyB,qBAAA,CAAUG,IAvBX;EAwBjBzC,WAAW,EAAEsC,qBAAA,CAAUG,IAxBN;EAyBjBzB,KAAK,EAAEsB,qBAAA,CAAUS,KAzBA;EAyBS;EAC1BhC,OAAO,EAAEuB,qBAAA,CAAUS,KA1BF;EA0BS;EAE1BjB,UAAU,EAAEQ,qBAAA,CAAUI,IA5BL,CA4BmB;EACA;;AA7BnB,CAArB;AAgCA;;AACA,IAAMO,OAAO,GAAG,IAAAC,sBAAA,EAAWzF,MAAX,EAAmBmB,cAAnB,CAAhB;;eACeqE,O"}
package/GenericApp.js CHANGED
@@ -202,12 +202,12 @@ var GenericApp = /*#__PURE__*/function (_Router) {
202
202
 
203
203
  var location = _Router2["default"].getLocation();
204
204
 
205
- location.tab = location.tab || window.localStorage.getItem(_this.adapterName + '-adapter') || '';
205
+ location.tab = location.tab || (window._localStorage || window.localStorage).getItem(_this.adapterName + '-adapter') || '';
206
206
 
207
207
  var themeInstance = _this.createTheme();
208
208
 
209
209
  _this.state = {
210
- selectedTab: window.localStorage.getItem(_this.adapterName + '-adapter') || '',
210
+ selectedTab: (window._localStorage || window.localStorage).getItem(_this.adapterName + '-adapter') || '',
211
211
  selectedTabNum: -1,
212
212
  "native": {},
213
213
  errorText: '',
@@ -515,7 +515,7 @@ var GenericApp = /*#__PURE__*/function (_Router) {
515
515
  }, {
516
516
  key: "selectTab",
517
517
  value: function selectTab(tab, index) {
518
- window.localStorage[this.adapterName + '-adapter'] = tab;
518
+ (window._localStorage || window.localStorage)[this.adapterName + '-adapter'] = tab;
519
519
  this.setState({
520
520
  selectedTab: tab,
521
521
  selectedTabNum: index