@iobroker/adapter-react-v5 4.8.1 → 4.9.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/Logo.d.ts +9 -50
- package/Components/Logo.js +106 -173
- package/Components/ObjectBrowser.d.ts +9 -0
- package/Components/ObjectBrowser.js +370 -165
- package/Components/ObjectBrowser.js.map +1 -1
- package/Components/SaveCloseButtons.d.ts +17 -61
- package/Components/SaveCloseButtons.js +64 -124
- package/Components/Schedule.d.ts +31 -6
- package/Components/Schedule.js +1144 -1562
- package/Components/TabContainer.d.ts +9 -37
- package/Components/TabContainer.js +49 -74
- package/Components/TabContent.d.ts +6 -27
- package/Components/TabContent.js +24 -67
- package/Components/TabHeader.d.ts +6 -11
- package/Components/TabHeader.js +11 -40
- package/Components/ToggleThemeMenu.d.ts +10 -8
- package/Components/ToggleThemeMenu.js +16 -36
- package/Components/types.d.ts +10 -2
- package/Dialogs/SelectID.d.ts +39 -114
- package/Dialogs/SelectID.js +141 -246
- package/LegacyConnection.d.ts +1 -1
- package/README.md +6 -2
- package/i18n.d.ts +2 -2
- package/index.d.ts +127 -126
- package/index.js +213 -192
- package/package.json +6 -7
- package/Components/JsonConfigComponent/ChipInput.d.ts +0 -12
- package/Components/JsonConfigComponent/ChipInput.js +0 -763
- package/Components/JsonConfigComponent/ChipInput.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigAccordion.d.ts +0 -15
- package/Components/JsonConfigComponent/ConfigAccordion.js +0 -348
- package/Components/JsonConfigComponent/ConfigAccordion.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigAlive.d.ts +0 -10
- package/Components/JsonConfigComponent/ConfigAlive.js +0 -105
- package/Components/JsonConfigComponent/ConfigAlive.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigAutocomplete.d.ts +0 -37
- package/Components/JsonConfigComponent/ConfigAutocomplete.js +0 -73
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.d.ts +0 -17
- package/Components/JsonConfigComponent/ConfigAutocompleteSendTo.js +0 -131
- package/Components/JsonConfigComponent/ConfigCRON.d.ts +0 -15
- package/Components/JsonConfigComponent/ConfigCRON.js +0 -157
- package/Components/JsonConfigComponent/ConfigCRON.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigCertCollection.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigCertCollection.js +0 -128
- package/Components/JsonConfigComponent/ConfigCertCollection.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigCertificateSelect.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigCertificateSelect.js +0 -149
- package/Components/JsonConfigComponent/ConfigCertificateSelect.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigCertificates.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigCertificates.js +0 -284
- package/Components/JsonConfigComponent/ConfigCertificates.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigCheckLicense.d.ts +0 -3
- package/Components/JsonConfigComponent/ConfigCheckLicense.js +0 -821
- package/Components/JsonConfigComponent/ConfigCheckLicense.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigCheckbox.d.ts +0 -15
- package/Components/JsonConfigComponent/ConfigCheckbox.js +0 -40
- package/Components/JsonConfigComponent/ConfigChip.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigChip.js +0 -120
- package/Components/JsonConfigComponent/ConfigChip.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigColor.d.ts +0 -22
- package/Components/JsonConfigComponent/ConfigColor.js +0 -120
- package/Components/JsonConfigComponent/ConfigColor.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigCoordinates.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigCoordinates.js +0 -265
- package/Components/JsonConfigComponent/ConfigCoordinates.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigCustom.d.ts +0 -26
- package/Components/JsonConfigComponent/ConfigCustom.js +0 -316
- package/Components/JsonConfigComponent/ConfigCustom.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigDatePicker.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigDatePicker.js +0 -91
- package/Components/JsonConfigComponent/ConfigDatePicker.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigDeviceManager.d.ts +0 -6
- package/Components/JsonConfigComponent/ConfigDeviceManager.js +0 -18
- package/Components/JsonConfigComponent/ConfigFile.d.ts +0 -15
- package/Components/JsonConfigComponent/ConfigFile.js +0 -228
- package/Components/JsonConfigComponent/ConfigFile.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigFileSelector.d.ts +0 -3
- package/Components/JsonConfigComponent/ConfigFileSelector.js +0 -625
- package/Components/JsonConfigComponent/ConfigFileSelector.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigFunc.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigFunc.js +0 -124
- package/Components/JsonConfigComponent/ConfigFunc.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigGeneric.d.ts +0 -95
- package/Components/JsonConfigComponent/ConfigGeneric.js +0 -646
- package/Components/JsonConfigComponent/ConfigIP.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigIP.js +0 -130
- package/Components/JsonConfigComponent/ConfigIP.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigImageSendTo.d.ts +0 -10
- package/Components/JsonConfigComponent/ConfigImageSendTo.js +0 -114
- package/Components/JsonConfigComponent/ConfigImageSendTo.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigImageUpload.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigImageUpload.js +0 -166
- package/Components/JsonConfigComponent/ConfigImageUpload.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigInstanceSelect.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigInstanceSelect.js +0 -264
- package/Components/JsonConfigComponent/ConfigInstanceSelect.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigInterface.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigInterface.js +0 -146
- package/Components/JsonConfigComponent/ConfigInterface.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigJsonEditor.d.ts +0 -13
- package/Components/JsonConfigComponent/ConfigJsonEditor.js +0 -145
- package/Components/JsonConfigComponent/ConfigJsonEditor.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigLanguage.d.ts +0 -7
- package/Components/JsonConfigComponent/ConfigLanguage.js +0 -110
- package/Components/JsonConfigComponent/ConfigLicense.d.ts +0 -24
- package/Components/JsonConfigComponent/ConfigLicense.js +0 -183
- package/Components/JsonConfigComponent/ConfigLicense.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigNumber.d.ts +0 -17
- package/Components/JsonConfigComponent/ConfigNumber.js +0 -117
- package/Components/JsonConfigComponent/ConfigObjectId.d.ts +0 -17
- package/Components/JsonConfigComponent/ConfigObjectId.js +0 -167
- package/Components/JsonConfigComponent/ConfigObjectId.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigPanel.d.ts +0 -3
- package/Components/JsonConfigComponent/ConfigPanel.js +0 -396
- package/Components/JsonConfigComponent/ConfigPanel.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigPassword.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigPassword.js +0 -193
- package/Components/JsonConfigComponent/ConfigPassword.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigPattern.d.ts +0 -21
- package/Components/JsonConfigComponent/ConfigPattern.js +0 -65
- package/Components/JsonConfigComponent/ConfigPattern.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigPort.d.ts +0 -3
- package/Components/JsonConfigComponent/ConfigPort.js +0 -176
- package/Components/JsonConfigComponent/ConfigRoom.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigRoom.js +0 -124
- package/Components/JsonConfigComponent/ConfigRoom.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigSelect.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigSelect.js +0 -159
- package/Components/JsonConfigComponent/ConfigSelect.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigSelectSendTo.d.ts +0 -17
- package/Components/JsonConfigComponent/ConfigSelectSendTo.js +0 -272
- package/Components/JsonConfigComponent/ConfigSelectSendTo.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigSendto.d.ts +0 -24
- package/Components/JsonConfigComponent/ConfigSendto.js +0 -294
- package/Components/JsonConfigComponent/ConfigSetState.d.ts +0 -18
- package/Components/JsonConfigComponent/ConfigSetState.js +0 -185
- package/Components/JsonConfigComponent/ConfigSetState.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigSlider.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigSlider.js +0 -119
- package/Components/JsonConfigComponent/ConfigSlider.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigStaticDivider.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigStaticDivider.js +0 -68
- package/Components/JsonConfigComponent/ConfigStaticDivider.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigStaticHeader.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigStaticHeader.js +0 -81
- package/Components/JsonConfigComponent/ConfigStaticHeader.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigStaticImage.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigStaticImage.js +0 -71
- package/Components/JsonConfigComponent/ConfigStaticImage.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigStaticText.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigStaticText.js +0 -88
- package/Components/JsonConfigComponent/ConfigStaticText.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigTable.d.ts +0 -3
- package/Components/JsonConfigComponent/ConfigTable.js +0 -1064
- package/Components/JsonConfigComponent/ConfigTable.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigTabs.d.ts +0 -34
- package/Components/JsonConfigComponent/ConfigTabs.js +0 -162
- package/Components/JsonConfigComponent/ConfigTabs.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigText.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigText.js +0 -226
- package/Components/JsonConfigComponent/ConfigText.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigTextSendTo.d.ts +0 -10
- package/Components/JsonConfigComponent/ConfigTextSendTo.js +0 -129
- package/Components/JsonConfigComponent/ConfigTextSendTo.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigTimePicker.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigTimePicker.js +0 -85
- package/Components/JsonConfigComponent/ConfigTimePicker.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigTopic.d.ts +0 -17
- package/Components/JsonConfigComponent/ConfigTopic.js +0 -110
- package/Components/JsonConfigComponent/ConfigTopic.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigUUID.d.ts +0 -15
- package/Components/JsonConfigComponent/ConfigUUID.js +0 -95
- package/Components/JsonConfigComponent/ConfigUUID.js.map +0 -1
- package/Components/JsonConfigComponent/ConfigUser.d.ts +0 -14
- package/Components/JsonConfigComponent/ConfigUser.js +0 -142
- package/Components/JsonConfigComponent/ConfigUser.js.map +0 -1
- package/Components/JsonConfigComponent/DeviceManager/Communication.d.ts +0 -63
- package/Components/JsonConfigComponent/DeviceManager/Communication.js +0 -268
- package/Components/JsonConfigComponent/DeviceManager/DeviceActionButton.d.ts +0 -11
- package/Components/JsonConfigComponent/DeviceManager/DeviceActionButton.js +0 -15
- package/Components/JsonConfigComponent/DeviceManager/DeviceCard.d.ts +0 -53
- package/Components/JsonConfigComponent/DeviceManager/DeviceCard.js +0 -340
- package/Components/JsonConfigComponent/DeviceManager/DeviceControl.d.ts +0 -45
- package/Components/JsonConfigComponent/DeviceManager/DeviceControl.js +0 -146
- package/Components/JsonConfigComponent/DeviceManager/DeviceImageUpload.d.ts +0 -12
- package/Components/JsonConfigComponent/DeviceManager/DeviceImageUpload.js +0 -69
- package/Components/JsonConfigComponent/DeviceManager/DeviceList.d.ts +0 -51
- package/Components/JsonConfigComponent/DeviceManager/DeviceList.js +0 -226
- package/Components/JsonConfigComponent/DeviceManager/DeviceStatus.d.ts +0 -13
- package/Components/JsonConfigComponent/DeviceManager/DeviceStatus.js +0 -111
- package/Components/JsonConfigComponent/DeviceManager/InstanceActionButton.d.ts +0 -7
- package/Components/JsonConfigComponent/DeviceManager/InstanceActionButton.js +0 -16
- package/Components/JsonConfigComponent/DeviceManager/JsonConfig.d.ts +0 -11
- package/Components/JsonConfigComponent/DeviceManager/JsonConfig.js +0 -94
- package/Components/JsonConfigComponent/DeviceManager/TooltipButton.d.ts +0 -10
- package/Components/JsonConfigComponent/DeviceManager/TooltipButton.js +0 -22
- package/Components/JsonConfigComponent/DeviceManager/Utils.d.ts +0 -12
- package/Components/JsonConfigComponent/DeviceManager/Utils.js +0 -158
- package/Components/JsonConfigComponent/DeviceManager/i18n/de.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/en.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/es.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/fr.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/i18n.d.ts +0 -26
- package/Components/JsonConfigComponent/DeviceManager/i18n/it.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/nl.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/pl.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/pt.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/ru.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/uk.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/i18n/zh-cn.json +0 -21
- package/Components/JsonConfigComponent/DeviceManager/index.d.ts +0 -2
- package/Components/JsonConfigComponent/DeviceManager/index.js +0 -10
- package/Components/JsonConfigComponent/DeviceManager/index.js.map +0 -1
- package/Components/JsonConfigComponent/index.d.ts +0 -26
- package/Components/JsonConfigComponent/index.js +0 -520
- package/Components/JsonConfigComponent/index.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/AdminConnection.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/AdminConnection.js +0 -7
- package/Components/JsonConfigComponent/wrapper/Components/ColorPicker.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Components/ColorPicker.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Components/ColorPicker.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Components/Icon.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Components/Icon.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Components/Icon.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Components/TextWithIcon.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Components/TextWithIcon.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Components/TextWithIcon.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Components/UploadImage.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Components/UploadImage.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Components/UploadImage.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Components/Utils.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Components/Utils.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Components/Utils.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Dialogs/Confirm.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Dialogs/Confirm.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Dialogs/Confirm.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Dialogs/Cron.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Dialogs/Cron.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Dialogs/Cron.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Dialogs/Error.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Dialogs/Error.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Dialogs/Error.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Dialogs/Message.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Dialogs/Message.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Dialogs/Message.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Dialogs/SelectFile.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Dialogs/SelectFile.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Dialogs/SelectFile.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/Dialogs/SelectID.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/Dialogs/SelectID.js +0 -10
- package/Components/JsonConfigComponent/wrapper/Dialogs/SelectID.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/i18n.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/i18n.js +0 -10
- package/Components/JsonConfigComponent/wrapper/i18n.js.map +0 -1
- package/Components/JsonConfigComponent/wrapper/icons/IconCopy.d.ts +0 -2
- package/Components/JsonConfigComponent/wrapper/icons/IconCopy.js +0 -10
- package/Components/JsonConfigComponent/wrapper/icons/IconCopy.js.map +0 -1
- package/Components/Logo.js.map +0 -1
- package/Components/SaveCloseButtons.js.map +0 -1
- package/Components/Schedule.js.map +0 -1
- package/Components/TabContainer.js.map +0 -1
- package/Components/TabContent.js.map +0 -1
- package/Components/TabHeader.js.map +0 -1
- package/Components/ToggleThemeMenu.js.map +0 -1
- package/Dialogs/SelectID.js.map +0 -1
|
@@ -1,625 +0,0 @@
|
|
|
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 _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
9
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
11
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
|
-
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
14
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
15
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
16
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
17
|
-
var _react = _interopRequireDefault(require("react"));
|
|
18
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
19
|
-
var _styles = require("@mui/styles");
|
|
20
|
-
var _reactDropzone = _interopRequireDefault(require("react-dropzone"));
|
|
21
|
-
var _material = require("@mui/material");
|
|
22
|
-
var _iconsMaterial = require("@mui/icons-material");
|
|
23
|
-
var _fa = require("react-icons/fa");
|
|
24
|
-
var _Utils = _interopRequireDefault(require("./wrapper/Components/Utils"));
|
|
25
|
-
var _i18n = _interopRequireDefault(require("./wrapper/i18n"));
|
|
26
|
-
var _Confirm = _interopRequireDefault(require("./wrapper/Dialogs/Confirm"));
|
|
27
|
-
var _ConfigGeneric2 = _interopRequireDefault(require("./ConfigGeneric"));
|
|
28
|
-
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); }; }
|
|
29
|
-
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; } }
|
|
30
|
-
var styles = function styles() {
|
|
31
|
-
return {
|
|
32
|
-
fullWidth: {
|
|
33
|
-
width: '100%'
|
|
34
|
-
},
|
|
35
|
-
fullWidthOneButton: {
|
|
36
|
-
width: 'calc(100% - 42px)'
|
|
37
|
-
},
|
|
38
|
-
fullWidthTwoButtons: {
|
|
39
|
-
width: 'calc(100% - 84px)'
|
|
40
|
-
},
|
|
41
|
-
fullWidthThreeButtons: {
|
|
42
|
-
width: 'calc(100% - 126x)'
|
|
43
|
-
},
|
|
44
|
-
dropZone: {
|
|
45
|
-
width: '100%',
|
|
46
|
-
height: '100%',
|
|
47
|
-
position: 'absolute'
|
|
48
|
-
},
|
|
49
|
-
dropZoneEmpty: {},
|
|
50
|
-
image: {
|
|
51
|
-
objectFit: 'contain',
|
|
52
|
-
margin: 'auto',
|
|
53
|
-
display: 'flex',
|
|
54
|
-
width: '100%',
|
|
55
|
-
height: '100%'
|
|
56
|
-
},
|
|
57
|
-
uploadDiv: {
|
|
58
|
-
position: 'relative',
|
|
59
|
-
width: '100%'
|
|
60
|
-
},
|
|
61
|
-
uploadDivDragging: {
|
|
62
|
-
opacity: 1,
|
|
63
|
-
background: 'rgba(128,255,128,0.1)'
|
|
64
|
-
},
|
|
65
|
-
uploadCenterDiv: {
|
|
66
|
-
margin: 5,
|
|
67
|
-
border: '3px dashed grey',
|
|
68
|
-
borderRadius: 5,
|
|
69
|
-
width: '100%',
|
|
70
|
-
height: '100%',
|
|
71
|
-
position: 'absolute',
|
|
72
|
-
display: 'flex'
|
|
73
|
-
},
|
|
74
|
-
uploadCenterIcon: {
|
|
75
|
-
paddingTop: 10,
|
|
76
|
-
width: 48,
|
|
77
|
-
height: 48
|
|
78
|
-
},
|
|
79
|
-
uploadCenterText: {
|
|
80
|
-
fontSize: 16
|
|
81
|
-
},
|
|
82
|
-
uploadCenterTextAndIcon: {
|
|
83
|
-
textAlign: 'center',
|
|
84
|
-
position: 'absolute',
|
|
85
|
-
top: 0,
|
|
86
|
-
bottom: 0,
|
|
87
|
-
left: 0,
|
|
88
|
-
right: 0,
|
|
89
|
-
display: 'flex',
|
|
90
|
-
flexDirection: 'column',
|
|
91
|
-
alignItems: 'center',
|
|
92
|
-
justifyContent: 'center'
|
|
93
|
-
},
|
|
94
|
-
disabledOpacity: {
|
|
95
|
-
opacity: 0.3,
|
|
96
|
-
cursor: 'default'
|
|
97
|
-
},
|
|
98
|
-
error: {
|
|
99
|
-
border: '2px solid red'
|
|
100
|
-
},
|
|
101
|
-
deleteButton: {},
|
|
102
|
-
selectedImage: {
|
|
103
|
-
height: 40,
|
|
104
|
-
width: 40,
|
|
105
|
-
display: 'inline-block',
|
|
106
|
-
marginRight: 8
|
|
107
|
-
}
|
|
108
|
-
};
|
|
109
|
-
};
|
|
110
|
-
var IMAGE_EXT = ['jpg', 'jpeg', 'svg', 'png', 'webp', 'gif', 'apng', 'avif', 'webp'];
|
|
111
|
-
var AUDIO_EXT = ['mp3', 'ogg', 'wav', 'aac'];
|
|
112
|
-
var VIDEO_EXT = ['avi', 'mp4', 'mov'];
|
|
113
|
-
var DOC_EXT = ['txt', 'log', 'html', 'htm'];
|
|
114
|
-
var JS_EXT = ['json', 'js', 'ts'];
|
|
115
|
-
var ConfigFileSelector = /*#__PURE__*/function (_ConfigGeneric) {
|
|
116
|
-
(0, _inherits2["default"])(ConfigFileSelector, _ConfigGeneric);
|
|
117
|
-
var _super = _createSuper(ConfigFileSelector);
|
|
118
|
-
function ConfigFileSelector(props) {
|
|
119
|
-
var _this;
|
|
120
|
-
(0, _classCallCheck2["default"])(this, ConfigFileSelector);
|
|
121
|
-
_this = _super.call(this, props);
|
|
122
|
-
_this.dropzoneRef = /*#__PURE__*/_react["default"].createRef();
|
|
123
|
-
_this.imagePrefix = _this.props.imagePrefix === undefined ? './files' : _this.props.imagePrefix;
|
|
124
|
-
return _this;
|
|
125
|
-
}
|
|
126
|
-
(0, _createClass2["default"])(ConfigFileSelector, [{
|
|
127
|
-
key: "componentDidMount",
|
|
128
|
-
value: function componentDidMount() {
|
|
129
|
-
var _this2 = this;
|
|
130
|
-
(0, _get2["default"])((0, _getPrototypeOf2["default"])(ConfigFileSelector.prototype), "componentDidMount", this).call(this);
|
|
131
|
-
this.objectID = (this.props.schema.objectID || '0_userdata.0').replace('%INSTANCE%', this.props.instance);
|
|
132
|
-
this.path = this.props.schema.upload;
|
|
133
|
-
if (this.path) {
|
|
134
|
-
if (this.path === '/') {
|
|
135
|
-
this.path = '';
|
|
136
|
-
} else if (!this.path.endsWith('/')) {
|
|
137
|
-
this.path = "".concat(this.path, "/");
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
// read files
|
|
142
|
-
this.updateFiles().then(function () {
|
|
143
|
-
var value = _ConfigGeneric2["default"].getValue(_this2.props.data, _this2.props.attr);
|
|
144
|
-
_this2.setState({
|
|
145
|
-
value: value
|
|
146
|
-
});
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
}, {
|
|
150
|
-
key: "updateFiles",
|
|
151
|
-
value: function updateFiles() {
|
|
152
|
-
var _this3 = this;
|
|
153
|
-
return this.readFiles(this.props.schema.pattern).then(function (files) {
|
|
154
|
-
return _this3.setState({
|
|
155
|
-
files: files
|
|
156
|
-
});
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
}, {
|
|
160
|
-
key: "readFolder",
|
|
161
|
-
value: function () {
|
|
162
|
-
var _readFolder = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(folderName, files, filter) {
|
|
163
|
-
var dirFiles, f, file, ok, regExp;
|
|
164
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
165
|
-
while (1) switch (_context.prev = _context.next) {
|
|
166
|
-
case 0:
|
|
167
|
-
_context.prev = 0;
|
|
168
|
-
_context.next = 3;
|
|
169
|
-
return this.props.socket.readDir(this.objectID, folderName.replace(/^\//, '') || null);
|
|
170
|
-
case 3:
|
|
171
|
-
dirFiles = _context.sent;
|
|
172
|
-
f = 0;
|
|
173
|
-
case 5:
|
|
174
|
-
if (!(f < dirFiles.length)) {
|
|
175
|
-
_context.next = 18;
|
|
176
|
-
break;
|
|
177
|
-
}
|
|
178
|
-
file = dirFiles[f];
|
|
179
|
-
if (!file.isDir) {
|
|
180
|
-
_context.next = 12;
|
|
181
|
-
break;
|
|
182
|
-
}
|
|
183
|
-
_context.next = 10;
|
|
184
|
-
return this.readFolder("".concat(folderName + file.file, "/"), files, filter);
|
|
185
|
-
case 10:
|
|
186
|
-
_context.next = 15;
|
|
187
|
-
break;
|
|
188
|
-
case 12:
|
|
189
|
-
ok = false;
|
|
190
|
-
if (filter === '*.*' && file.file.includes('.')) {
|
|
191
|
-
ok = true;
|
|
192
|
-
} else if (!filter || filter === '*') {
|
|
193
|
-
ok = true;
|
|
194
|
-
} else if (filter === '.*' && file.file.startsWith('.')) {
|
|
195
|
-
ok = true;
|
|
196
|
-
} else {
|
|
197
|
-
regExp = new RegExp("^".concat(filter.replace(/\./g, '\\.').replace(/\*/g, '.*'), "$"));
|
|
198
|
-
ok = regExp.test(file.file);
|
|
199
|
-
}
|
|
200
|
-
ok && files.push({
|
|
201
|
-
name: folderName + file.file,
|
|
202
|
-
size: file.stats ? _Utils["default"].formatBytes(file.stats.size) : '--'
|
|
203
|
-
});
|
|
204
|
-
case 15:
|
|
205
|
-
f++;
|
|
206
|
-
_context.next = 5;
|
|
207
|
-
break;
|
|
208
|
-
case 18:
|
|
209
|
-
_context.next = 23;
|
|
210
|
-
break;
|
|
211
|
-
case 20:
|
|
212
|
-
_context.prev = 20;
|
|
213
|
-
_context.t0 = _context["catch"](0);
|
|
214
|
-
console.error("Cannot read \"".concat(folderName, "\": ").concat(_context.t0));
|
|
215
|
-
case 23:
|
|
216
|
-
return _context.abrupt("return", files);
|
|
217
|
-
case 24:
|
|
218
|
-
case "end":
|
|
219
|
-
return _context.stop();
|
|
220
|
-
}
|
|
221
|
-
}, _callee, this, [[0, 20]]);
|
|
222
|
-
}));
|
|
223
|
-
function readFolder(_x, _x2, _x3) {
|
|
224
|
-
return _readFolder.apply(this, arguments);
|
|
225
|
-
}
|
|
226
|
-
return readFolder;
|
|
227
|
-
}()
|
|
228
|
-
}, {
|
|
229
|
-
key: "readFiles",
|
|
230
|
-
value: function () {
|
|
231
|
-
var _readFiles = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(pattern) {
|
|
232
|
-
var files, filter, pos, pos_, folder;
|
|
233
|
-
return _regenerator["default"].wrap(function _callee2$(_context2) {
|
|
234
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
235
|
-
case 0:
|
|
236
|
-
files = [];
|
|
237
|
-
pattern = pattern || this.props.schema.pattern;
|
|
238
|
-
if (!pattern) {
|
|
239
|
-
pattern = '**/*.*';
|
|
240
|
-
}
|
|
241
|
-
pos = pattern.lastIndexOf('/');
|
|
242
|
-
if (pos === -1) {
|
|
243
|
-
filter = pattern;
|
|
244
|
-
} else {
|
|
245
|
-
filter = pattern.substring(pos + 1);
|
|
246
|
-
}
|
|
247
|
-
if (!pattern.startsWith('**')) {
|
|
248
|
-
_context2.next = 10;
|
|
249
|
-
break;
|
|
250
|
-
}
|
|
251
|
-
_context2.next = 8;
|
|
252
|
-
return this.readFolder('/', files, filter);
|
|
253
|
-
case 8:
|
|
254
|
-
_context2.next = 19;
|
|
255
|
-
break;
|
|
256
|
-
case 10:
|
|
257
|
-
pos_ = pattern.lastIndexOf('/');
|
|
258
|
-
if (!(pos_ === -1)) {
|
|
259
|
-
_context2.next = 16;
|
|
260
|
-
break;
|
|
261
|
-
}
|
|
262
|
-
_context2.next = 14;
|
|
263
|
-
return this.readFolder('/', files, filter);
|
|
264
|
-
case 14:
|
|
265
|
-
_context2.next = 19;
|
|
266
|
-
break;
|
|
267
|
-
case 16:
|
|
268
|
-
folder = pattern.substring(0, pos_ + 1);
|
|
269
|
-
_context2.next = 19;
|
|
270
|
-
return this.readFolder(folder, files, filter);
|
|
271
|
-
case 19:
|
|
272
|
-
return _context2.abrupt("return", files);
|
|
273
|
-
case 20:
|
|
274
|
-
case "end":
|
|
275
|
-
return _context2.stop();
|
|
276
|
-
}
|
|
277
|
-
}, _callee2, this);
|
|
278
|
-
}));
|
|
279
|
-
function readFiles(_x4) {
|
|
280
|
-
return _readFiles.apply(this, arguments);
|
|
281
|
-
}
|
|
282
|
-
return readFiles;
|
|
283
|
-
}()
|
|
284
|
-
}, {
|
|
285
|
-
key: "onDrop",
|
|
286
|
-
value: function onDrop(acceptedFiles) {
|
|
287
|
-
var _this4 = this;
|
|
288
|
-
var file = acceptedFiles[0];
|
|
289
|
-
var reader = new FileReader();
|
|
290
|
-
var maxSize = this.props.schema.maxSize || 2 * 1024 * 1024;
|
|
291
|
-
reader.onabort = function () {
|
|
292
|
-
return console.log('file reading was aborted');
|
|
293
|
-
};
|
|
294
|
-
reader.onerror = function () {
|
|
295
|
-
return console.log('file reading has failed');
|
|
296
|
-
};
|
|
297
|
-
reader.onload = function () {
|
|
298
|
-
var ext = "image/".concat(file.name.split('.').pop().toLowerCase());
|
|
299
|
-
if (ext === 'image/jpg') {
|
|
300
|
-
ext = 'image/jpeg';
|
|
301
|
-
} else if (ext.includes('svg')) {
|
|
302
|
-
ext = 'image/svg+xml';
|
|
303
|
-
}
|
|
304
|
-
if (file.size > maxSize) {
|
|
305
|
-
window.alert(_i18n["default"].t('File is too big. Max %sk allowed. Try use SVG.', Math.round(maxSize / 1024)));
|
|
306
|
-
return;
|
|
307
|
-
}
|
|
308
|
-
var base64 = "data:".concat(ext, ";base64,").concat(btoa(new Uint8Array(reader.result).reduce(function (data, _byte) {
|
|
309
|
-
return data + String.fromCharCode(_byte);
|
|
310
|
-
}, '')));
|
|
311
|
-
_this4.props.socket.writeFile64(_this4.objectID, _this4.path + file.name, base64).then(function () {
|
|
312
|
-
return _this4.updateFiles();
|
|
313
|
-
})["catch"](function (e) {
|
|
314
|
-
return window.alert("Cannot upload file: ".concat(e));
|
|
315
|
-
});
|
|
316
|
-
};
|
|
317
|
-
reader.readAsArrayBuffer(file);
|
|
318
|
-
}
|
|
319
|
-
}, {
|
|
320
|
-
key: "renderDeleteDialog",
|
|
321
|
-
value: function renderDeleteDialog() {
|
|
322
|
-
var _this5 = this;
|
|
323
|
-
if (!this.state.deleteFile) {
|
|
324
|
-
return null;
|
|
325
|
-
}
|
|
326
|
-
return /*#__PURE__*/_react["default"].createElement(_Confirm["default"], {
|
|
327
|
-
title: _i18n["default"].t('ra_Are you sure?'),
|
|
328
|
-
text: _i18n["default"].t('ra_File will be deleted'),
|
|
329
|
-
ok: _i18n["default"].t('ra_Delete'),
|
|
330
|
-
cancel: _i18n["default"].t('ra_Cancel'),
|
|
331
|
-
onClose: function onClose(isOk) {
|
|
332
|
-
var deleteFile = _this5.state.deleteFile;
|
|
333
|
-
_this5.setState({
|
|
334
|
-
deleteFile: false
|
|
335
|
-
}, function () {
|
|
336
|
-
if (isOk) {
|
|
337
|
-
_this5.props.socket.deleteFile(_this5.objectID, deleteFile).then(function () {
|
|
338
|
-
return _this5.updateFiles();
|
|
339
|
-
})["catch"](function (e) {
|
|
340
|
-
return window.alert("Cannot delete file: ".concat(e));
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
});
|
|
344
|
-
}
|
|
345
|
-
});
|
|
346
|
-
}
|
|
347
|
-
}, {
|
|
348
|
-
key: "loadFile",
|
|
349
|
-
value: function loadFile() {
|
|
350
|
-
return this.props.socket.readFile(this.objectID, this.state.value, true);
|
|
351
|
-
}
|
|
352
|
-
}, {
|
|
353
|
-
key: "play",
|
|
354
|
-
value: function play() {
|
|
355
|
-
this.loadFile().then(function (data) {
|
|
356
|
-
if (typeof AudioContext !== 'undefined') {
|
|
357
|
-
var context = new AudioContext();
|
|
358
|
-
var buf = ConfigFileSelector.base64ToArrayBuffer(data.file);
|
|
359
|
-
context.decodeAudioData(buf, function (buffer) {
|
|
360
|
-
var source = context.createBufferSource(); // creates a sound source
|
|
361
|
-
source.buffer = buffer; // tell the source which sound to play
|
|
362
|
-
source.connect(context.destination); // connect the source to the context's destination (the speakers)
|
|
363
|
-
source.start(0);
|
|
364
|
-
}, function (err) {
|
|
365
|
-
return window.alert("Cannot play: ".concat(err));
|
|
366
|
-
});
|
|
367
|
-
}
|
|
368
|
-
});
|
|
369
|
-
}
|
|
370
|
-
}, {
|
|
371
|
-
key: "getIcon",
|
|
372
|
-
value: function getIcon(item) {
|
|
373
|
-
if (!item || !item.extension) {
|
|
374
|
-
return null;
|
|
375
|
-
}
|
|
376
|
-
if (IMAGE_EXT.includes(item.extension)) {
|
|
377
|
-
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
378
|
-
className: this.props.classes.selectedImage,
|
|
379
|
-
style: {
|
|
380
|
-
backgroundImage: "url(".concat(this.imagePrefix, "/").concat(this.objectID, "/").concat(item.value, ")"),
|
|
381
|
-
backgroundSize: 'contain',
|
|
382
|
-
backgroundRepeat: 'no-repeat'
|
|
383
|
-
}
|
|
384
|
-
});
|
|
385
|
-
}
|
|
386
|
-
if (AUDIO_EXT.includes(item.extension)) {
|
|
387
|
-
return /*#__PURE__*/_react["default"].createElement(_iconsMaterial.MusicNote, null);
|
|
388
|
-
}
|
|
389
|
-
if (DOC_EXT.includes(item.extension)) {
|
|
390
|
-
return /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Article, null);
|
|
391
|
-
}
|
|
392
|
-
if (VIDEO_EXT.includes(item.extension)) {
|
|
393
|
-
return /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Videocam, null);
|
|
394
|
-
}
|
|
395
|
-
if (JS_EXT.includes(item.extension)) {
|
|
396
|
-
return /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Code, null);
|
|
397
|
-
}
|
|
398
|
-
return null;
|
|
399
|
-
}
|
|
400
|
-
}, {
|
|
401
|
-
key: "renderItem",
|
|
402
|
-
value: function renderItem(error, disabled) {
|
|
403
|
-
var _this6 = this;
|
|
404
|
-
if (!this.state.files) {
|
|
405
|
-
return null;
|
|
406
|
-
}
|
|
407
|
-
var folders = [];
|
|
408
|
-
if (!this.props.schema.withFolder) {
|
|
409
|
-
this.state.files.forEach(function (file) {
|
|
410
|
-
var pos = file.name.lastIndexOf('/');
|
|
411
|
-
if (pos === -1) {
|
|
412
|
-
if (!folders.includes('/')) {
|
|
413
|
-
folders.push('/');
|
|
414
|
-
}
|
|
415
|
-
} else {
|
|
416
|
-
var folder = file.name.substring(0, pos + 1);
|
|
417
|
-
if (!folders.includes(folder)) {
|
|
418
|
-
folders.push(folder);
|
|
419
|
-
}
|
|
420
|
-
}
|
|
421
|
-
});
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
/** @typedef {{ value: string, label: string, extension?: string }} Item */
|
|
425
|
-
/** @type {Item[]} */
|
|
426
|
-
var selectOptions = this.state.files.map(function (file) {
|
|
427
|
-
return {
|
|
428
|
-
value: file.name,
|
|
429
|
-
label: !_this6.props.schema.withFolder && folders.length === 1 ? "".concat(file.name.substring(folders[0].length)) : "".concat(file.name).concat(_this6.props.schema.noSize ? '' : "(".concat(file.size, ")")),
|
|
430
|
-
extension: file.name.toLowerCase().split('.').pop()
|
|
431
|
-
};
|
|
432
|
-
});
|
|
433
|
-
if (!this.props.schema.noNone) {
|
|
434
|
-
selectOptions.unshift({
|
|
435
|
-
label: _i18n["default"].t('ra_none'),
|
|
436
|
-
value: ''
|
|
437
|
-
});
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
/** @type {Item | undefined } */
|
|
441
|
-
var item = selectOptions.find(function (_item) {
|
|
442
|
-
return _item.value === _this6.state.value;
|
|
443
|
-
});
|
|
444
|
-
var buttons = 0;
|
|
445
|
-
if (this.props.schema.upload) {
|
|
446
|
-
buttons++;
|
|
447
|
-
}
|
|
448
|
-
if (this.props.schema.refresh) {
|
|
449
|
-
buttons++;
|
|
450
|
-
}
|
|
451
|
-
var play = this.state.value && (this.state.value.endsWith('.mp3') || this.state.value.endsWith('.ogg') || this.state.value.endsWith('.wav'));
|
|
452
|
-
// show play button
|
|
453
|
-
if (play) {
|
|
454
|
-
buttons++;
|
|
455
|
-
}
|
|
456
|
-
var element = /*#__PURE__*/_react["default"].createElement("div", {
|
|
457
|
-
className: this.props.classes.fullWidth
|
|
458
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.FormControl, {
|
|
459
|
-
variant: "standard",
|
|
460
|
-
style: {
|
|
461
|
-
width: "calc(100% - ".concat(buttons * 42, "px)")
|
|
462
|
-
}
|
|
463
|
-
}, this.props.schema.label ? /*#__PURE__*/_react["default"].createElement(_material.InputLabel, null, this.getText(this.props.schema.label)) : null, /*#__PURE__*/_react["default"].createElement(_material.Select, {
|
|
464
|
-
variant: "standard",
|
|
465
|
-
error: !!error,
|
|
466
|
-
disabled: !!disabled,
|
|
467
|
-
value: this.state.value || '_',
|
|
468
|
-
renderValue: function renderValue() {
|
|
469
|
-
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, _this6.getIcon(item), /*#__PURE__*/_react["default"].createElement("span", null, (item === null || item === void 0 ? void 0 : item.label) || ''));
|
|
470
|
-
},
|
|
471
|
-
onChange: function onChange(e) {
|
|
472
|
-
_this6.setState({
|
|
473
|
-
value: e.target.value === '_' ? '' : e.target.value
|
|
474
|
-
}, function () {
|
|
475
|
-
return _this6.onChange(_this6.props.attr, _this6.state.value);
|
|
476
|
-
});
|
|
477
|
-
}
|
|
478
|
-
}, selectOptions.map(function (it) {
|
|
479
|
-
return /*#__PURE__*/_react["default"].createElement(_material.MenuItem, {
|
|
480
|
-
key: it.value,
|
|
481
|
-
value: it.value
|
|
482
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.ListItemIcon, null, _this6.getIcon(it)), /*#__PURE__*/_react["default"].createElement(_material.ListItemText, null, it.label), _this6.props.schema["delete"] && item.value ? /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
483
|
-
className: _this6.props.classes.deleteButton,
|
|
484
|
-
size: "small",
|
|
485
|
-
onClick: function onClick() {
|
|
486
|
-
return _this6.setState({
|
|
487
|
-
deleteFile: item.value
|
|
488
|
-
});
|
|
489
|
-
}
|
|
490
|
-
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Delete, null)) : null);
|
|
491
|
-
})), this.props.schema.help ? /*#__PURE__*/_react["default"].createElement(_material.FormHelperText, null, this.renderHelp(this.props.schema.help, this.props.schema.helpLink, this.props.schema.noTranslation)) : null), this.props.schema.refresh && /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
492
|
-
onClick: function onClick() {
|
|
493
|
-
return _this6.updateFiles();
|
|
494
|
-
}
|
|
495
|
-
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Refresh, null)), this.props.schema.upload && /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
496
|
-
onClick: function onClick() {
|
|
497
|
-
var _this6$dropzoneRef$cu;
|
|
498
|
-
return (_this6$dropzoneRef$cu = _this6.dropzoneRef.current) === null || _this6$dropzoneRef$cu === void 0 ? void 0 : _this6$dropzoneRef$cu.open();
|
|
499
|
-
}
|
|
500
|
-
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.UploadFile, null)), play && /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
501
|
-
style: {
|
|
502
|
-
color: '#00FF00'
|
|
503
|
-
},
|
|
504
|
-
onClick: function onClick() {
|
|
505
|
-
return _this6.play();
|
|
506
|
-
}
|
|
507
|
-
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.PlayArrow, null)));
|
|
508
|
-
if (!this.props.schema.upload) {
|
|
509
|
-
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, element, this.renderDeleteDialog());
|
|
510
|
-
}
|
|
511
|
-
var accept = {
|
|
512
|
-
'*/*': []
|
|
513
|
-
};
|
|
514
|
-
if (this.props.schema.fileTypes === 'image') {
|
|
515
|
-
accept = {
|
|
516
|
-
'image/*': ['.png', '.jpg', '.svg', '.gif', '.apng', '.avif', '.webp']
|
|
517
|
-
};
|
|
518
|
-
} else if (this.props.schema.fileTypes === 'audio') {
|
|
519
|
-
accept = {
|
|
520
|
-
'audio/*': ['.mp3', '.ogg', '.wav', '.mp4']
|
|
521
|
-
};
|
|
522
|
-
} else if (this.props.schema.fileTypes === 'text') {
|
|
523
|
-
accept = {
|
|
524
|
-
'text/plain': ['.txt']
|
|
525
|
-
};
|
|
526
|
-
}
|
|
527
|
-
if (this.props.schema.pattern) {
|
|
528
|
-
var last = this.props.schema.pattern.split('/').pop().toLowerCase().replace(/.*\./, '');
|
|
529
|
-
if (last === 'png' || last === 'jpg' || last === 'svg' || last === 'gif' || last === 'apng' || last === 'avif' || last === 'webp') {
|
|
530
|
-
accept = {
|
|
531
|
-
'image/*': ['.png', '.jpg', '.svg', '.gif', '.apng', '.avif', '.webp']
|
|
532
|
-
};
|
|
533
|
-
} else if (last === 'mp3' || last === 'ogg' || last === 'wav') {
|
|
534
|
-
accept = {
|
|
535
|
-
'audio/*': ['.mp3', '.ogg', '.wav', '.mp4']
|
|
536
|
-
};
|
|
537
|
-
} else if (last === 'ics') {
|
|
538
|
-
accept = {
|
|
539
|
-
'text/calendar': ['.ics']
|
|
540
|
-
};
|
|
541
|
-
} else if (last === 'txt') {
|
|
542
|
-
accept = {
|
|
543
|
-
'text/plain': ['.txt']
|
|
544
|
-
};
|
|
545
|
-
} else if (last === 'pem') {
|
|
546
|
-
accept = {
|
|
547
|
-
'text/plain': ['.pem']
|
|
548
|
-
};
|
|
549
|
-
} else {
|
|
550
|
-
accept = {
|
|
551
|
-
'*/*': [".".concat(last)]
|
|
552
|
-
};
|
|
553
|
-
}
|
|
554
|
-
}
|
|
555
|
-
return /*#__PURE__*/_react["default"].createElement(_reactDropzone["default"], {
|
|
556
|
-
ref: this.dropzoneRef,
|
|
557
|
-
multiple: false,
|
|
558
|
-
accept: accept,
|
|
559
|
-
noKeyboard: true,
|
|
560
|
-
noClick: true,
|
|
561
|
-
maxSize: this.props.schema.maxSize || 2 * 1024 * 1024,
|
|
562
|
-
onDragEnter: function onDragEnter() {
|
|
563
|
-
_this6.setState({
|
|
564
|
-
uploadFile: 'dragging'
|
|
565
|
-
});
|
|
566
|
-
},
|
|
567
|
-
onDragLeave: function onDragLeave() {
|
|
568
|
-
return _this6.setState({
|
|
569
|
-
uploadFile: true
|
|
570
|
-
});
|
|
571
|
-
},
|
|
572
|
-
onDrop: function onDrop(acceptedFiles, errors) {
|
|
573
|
-
_this6.setState({
|
|
574
|
-
uploadFile: false
|
|
575
|
-
});
|
|
576
|
-
if (!acceptedFiles.length) {
|
|
577
|
-
window.alert(errors && errors[0] && errors[0].errors && errors[0].errors[0] && errors[0].errors[0].message || _i18n["default"].t('Cannot upload'));
|
|
578
|
-
} else {
|
|
579
|
-
_this6.onDrop(acceptedFiles);
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
}, function (_ref) {
|
|
583
|
-
var getRootProps = _ref.getRootProps,
|
|
584
|
-
getInputProps = _ref.getInputProps;
|
|
585
|
-
return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({
|
|
586
|
-
className: _Utils["default"].clsx(_this6.props.classes.uploadDiv, _this6.state.uploadFile === 'dragging' && _this6.props.classes.uploadDivDragging, disabled && _this6.props.classes.disabledOpacity)
|
|
587
|
-
}, getRootProps()), /*#__PURE__*/_react["default"].createElement("input", getInputProps()), _this6.state.uploadFile === 'dragging' ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
588
|
-
className: _Utils["default"].clsx(_this6.props.classes.uploadCenterDiv, _this6.state.uploadError && _this6.props.classes.error)
|
|
589
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
590
|
-
className: _this6.props.classes.uploadCenterTextAndIcon
|
|
591
|
-
}, /*#__PURE__*/_react["default"].createElement(_fa.FaFileUpload, {
|
|
592
|
-
className: _this6.props.classes.uploadCenterIcon
|
|
593
|
-
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
594
|
-
className: _this6.props.classes.uploadCenterText
|
|
595
|
-
}, _this6.state.uploadFile === 'dragging' ? _i18n["default"].t('ra_Drop file here') : _i18n["default"].t('ra_Place your files here or click here to open the browse dialog')))) : null, element, _this6.renderDeleteDialog());
|
|
596
|
-
});
|
|
597
|
-
}
|
|
598
|
-
}], [{
|
|
599
|
-
key: "base64ToArrayBuffer",
|
|
600
|
-
value: function base64ToArrayBuffer(base64) {
|
|
601
|
-
var binaryString = window.atob(base64);
|
|
602
|
-
var len = binaryString.length;
|
|
603
|
-
var bytes = new Uint8Array(len);
|
|
604
|
-
for (var i = 0; i < len; i++) {
|
|
605
|
-
bytes[i] = binaryString.charCodeAt(i);
|
|
606
|
-
}
|
|
607
|
-
return bytes.buffer;
|
|
608
|
-
}
|
|
609
|
-
}]);
|
|
610
|
-
return ConfigFileSelector;
|
|
611
|
-
}(_ConfigGeneric2["default"]);
|
|
612
|
-
ConfigFileSelector.propTypes = {
|
|
613
|
-
socket: _propTypes["default"].object.isRequired,
|
|
614
|
-
themeType: _propTypes["default"].string,
|
|
615
|
-
themeName: _propTypes["default"].string,
|
|
616
|
-
style: _propTypes["default"].object,
|
|
617
|
-
className: _propTypes["default"].string,
|
|
618
|
-
data: _propTypes["default"].object.isRequired,
|
|
619
|
-
schema: _propTypes["default"].object,
|
|
620
|
-
onError: _propTypes["default"].func,
|
|
621
|
-
onChange: _propTypes["default"].func,
|
|
622
|
-
imagePrefix: _propTypes["default"].func
|
|
623
|
-
};
|
|
624
|
-
var _default = exports["default"] = (0, _styles.withStyles)(styles)(ConfigFileSelector);
|
|
625
|
-
//# sourceMappingURL=ConfigFileSelector.js.map
|