@iobroker/adapter-react-v5 4.8.0 → 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 +7 -3
- package/i18n.d.ts +2 -2
- package/index.d.ts +127 -126
- package/index.js +213 -192
- package/package.json +7 -8
- 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 -216
- 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,1064 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
10
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
-
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
12
|
-
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
13
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
14
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
15
|
-
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
|
|
16
|
-
var _get2 = _interopRequireDefault(require("@babel/runtime/helpers/get"));
|
|
17
|
-
var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
|
|
18
|
-
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
19
|
-
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
|
|
20
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
21
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
22
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
23
|
-
var _styles = require("@mui/styles");
|
|
24
|
-
var _reactDropzone = _interopRequireDefault(require("react-dropzone"));
|
|
25
|
-
var _material = require("@mui/material");
|
|
26
|
-
var _iconsMaterial = require("@mui/icons-material");
|
|
27
|
-
var _i18n = _interopRequireDefault(require("./wrapper/i18n"));
|
|
28
|
-
var _Utils = _interopRequireDefault(require("./wrapper/Components/Utils"));
|
|
29
|
-
var _ConfigGeneric2 = _interopRequireDefault(require("./ConfigGeneric"));
|
|
30
|
-
var _ConfigPanel = _interopRequireDefault(require("./ConfigPanel"));
|
|
31
|
-
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
32
|
-
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
33
|
-
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
34
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
35
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
36
|
-
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); }; }
|
|
37
|
-
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; } } // eslint-disable-next-line import/no-cycle
|
|
38
|
-
var MAX_SIZE = 1024 * 1024; // 1MB
|
|
39
|
-
|
|
40
|
-
var styles = function styles(theme) {
|
|
41
|
-
return {
|
|
42
|
-
fullWidth: {
|
|
43
|
-
width: '100%'
|
|
44
|
-
},
|
|
45
|
-
root: {
|
|
46
|
-
width: '100%'
|
|
47
|
-
},
|
|
48
|
-
paper: {
|
|
49
|
-
width: '100%',
|
|
50
|
-
marginBottom: theme.spacing(2),
|
|
51
|
-
backgroundColor: 'rgba(255, 255, 255, 0.1)'
|
|
52
|
-
},
|
|
53
|
-
headerText: {
|
|
54
|
-
width: '100%'
|
|
55
|
-
},
|
|
56
|
-
table: {
|
|
57
|
-
minWidth: 750
|
|
58
|
-
},
|
|
59
|
-
visuallyHidden: {
|
|
60
|
-
border: 0,
|
|
61
|
-
clip: 'rect(0 0 0 0)',
|
|
62
|
-
height: 1,
|
|
63
|
-
margin: -1,
|
|
64
|
-
overflow: 'hidden',
|
|
65
|
-
padding: 0,
|
|
66
|
-
position: 'absolute',
|
|
67
|
-
top: 20,
|
|
68
|
-
width: 1
|
|
69
|
-
},
|
|
70
|
-
label: {
|
|
71
|
-
display: 'flex',
|
|
72
|
-
justifyContent: 'space-between'
|
|
73
|
-
},
|
|
74
|
-
highlight: theme.palette.mode === 'light' ? {
|
|
75
|
-
color: theme.palette.secondary.main
|
|
76
|
-
// backgroundColor: lighten(theme.palette.secondary.light, 0.85),
|
|
77
|
-
} : {
|
|
78
|
-
color: theme.palette.text.primary,
|
|
79
|
-
backgroundColor: theme.palette.secondary.dark
|
|
80
|
-
},
|
|
81
|
-
title: {
|
|
82
|
-
flex: '1 1 100%'
|
|
83
|
-
},
|
|
84
|
-
rootTool: {
|
|
85
|
-
paddingLeft: theme.spacing(2),
|
|
86
|
-
paddingRight: theme.spacing(1)
|
|
87
|
-
},
|
|
88
|
-
silver: {
|
|
89
|
-
opacity: 0.2
|
|
90
|
-
},
|
|
91
|
-
flex: {
|
|
92
|
-
display: 'flex',
|
|
93
|
-
alignItems: 'baseline'
|
|
94
|
-
},
|
|
95
|
-
filteredOut: {
|
|
96
|
-
padding: 10,
|
|
97
|
-
display: 'flex',
|
|
98
|
-
textAlign: 'center'
|
|
99
|
-
},
|
|
100
|
-
buttonEmpty: {
|
|
101
|
-
width: 34,
|
|
102
|
-
display: 'inline-block'
|
|
103
|
-
},
|
|
104
|
-
buttonCell: {
|
|
105
|
-
whiteSpace: 'nowrap'
|
|
106
|
-
},
|
|
107
|
-
dropZone: {
|
|
108
|
-
width: '100%',
|
|
109
|
-
height: 100,
|
|
110
|
-
position: 'relative'
|
|
111
|
-
},
|
|
112
|
-
dropZoneEmpty: {},
|
|
113
|
-
uploadDiv: {
|
|
114
|
-
position: 'relative',
|
|
115
|
-
width: '100%',
|
|
116
|
-
height: 300,
|
|
117
|
-
opacity: 0.9,
|
|
118
|
-
marginTop: 30,
|
|
119
|
-
cursor: 'pointer',
|
|
120
|
-
outline: 'none'
|
|
121
|
-
},
|
|
122
|
-
uploadDivDragging: {
|
|
123
|
-
opacity: 1,
|
|
124
|
-
background: 'rgba(128,255,128,0.1)'
|
|
125
|
-
},
|
|
126
|
-
image: {
|
|
127
|
-
objectFit: 'contain',
|
|
128
|
-
margin: 'auto',
|
|
129
|
-
display: 'flex',
|
|
130
|
-
width: '100%',
|
|
131
|
-
height: '100%'
|
|
132
|
-
},
|
|
133
|
-
uploadCenterDiv: {
|
|
134
|
-
margin: 5,
|
|
135
|
-
border: '3px dashed grey',
|
|
136
|
-
borderRadius: 5,
|
|
137
|
-
width: 'calc(100% - 10px)',
|
|
138
|
-
height: 'calc(100% - 10px)',
|
|
139
|
-
minHeight: 300,
|
|
140
|
-
position: 'relative',
|
|
141
|
-
display: 'flex'
|
|
142
|
-
},
|
|
143
|
-
uploadCenterIcon: {
|
|
144
|
-
paddingTop: 10,
|
|
145
|
-
width: 48,
|
|
146
|
-
height: 48
|
|
147
|
-
},
|
|
148
|
-
uploadCenterText: {
|
|
149
|
-
fontSize: 16
|
|
150
|
-
},
|
|
151
|
-
uploadCenterTextAndIcon: {
|
|
152
|
-
textAlign: 'center',
|
|
153
|
-
position: 'absolute',
|
|
154
|
-
top: 0,
|
|
155
|
-
bottom: 0,
|
|
156
|
-
left: 0,
|
|
157
|
-
right: 0,
|
|
158
|
-
display: 'flex',
|
|
159
|
-
flexDirection: 'column',
|
|
160
|
-
alignItems: 'center',
|
|
161
|
-
justifyContent: 'center'
|
|
162
|
-
},
|
|
163
|
-
buttonRemoveWrapper: {
|
|
164
|
-
position: 'absolute',
|
|
165
|
-
zIndex: 222,
|
|
166
|
-
right: 0
|
|
167
|
-
},
|
|
168
|
-
error: {
|
|
169
|
-
border: '2px solid red',
|
|
170
|
-
boxSizing: 'border-box'
|
|
171
|
-
}
|
|
172
|
-
};
|
|
173
|
-
};
|
|
174
|
-
function objectToArray(object, nameOfFirstAttr, nameOfSecondAttr) {
|
|
175
|
-
nameOfFirstAttr = nameOfFirstAttr || 'key';
|
|
176
|
-
var array = [];
|
|
177
|
-
Object.keys(object).forEach(function (key) {
|
|
178
|
-
var item = {};
|
|
179
|
-
item[nameOfFirstAttr] = key;
|
|
180
|
-
if (nameOfSecondAttr) {
|
|
181
|
-
item[nameOfSecondAttr] = object[key];
|
|
182
|
-
array.push(item);
|
|
183
|
-
} else {
|
|
184
|
-
array.push(Object.assign(item, object[key]));
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
return array;
|
|
188
|
-
}
|
|
189
|
-
function arrayToObject(array, nameOfFirstAttr, nameOfSecondAttr) {
|
|
190
|
-
nameOfFirstAttr = nameOfFirstAttr || 'key';
|
|
191
|
-
var object = {};
|
|
192
|
-
array.forEach(function (row) {
|
|
193
|
-
var key = row[nameOfFirstAttr];
|
|
194
|
-
if (key === null || key === undefined) {
|
|
195
|
-
key = '';
|
|
196
|
-
}
|
|
197
|
-
delete row[nameOfFirstAttr];
|
|
198
|
-
if (nameOfSecondAttr) {
|
|
199
|
-
object[key] = row[nameOfSecondAttr];
|
|
200
|
-
} else {
|
|
201
|
-
object[key] = row;
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
return object;
|
|
205
|
-
}
|
|
206
|
-
var ConfigTable = /*#__PURE__*/function (_ConfigGeneric) {
|
|
207
|
-
(0, _inherits2["default"])(ConfigTable, _ConfigGeneric);
|
|
208
|
-
var _super = _createSuper(ConfigTable);
|
|
209
|
-
function ConfigTable(props) {
|
|
210
|
-
var _this;
|
|
211
|
-
(0, _classCallCheck2["default"])(this, ConfigTable);
|
|
212
|
-
_this = _super.call(this, props);
|
|
213
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "handleRequestSort", function (property) {
|
|
214
|
-
var orderCheck = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
215
|
-
var _this$state = _this.state,
|
|
216
|
-
order = _this$state.order,
|
|
217
|
-
orderBy = _this$state.orderBy;
|
|
218
|
-
if (orderBy) {
|
|
219
|
-
var isAsc = orderBy === property && order === 'asc';
|
|
220
|
-
var newOrder = orderCheck ? order : isAsc ? 'desc' : 'asc';
|
|
221
|
-
var newValue = _this.stableSort(newOrder, property);
|
|
222
|
-
_this.setState({
|
|
223
|
-
order: newOrder,
|
|
224
|
-
orderBy: property,
|
|
225
|
-
iteration: _this.state.iteration + 10000
|
|
226
|
-
}, function () {
|
|
227
|
-
return _this.applyFilter(false, newValue);
|
|
228
|
-
});
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "stableSort", function (order, orderBy) {
|
|
232
|
-
var value = _this.state.value;
|
|
233
|
-
var comparator = ConfigTable.getComparator(order, orderBy);
|
|
234
|
-
var stabilizedThis = value.map(function (el, index) {
|
|
235
|
-
return [el, index];
|
|
236
|
-
});
|
|
237
|
-
stabilizedThis.sort(function (a, b) {
|
|
238
|
-
var order_ = comparator(a[0], b[0]);
|
|
239
|
-
if (order_ !== 0) {
|
|
240
|
-
return order_;
|
|
241
|
-
}
|
|
242
|
-
return a[1] - b[1];
|
|
243
|
-
});
|
|
244
|
-
return stabilizedThis.map(function (el) {
|
|
245
|
-
return el[0];
|
|
246
|
-
});
|
|
247
|
-
});
|
|
248
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onDelete", function (index) {
|
|
249
|
-
return function () {
|
|
250
|
-
var newValue = JSON.parse(JSON.stringify(_this.state.value));
|
|
251
|
-
newValue.splice(index, 1);
|
|
252
|
-
_this.setState({
|
|
253
|
-
value: newValue,
|
|
254
|
-
iteration: _this.state.iteration + 10000
|
|
255
|
-
}, function () {
|
|
256
|
-
return _this.applyFilter(false, null, function () {
|
|
257
|
-
return _this.onChangeWrapper(newValue);
|
|
258
|
-
});
|
|
259
|
-
});
|
|
260
|
-
};
|
|
261
|
-
});
|
|
262
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onClone", function (index) {
|
|
263
|
-
return function () {
|
|
264
|
-
var newValue = JSON.parse(JSON.stringify(_this.state.value));
|
|
265
|
-
var cloned = JSON.parse(JSON.stringify(newValue[index]));
|
|
266
|
-
if (typeof _this.props.schema.clone === 'string' && typeof cloned[_this.props.schema.clone] === 'string') {
|
|
267
|
-
var i = 1;
|
|
268
|
-
var text = cloned[_this.props.schema.clone];
|
|
269
|
-
var pattern = text.match(/(\d+)$/);
|
|
270
|
-
if (pattern) {
|
|
271
|
-
text = text.replace(pattern[0], '');
|
|
272
|
-
i = parseInt(pattern[0], 10) + 1;
|
|
273
|
-
} else {
|
|
274
|
-
text += '_';
|
|
275
|
-
}
|
|
276
|
-
// eslint-disable-next-line no-loop-func
|
|
277
|
-
while (newValue.find(function (it) {
|
|
278
|
-
return it[_this.props.schema.clone] === text + i.toString();
|
|
279
|
-
})) {
|
|
280
|
-
i++;
|
|
281
|
-
}
|
|
282
|
-
cloned[_this.props.schema.clone] = "".concat(cloned[_this.props.schema.clone], "_").concat(i);
|
|
283
|
-
}
|
|
284
|
-
newValue.splice(index, 0, cloned);
|
|
285
|
-
_this.setState({
|
|
286
|
-
value: newValue,
|
|
287
|
-
iteration: _this.state.iteration + 10000
|
|
288
|
-
}, function () {
|
|
289
|
-
return _this.applyFilter(false, null, function () {
|
|
290
|
-
return _this.onChangeWrapper(newValue);
|
|
291
|
-
});
|
|
292
|
-
});
|
|
293
|
-
};
|
|
294
|
-
});
|
|
295
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChangeWrapper", function (newValue) {
|
|
296
|
-
var updateVisible = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
|
|
297
|
-
_this.typingTimer && clearTimeout(_this.typingTimer);
|
|
298
|
-
_this.typingTimer = setTimeout(function (value, _updateVisible) {
|
|
299
|
-
_this.typingTimer = null;
|
|
300
|
-
if (_this.props.schema.objKeyName) {
|
|
301
|
-
var objValue = arrayToObject(JSON.parse(JSON.stringify(value)), _this.props.schema.objKeyName, _this.props.schema.objValueName);
|
|
302
|
-
_this.onChange(_this.props.attr, objValue);
|
|
303
|
-
} else {
|
|
304
|
-
_this.onChange(_this.props.attr, value);
|
|
305
|
-
}
|
|
306
|
-
if (_updateVisible) {
|
|
307
|
-
_this.applyFilter(false, value);
|
|
308
|
-
_this.handleRequestSort(_this.state.orderBy, true);
|
|
309
|
-
}
|
|
310
|
-
}, 300, newValue, updateVisible);
|
|
311
|
-
});
|
|
312
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onAdd", function () {
|
|
313
|
-
var schema = _this.props.schema;
|
|
314
|
-
var newValue = JSON.parse(JSON.stringify(_this.state.value));
|
|
315
|
-
var newItem = schema.items && schema.items.reduce(function (accumulator, currentValue) {
|
|
316
|
-
var defaultValue;
|
|
317
|
-
if (currentValue.defaultFunc) {
|
|
318
|
-
if (_this.props.custom) {
|
|
319
|
-
defaultValue = currentValue.defaultFunc ? _this.executeCustom(currentValue.defaultFunc, _this.props.schema["default"], _this.props.data, _this.props.instanceObj, newValue.length, _this.props.data) : _this.props.schema["default"];
|
|
320
|
-
} else {
|
|
321
|
-
defaultValue = currentValue.defaultFunc ? _this.execute(currentValue.defaultFunc, _this.props.schema["default"], _this.props.data, newValue.length, _this.props.data) : _this.props.schema["default"];
|
|
322
|
-
}
|
|
323
|
-
} else {
|
|
324
|
-
defaultValue = currentValue["default"] === undefined ? null : currentValue["default"];
|
|
325
|
-
}
|
|
326
|
-
accumulator[currentValue.attr] = defaultValue;
|
|
327
|
-
return accumulator;
|
|
328
|
-
}, {});
|
|
329
|
-
newValue.push(newItem);
|
|
330
|
-
_this.setState({
|
|
331
|
-
value: newValue
|
|
332
|
-
}, function () {
|
|
333
|
-
return _this.applyFilter(false, null, function () {
|
|
334
|
-
return _this.onChangeWrapper(newValue);
|
|
335
|
-
});
|
|
336
|
-
});
|
|
337
|
-
});
|
|
338
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "applyFilter", function (clear, value, cb) {
|
|
339
|
-
value = value || _this.state.value;
|
|
340
|
-
var visibleValue = value.map(function (_, i) {
|
|
341
|
-
return i;
|
|
342
|
-
});
|
|
343
|
-
Object.keys(_this.filterRefs).forEach(function (attr) {
|
|
344
|
-
var _this$filterRefs$attr;
|
|
345
|
-
var valueInputRef = (_this$filterRefs$attr = _this.filterRefs[attr].current) === null || _this$filterRefs$attr === void 0 ? void 0 : _this$filterRefs$attr.children[0].children[0].value;
|
|
346
|
-
if (!clear && valueInputRef) {
|
|
347
|
-
valueInputRef = valueInputRef.toLowerCase();
|
|
348
|
-
visibleValue = visibleValue.filter(function (idx) {
|
|
349
|
-
return value[idx] && value[idx][attr] && value[idx][attr].toLowerCase().includes(valueInputRef);
|
|
350
|
-
});
|
|
351
|
-
} else if (_this.filterRefs[attr].current) {
|
|
352
|
-
_this.filterRefs[attr].current.children[0].children[0].value = '';
|
|
353
|
-
}
|
|
354
|
-
});
|
|
355
|
-
if (visibleValue.length === value.length) {
|
|
356
|
-
visibleValue = null;
|
|
357
|
-
}
|
|
358
|
-
if (visibleValue === null && _this.state.visibleValue === null) {
|
|
359
|
-
cb && cb();
|
|
360
|
-
return;
|
|
361
|
-
}
|
|
362
|
-
if (JSON.stringify(visibleValue) !== JSON.stringify(_this.state.visibleValue)) {
|
|
363
|
-
_this.setState({
|
|
364
|
-
visibleValue: visibleValue
|
|
365
|
-
}, function () {
|
|
366
|
-
return cb && cb();
|
|
367
|
-
});
|
|
368
|
-
} else {
|
|
369
|
-
cb && cb();
|
|
370
|
-
}
|
|
371
|
-
});
|
|
372
|
-
_this.filterRefs = {};
|
|
373
|
-
_this.props.schema.items = _this.props.schema.items || [];
|
|
374
|
-
_this.props.schema.items.forEach(function (el) {
|
|
375
|
-
if (el.filter) {
|
|
376
|
-
_this.filterRefs[el.attr] = /*#__PURE__*/(0, _react.createRef)();
|
|
377
|
-
}
|
|
378
|
-
});
|
|
379
|
-
return _this;
|
|
380
|
-
}
|
|
381
|
-
|
|
382
|
-
/**
|
|
383
|
-
* React lifecycle hook, called once component is mounted
|
|
384
|
-
* @return {Promise<void>}
|
|
385
|
-
*/
|
|
386
|
-
(0, _createClass2["default"])(ConfigTable, [{
|
|
387
|
-
key: "componentDidMount",
|
|
388
|
-
value: (function () {
|
|
389
|
-
var _componentDidMount = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
390
|
-
var _this2 = this;
|
|
391
|
-
var value;
|
|
392
|
-
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
393
|
-
while (1) switch (_context.prev = _context.next) {
|
|
394
|
-
case 0:
|
|
395
|
-
(0, _get2["default"])((0, _getPrototypeOf2["default"])(ConfigTable.prototype), "componentDidMount", this).call(this);
|
|
396
|
-
value = _ConfigGeneric2["default"].getValue(this.props.data, this.props.attr) || []; // if the list is given as an object
|
|
397
|
-
if (this.props.schema.objKeyName) {
|
|
398
|
-
value = objectToArray(value, this.props.schema.objKeyName, this.props.schema.objValueName);
|
|
399
|
-
}
|
|
400
|
-
if (!Array.isArray(value)) {
|
|
401
|
-
value = [];
|
|
402
|
-
}
|
|
403
|
-
this.setState({
|
|
404
|
-
value: value,
|
|
405
|
-
visibleValue: null,
|
|
406
|
-
orderBy: /* this.props.schema.items.length ? this.props.schema.items[0].attr : */'',
|
|
407
|
-
order: 'asc',
|
|
408
|
-
iteration: 0,
|
|
409
|
-
filterOn: []
|
|
410
|
-
}, function () {
|
|
411
|
-
return _this2.validateUniqueProps();
|
|
412
|
-
});
|
|
413
|
-
case 5:
|
|
414
|
-
case "end":
|
|
415
|
-
return _context.stop();
|
|
416
|
-
}
|
|
417
|
-
}, _callee, this);
|
|
418
|
-
}));
|
|
419
|
-
function componentDidMount() {
|
|
420
|
-
return _componentDidMount.apply(this, arguments);
|
|
421
|
-
}
|
|
422
|
-
return componentDidMount;
|
|
423
|
-
}())
|
|
424
|
-
}, {
|
|
425
|
-
key: "componentWillUnmount",
|
|
426
|
-
value: function componentWillUnmount() {
|
|
427
|
-
this.typingTimer && clearTimeout(this.typingTimer);
|
|
428
|
-
this.typingTimer = null;
|
|
429
|
-
(0, _get2["default"])((0, _getPrototypeOf2["default"])(ConfigTable.prototype), "componentWillUnmount", this).call(this);
|
|
430
|
-
}
|
|
431
|
-
}, {
|
|
432
|
-
key: "itemTable",
|
|
433
|
-
value: function itemTable(attrItem, data, idx) {
|
|
434
|
-
var _this3 = this;
|
|
435
|
-
var value = this.state.value;
|
|
436
|
-
var schema = this.props.schema;
|
|
437
|
-
var schemaForAttribute = schema.items && schema.items.find(function (el) {
|
|
438
|
-
return el.attr === attrItem;
|
|
439
|
-
});
|
|
440
|
-
if (!schemaForAttribute) {
|
|
441
|
-
return null;
|
|
442
|
-
}
|
|
443
|
-
var schemaItem = {
|
|
444
|
-
items: (0, _defineProperty2["default"])({}, attrItem, schemaForAttribute)
|
|
445
|
-
};
|
|
446
|
-
return /*#__PURE__*/_react["default"].createElement(_ConfigPanel["default"], {
|
|
447
|
-
index: idx + this.state.iteration,
|
|
448
|
-
arrayIndex: idx,
|
|
449
|
-
changed: this.props.changed,
|
|
450
|
-
globalData: this.props.data,
|
|
451
|
-
socket: this.props.socket,
|
|
452
|
-
adapterName: this.props.adapterName,
|
|
453
|
-
instance: this.props.instance,
|
|
454
|
-
common: this.props.common,
|
|
455
|
-
alive: this.props.alive,
|
|
456
|
-
themeType: this.props.themeType,
|
|
457
|
-
themeName: this.props.themeName,
|
|
458
|
-
data: data,
|
|
459
|
-
table: true,
|
|
460
|
-
custom: true,
|
|
461
|
-
schema: schemaItem,
|
|
462
|
-
systemConfig: this.props.systemConfig,
|
|
463
|
-
originalData: this.props.originalData,
|
|
464
|
-
customs: this.props.customs,
|
|
465
|
-
onChange: function onChange(attr, valueChange) {
|
|
466
|
-
var newObj = JSON.parse(JSON.stringify(value));
|
|
467
|
-
newObj[idx][attr] = valueChange;
|
|
468
|
-
_this3.setState({
|
|
469
|
-
value: newObj
|
|
470
|
-
}, function () {
|
|
471
|
-
_this3.validateUniqueProps();
|
|
472
|
-
_this3.onChangeWrapper(newObj, true);
|
|
473
|
-
});
|
|
474
|
-
},
|
|
475
|
-
onError: function onError(error, attr) {
|
|
476
|
-
return _this3.onError(error, attr);
|
|
477
|
-
}
|
|
478
|
-
});
|
|
479
|
-
}
|
|
480
|
-
|
|
481
|
-
/**
|
|
482
|
-
* Validate that columns configured in `uniqueColumns` have unique values
|
|
483
|
-
*/
|
|
484
|
-
}, {
|
|
485
|
-
key: "validateUniqueProps",
|
|
486
|
-
value: function validateUniqueProps() {
|
|
487
|
-
var _this4 = this;
|
|
488
|
-
if (!this.props.schema.uniqueColumns) {
|
|
489
|
-
return;
|
|
490
|
-
}
|
|
491
|
-
var _iterator = _createForOfIteratorHelper(this.props.schema.uniqueColumns),
|
|
492
|
-
_step;
|
|
493
|
-
try {
|
|
494
|
-
var _loop = function _loop() {
|
|
495
|
-
var uniqueCol = _step.value;
|
|
496
|
-
/** @type {string[]} */
|
|
497
|
-
var allVals = [];
|
|
498
|
-
var found = _this4.state.value.find(function (entry) {
|
|
499
|
-
var val = entry[uniqueCol];
|
|
500
|
-
if (allVals.includes(val)) {
|
|
501
|
-
_this4.onError(uniqueCol, 'is not unique');
|
|
502
|
-
_this4.setState({
|
|
503
|
-
errorMessage: _i18n["default"].t('Non-allowed duplicate entry "%s" in column "%s"', val, uniqueCol)
|
|
504
|
-
});
|
|
505
|
-
return true;
|
|
506
|
-
}
|
|
507
|
-
allVals.push(val);
|
|
508
|
-
return false;
|
|
509
|
-
});
|
|
510
|
-
if (!found) {
|
|
511
|
-
_this4.onError(uniqueCol, null);
|
|
512
|
-
_this4.setState({
|
|
513
|
-
errorMessage: ''
|
|
514
|
-
});
|
|
515
|
-
}
|
|
516
|
-
};
|
|
517
|
-
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
518
|
-
_loop();
|
|
519
|
-
}
|
|
520
|
-
} catch (err) {
|
|
521
|
-
_iterator.e(err);
|
|
522
|
-
} finally {
|
|
523
|
-
_iterator.f();
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
}, {
|
|
527
|
-
key: "enhancedTableHead",
|
|
528
|
-
value: function enhancedTableHead(buttonsWidth, doAnyFilterSet) {
|
|
529
|
-
var _this5 = this;
|
|
530
|
-
var _this$props = this.props,
|
|
531
|
-
schema = _this$props.schema,
|
|
532
|
-
classes = _this$props.classes;
|
|
533
|
-
var _this$state2 = this.state,
|
|
534
|
-
order = _this$state2.order,
|
|
535
|
-
orderBy = _this$state2.orderBy;
|
|
536
|
-
return /*#__PURE__*/_react["default"].createElement(_material.TableHead, null, /*#__PURE__*/_react["default"].createElement(_material.TableRow, null, schema.items && schema.items.map(function (headCell, i) {
|
|
537
|
-
var _this5$filterRefs$hea;
|
|
538
|
-
return /*#__PURE__*/_react["default"].createElement(_material.TableCell, {
|
|
539
|
-
style: {
|
|
540
|
-
width: typeof headCell.width === 'string' && headCell.width.endsWith('%') ? headCell.width : headCell.width
|
|
541
|
-
},
|
|
542
|
-
key: "".concat(headCell.attr, "_").concat(i),
|
|
543
|
-
align: "left",
|
|
544
|
-
sortDirection: orderBy === headCell.attr ? order : false
|
|
545
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
546
|
-
className: classes.flex,
|
|
547
|
-
style: schema.showFirstAddOnTop ? {
|
|
548
|
-
flexDirection: 'column'
|
|
549
|
-
} : undefined
|
|
550
|
-
}, !i && !schema.noDelete ? /*#__PURE__*/_react["default"].createElement(_material.Tooltip, {
|
|
551
|
-
title: doAnyFilterSet ? _i18n["default"].t('ra_Cannot add items with set filter') : _i18n["default"].t('ra_Add row')
|
|
552
|
-
}, /*#__PURE__*/_react["default"].createElement("span", null, /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
553
|
-
size: "small",
|
|
554
|
-
color: "primary",
|
|
555
|
-
disabled: !!doAnyFilterSet && !_this5.props.schema.allowAddByFilter,
|
|
556
|
-
onClick: _this5.onAdd
|
|
557
|
-
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Add, null)))) : null, headCell.sort && /*#__PURE__*/_react["default"].createElement(_material.TableSortLabel, {
|
|
558
|
-
active: true,
|
|
559
|
-
className: _Utils["default"].clsx(orderBy !== headCell.attr && classes.silver),
|
|
560
|
-
direction: orderBy === headCell.attr ? order : 'asc',
|
|
561
|
-
onClick: function onClick() {
|
|
562
|
-
return _this5.handleRequestSort(headCell.attr);
|
|
563
|
-
}
|
|
564
|
-
}), headCell.filter && _this5.state.filterOn.includes(headCell.attr) ? /*#__PURE__*/_react["default"].createElement(_material.TextField, {
|
|
565
|
-
variant: "standard",
|
|
566
|
-
ref: _this5.filterRefs[headCell.attr],
|
|
567
|
-
onChange: function onChange() {
|
|
568
|
-
return _this5.applyFilter();
|
|
569
|
-
},
|
|
570
|
-
title: _i18n["default"].t('ra_You can filter entries by entering here some text'),
|
|
571
|
-
InputProps: {
|
|
572
|
-
endAdornment: ((_this5$filterRefs$hea = _this5.filterRefs[headCell.attr]) === null || _this5$filterRefs$hea === void 0 || (_this5$filterRefs$hea = _this5$filterRefs$hea.current) === null || _this5$filterRefs$hea === void 0 || (_this5$filterRefs$hea = _this5$filterRefs$hea.children[0]) === null || _this5$filterRefs$hea === void 0 || (_this5$filterRefs$hea = _this5$filterRefs$hea.children[0]) === null || _this5$filterRefs$hea === void 0 ? void 0 : _this5$filterRefs$hea.value) && /*#__PURE__*/_react["default"].createElement(_material.InputAdornment, {
|
|
573
|
-
position: "end"
|
|
574
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
575
|
-
size: "small",
|
|
576
|
-
onClick: function onClick() {
|
|
577
|
-
_this5.filterRefs[headCell.attr].current.children[0].children[0].value = '';
|
|
578
|
-
_this5.applyFilter();
|
|
579
|
-
}
|
|
580
|
-
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Close, null)))
|
|
581
|
-
},
|
|
582
|
-
fullWidth: true,
|
|
583
|
-
placeholder: _this5.getText(headCell.title)
|
|
584
|
-
}) : /*#__PURE__*/_react["default"].createElement("span", {
|
|
585
|
-
className: _this5.props.classes.headerText
|
|
586
|
-
}, _this5.getText(headCell.title)), headCell.filter ? /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
587
|
-
title: _i18n["default"].t('ra_Show/hide filter input'),
|
|
588
|
-
size: "small",
|
|
589
|
-
onClick: function onClick() {
|
|
590
|
-
var filterOn = (0, _toConsumableArray2["default"])(_this5.state.filterOn);
|
|
591
|
-
var pos = _this5.state.filterOn.indexOf(headCell.attr);
|
|
592
|
-
if (pos === -1) {
|
|
593
|
-
filterOn.push(headCell.attr);
|
|
594
|
-
} else {
|
|
595
|
-
filterOn.splice(pos, 1);
|
|
596
|
-
}
|
|
597
|
-
_this5.setState({
|
|
598
|
-
filterOn: filterOn
|
|
599
|
-
}, function () {
|
|
600
|
-
if (pos && _this5.filterRefs[headCell.attr].current.children[0].children[0].value) {
|
|
601
|
-
_this5.filterRefs[headCell.attr].current.children[0].children[0].value = '';
|
|
602
|
-
_this5.applyFilter();
|
|
603
|
-
}
|
|
604
|
-
});
|
|
605
|
-
}
|
|
606
|
-
}, _this5.state.filterOn.includes(headCell.attr) ? /*#__PURE__*/_react["default"].createElement(_iconsMaterial.FilterAltOff, null) : /*#__PURE__*/_react["default"].createElement(_iconsMaterial.FilterAlt, null)) : null));
|
|
607
|
-
}), !schema.noDelete && /*#__PURE__*/_react["default"].createElement(_material.TableCell, {
|
|
608
|
-
style: {
|
|
609
|
-
paddingLeft: 20,
|
|
610
|
-
paddingRight: 20,
|
|
611
|
-
width: buttonsWidth,
|
|
612
|
-
textAlign: 'right'
|
|
613
|
-
},
|
|
614
|
-
padding: "checkbox"
|
|
615
|
-
}, schema["import"] ? /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
616
|
-
style: {
|
|
617
|
-
marginRight: 10
|
|
618
|
-
},
|
|
619
|
-
size: "small",
|
|
620
|
-
onClick: function onClick() {
|
|
621
|
-
return _this5.setState({
|
|
622
|
-
showImportDialog: true
|
|
623
|
-
});
|
|
624
|
-
},
|
|
625
|
-
title: _i18n["default"].t('ra_import data from %s file', 'CSV')
|
|
626
|
-
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.UploadFile, null)) : null, schema["export"] ? /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
627
|
-
style: {
|
|
628
|
-
marginRight: 10
|
|
629
|
-
},
|
|
630
|
-
size: "small",
|
|
631
|
-
onClick: function onClick() {
|
|
632
|
-
return _this5.onExport();
|
|
633
|
-
},
|
|
634
|
-
title: _i18n["default"].t('ra_Export data to %s file', 'CSV')
|
|
635
|
-
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Download, null)) : null, /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
636
|
-
disabled: true,
|
|
637
|
-
size: "small"
|
|
638
|
-
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Delete, null)))));
|
|
639
|
-
}
|
|
640
|
-
}, {
|
|
641
|
-
key: "onExport",
|
|
642
|
-
value: function onExport() {
|
|
643
|
-
var schema = this.props.schema;
|
|
644
|
-
var value = this.state.value;
|
|
645
|
-
var cols = schema.items.map(function (it) {
|
|
646
|
-
return it.attr;
|
|
647
|
-
});
|
|
648
|
-
var lines = [cols.join(';')];
|
|
649
|
-
value.forEach(function (row) {
|
|
650
|
-
var line = [];
|
|
651
|
-
schema.items.forEach(function (it) {
|
|
652
|
-
if (row[it.attr].includes(';')) {
|
|
653
|
-
line.push("\"".concat(row[it.attr], "\""));
|
|
654
|
-
} else {
|
|
655
|
-
line.push(row[it.attr]);
|
|
656
|
-
}
|
|
657
|
-
});
|
|
658
|
-
lines.push(line.join(';'));
|
|
659
|
-
});
|
|
660
|
-
var el = document.createElement('a');
|
|
661
|
-
el.setAttribute('href', "data:text/csv;charset=utf-8,".concat(encodeURIComponent(lines.join('\n'))));
|
|
662
|
-
var now = new Date();
|
|
663
|
-
el.setAttribute('download', "".concat(now.getFullYear(), "_").concat((now.getMonth() + 1).toString().padStart(2, '0'), "_").concat(now.getDate().toString().padStart(2, '0'), "_").concat(this.props.adapterName, ".").concat(this.props.instance, "_").concat(this.props.attr, ".csv"));
|
|
664
|
-
el.style.display = 'none';
|
|
665
|
-
document.body.appendChild(el);
|
|
666
|
-
el.click();
|
|
667
|
-
document.body.removeChild(el);
|
|
668
|
-
}
|
|
669
|
-
}, {
|
|
670
|
-
key: "onImport",
|
|
671
|
-
value: function onImport(text) {
|
|
672
|
-
var _this6 = this;
|
|
673
|
-
var lines = text.split('\n').map(function (line) {
|
|
674
|
-
return line.replace('\r', '').trim();
|
|
675
|
-
});
|
|
676
|
-
// the first line is header
|
|
677
|
-
var schema = this.props.schema;
|
|
678
|
-
var header = lines.shift().split(';').filter(function (it) {
|
|
679
|
-
return it && schema.items.find(function (it2) {
|
|
680
|
-
return it2.attr === it;
|
|
681
|
-
});
|
|
682
|
-
});
|
|
683
|
-
var values = [];
|
|
684
|
-
lines.forEach(function (line) {
|
|
685
|
-
var parts = line.split(';');
|
|
686
|
-
var obj = {};
|
|
687
|
-
var _loop2 = function _loop2(_p) {
|
|
688
|
-
var value = parts[_p];
|
|
689
|
-
if (value.startsWith('"')) {
|
|
690
|
-
value = value.substring(1);
|
|
691
|
-
while (_p < parts.length && !value.endsWith('"')) {
|
|
692
|
-
value += ";".concat(parts[++_p]);
|
|
693
|
-
}
|
|
694
|
-
value = value.substring(0, value.length - 1);
|
|
695
|
-
}
|
|
696
|
-
if (parts[_p] === 'true') {
|
|
697
|
-
parts[_p] = true;
|
|
698
|
-
} else if (parts[_p] === 'false') {
|
|
699
|
-
parts[_p] = false;
|
|
700
|
-
// eslint-disable-next-line no-restricted-properties
|
|
701
|
-
} else if (window.isFinite(parts[_p])) {
|
|
702
|
-
var attr = _this6.props.schema.items.find(function (it) {
|
|
703
|
-
return it.attr === header[_p];
|
|
704
|
-
});
|
|
705
|
-
if (attr && attr.type === 'number') {
|
|
706
|
-
// if a type of attribute is a "number"
|
|
707
|
-
parts[_p] = parseFloat(parts[_p]);
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
obj[header[_p]] = parts[_p];
|
|
711
|
-
p = _p;
|
|
712
|
-
};
|
|
713
|
-
for (var p = 0; p < parts.length; p++) {
|
|
714
|
-
_loop2(p);
|
|
715
|
-
}
|
|
716
|
-
values.push(obj);
|
|
717
|
-
});
|
|
718
|
-
if (values.length) {
|
|
719
|
-
var _this$state$value;
|
|
720
|
-
if ((_this$state$value = this.state.value) !== null && _this$state$value !== void 0 && _this$state$value.length) {
|
|
721
|
-
this.setState({
|
|
722
|
-
showTypeOfImportDialog: values,
|
|
723
|
-
showImportDialog: false
|
|
724
|
-
});
|
|
725
|
-
} else {
|
|
726
|
-
this.setState({
|
|
727
|
-
value: values,
|
|
728
|
-
showImportDialog: false
|
|
729
|
-
});
|
|
730
|
-
}
|
|
731
|
-
} else {
|
|
732
|
-
window.alert('ra_No data found in file');
|
|
733
|
-
}
|
|
734
|
-
}
|
|
735
|
-
}, {
|
|
736
|
-
key: "isAnyFilterSet",
|
|
737
|
-
value: function isAnyFilterSet() {
|
|
738
|
-
var _this7 = this;
|
|
739
|
-
return Object.keys(this.filterRefs).find(function (attr) {
|
|
740
|
-
var _this7$filterRefs$att;
|
|
741
|
-
return (_this7$filterRefs$att = _this7.filterRefs[attr].current) === null || _this7$filterRefs$att === void 0 ? void 0 : _this7$filterRefs$att.children[0].children[0].value;
|
|
742
|
-
});
|
|
743
|
-
}
|
|
744
|
-
}, {
|
|
745
|
-
key: "onMoveUp",
|
|
746
|
-
value: function onMoveUp(idx) {
|
|
747
|
-
var _this8 = this;
|
|
748
|
-
var newValue = JSON.parse(JSON.stringify(this.state.value));
|
|
749
|
-
var item = newValue[idx];
|
|
750
|
-
newValue.splice(idx, 1);
|
|
751
|
-
newValue.splice(idx - 1, 0, item);
|
|
752
|
-
this.setState({
|
|
753
|
-
value: newValue,
|
|
754
|
-
iteration: this.state.iteration + 10000
|
|
755
|
-
}, function () {
|
|
756
|
-
return _this8.applyFilter(false, null, function () {
|
|
757
|
-
return _this8.onChangeWrapper(newValue);
|
|
758
|
-
});
|
|
759
|
-
});
|
|
760
|
-
}
|
|
761
|
-
}, {
|
|
762
|
-
key: "onMoveDown",
|
|
763
|
-
value: function onMoveDown(idx) {
|
|
764
|
-
var _this9 = this;
|
|
765
|
-
var newValue = JSON.parse(JSON.stringify(this.state.value));
|
|
766
|
-
var item = newValue[idx];
|
|
767
|
-
newValue.splice(idx, 1);
|
|
768
|
-
newValue.splice(idx + 1, 0, item);
|
|
769
|
-
this.setState({
|
|
770
|
-
value: newValue,
|
|
771
|
-
iteration: this.state.iteration + 10000
|
|
772
|
-
}, function () {
|
|
773
|
-
return _this9.applyFilter(false, null, function () {
|
|
774
|
-
return _this9.onChangeWrapper(newValue);
|
|
775
|
-
});
|
|
776
|
-
});
|
|
777
|
-
}
|
|
778
|
-
}, {
|
|
779
|
-
key: "onDrop",
|
|
780
|
-
value: function onDrop(acceptedFiles) {
|
|
781
|
-
var _this10 = this;
|
|
782
|
-
var file = acceptedFiles[0];
|
|
783
|
-
var reader = new FileReader();
|
|
784
|
-
reader.onabort = function () {
|
|
785
|
-
return console.log('file reading was aborted');
|
|
786
|
-
};
|
|
787
|
-
reader.onerror = function () {
|
|
788
|
-
return console.log('file reading has failed');
|
|
789
|
-
};
|
|
790
|
-
reader.onload = function () {
|
|
791
|
-
if (file.size > MAX_SIZE) {
|
|
792
|
-
window.alert(_i18n["default"].t('ra_File is too big. Max %sk allowed. Try use SVG.', Math.round(MAX_SIZE / 1024)));
|
|
793
|
-
return;
|
|
794
|
-
}
|
|
795
|
-
var text = new Uint8Array(reader.result).reduce(function (data, _byte) {
|
|
796
|
-
return data + String.fromCharCode(_byte);
|
|
797
|
-
}, '');
|
|
798
|
-
_this10.onImport(text);
|
|
799
|
-
};
|
|
800
|
-
reader.readAsArrayBuffer(file);
|
|
801
|
-
}
|
|
802
|
-
}, {
|
|
803
|
-
key: "showTypeOfImportDialog",
|
|
804
|
-
value: function showTypeOfImportDialog() {
|
|
805
|
-
var _this11 = this;
|
|
806
|
-
if (!this.state.showTypeOfImportDialog) {
|
|
807
|
-
return null;
|
|
808
|
-
}
|
|
809
|
-
return /*#__PURE__*/_react["default"].createElement(_material.Dialog, {
|
|
810
|
-
open: !0,
|
|
811
|
-
onClose: function onClose() {
|
|
812
|
-
return _this11.setState({
|
|
813
|
-
showTypeOfImportDialog: false
|
|
814
|
-
});
|
|
815
|
-
},
|
|
816
|
-
maxWidth: "md"
|
|
817
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.DialogTitle, null, _i18n["default"].t('ra_Append or replace?')), /*#__PURE__*/_react["default"].createElement(_material.DialogContent, null, _i18n["default"].t('ra_Append %s entries or replace existing?', this.state.showTypeOfImportDialog.length)), /*#__PURE__*/_react["default"].createElement(_material.DialogActions, null, /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
818
|
-
variant: "contained",
|
|
819
|
-
color: "primary",
|
|
820
|
-
autoFocus: true,
|
|
821
|
-
onClick: function onClick() {
|
|
822
|
-
var value = JSON.parse(JSON.stringify(_this11.state.value));
|
|
823
|
-
_this11.state.showTypeOfImportDialog.forEach(function (obj) {
|
|
824
|
-
return value.push(obj);
|
|
825
|
-
});
|
|
826
|
-
_this11.setState({
|
|
827
|
-
value: value,
|
|
828
|
-
iteration: _this11.state.iteration + 10000,
|
|
829
|
-
showTypeOfImportDialog: false
|
|
830
|
-
}, function () {
|
|
831
|
-
return _this11.applyFilter(false, null, function () {
|
|
832
|
-
return _this11.onChangeWrapper(value);
|
|
833
|
-
});
|
|
834
|
-
});
|
|
835
|
-
}
|
|
836
|
-
}, _i18n["default"].t('ra_Append')), /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
837
|
-
variant: "contained",
|
|
838
|
-
color: "secondary",
|
|
839
|
-
autoFocus: true,
|
|
840
|
-
onClick: function onClick() {
|
|
841
|
-
var value = _this11.state.showTypeOfImportDialog;
|
|
842
|
-
_this11.setState({
|
|
843
|
-
value: value,
|
|
844
|
-
iteration: _this11.state.iteration + 10000,
|
|
845
|
-
showTypeOfImportDialog: false
|
|
846
|
-
}, function () {
|
|
847
|
-
return _this11.applyFilter(false, null, function () {
|
|
848
|
-
return _this11.onChangeWrapper(value);
|
|
849
|
-
});
|
|
850
|
-
});
|
|
851
|
-
}
|
|
852
|
-
}, _i18n["default"].t('ra_Replace'))));
|
|
853
|
-
}
|
|
854
|
-
}, {
|
|
855
|
-
key: "showImportDialog",
|
|
856
|
-
value: function showImportDialog() {
|
|
857
|
-
var _this12 = this;
|
|
858
|
-
if (!this.state.showImportDialog) {
|
|
859
|
-
return null;
|
|
860
|
-
}
|
|
861
|
-
return /*#__PURE__*/_react["default"].createElement(_material.Dialog, {
|
|
862
|
-
open: !0,
|
|
863
|
-
onClose: function onClose() {
|
|
864
|
-
return _this12.setState({
|
|
865
|
-
showImportDialog: false
|
|
866
|
-
});
|
|
867
|
-
},
|
|
868
|
-
maxWidth: "md",
|
|
869
|
-
fullWidth: true
|
|
870
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.DialogTitle, null, _i18n["default"].t('ra_Import from %s', 'CSV')), /*#__PURE__*/_react["default"].createElement(_material.DialogContent, null, /*#__PURE__*/_react["default"].createElement(_reactDropzone["default"], {
|
|
871
|
-
multiple: false,
|
|
872
|
-
accept: {
|
|
873
|
-
'text/csv': ['.csv']
|
|
874
|
-
},
|
|
875
|
-
maxSize: MAX_SIZE,
|
|
876
|
-
onDragEnter: function onDragEnter() {
|
|
877
|
-
return _this12.setState({
|
|
878
|
-
uploadFile: 'dragging'
|
|
879
|
-
});
|
|
880
|
-
},
|
|
881
|
-
onDragLeave: function onDragLeave() {
|
|
882
|
-
return _this12.setState({
|
|
883
|
-
uploadFile: true
|
|
884
|
-
});
|
|
885
|
-
},
|
|
886
|
-
onDrop: function onDrop(acceptedFiles, errors) {
|
|
887
|
-
_this12.setState({
|
|
888
|
-
uploadFile: false
|
|
889
|
-
});
|
|
890
|
-
if (!acceptedFiles.length) {
|
|
891
|
-
window.alert(errors && errors[0] && errors[0].errors && errors[0].errors[0] && errors[0].errors[0].message || _i18n["default"].t('ra_Cannot upload'));
|
|
892
|
-
} else {
|
|
893
|
-
_this12.onDrop(acceptedFiles);
|
|
894
|
-
}
|
|
895
|
-
}
|
|
896
|
-
}, function (_ref) {
|
|
897
|
-
var getRootProps = _ref.getRootProps,
|
|
898
|
-
getInputProps = _ref.getInputProps;
|
|
899
|
-
return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({
|
|
900
|
-
className: _Utils["default"].clsx(_this12.props.classes.uploadDiv, _this12.state.uploadFile === 'dragging' && _this12.props.classes.uploadDivDragging, _this12.props.classes.dropZone, !_this12.state.icon && _this12.props.classes.dropZoneEmpty)
|
|
901
|
-
}, getRootProps()), /*#__PURE__*/_react["default"].createElement("input", getInputProps()), /*#__PURE__*/_react["default"].createElement("div", {
|
|
902
|
-
className: _Utils["default"].clsx(_this12.props.classes.uploadCenterDiv)
|
|
903
|
-
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
904
|
-
className: _this12.props.classes.uploadCenterTextAndIcon
|
|
905
|
-
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.UploadFile, {
|
|
906
|
-
className: _this12.props.classes.uploadCenterIcon
|
|
907
|
-
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
908
|
-
className: _this12.props.classes.uploadCenterText
|
|
909
|
-
}, _this12.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')))));
|
|
910
|
-
})), /*#__PURE__*/_react["default"].createElement(_material.DialogActions, null, /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
911
|
-
variant: "contained",
|
|
912
|
-
onClick: function onClick() {
|
|
913
|
-
return _this12.setState({
|
|
914
|
-
showImportDialog: false
|
|
915
|
-
});
|
|
916
|
-
},
|
|
917
|
-
color: "primary",
|
|
918
|
-
startIcon: /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Close, null)
|
|
919
|
-
}, _i18n["default"].t('Cancel'))));
|
|
920
|
-
}
|
|
921
|
-
}, {
|
|
922
|
-
key: "renderItem",
|
|
923
|
-
value: function renderItem( /* error, disabled, defaultValue */
|
|
924
|
-
) {
|
|
925
|
-
var _this13 = this;
|
|
926
|
-
var _this$props2 = this.props,
|
|
927
|
-
classes = _this$props2.classes,
|
|
928
|
-
schema = _this$props2.schema;
|
|
929
|
-
var visibleValue = this.state.visibleValue;
|
|
930
|
-
if (!this.state.value) {
|
|
931
|
-
return null;
|
|
932
|
-
}
|
|
933
|
-
visibleValue = visibleValue || this.state.value.map(function (_, i) {
|
|
934
|
-
return i;
|
|
935
|
-
});
|
|
936
|
-
var doAnyFilterSet = this.isAnyFilterSet();
|
|
937
|
-
return /*#__PURE__*/_react["default"].createElement(_material.Paper, {
|
|
938
|
-
className: classes.paper
|
|
939
|
-
}, this.showImportDialog(), this.showTypeOfImportDialog(), schema.label ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
940
|
-
className: classes.label
|
|
941
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.Toolbar, {
|
|
942
|
-
variant: "dense",
|
|
943
|
-
className: classes.rootTool
|
|
944
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.Typography, {
|
|
945
|
-
className: classes.title,
|
|
946
|
-
variant: "h6",
|
|
947
|
-
id: "tableTitle",
|
|
948
|
-
component: "div"
|
|
949
|
-
}, this.getText(schema.label)))) : null, /*#__PURE__*/_react["default"].createElement(_material.TableContainer, null, /*#__PURE__*/_react["default"].createElement(_material.Table, {
|
|
950
|
-
className: classes.table,
|
|
951
|
-
size: "small"
|
|
952
|
-
}, this.enhancedTableHead(!doAnyFilterSet && !this.state.orderBy ? 120 : 64, doAnyFilterSet), /*#__PURE__*/_react["default"].createElement(_material.TableBody, null, visibleValue.map(function (idx, i) {
|
|
953
|
-
return /*#__PURE__*/_react["default"].createElement(_material.TableRow, {
|
|
954
|
-
hover: true,
|
|
955
|
-
key: "".concat(idx, "_").concat(i)
|
|
956
|
-
}, schema.items && schema.items.map(function (headCell) {
|
|
957
|
-
return /*#__PURE__*/_react["default"].createElement(_material.TableCell, {
|
|
958
|
-
key: "".concat(headCell.attr, "_").concat(idx),
|
|
959
|
-
align: "left"
|
|
960
|
-
}, _this13.itemTable(headCell.attr, _this13.state.value[idx], idx));
|
|
961
|
-
}), !schema.noDelete && /*#__PURE__*/_react["default"].createElement(_material.TableCell, {
|
|
962
|
-
align: "left",
|
|
963
|
-
className: classes.buttonCell
|
|
964
|
-
}, !doAnyFilterSet && !_this13.state.orderBy ? i ? /*#__PURE__*/_react["default"].createElement(_material.Tooltip, {
|
|
965
|
-
title: _i18n["default"].t('ra_Move up')
|
|
966
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
967
|
-
size: "small",
|
|
968
|
-
onClick: function onClick() {
|
|
969
|
-
return _this13.onMoveUp(idx);
|
|
970
|
-
}
|
|
971
|
-
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.ArrowUpward, null))) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
972
|
-
className: classes.buttonEmpty
|
|
973
|
-
}) : null, !doAnyFilterSet && !_this13.state.orderBy ? i < visibleValue.length - 1 ? /*#__PURE__*/_react["default"].createElement(_material.Tooltip, {
|
|
974
|
-
title: _i18n["default"].t('ra_Move down')
|
|
975
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
976
|
-
size: "small",
|
|
977
|
-
onClick: function onClick() {
|
|
978
|
-
return _this13.onMoveDown(idx);
|
|
979
|
-
}
|
|
980
|
-
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.ArrowDownward, null))) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
981
|
-
className: classes.buttonEmpty
|
|
982
|
-
}) : null, /*#__PURE__*/_react["default"].createElement(_material.Tooltip, {
|
|
983
|
-
title: _i18n["default"].t('ra_Delete current row')
|
|
984
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
985
|
-
size: "small",
|
|
986
|
-
onClick: _this13.onDelete(idx)
|
|
987
|
-
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Delete, null))), _this13.props.schema.clone ? /*#__PURE__*/_react["default"].createElement(_material.Tooltip, {
|
|
988
|
-
title: _i18n["default"].t('ra_Clone current row')
|
|
989
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
990
|
-
size: "small",
|
|
991
|
-
onClick: _this13.onClone(idx)
|
|
992
|
-
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.ContentCopy, null))) : null));
|
|
993
|
-
}), !schema.noDelete && visibleValue.length >= (schema.showSecondAddAt || 5) ? /*#__PURE__*/_react["default"].createElement(_material.TableRow, null, /*#__PURE__*/_react["default"].createElement(_material.TableCell, {
|
|
994
|
-
colSpan: schema.items.length + 1
|
|
995
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.Tooltip, {
|
|
996
|
-
title: doAnyFilterSet ? _i18n["default"].t('ra_Cannot add items with set filter') : _i18n["default"].t('ra_Add row')
|
|
997
|
-
}, /*#__PURE__*/_react["default"].createElement("span", null, /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
998
|
-
size: "small",
|
|
999
|
-
color: "primary",
|
|
1000
|
-
disabled: !!doAnyFilterSet && !this.props.schema.allowAddByFilter,
|
|
1001
|
-
onClick: this.onAdd
|
|
1002
|
-
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Add, null)))))) : null)), !visibleValue.length && this.state.value.length ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
1003
|
-
className: classes.filteredOut
|
|
1004
|
-
}, /*#__PURE__*/_react["default"].createElement(_material.Typography, {
|
|
1005
|
-
className: classes.title,
|
|
1006
|
-
variant: "h6",
|
|
1007
|
-
id: "tableTitle",
|
|
1008
|
-
component: "div"
|
|
1009
|
-
}, _i18n["default"].t('ra_All items are filtered out'), /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
1010
|
-
size: "small",
|
|
1011
|
-
onClick: function onClick() {
|
|
1012
|
-
return _this13.applyFilter(true);
|
|
1013
|
-
}
|
|
1014
|
-
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Close, null)))) : null), 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.state.errorMessage ? /*#__PURE__*/_react["default"].createElement("div", {
|
|
1015
|
-
style: {
|
|
1016
|
-
display: 'flex',
|
|
1017
|
-
padding: '5px'
|
|
1018
|
-
}
|
|
1019
|
-
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Warning, {
|
|
1020
|
-
color: "error"
|
|
1021
|
-
}), /*#__PURE__*/_react["default"].createElement("span", {
|
|
1022
|
-
style: {
|
|
1023
|
-
color: 'red',
|
|
1024
|
-
alignSelf: 'center'
|
|
1025
|
-
}
|
|
1026
|
-
}, this.state.errorMessage)) : null);
|
|
1027
|
-
}
|
|
1028
|
-
}], [{
|
|
1029
|
-
key: "descendingComparator",
|
|
1030
|
-
value: function descendingComparator(a, b, orderBy) {
|
|
1031
|
-
if (b[orderBy] < a[orderBy]) {
|
|
1032
|
-
return -1;
|
|
1033
|
-
}
|
|
1034
|
-
if (b[orderBy] > a[orderBy]) {
|
|
1035
|
-
return 1;
|
|
1036
|
-
}
|
|
1037
|
-
return 0;
|
|
1038
|
-
}
|
|
1039
|
-
}, {
|
|
1040
|
-
key: "getComparator",
|
|
1041
|
-
value: function getComparator(order, orderBy) {
|
|
1042
|
-
return order === 'desc' ? function (a, b) {
|
|
1043
|
-
return ConfigTable.descendingComparator(a, b, orderBy);
|
|
1044
|
-
} : function (a, b) {
|
|
1045
|
-
return -ConfigTable.descendingComparator(a, b, orderBy);
|
|
1046
|
-
};
|
|
1047
|
-
}
|
|
1048
|
-
}]);
|
|
1049
|
-
return ConfigTable;
|
|
1050
|
-
}(_ConfigGeneric2["default"]);
|
|
1051
|
-
ConfigTable.propTypes = {
|
|
1052
|
-
socket: _propTypes["default"].object.isRequired,
|
|
1053
|
-
changed: _propTypes["default"].bool,
|
|
1054
|
-
themeType: _propTypes["default"].string,
|
|
1055
|
-
themeName: _propTypes["default"].string,
|
|
1056
|
-
style: _propTypes["default"].object,
|
|
1057
|
-
className: _propTypes["default"].string,
|
|
1058
|
-
data: _propTypes["default"].object.isRequired,
|
|
1059
|
-
schema: _propTypes["default"].object,
|
|
1060
|
-
onError: _propTypes["default"].func,
|
|
1061
|
-
onChange: _propTypes["default"].func
|
|
1062
|
-
};
|
|
1063
|
-
var _default = exports["default"] = (0, _styles.withStyles)(styles)(ConfigTable);
|
|
1064
|
-
//# sourceMappingURL=ConfigTable.js.map
|