@iobroker/adapter-react-v5 3.1.0 → 3.1.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.
@@ -0,0 +1,305 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
+
5
+ var _typeof = require("@babel/runtime/helpers/typeof");
6
+
7
+ Object.defineProperty(exports, "__esModule", {
8
+ value: true
9
+ });
10
+ exports["default"] = void 0;
11
+
12
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
13
+
14
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
15
+
16
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime/helpers/assertThisInitialized"));
17
+
18
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits"));
19
+
20
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
21
+
22
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime/helpers/getPrototypeOf"));
23
+
24
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
25
+
26
+ var _react = _interopRequireWildcard(require("react"));
27
+
28
+ var _propTypes = _interopRequireDefault(require("prop-types"));
29
+
30
+ var _styles = require("@mui/styles");
31
+
32
+ var _Table = _interopRequireDefault(require("@mui/material/Table"));
33
+
34
+ var _Skeleton = _interopRequireDefault(require("@mui/material/Skeleton"));
35
+
36
+ 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); }
37
+
38
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(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; }
39
+
40
+ 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); }; }
41
+
42
+ 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; } }
43
+
44
+ var styles = function styles(theme) {
45
+ return {
46
+ table: {
47
+ display: 'grid',
48
+ '& tr': {
49
+ display: 'contents'
50
+ },
51
+ '& thead': {
52
+ display: 'contents'
53
+ },
54
+ '& tbody': {
55
+ display: 'contents'
56
+ },
57
+ '& th': {
58
+ // resizer
59
+ position: 'sticky',
60
+ userSelect: 'none'
61
+ },
62
+ '& .resize-handle': {
63
+ // resizer
64
+ display: 'block',
65
+ position: 'absolute',
66
+ cursor: 'col-resize',
67
+ width: 7,
68
+ right: 0,
69
+ top: 2,
70
+ bottom: 2,
71
+ zIndex: 1,
72
+ borderRight: '2px dotted #888',
73
+ '&:hover': {
74
+ borderColor: '#ccc',
75
+ borderRightStyle: 'solid'
76
+ },
77
+ '&.active': {
78
+ borderColor: '#517ea5',
79
+ borderRightStyle: 'solid'
80
+ }
81
+ }
82
+ }
83
+ };
84
+ };
85
+
86
+ var TableResize = /*#__PURE__*/function (_Component) {
87
+ (0, _inherits2["default"])(TableResize, _Component);
88
+
89
+ var _super = _createSuper(TableResize);
90
+
91
+ function TableResize(props) {
92
+ var _this;
93
+
94
+ (0, _classCallCheck2["default"])(this, TableResize);
95
+ _this = _super.call(this, props);
96
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "resizerReset", function () {
97
+ for (var c = 0; c < _this.resizerCurrentWidths.length; c++) {
98
+ _this.resizerCurrentWidths[c] = (_this.props.initialWidths || [])[c] || 'auto';
99
+ }
100
+
101
+ window.localStorage.setItem("App.".concat(_this.props.name || 'history', ".table"), JSON.stringify(_this.resizerCurrentWidths));
102
+
103
+ _this.resizerApplyWidths();
104
+ });
105
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "resizerMouseMove", function (e) {
106
+ if (_this.resizerActiveDiv) {
107
+ var width = _this.resizerOldWidth + e.clientX - _this.resizerPosition;
108
+ var widthNext = _this.resizerOldWidthNext - e.clientX + _this.resizerPosition;
109
+
110
+ if ((!_this.resizerMin || width > _this.resizerMin) && (!_this.resizerMinNext || widthNext > _this.resizerMinNext)) {
111
+ _this.resizerCurrentWidths[_this.resizerActiveIndex] = width;
112
+ _this.resizerCurrentWidths[_this.resizerActiveIndex + 1] = widthNext;
113
+
114
+ _this.resizerApplyWidths();
115
+ }
116
+ }
117
+ });
118
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "resizerMouseUp", function () {
119
+ window.localStorage.setItem("App.".concat(_this.props.name || 'history', ".table"), JSON.stringify(_this.resizerCurrentWidths));
120
+ _this.resizerActiveIndex = null;
121
+ _this.resizerActiveDiv = null;
122
+ window.removeEventListener('mousemove', _this.resizerMouseMove);
123
+ window.removeEventListener('mouseup', _this.resizerMouseUp);
124
+ });
125
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "resizerMouseDown", function (e) {
126
+ if (_this.resizerActiveIndex === null || _this.resizerActiveIndex === undefined) {
127
+ console.log('Mouse down ' + e.target.dataset.index);
128
+ _this.resizerActiveIndex = parseInt(e.target.dataset.index, 10);
129
+ _this.resizerActiveDiv = e.target;
130
+ _this.resizerMin = _this.props.minWidths ? _this.props.minWidths[_this.resizerActiveIndex] : 0;
131
+ _this.resizerMinNext = _this.props.minWidths ? _this.props.minWidths[_this.resizerActiveIndex + 1] : 0;
132
+ _this.resizerPosition = e.clientX;
133
+ var ths;
134
+
135
+ if (_this.resizerCurrentWidths[_this.resizerActiveIndex] === 'auto') {
136
+ ths = ths || _this.resizerRefTable.current.querySelectorAll('th');
137
+ _this.resizerCurrentWidths[_this.resizerActiveIndex] = ths[_this.resizerActiveIndex].offsetWidth;
138
+ }
139
+
140
+ if (_this.resizerCurrentWidths[_this.resizerActiveIndex + 1] === 'auto') {
141
+ ths = ths || _this.resizerRefTable.current.querySelectorAll('th');
142
+ _this.resizerCurrentWidths[_this.resizerActiveIndex + 1] = ths[_this.resizerActiveIndex + 1].offsetWidth;
143
+ }
144
+
145
+ _this.resizerOldWidth = _this.resizerCurrentWidths[_this.resizerActiveIndex];
146
+ _this.resizerOldWidthNext = _this.resizerCurrentWidths[_this.resizerActiveIndex + 1];
147
+ window.addEventListener('mousemove', _this.resizerMouseMove);
148
+ window.addEventListener('mouseup', _this.resizerMouseUp);
149
+ }
150
+ });
151
+ _this.resizerRefTable = /*#__PURE__*/_react["default"].createRef();
152
+ _this.resizerActiveIndex = null;
153
+ _this.resizerActiveDiv = null;
154
+ _this.resizerCurrentWidths = [];
155
+ var widthsStored = window.localStorage.getItem("App.".concat(_this.props.name || 'history', ".table"));
156
+ _this.widthFilled = false;
157
+
158
+ if (widthsStored) {
159
+ try {
160
+ _this.resizerCurrentWidths = JSON.parse(widthsStored);
161
+ _this.widthFilled = true;
162
+ } catch (e) {// ignore
163
+ }
164
+ }
165
+
166
+ return _this;
167
+ }
168
+
169
+ (0, _createClass2["default"])(TableResize, [{
170
+ key: "componentDidMount",
171
+ value: function componentDidMount() {
172
+ this.resizerInstall();
173
+ }
174
+ }, {
175
+ key: "componentWillUnmount",
176
+ value: function componentWillUnmount() {
177
+ this.resizerUninstall();
178
+ }
179
+ }, {
180
+ key: "resizerInstall",
181
+ value: function resizerInstall() {
182
+ var _this2 = this;
183
+
184
+ if (this.resizerRefTable.current && !this.resizerRefTable.current._installed) {
185
+ this.resizerRefTable.current._installed = true;
186
+ var ths = this.resizerRefTable.current.querySelectorAll('th');
187
+
188
+ if (this.widthFilled && this.resizerCurrentWidths.length !== ths.length) {
189
+ this.resizerCurrentWidths = [];
190
+ this.widthFilled = false;
191
+ }
192
+
193
+ for (var i = 0; i < ths.length; i++) {
194
+ !this.widthFilled && this.resizerCurrentWidths.push(ths[i].offsetWidth); // last column does need handle
195
+
196
+ if (i < ths.length - 1) {
197
+ var div = window.document.createElement('div');
198
+ div.dataset.index = i.toString();
199
+ div.onmousedown = this.resizerMouseDown;
200
+ div.ondblclick = this.resizerReset;
201
+ div.title = this.props.dblTitle || 'Double click to reset table layout';
202
+ div.className = 'resize-handle';
203
+ ths[i].appendChild(div);
204
+ }
205
+ }
206
+
207
+ if (this.widthFilled) {
208
+ this.resizerApplyWidths();
209
+ }
210
+ } else {
211
+ this.installTimeout = setTimeout(function () {
212
+ _this2.installTimeout = null;
213
+
214
+ _this2.resizerInstall();
215
+ }, 100);
216
+ }
217
+ }
218
+ }, {
219
+ key: "resizerUninstall",
220
+ value: function resizerUninstall() {
221
+ this.installTimeout && clearTimeout(this.installTimeout); // resizer
222
+
223
+ if (this.resizerRefTable.current && this.resizerRefTable.current._installed) {
224
+ this.resizerRefTable.current._installed = true;
225
+ var ths = this.resizerRefTable.current.querySelectorAll('th');
226
+
227
+ for (var i = 0; i < ths.length; i++) {
228
+ var div = ths[i].querySelector('.resize-handle');
229
+
230
+ if (div) {
231
+ div.onmousedown = null;
232
+ div.remove();
233
+ }
234
+ }
235
+ }
236
+ }
237
+ }, {
238
+ key: "resizerApplyWidths",
239
+ value: function resizerApplyWidths() {
240
+ var gridTemplateColumns = [];
241
+
242
+ if (this.resizerCurrentWidths.length) {
243
+ for (var c = 0; c < this.resizerCurrentWidths.length; c++) {
244
+ if (this.resizerCurrentWidths[c]) {
245
+ gridTemplateColumns.push(this.resizerCurrentWidths[c] !== 'auto' ? this.resizerCurrentWidths[c] + 'px' : 'auto');
246
+ } else if (this.props.initialWidths && this.props.initialWidths[c]) {
247
+ gridTemplateColumns.push(this.props.initialWidths[c] !== 'auto' ? this.props.initialWidths[c] + 'px' : 'auto');
248
+ } else {
249
+ gridTemplateColumns.push('auto');
250
+ }
251
+ }
252
+ } else if (this.props.initialWidths) {
253
+ for (var _c = 0; _c < this.props.initialWidths.length; _c++) {
254
+ if (this.props.initialWidths[_c]) {
255
+ gridTemplateColumns.push(this.props.initialWidths[_c] !== 'auto' ? this.props.initialWidths[_c] + 'px' : 'auto');
256
+ } else {
257
+ gridTemplateColumns.push('auto');
258
+ }
259
+ }
260
+ }
261
+
262
+ if (this.resizerRefTable.current && gridTemplateColumns.length) {
263
+ this.resizerRefTable.current.style.gridTemplateColumns = gridTemplateColumns.join(' ');
264
+ }
265
+
266
+ return gridTemplateColumns.length ? gridTemplateColumns.join(' ') : undefined;
267
+ }
268
+ }, {
269
+ key: "render",
270
+ value: function render() {
271
+ if (this.props.ready === false) {
272
+ return /*#__PURE__*/_react["default"].createElement(_Skeleton["default"], null);
273
+ }
274
+
275
+ var style = {
276
+ gridTemplateColumns: this.resizerApplyWidths()
277
+ };
278
+ return /*#__PURE__*/_react["default"].createElement(_Table["default"], {
279
+ stickyHeader: this.props.stickyHeader,
280
+ size: this.props.size || 'small',
281
+ className: this.props.classes.table + (this.props.className ? ' ' + this.props.className : ''),
282
+ ref: this.resizerRefTable,
283
+ style: Object.assign({}, this.props.style || {}, style)
284
+ }, this.props.children);
285
+ }
286
+ }]);
287
+ return TableResize;
288
+ }(_react.Component);
289
+
290
+ TableResize.propTypes = {
291
+ name: _propTypes["default"].string,
292
+ ready: _propTypes["default"].bool,
293
+ stickyHeader: _propTypes["default"].bool,
294
+ size: _propTypes["default"].string,
295
+ className: _propTypes["default"].string,
296
+ style: _propTypes["default"].object,
297
+ initialWidths: _propTypes["default"].array,
298
+ minWidths: _propTypes["default"].array,
299
+ dblTitle: _propTypes["default"].string
300
+ };
301
+
302
+ var _default = (0, _styles.withStyles)(styles)(TableResize);
303
+
304
+ exports["default"] = _default;
305
+ //# sourceMappingURL=TableResize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TableResize.js","names":["styles","theme","table","display","position","userSelect","cursor","width","right","top","bottom","zIndex","borderRight","borderColor","borderRightStyle","TableResize","props","c","resizerCurrentWidths","length","initialWidths","window","localStorage","setItem","name","JSON","stringify","resizerApplyWidths","e","resizerActiveDiv","resizerOldWidth","clientX","resizerPosition","widthNext","resizerOldWidthNext","resizerMin","resizerMinNext","resizerActiveIndex","removeEventListener","resizerMouseMove","resizerMouseUp","undefined","console","log","target","dataset","index","parseInt","minWidths","ths","resizerRefTable","current","querySelectorAll","offsetWidth","addEventListener","React","createRef","widthsStored","getItem","widthFilled","parse","resizerInstall","resizerUninstall","_installed","i","push","div","document","createElement","toString","onmousedown","resizerMouseDown","ondblclick","resizerReset","title","dblTitle","className","appendChild","installTimeout","setTimeout","clearTimeout","querySelector","remove","gridTemplateColumns","style","join","ready","stickyHeader","size","classes","Object","assign","children","Component","propTypes","PropTypes","string","bool","object","array","withStyles"],"sources":["TableResize.jsx"],"sourcesContent":["/**\n * Copyright 2022, bluefox <dogafox@gmail.com>\n *\n * MIT License\n *\n **/\nimport React, { Component } from 'react';\nimport PropTypes from 'prop-types';\nimport { withStyles} from '@mui/styles';\n\nimport Table from '@mui/material/Table';\nimport Skeleton from '@mui/material/Skeleton';\n\nconst styles = theme => ({\n table: {\n display: 'grid',\n '& tr': {\n display: 'contents',\n },\n '& thead': {\n display: 'contents',\n },\n '& tbody': {\n display: 'contents',\n },\n '& th': { // resizer\n position: 'sticky',\n userSelect: 'none',\n },\n '& .resize-handle': { // resizer\n display: 'block',\n position: 'absolute',\n cursor: 'col-resize',\n width: 7,\n right: 0,\n top: 2,\n bottom: 2,\n zIndex: 1,\n borderRight: '2px dotted #888',\n '&:hover': {\n borderColor: '#ccc',\n borderRightStyle: 'solid',\n }\n , '&.active': {\n borderColor: '#517ea5',\n borderRightStyle: 'solid',\n }\n }\n },\n});\n\nclass TableResize extends Component {\n constructor(props) {\n super(props);\n this.resizerRefTable = React.createRef();\n this.resizerActiveIndex = null;\n this.resizerActiveDiv = null;\n this.resizerCurrentWidths = [];\n const widthsStored = window.localStorage.getItem(`App.${this.props.name || 'history'}.table`);\n this.widthFilled = false;\n\n if (widthsStored) {\n try {\n this.resizerCurrentWidths = JSON.parse(widthsStored);\n this.widthFilled = true;\n } catch (e) {\n // ignore\n }\n }\n }\n\n componentDidMount() {\n this.resizerInstall();\n }\n\n componentWillUnmount() {\n this.resizerUninstall();\n }\n\n resizerInstall() {\n if (this.resizerRefTable.current && !this.resizerRefTable.current._installed) {\n this.resizerRefTable.current._installed = true;\n const ths = this.resizerRefTable.current.querySelectorAll('th');\n if (this.widthFilled && this.resizerCurrentWidths.length !== ths.length) {\n this.resizerCurrentWidths = [];\n this.widthFilled = false;\n }\n\n for (let i = 0; i < ths.length; i++) {\n !this.widthFilled && this.resizerCurrentWidths.push(ths[i].offsetWidth);\n\n // last column does need handle\n if (i < ths.length - 1) {\n const div = window.document.createElement('div');\n div.dataset.index = i.toString();\n div.onmousedown = this.resizerMouseDown;\n div.ondblclick = this.resizerReset;\n div.title = this.props.dblTitle || 'Double click to reset table layout';\n div.className = 'resize-handle';\n ths[i].appendChild(div);\n }\n }\n if (this.widthFilled) {\n this.resizerApplyWidths();\n }\n } else {\n this.installTimeout = setTimeout(() => {\n this.installTimeout = null;\n this.resizerInstall()\n }, 100);\n }\n }\n\n resizerReset = () => {\n for (let c = 0; c < this.resizerCurrentWidths.length; c++) {\n this.resizerCurrentWidths[c] = (this.props.initialWidths || [])[c] || 'auto';\n }\n\n window.localStorage.setItem(`App.${this.props.name || 'history'}.table`, JSON.stringify(this.resizerCurrentWidths));\n this.resizerApplyWidths();\n }\n\n resizerUninstall() {\n this.installTimeout && clearTimeout(this.installTimeout);\n\n // resizer\n if (this.resizerRefTable.current && this.resizerRefTable.current._installed) {\n this.resizerRefTable.current._installed = true;\n const ths = this.resizerRefTable.current.querySelectorAll('th');\n for (let i = 0; i < ths.length; i++) {\n const div = ths[i].querySelector('.resize-handle');\n if (div) {\n div.onmousedown = null;\n div.remove();\n }\n }\n }\n }\n\n resizerApplyWidths() {\n const gridTemplateColumns = [];\n if (this.resizerCurrentWidths.length) {\n for (let c = 0; c < this.resizerCurrentWidths.length; c++) {\n if (this.resizerCurrentWidths[c]) {\n gridTemplateColumns.push(this.resizerCurrentWidths[c] !== 'auto' ? this.resizerCurrentWidths[c] + 'px' : 'auto');\n } else if (this.props.initialWidths && this.props.initialWidths[c]) {\n gridTemplateColumns.push(this.props.initialWidths[c] !== 'auto' ? this.props.initialWidths[c] + 'px' : 'auto');\n } else {\n gridTemplateColumns.push('auto');\n }\n }\n } else if (this.props.initialWidths) {\n for (let c = 0; c < this.props.initialWidths.length; c++) {\n if (this.props.initialWidths[c]) {\n gridTemplateColumns.push(this.props.initialWidths[c] !== 'auto' ? this.props.initialWidths[c] + 'px' : 'auto');\n } else {\n gridTemplateColumns.push('auto');\n }\n }\n }\n\n if (this.resizerRefTable.current && gridTemplateColumns.length) {\n this.resizerRefTable.current.style.gridTemplateColumns = gridTemplateColumns.join(' ');\n }\n\n return gridTemplateColumns.length ? gridTemplateColumns.join(' ') : undefined;\n }\n\n resizerMouseMove = e => {\n if (this.resizerActiveDiv) {\n const width = this.resizerOldWidth + e.clientX - this.resizerPosition;\n const widthNext = this.resizerOldWidthNext - e.clientX + this.resizerPosition;\n if ((!this.resizerMin || width > this.resizerMin) &&\n (!this.resizerMinNext || widthNext > this.resizerMinNext)) {\n this.resizerCurrentWidths[this.resizerActiveIndex] = width;\n this.resizerCurrentWidths[this.resizerActiveIndex + 1] = widthNext;\n this.resizerApplyWidths();\n }\n }\n }\n\n resizerMouseUp = () => {\n window.localStorage.setItem(`App.${this.props.name || 'history'}.table`, JSON.stringify(this.resizerCurrentWidths));\n\n this.resizerActiveIndex = null;\n this.resizerActiveDiv = null;\n window.removeEventListener('mousemove', this.resizerMouseMove);\n window.removeEventListener('mouseup', this.resizerMouseUp);\n }\n\n resizerMouseDown = e => {\n if (this.resizerActiveIndex === null || this.resizerActiveIndex === undefined) {\n console.log('Mouse down ' + e.target.dataset.index);\n this.resizerActiveIndex = parseInt(e.target.dataset.index, 10);\n this.resizerActiveDiv = e.target;\n this.resizerMin = this.props.minWidths ? this.props.minWidths[this.resizerActiveIndex] : 0;\n this.resizerMinNext = this.props.minWidths ? this.props.minWidths[this.resizerActiveIndex + 1] : 0;\n this.resizerPosition = e.clientX;\n let ths;\n if (this.resizerCurrentWidths[this.resizerActiveIndex] === 'auto') {\n ths = ths || this.resizerRefTable.current.querySelectorAll('th');\n this.resizerCurrentWidths[this.resizerActiveIndex] = ths[this.resizerActiveIndex].offsetWidth;\n }\n if (this.resizerCurrentWidths[this.resizerActiveIndex + 1] === 'auto') {\n ths = ths || this.resizerRefTable.current.querySelectorAll('th');\n this.resizerCurrentWidths[this.resizerActiveIndex + 1] = ths[this.resizerActiveIndex + 1].offsetWidth;\n }\n\n this.resizerOldWidth = this.resizerCurrentWidths[this.resizerActiveIndex];\n this.resizerOldWidthNext = this.resizerCurrentWidths[this.resizerActiveIndex + 1];\n\n window.addEventListener('mousemove', this.resizerMouseMove);\n window.addEventListener('mouseup', this.resizerMouseUp);\n }\n };\n\n render() {\n if (this.props.ready === false) {\n return <Skeleton />;\n }\n\n const style = { gridTemplateColumns: this.resizerApplyWidths() };\n\n return <Table\n stickyHeader={this.props.stickyHeader}\n size={this.props.size || 'small'}\n className={ this.props.classes.table + (this.props.className ? ' ' + this.props.className : '')}\n ref={ this.resizerRefTable }\n style={ Object.assign({}, this.props.style || {}, style) }\n >\n { this.props.children }\n </Table>;\n }\n}\n\nTableResize.propTypes = {\n name: PropTypes.string,\n ready: PropTypes.bool,\n stickyHeader: PropTypes.bool,\n size: PropTypes.string,\n className: PropTypes.string,\n style: PropTypes.object,\n initialWidths: PropTypes.array,\n minWidths: PropTypes.array,\n dblTitle: PropTypes.string,\n};\n\nexport default withStyles(styles)(TableResize);"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAMA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAAAC,KAAK;EAAA,OAAK;IACrBC,KAAK,EAAE;MACHC,OAAO,EAAE,MADN;MAEH,QAAQ;QACJA,OAAO,EAAE;MADL,CAFL;MAKH,WAAW;QACPA,OAAO,EAAE;MADF,CALR;MAQH,WAAW;QACPA,OAAO,EAAE;MADF,CARR;MAWH,QAAQ;QAAE;QACNC,QAAQ,EAAE,QADN;QAEJC,UAAU,EAAE;MAFR,CAXL;MAeH,oBAAoB;QAAE;QAClBF,OAAO,EAAE,OADO;QAEhBC,QAAQ,EAAE,UAFM;QAGhBE,MAAM,EAAE,YAHQ;QAIhBC,KAAK,EAAE,CAJS;QAKhBC,KAAK,EAAE,CALS;QAMhBC,GAAG,EAAE,CANW;QAOhBC,MAAM,EAAE,CAPQ;QAQhBC,MAAM,EAAE,CARQ;QAShBC,WAAW,EAAE,iBATG;QAUhB,WAAW;UACPC,WAAW,EAAE,MADN;UAEPC,gBAAgB,EAAE;QAFX,CAVK;QAcd,YAAY;UACVD,WAAW,EAAE,SADH;UAEVC,gBAAgB,EAAE;QAFR;MAdE;IAfjB;EADc,CAAL;AAAA,CAApB;;IAsCMC,W;;;;;EACF,qBAAYC,KAAZ,EAAmB;IAAA;;IAAA;IACf,0BAAMA,KAAN;IADe,iGA6DJ,YAAM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,gCAAC,oBAAD,OAAP;MACH;;MAED,IAAMF,KAAK,GAAG;QAAED,mBAAmB,EAAE,KAAKxD,kBAAL;MAAvB,CAAd;MAEA,oBAAO,gCAAC,iBAAD;QACH,YAAY,EAAE,KAAKX,KAAL,CAAWuE,YADtB;QAEH,IAAI,EAAE,KAAKvE,KAAL,CAAWwE,IAAX,IAAmB,OAFtB;QAGH,SAAS,EAAG,KAAKxE,KAAL,CAAWyE,OAAX,CAAmBvF,KAAnB,IAA4B,KAAKc,KAAL,CAAW4D,SAAX,GAAuB,MAAM,KAAK5D,KAAL,CAAW4D,SAAxC,GAAoD,EAAhF,CAHT;QAIH,GAAG,EAAG,KAAK1B,eAJR;QAKH,KAAK,EAAGwC,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkB,KAAK3E,KAAL,CAAWoE,KAAX,IAAoB,EAAtC,EAA0CA,KAA1C;MALL,GAOD,KAAKpE,KAAL,CAAW4E,QAPV,CAAP;IASH;;;EArLqBC,gB;;AAwL1B9E,WAAW,CAAC+E,SAAZ,GAAwB;EACpBtE,IAAI,EAAEuE,qBAAA,CAAUC,MADI;EAEpBV,KAAK,EAAES,qBAAA,CAAUE,IAFG;EAGpBV,YAAY,EAAEQ,qBAAA,CAAUE,IAHJ;EAIpBT,IAAI,EAAEO,qBAAA,CAAUC,MAJI;EAKpBpB,SAAS,EAAEmB,qBAAA,CAAUC,MALD;EAMpBZ,KAAK,EAAEW,qBAAA,CAAUG,MANG;EAOpB9E,aAAa,EAAE2E,qBAAA,CAAUI,KAPL;EAQpBnD,SAAS,EAAE+C,qBAAA,CAAUI,KARD;EASpBxB,QAAQ,EAAEoB,qBAAA,CAAUC;AATA,CAAxB;;eAYe,IAAAI,kBAAA,EAAWpG,MAAX,EAAmBe,WAAnB,C"}
package/Connection.js CHANGED
@@ -233,9 +233,17 @@ var Connection = /*#__PURE__*/function () {
233
233
  protocol = parts[0];
234
234
  host = parts[1];
235
235
  }
