@iobroker/adapter-react-v5 3.0.10 → 3.0.13
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/FileBrowser.js +16 -5
- package/Components/FileBrowser.js.map +1 -1
- package/Components/FileViewer.js +21 -11
- package/Components/FileViewer.js.map +1 -1
- package/Components/IconSelector.js +1822 -6
- package/Components/IconSelector.js.map +1 -1
- package/Components/Image.js +19 -13
- package/Components/Image.js.map +1 -1
- package/Components/JsonConfigComponent/ConfigCustom.js +15 -4
- package/Components/JsonConfigComponent/ConfigCustom.js.map +1 -1
- package/Components/Loader.js +16 -12
- package/Components/Loader.js.map +1 -1
- package/Components/Loaders/PT.js +14 -5
- package/Components/Loaders/PT.js.map +1 -1
- package/Components/Loaders/Vendor.js +11 -2
- package/Components/Loaders/Vendor.js.map +1 -1
- package/Components/UploadImage.js +11 -2
- package/Components/UploadImage.js.map +1 -1
- package/GenericApp.js +12 -3
- package/GenericApp.js.map +1 -1
- package/README.md +1 -1
- package/icons/IconNoIcon.js +47 -0
- package/icons/IconNoIcon.js.map +1 -0
- package/index.js +115 -1121
- package/package.json +1 -1
- package/index.js.map +0 -1
package/Components/Loader.js
CHANGED
|
@@ -21,17 +21,12 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
21
21
|
|
|
22
22
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
23
23
|
|
|
24
|
-
var _withStyles = _interopRequireDefault(require("@mui/styles/withStyles"));
|
|
25
|
-
|
|
26
|
-
require("./loader.css");
|
|
27
|
-
|
|
28
24
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
29
25
|
|
|
30
26
|
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; } }
|
|
31
27
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
};
|
|
28
|
+
// import './loader.css'
|
|
29
|
+
var loaderStyles = "\n/**\n * Copyright 2018-2022 bluefox <dogafox@gmail.com>\n *\n * MIT License\n *\n **/\n\n.logo-background-light, .logo-background-colored {\n background: white;\n}\n.logo-background-dark, .logo-background-blue {\n background: black;\n}\n.logo-div {\n position: absolute;\n top: 50%;\n left: 50%;\n -ms-transform: translateX(-50%) translateY(-50%);\n -webkit-transform: translate(-50%,-50%);\n transform: translate(-50%,-50%);\n overflow: hidden;\n border-radius: 50%;\n z-index: 2;\n}\n.logo-border {\n /*border-color: #164477;*/\n border-top-color: #3399CC;\n border-left-color: #164477;\n border-bottom-color: #164477;\n border-right-color: #164477;\n border-radius: 50%;\n border-style: solid;\n box-sizing: border-box;\n width: 100%;\n height: 100%;\n position: absolute;\n}\n.logo-top {\n position: absolute;\n width: 4.5%;\n height: 16%;\n top: 0;\n z-index: 2;\n}\n.logo-i {\n position: absolute;\n width: 14.5%;\n height: 60%;\n top: 20%;\n left: 42%;\n background: #3399CC;\n}\n.logo-i-top {\n position: absolute;\n width: 14.5%;\n height: 4%;\n left: 42%;\n background: #3399CC;\n border-radius: 100%;\n}\n.logo-back {\n width: 100%;\n height: 100%;\n z-index: 0;\n overflow: hidden;\n}\n@keyframes logo-grow {\n 0% {\n width: 230px;\n height: 230px;\n transform: translate(-50%,-50%) scale(1);\n opacity: 1\n }\n 99% {\n width: 230px;\n height: 230px;\n transform: translate(-50%,-50%) scale(10);\n opacity: 0;\n }\n 100% {\n width: 0;\n height: 0;\n opacity: 0;\n }\n}\n@keyframes logo-spin { 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); } }\n@keyframes logo-color-inside-light {\n 0% {\n background: #FEFEFE;\n }\n 100% {\n background: #3399CC;\n }\n}\n@keyframes logo-color-inside-dark {\n 0% {\n background: #030303;\n }\n 100% {\n background: #3399CC;\n }\n}\n@keyframes logo-color-inside-colored {\n 0% {\n background: #FEFEFE;\n }\n 100% {\n background: #3399CC;\n }\n}\n@keyframes logo-color-inside-blue {\n 0% {\n background: #030303;\n }\n 100% {\n background: #3399CC;\n }\n}\n\n@keyframes logo-color-outside-light {\n 0% {\n border-color: #FEFEFE;\n }\n 100% {\n border-top-color: #3399CC;\n border-left-color: #164477;\n border-bottom-color: #164477;\n border-right-color: #164477;\n }\n}\n@keyframes logo-color-outside-dark {\n 0% {\n border-color: #040404;\n }\n 100% {\n border-top-color: #3399CC;\n border-left-color: #164477;\n border-bottom-color: #164477;\n border-right-color: #164477;\n }\n}\n@keyframes logo-color-outside-colored {\n 0% {\n border-color: #FEFEFE;\n }\n 100% {\n border-top-color: #3399CC;\n border-left-color: #164477;\n border-bottom-color: #164477;\n border-right-color: #164477;\n }\n}\n@keyframes logo-color-outside-blue {\n 0% {\n border-color: #040404;\n }\n 100% {\n border-top-color: #3399CC;\n border-left-color: #164477;\n border-bottom-color: #164477;\n border-right-color: #164477;\n }\n}\n\n.logo-animate-wait {\n animation: logo-color-outside 1.5s, logo-spin 1.5s linear infinite;\n}\n\n.logo-animate-grow-light {\n background: #DDD;\n}\n.logo-animate-grow-dark {\n background: #1d1d1d;\n}\n.logo-animate-grow-colored {\n background: #DDD;\n}\n.logo-animate-grow-blue {\n background: #1d1d1d;\n}\n\n.logo-animate-grow {\n display: inline-block;\n text-align: center;\n z-index: 1;\n top: 50%;\n left: 50%;\n -ms-transform: translateX(-50%) translateY(-50%);\n -webkit-transform: translate(-50%,-50%);\n transform: translate(-50%,-50%);\n width: 245px;\n height: 245px;\n border-radius: 50%;\n position: absolute;\n animation: logo-grow 1s 1 ease forwards;\n}\n\n.logo-animate-color-inside-light {\n animation: logo-color-inside-light 2.5s;\n}\n.logo-animate-color-inside-dark {\n animation: logo-color-inside-dark 2.5s;\n}\n.logo-animate-color-inside-colored {\n animation: logo-color-inside-colored 2.5s;\n}\n.logo-animate-color-inside-blue {\n animation: logo-color-inside-blue 2.5s;\n}\n\n.logo-animate-color-outside-light {\n animation: logo-color-outside-light 1.5s;\n}\n.logo-animate-color-outside-dark {\n animation: logo-color-outside-dark 1.5s;\n}\n.logo-animate-color-outside-colored {\n animation: logo-color-outside-colored 1.5s;\n}\n.logo-animate-color-outside-blue {\n animation: logo-color-outside-blue 1.5s;\n}\n";
|
|
35
30
|
/**
|
|
36
31
|
* @typedef {object} LoaderProps
|
|
37
32
|
* @property {string} [key] The key to identify this component.
|
|
@@ -42,15 +37,25 @@ var styles = function styles(theme) {
|
|
|
42
37
|
* @extends {React.Component<LoaderProps>}
|
|
43
38
|
*/
|
|
44
39
|
|
|
45
|
-
|
|
46
40
|
var Loader = /*#__PURE__*/function (_React$Component) {
|
|
47
41
|
(0, _inherits2["default"])(Loader, _React$Component);
|
|
48
42
|
|
|
49
43
|
var _super = _createSuper(Loader);
|
|
50
44
|
|
|
51
|
-
function Loader() {
|
|
45
|
+
function Loader(props) {
|
|
46
|
+
var _this;
|
|
47
|
+
|
|
52
48
|
(0, _classCallCheck2["default"])(this, Loader);
|
|
53
|
-
|
|
49
|
+
_this = _super.call(this, props);
|
|
50
|
+
|
|
51
|
+
if (!window.document.getElementById('loader-iobroker-component')) {
|
|
52
|
+
var style = window.document.createElement('style');
|
|
53
|
+
style.setAttribute('id', 'loader-iobroker-component');
|
|
54
|
+
style.innerHTML = loaderStyles;
|
|
55
|
+
window.document.head.appendChild(style);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return _this;
|
|
54
59
|
}
|
|
55
60
|
|
|
56
61
|
(0, _createClass2["default"])(Loader, [{
|
|
@@ -111,8 +116,7 @@ Loader.propTypes = {
|
|
|
111
116
|
};
|
|
112
117
|
/** @type {typeof Loader} */
|
|
113
118
|
|
|
114
|
-
var _export =
|
|
115
|
-
|
|
119
|
+
var _export = Loader;
|
|
116
120
|
var _default = _export;
|
|
117
121
|
exports["default"] = _default;
|
|
118
122
|
//# sourceMappingURL=Loader.js.map
|
package/Components/Loader.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Loader.js","names":["
|
|
1
|
+
{"version":3,"file":"Loader.js","names":["loaderStyles","Loader","props","window","document","getElementById","style","createElement","setAttribute","innerHTML","head","appendChild","size","theme","themeType","width","height","left","borderWidth","top","bottom","React","Component","propTypes","PropTypes","number","string","_export"],"sources":["Loader.js"],"sourcesContent":["/**\n * Copyright 2018-2022 bluefox <dogafox@gmail.com>\n *\n * MIT License\n *\n **/\nimport React from 'react';\nimport PropTypes from 'prop-types';\n// import './loader.css'\nconst loaderStyles = `\n/**\n * Copyright 2018-2022 bluefox <dogafox@gmail.com>\n *\n * MIT License\n *\n **/\n\n.logo-background-light, .logo-background-colored {\n background: white;\n}\n.logo-background-dark, .logo-background-blue {\n background: black;\n}\n.logo-div {\n position: absolute;\n top: 50%;\n left: 50%;\n -ms-transform: translateX(-50%) translateY(-50%);\n -webkit-transform: translate(-50%,-50%);\n transform: translate(-50%,-50%);\n overflow: hidden;\n border-radius: 50%;\n z-index: 2;\n}\n.logo-border {\n /*border-color: #164477;*/\n border-top-color: #3399CC;\n border-left-color: #164477;\n border-bottom-color: #164477;\n border-right-color: #164477;\n border-radius: 50%;\n border-style: solid;\n box-sizing: border-box;\n width: 100%;\n height: 100%;\n position: absolute;\n}\n.logo-top {\n position: absolute;\n width: 4.5%;\n height: 16%;\n top: 0;\n z-index: 2;\n}\n.logo-i {\n position: absolute;\n width: 14.5%;\n height: 60%;\n top: 20%;\n left: 42%;\n background: #3399CC;\n}\n.logo-i-top {\n position: absolute;\n width: 14.5%;\n height: 4%;\n left: 42%;\n background: #3399CC;\n border-radius: 100%;\n}\n.logo-back {\n width: 100%;\n height: 100%;\n z-index: 0;\n overflow: hidden;\n}\n@keyframes logo-grow {\n 0% {\n width: 230px;\n height: 230px;\n transform: translate(-50%,-50%) scale(1);\n opacity: 1\n }\n 99% {\n width: 230px;\n height: 230px;\n transform: translate(-50%,-50%) scale(10);\n opacity: 0;\n }\n 100% {\n width: 0;\n height: 0;\n opacity: 0;\n }\n}\n@keyframes logo-spin { 100% { -webkit-transform: rotate(360deg); transform: rotate(360deg); } }\n@keyframes logo-color-inside-light {\n 0% {\n background: #FEFEFE;\n }\n 100% {\n background: #3399CC;\n }\n}\n@keyframes logo-color-inside-dark {\n 0% {\n background: #030303;\n }\n 100% {\n background: #3399CC;\n }\n}\n@keyframes logo-color-inside-colored {\n 0% {\n background: #FEFEFE;\n }\n 100% {\n background: #3399CC;\n }\n}\n@keyframes logo-color-inside-blue {\n 0% {\n background: #030303;\n }\n 100% {\n background: #3399CC;\n }\n}\n\n@keyframes logo-color-outside-light {\n 0% {\n border-color: #FEFEFE;\n }\n 100% {\n border-top-color: #3399CC;\n border-left-color: #164477;\n border-bottom-color: #164477;\n border-right-color: #164477;\n }\n}\n@keyframes logo-color-outside-dark {\n 0% {\n border-color: #040404;\n }\n 100% {\n border-top-color: #3399CC;\n border-left-color: #164477;\n border-bottom-color: #164477;\n border-right-color: #164477;\n }\n}\n@keyframes logo-color-outside-colored {\n 0% {\n border-color: #FEFEFE;\n }\n 100% {\n border-top-color: #3399CC;\n border-left-color: #164477;\n border-bottom-color: #164477;\n border-right-color: #164477;\n }\n}\n@keyframes logo-color-outside-blue {\n 0% {\n border-color: #040404;\n }\n 100% {\n border-top-color: #3399CC;\n border-left-color: #164477;\n border-bottom-color: #164477;\n border-right-color: #164477;\n }\n}\n\n.logo-animate-wait {\n animation: logo-color-outside 1.5s, logo-spin 1.5s linear infinite;\n}\n\n.logo-animate-grow-light {\n background: #DDD;\n}\n.logo-animate-grow-dark {\n background: #1d1d1d;\n}\n.logo-animate-grow-colored {\n background: #DDD;\n}\n.logo-animate-grow-blue {\n background: #1d1d1d;\n}\n\n.logo-animate-grow {\n display: inline-block;\n text-align: center;\n z-index: 1;\n top: 50%;\n left: 50%;\n -ms-transform: translateX(-50%) translateY(-50%);\n -webkit-transform: translate(-50%,-50%);\n transform: translate(-50%,-50%);\n width: 245px;\n height: 245px;\n border-radius: 50%;\n position: absolute;\n animation: logo-grow 1s 1 ease forwards;\n}\n\n.logo-animate-color-inside-light {\n animation: logo-color-inside-light 2.5s;\n}\n.logo-animate-color-inside-dark {\n animation: logo-color-inside-dark 2.5s;\n}\n.logo-animate-color-inside-colored {\n animation: logo-color-inside-colored 2.5s;\n}\n.logo-animate-color-inside-blue {\n animation: logo-color-inside-blue 2.5s;\n}\n\n.logo-animate-color-outside-light {\n animation: logo-color-outside-light 1.5s;\n}\n.logo-animate-color-outside-dark {\n animation: logo-color-outside-dark 1.5s;\n}\n.logo-animate-color-outside-colored {\n animation: logo-color-outside-colored 1.5s;\n}\n.logo-animate-color-outside-blue {\n animation: logo-color-outside-blue 1.5s;\n}\n`;\n\n/**\n * @typedef {object} LoaderProps\n * @property {string} [key] The key to identify this component.\n * @property {number} [size] The size in pixels of this loader.\n * @property {string} [themeType] The chosen theme type.\n * @property {string} [theme] The chosen theme.\n *\n * @extends {React.Component<LoaderProps>}\n */\nclass Loader extends React.Component {\n constructor(props) {\n super(props);\n\n if (!window.document.getElementById('loader-iobroker-component')) {\n const style = window.document.createElement('style');\n style.setAttribute('id', 'loader-iobroker-component');\n style.innerHTML = loaderStyles;\n window.document.head.appendChild(style);\n }\n }\n\n render() {\n const size = this.props.size || 234;\n const theme = this.props.themeType || this.props.theme || 'light';\n return <div className={'logo-back logo-background-' + theme}>\n <div className=\"logo-div\" style={{width: size, height: size}}>\n <div className={'logo-top logo-background-' + theme} style={{left: '37%'}}/>\n <div className={'logo-top logo-background-' + theme} style={{left: '57%'}}/>\n <div\n className={'logo-border logo-background-' + theme + ' logo-animate-wait'}\n style={{borderWidth: size * 0.132}}\n />\n <div className={'logo-i logo-animate-color-inside-' + theme}/>\n <div className={'logo-i-top logo-animate-color-inside-' + theme} style={{top: '18%'}}/>\n <div className={'logo-i-top logo-animate-color-inside-' + theme} style={{bottom: '18%'}}/>\n </div>\n <div className={'logo-animate-grow logo-animate-grow-' + theme}\n style={{width: size + 11, height: size + 11}}\n />\n </div>;\n }\n}\n\nLoader.propTypes = {\n size: PropTypes.number,\n themeType: PropTypes.string\n};\n\n/** @type {typeof Loader} */\nconst _export = Loader;\nexport default _export;"],"mappings":";;;;;;;;;;;;;;;;;;;AAMA;;AACA;;;;;;AACA;AACA,IAAMA,YAAY,otJAAlB;AAiOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;IACMC,M;;;;;EACF,gBAAYC,KAAZ,EAAmB;IAAA;;IAAA;IACf,0BAAMA,KAAN;;IAEA,IAAI,CAACC,MAAM,CAACC,QAAP,CAAgBC,cAAhB,CAA+B,2BAA/B,CAAL,EAAkE;MAC9D,IAAMC,KAAK,GAAGH,MAAM,CAACC,QAAP,CAAgBG,aAAhB,CAA8B,OAA9B,CAAd;MACAD,KAAK,CAACE,YAAN,CAAmB,IAAnB,EAAyB,2BAAzB;MACAF,KAAK,CAACG,SAAN,GAAkBT,YAAlB;MACAG,MAAM,CAACC,QAAP,CAAgBM,IAAhB,CAAqBC,WAArB,CAAiCL,KAAjC;IACH;;IARc;EASlB;;;;WAED,kBAAS;MACL,IAAMM,IAAI,GAAG,KAAKV,KAAL,CAAWU,IAAX,IAAmB,GAAhC;MACA,IAAMC,KAAK,GAAG,KAAKX,KAAL,CAAWY,SAAX,IAAwB,KAAKZ,KAAL,CAAWW,KAAnC,IAA4C,OAA1D;MACA,oBAAO;QAAK,SAAS,EAAE,+BAA+BA;MAA/C,gBACH;QAAK,SAAS,EAAC,UAAf;QAA0B,KAAK,EAAE;UAACE,KAAK,EAAEH,IAAR;UAAcI,MAAM,EAAEJ;QAAtB;MAAjC,gBACI;QAAK,SAAS,EAAE,8BAA8BC,KAA9C;QAAqD,KAAK,EAAE;UAACI,IAAI,EAAE;QAAP;MAA5D,EADJ,eAEI;QAAK,SAAS,EAAE,8BAA8BJ,KAA9C;QAAqD,KAAK,EAAE;UAACI,IAAI,EAAE;QAAP;MAA5D,EAFJ,eAGI;QACI,SAAS,EAAE,iCAAiCJ,KAAjC,GAAyC,oBADxD;QAEI,KAAK,EAAE;UAACK,WAAW,EAAEN,IAAI,GAAG;QAArB;MAFX,EAHJ,eAOI;QAAK,SAAS,EAAE,sCAAsCC;MAAtD,EAPJ,eAQI;QAAK,SAAS,EAAE,0CAA0CA,KAA1D;QAAiE,KAAK,EAAE;UAACM,GAAG,EAAE;QAAN;MAAxE,EARJ,eASI;QAAK,SAAS,EAAE,0CAA0CN,KAA1D;QAAiE,KAAK,EAAE;UAACO,MAAM,EAAE;QAAT;MAAxE,EATJ,CADG,eAYH;QAAK,SAAS,EAAE,yCAAyCP,KAAzD;QACK,KAAK,EAAE;UAACE,KAAK,EAAEH,IAAI,GAAG,EAAf;UAAmBI,MAAM,EAAEJ,IAAI,GAAG;QAAlC;MADZ,EAZG,CAAP;IAgBH;;;EA/BgBS,iBAAA,CAAMC,S;;AAkC3BrB,MAAM,CAACsB,SAAP,GAAmB;EACfX,IAAI,EAAEY,qBAAA,CAAUC,MADD;EAEfX,SAAS,EAAEU,qBAAA,CAAUE;AAFN,CAAnB;AAKA;;AACA,IAAMC,OAAO,GAAG1B,MAAhB;eACe0B,O"}
|
package/Components/Loaders/PT.js
CHANGED
|
@@ -21,28 +21,29 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
21
21
|
|
|
22
22
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
23
23
|
|
|
24
|
-
require("./PT.css");
|
|
25
|
-
|
|
26
24
|
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); }; }
|
|
27
25
|
|
|
28
26
|
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; } }
|
|
29
27
|
|
|
28
|
+
// import './PT.css'
|
|
29
|
+
var ptStyles = "\n.logo-background-light, .logo-background-colored {\n background: white;\n}\n.logo-background-dark, .logo-background-blue {\n background: black;\n}\n.pt-logo-div {\n position: absolute;\n top: 50%;\n left: 50%;\n -ms-transform: translateX(-50%) translateY(-50%);\n -webkit-transform: translate(-50%,-50%);\n transform: translate(-50%,-50%);\n z-index: 2;\n}\n.pt-logo-border {\n border-style: solid;\n box-sizing: border-box;\n width: 100%;\n height: 100%;\n position: absolute;\n}\n.pt-loader-block {\n height: 65px;\n width: 74px;\n border-radius: 15px;\n position: absolute;\n box-sizing: content-box;\n}\n.pt-loader-blue {\n border: 9px solid #0F99DE;\n transform: rotate(5grad);\n left: 93px;\n top: 0;\n animation: spin-blue 5s ease-in-out infinite;\n}\n.pt-loader-green {\n border: 9px solid #88A536;\n transform: rotate(-6grad);\n left: 70px;\n top: 58px;\n animation: spin-green 5s ease-in-out infinite;\n}\n.pt-loader-red {\n border: 9px solid #BD1B24;\n transform: rotate(-15grad);\n left: 24px;\n top: 100px;\n animation: spin-red 5s ease-in-out infinite;\n}\n\n@keyframes spin-blue {\n 0% {\n transform: rotate(5deg);\n }\n 25% {\n transform: rotate(185deg);\n }\n 50% {\n transform: rotate(185deg);\n }\n 75% {\n transform: rotate(185deg);\n }\n 100% {\n transform: rotate(185deg);\n }\n}\n@keyframes spin-green {\n 0% {\n transform: rotate(-6deg);\n }\n 25% {\n transform: rotate(-6deg);\n }\n 50% {\n transform: rotate(174deg);\n }\n 75% {\n transform: rotate(174deg);\n }\n 100% {\n transform: rotate(-6deg);\n }\n}\n@keyframes spin-red {\n 0% {\n transform: rotate(-15deg);\n }\n 25% {\n transform: rotate(-15deg);\n }\n 50% {\n transform: rotate(-15deg);\n }\n 75% {\n transform: rotate(165deg);\n }\n 100% {\n transform: rotate(165deg);\n }\n}\n";
|
|
30
30
|
/**
|
|
31
|
-
* @typedef {object}
|
|
31
|
+
* @typedef {object} LoaderPTProps
|
|
32
32
|
* @property {string} [key] The key to identify this component.
|
|
33
33
|
* @property {number} [size] The size in pixels of this loader.
|
|
34
34
|
* @property {string} [themeType] The chosen theme type.
|
|
35
35
|
* @property {string} [theme] The chosen theme.
|
|
36
36
|
*
|
|
37
|
-
* @extends {React.Component<
|
|
37
|
+
* @extends {React.Component<LoaderPTProps>}
|
|
38
38
|
*/
|
|
39
|
+
|
|
39
40
|
var LoaderPT = /*#__PURE__*/function (_React$Component) {
|
|
40
41
|
(0, _inherits2["default"])(LoaderPT, _React$Component);
|
|
41
42
|
|
|
42
43
|
var _super = _createSuper(LoaderPT);
|
|
43
44
|
|
|
44
45
|
/**
|
|
45
|
-
* @param {
|
|
46
|
+
* @param {LoaderPTProps} props
|
|
46
47
|
*/
|
|
47
48
|
function LoaderPT(props) {
|
|
48
49
|
var _this;
|
|
@@ -50,6 +51,14 @@ var LoaderPT = /*#__PURE__*/function (_React$Component) {
|
|
|
50
51
|
(0, _classCallCheck2["default"])(this, LoaderPT);
|
|
51
52
|
_this = _super.call(this, props);
|
|
52
53
|
_this.size = _this.props.size || 200;
|
|
54
|
+
|
|
55
|
+
if (!window.document.getElementById('pt-iobroker-component')) {
|
|
56
|
+
var style = window.document.createElement('style');
|
|
57
|
+
style.setAttribute('id', 'pt-iobroker-component');
|
|
58
|
+
style.innerHTML = ptStyles;
|
|
59
|
+
window.document.head.appendChild(style);
|
|
60
|
+
}
|
|
61
|
+
|
|
53
62
|
return _this;
|
|
54
63
|
}
|
|
55
64
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PT.js","names":["LoaderPT","props","size","theme","themeType","width","height","React","Component","propTypes","PropTypes","number","string","_export"],"sources":["Loaders/PT.js"],"sourcesContent":["/**\n * Copyright 2021-2022 ioBroker GmbH\n *\n * MIT License\n *\n **/\nimport React from 'react';\nimport PropTypes from 'prop-types';\
|
|
1
|
+
{"version":3,"file":"PT.js","names":["ptStyles","LoaderPT","props","size","window","document","getElementById","style","createElement","setAttribute","innerHTML","head","appendChild","theme","themeType","width","height","React","Component","propTypes","PropTypes","number","string","_export"],"sources":["Loaders/PT.js"],"sourcesContent":["/**\n * Copyright 2021-2022 ioBroker GmbH\n *\n * MIT License\n *\n **/\nimport React from 'react';\nimport PropTypes from 'prop-types';\n// import './PT.css'\nconst ptStyles = `\n.logo-background-light, .logo-background-colored {\n background: white;\n}\n.logo-background-dark, .logo-background-blue {\n background: black;\n}\n.pt-logo-div {\n position: absolute;\n top: 50%;\n left: 50%;\n -ms-transform: translateX(-50%) translateY(-50%);\n -webkit-transform: translate(-50%,-50%);\n transform: translate(-50%,-50%);\n z-index: 2;\n}\n.pt-logo-border {\n border-style: solid;\n box-sizing: border-box;\n width: 100%;\n height: 100%;\n position: absolute;\n}\n.pt-loader-block {\n height: 65px;\n width: 74px;\n border-radius: 15px;\n position: absolute;\n box-sizing: content-box;\n}\n.pt-loader-blue {\n border: 9px solid #0F99DE;\n transform: rotate(5grad);\n left: 93px;\n top: 0;\n animation: spin-blue 5s ease-in-out infinite;\n}\n.pt-loader-green {\n border: 9px solid #88A536;\n transform: rotate(-6grad);\n left: 70px;\n top: 58px;\n animation: spin-green 5s ease-in-out infinite;\n}\n.pt-loader-red {\n border: 9px solid #BD1B24;\n transform: rotate(-15grad);\n left: 24px;\n top: 100px;\n animation: spin-red 5s ease-in-out infinite;\n}\n\n@keyframes spin-blue {\n 0% {\n transform: rotate(5deg);\n }\n 25% {\n transform: rotate(185deg);\n }\n 50% {\n transform: rotate(185deg);\n }\n 75% {\n transform: rotate(185deg);\n }\n 100% {\n transform: rotate(185deg);\n }\n}\n@keyframes spin-green {\n 0% {\n transform: rotate(-6deg);\n }\n 25% {\n transform: rotate(-6deg);\n }\n 50% {\n transform: rotate(174deg);\n }\n 75% {\n transform: rotate(174deg);\n }\n 100% {\n transform: rotate(-6deg);\n }\n}\n@keyframes spin-red {\n 0% {\n transform: rotate(-15deg);\n }\n 25% {\n transform: rotate(-15deg);\n }\n 50% {\n transform: rotate(-15deg);\n }\n 75% {\n transform: rotate(165deg);\n }\n 100% {\n transform: rotate(165deg);\n }\n}\n`;\n\n/**\n * @typedef {object} LoaderPTProps\n * @property {string} [key] The key to identify this component.\n * @property {number} [size] The size in pixels of this loader.\n * @property {string} [themeType] The chosen theme type.\n * @property {string} [theme] The chosen theme.\n *\n * @extends {React.Component<LoaderPTProps>}\n */\nclass LoaderPT extends React.Component {\n /**\n * @param {LoaderPTProps} props\n */\n constructor(props) {\n super(props);\n this.size = this.props.size || 200;\n\n if (!window.document.getElementById('pt-iobroker-component')) {\n const style = window.document.createElement('style');\n style.setAttribute('id', 'pt-iobroker-component');\n style.innerHTML = ptStyles;\n window.document.head.appendChild(style);\n }\n }\n\n render() {\n const theme = this.props.themeType || this.props.theme || 'light';\n return <div className={'pt-logo-back logo-background-' + theme}>\n <div className=\"pt-logo-div\" style={{width: this.size, height: this.size}}>\n <div style={{width: 200, height: 200}}>\n <div className=\"pt-loader-blue pt-loader-block\"/>\n <div className=\"pt-loader-green pt-loader-block\"/>\n <div className=\"pt-loader-red pt-loader-block\"/>\n </div>\n </div>\n </div>;\n }\n}\n\nLoaderPT.propTypes = {\n size: PropTypes.number,\n themeType: PropTypes.string\n};\n\n/** @type {typeof LoaderPT} */\nconst _export = LoaderPT;\nexport default _export;"],"mappings":";;;;;;;;;;;;;;;;;;;AAMA;;AACA;;;;;;AACA;AACA,IAAMA,QAAQ,ohEAAd;AAyGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;IACMC,Q;;;;;EACF;AACJ;AACA;EACI,kBAAYC,KAAZ,EAAmB;IAA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var _CircularProgress = _interopRequireDefault(require("@mui/material/CircularProgress"));
|
|
25
25
|
|
|
26
|
-
require("./Vendor.css");
|
|
27
|
-
|
|
28
26
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
29
27
|
|
|
30
28
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
31
29
|
|
|
30
|
+
// import './Vendor.css'
|
|
31
|
+
var vendorStyles = "\n.logo-background-light, .logo-background-colored {\n background: white;\n}\n.logo-background-dark, .logo-background-blue {\n background: black;\n}\n";
|
|
32
32
|
/**
|
|
33
33
|
* @typedef {object} LoaderVendorProps
|
|
34
34
|
* @property {string} [key] The key to identify this component.
|
|
@@ -38,6 +38,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
38
38
|
*
|
|
39
39
|
* @extends {React.Component<LoaderVendorProps>}
|
|
40
40
|
*/
|
|
41
|
+
|
|
41
42
|
var LoaderVendor = /*#__PURE__*/function (_React$Component) {
|
|
42
43
|
(0, _inherits2["default"])(LoaderVendor, _React$Component);
|
|
43
44
|
|
|
@@ -52,6 +53,14 @@ var LoaderVendor = /*#__PURE__*/function (_React$Component) {
|
|
|
52
53
|
(0, _classCallCheck2["default"])(this, LoaderVendor);
|
|
53
54
|
_this = _super.call(this, props);
|
|
54
55
|
_this.size = _this.props.size || 200;
|
|
56
|
+
|
|
57
|
+
if (!window.document.getElementById('vendor-iobroker-component')) {
|
|
58
|
+
var style = window.document.createElement('style');
|
|
59
|
+
style.setAttribute('id', 'vendor-iobroker-component');
|
|
60
|
+
style.innerHTML = vendorStyles;
|
|
61
|
+
window.document.head.appendChild(style);
|
|
62
|
+
}
|
|
63
|
+
|
|
55
64
|
return _this;
|
|
56
65
|
}
|
|
57
66
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Vendor.js","names":["LoaderVendor","props","size","theme","themeType","display","flexDirection","height","width","margin","flexGrow","React","Component","propTypes","PropTypes","number","string","_export"],"sources":["Loaders/Vendor.js"],"sourcesContent":["/**\n * Copyright 2021-2022 ioBroker GmbH\n *\n * MIT License\n *\n **/\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport CircularProgress from '@mui/material/CircularProgress';\
|
|
1
|
+
{"version":3,"file":"Vendor.js","names":["vendorStyles","LoaderVendor","props","size","window","document","getElementById","style","createElement","setAttribute","innerHTML","head","appendChild","theme","themeType","display","flexDirection","height","width","margin","flexGrow","React","Component","propTypes","PropTypes","number","string","_export"],"sources":["Loaders/Vendor.js"],"sourcesContent":["/**\n * Copyright 2021-2022 ioBroker GmbH\n *\n * MIT License\n *\n **/\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport CircularProgress from '@mui/material/CircularProgress';\n// import './Vendor.css'\nconst vendorStyles = `\n.logo-background-light, .logo-background-colored {\n background: white;\n}\n.logo-background-dark, .logo-background-blue {\n background: black;\n}\n`;\n\n/**\n * @typedef {object} LoaderVendorProps\n * @property {string} [key] The key to identify this component.\n * @property {number} [size] The size in pixels of this loader.\n * @property {string} [themeType] The chosen theme type.\n * @property {string} [theme] The chosen theme.\n *\n * @extends {React.Component<LoaderVendorProps>}\n */\nclass LoaderVendor extends React.Component {\n /**\n * @param {LoaderVendorProps} props\n */\n constructor(props) {\n super(props);\n this.size = this.props.size || 200;\n\n if (!window.document.getElementById('vendor-iobroker-component')) {\n const style = window.document.createElement('style');\n style.setAttribute('id', 'vendor-iobroker-component');\n style.innerHTML = vendorStyles;\n window.document.head.appendChild(style);\n }\n }\n\n render() {\n const theme = this.props.themeType || this.props.theme || 'light';\n return <div className={'vendor-logo-back logo-background-' + theme} style={{\n display: 'flex',\n flexDirection: 'column',\n height: '100%',\n width: '10%',\n margin: 'auto'\n }}>\n <div style={{flexGrow: 1}}/>\n <CircularProgress color=\"secondary\" size={200} thickness={5}/>\n <div style={{flexGrow: 1}}/>\n </div>;\n }\n}\n\nLoaderVendor.propTypes = {\n size: PropTypes.number,\n themeType: PropTypes.string\n};\n\n/** @type {typeof LoaderVendor} */\nconst _export = LoaderVendor;\nexport default _export;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAMA;;AACA;;AACA;;;;;;AACA;AACA,IAAMA,YAAY,iKAAlB;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;IACMC,Y;;;;;EACF;AACJ;AACA;EACI,sBAAYC,KAAZ,EAAmB;IAAA;;IAAA;IACf,0BAAMA,KAAN;IACA,MAAKC,IAAL,GAAY,MAAKD,KAAL,CAAWC,IAAX,IAAmB,GAA/B;;IAEA,IAAI,CAACC,MAAM,CAACC,QAAP,CAAgBC,cAAhB,CAA+B,2BAA/B,CAAL,EAAkE;MAC9D,IAAMC,KAAK,GAAGH,MAAM,CAACC,QAAP,CAAgBG,aAAhB,CAA8B,OAA9B,CAAd;MACAD,KAAK,CAACE,YAAN,CAAmB,IAAnB,EAAyB,2BAAzB;MACAF,KAAK,CAACG,SAAN,GAAkBV,YAAlB;MACAI,MAAM,CAACC,QAAP,CAAgBM,IAAhB,CAAqBC,WAArB,CAAiCL,KAAjC;IACH;;IATc;EAUlB;;;;WAED,kBAAS;MACL,IAAMM,KAAK,GAAG,KAAKX,KAAL,CAAWY,SAAX,IAAwB,KAAKZ,KAAL,CAAWW,KAAnC,IAA4C,OAA1D;MACA,oBAAO;QAAK,SAAS,EAAE,sCAAsCA,KAAtD;QAA6D,KAAK,EAAE;UACvEE,OAAO,EAAE,MAD8D;UAEvEC,aAAa,EAAE,QAFwD;UAGvEC,MAAM,EAAE,MAH+D;UAIvEC,KAAK,EAAE,KAJgE;UAKvEC,MAAM,EAAE;QAL+D;MAApE,gBAOH;QAAK,KAAK,EAAE;UAACC,QAAQ,EAAE;QAAX;MAAZ,EAPG,eAQH,gCAAC,4BAAD;QAAkB,KAAK,EAAC,WAAxB;QAAoC,IAAI,EAAE,GAA1C;QAA+C,SAAS,EAAE;MAA1D,EARG,eASH;QAAK,KAAK,EAAE;UAACA,QAAQ,EAAE;QAAX;MAAZ,EATG,CAAP;IAWH;;;EA7BsBC,iBAAA,CAAMC,S;;AAgCjCrB,YAAY,CAACsB,SAAb,GAAyB;EACrBpB,IAAI,EAAEqB,qBAAA,CAAUC,MADK;EAErBX,SAAS,EAAEU,qBAAA,CAAUE;AAFA,CAAzB;AAKA;;AACA,IAAMC,OAAO,GAAG1B,YAAhB;eACe0B,O"}
|
|
@@ -29,8 +29,6 @@ var _reactDropzone = _interopRequireDefault(require("react-dropzone"));
|
|
|
29
29
|
|
|
30
30
|
var _reactCropper = require("react-cropper");
|
|
31
31
|
|
|
32
|
-
require("cropperjs/dist/cropper.css");
|
|
33
|
-
|
|
34
32
|
var _styles = require("@mui/styles");
|
|
35
33
|
|
|
36
34
|
var _material = require("@mui/material");
|
|
@@ -47,6 +45,9 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
47
45
|
|
|
48
46
|
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; } }
|
|
49
47
|
|
|
48
|
+
// import 'cropperjs/dist/cropper.css';
|
|
49
|
+
var cropperStyles = "\n/*!\n * Cropper.js v1.5.12\n * https://fengyuanchen.github.io/cropperjs\n *\n * Copyright 2015-present Chen Fengyuan\n * Released under the MIT license\n *\n * Date: 2021-06-12T08:00:11.623Z\n */\n\n.cropper-container {\n direction: ltr;\n font-size: 0;\n line-height: 0;\n position: relative;\n -ms-touch-action: none;\n touch-action: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.cropper-container img {\n display: block;\n height: 100%;\n image-orientation: 0deg;\n max-height: none !important;\n max-width: none !important;\n min-height: 0 !important;\n min-width: 0 !important;\n width: 100%;\n}\n\n.cropper-wrap-box,\n.cropper-canvas,\n.cropper-drag-box,\n.cropper-crop-box,\n.cropper-modal {\n bottom: 0;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n}\n\n.cropper-wrap-box,\n.cropper-canvas {\n overflow: hidden;\n}\n\n.cropper-drag-box {\n background-color: #fff;\n opacity: 0;\n}\n\n.cropper-modal {\n background-color: #000;\n opacity: 0.5;\n}\n\n.cropper-view-box {\n display: block;\n height: 100%;\n outline: 1px solid #39f;\n outline-color: rgba(51, 153, 255, 0.75);\n overflow: hidden;\n width: 100%;\n}\n\n.cropper-dashed {\n border: 0 dashed #eee;\n display: block;\n opacity: 0.5;\n position: absolute;\n}\n\n.cropper-dashed.dashed-h {\n border-bottom-width: 1px;\n border-top-width: 1px;\n height: calc(100% / 3);\n left: 0;\n top: calc(100% / 3);\n width: 100%;\n}\n\n.cropper-dashed.dashed-v {\n border-left-width: 1px;\n border-right-width: 1px;\n height: 100%;\n left: calc(100% / 3);\n top: 0;\n width: calc(100% / 3);\n}\n\n.cropper-center {\n display: block;\n height: 0;\n left: 50%;\n opacity: 0.75;\n position: absolute;\n top: 50%;\n width: 0;\n}\n\n.cropper-center::before,\n.cropper-center::after {\n background-color: #eee;\n content: ' ';\n display: block;\n position: absolute;\n}\n\n.cropper-center::before {\n height: 1px;\n left: -3px;\n top: 0;\n width: 7px;\n}\n\n.cropper-center::after {\n height: 7px;\n left: 0;\n top: -3px;\n width: 1px;\n}\n\n.cropper-face,\n.cropper-line,\n.cropper-point {\n display: block;\n height: 100%;\n opacity: 0.1;\n position: absolute;\n width: 100%;\n}\n\n.cropper-face {\n background-color: #fff;\n left: 0;\n top: 0;\n}\n\n.cropper-line {\n background-color: #39f;\n}\n\n.cropper-line.line-e {\n cursor: ew-resize;\n right: -3px;\n top: 0;\n width: 5px;\n}\n\n.cropper-line.line-n {\n cursor: ns-resize;\n height: 5px;\n left: 0;\n top: -3px;\n}\n\n.cropper-line.line-w {\n cursor: ew-resize;\n left: -3px;\n top: 0;\n width: 5px;\n}\n\n.cropper-line.line-s {\n bottom: -3px;\n cursor: ns-resize;\n height: 5px;\n left: 0;\n}\n\n.cropper-point {\n background-color: #39f;\n height: 5px;\n opacity: 0.75;\n width: 5px;\n}\n\n.cropper-point.point-e {\n cursor: ew-resize;\n margin-top: -3px;\n right: -3px;\n top: 50%;\n}\n\n.cropper-point.point-n {\n cursor: ns-resize;\n left: 50%;\n margin-left: -3px;\n top: -3px;\n}\n\n.cropper-point.point-w {\n cursor: ew-resize;\n left: -3px;\n margin-top: -3px;\n top: 50%;\n}\n\n.cropper-point.point-s {\n bottom: -3px;\n cursor: s-resize;\n left: 50%;\n margin-left: -3px;\n}\n\n.cropper-point.point-ne {\n cursor: nesw-resize;\n right: -3px;\n top: -3px;\n}\n\n.cropper-point.point-nw {\n cursor: nwse-resize;\n left: -3px;\n top: -3px;\n}\n\n.cropper-point.point-sw {\n bottom: -3px;\n cursor: nesw-resize;\n left: -3px;\n}\n\n.cropper-point.point-se {\n bottom: -3px;\n cursor: nwse-resize;\n height: 20px;\n opacity: 1;\n right: -3px;\n width: 20px;\n}\n\n@media (min-width: 768px) {\n .cropper-point.point-se {\n height: 15px;\n width: 15px;\n }\n}\n\n@media (min-width: 992px) {\n .cropper-point.point-se {\n height: 10px;\n width: 10px;\n }\n}\n\n@media (min-width: 1200px) {\n .cropper-point.point-se {\n height: 5px;\n opacity: 0.75;\n width: 5px;\n }\n}\n\n.cropper-point.point-se::before {\n background-color: #39f;\n bottom: -50%;\n content: ' ';\n display: block;\n height: 200%;\n opacity: 0;\n position: absolute;\n right: -50%;\n width: 200%;\n}\n\n.cropper-invisible {\n opacity: 0;\n}\n\n.cropper-bg {\n background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC');\n}\n\n.cropper-hide {\n display: block;\n height: 0;\n position: absolute;\n width: 0;\n}\n\n.cropper-hidden {\n display: none !important;\n}\n\n.cropper-move {\n cursor: move;\n}\n\n.cropper-crop {\n cursor: crosshair;\n}\n\n.cropper-disabled .cropper-drag-box,\n.cropper-disabled .cropper-face,\n.cropper-disabled .cropper-line,\n.cropper-disabled .cropper-point {\n cursor: not-allowed;\n}\n";
|
|
50
|
+
|
|
50
51
|
var styles = function styles(theme) {
|
|
51
52
|
return {
|
|
52
53
|
dropZone: {
|
|
@@ -141,6 +142,14 @@ var UploadImage = /*#__PURE__*/function (_Component) {
|
|
|
141
142
|
cropHandler: false
|
|
142
143
|
};
|
|
143
144
|
_this.cropperRef = /*#__PURE__*/(0, _react.createRef)();
|
|
145
|
+
|
|
146
|
+
if (!window.document.getElementById('cropper-style-json-component')) {
|
|
147
|
+
var style = window.document.createElement('style');
|
|
148
|
+
style.setAttribute('id', 'cropper-style-json-component');
|
|
149
|
+
style.innerHTML = cropperStyles;
|
|
150
|
+
window.document.head.appendChild(style);
|
|
151
|
+
}
|
|
152
|
+
|
|
144
153
|
return _this;
|
|
145
154
|
}
|
|
146
155
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UploadImage.js","names":["styles","theme","dropZone","width","height","position","dropZoneEmpty","image","objectFit","margin","display","uploadDiv","opacity","marginTop","cursor","outline","uploadDivDragging","background","uploadCenterDiv","border","borderRadius","uploadCenterIcon","paddingTop","uploadCenterText","fontSize","uploadCenterTextAndIcon","textAlign","top","bottom","left","right","flexDirection","alignItems","justifyContent","disabledOpacity","buttonRemoveWrapper","zIndex","buttonCropWrapper","error","UploadImage","props","state","uploadFile","anchorEl","cropHandler","cropperRef","createRef","acceptedFiles","maxSize","t","onChange","file","reader","FileReader","onabort","console","log","onerror","onload","ext","name","split","pop","toLowerCase","includes","size","window","alert","Math","round","base64","btoa","Uint8Array","result","reduce","data","byte","String","fromCharCode","readAsArrayBuffer","disabled","classes","icon","removeIconFunc","accept","crop","setState","errors","length","message","onDrop","getRootProps","getInputProps","clsx","e","stopPropagation","currentTarget","Boolean","imageElement","current","cropper","getCroppedCanvas","toDataURL","Component","defaultProps","el","propTypes","PropTypes","object","number","bool","func","string","withStyles"],"sources":["UploadImage.jsx"],"sourcesContent":["import { Component, createRef } from 'react';\nimport clsx from 'clsx';\nimport PropTypes from 'prop-types';\nimport Dropzone from 'react-dropzone';\nimport { Cropper } from 'react-cropper';\nimport 'cropperjs/dist/cropper.css';\n\nimport { withStyles } from '@mui/styles';\nimport { Menu, MenuItem, Tooltip } from '@mui/material';\nimport IconButton from '@mui/material/IconButton';\n\nimport IconClose from '@mui/icons-material/Close';\nimport CropIcon from '@mui/icons-material/Crop';\nimport { FaFileUpload as UploadIcon } from 'react-icons/fa';\n\nconst styles = theme => ({\n dropZone: {\n width: '100%',\n height: 100,\n position: 'relative',\n },\n dropZoneEmpty: {\n\n },\n image: {\n objectFit: 'contain',\n margin: 'auto',\n display: 'flex',\n width: '100%',\n height: '100%',\n },\n\n uploadDiv: {\n position: 'relative',\n width: '100%',\n height: 300,\n opacity: 0.9,\n marginTop: 30,\n cursor: 'pointer',\n outline: 'none'\n },\n uploadDivDragging: {\n opacity: 1,\n background: 'rgba(128,255,128,0.1)'\n },\n\n uploadCenterDiv: {\n margin: 5,\n border: '3px dashed grey',\n borderRadius: 5,\n width: 'calc(100% - 10px)',\n height: 'calc(100% - 10px)',\n position: 'relative',\n display: 'flex'\n },\n uploadCenterIcon: {\n paddingTop: 10,\n width: 48,\n height: 48,\n },\n uploadCenterText: {\n fontSize: 16,\n },\n uploadCenterTextAndIcon: {\n textAlign: 'center',\n position: 'absolute',\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center'\n\n },\n disabledOpacity: {\n opacity: 0.3,\n cursor: 'default'\n },\n buttonRemoveWrapper: {\n position: 'absolute',\n zIndex: 222,\n right: 0\n },\n buttonCropWrapper: {\n position: 'absolute',\n zIndex: 222,\n right: 0,\n top: 50\n },\n error: {\n border: '2px solid red'\n }\n});\n\nclass UploadImage extends Component {\n constructor(props) {\n super(props);\n this.state = {\n uploadFile: false,\n anchorEl: null,\n cropHandler: false,\n };\n this.cropperRef = createRef();\n }\n\n onDrop(acceptedFiles) {\n const { maxSize, t, onChange } = this.props;\n\n const file = acceptedFiles[0];\n const reader = new FileReader();\n\n reader.onabort = () => console.log('file reading was aborted');\n reader.onerror = () => console.log('file reading has failed');\n reader.onload = () => {\n let ext = 'image/' + file.name.split('.').pop().toLowerCase();\n if (ext === 'image/jpg') {\n ext = 'image/jpeg';\n } else if (ext.includes('svg')) {\n ext = 'image/svg+xml';\n }\n if (file.size > maxSize) {\n return window.alert(t('File is too big. Max %sk allowed. Try use SVG.', Math.round(maxSize / 1024)));\n }\n const base64 = `data:${ext};base64,${btoa(\n new Uint8Array(reader.result)\n .reduce((data, byte) => data + String.fromCharCode(byte), ''))}`;\n\n onChange(base64);\n };\n reader.readAsArrayBuffer(file);\n }\n\n render() {\n const { disabled, maxSize, classes, icon, t, removeIconFunc, accept, error, crop, onChange } = this.props;\n const { uploadFile, anchorEl, cropHandler } = this.state;\n return <Dropzone\n disabled={disabled || cropHandler}\n key=\"dropzone\"\n multiple={false}\n accept={accept}\n maxSize={maxSize}\n onDragEnter={() => this.setState({ uploadFile: 'dragging' })}\n onDragLeave={() => this.setState({ uploadFile: true })}\n onDrop={(acceptedFiles, errors) => {\n this.setState({ uploadFile: false });\n if (!acceptedFiles.length) {\n window.alert((errors && errors[0] && errors[0].errors && errors[0].errors[0] && errors[0].errors[0].message) || t('Cannot upload'));\n } else {\n return this.onDrop(acceptedFiles);\n }\n }}\n >\n {({ getRootProps, getInputProps }) => <div\n className={clsx(\n classes.uploadDiv,\n uploadFile === 'dragging' && classes.uploadDivDragging,\n classes.dropZone,\n disabled && classes.disabledOpacity,\n !icon && classes.dropZoneEmpty\n )}\n {...getRootProps()}>\n <input {...getInputProps()} />\n <div className={clsx(classes.uploadCenterDiv, error && classes.error)}>\n {!icon ? <div className={classes.uploadCenterTextAndIcon}>\n <UploadIcon className={classes.uploadCenterIcon} />\n <div className={classes.uploadCenterText}>{\n uploadFile === 'dragging' ? t('Drop file here') :\n t('Place your files here or click here to open the browse dialog')}</div>\n </div>\n :\n removeIconFunc && !cropHandler && <div className={classes.buttonRemoveWrapper}>\n <Tooltip title={t('Clear')}>\n <IconButton size=\"large\" onClick={e => {\n removeIconFunc && removeIconFunc();\n e.stopPropagation();\n }}><IconClose />\n </IconButton>\n </Tooltip>\n </div>\n }\n {icon && crop && <div className={classes.buttonCropWrapper}>\n <Tooltip title={t('Crop')}>\n <IconButton size=\"large\" onClick={e => {\n if (!cropHandler) {\n this.setState({ cropHandler: true });\n } else {\n this.setState({ anchorEl: e.currentTarget });\n }\n e.stopPropagation();\n }}><CropIcon color={cropHandler ? 'primary' : 'inherit'} />\n </IconButton>\n </Tooltip>\n <Menu\n id=\"simple-menu\"\n anchorEl={anchorEl}\n keepMounted\n open={Boolean(anchorEl)}\n onClose={() => this.setState({ anchorEl: null })}\n >\n <MenuItem onClick={() => this.setState({ anchorEl: null, cropHandler: false }, () => {\n const imageElement = this.cropperRef?.current?.cropper;\n onChange(imageElement.getCroppedCanvas().toDataURL());\n })}>{t('Save')}</MenuItem>\n <MenuItem onClick={() => this.setState({ anchorEl: null, cropHandler: false })}>{t('Close')}</MenuItem>\n </Menu>\n </div>}\n {icon && !cropHandler ? <img src={icon} className={classes.image} alt=\"icon\" /> : null}\n\n {icon && crop && cropHandler ? <Cropper\n ref={this.cropperRef}\n className={classes.image}\n src={icon}\n initialAspectRatio={1}\n viewMode={1}\n guides={false}\n minCropBoxHeight={10}\n minCropBoxWidth={10}\n background={false}\n checkOrientation={false}\n /> : null}\n </div>\n </div>}\n </Dropzone>;\n }\n}\n\nUploadImage.defaultProps = {\n disabled: false,\n maxSize: 10 * 1024,\n icon: null,\n removeIconFunc: null,\n accept: 'image/*',\n error: false,\n onChange: base64 => console.log(base64),\n t: el => el,\n crop: false,\n};\n\nUploadImage.propTypes = {\n classes: PropTypes.object,\n maxSize: PropTypes.number,\n disabled: PropTypes.bool,\n crop: PropTypes.bool,\n error: PropTypes.bool,\n onChange: PropTypes.func,\n accept: PropTypes.string,\n t: PropTypes.func,\n};\n\nexport default withStyles(styles)(UploadImage);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AAEA;;AACA;;AACA;;AAEA;;AACA;;AACA;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;EAAA,OAAK;IACrBC,QAAQ,EAAE;MACNC,KAAK,EAAE,MADD;MAENC,MAAM,EAAE,GAFF;MAGNC,QAAQ,EAAE;IAHJ,CADW;IAMrBC,aAAa,EAAE,EANM;IASrBC,KAAK,EAAE;MACHC,SAAS,EAAE,SADR;MAEHC,MAAM,EAAE,MAFL;MAGHC,OAAO,EAAE,MAHN;MAIHP,KAAK,EAAE,MAJJ;MAKHC,MAAM,EAAE;IALL,CATc;IAiBrBO,SAAS,EAAE;MACPN,QAAQ,EAAE,UADH;MAEPF,KAAK,EAAE,MAFA;MAGPC,MAAM,EAAE,GAHD;MAIPQ,OAAO,EAAE,GAJF;MAKPC,SAAS,EAAE,EALJ;MAMPC,MAAM,EAAE,SAND;MAOPC,OAAO,EAAE;IAPF,CAjBU;IA0BrBC,i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B,QAAQ,EAAE,KADa;EAEvBhC,OAAO,EAAE,KAAK,IAFS;EAGvBkC,IAAI,EAAE,IAHiB;EAIvBC,cAAc,EAAE,IAJO;EAKvBC,MAAM,EAAE,SALe;EAMvB9C,KAAK,EAAE,KANgB;EAOvBY,QAAQ,EAAE,kBAAAoB,MAAM;IAAA,OAAIf,OAAO,CAACC,GAAR,CAAYc,MAAZ,CAAJ;EAAA,CAPO;EAQvBrB,CAAC,EAAE,WAAAwD,EAAE;IAAA,OAAIA,EAAJ;EAAA,CARkB;EASvBpB,IAAI,EAAE;AATiB,CAA3B;AAYA9C,WAAW,CAACmE,SAAZ,GAAwB;EACpBzB,OAAO,EAAE0B,qBAAA,CAAUC,MADC;EAEpB5D,OAAO,EAAE2D,qBAAA,CAAUE,MAFC;EAGpB7B,QAAQ,EAAE2B,qBAAA,CAAUG,IAHA;EAIpBzB,IAAI,EAAEsB,qBAAA,CAAUG,IAJI;EAKpBxE,KAAK,EAAEqE,qBAAA,CAAUG,IALG;EAMpB5D,QAAQ,EAAEyD,qBAAA,CAAUI,IANA;EAOpB3B,MAAM,EAAEuB,qBAAA,CAAUK,MAPE;EAQpB/D,CAAC,EAAE0D,qBAAA,CAAUI;AARO,CAAxB;;eAWe,IAAAE,kBAAA,EAAWjH,MAAX,EAAmBuC,WAAnB,C"}
|
|
1
|
+
{"version":3,"file":"UploadImage.js","names":["cropperStyles","styles","theme","dropZone","width","height","position","dropZoneEmpty","image","objectFit","margin","display","uploadDiv","opacity","marginTop","cursor","outline","uploadDivDragging","background","uploadCenterDiv","border","borderRadius","uploadCenterIcon","paddingTop","uploadCenterText","fontSize","uploadCenterTextAndIcon","textAlign","top","bottom","left","right","flexDirection","alignItems","justifyContent","disabledOpacity","buttonRemoveWrapper","zIndex","buttonCropWrapper","error","UploadImage","props","state","uploadFile","anchorEl","cropHandler","cropperRef","createRef","window","document","getElementById","style","createElement","setAttribute","innerHTML","head","appendChild","acceptedFiles","maxSize","t","onChange","file","reader","FileReader","onabort","console","log","onerror","onload","ext","name","split","pop","toLowerCase","includes","size","alert","Math","round","base64","btoa","Uint8Array","result","reduce","data","byte","String","fromCharCode","readAsArrayBuffer","disabled","classes","icon","removeIconFunc","accept","crop","setState","errors","length","message","onDrop","getRootProps","getInputProps","clsx","e","stopPropagation","currentTarget","Boolean","imageElement","current","cropper","getCroppedCanvas","toDataURL","Component","defaultProps","el","propTypes","PropTypes","object","number","bool","func","string","withStyles"],"sources":["UploadImage.jsx"],"sourcesContent":["import { Component, createRef } from 'react';\nimport clsx from 'clsx';\nimport PropTypes from 'prop-types';\nimport Dropzone from 'react-dropzone';\nimport { Cropper } from 'react-cropper';\n\nimport { withStyles } from '@mui/styles';\nimport { Menu, MenuItem, Tooltip } from '@mui/material';\nimport IconButton from '@mui/material/IconButton';\n\nimport IconClose from '@mui/icons-material/Close';\nimport CropIcon from '@mui/icons-material/Crop';\nimport { FaFileUpload as UploadIcon } from 'react-icons/fa';\n\n// import 'cropperjs/dist/cropper.css';\nconst cropperStyles = `\n/*!\n * Cropper.js v1.5.12\n * https://fengyuanchen.github.io/cropperjs\n *\n * Copyright 2015-present Chen Fengyuan\n * Released under the MIT license\n *\n * Date: 2021-06-12T08:00:11.623Z\n */\n\n.cropper-container {\n direction: ltr;\n font-size: 0;\n line-height: 0;\n position: relative;\n -ms-touch-action: none;\n touch-action: none;\n -webkit-user-select: none;\n -moz-user-select: none;\n -ms-user-select: none;\n user-select: none;\n}\n\n.cropper-container img {\n display: block;\n height: 100%;\n image-orientation: 0deg;\n max-height: none !important;\n max-width: none !important;\n min-height: 0 !important;\n min-width: 0 !important;\n width: 100%;\n}\n\n.cropper-wrap-box,\n.cropper-canvas,\n.cropper-drag-box,\n.cropper-crop-box,\n.cropper-modal {\n bottom: 0;\n left: 0;\n position: absolute;\n right: 0;\n top: 0;\n}\n\n.cropper-wrap-box,\n.cropper-canvas {\n overflow: hidden;\n}\n\n.cropper-drag-box {\n background-color: #fff;\n opacity: 0;\n}\n\n.cropper-modal {\n background-color: #000;\n opacity: 0.5;\n}\n\n.cropper-view-box {\n display: block;\n height: 100%;\n outline: 1px solid #39f;\n outline-color: rgba(51, 153, 255, 0.75);\n overflow: hidden;\n width: 100%;\n}\n\n.cropper-dashed {\n border: 0 dashed #eee;\n display: block;\n opacity: 0.5;\n position: absolute;\n}\n\n.cropper-dashed.dashed-h {\n border-bottom-width: 1px;\n border-top-width: 1px;\n height: calc(100% / 3);\n left: 0;\n top: calc(100% / 3);\n width: 100%;\n}\n\n.cropper-dashed.dashed-v {\n border-left-width: 1px;\n border-right-width: 1px;\n height: 100%;\n left: calc(100% / 3);\n top: 0;\n width: calc(100% / 3);\n}\n\n.cropper-center {\n display: block;\n height: 0;\n left: 50%;\n opacity: 0.75;\n position: absolute;\n top: 50%;\n width: 0;\n}\n\n.cropper-center::before,\n.cropper-center::after {\n background-color: #eee;\n content: ' ';\n display: block;\n position: absolute;\n}\n\n.cropper-center::before {\n height: 1px;\n left: -3px;\n top: 0;\n width: 7px;\n}\n\n.cropper-center::after {\n height: 7px;\n left: 0;\n top: -3px;\n width: 1px;\n}\n\n.cropper-face,\n.cropper-line,\n.cropper-point {\n display: block;\n height: 100%;\n opacity: 0.1;\n position: absolute;\n width: 100%;\n}\n\n.cropper-face {\n background-color: #fff;\n left: 0;\n top: 0;\n}\n\n.cropper-line {\n background-color: #39f;\n}\n\n.cropper-line.line-e {\n cursor: ew-resize;\n right: -3px;\n top: 0;\n width: 5px;\n}\n\n.cropper-line.line-n {\n cursor: ns-resize;\n height: 5px;\n left: 0;\n top: -3px;\n}\n\n.cropper-line.line-w {\n cursor: ew-resize;\n left: -3px;\n top: 0;\n width: 5px;\n}\n\n.cropper-line.line-s {\n bottom: -3px;\n cursor: ns-resize;\n height: 5px;\n left: 0;\n}\n\n.cropper-point {\n background-color: #39f;\n height: 5px;\n opacity: 0.75;\n width: 5px;\n}\n\n.cropper-point.point-e {\n cursor: ew-resize;\n margin-top: -3px;\n right: -3px;\n top: 50%;\n}\n\n.cropper-point.point-n {\n cursor: ns-resize;\n left: 50%;\n margin-left: -3px;\n top: -3px;\n}\n\n.cropper-point.point-w {\n cursor: ew-resize;\n left: -3px;\n margin-top: -3px;\n top: 50%;\n}\n\n.cropper-point.point-s {\n bottom: -3px;\n cursor: s-resize;\n left: 50%;\n margin-left: -3px;\n}\n\n.cropper-point.point-ne {\n cursor: nesw-resize;\n right: -3px;\n top: -3px;\n}\n\n.cropper-point.point-nw {\n cursor: nwse-resize;\n left: -3px;\n top: -3px;\n}\n\n.cropper-point.point-sw {\n bottom: -3px;\n cursor: nesw-resize;\n left: -3px;\n}\n\n.cropper-point.point-se {\n bottom: -3px;\n cursor: nwse-resize;\n height: 20px;\n opacity: 1;\n right: -3px;\n width: 20px;\n}\n\n@media (min-width: 768px) {\n .cropper-point.point-se {\n height: 15px;\n width: 15px;\n }\n}\n\n@media (min-width: 992px) {\n .cropper-point.point-se {\n height: 10px;\n width: 10px;\n }\n}\n\n@media (min-width: 1200px) {\n .cropper-point.point-se {\n height: 5px;\n opacity: 0.75;\n width: 5px;\n }\n}\n\n.cropper-point.point-se::before {\n background-color: #39f;\n bottom: -50%;\n content: ' ';\n display: block;\n height: 200%;\n opacity: 0;\n position: absolute;\n right: -50%;\n width: 200%;\n}\n\n.cropper-invisible {\n opacity: 0;\n}\n\n.cropper-bg {\n background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAAA3NCSVQICAjb4U/gAAAABlBMVEXMzMz////TjRV2AAAACXBIWXMAAArrAAAK6wGCiw1aAAAAHHRFWHRTb2Z0d2FyZQBBZG9iZSBGaXJld29ya3MgQ1M26LyyjAAAABFJREFUCJlj+M/AgBVhF/0PAH6/D/HkDxOGAAAAAElFTkSuQmCC');\n}\n\n.cropper-hide {\n display: block;\n height: 0;\n position: absolute;\n width: 0;\n}\n\n.cropper-hidden {\n display: none !important;\n}\n\n.cropper-move {\n cursor: move;\n}\n\n.cropper-crop {\n cursor: crosshair;\n}\n\n.cropper-disabled .cropper-drag-box,\n.cropper-disabled .cropper-face,\n.cropper-disabled .cropper-line,\n.cropper-disabled .cropper-point {\n cursor: not-allowed;\n}\n`;\n\n\nconst styles = theme => ({\n dropZone: {\n width: '100%',\n height: 100,\n position: 'relative',\n },\n dropZoneEmpty: {\n\n },\n image: {\n objectFit: 'contain',\n margin: 'auto',\n display: 'flex',\n width: '100%',\n height: '100%',\n },\n\n uploadDiv: {\n position: 'relative',\n width: '100%',\n height: 300,\n opacity: 0.9,\n marginTop: 30,\n cursor: 'pointer',\n outline: 'none'\n },\n uploadDivDragging: {\n opacity: 1,\n background: 'rgba(128,255,128,0.1)'\n },\n\n uploadCenterDiv: {\n margin: 5,\n border: '3px dashed grey',\n borderRadius: 5,\n width: 'calc(100% - 10px)',\n height: 'calc(100% - 10px)',\n position: 'relative',\n display: 'flex'\n },\n uploadCenterIcon: {\n paddingTop: 10,\n width: 48,\n height: 48,\n },\n uploadCenterText: {\n fontSize: 16,\n },\n uploadCenterTextAndIcon: {\n textAlign: 'center',\n position: 'absolute',\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center'\n\n },\n disabledOpacity: {\n opacity: 0.3,\n cursor: 'default'\n },\n buttonRemoveWrapper: {\n position: 'absolute',\n zIndex: 222,\n right: 0\n },\n buttonCropWrapper: {\n position: 'absolute',\n zIndex: 222,\n right: 0,\n top: 50\n },\n error: {\n border: '2px solid red'\n }\n});\n\nclass UploadImage extends Component {\n constructor(props) {\n super(props);\n this.state = {\n uploadFile: false,\n anchorEl: null,\n cropHandler: false,\n };\n this.cropperRef = createRef();\n\n if (!window.document.getElementById('cropper-style-json-component')) {\n const style = window.document.createElement('style');\n style.setAttribute('id', 'cropper-style-json-component');\n style.innerHTML = cropperStyles;\n window.document.head.appendChild(style);\n }\n }\n\n onDrop(acceptedFiles) {\n const { maxSize, t, onChange } = this.props;\n\n const file = acceptedFiles[0];\n const reader = new FileReader();\n\n reader.onabort = () => console.log('file reading was aborted');\n reader.onerror = () => console.log('file reading has failed');\n reader.onload = () => {\n let ext = 'image/' + file.name.split('.').pop().toLowerCase();\n if (ext === 'image/jpg') {\n ext = 'image/jpeg';\n } else if (ext.includes('svg')) {\n ext = 'image/svg+xml';\n }\n if (file.size > maxSize) {\n return window.alert(t('File is too big. Max %sk allowed. Try use SVG.', Math.round(maxSize / 1024)));\n }\n const base64 = `data:${ext};base64,${btoa(\n new Uint8Array(reader.result)\n .reduce((data, byte) => data + String.fromCharCode(byte), ''))}`;\n\n onChange(base64);\n };\n reader.readAsArrayBuffer(file);\n }\n\n render() {\n const { disabled, maxSize, classes, icon, t, removeIconFunc, accept, error, crop, onChange } = this.props;\n const { uploadFile, anchorEl, cropHandler } = this.state;\n return <Dropzone\n disabled={disabled || cropHandler}\n key=\"dropzone\"\n multiple={false}\n accept={accept}\n maxSize={maxSize}\n onDragEnter={() => this.setState({ uploadFile: 'dragging' })}\n onDragLeave={() => this.setState({ uploadFile: true })}\n onDrop={(acceptedFiles, errors) => {\n this.setState({ uploadFile: false });\n if (!acceptedFiles.length) {\n window.alert((errors && errors[0] && errors[0].errors && errors[0].errors[0] && errors[0].errors[0].message) || t('Cannot upload'));\n } else {\n return this.onDrop(acceptedFiles);\n }\n }}\n >\n {({ getRootProps, getInputProps }) => <div\n className={clsx(\n classes.uploadDiv,\n uploadFile === 'dragging' && classes.uploadDivDragging,\n classes.dropZone,\n disabled && classes.disabledOpacity,\n !icon && classes.dropZoneEmpty\n )}\n {...getRootProps()}>\n <input {...getInputProps()} />\n <div className={clsx(classes.uploadCenterDiv, error && classes.error)}>\n {!icon ? <div className={classes.uploadCenterTextAndIcon}>\n <UploadIcon className={classes.uploadCenterIcon} />\n <div className={classes.uploadCenterText}>{\n uploadFile === 'dragging' ? t('Drop file here') :\n t('Place your files here or click here to open the browse dialog')}</div>\n </div>\n :\n removeIconFunc && !cropHandler && <div className={classes.buttonRemoveWrapper}>\n <Tooltip title={t('Clear')}>\n <IconButton size=\"large\" onClick={e => {\n removeIconFunc && removeIconFunc();\n e.stopPropagation();\n }}><IconClose />\n </IconButton>\n </Tooltip>\n </div>\n }\n {icon && crop && <div className={classes.buttonCropWrapper}>\n <Tooltip title={t('Crop')}>\n <IconButton size=\"large\" onClick={e => {\n if (!cropHandler) {\n this.setState({ cropHandler: true });\n } else {\n this.setState({ anchorEl: e.currentTarget });\n }\n e.stopPropagation();\n }}><CropIcon color={cropHandler ? 'primary' : 'inherit'} />\n </IconButton>\n </Tooltip>\n <Menu\n id=\"simple-menu\"\n anchorEl={anchorEl}\n keepMounted\n open={Boolean(anchorEl)}\n onClose={() => this.setState({ anchorEl: null })}\n >\n <MenuItem onClick={() => this.setState({ anchorEl: null, cropHandler: false }, () => {\n const imageElement = this.cropperRef?.current?.cropper;\n onChange(imageElement.getCroppedCanvas().toDataURL());\n })}>{t('Save')}</MenuItem>\n <MenuItem onClick={() => this.setState({ anchorEl: null, cropHandler: false })}>{t('Close')}</MenuItem>\n </Menu>\n </div>}\n {icon && !cropHandler ? <img src={icon} className={classes.image} alt=\"icon\" /> : null}\n\n {icon && crop && cropHandler ? <Cropper\n ref={this.cropperRef}\n className={classes.image}\n src={icon}\n initialAspectRatio={1}\n viewMode={1}\n guides={false}\n minCropBoxHeight={10}\n minCropBoxWidth={10}\n background={false}\n checkOrientation={false}\n /> : null}\n </div>\n </div>}\n </Dropzone>;\n }\n}\n\nUploadImage.defaultProps = {\n disabled: false,\n maxSize: 10 * 1024,\n icon: null,\n removeIconFunc: null,\n accept: 'image/*',\n error: false,\n onChange: base64 => console.log(base64),\n t: el => el,\n crop: false,\n};\n\nUploadImage.propTypes = {\n classes: PropTypes.object,\n maxSize: PropTypes.number,\n disabled: PropTypes.bool,\n crop: PropTypes.bool,\n error: PropTypes.bool,\n onChange: PropTypes.func,\n accept: PropTypes.string,\n t: PropTypes.func,\n};\n\nexport default withStyles(styles)(UploadImage);\n"],"mappings":";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O,CAACC,GAAR,CAAYa,MAAZ,CAAJ;EAAA,CAPO;EAQvBpB,CAAC,EAAE,WAAAuD,EAAE;IAAA,OAAIA,EAAJ;EAAA,CARkB;EASvBpB,IAAI,EAAE;AATiB,CAA3B;AAYAtD,WAAW,CAAC2E,SAAZ,GAAwB;EACpBzB,OAAO,EAAE0B,qBAAA,CAAUC,MADC;EAEpB3D,OAAO,EAAE0D,qBAAA,CAAUE,MAFC;EAGpB7B,QAAQ,EAAE2B,qBAAA,CAAUG,IAHA;EAIpBzB,IAAI,EAAEsB,qBAAA,CAAUG,IAJI;EAKpBhF,KAAK,EAAE6E,qBAAA,CAAUG,IALG;EAMpB3D,QAAQ,EAAEwD,qBAAA,CAAUI,IANA;EAOpB3B,MAAM,EAAEuB,qBAAA,CAAUK,MAPE;EAQpB9D,CAAC,EAAEyD,qBAAA,CAAUI;AARO,CAAxB;;eAWe,IAAAE,kBAAA,EAAWzH,MAAX,EAAmBuC,WAAnB,C"}
|
package/GenericApp.js
CHANGED
|
@@ -59,8 +59,6 @@ var _SaveCloseButtons = _interopRequireDefault(require("./Components/SaveCloseBu
|
|
|
59
59
|
|
|
60
60
|
var _i18n = _interopRequireDefault(require("./i18n"));
|
|
61
61
|
|
|
62
|
-
require("./index.css");
|
|
63
|
-
|
|
64
62
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
65
63
|
|
|
66
64
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
@@ -73,6 +71,9 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
73
71
|
|
|
74
72
|
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; } }
|
|
75
73
|
|
|
74
|
+
// import './index.css';
|
|
75
|
+
var cssStyle = "\nhtml {\n height: 100%;\n}\n\nbody {\n margin: 0;\n padding: 0;\n font-family: -apple-system, BlinkMacSystemFont, \"Segoe UI\", \"Roboto\", \"Oxygen\", \"Ubuntu\", \"Cantarell\", \"Fira Sans\", \"Droid Sans\", \"Helvetica Neue\", sans-serif;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n width: 100%;\n height: 100%;\n overflow: hidden;\n}\n\n/* scrollbar */\n::-webkit-scrollbar-track {\n background-color: #ccc;\n border-radius: 5px;\n}\n\n::-webkit-scrollbar {\n width: 5px;\n height: 5px;\n background-color: #ccc;\n}\n\n::-webkit-scrollbar-thumb {\n background-color: #575757;\n border-radius: 5px;\n}\n\n#root {\n height: 100%;\n}\n\n.App {\n height: 100%;\n}\n\n@keyframes glow {\n from {\n background-color: initial;\n }\n to {\n background-color: #58c458;\n }\n}\n";
|
|
76
|
+
|
|
76
77
|
if (!window.localStorage) {
|
|
77
78
|
window.localStorage = {
|
|
78
79
|
getItem: function getItem() {
|
|
@@ -101,7 +102,15 @@ var GenericApp = /*#__PURE__*/function (_Router) {
|
|
|
101
102
|
var _this;
|
|
102
103
|
|
|
103
104
|
(0, _classCallCheck2["default"])(this, GenericApp);
|
|
104
|
-
var ConnectionClass = props.Connection || settings.Connection || _Connection["default"];
|
|
105
|
+
var ConnectionClass = props.Connection || settings.Connection || _Connection["default"];
|
|
106
|
+
|
|
107
|
+
if (!window.document.getElementById('generic-app-iobroker-component')) {
|
|
108
|
+
var style = window.document.createElement('style');
|
|
109
|
+
style.setAttribute('id', 'generic-app-iobroker-component');
|
|
110
|
+
style.innerHTML = cssStyle;
|
|
111
|
+
window.document.head.appendChild(style);
|
|
112
|
+
} // Remove `!Connection.isWeb() && window.adapterName !== 'material'` when iobroker.socket will support native ws
|
|
113
|
+
|
|
105
114
|
|
|
106
115
|
if (!ConnectionClass.isWeb() && window.io && window.location.port === '3000') {
|
|
107
116
|
try {
|