redhotmagma-visualization 1.41.0 → 1.42.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AlignTargetProvider.js +50 -79
- package/CommonUtils/Deferred.js +11 -38
- package/CommonUtils/Observable.js +29 -48
- package/CommonUtils/PropertyObserver.js +10 -17
- package/CommonUtils/SyncCurrentFunction.js +33 -42
- package/CommonUtils/SyncObservableEvent.js +2 -6
- package/CommonUtils/pointerEvent.js +50 -98
- package/Constants.js +6 -6
- package/DevApp.js +187 -309
- package/ExposedModules.js +2 -9
- package/FallbackVisualization.js +4 -10
- package/PrintingEffects/ColorEmbossingEffect.js +15 -26
- package/PrintingEffects/DomingEffect.js +29 -52
- package/PrintingEffects/EmbossingEffect.js +17 -29
- package/PrintingEffects/EmbroideryEffect.js +251 -362
- package/PrintingEffects/EngravingEffect.js +17 -29
- package/PrintingEffects/PrintingEffects.js +44 -73
- package/PrintingEffects/PrintingEffectsUtils.js +1 -7
- package/React/ReactBase.js +15 -47
- package/Three/Controls/OrbitControls.js +105 -126
- package/Three/Exporters/glTFExporter.js +2 -6
- package/Three/Loaders/ColladaLoader.js +202 -550
- package/Three/Loaders/MTLLoader.js +33 -64
- package/Three/Loaders/OBJLoader.js +48 -80
- package/Three/Three2D.js +750 -1014
- package/Three/Three2DLayers.js +217 -341
- package/Three/Three3D.js +530 -800
- package/Three/Three3DScene.js +484 -780
- package/Three/ThreeBase.js +145 -230
- package/Utils/DesignArea/getDesignAreaCanvasSize.js +3 -11
- package/Utils/TextureBuilder/createTextureBuilder.js +133 -193
- package/Utils/TextureBuilder/textureBuilderFunctions.js +11 -27
- package/Utils/alignToElement.js +13 -24
- package/Utils/canvasBlur.js +27 -45
- package/Utils/createAlphaMapFromAlphaChannel.js +11 -21
- package/Utils/createBakedShadow.js +38 -42
- package/Utils/createCache.js +0 -4
- package/Utils/createCanvas.js +3 -9
- package/Utils/createImageRepository.js +63 -87
- package/Utils/disposeMaterial.js +4 -14
- package/Utils/getImageSize.js +1 -2
- package/Utils/imagePreloader.js +36 -48
- package/Utils/initTextureCanvas.js +6 -18
- package/Utils/isMobileDevice.js +3 -7
- package/Utils/optimizeTextureImage.js +13 -29
- package/Utils/rememberCameraViewOffset.js +8 -11
- package/Utils/removeObject.js +0 -4
- package/Utils/restrictCameraMovement.js +2 -12
- package/Utils/setLightShadow.js +3 -5
- package/Utils/setOrthographicCameraSize.js +0 -1
- package/Utils/updateFitSizeToElement.js +4 -9
- package/VisualizationContainer.js +37 -90
- package/VisualizationInterface.js +32 -67
- package/VisualizationProvider.js +5 -15
- package/index.js +2 -9
- package/package.json +6 -7
- package/scripts/cpPublicLocal.js +7 -2
- package/src/CommonUtils/Observable.js +1 -0
- package/src/CommonUtils/pointerEvent.js +17 -0
- package/src/Constants.js +2 -0
- package/src/DevApp.js +1 -2
- package/src/Three/Three2D.js +105 -1
- package/src/Three/ThreeBase.js +31 -3
- package/src/Utils/TextureBuilder/createTextureBuilder.js +12 -3
- package/src/VisualizationContainer.js +8 -2
- package/src/index.js +2 -3
- package/visualizationAdapterCreator.js +6 -23
package/Utils/setLightShadow.js
CHANGED
|
@@ -4,16 +4,14 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = setLightShadow;
|
|
7
|
-
|
|
8
7
|
function setLightShadow(light) {
|
|
9
8
|
var d = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 50;
|
|
10
9
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
11
|
-
|
|
12
10
|
if (light.isDirectionalLight) {
|
|
13
11
|
var _options$shadowMapSiz = options.shadowMapSize,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
12
|
+
shadowMapSize = _options$shadowMapSiz === void 0 ? 512 : _options$shadowMapSiz,
|
|
13
|
+
_options$cameraProps = options.cameraProps,
|
|
14
|
+
cameraProps = _options$cameraProps === void 0 ? {} : _options$cameraProps;
|
|
17
15
|
light.castShadow = true;
|
|
18
16
|
light.shadow.mapSize.width = shadowMapSize;
|
|
19
17
|
light.shadow.mapSize.height = shadowMapSize;
|
|
@@ -4,20 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.updateFitSizeToElement = void 0;
|
|
7
|
-
|
|
8
7
|
/**
|
|
9
8
|
* @param {ThreeBase} visualization
|
|
10
9
|
* @param {Element} element
|
|
11
10
|
*/
|
|
12
|
-
var updateFitSizeToElement = function updateFitSizeToElement(visualization, element) {
|
|
11
|
+
var updateFitSizeToElement = exports.updateFitSizeToElement = function updateFitSizeToElement(visualization, element) {
|
|
13
12
|
if (visualization && visualization.setFitSize) {
|
|
14
13
|
if (!element) {
|
|
15
14
|
visualization.setFitSize(null);
|
|
16
15
|
} else {
|
|
17
16
|
var _element$getBoundingC = element.getBoundingClientRect(),
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
width = _element$getBoundingC.width,
|
|
18
|
+
height = _element$getBoundingC.height;
|
|
21
19
|
if (width > 0 && height > 0) {
|
|
22
20
|
visualization.setFitSize({
|
|
23
21
|
width: width,
|
|
@@ -26,7 +24,6 @@ var updateFitSizeToElement = function updateFitSizeToElement(visualization, elem
|
|
|
26
24
|
}
|
|
27
25
|
}
|
|
28
26
|
}
|
|
29
|
-
|
|
30
27
|
return {
|
|
31
28
|
updateCameraPosition: function updateCameraPosition() {
|
|
32
29
|
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
@@ -34,6 +31,4 @@ var updateFitSizeToElement = function updateFitSizeToElement(visualization, elem
|
|
|
34
31
|
updateFn && updateFn.call(visualization, options);
|
|
35
32
|
}
|
|
36
33
|
};
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
exports.updateFitSizeToElement = updateFitSizeToElement;
|
|
34
|
+
};
|
|
@@ -1,58 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports["default"] = exports.VisualizationContainerSwitch = exports.VisualizationContainer = void 0;
|
|
9
|
-
|
|
10
7
|
var _react = _interopRequireDefault(require("react"));
|
|
11
|
-
|
|
12
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
9
|
var _cssElementQueries = require("css-element-queries");
|
|
15
|
-
|
|
16
10
|
var _VisualizationProvider = require("./VisualizationProvider");
|
|
17
|
-
|
|
18
11
|
var _VisualizationInterface = require("./VisualizationInterface");
|
|
19
|
-
|
|
20
12
|
var _AlignTargetProvider = require("./AlignTargetProvider");
|
|
21
|
-
|
|
22
13
|
var _alignToElement = require("./Utils/alignToElement");
|
|
23
|
-
|
|
24
14
|
var _updateFitSizeToElement = require("./Utils/updateFitSizeToElement");
|
|
25
|
-
|
|
26
15
|
var _Constants = require("./Constants");
|
|
27
|
-
|
|
28
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
29
|
-
|
|
30
|
-
function ownKeys(
|
|
31
|
-
|
|
32
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
33
|
-
|
|
17
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
18
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
19
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
34
20
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
35
|
-
|
|
36
|
-
function
|
|
37
|
-
|
|
38
|
-
function
|
|
39
|
-
|
|
40
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
41
|
-
|
|
42
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
43
|
-
|
|
21
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
22
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
23
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
24
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
44
25
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
45
|
-
|
|
46
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
|
|
47
|
-
|
|
26
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
48
27
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
49
|
-
|
|
50
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; } }
|
|
51
|
-
|
|
52
|
-
function
|
|
53
|
-
|
|
54
|
-
function
|
|
55
|
-
|
|
29
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
30
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
31
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
32
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
56
33
|
var defaultContainerStyle = {
|
|
57
34
|
position: "absolute",
|
|
58
35
|
top: 0,
|
|
@@ -61,6 +38,7 @@ var defaultContainerStyle = {
|
|
|
61
38
|
height: "100%",
|
|
62
39
|
overflow: "hidden"
|
|
63
40
|
};
|
|
41
|
+
|
|
64
42
|
/**
|
|
65
43
|
* Component for the Three.js visualization
|
|
66
44
|
* Responsibilities:
|
|
@@ -69,75 +47,56 @@ var defaultContainerStyle = {
|
|
|
69
47
|
* - loads the current model and starts the animation
|
|
70
48
|
* - will handle probably the positioning of the 3D component
|
|
71
49
|
*/
|
|
72
|
-
|
|
73
|
-
var VisualizationContainer = /*#__PURE__*/function (_React$Component) {
|
|
50
|
+
var VisualizationContainer = exports.VisualizationContainer = /*#__PURE__*/function (_React$Component) {
|
|
74
51
|
_inherits(VisualizationContainer, _React$Component);
|
|
75
|
-
|
|
76
52
|
var _super = _createSuper(VisualizationContainer);
|
|
77
|
-
|
|
78
53
|
function VisualizationContainer() {
|
|
79
54
|
var _this;
|
|
80
|
-
|
|
81
55
|
_classCallCheck(this, VisualizationContainer);
|
|
82
|
-
|
|
83
56
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
84
57
|
args[_key] = arguments[_key];
|
|
85
58
|
}
|
|
86
|
-
|
|
87
59
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
88
|
-
|
|
89
60
|
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
90
61
|
loading: false,
|
|
91
62
|
broken: false
|
|
92
63
|
});
|
|
93
|
-
|
|
94
64
|
_defineProperty(_assertThisInitialized(_this), "setLoading", function (loading) {
|
|
95
65
|
_this.setState({
|
|
96
66
|
loading: loading
|
|
97
67
|
});
|
|
98
68
|
});
|
|
99
|
-
|
|
100
69
|
_defineProperty(_assertThisInitialized(_this), "onSizeChange", function (size) {
|
|
101
70
|
var _this$props = _this.props,
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
71
|
+
visualization = _this$props.visualization,
|
|
72
|
+
alignTargetElement = _this$props.alignTargetElement;
|
|
105
73
|
if (!visualization.isInitialized()) {
|
|
106
74
|
return;
|
|
107
75
|
}
|
|
108
|
-
|
|
109
76
|
visualization.setSize(size);
|
|
110
|
-
|
|
111
77
|
if (alignTargetElement && alignTargetElement.clientWidth > 0 && alignTargetElement.clientHeight > 0) {
|
|
112
78
|
(0, _alignToElement.alignToElement)(visualization, alignTargetElement);
|
|
113
79
|
(0, _updateFitSizeToElement.updateFitSizeToElement)(visualization, alignTargetElement).updateCameraPosition({
|
|
114
80
|
animate: visualization.isAnimating() || !!alignTargetElement
|
|
115
81
|
});
|
|
116
82
|
}
|
|
117
|
-
|
|
118
83
|
visualization.render();
|
|
119
84
|
});
|
|
120
|
-
|
|
121
85
|
_defineProperty(_assertThisInitialized(_this), "containerRef", /*#__PURE__*/_react["default"].createRef());
|
|
122
|
-
|
|
123
86
|
return _this;
|
|
124
87
|
}
|
|
125
|
-
|
|
126
88
|
_createClass(VisualizationContainer, [{
|
|
127
89
|
key: "componentDidMount",
|
|
128
90
|
value: function componentDidMount() {
|
|
129
91
|
var visualization = this.props.visualization;
|
|
130
|
-
|
|
131
92
|
if (!visualization) {
|
|
132
93
|
// eslint-disable-next-line no-console
|
|
133
94
|
console.warn("Visualization component is not provided! Visualization will not be rendered.");
|
|
134
95
|
return;
|
|
135
96
|
}
|
|
136
|
-
|
|
137
97
|
if (!(visualization instanceof _VisualizationInterface.VisualizationInterface)) {
|
|
138
98
|
throw new Error('The provided "three" prop should always be a subclass of VisualizationInterface!');
|
|
139
99
|
}
|
|
140
|
-
|
|
141
100
|
this.initResizeSensor();
|
|
142
101
|
this.updateVisualization();
|
|
143
102
|
}
|
|
@@ -157,26 +116,22 @@ var VisualizationContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
157
116
|
value: function updateVisualization() {
|
|
158
117
|
var prevProps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
159
118
|
var _this$props2 = this.props,
|
|
160
|
-
|
|
161
|
-
|
|
119
|
+
visualization = _this$props2.visualization,
|
|
120
|
+
alignTargetElement = _this$props2.alignTargetElement;
|
|
162
121
|
var container = this.containerRef.current;
|
|
163
|
-
|
|
164
122
|
if (visualization !== prevProps.visualization) {
|
|
165
123
|
if (prevProps.visualization) {
|
|
166
124
|
prevProps.visualization.dispose();
|
|
167
125
|
}
|
|
168
|
-
|
|
169
126
|
if (visualization.isInitialized()) {
|
|
170
127
|
// Three is already initialized, just add it to the current container instead of reloading it completely
|
|
171
128
|
visualization.addToContainer(container);
|
|
172
129
|
} else {
|
|
173
130
|
this.initVisualization(container);
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
|
|
131
|
+
}
|
|
132
|
+
// init resize sensor if it's not done in the componentDidUpdate
|
|
177
133
|
!this.resizeSensor && this.initResizeSensor();
|
|
178
134
|
}
|
|
179
|
-
|
|
180
135
|
if (alignTargetElement && alignTargetElement !== prevProps.alignTargetElement || visualization && visualization !== prevProps.visualization) {
|
|
181
136
|
(0, _alignToElement.alignToElement)(visualization, alignTargetElement);
|
|
182
137
|
(0, _updateFitSizeToElement.updateFitSizeToElement)(visualization, alignTargetElement).updateCameraPosition({
|
|
@@ -189,44 +144,47 @@ var VisualizationContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
189
144
|
key: "componentWillUnmount",
|
|
190
145
|
value: function componentWillUnmount() {
|
|
191
146
|
var _this$props3 = this.props,
|
|
192
|
-
|
|
193
|
-
|
|
147
|
+
autoDispose = _this$props3.autoDispose,
|
|
148
|
+
visualization = _this$props3.visualization;
|
|
194
149
|
autoDispose && visualization.dispose();
|
|
195
150
|
this.resizeSensor && this.resizeSensor.detach();
|
|
151
|
+
this.offObservers && this.offObservers();
|
|
196
152
|
}
|
|
197
153
|
}, {
|
|
198
154
|
key: "initVisualization",
|
|
199
155
|
value: function initVisualization(container) {
|
|
200
156
|
var _this2 = this;
|
|
201
|
-
|
|
202
157
|
var visualization = this.props.visualization;
|
|
203
158
|
visualization.init(container);
|
|
204
|
-
visualization.observable.on(_Constants.EventTypes.LoadError, function (_ref) {
|
|
159
|
+
var offLoadError = visualization.observable.on(_Constants.EventTypes.LoadError, function (_ref) {
|
|
205
160
|
var screenshot = _ref.data.screenshot;
|
|
206
161
|
return !screenshot && _this2.setState({
|
|
207
162
|
broken: true
|
|
208
163
|
});
|
|
209
164
|
});
|
|
210
|
-
visualization.observable.on(_Constants.EventTypes.LoadFinished, function (_ref2) {
|
|
165
|
+
var offLoadFinished = visualization.observable.on(_Constants.EventTypes.LoadFinished, function (_ref2) {
|
|
211
166
|
var screenshot = _ref2.data.screenshot;
|
|
212
167
|
return !screenshot && _this2.setState({
|
|
213
168
|
broken: false
|
|
214
169
|
});
|
|
215
170
|
});
|
|
171
|
+
this.offObservers = function () {
|
|
172
|
+
offLoadError();
|
|
173
|
+
offLoadFinished();
|
|
174
|
+
delete _this2.offObservers;
|
|
175
|
+
};
|
|
216
176
|
}
|
|
217
177
|
}, {
|
|
218
178
|
key: "render",
|
|
219
179
|
value: function render() {
|
|
220
180
|
var _this$props4 = this.props,
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
181
|
+
className = _this$props4.className,
|
|
182
|
+
ProgressComponent = _this$props4.ProgressComponent,
|
|
183
|
+
BrokenComponent = _this$props4.BrokenComponent;
|
|
224
184
|
var broken = this.state.broken;
|
|
225
|
-
|
|
226
185
|
var style = _objectSpread(_objectSpread({}, className ? {} : defaultContainerStyle), broken && BrokenComponent && {
|
|
227
186
|
display: "none"
|
|
228
187
|
});
|
|
229
|
-
|
|
230
188
|
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(ProgressComponent, {
|
|
231
189
|
loading: this.props.isLoading
|
|
232
190
|
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
@@ -236,18 +194,13 @@ var VisualizationContainer = /*#__PURE__*/function (_React$Component) {
|
|
|
236
194
|
}), broken && BrokenComponent && /*#__PURE__*/_react["default"].createElement(BrokenComponent, null));
|
|
237
195
|
}
|
|
238
196
|
}]);
|
|
239
|
-
|
|
240
197
|
return VisualizationContainer;
|
|
241
198
|
}(_react["default"].Component);
|
|
242
|
-
|
|
243
|
-
exports.VisualizationContainer = VisualizationContainer;
|
|
244
|
-
|
|
245
199
|
_defineProperty(VisualizationContainer, "propTypes", {
|
|
246
200
|
visualization: _propTypes["default"].instanceOf(_VisualizationInterface.VisualizationInterface).isRequired,
|
|
247
201
|
autoDispose: _propTypes["default"].bool,
|
|
248
202
|
alignTargetElement: _propTypes["default"].instanceOf(Element)
|
|
249
203
|
});
|
|
250
|
-
|
|
251
204
|
_defineProperty(VisualizationContainer, "defaultProps", {
|
|
252
205
|
ProgressComponent: function ProgressComponent(_ref3) {
|
|
253
206
|
var loading = _ref3.loading;
|
|
@@ -256,24 +209,18 @@ _defineProperty(VisualizationContainer, "defaultProps", {
|
|
|
256
209
|
autoDispose: false,
|
|
257
210
|
alignTargetElement: null
|
|
258
211
|
});
|
|
259
|
-
|
|
260
|
-
var VisualizationContainerSwitch = function VisualizationContainerSwitch(props) {
|
|
212
|
+
var VisualizationContainerSwitch = exports.VisualizationContainerSwitch = function VisualizationContainerSwitch(props) {
|
|
261
213
|
// eslint-disable-next-line react/prop-types
|
|
262
214
|
var visualization = props.visualization,
|
|
263
|
-
|
|
264
|
-
|
|
215
|
+
VisualizationContainerComponent = props.VisualizationContainerComponent,
|
|
216
|
+
FallbackComponent = props.FallbackComponent;
|
|
265
217
|
var Component = visualization ? VisualizationContainerComponent : FallbackComponent;
|
|
266
218
|
return /*#__PURE__*/_react["default"].createElement(Component, props);
|
|
267
219
|
};
|
|
268
|
-
|
|
269
|
-
exports.VisualizationContainerSwitch = VisualizationContainerSwitch;
|
|
270
220
|
VisualizationContainerSwitch.defaultProps = {
|
|
271
221
|
VisualizationContainerComponent: VisualizationContainer,
|
|
272
222
|
FallbackComponent: function FallbackComponent() {
|
|
273
223
|
return null;
|
|
274
224
|
}
|
|
275
225
|
};
|
|
276
|
-
|
|
277
|
-
var _default = (0, _AlignTargetProvider.withCurrentTarget)((0, _VisualizationProvider.withVisualization)(VisualizationContainerSwitch));
|
|
278
|
-
|
|
279
|
-
exports["default"] = _default;
|
|
226
|
+
var _default = exports["default"] = (0, _AlignTargetProvider.withCurrentTarget)((0, _VisualizationProvider.withVisualization)(VisualizationContainerSwitch));
|