236
+ } // get current path
237
+
238
+
239
+ var path = window.location.pathname;
240
+ var pos = path.lastIndexOf('/');
241
+
242
+ if (pos !== -1) {
243
+ path = path.substring(0, pos + 1);
236
244
  }
237
245
 
238
- var url = port ? "".concat(protocol, "://").concat(host, ":").concat(port) : "".concat(protocol, "://").concat(host);
246
+ var url = port ? "".concat(protocol, "://").concat(host, ":").concat(port).concat(path) : "".concat(protocol, "://").concat(host).concat(path);
239
247
  this._socket = window.io.connect(url, {
240
248
  query: 'ws=true',
241
249
  name: this.props.name,
@@ -2665,7 +2673,7 @@ var Connection = /*#__PURE__*/function () {
2665
2673
  family: 'ipv6'
2666
2674
  }];
2667
2675
 
2668
- if ((_host$native = host["native"]) !== null && _host$native !== void 0 && (_host$native$hardware = _host$native.hardware) !== null && _host$native$hardware !== void 0 && _host$native$hardware.networkInterfaces) {
2676
+ if (host !== null && host !== void 0 && (_host$native = host["native"]) !== null && _host$native !== void 0 && (_host$native$hardware = _host$native.hardware) !== null && _host$native$hardware !== void 0 && _host$native$hardware.networkInterfaces) {
2669
2677
  for (var eth in host["native"].hardware.networkInterfaces) {
2670
2678
  if (!host["native"].hardware.networkInterfaces.hasOwnProperty(eth)) {
2671
2679
  continue;
@@ -3034,7 +3042,7 @@ var Connection = /*#__PURE__*/function () {
3034
3042
  resolve(json);
3035
3043
  }
3036
3044
  })["catch"](function (e) {
3037
- reject('getCurrentSession: ' + e);
3045
+ return reject('getCurrentSession: ' + e);
3038
3046
  });
3039
3047
  });
3040
3048
  }