@iobroker/adapter-react-v5 4.7.14 → 4.8.0
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/JsonConfigComponent/ConfigAccordion.d.ts +1 -1
- package/Components/JsonConfigComponent/ConfigAccordion.js +4 -6
- package/Components/JsonConfigComponent/ConfigAccordion.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigAlive.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigAutocomplete.d.ts +36 -13
- package/Components/JsonConfigComponent/ConfigAutocomplete.js +66 -164
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.d.ts +16 -13
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js +119 -251
- package/Components/JsonConfigComponent/ConfigCRON.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigCertCollection.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigCertificateSelect.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigCertificates.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigCheckbox.d.ts +14 -13
- package/Components/JsonConfigComponent/ConfigCheckbox.js +37 -79
- package/Components/JsonConfigComponent/ConfigChip.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigColor.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigCoordinates.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigDatePicker.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigDeviceManager.d.ts +6 -0
- package/Components/JsonConfigComponent/ConfigDeviceManager.js +18 -0
- package/Components/JsonConfigComponent/ConfigFile.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigFile.js +2 -2
- package/Components/JsonConfigComponent/ConfigFile.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigFileSelector.js +8 -5
- package/Components/JsonConfigComponent/ConfigFileSelector.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigFunc.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigGeneric.d.ts +12 -4
- package/Components/JsonConfigComponent/ConfigGeneric.js +11 -2
- package/Components/JsonConfigComponent/ConfigIP.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigImageSendTo.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigImageUpload.js +38 -44
- package/Components/JsonConfigComponent/ConfigImageUpload.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigInstanceSelect.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigInterface.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigInterface.js +1 -1
- package/Components/JsonConfigComponent/ConfigInterface.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigJsonEditor.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigJsonEditor.js +0 -1
- package/Components/JsonConfigComponent/ConfigJsonEditor.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigLanguage.d.ts +6 -13
- package/Components/JsonConfigComponent/ConfigLanguage.js +105 -154
- package/Components/JsonConfigComponent/ConfigLicense.d.ts +1 -1
- package/Components/JsonConfigComponent/ConfigNumber.d.ts +1 -1
- package/Components/JsonConfigComponent/ConfigObjectId.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigPanel.js +8 -1
- package/Components/JsonConfigComponent/ConfigPanel.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPassword.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigPattern.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigRoom.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigSelect.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigSelectSendTo.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigSendto.d.ts +23 -17
- package/Components/JsonConfigComponent/ConfigSendto.js +259 -399
- package/Components/JsonConfigComponent/ConfigSetState.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigSlider.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigStaticDivider.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigStaticHeader.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigStaticImage.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigStaticText.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigText.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigText.js +18 -0
- package/Components/JsonConfigComponent/ConfigText.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTextSendTo.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigTimePicker.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigTopic.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigUUID.d.ts +2 -2
- package/Components/JsonConfigComponent/ConfigUser.d.ts +2 -2
- package/Components/JsonConfigComponent/DeviceManager/Communication.d.ts +63 -0
- package/Components/JsonConfigComponent/DeviceManager/Communication.js +268 -0
- package/Components/JsonConfigComponent/DeviceManager/DeviceActionButton.d.ts +11 -0
- package/Components/JsonConfigComponent/DeviceManager/DeviceActionButton.js +15 -0
- package/Components/JsonConfigComponent/DeviceManager/DeviceCard.d.ts +53 -0
- package/Components/JsonConfigComponent/DeviceManager/DeviceCard.js +340 -0
- package/Components/JsonConfigComponent/DeviceManager/DeviceControl.d.ts +45 -0
- package/Components/JsonConfigComponent/DeviceManager/DeviceControl.js +146 -0
- package/Components/JsonConfigComponent/DeviceManager/DeviceImageUpload.d.ts +12 -0
- package/Components/JsonConfigComponent/DeviceManager/DeviceImageUpload.js +69 -0
- package/Components/JsonConfigComponent/DeviceManager/DeviceList.d.ts +51 -0
- package/Components/JsonConfigComponent/DeviceManager/DeviceList.js +216 -0
- package/Components/JsonConfigComponent/DeviceManager/DeviceStatus.d.ts +13 -0
- package/Components/JsonConfigComponent/DeviceManager/DeviceStatus.js +111 -0
- package/Components/JsonConfigComponent/DeviceManager/InstanceActionButton.d.ts +7 -0
- package/Components/JsonConfigComponent/DeviceManager/InstanceActionButton.js +16 -0
- package/Components/JsonConfigComponent/DeviceManager/JsonConfig.d.ts +11 -0
- package/Components/JsonConfigComponent/DeviceManager/JsonConfig.js +94 -0
- package/Components/JsonConfigComponent/DeviceManager/TooltipButton.d.ts +10 -0
- package/Components/JsonConfigComponent/DeviceManager/TooltipButton.js +22 -0
- package/Components/JsonConfigComponent/DeviceManager/Utils.d.ts +12 -0
- package/Components/JsonConfigComponent/DeviceManager/Utils.js +158 -0
- package/Components/JsonConfigComponent/DeviceManager/i18n/de.json +21 -0
- package/Components/JsonConfigComponent/DeviceManager/i18n/en.json +21 -0
- package/Components/JsonConfigComponent/DeviceManager/i18n/es.json +21 -0
- package/Components/JsonConfigComponent/DeviceManager/i18n/fr.json +21 -0
- package/Components/JsonConfigComponent/DeviceManager/i18n/i18n.d.ts +26 -0
- package/Components/JsonConfigComponent/DeviceManager/i18n/it.json +21 -0
- package/Components/JsonConfigComponent/DeviceManager/i18n/nl.json +21 -0
- package/Components/JsonConfigComponent/DeviceManager/i18n/pl.json +21 -0
- package/Components/JsonConfigComponent/DeviceManager/i18n/pt.json +21 -0
- package/Components/JsonConfigComponent/DeviceManager/i18n/ru.json +21 -0
- package/Components/JsonConfigComponent/DeviceManager/i18n/uk.json +21 -0
- package/Components/JsonConfigComponent/DeviceManager/i18n/zh-cn.json +21 -0
- package/Components/JsonConfigComponent/DeviceManager/index.d.ts +2 -0
- package/Components/JsonConfigComponent/DeviceManager/index.js +10 -0
- package/Components/JsonConfigComponent/DeviceManager/index.js.map +1 -0
- package/Components/JsonConfigComponent/index.js +2 -7
- package/Components/JsonConfigComponent/index.js.map +1 -1
- package/Components/TextWithIcon.d.ts +1 -1
- package/Components/Utils.js +1 -1
- package/Components/Utils.js.map +1 -1
- package/Dialogs/ComplexCron.js +15 -17
- package/Dialogs/ComplexCron.js.map +1 -1
- package/Dialogs/Confirm.d.ts +20 -44
- package/Dialogs/Confirm.js +102 -158
- package/Dialogs/Error.d.ts +20 -39
- package/Dialogs/Error.js +50 -76
- package/Dialogs/Message.d.ts +22 -32
- package/Dialogs/Message.js +51 -83
- package/LegacyConnection.d.ts +3 -3
- package/README.md +9 -6
- package/i18n.d.ts +6 -6
- package/package.json +6 -5
- package/Components/JsonConfigComponent/ConfigAutocomplete.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigCheckbox.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigLanguage.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigSendto.js.map +0 -1
- package/Dialogs/Confirm.js.map +0 -1
- package/Dialogs/Error.js.map +0 -1
- package/Dialogs/Message.js.map +0 -1
package/Dialogs/ComplexCron.js
CHANGED
|
@@ -13,14 +13,8 @@ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/ge
|
|
|
13
13
|
var _react = _interopRequireDefault(require("react"));
|
|
14
14
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
15
|
var _styles = require("@mui/styles");
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var _DialogContent = _interopRequireDefault(require("@mui/material/DialogContent"));
|
|
19
|
-
var _DialogActions = _interopRequireDefault(require("@mui/material/DialogActions"));
|
|
20
|
-
var _Dialog = _interopRequireDefault(require("@mui/material/Dialog"));
|
|
21
|
-
var _Check = _interopRequireDefault(require("@mui/icons-material/Check"));
|
|
22
|
-
var _Cancel = _interopRequireDefault(require("@mui/icons-material/Cancel"));
|
|
23
|
-
var _Delete = _interopRequireDefault(require("@mui/icons-material/Delete"));
|
|
16
|
+
var _material = require("@mui/material");
|
|
17
|
+
var _iconsMaterial = require("@mui/icons-material");
|
|
24
18
|
var _ComplexCron = _interopRequireDefault(require("../Components/ComplexCron"));
|
|
25
19
|
var _i18n = _interopRequireDefault(require("../i18n"));
|
|
26
20
|
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); }; }
|
|
@@ -82,7 +76,7 @@ var DialogComplexCron = /*#__PURE__*/function (_React$Component) {
|
|
|
82
76
|
key: "render",
|
|
83
77
|
value: function render() {
|
|
84
78
|
var _this2 = this;
|
|
85
|
-
return /*#__PURE__*/_react["default"].createElement(
|
|
79
|
+
return /*#__PURE__*/_react["default"].createElement(_material.Dialog, {
|
|
86
80
|
onClose: function onClose() {},
|
|
87
81
|
maxWidth: "md",
|
|
88
82
|
fullWidth: true,
|
|
@@ -91,9 +85,9 @@ var DialogComplexCron = /*#__PURE__*/function (_React$Component) {
|
|
|
91
85
|
},
|
|
92
86
|
open: !0,
|
|
93
87
|
"aria-labelledby": "cron-dialog-title"
|
|
94
|
-
}, /*#__PURE__*/_react["default"].createElement(
|
|
88
|
+
}, /*#__PURE__*/_react["default"].createElement(_material.DialogTitle, {
|
|
95
89
|
id: "cron-dialog-title"
|
|
96
|
-
}, this.props.title || _i18n["default"].t('ra_Define schedule...')), /*#__PURE__*/_react["default"].createElement(
|
|
90
|
+
}, this.props.title || _i18n["default"].t('ra_Define schedule...')), /*#__PURE__*/_react["default"].createElement(_material.DialogContent, {
|
|
97
91
|
style: {
|
|
98
92
|
height: '100%',
|
|
99
93
|
overflow: 'hidden'
|
|
@@ -106,27 +100,31 @@ var DialogComplexCron = /*#__PURE__*/function (_React$Component) {
|
|
|
106
100
|
});
|
|
107
101
|
},
|
|
108
102
|
language: _i18n["default"].getLanguage()
|
|
109
|
-
})), /*#__PURE__*/_react["default"].createElement(
|
|
103
|
+
})), /*#__PURE__*/_react["default"].createElement(_material.DialogActions, null, !!this.props.clearButton && /*#__PURE__*/_react["default"].createElement(_material.Button
|
|
104
|
+
// @ts-expect-error
|
|
105
|
+
, {
|
|
110
106
|
color: "grey",
|
|
111
107
|
variant: "contained",
|
|
112
108
|
onClick: function onClick() {
|
|
113
109
|
return _this2.handleClear();
|
|
114
110
|
},
|
|
115
|
-
startIcon: /*#__PURE__*/_react["default"].createElement(
|
|
116
|
-
}, this.props.clear || _i18n["default"].t('ra_Clear')), /*#__PURE__*/_react["default"].createElement(
|
|
111
|
+
startIcon: /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Delete, null)
|
|
112
|
+
}, this.props.clear || _i18n["default"].t('ra_Clear')), /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
117
113
|
variant: "contained",
|
|
118
114
|
onClick: function onClick() {
|
|
119
115
|
return _this2.handleOk();
|
|
120
116
|
},
|
|
121
117
|
color: "primary",
|
|
122
|
-
startIcon: /*#__PURE__*/_react["default"].createElement(
|
|
123
|
-
}, this.props.ok || _i18n["default"].t('ra_Ok')), /*#__PURE__*/_react["default"].createElement(
|
|
118
|
+
startIcon: /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Check, null)
|
|
119
|
+
}, this.props.ok || _i18n["default"].t('ra_Ok')), /*#__PURE__*/_react["default"].createElement(_material.Button
|
|
120
|
+
// @ts-expect-error
|
|
121
|
+
, {
|
|
124
122
|
color: "grey",
|
|
125
123
|
variant: "contained",
|
|
126
124
|
onClick: function onClick() {
|
|
127
125
|
return _this2.handleCancel();
|
|
128
126
|
},
|
|
129
|
-
startIcon: /*#__PURE__*/_react["default"].createElement(
|
|
127
|
+
startIcon: /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Cancel, null)
|
|
130
128
|
}, this.props.cancel || _i18n["default"].t('ra_Cancel'))));
|
|
131
129
|
}
|
|
132
130
|
}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ComplexCron.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","
|
|
1
|
+
{"version":3,"file":"ComplexCron.js","names":["_react","_interopRequireDefault","require","_propTypes","_styles","_material","_iconsMaterial","_ComplexCron","_i18n","_createSuper","Derived","hasNativeReflectConstruct","_isNativeReflectConstruct","_createSuperInternal","Super","_getPrototypeOf2","result","NewTarget","constructor","Reflect","construct","arguments","apply","_possibleConstructorReturn2","sham","Proxy","Boolean","prototype","valueOf","call","e","styles","headerID","fontWeight","fontStyle","radio","display","dialogPaper","height","DialogComplexCron","_React$Component","_inherits2","_super","props","_this","_classCallCheck2","cron","replace","trim","state","_createClass2","key","value","handleCancel","onClose","handleOk","onOk","handleClear","render","_this2","createElement","Dialog","maxWidth","fullWidth","classes","paper","open","DialogTitle","id","title","I18n","t","DialogContent","style","overflow","cronExpression","onChange","setState","language","getLanguage","DialogActions","clearButton","Button","color","variant","onClick","startIcon","Delete","clear","Check","ok","Cancel","cancel","React","Component","propTypes","PropTypes","object","func","isRequired","string","bool","_default","exports","withStyles"],"sources":["ComplexCron.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@mui/styles';\n\nimport {\n Button,\n DialogTitle,\n DialogContent,\n DialogActions,\n Dialog,\n} from '@mui/material';\n\nimport {\n Check as IconOk,\n Cancel as IconCancel,\n Delete as IconClear,\n} from '@mui/icons-material';\n\nimport ComplexCron from '../Components/ComplexCron';\n\nimport I18n from '../i18n';\n\n// Generate cron expression\nconst styles = () => ({\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 DialogComplexCron extends React.Component {\n constructor(props) {\n super(props);\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 handleClear() {\n this.props.onOk(false);\n this.props.onClose();\n }\n\n render() {\n return <Dialog\n onClose={() => {}}\n maxWidth=\"md\"\n fullWidth\n classes={{ paper: this.props.classes.dialogPaper }}\n open={!0}\n aria-labelledby=\"cron-dialog-title\"\n >\n <DialogTitle id=\"cron-dialog-title\">{this.props.title || I18n.t('ra_Define schedule...')}</DialogTitle>\n <DialogContent style={{ height: '100%', overflow: 'hidden' }}>\n <ComplexCron\n cronExpression={this.state.cron}\n onChange={cron => this.setState({ cron })}\n language={I18n.getLanguage()}\n />\n </DialogContent>\n <DialogActions>\n {!!this.props.clearButton && <Button\n // @ts-expect-error\n color=\"grey\"\n variant=\"contained\"\n onClick={() => this.handleClear()}\n startIcon={<IconClear />}\n >\n {this.props.clear || I18n.t('ra_Clear')}\n </Button>}\n <Button\n variant=\"contained\"\n onClick={() => this.handleOk()}\n color=\"primary\"\n startIcon={<IconOk />}\n >\n {this.props.ok || I18n.t('ra_Ok')}\n </Button>\n <Button\n // @ts-expect-error\n color=\"grey\"\n variant=\"contained\"\n onClick={() => this.handleCancel()}\n startIcon={<IconCancel />}\n >\n {this.props.cancel || I18n.t('ra_Cancel')}\n </Button>\n </DialogActions>\n </Dialog>;\n }\n}\n\nDialogComplexCron.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 clearButton: PropTypes.bool,\n};\n\nexport default withStyles(styles)(DialogComplexCron);\n"],"mappings":";;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AAEA,IAAAG,SAAA,GAAAH,OAAA;AAQA,IAAAI,cAAA,GAAAJ,OAAA;AAMA,IAAAK,YAAA,GAAAN,sBAAA,CAAAC,OAAA;AAEA,IAAAM,KAAA,GAAAP,sBAAA,CAAAC,OAAA;AAA2B,SAAAO,aAAAC,OAAA,QA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S,CAACK;AAC3B,CAAC;AAAC,IAAAC,QAAA,GAAAC,OAAA,cAEa,IAAAC,kBAAU,EAACzE,MAAM,CAAC,CAACQ,iBAAiB,CAAC"}
|
package/Dialogs/Confirm.d.ts
CHANGED
|
@@ -1,49 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2019-2023 Denis Haev (bluefox) <dogafox@gmail.com>
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
**/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
interface DialogConfirmProps {
|
|
6
9
|
title?: string;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
text: string | React.JSX.Element;
|
|
11
|
+
onClose?: (ok: boolean) => void;
|
|
12
|
+
classes: {
|
|
13
|
+
suppress: string;
|
|
14
|
+
suppressRoot: string;
|
|
15
|
+
};
|
|
16
|
+
fullWidth?: boolean;
|
|
17
|
+
icon?: React.JSX.Element;
|
|
14
18
|
ok?: string;
|
|
15
|
-
/**
|
|
16
|
-
* The cancel button text; default: Cancel (translated)
|
|
17
|
-
*/
|
|
18
19
|
cancel?: string;
|
|
19
|
-
|
|
20
|
-
* interval in minutes for which the confirm dialog will be suppressed if activated.
|
|
21
|
-
*/
|
|
22
|
-
suppressQuestionMinutes?: string;
|
|
23
|
-
/**
|
|
24
|
-
* The suppress checkbox text; default: Suppress question for next %s minutes (translated)
|
|
25
|
-
*/
|
|
20
|
+
suppressQuestionMinutes?: number;
|
|
26
21
|
suppressText?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Name of the dialog. Used only with suppressQuestionMinutes to store the user choice
|
|
29
|
-
*/
|
|
30
22
|
dialogName?: string;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
onClose?: (ok: boolean) => void;
|
|
35
|
-
};
|
|
36
|
-
declare const _export: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
|
|
37
|
-
onClose: PropTypes.Validator<(...args: any[]) => any>;
|
|
38
|
-
fullWidth: PropTypes.Requireable<boolean>;
|
|
39
|
-
title: PropTypes.Requireable<string>;
|
|
40
|
-
text: PropTypes.Requireable<string>;
|
|
41
|
-
ok: PropTypes.Requireable<string>;
|
|
42
|
-
cancel: PropTypes.Requireable<string>;
|
|
43
|
-
icon: PropTypes.Requireable<object>;
|
|
44
|
-
suppressQuestionMinutes: PropTypes.Requireable<number>;
|
|
45
|
-
suppressText: PropTypes.Requireable<string>;
|
|
46
|
-
dialogName: PropTypes.Requireable<string>;
|
|
47
|
-
}>, "classes"> & import("@mui/styles").StyledComponentProps<"suppress" | "suppressRoot"> & object>;
|
|
48
|
-
import PropTypes from 'prop-types';
|
|
49
|
-
import React from 'react';
|
|
23
|
+
}
|
|
24
|
+
declare const _export: React.JSXElementConstructor<Omit<DialogConfirmProps, "classes"> & import("@mui/styles").StyledComponentProps<"suppress" | "suppressRoot"> & object>;
|
|
25
|
+
export default _export;
|
package/Dialogs/Confirm.js
CHANGED
|
@@ -1,170 +1,114 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports["default"] = void 0;
|
|
8
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
9
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
10
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
11
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
12
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
13
|
-
var _react = _interopRequireDefault(require("react"));
|
|
14
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
var _styles = require("@mui/styles");
|
|
16
|
-
var _Button = _interopRequireDefault(require("@mui/material/Button"));
|
|
17
|
-
var _Dialog = _interopRequireDefault(require("@mui/material/Dialog"));
|
|
18
|
-
var _DialogActions = _interopRequireDefault(require("@mui/material/DialogActions"));
|
|
19
|
-
var _DialogContent = _interopRequireDefault(require("@mui/material/DialogContent"));
|
|
20
|
-
var _DialogContentText = _interopRequireDefault(require("@mui/material/DialogContentText"));
|
|
21
|
-
var _DialogTitle = _interopRequireDefault(require("@mui/material/DialogTitle"));
|
|
22
|
-
var _FormControlLabel = _interopRequireDefault(require("@mui/material/FormControlLabel"));
|
|
23
|
-
var _Checkbox = _interopRequireDefault(require("@mui/material/Checkbox"));
|
|
24
|
-
var _Check = _interopRequireDefault(require("@mui/icons-material/Check"));
|
|
25
|
-
var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
|
|
26
|
-
var _i18n = _interopRequireDefault(require("../i18n"));
|
|
27
|
-
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); }; }
|
|
28
|
-
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; } } /**
|
|
2
|
+
/**
|
|
29
3
|
* Copyright 2019-2023 Denis Haev (bluefox) <dogafox@gmail.com>
|
|
30
4
|
*
|
|
31
5
|
* MIT License
|
|
32
6
|
*
|
|
33
|
-
**/
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
7
|
+
**/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
|
+
if (mod && mod.__esModule) return mod;
|
|
26
|
+
var result = {};
|
|
27
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
28
|
+
__setModuleDefault(result, mod);
|
|
29
|
+
return result;
|
|
30
|
+
};
|
|
31
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
32
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
33
|
+
};
|
|
34
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
|
+
// please do not delete React, as without it other projects could not be compiled: ReferenceError: React is not defined
|
|
36
|
+
const react_1 = __importStar(require("react"));
|
|
37
|
+
const styles_1 = require("@mui/styles");
|
|
38
|
+
const material_1 = require("@mui/material");
|
|
39
|
+
const icons_material_1 = require("@mui/icons-material");
|
|
40
|
+
const i18n_1 = __importDefault(require("../i18n"));
|
|
41
|
+
const styles = {
|
|
42
|
+
suppress: {
|
|
43
|
+
fontSize: 12,
|
|
44
|
+
},
|
|
45
|
+
suppressRoot: {
|
|
46
|
+
marginTop: 16,
|
|
47
|
+
},
|
|
41
48
|
};
|
|
42
|
-
|
|
43
49
|
/**
|
|
44
|
-
* @
|
|
45
|
-
* @property
|
|
46
|
-
* @property
|
|
47
|
-
* @property
|
|
48
|
-
* @property
|
|
49
|
-
* @property
|
|
50
|
-
* @property
|
|
51
|
-
* @property
|
|
52
|
-
* @property {(ok: boolean) => void} [onClose] Close handler.
|
|
53
|
-
*
|
|
54
|
-
* @extends {React.Component<DialogConfirmProps>}
|
|
50
|
+
* @property title The dialog title; default: Are you sure? (translated)
|
|
51
|
+
* @property text The dialog text.
|
|
52
|
+
* @property ok The ok button text; default: OK (translated)
|
|
53
|
+
* @property cancel The cancel button text; default: Cancel (translated)
|
|
54
|
+
* @property suppressQuestionMinutes interval in minutes for which the confirmation dialog will be suppressed if activated.
|
|
55
|
+
* @property suppressText The suppress checkbox text; default: Suppress question for next %s minutes (translated)
|
|
56
|
+
* @property dialogName Name of the dialog. Used only with suppressQuestionMinutes to store the user choice
|
|
57
|
+
* @property onClose Close handler.
|
|
55
58
|
*/
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
59
|
+
class DialogConfirm extends react_1.Component {
|
|
60
|
+
constructor(props) {
|
|
61
|
+
super(props);
|
|
62
|
+
if (!this.props.dialogName && this.props.suppressQuestionMinutes) {
|
|
63
|
+
throw new Error('dialogName required if suppressQuestionMinutes used');
|
|
64
|
+
}
|
|
65
|
+
let suppress = false;
|
|
66
|
+
if (this.props.suppressQuestionMinutes) {
|
|
67
|
+
suppress = parseInt((window._localStorage || window.localStorage).getItem(this.props.dialogName), 10) || 0;
|
|
68
|
+
if (!suppress) {
|
|
69
|
+
suppress = false;
|
|
70
|
+
}
|
|
71
|
+
else if (Date.now() > suppress) {
|
|
72
|
+
(window._localStorage || window.localStorage).removeItem(this.props.dialogName);
|
|
73
|
+
suppress = false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
this.state = {
|
|
77
|
+
suppress,
|
|
78
|
+
};
|
|
65
79
|
}
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
} else if (Date.now() > suppress) {
|
|
72
|
-
(window._localStorage || window.localStorage).removeItem(_this.props.dialogName);
|
|
73
|
-
suppress = false;
|
|
74
|
-
}
|
|
80
|
+
handleOk() {
|
|
81
|
+
if (this.state.suppress) {
|
|
82
|
+
(window._localStorage || window.localStorage).setItem(this.props.dialogName, Date.now() + (this.props.suppressQuestionMinutes || 2) * 60000);
|
|
83
|
+
}
|
|
84
|
+
this.props.onClose && this.props.onClose(true);
|
|
75
85
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
};
|
|
79
|
-
return _this;
|
|
80
|
-
}
|
|
81
|
-
(0, _createClass2["default"])(DialogConfirm, [{
|
|
82
|
-
key: "handleOk",
|
|
83
|
-
value: function handleOk() {
|
|
84
|
-
if (this.state.suppress) {
|
|
85
|
-
(window._localStorage || window.localStorage).setItem(this.props.dialogName, Date.now() + this.props.suppressQuestionMinutes * 60000);
|
|
86
|
-
}
|
|
87
|
-
this.props.onClose && this.props.onClose(true);
|
|
86
|
+
handleCancel() {
|
|
87
|
+
this.props.onClose && this.props.onClose(false);
|
|
88
88
|
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
render() {
|
|
90
|
+
if (typeof this.state.suppress === 'number') {
|
|
91
|
+
setTimeout(() => this.props.onClose && this.props.onClose(true), 100);
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
return react_1.default.createElement(material_1.Dialog, { open: !0, maxWidth: "md", fullWidth: this.props.fullWidth !== undefined ? this.props.fullWidth : true, onClose: (event, reason) => {
|
|
95
|
+
if (reason !== 'backdropClick' && reason !== 'escapeKeyDown') {
|
|
96
|
+
this.handleCancel();
|
|
97
|
+
}
|
|
98
|
+
}, "aria-labelledby": "ar_confirmation_dialog_title", "aria-describedby": "ar_confirmation_dialog_description" },
|
|
99
|
+
react_1.default.createElement(material_1.DialogTitle, { id: "ar_confirmation_dialog_title" }, this.props.title || i18n_1.default.t('ra_Are you sure?')),
|
|
100
|
+
react_1.default.createElement(material_1.DialogContent, null,
|
|
101
|
+
react_1.default.createElement(material_1.DialogContentText, { id: "ar_confirmation_dialog_description" },
|
|
102
|
+
this.props.icon || null,
|
|
103
|
+
this.props.text,
|
|
104
|
+
this.props.suppressQuestionMinutes ? react_1.default.createElement("br", null) : null,
|
|
105
|
+
this.props.suppressQuestionMinutes ? react_1.default.createElement(material_1.FormControlLabel, { classes: { label: this.props.classes.suppress, root: this.props.classes.suppressRoot }, control: react_1.default.createElement(material_1.Checkbox, { id: `ar_dialog_confirm_suppress_${this.props.dialogName || ''}`, checked: !!this.state.suppress, onChange: () => this.setState({ suppress: !this.state.suppress }) }), label: this.props.suppressText || i18n_1.default.t('ra_Suppress question for next %s minutes', (this.props.suppressQuestionMinutes || 2).toString()) }) : null)),
|
|
106
|
+
react_1.default.createElement(material_1.DialogActions, null,
|
|
107
|
+
react_1.default.createElement(material_1.Button, { id: `ar_dialog_confirm_ok_${this.props.dialogName || ''}`, variant: "contained", onClick: () => this.handleOk(), color: "primary", autoFocus: true, startIcon: react_1.default.createElement(icons_material_1.Check, null) }, this.props.ok || i18n_1.default.t('ra_Ok')),
|
|
108
|
+
react_1.default.createElement(material_1.Button, { id: `ar_dialog_confirm_cancel_${this.props.dialogName || ''}`, variant: "contained", onClick: () => this.handleCancel(),
|
|
109
|
+
// @ts-expect-error
|
|
110
|
+
color: "grey", startIcon: react_1.default.createElement(icons_material_1.Close, null) }, this.props.cancel || i18n_1.default.t('ra_Cancel'))));
|
|
93
111
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
var _this2 = this;
|
|
98
|
-
if (typeof this.state.suppress === 'number') {
|
|
99
|
-
setTimeout(function () {
|
|
100
|
-
return _this2.props.onClose && _this2.props.onClose(true);
|
|
101
|
-
}, 100);
|
|
102
|
-
return null;
|
|
103
|
-
}
|
|
104
|
-
return /*#__PURE__*/_react["default"].createElement(_Dialog["default"], {
|
|
105
|
-
open: !0,
|
|
106
|
-
maxWidth: "md",
|
|
107
|
-
fullWidth: this.props.fullWidth !== undefined ? this.props.fullWidth : true,
|
|
108
|
-
onClose: function onClose(event, reason) {
|
|
109
|
-
if (reason !== 'backdropClick' && reason !== 'escapeKeyDown') {
|
|
110
|
-
_this2.handleCancel();
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
"aria-labelledby": "ar_confirmation_dialog_title",
|
|
114
|
-
"aria-describedby": "ar_confirmation_dialog_description"
|
|
115
|
-
}, /*#__PURE__*/_react["default"].createElement(_DialogTitle["default"], {
|
|
116
|
-
id: "ar_confirmation_dialog_title"
|
|
117
|
-
}, this.props.title || _i18n["default"].t('ra_Are you sure?')), /*#__PURE__*/_react["default"].createElement(_DialogContent["default"], null, /*#__PURE__*/_react["default"].createElement(_DialogContentText["default"], {
|
|
118
|
-
id: "ar_confirmation_dialog_description"
|
|
119
|
-
}, this.props.icon || null, this.props.text, this.props.suppressQuestionMinutes ? /*#__PURE__*/_react["default"].createElement("br", null) : null, this.props.suppressQuestionMinutes ? /*#__PURE__*/_react["default"].createElement(_FormControlLabel["default"], {
|
|
120
|
-
classes: {
|
|
121
|
-
label: this.props.classes.suppress,
|
|
122
|
-
root: this.props.classes.suppressRoot
|
|
123
|
-
},
|
|
124
|
-
control: /*#__PURE__*/_react["default"].createElement(_Checkbox["default"], {
|
|
125
|
-
id: "ar_dialog_confirm_suppress_".concat(this.props.dialogName || ''),
|
|
126
|
-
checked: !!this.state.suppress,
|
|
127
|
-
onChange: function onChange() {
|
|
128
|
-
return _this2.setState({
|
|
129
|
-
suppress: !_this2.state.suppress
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
}),
|
|
133
|
-
label: this.props.suppressText || _i18n["default"].t('ra_Suppress question for next %s minutes', this.props.suppressQuestionMinutes)
|
|
134
|
-
}) : null)), /*#__PURE__*/_react["default"].createElement(_DialogActions["default"], null, /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
135
|
-
id: "ar_dialog_confirm_ok_".concat(this.props.dialogName || ''),
|
|
136
|
-
variant: "contained",
|
|
137
|
-
onClick: function onClick() {
|
|
138
|
-
return _this2.handleOk();
|
|
139
|
-
},
|
|
140
|
-
color: "primary",
|
|
141
|
-
autoFocus: true,
|
|
142
|
-
startIcon: /*#__PURE__*/_react["default"].createElement(_Check["default"], null)
|
|
143
|
-
}, this.props.ok || _i18n["default"].t('ra_Ok')), /*#__PURE__*/_react["default"].createElement(_Button["default"], {
|
|
144
|
-
id: "ar_dialog_confirm_cancel_".concat(this.props.dialogName || ''),
|
|
145
|
-
variant: "contained",
|
|
146
|
-
onClick: function onClick() {
|
|
147
|
-
return _this2.handleCancel();
|
|
148
|
-
},
|
|
149
|
-
color: "grey",
|
|
150
|
-
startIcon: /*#__PURE__*/_react["default"].createElement(_Close["default"], null)
|
|
151
|
-
}, this.props.cancel || _i18n["default"].t('ra_Cancel'))));
|
|
152
|
-
}
|
|
153
|
-
}]);
|
|
154
|
-
return DialogConfirm;
|
|
155
|
-
}(_react["default"].Component);
|
|
156
|
-
DialogConfirm.propTypes = {
|
|
157
|
-
onClose: _propTypes["default"].func.isRequired,
|
|
158
|
-
fullWidth: _propTypes["default"].bool,
|
|
159
|
-
title: _propTypes["default"].string,
|
|
160
|
-
text: _propTypes["default"].string,
|
|
161
|
-
ok: _propTypes["default"].string,
|
|
162
|
-
cancel: _propTypes["default"].string,
|
|
163
|
-
icon: _propTypes["default"].object,
|
|
164
|
-
suppressQuestionMinutes: _propTypes["default"].number,
|
|
165
|
-
suppressText: _propTypes["default"].string,
|
|
166
|
-
dialogName: _propTypes["default"].string
|
|
167
|
-
};
|
|
168
|
-
var _export = (0, _styles.withStyles)(styles)(DialogConfirm);
|
|
169
|
-
var _default = exports["default"] = _export;
|
|
170
|
-
//# sourceMappingURL=Confirm.js.map
|
|
112
|
+
}
|
|
113
|
+
const _export = (0, styles_1.withStyles)(styles)(DialogConfirm);
|
|
114
|
+
exports.default = _export;
|
package/Dialogs/Error.d.ts
CHANGED
|
@@ -1,49 +1,30 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2018-2023 Denis Haev (bluefox) <dogafox@gmail.com>
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
**/
|
|
7
|
+
import React, { Component } from 'react';
|
|
8
|
+
interface DialogErrorProps {
|
|
6
9
|
title?: string;
|
|
7
|
-
|
|
8
|
-
* The dialog text.
|
|
9
|
-
*/
|
|
10
|
-
text: string | JSX.Element;
|
|
11
|
-
/**
|
|
12
|
-
* Close handler.
|
|
13
|
-
*/
|
|
10
|
+
text: string | React.JSX.Element;
|
|
14
11
|
onClose?: () => void;
|
|
15
|
-
|
|
16
|
-
* The styling class names.
|
|
17
|
-
*/
|
|
18
|
-
classes: {
|
|
12
|
+
classes?: {
|
|
19
13
|
titleBackground: string;
|
|
20
14
|
titleColor: string;
|
|
21
15
|
};
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
declare const _export: typeof DialogError;
|
|
16
|
+
fullWidth?: boolean;
|
|
17
|
+
}
|
|
25
18
|
/**
|
|
26
|
-
* @
|
|
27
|
-
* @property
|
|
28
|
-
* @property
|
|
29
|
-
* @property
|
|
30
|
-
* @property {{titleBackground: string; titleColor: string}} classes The styling class names.
|
|
31
|
-
*
|
|
32
|
-
* @extends {React.Component<DialogErrorProps>}
|
|
19
|
+
* @property title The dialog title; default: Error (translated)
|
|
20
|
+
* @property text The dialog text.
|
|
21
|
+
* @property onClose Close handler.
|
|
22
|
+
* @property classes The styling class names.
|
|
33
23
|
*/
|
|
34
|
-
declare class DialogError extends
|
|
35
|
-
constructor(props: DialogErrorProps | Readonly<DialogErrorProps>);
|
|
36
|
-
constructor(props: DialogErrorProps, context: any);
|
|
24
|
+
declare class DialogError extends Component<DialogErrorProps> {
|
|
37
25
|
handleOk(): void;
|
|
38
26
|
render(): React.JSX.Element;
|
|
39
27
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
let fullWidth: PropTypes.Requireable<boolean>;
|
|
44
|
-
let title: PropTypes.Requireable<string>;
|
|
45
|
-
let text: PropTypes.Requireable<NonNullable<string | PropTypes.ReactElementLike>>;
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
import React from 'react';
|
|
49
|
-
import PropTypes from 'prop-types';
|
|
28
|
+
/** @type {typeof DialogError} */
|
|
29
|
+
declare const _export: typeof DialogError;
|
|
30
|
+
export default _export;
|