@iobroker/adapter-react-v5 4.6.7 → 4.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Components/JsonConfigComponent/ChipInput.js +1 -22
- package/Components/JsonConfigComponent/ChipInput.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCheckLicense.js +1 -1
- package/Components/JsonConfigComponent/ConfigCheckLicense.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigColor.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCoordinates.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigFileSelector.js +15 -29
- package/Components/JsonConfigComponent/ConfigFileSelector.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigFunc.js +5 -9
- package/Components/JsonConfigComponent/ConfigFunc.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigIP.js +3 -2
- package/Components/JsonConfigComponent/ConfigIP.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigImageUpload.js +4 -6
- package/Components/JsonConfigComponent/ConfigImageUpload.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigInstanceSelect.d.ts +1 -1
- package/Components/JsonConfigComponent/ConfigInstanceSelect.js +45 -18
- package/Components/JsonConfigComponent/ConfigInstanceSelect.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigLanguage.js +5 -9
- package/Components/JsonConfigComponent/ConfigLanguage.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigObjectId.js +2 -4
- package/Components/JsonConfigComponent/ConfigObjectId.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPanel.js +13 -15
- package/Components/JsonConfigComponent/ConfigPanel.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPassword.js +10 -13
- package/Components/JsonConfigComponent/ConfigPassword.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigPattern.js +3 -4
- package/Components/JsonConfigComponent/ConfigPattern.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigRoom.js +5 -9
- package/Components/JsonConfigComponent/ConfigRoom.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSelectSendTo.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigSendto.js +0 -26
- package/Components/JsonConfigComponent/ConfigSendto.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigStaticText.js +0 -33
- package/Components/JsonConfigComponent/ConfigStaticText.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTable.js +149 -79
- package/Components/JsonConfigComponent/ConfigTable.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigTabs.js +2 -0
- package/Components/JsonConfigComponent/ConfigTabs.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigUUID.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigUser.js +3 -2
- package/Components/JsonConfigComponent/ConfigUser.js.map +1 -1
- package/Components/ObjectBrowser.d.ts +24 -1
- package/Components/ObjectBrowser.js +223 -94
- package/Components/ObjectBrowser.js.map +1 -1
- package/README.md +3 -0
- package/package.json +6 -6
|
@@ -30,6 +30,9 @@ var _ConfigGeneric2 = _interopRequireDefault(require("./ConfigGeneric"));
|
|
|
30
30
|
var _ConfigPanel = _interopRequireDefault(require("./ConfigPanel"));
|
|
31
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
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; }
|
|
33
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); }; }
|
|
34
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
|
|
35
38
|
var MAX_SIZE = 1024 * 1024; // 1MB
|
|
@@ -375,10 +378,16 @@ var ConfigTable = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
375
378
|
});
|
|
376
379
|
return _this;
|
|
377
380
|
}
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* React lifecycle hook, called once component is mounted
|
|
384
|
+
* @return {Promise<void>}
|
|
385
|
+
*/
|
|
378
386
|
(0, _createClass2["default"])(ConfigTable, [{
|
|
379
387
|
key: "componentDidMount",
|
|
380
388
|
value: function () {
|
|
381
389
|
var _componentDidMount = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
|
|
390
|
+
var _this2 = this;
|
|
382
391
|
var value;
|
|
383
392
|
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
384
393
|
while (1) switch (_context.prev = _context.next) {
|
|
@@ -398,6 +407,8 @@ var ConfigTable = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
398
407
|
order: 'asc',
|
|
399
408
|
iteration: 0,
|
|
400
409
|
filterOn: []
|
|
410
|
+
}, function () {
|
|
411
|
+
return _this2.validateUniqueProps();
|
|
401
412
|
});
|
|
402
413
|
case 5:
|
|
403
414
|
case "end":
|
|
@@ -420,7 +431,7 @@ var ConfigTable = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
420
431
|
}, {
|
|
421
432
|
key: "itemTable",
|
|
422
433
|
value: function itemTable(attrItem, data, idx) {
|
|
423
|
-
var
|
|
434
|
+
var _this3 = this;
|
|
424
435
|
var value = this.state.value;
|
|
425
436
|
var schema = this.props.schema;
|
|
426
437
|
var schemaForAttribute = schema.items && schema.items.find(function (el) {
|
|
@@ -454,21 +465,68 @@ var ConfigTable = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
454
465
|
onChange: function onChange(attr, valueChange) {
|
|
455
466
|
var newObj = JSON.parse(JSON.stringify(value));
|
|
456
467
|
newObj[idx][attr] = valueChange;
|
|
457
|
-
|
|
468
|
+
_this3.setState({
|
|
458
469
|
value: newObj
|
|
459
470
|
}, function () {
|
|
460
|
-
|
|
471
|
+
_this3.validateUniqueProps();
|
|
472
|
+
_this3.onChangeWrapper(newObj, true);
|
|
461
473
|
});
|
|
462
474
|
},
|
|
463
475
|
onError: function onError(error, attr) {
|
|
464
|
-
return
|
|
476
|
+
return _this3.onError(error, attr);
|
|
465
477
|
}
|
|
466
478
|
});
|
|
467
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
|
+
}
|
|
468
526
|
}, {
|
|
469
527
|
key: "enhancedTableHead",
|
|
470
528
|
value: function enhancedTableHead(buttonsWidth, doAnyFilterSet) {
|
|
471
|
-
var
|
|
529
|
+
var _this5 = this;
|
|
472
530
|
var _this$props = this.props,
|
|
473
531
|
schema = _this$props.schema,
|
|
474
532
|
classes = _this$props.classes;
|
|
@@ -476,7 +534,7 @@ var ConfigTable = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
476
534
|
order = _this$state2.order,
|
|
477
535
|
orderBy = _this$state2.orderBy;
|
|
478
536
|
return /*#__PURE__*/_react["default"].createElement(_material.TableHead, null, /*#__PURE__*/_react["default"].createElement(_material.TableRow, null, schema.items && schema.items.map(function (headCell, i) {
|
|
479
|
-
var
|
|
537
|
+
var _this5$filterRefs$hea;
|
|
480
538
|
return /*#__PURE__*/_react["default"].createElement(_material.TableCell, {
|
|
481
539
|
style: {
|
|
482
540
|
width: typeof headCell.width === 'string' && headCell.width.endsWith('%') ? headCell.width : headCell.width
|
|
@@ -494,58 +552,58 @@ var ConfigTable = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
494
552
|
}, /*#__PURE__*/_react["default"].createElement("span", null, /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
495
553
|
size: "small",
|
|
496
554
|
color: "primary",
|
|
497
|
-
disabled: !!doAnyFilterSet && !
|
|
498
|
-
onClick:
|
|
555
|
+
disabled: !!doAnyFilterSet && !_this5.props.schema.allowAddByFilter,
|
|
556
|
+
onClick: _this5.onAdd
|
|
499
557
|
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Add, null)))) : null, headCell.sort && /*#__PURE__*/_react["default"].createElement(_material.TableSortLabel, {
|
|
500
558
|
active: true,
|
|
501
559
|
className: _Utils["default"].clsx(orderBy !== headCell.attr && classes.silver),
|
|
502
560
|
direction: orderBy === headCell.attr ? order : 'asc',
|
|
503
561
|
onClick: function onClick() {
|
|
504
|
-
return
|
|
562
|
+
return _this5.handleRequestSort(headCell.attr);
|
|
505
563
|
}
|
|
506
|
-
}), headCell.filter &&
|
|
564
|
+
}), headCell.filter && _this5.state.filterOn.includes(headCell.attr) ? /*#__PURE__*/_react["default"].createElement(_material.TextField, {
|
|
507
565
|
variant: "standard",
|
|
508
|
-
ref:
|
|
566
|
+
ref: _this5.filterRefs[headCell.attr],
|
|
509
567
|
onChange: function onChange() {
|
|
510
|
-
return
|
|
568
|
+
return _this5.applyFilter();
|
|
511
569
|
},
|
|
512
570
|
title: _i18n["default"].t('ra_You can filter entries by entering here some text'),
|
|
513
571
|
InputProps: {
|
|
514
|
-
endAdornment: ((
|
|
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, {
|
|
515
573
|
position: "end"
|
|
516
574
|
}, /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
517
575
|
size: "small",
|
|
518
576
|
onClick: function onClick() {
|
|
519
|
-
|
|
520
|
-
|
|
577
|
+
_this5.filterRefs[headCell.attr].current.children[0].children[0].value = '';
|
|
578
|
+
_this5.applyFilter();
|
|
521
579
|
}
|
|
522
580
|
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Close, null)))
|
|
523
581
|
},
|
|
524
582
|
fullWidth: true,
|
|
525
|
-
placeholder:
|
|
583
|
+
placeholder: _this5.getText(headCell.title)
|
|
526
584
|
}) : /*#__PURE__*/_react["default"].createElement("span", {
|
|
527
|
-
className:
|
|
528
|
-
},
|
|
585
|
+
className: _this5.props.classes.headerText
|
|
586
|
+
}, _this5.getText(headCell.title)), headCell.filter ? /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
529
587
|
title: _i18n["default"].t('ra_Show/hide filter input'),
|
|
530
588
|
size: "small",
|
|
531
589
|
onClick: function onClick() {
|
|
532
|
-
var filterOn = (0, _toConsumableArray2["default"])(
|
|
533
|
-
var pos =
|
|
590
|
+
var filterOn = (0, _toConsumableArray2["default"])(_this5.state.filterOn);
|
|
591
|
+
var pos = _this5.state.filterOn.indexOf(headCell.attr);
|
|
534
592
|
if (pos === -1) {
|
|
535
593
|
filterOn.push(headCell.attr);
|
|
536
594
|
} else {
|
|
537
595
|
filterOn.splice(pos, 1);
|
|
538
596
|
}
|
|
539
|
-
|
|
597
|
+
_this5.setState({
|
|
540
598
|
filterOn: filterOn
|
|
541
599
|
}, function () {
|
|
542
|
-
if (pos &&
|
|
543
|
-
|
|
544
|
-
|
|
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();
|
|
545
603
|
}
|
|
546
604
|
});
|
|
547
605
|
}
|
|
548
|
-
},
|
|
606
|
+
}, _this5.state.filterOn.includes(headCell.attr) ? /*#__PURE__*/_react["default"].createElement(_iconsMaterial.FilterAltOff, null) : /*#__PURE__*/_react["default"].createElement(_iconsMaterial.FilterAlt, null)) : null));
|
|
549
607
|
}), !schema.noDelete && /*#__PURE__*/_react["default"].createElement(_material.TableCell, {
|
|
550
608
|
style: {
|
|
551
609
|
paddingLeft: 20,
|
|
@@ -560,7 +618,7 @@ var ConfigTable = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
560
618
|
},
|
|
561
619
|
size: "small",
|
|
562
620
|
onClick: function onClick() {
|
|
563
|
-
return
|
|
621
|
+
return _this5.setState({
|
|
564
622
|
showImportDialog: true
|
|
565
623
|
});
|
|
566
624
|
},
|
|
@@ -571,7 +629,7 @@ var ConfigTable = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
571
629
|
},
|
|
572
630
|
size: "small",
|
|
573
631
|
onClick: function onClick() {
|
|
574
|
-
return
|
|
632
|
+
return _this5.onExport();
|
|
575
633
|
},
|
|
576
634
|
title: _i18n["default"].t('ra_Export data to %s file', 'CSV')
|
|
577
635
|
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Download, null)) : null, /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
@@ -611,7 +669,7 @@ var ConfigTable = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
611
669
|
}, {
|
|
612
670
|
key: "onImport",
|
|
613
671
|
value: function onImport(text) {
|
|
614
|
-
var
|
|
672
|
+
var _this6 = this;
|
|
615
673
|
var lines = text.split('\n').map(function (line) {
|
|
616
674
|
return line.replace('\r', '').trim();
|
|
617
675
|
});
|
|
@@ -626,7 +684,7 @@ var ConfigTable = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
626
684
|
lines.forEach(function (line) {
|
|
627
685
|
var parts = line.split(';');
|
|
628
686
|
var obj = {};
|
|
629
|
-
var
|
|
687
|
+
var _loop2 = function _loop2(_p) {
|
|
630
688
|
var value = parts[_p];
|
|
631
689
|
if (value.startsWith('"')) {
|
|
632
690
|
value = value.substring(1);
|
|
@@ -641,7 +699,7 @@ var ConfigTable = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
641
699
|
parts[_p] = false;
|
|
642
700
|
// eslint-disable-next-line no-restricted-properties
|
|
643
701
|
} else if (window.isFinite(parts[_p])) {
|
|
644
|
-
var attr =
|
|
702
|
+
var attr = _this6.props.schema.items.find(function (it) {
|
|
645
703
|
return it.attr === header[_p];
|
|
646
704
|
});
|
|
647
705
|
if (attr && attr.type === 'number') {
|
|
@@ -653,7 +711,7 @@ var ConfigTable = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
653
711
|
p = _p;
|
|
654
712
|
};
|
|
655
713
|
for (var p = 0; p < parts.length; p++) {
|
|
656
|
-
|
|
714
|
+
_loop2(p);
|
|
657
715
|
}
|
|
658
716
|
values.push(obj);
|
|
659
717
|
});
|
|
@@ -677,16 +735,16 @@ var ConfigTable = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
677
735
|
}, {
|
|
678
736
|
key: "isAnyFilterSet",
|
|
679
737
|
value: function isAnyFilterSet() {
|
|
680
|
-
var
|
|
738
|
+
var _this7 = this;
|
|
681
739
|
return Object.keys(this.filterRefs).find(function (attr) {
|
|
682
|
-
var
|
|
683
|
-
return (
|
|
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;
|
|
684
742
|
});
|
|
685
743
|
}
|
|
686
744
|
}, {
|
|
687
745
|
key: "onMoveUp",
|
|
688
746
|
value: function onMoveUp(idx) {
|
|
689
|
-
var
|
|
747
|
+
var _this8 = this;
|
|
690
748
|
var newValue = JSON.parse(JSON.stringify(this.state.value));
|
|
691
749
|
var item = newValue[idx];
|
|
692
750
|
newValue.splice(idx, 1);
|
|
@@ -695,15 +753,15 @@ var ConfigTable = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
695
753
|
value: newValue,
|
|
696
754
|
iteration: this.state.iteration + 10000
|
|
697
755
|
}, function () {
|
|
698
|
-
return
|
|
699
|
-
return
|
|
756
|
+
return _this8.applyFilter(false, null, function () {
|
|
757
|
+
return _this8.onChangeWrapper(newValue);
|
|
700
758
|
});
|
|
701
759
|
});
|
|
702
760
|
}
|
|
703
761
|
}, {
|
|
704
762
|
key: "onMoveDown",
|
|
705
763
|
value: function onMoveDown(idx) {
|
|
706
|
-
var
|
|
764
|
+
var _this9 = this;
|
|
707
765
|
var newValue = JSON.parse(JSON.stringify(this.state.value));
|
|
708
766
|
var item = newValue[idx];
|
|
709
767
|
newValue.splice(idx, 1);
|
|
@@ -712,15 +770,15 @@ var ConfigTable = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
712
770
|
value: newValue,
|
|
713
771
|
iteration: this.state.iteration + 10000
|
|
714
772
|
}, function () {
|
|
715
|
-
return
|
|
716
|
-
return
|
|
773
|
+
return _this9.applyFilter(false, null, function () {
|
|
774
|
+
return _this9.onChangeWrapper(newValue);
|
|
717
775
|
});
|
|
718
776
|
});
|
|
719
777
|
}
|
|
720
778
|
}, {
|
|
721
779
|
key: "onDrop",
|
|
722
780
|
value: function onDrop(acceptedFiles) {
|
|
723
|
-
var
|
|
781
|
+
var _this10 = this;
|
|
724
782
|
var file = acceptedFiles[0];
|
|
725
783
|
var reader = new FileReader();
|
|
726
784
|
reader.onabort = function () {
|
|
@@ -737,21 +795,21 @@ var ConfigTable = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
737
795
|
var text = new Uint8Array(reader.result).reduce(function (data, _byte) {
|
|
738
796
|
return data + String.fromCharCode(_byte);
|
|
739
797
|
}, '');
|
|
740
|
-
|
|
798
|
+
_this10.onImport(text);
|
|
741
799
|
};
|
|
742
800
|
reader.readAsArrayBuffer(file);
|
|
743
801
|
}
|
|
744
802
|
}, {
|
|
745
803
|
key: "showTypeOfImportDialog",
|
|
746
804
|
value: function showTypeOfImportDialog() {
|
|
747
|
-
var
|
|
805
|
+
var _this11 = this;
|
|
748
806
|
if (!this.state.showTypeOfImportDialog) {
|
|
749
807
|
return null;
|
|
750
808
|
}
|
|
751
809
|
return /*#__PURE__*/_react["default"].createElement(_material.Dialog, {
|
|
752
810
|
open: !0,
|
|
753
811
|
onClose: function onClose() {
|
|
754
|
-
return
|
|
812
|
+
return _this11.setState({
|
|
755
813
|
showTypeOfImportDialog: false
|
|
756
814
|
});
|
|
757
815
|
},
|
|
@@ -761,17 +819,17 @@ var ConfigTable = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
761
819
|
color: "primary",
|
|
762
820
|
autoFocus: true,
|
|
763
821
|
onClick: function onClick() {
|
|
764
|
-
var value = JSON.parse(JSON.stringify(
|
|
765
|
-
|
|
822
|
+
var value = JSON.parse(JSON.stringify(_this11.state.value));
|
|
823
|
+
_this11.state.showTypeOfImportDialog.forEach(function (obj) {
|
|
766
824
|
return value.push(obj);
|
|
767
825
|
});
|
|
768
|
-
|
|
826
|
+
_this11.setState({
|
|
769
827
|
value: value,
|
|
770
|
-
iteration:
|
|
828
|
+
iteration: _this11.state.iteration + 10000,
|
|
771
829
|
showTypeOfImportDialog: false
|
|
772
830
|
}, function () {
|
|
773
|
-
return
|
|
774
|
-
return
|
|
831
|
+
return _this11.applyFilter(false, null, function () {
|
|
832
|
+
return _this11.onChangeWrapper(value);
|
|
775
833
|
});
|
|
776
834
|
});
|
|
777
835
|
}
|
|
@@ -780,14 +838,14 @@ var ConfigTable = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
780
838
|
color: "secondary",
|
|
781
839
|
autoFocus: true,
|
|
782
840
|
onClick: function onClick() {
|
|
783
|
-
var value =
|
|
784
|
-
|
|
841
|
+
var value = _this11.state.showTypeOfImportDialog;
|
|
842
|
+
_this11.setState({
|
|
785
843
|
value: value,
|
|
786
|
-
iteration:
|
|
844
|
+
iteration: _this11.state.iteration + 10000,
|
|
787
845
|
showTypeOfImportDialog: false
|
|
788
846
|
}, function () {
|
|
789
|
-
return
|
|
790
|
-
return
|
|
847
|
+
return _this11.applyFilter(false, null, function () {
|
|
848
|
+
return _this11.onChangeWrapper(value);
|
|
791
849
|
});
|
|
792
850
|
});
|
|
793
851
|
}
|
|
@@ -796,14 +854,14 @@ var ConfigTable = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
796
854
|
}, {
|
|
797
855
|
key: "showImportDialog",
|
|
798
856
|
value: function showImportDialog() {
|
|
799
|
-
var
|
|
857
|
+
var _this12 = this;
|
|
800
858
|
if (!this.state.showImportDialog) {
|
|
801
859
|
return null;
|
|
802
860
|
}
|
|
803
861
|
return /*#__PURE__*/_react["default"].createElement(_material.Dialog, {
|
|
804
862
|
open: !0,
|
|
805
863
|
onClose: function onClose() {
|
|
806
|
-
return
|
|
864
|
+
return _this12.setState({
|
|
807
865
|
showImportDialog: false
|
|
808
866
|
});
|
|
809
867
|
},
|
|
@@ -816,43 +874,43 @@ var ConfigTable = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
816
874
|
},
|
|
817
875
|
maxSize: MAX_SIZE,
|
|
818
876
|
onDragEnter: function onDragEnter() {
|
|
819
|
-
return
|
|
877
|
+
return _this12.setState({
|
|
820
878
|
uploadFile: 'dragging'
|
|
821
879
|
});
|
|
822
880
|
},
|
|
823
881
|
onDragLeave: function onDragLeave() {
|
|
824
|
-
return
|
|
882
|
+
return _this12.setState({
|
|
825
883
|
uploadFile: true
|
|
826
884
|
});
|
|
827
885
|
},
|
|
828
886
|
onDrop: function onDrop(acceptedFiles, errors) {
|
|
829
|
-
|
|
887
|
+
_this12.setState({
|
|
830
888
|
uploadFile: false
|
|
831
889
|
});
|
|
832
890
|
if (!acceptedFiles.length) {
|
|
833
891
|
window.alert(errors && errors[0] && errors[0].errors && errors[0].errors[0] && errors[0].errors[0].message || _i18n["default"].t('ra_Cannot upload'));
|
|
834
892
|
} else {
|
|
835
|
-
|
|
893
|
+
_this12.onDrop(acceptedFiles);
|
|
836
894
|
}
|
|
837
895
|
}
|
|
838
896
|
}, function (_ref) {
|
|
839
897
|
var getRootProps = _ref.getRootProps,
|
|
840
898
|
getInputProps = _ref.getInputProps;
|
|
841
899
|
return /*#__PURE__*/_react["default"].createElement("div", (0, _extends2["default"])({
|
|
842
|
-
className: _Utils["default"].clsx(
|
|
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)
|
|
843
901
|
}, getRootProps()), /*#__PURE__*/_react["default"].createElement("input", getInputProps()), /*#__PURE__*/_react["default"].createElement("div", {
|
|
844
|
-
className: _Utils["default"].clsx(
|
|
902
|
+
className: _Utils["default"].clsx(_this12.props.classes.uploadCenterDiv)
|
|
845
903
|
}, /*#__PURE__*/_react["default"].createElement("div", {
|
|
846
|
-
className:
|
|
904
|
+
className: _this12.props.classes.uploadCenterTextAndIcon
|
|
847
905
|
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.UploadFile, {
|
|
848
|
-
className:
|
|
906
|
+
className: _this12.props.classes.uploadCenterIcon
|
|
849
907
|
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
850
|
-
className:
|
|
851
|
-
},
|
|
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')))));
|
|
852
910
|
})), /*#__PURE__*/_react["default"].createElement(_material.DialogActions, null, /*#__PURE__*/_react["default"].createElement(_material.Button, {
|
|
853
911
|
variant: "contained",
|
|
854
912
|
onClick: function onClick() {
|
|
855
|
-
return
|
|
913
|
+
return _this12.setState({
|
|
856
914
|
showImportDialog: false
|
|
857
915
|
});
|
|
858
916
|
},
|
|
@@ -864,7 +922,7 @@ var ConfigTable = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
864
922
|
key: "renderItem",
|
|
865
923
|
value: function renderItem( /* error, disabled, defaultValue */
|
|
866
924
|
) {
|
|
867
|
-
var
|
|
925
|
+
var _this13 = this;
|
|
868
926
|
var _this$props2 = this.props,
|
|
869
927
|
classes = _this$props2.classes,
|
|
870
928
|
schema = _this$props2.schema;
|
|
@@ -899,25 +957,25 @@ var ConfigTable = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
899
957
|
return /*#__PURE__*/_react["default"].createElement(_material.TableCell, {
|
|
900
958
|
key: "".concat(headCell.attr, "_").concat(idx),
|
|
901
959
|
align: "left"
|
|
902
|
-
},
|
|
960
|
+
}, _this13.itemTable(headCell.attr, _this13.state.value[idx], idx));
|
|
903
961
|
}), !schema.noDelete && /*#__PURE__*/_react["default"].createElement(_material.TableCell, {
|
|
904
962
|
align: "left",
|
|
905
963
|
className: classes.buttonCell
|
|
906
|
-
}, !doAnyFilterSet && !
|
|
964
|
+
}, !doAnyFilterSet && !_this13.state.orderBy ? i ? /*#__PURE__*/_react["default"].createElement(_material.Tooltip, {
|
|
907
965
|
title: _i18n["default"].t('ra_Move up')
|
|
908
966
|
}, /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
909
967
|
size: "small",
|
|
910
968
|
onClick: function onClick() {
|
|
911
|
-
return
|
|
969
|
+
return _this13.onMoveUp(idx);
|
|
912
970
|
}
|
|
913
971
|
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.ArrowUpward, null))) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
914
972
|
className: classes.buttonEmpty
|
|
915
|
-
}) : null, !doAnyFilterSet && !
|
|
973
|
+
}) : null, !doAnyFilterSet && !_this13.state.orderBy ? i < visibleValue.length - 1 ? /*#__PURE__*/_react["default"].createElement(_material.Tooltip, {
|
|
916
974
|
title: _i18n["default"].t('ra_Move down')
|
|
917
975
|
}, /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
918
976
|
size: "small",
|
|
919
977
|
onClick: function onClick() {
|
|
920
|
-
return
|
|
978
|
+
return _this13.onMoveDown(idx);
|
|
921
979
|
}
|
|
922
980
|
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.ArrowDownward, null))) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
923
981
|
className: classes.buttonEmpty
|
|
@@ -925,12 +983,12 @@ var ConfigTable = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
925
983
|
title: _i18n["default"].t('ra_Delete current row')
|
|
926
984
|
}, /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
927
985
|
size: "small",
|
|
928
|
-
onClick:
|
|
929
|
-
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Delete, null))),
|
|
986
|
+
onClick: _this13.onDelete(idx)
|
|
987
|
+
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.Delete, null))), _this13.props.schema.clone ? /*#__PURE__*/_react["default"].createElement(_material.Tooltip, {
|
|
930
988
|
title: _i18n["default"].t('ra_Clone current row')
|
|
931
989
|
}, /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
932
990
|
size: "small",
|
|
933
|
-
onClick:
|
|
991
|
+
onClick: _this13.onClone(idx)
|
|
934
992
|
}, /*#__PURE__*/_react["default"].createElement(_iconsMaterial.ContentCopy, null))) : null));
|
|
935
993
|
}), !schema.noDelete && visibleValue.length >= (schema.showSecondAddAt || 5) ? /*#__PURE__*/_react["default"].createElement(_material.TableRow, null, /*#__PURE__*/_react["default"].createElement(_material.TableCell, {
|
|
936
994
|
colSpan: schema.items.length + 1
|
|
@@ -951,9 +1009,21 @@ var ConfigTable = /*#__PURE__*/function (_ConfigGeneric) {
|
|
|
951
1009
|
}, _i18n["default"].t('ra_All items are filtered out'), /*#__PURE__*/_react["default"].createElement(_material.IconButton, {
|
|
952
1010
|
size: "small",
|
|
953
1011
|
onClick: function onClick() {
|
|
954
|
-
return
|
|
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'
|
|
955
1025
|
}
|
|
956
|
-
},
|
|
1026
|
+
}, this.state.errorMessage)) : null);
|
|
957
1027
|
}
|
|
958
1028
|
}], [{
|
|
959
1029
|
key: "descendingComparator",
|