@iobroker/adapter-react-v5 2.1.6 → 2.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Components/404.js +17 -25
- package/Components/404.js.map +1 -1
- package/Components/ColorPicker.js +25 -35
- package/Components/ColorPicker.js.map +1 -1
- package/Components/ComplexCron.js +29 -37
- package/Components/ComplexCron.js.map +1 -1
- package/Components/FileBrowser.js +41 -62
- package/Components/FileBrowser.js.map +1 -1
- package/Components/FileViewer.js +18 -28
- package/Components/FileViewer.js.map +1 -1
- package/Components/Icon.js +15 -25
- package/Components/Icon.js.map +1 -1
- package/Components/IconPicker.js +6 -6
- package/Components/IconPicker.js.map +1 -1
- package/Components/IconSelector.js +25 -31
- package/Components/IconSelector.js.map +1 -1
- package/Components/Image.js +15 -25
- package/Components/Image.js.map +1 -1
- package/Components/Loader.js +14 -24
- package/Components/Loader.js.map +1 -1
- package/Components/Loaders/PT.js +13 -23
- package/Components/Loaders/PT.js.map +1 -1
- package/Components/Loaders/Vendor.js +14 -24
- package/Components/Loaders/Vendor.js.map +1 -1
- package/Components/Logo.js +18 -28
- package/Components/Logo.js.map +1 -1
- package/Components/MDUtils.js +14 -11
- package/Components/MDUtils.js.map +1 -1
- package/Components/ObjectBrowser.js +150 -238
- package/Components/ObjectBrowser.js.map +1 -1
- package/Components/Router.js +13 -21
- package/Components/Router.js.map +1 -1
- package/Components/SaveCloseButtons.js +15 -25
- package/Components/SaveCloseButtons.js.map +1 -1
- package/Components/Schedule.js +23 -37
- package/Components/Schedule.js.map +1 -1
- package/Components/SelectWithIcon.js +18 -26
- package/Components/SelectWithIcon.js.map +1 -1
- package/Components/SimpleCron/cron2text.js.map +1 -1
- package/Components/SimpleCron/cronText.js +2 -2
- package/Components/SimpleCron/cronText.js.map +1 -1
- package/Components/SimpleCron/index.js +24 -34
- package/Components/SimpleCron/index.js.map +1 -1
- package/Components/SimpleCron/jquery.cron.locale.js.map +1 -1
- package/Components/TabContainer.js +18 -28
- package/Components/TabContainer.js.map +1 -1
- package/Components/TabContent.js +17 -27
- package/Components/TabContent.js.map +1 -1
- package/Components/TabHeader.js +13 -23
- package/Components/TabHeader.js.map +1 -1
- package/Components/TextWithIcon.js +5 -5
- package/Components/TextWithIcon.js.map +1 -1
- package/Components/ToggleThemeMenu.js +2 -2
- package/Components/ToggleThemeMenu.js.map +1 -1
- package/Components/TreeTable.js +21 -42
- package/Components/TreeTable.js.map +1 -1
- package/Components/Utils.js +34 -42
- package/Components/Utils.js.map +1 -1
- package/Components/copy-to-clipboard.js.map +1 -1
- package/Components/withWidth.js +42 -0
- package/Components/withWidth.js.map +1 -0
- package/Connection.js +20 -23
- package/Connection.js.map +1 -1
- package/Dialogs/ComplexCron.js +15 -25
- package/Dialogs/ComplexCron.js.map +1 -1
- package/Dialogs/Confirm.js +15 -25
- package/Dialogs/Confirm.js.map +1 -1
- package/Dialogs/Cron.js +19 -27
- package/Dialogs/Cron.js.map +1 -1
- package/Dialogs/Error.js +15 -25
- package/Dialogs/Error.js.map +1 -1
- package/Dialogs/Message.js +15 -25
- package/Dialogs/Message.js.map +1 -1
- package/Dialogs/SelectID.js +19 -27
- package/Dialogs/SelectID.js.map +1 -1
- package/Dialogs/SimpleCron.js +15 -25
- package/Dialogs/SimpleCron.js.map +1 -1
- package/Dialogs/TextInput.js +18 -28
- package/Dialogs/TextInput.js.map +1 -1
- package/GenericApp.js +41 -50
- package/GenericApp.js.map +1 -1
- package/Prompt.js.map +1 -1
- package/README.md +12 -0
- package/Theme.js +2 -2
- package/Theme.js.map +1 -1
- package/i18n/de.json +3 -3
- package/i18n/en.json +3 -3
- package/i18n/es.json +3 -3
- package/i18n/fr.json +3 -3
- package/i18n/it.json +3 -3
- package/i18n/nl.json +3 -3
- package/i18n/pl.json +3 -3
- package/i18n/pt.json +3 -3
- package/i18n/ru.json +3 -3
- package/i18n/zh-cn.json +3 -3
- package/i18n.js +22 -13
- package/i18n.js.map +1 -1
- package/icons/IconAdapter.js +2 -2
- package/icons/IconAdapter.js.map +1 -1
- package/icons/IconAlias.js +2 -2
- package/icons/IconAlias.js.map +1 -1
- package/icons/IconChannel.js +2 -2
- package/icons/IconChannel.js.map +1 -1
- package/icons/IconClearFilter.js +2 -2
- package/icons/IconClearFilter.js.map +1 -1
- package/icons/IconClosed.js +2 -2
- package/icons/IconClosed.js.map +1 -1
- package/icons/IconCopy.js +2 -2
- package/icons/IconCopy.js.map +1 -1
- package/icons/IconDevice.js +2 -2
- package/icons/IconDevice.js.map +1 -1
- package/icons/IconDocument.js +2 -2
- package/icons/IconDocument.js.map +1 -1
- package/icons/IconExpert.js +2 -2
- package/icons/IconExpert.js.map +1 -1
- package/icons/IconFx.js +2 -2
- package/icons/IconFx.js.map +1 -1
- package/icons/IconInstance.js +2 -2
- package/icons/IconInstance.js.map +1 -1
- package/icons/IconLogout.js +2 -2
- package/icons/IconLogout.js.map +1 -1
- package/icons/IconOpen.js +2 -2
- package/icons/IconOpen.js.map +1 -1
- package/icons/IconState.js +6 -6
- package/icons/IconState.js.map +1 -1
- package/package.json +10 -10
package/Dialogs/Message.js
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = void 0;
|
|
9
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
|
+
|
|
10
20
|
var _react = _interopRequireDefault(require("react"));
|
|
11
21
|
|
|
12
22
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -27,28 +37,10 @@ var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
|
|
|
27
37
|
|
|
28
38
|
var _i18n = _interopRequireDefault(require("../i18n"));
|
|
29
39
|
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
33
|
-
|
|
34
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
35
|
-
|
|
36
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
37
|
-
|
|
38
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
39
|
-
|
|
40
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
41
|
-
|
|
42
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
43
|
-
|
|
44
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
45
|
-
|
|
46
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
40
|
+
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
41
|
|
|
48
42
|
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
43
|
|
|
50
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
51
|
-
|
|
52
44
|
/**
|
|
53
45
|
* @typedef {object} DialogMessageProps
|
|
54
46
|
* @property {string} [key] The key to identify this component.
|
|
@@ -59,17 +51,16 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
59
51
|
* @extends {React.Component<DialogMessageProps>}
|
|
60
52
|
*/
|
|
61
53
|
var DialogMessage = /*#__PURE__*/function (_React$Component) {
|
|
62
|
-
|
|
54
|
+
(0, _inherits2["default"])(DialogMessage, _React$Component);
|
|
63
55
|
|
|
64
56
|
var _super = _createSuper(DialogMessage);
|
|
65
57
|
|
|
66
58
|
function DialogMessage() {
|
|
67
|
-
|
|
68
|
-
|
|
59
|
+
(0, _classCallCheck2["default"])(this, DialogMessage);
|
|
69
60
|
return _super.apply(this, arguments);
|
|
70
61
|
}
|
|
71
62
|
|
|
72
|
-
|
|
63
|
+
(0, _createClass2["default"])(DialogMessage, [{
|
|
73
64
|
key: "handleOk",
|
|
74
65
|
value: function handleOk() {
|
|
75
66
|
this.props.onClose && this.props.onClose();
|
|
@@ -103,7 +94,6 @@ var DialogMessage = /*#__PURE__*/function (_React$Component) {
|
|
|
103
94
|
}, _i18n["default"].t('ra_Close'))));
|
|
104
95
|
}
|
|
105
96
|
}]);
|
|
106
|
-
|
|
107
97
|
return DialogMessage;
|
|
108
98
|
}(_react["default"].Component);
|
|
109
99
|
|
package/Dialogs/Message.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"Message.js","names":["DialogMessage","props","onClose","handleOk","title","I18n","t","text","React","Component","propTypes","PropTypes","func","isRequired","string","icon","object"],"sources":["Message.js"],"sourcesContent":["/**\n * Copyright 2018-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';\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';\n\nimport IconClose from '@mui/icons-material/Close';\n\nimport I18n from '../i18n';\n\n/**\n * @typedef {object} DialogMessageProps\n * @property {string} [key] The key to identify this component.\n * @property {string} [title] The dialog title; default: Message (translated)\n * @property {string} text The dialog text.\n * @property {() => void} [onClose] Close handler.\n *\n * @extends {React.Component<DialogMessageProps>}\n */\nclass DialogMessage extends React.Component {\n\n handleOk() {\n this.props.onClose && this.props.onClose();\n };\n\n render() {\n return <Dialog\n open={true}\n maxWidth=\"sm\"\n fullWidth={true}\n onClose={() => this.handleOk()}\n aria-labelledby=\"message-dialog-title\"\n aria-describedby=\"message-dialog-description\"\n >\n <DialogTitle id=\"message-dialog-title\">{this.props.title || I18n.t('ra_Message')}</DialogTitle>\n <DialogContent>\n <DialogContentText id=\"message-dialog-description\">\n {this.props.text}\n </DialogContentText>\n </DialogContent>\n <DialogActions>\n <Button variant=\"contained\" onClick={() => this.handleOk()} color=\"primary\" autoFocus startIcon={<IconClose />}>{I18n.t('ra_Close')}</Button>\n </DialogActions>\n </Dialog>;\n }\n}\n\nDialogMessage.propTypes = {\n onClose: PropTypes.func.isRequired,\n title: PropTypes.string,\n text: PropTypes.string,\n icon: PropTypes.object\n};\n\nexport default DialogMessage;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAQA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AAEA;;;;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACMA,a;;;;;;;;;;;;WAEF,oBAAW;MACP,KAAKC,KAAL,CAAWC,OAAX,IAAsB,KAAKD,KAAL,CAAWC,OAAX,EAAtB;IACH;;;WAED,kBAAS;MAAA;;MACL,oBAAO,gCAAC,kBAAD;QACH,IAAI,EAAE,IADH;QAEH,QAAQ,EAAC,IAFN;QAGH,SAAS,EAAE,IAHR;QAIH,OAAO,EAAE;UAAA,OAAM,KAAI,CAACC,QAAL,EAAN;QAAA,CAJN;QAKH,mBAAgB,sBALb;QAMH,oBAAiB;MANd,gBAQH,gCAAC,uBAAD;QAAa,EAAE,EAAC;MAAhB,GAAwC,KAAKF,KAAL,CAAWG,KAAX,IAAoBC,gBAAA,CAAKC,CAAL,CAAO,YAAP,CAA5D,CARG,eASH,gCAAC,yBAAD,qBACI,gCAAC,6BAAD;QAAmB,EAAE,EAAC;MAAtB,GACK,KAAKL,KAAL,CAAWM,IADhB,CADJ,CATG,eAcH,gCAAC,yBAAD,qBACI,gCAAC,kBAAD;QAAQ,OAAO,EAAC,WAAhB;QAA4B,OAAO,EAAE;UAAA,OAAM,KAAI,CAACJ,QAAL,EAAN;QAAA,CAArC;QAA4D,KAAK,EAAC,SAAlE;QAA4E,SAAS,MAArF;QAAsF,SAAS,eAAE,gCAAC,iBAAD;MAAjG,GAAiHE,gBAAA,CAAKC,CAAL,CAAO,UAAP,CAAjH,CADJ,CAdG,CAAP;IAkBH;;;EAzBuBE,iBAAA,CAAMC,S;;AA4BlCT,aAAa,CAACU,SAAd,GAA0B;EACtBR,OAAO,EAAES,qBAAA,CAAUC,IAAV,CAAeC,UADF;EAEtBT,KAAK,EAAEO,qBAAA,CAAUG,MAFK;EAGtBP,IAAI,EAAEI,qBAAA,CAAUG,MAHM;EAItBC,IAAI,EAAEJ,qBAAA,CAAUK;AAJM,CAA1B;eAOehB,a"}
|
package/Dialogs/SelectID.js
CHANGED
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports["default"] = void 0;
|
|
7
9
|
|
|
10
|
+
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
11
|
+
|
|
12
|
+
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
13
|
+
|
|
14
|
+
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
+
|
|
16
|
+
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
17
|
+
|
|
18
|
+
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
+
|
|
20
|
+
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
21
|
+
|
|
8
22
|
var _react = _interopRequireDefault(require("react"));
|
|
9
23
|
|
|
10
24
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -31,30 +45,10 @@ var _i18n = _interopRequireDefault(require("../i18n"));
|
|
|
31
45
|
|
|
32
46
|
var _ObjectBrowser = _interopRequireDefault(require("../Components/ObjectBrowser"));
|
|
33
47
|
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
37
|
-
|
|
38
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
39
|
-
|
|
40
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
41
|
-
|
|
42
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
43
|
-
|
|
44
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
45
|
-
|
|
46
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
47
|
-
|
|
48
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
49
|
-
|
|
50
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
51
|
-
|
|
52
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
48
|
+
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); }; }
|
|
53
49
|
|
|
54
50
|
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; } }
|
|
55
51
|
|
|
56
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
57
|
-
|
|
58
52
|
var styles = function styles(theme) {
|
|
59
53
|
return {
|
|
60
54
|
headerID: {
|
|
@@ -116,7 +110,7 @@ var styles = function styles(theme) {
|
|
|
116
110
|
|
|
117
111
|
|
|
118
112
|
var SelectID = /*#__PURE__*/function (_React$Component) {
|
|
119
|
-
|
|
113
|
+
(0, _inherits2["default"])(SelectID, _React$Component);
|
|
120
114
|
|
|
121
115
|
var _super = _createSuper(SelectID);
|
|
122
116
|
|
|
@@ -126,8 +120,7 @@ var SelectID = /*#__PURE__*/function (_React$Component) {
|
|
|
126
120
|
function SelectID(props) {
|
|
127
121
|
var _this;
|
|
128
122
|
|
|
129
|
-
|
|
130
|
-
|
|
123
|
+
(0, _classCallCheck2["default"])(this, SelectID);
|
|
131
124
|
_this = _super.call(this, props);
|
|
132
125
|
_this.dialogName = _this.props.dialogName || 'default';
|
|
133
126
|
_this.dialogName = 'SelectID.' + _this.dialogName;
|
|
@@ -141,7 +134,7 @@ var SelectID = /*#__PURE__*/function (_React$Component) {
|
|
|
141
134
|
|
|
142
135
|
var selected = _this.props.selected || [];
|
|
143
136
|
|
|
144
|
-
if (
|
|
137
|
+
if ((0, _typeof2["default"])(selected) !== 'object') {
|
|
145
138
|
selected = [selected];
|
|
146
139
|
}
|
|
147
140
|
|
|
@@ -156,7 +149,7 @@ var SelectID = /*#__PURE__*/function (_React$Component) {
|
|
|
156
149
|
return _this;
|
|
157
150
|
}
|
|
158
151
|
|
|
159
|
-
|
|
152
|
+
(0, _createClass2["default"])(SelectID, [{
|
|
160
153
|
key: "handleCancel",
|
|
161
154
|
value: function handleCancel() {
|
|
162
155
|
this.props.onClose();
|
|
@@ -268,7 +261,6 @@ var SelectID = /*#__PURE__*/function (_React$Component) {
|
|
|
268
261
|
}, this.props.cancel || _i18n["default"].t('ra_Cancel'))));
|
|
269
262
|
}
|
|
270
263
|
}]);
|
|
271
|
-
|
|
272
264
|
return SelectID;
|
|
273
265
|
}(_react["default"].Component);
|
|
274
266
|
|
package/Dialogs/SelectID.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["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"],"mappings":";;;;;;;AAOA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;AAAA,SAAK;AACrBC,IAAAA,QAAQ,EAAE;AACNC,MAAAA,UAAU,EAAE,MADN;AAENC,MAAAA,SAAS,EAAE;AAFL,KADW;AAKrBC,IAAAA,MAAM,EAAE;AACJC,MAAAA,MAAM,EAAE;AADJ,KALa;AAQrBC,IAAAA,YAAY,EAAE;AACVC,MAAAA,OAAO,EAAE,CADC;AAEVC,MAAAA,KAAK,EAAE,MAFG;AAGVC,MAAAA,QAAQ,EAAE,MAHA;AAIVC,MAAAA,SAAS,EAAE,mBAJD;AAKVL,MAAAA,MAAM,EAAE;AALE,KARO;AAerBM,IAAAA,OAAO,EAAE;AACLN,MAAAA,MAAM,EAAE,MADH;AAELO,MAAAA,QAAQ,EAAE;AAFL,KAfY;AAmBrBC,IAAAA,aAAa,EAAE;AACXN,MAAAA,OAAO,EAAE;AADE,KAnBM;AAsBrBO,IAAAA,SAAS,EAAE;AACPC,MAAAA,UAAU,EAAE,QADL;AAEPP,MAAAA,KAAK,EAAE,mBAFA;AAGPI,MAAAA,QAAQ,EAAE,QAHH;AAIP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AX,EAAmBmB,QAAnB,CAAhB;;eACemE,O","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"],"file":"SelectID.js"}
|
|
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,MAAM,EAAE;IALE,CARO;IAerBM,OAAO,EAAE;MACLN,MAAM,EAAE,MADH;MAELO,QAAQ,EAAE;IAFL,CAfY;IAm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
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = void 0;
|
|
9
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
|
+
|
|
10
20
|
var _react = _interopRequireDefault(require("react"));
|
|
11
21
|
|
|
12
22
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -31,28 +41,10 @@ var _SimpleCron = _interopRequireDefault(require("../Components/SimpleCron"));
|
|
|
31
41
|
|
|
32
42
|
var _i18n = _interopRequireDefault(require("../i18n"));
|
|
33
43
|
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
37
|
-
|
|
38
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
39
|
-
|
|
40
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
41
|
-
|
|
42
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
43
|
-
|
|
44
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
45
|
-
|
|
46
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
47
|
-
|
|
48
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
49
|
-
|
|
50
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
44
|
+
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); }; }
|
|
51
45
|
|
|
52
46
|
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; } }
|
|
53
47
|
|
|
54
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
55
|
-
|
|
56
48
|
// Generate cron expression
|
|
57
49
|
var styles = function styles(theme) {
|
|
58
50
|
return {
|
|
@@ -70,15 +62,14 @@ var styles = function styles(theme) {
|
|
|
70
62
|
};
|
|
71
63
|
|
|
72
64
|
var DialogSimpleCron = /*#__PURE__*/function (_React$Component) {
|
|
73
|
-
|
|
65
|
+
(0, _inherits2["default"])(DialogSimpleCron, _React$Component);
|
|
74
66
|
|
|
75
67
|
var _super = _createSuper(DialogSimpleCron);
|
|
76
68
|
|
|
77
69
|
function DialogSimpleCron(props) {
|
|
78
70
|
var _this;
|
|
79
71
|
|
|
80
|
-
|
|
81
|
-
|
|
72
|
+
(0, _classCallCheck2["default"])(this, DialogSimpleCron);
|
|
82
73
|
_this = _super.call(this, props);
|
|
83
74
|
var cron;
|
|
84
75
|
|
|
@@ -98,7 +89,7 @@ var DialogSimpleCron = /*#__PURE__*/function (_React$Component) {
|
|
|
98
89
|
return _this;
|
|
99
90
|
}
|
|
100
91
|
|
|
101
|
-
|
|
92
|
+
(0, _createClass2["default"])(DialogSimpleCron, [{
|
|
102
93
|
key: "handleCancel",
|
|
103
94
|
value: function handleCancel() {
|
|
104
95
|
this.props.onClose();
|
|
@@ -155,7 +146,6 @@ var DialogSimpleCron = /*#__PURE__*/function (_React$Component) {
|
|
|
155
146
|
}, this.props.cancel || _i18n["default"].t('ra_Cancel'))));
|
|
156
147
|
}
|
|
157
148
|
}]);
|
|
158
|
-
|
|
159
149
|
return DialogSimpleCron;
|
|
160
150
|
}(_react["default"].Component);
|
|
161
151
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"SimpleCron.js","names":["styles","theme","headerID","fontWeight","fontStyle","radio","display","dialogPaper","height","DialogSimpleCron","props","cron","replace","trim","state","onClose","onOk","paper","classes","title","I18n","t","overflow","setState","getLanguage","handleOk","ok","handleCancel","cancel","React","Component","propTypes","PropTypes","object","func","isRequired","string","simple","bool","language","withStyles"],"sources":["SimpleCron.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport withStyles from '@mui/styles/withStyles';\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 IconOk from '@mui/icons-material/Check';\nimport IconCancel from '@mui/icons-material/Cancel';\n\nimport SimpleCron from '../Components/SimpleCron';\n\nimport I18n from '../i18n';\n\n// Generate cron expression\n\nconst styles = theme => ({\n headerID: {\n fontWeight: 'bold',\n fontStyle: 'italic'\n },\n radio: {\n display: 'inline-block'\n },\n dialogPaper: {\n height: 'calc(100% - 96px)'\n },\n});\n\nclass DialogSimpleCron extends React.Component {\n constructor(props) {\n super(props);\n\n let cron;\n if (this.props.cron && typeof this.props.cron === 'string' && this.props.cron.replace(/^[\"']/, '')[0] !== '{') {\n cron = this.props.cron.replace(/['\"]/g, '').trim();\n } else {\n cron = this.props.cron || '{}';\n if (typeof cron === 'string') {\n cron = cron.replace(/^[\"']/, '').replace(/[\"']\\n?$/, '');\n }\n }\n\n this.state = {\n cron,\n };\n }\n\n handleCancel() {\n this.props.onClose();\n }\n\n handleOk() {\n this.props.onOk(this.state.cron);\n this.props.onClose();\n }\n\n render() {\n return <Dialog\n onClose={() => {}}\n maxWidth=\"md\"\n fullWidth={true}\n classes={{paper: this.props.classes.dialogPaper}}\n open={true}\n aria-labelledby=\"cron-dialog-title\"\n >\n <DialogTitle id=\"cron-dialog-title\">{this.props.title || I18n.t('ra_Define CRON...')}</DialogTitle>\n <DialogContent style={{height: '100%', overflow: 'hidden'}}>\n <SimpleCron\n cronExpression={this.state.cron}\n onChange={cron => this.setState({cron})}\n language={I18n.getLanguage()}\n />\n </DialogContent>\n <DialogActions>\n <Button variant=\"contained\" onClick={() => this.handleOk()} color=\"primary\" startIcon={<IconOk />}>{this.props.ok || I18n.t('ra_Ok')}</Button>\n <Button variant=\"contained\" onClick={() => this.handleCancel()} color=\"grey\" startIcon={<IconCancel />}>{this.props.cancel || I18n.t('ra_Cancel')}</Button>\n </DialogActions>\n </Dialog>;\n }\n}\n\nDialogSimpleCron.propTypes = {\n classes: PropTypes.object,\n onClose: PropTypes.func.isRequired,\n onOk: PropTypes.func.isRequired,\n title: PropTypes.string,\n cron: PropTypes.string,\n cancel: PropTypes.string,\n ok: PropTypes.string,\n simple: PropTypes.bool,\n language: PropTypes.string\n\n};\n\nexport default withStyles(styles)(DialogSimpleCron);\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AAEA;;AAEA;;;;;;AAEA;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;EAAA,OAAK;IACrBC,QAAQ,EAAE;MACNC,UAAU,EAAE,MADN;MAENC,SAAS,EAAE;IAFL,CADW;IAKrBC,KAAK,EAAE;MACHC,OAAO,EAAE;IADN,CALc;IAQrBC,WAAW,EAAE;MACTC,MAAM,EAAE;IADC;EARQ,CAAL;AAAA,CAApB;;IAaMC,gB;;;;;EACF,0BAAYC,KAAZ,EAAmB;IAAA;;IAAA;IACf,0BAAMA,KAAN;IAEA,IAAIC,IAAJ;;IACA,IAAI,MAAKD,KAAL,CAAWC,IAAX,IAAmB,OAAO,MAAKD,KAAL,CAAWC,IAAlB,KAA2B,QAA9C,IAA0D,MAAKD,KAAL,CAAWC,IAAX,CAAgBC,OAAhB,CAAwB,OAAxB,EAAiC,EAAjC,EAAqC,CAArC,MAA4C,GAA1G,EAA+G;MAC3GD,IAAI,GAAG,MAAKD,KAAL,CAAWC,IAAX,CAAgBC,OAAhB,CAAwB,OAAxB,EAAiC,EAAjC,EAAqCC,IAArC,EAAP;IACH,CAFD,MAEO;MACHF,IAAI,GA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Default");
|
|
4
4
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = void 0;
|
|
9
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 _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
21
|
+
|
|
10
22
|
var _react = _interopRequireDefault(require("react"));
|
|
11
23
|
|
|
12
24
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -31,35 +43,15 @@ var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
|
|
|
31
43
|
|
|
32
44
|
var _Check = _interopRequireDefault(require("@mui/icons-material/Check"));
|
|
33
45
|
|
|
34
|
-
function
|
|
35
|
-
|
|
36
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
37
|
-
|
|
38
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
39
|
-
|
|
40
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
41
|
-
|
|
42
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
43
|
-
|
|
44
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
45
|
-
|
|
46
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
47
|
-
|
|
48
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
49
|
-
|
|
50
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
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); }; }
|
|
51
47
|
|
|
52
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; } }
|
|
53
49
|
|
|
54
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
55
|
-
|
|
56
|
-
function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
57
|
-
|
|
58
50
|
// FIXME checkout https://mui.com/components/use-media-query/#migrating-from-withwidth
|
|
59
51
|
var withWidth = function withWidth() {
|
|
60
52
|
return function (WrappedComponent) {
|
|
61
53
|
return function (props) {
|
|
62
|
-
return /*#__PURE__*/_react["default"].createElement(WrappedComponent,
|
|
54
|
+
return /*#__PURE__*/_react["default"].createElement(WrappedComponent, (0, _extends2["default"])({}, props, {
|
|
63
55
|
width: "xs"
|
|
64
56
|
}));
|
|
65
57
|
};
|
|
@@ -84,7 +76,7 @@ var withWidth = function withWidth() {
|
|
|
84
76
|
|
|
85
77
|
|
|
86
78
|
var TextInput = /*#__PURE__*/function (_React$Component) {
|
|
87
|
-
|
|
79
|
+
(0, _inherits2["default"])(TextInput, _React$Component);
|
|
88
80
|
|
|
89
81
|
var _super = _createSuper(TextInput);
|
|
90
82
|
|
|
@@ -94,8 +86,7 @@ var TextInput = /*#__PURE__*/function (_React$Component) {
|
|
|
94
86
|
function TextInput(props) {
|
|
95
87
|
var _this;
|
|
96
88
|
|
|
97
|
-
|
|
98
|
-
|
|
89
|
+
(0, _classCallCheck2["default"])(this, TextInput);
|
|
99
90
|
_this = _super.call(this, props);
|
|
100
91
|
_this.state = {
|
|
101
92
|
text: _this.props.input || _this.props.value || '',
|
|
@@ -105,7 +96,7 @@ var TextInput = /*#__PURE__*/function (_React$Component) {
|
|
|
105
96
|
return _this;
|
|
106
97
|
}
|
|
107
98
|
|
|
108
|
-
|
|
99
|
+
(0, _createClass2["default"])(TextInput, [{
|
|
109
100
|
key: "render",
|
|
110
101
|
value: function render() {
|
|
111
102
|
var _this2 = this;
|
|
@@ -168,7 +159,6 @@ var TextInput = /*#__PURE__*/function (_React$Component) {
|
|
|
168
159
|
}, this.props.cancelText || _i18n["default"].t('ra_Cancel'))));
|
|
169
160
|
}
|
|
170
161
|
}]);
|
|
171
|
-
|
|
172
162
|
return TextInput;
|
|
173
163
|
}(_react["default"].Component);
|
|
174
164
|
|
package/Dialogs/TextInput.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"TextInput.js","names":["withWidth","WrappedComponent","props","TextInput","state","text","input","value","error","onClose","titleText","promptText","labelText","type","e","charCode","verify","target","rule","setState","applyText","I18n","t","cancelText","React","Component","propTypes","PropTypes","func","isRequired","string","replace","_export"],"sources":["TextInput.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nimport Button from '@mui/material/Button';\nimport TextField from '@mui/material/TextField';\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';\n\nimport I18n from '../i18n';\n\nimport IconClose from '@mui/icons-material/Close';\nimport IconCheck from '@mui/icons-material/Check';\n\n// FIXME checkout https://mui.com/components/use-media-query/#migrating-from-withwidth\nconst withWidth = () => WrappedComponent => props => <WrappedComponent {...props} width=\"xs\" />;\n\n/**\n * @typedef {object} TextInputProps\n * @property {string} [key] The key to identify this component.\n * @property {(text: string | null) => void} onClose The dialog close callback.\n * @property {string} titleText The title text.\n * @property {string} [promptText] Prompt text (default: empty).\n * @property {string} [labelText] Label text (default: empty).\n * @property {string} cancelText The text of the cancel button.\n * @property {string} applyText The text of the apply button.\n * @property {(text: string) => string} [verify] The verification callback. Return a non-empty string if there was an error.\n * @property {(text: string) => string} [rule] The text replacement callback.\n * @property {'text' | 'number' | 'password' | 'email'} [type] The type of the textbox (default: text).\n * @property {string} [input] The input when opening the dialog.\n *\n * @extends {React.Component<TextInputProps>}\n */\nclass TextInput extends React.Component {\n /**\n * @param {Readonly<TextInputProps>} props\n */\n constructor(props) {\n super(props);\n\n this.state = {\n text: this.props.input || this.props.value || '', // input is deprectaed\n error: ''\n }\n }\n render() {\n return <Dialog open={true} onClose={() => this.props.onClose(null)} aria-labelledby=\"form-dialog-title\">\n <DialogTitle id=\"form-dialog-title\">{this.props.titleText}</DialogTitle>\n <DialogContent>\n <DialogContentText>\n {this.props.promptText}\n </DialogContentText>\n <TextField\n variant=\"standard\"\n autoFocus\n margin=\"dense\"\n error={!!this.state.error}\n title={this.state.error}\n value={this.state.text}\n label={this.props.labelText || ''}\n type={this.props.type || 'text'}\n onKeyPress={e => e.charCode === 13 && this.state.text && this.props.onClose(this.state.text)}\n onChange={e => {\n let error = '';\n if (this.props.verify) {\n error = !this.props.verify(e.target.value);\n }\n\n if (this.props.rule) {\n this.setState({text: this.props.rule(e.target.value), error});\n } else {\n this.setState({text: e.target.value, error});\n }\n }}\n fullWidth\n />\n </DialogContent>\n <DialogActions>\n <Button variant=\"contained\" disabled={!this.state.text || this.state.error} onClick={() => this.props.onClose(this.state.text)}\n color=\"primary\" startIcon={<IconCheck />}>{this.props.applyText || I18n.t('ra_Ok')}</Button>\n <Button color=\"grey\" variant=\"contained\" onClick={() => this.props.onClose(null)} startIcon={<IconClose />}>{this.props.cancelText || I18n.t('ra_Cancel')}</Button>\n </DialogActions>\n </Dialog>;\n }\n}\n\nTextInput.propTypes = {\n onClose: PropTypes.func.isRequired,\n titleText: PropTypes.string.isRequired,\n promptText: PropTypes.string,\n labelText: PropTypes.string,\n cancelText: PropTypes.string,\n applyText: PropTypes.string,\n verify: PropTypes.func,\n replace: PropTypes.func,\n type: PropTypes.string, // text, number, password, email\n value: PropTypes.string,\n};\n\n/** @type {typeof TextInput} */\ncon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