@iobroker/adapter-react-v5 4.9.1 → 4.9.3

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.
@@ -1,119 +1,92 @@
1
1
  "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports["default"] = void 0;
8
- var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
9
- var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
10
- var _react = _interopRequireDefault(require("react"));
11
- var _copyToClipboard = _interopRequireDefault(require("./copy-to-clipboard"));
12
- /**
13
- * Copyright 2018-2023 Denis Haev (bluefox) <dogafox@gmail.com>
14
- *
15
- * MIT License
16
- *
17
- **/
18
- var MDUtils = /*#__PURE__*/function () {
19
- function MDUtils() {
20
- (0, _classCallCheck2["default"])(this, MDUtils);
21
- }
22
- (0, _createClass2["default"])(MDUtils, null, [{
23
- key: "text2link",
24
- value: function text2link(text) {
25
- var m = text.match(/\d+\.\)\s/);
26
- if (m) {
27
- text = text.replace(m[0], m[0].replace(/\s/, '&nbsp;'));
28
- }
29
- return text.replace(/[^a-zA-Zа-яА-Я0-9]/g, '').trim().replace(/\s/g, '').toLowerCase();
30
- }
31
- }, {
32
- key: "openLink",
33
- value: function openLink(url, target) {
34
- if (target === 'this') {
35
- window.location = url;
36
- } else {
37
- window.open(url, target || '_blank');
38
- }
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const CopyToClipboard_1 = __importDefault(require("./CopyToClipboard"));
7
+ class MDUtils {
8
+ static text2link(text) {
9
+ const m = text.match(/\d+\.\)\s/);
10
+ if (m) {
11
+ text = text.replace(m[0], m[0].replace(/\s/, '&nbsp;'));
12
+ }
13
+ return text.replace(/[^a-zA-Zа-яА-Я0-9]/g, '').trim().replace(/\s/g, '').toLowerCase();
39
14
  }
40
- }, {
41
- key: "getTitle",
42
- value: function getTitle(text) {
43
- var result = MDUtils.extractHeader(text);
44
- var body = result.body;
45
- var header = result.header;
46
- if (!header.title) {
47
- // remove {docsify-bla}
48
- body = body.replace(/{[^}]*}/g, '');
49
- body = body.trim();
50
- var lines = body.replace(/\r/g, '').split('\n');
51
- for (var i = 0; i < lines.length; i++) {
52
- if (lines[i].startsWith('# ')) {
53
- return lines[i].substring(2).trim();
54
- }
15
+ static openLink(url, target) {
16
+ if (target === 'this') {
17
+ window.location.href = url;
18
+ }
19
+ else {
20
+ window.open(url, target || '_blank');
55
21
  }
56
- return '';
57
- }
58
- return header.title;
59
22
  }
60
- }, {
61
- key: "extractHeader",
62
- value: function extractHeader(text) {
63
- var attrs = {};
64
- if (text.substring(0, 3) === '---') {
65
- var pos = text.substring(3).indexOf('\n---');
66
- if (pos !== -1) {
67
- var _header = text.substring(3, pos + 3);
68
- var lines = _header.replace(/\r/g, '').split('\n');
69
- lines.forEach(function (line) {
70
- if (!line.trim()) {
71
- return;
23
+ static getTitle(text) {
24
+ const result = MDUtils.extractHeader(text);
25
+ let body = result.body;
26
+ const header = result.header;
27
+ if (!header.title) {
28
+ // remove {docsify-bla}
29
+ body = body.replace(/{[^}]*}/g, '');
30
+ body = body.trim();
31
+ const lines = body.replace(/\r/g, '').split('\n');
32
+ for (let i = 0; i < lines.length; i++) {
33
+ if (lines[i].startsWith('# ')) {
34
+ return lines[i].substring(2).trim();
35
+ }
72
36
  }
73
- var _pos = line.indexOf(':');
74
- if (_pos !== -1) {
75
- var attr = line.substring(0, _pos).trim();
76
- attrs[attr] = line.substring(_pos + 1).trim();
77
- attrs[attr] = attrs[attr].replace(/^['"]|['"]$/g, '');
78
- if (attrs[attr] === 'true') {
79
- attrs[attr] = true;
80
- } else if (attrs[attr] === 'false') {
81
- attrs[attr] = false;
82
- } else if (parseFloat(attrs[attr]).toString() === attrs[attr]) {
83
- attrs[attr] = parseFloat(attrs[attr]);
84
- }
85
- } else {
86
- attrs[line.trim()] = true;
37
+ return '';
38
+ }
39
+ return header.title;
40
+ }
41
+ static extractHeader(text) {
42
+ const attrs = {};
43
+ if (text.substring(0, 3) === '---') {
44
+ const pos = text.substring(3).indexOf('\n---');
45
+ if (pos !== -1) {
46
+ const _header = text.substring(3, pos + 3);
47
+ const lines = _header.replace(/\r/g, '').split('\n');
48
+ lines.forEach(line => {
49
+ if (!line.trim()) {
50
+ return;
51
+ }
52
+ const pos_ = line.indexOf(':');
53
+ if (pos_ !== -1) {
54
+ const attr = line.substring(0, pos_).trim();
55
+ let val = line.substring(pos_ + 1).trim();
56
+ val = val.replace(/^['"]|['"]$/g, '');
57
+ if (val === 'true') {
58
+ attrs[attr] = true;
59
+ }
60
+ else if (val === 'false') {
61
+ attrs[attr] = false;
62
+ }
63
+ else if (parseFloat(val).toString() === val) {
64
+ attrs[attr] = parseFloat(val);
65
+ }
66
+ else {
67
+ attrs[attr] = val;
68
+ }
69
+ }
70
+ else {
71
+ attrs[line.trim()] = true;
72
+ }
73
+ });
74
+ text = text.substring(pos + 7);
87
75
  }
88
- });
89
- text = text.substring(pos + 7);
90
76
  }
91
- }
92
- return {
93
- header: attrs,
94
- body: text
95
- };
77
+ return { header: attrs, body: text };
96
78
  }
97
- }, {
98
- key: "removeDocsify",
99
- value: function removeDocsify(text) {
100
- var m = text.match(/{docsify-[^}]*}/g);
101
- if (m) {
102
- m.forEach(function (doc) {
103
- return text = text.replace(doc, '');
104
- });
105
- }
106
- return text;
79
+ static removeDocsify(text) {
80
+ const m = text.match(/{docsify-[^}]*}/g);
81
+ if (m) {
82
+ m.forEach(doc => text = text.replace(doc, ''));
83
+ }
84
+ return text;
107
85
  }
108
- }, {
109
- key: "onCopy",
110
- value: function onCopy(e, text) {
111
- (0, _copyToClipboard["default"])(text);
112
- e && e.stopPropagation();
113
- e && e.preventDefault();
86
+ static onCopy(e, text) {
87
+ (0, CopyToClipboard_1.default)(text);
88
+ e && e.stopPropagation();
89
+ e && e.preventDefault();
114
90
  }
115
- }]);
116
- return MDUtils;
117
- }();
118
- var _default = exports["default"] = MDUtils;
119
- //# sourceMappingURL=MDUtils.js.map
91
+ }
92
+ exports.default = MDUtils;
@@ -436,7 +436,7 @@ declare class ObjectBrowser extends React.Component<import("./types").ObjectBrow
436
436
  * @param {string} text
437
437
  */
438
438
  private onCopy;
439
- renderTooltipAccessControl: (acl: any) => React.JSX.Element | "";
439
+ renderTooltipAccessControl: (acl: any) => "" | React.JSX.Element;
440
440
  /**
441
441
  * @param {string} id
442
442
  * @param {{ data: { obj: { type: string; }; hasCustoms: any; }; }} item
@@ -11,7 +11,7 @@ declare const _default: React.JSXElementConstructor<Omit<PropTypes.InferProps<{
11
11
  moreClasses: PropTypes.Requireable<object>;
12
12
  icon: PropTypes.Requireable<string>;
13
13
  color: PropTypes.Requireable<string>;
14
- }>, "classes"> & import("@mui/styles").StyledComponentProps<"text" | "icon" | "div"> & object>;
14
+ }>, "classes"> & import("@mui/styles").StyledComponentProps<"div" | "text" | "icon"> & object>;
15
15
  export default _default;
16
16
  import PropTypes from 'prop-types';
17
17
  import React from 'react';