coolcare-lite-scada-component 4.1.6 → 4.1.7

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.
@@ -84,7 +84,8 @@ var Player = function Player(_ref) {
84
84
  var jsonConfig = _ref.jsonConfig,
85
85
  query = _ref.query,
86
86
  onEvent = _ref.onEvent,
87
- onHistoryEvent = _ref.onHistoryEvent;
87
+ _ref$embedded = _ref.embedded,
88
+ embedded = _ref$embedded === void 0 ? false : _ref$embedded;
88
89
  var graphRef = useRef(null);
89
90
  var wrapRef = useRef(null);
90
91
  var playerRef = useRef(null);
@@ -206,7 +207,7 @@ var Player = function Player(_ref) {
206
207
  console.error(_t);
207
208
  message.error('oops, 出错了');
208
209
  case 7:
209
- _context.n = 16;
210
+ _context.n = 15;
210
211
  break;
211
212
  case 8:
212
213
  deviceId = points === null || points === void 0 ? void 0 : (_points$3 = points[0]) === null || _points$3 === void 0 ? void 0 : _points$3.deviceId;
@@ -237,25 +238,10 @@ var Player = function Player(_ref) {
237
238
  message.error('没有找到对应的点');
238
239
  return _context.a(2);
239
240
  case 12:
240
- if (!onHistoryEvent) {
241
+ if (!(!embedded && query.scene === 'device' && isInIframe())) {
241
242
  _context.n = 13;
242
243
  break;
243
244
  }
244
- onHistoryEvent({
245
- event: 'show-point-history-modal',
246
- payload: {
247
- pointIds: _res.data.map(function (v) {
248
- return v.pointId;
249
- }),
250
- locationSearch: window.location.search
251
- }
252
- });
253
- return _context.a(2);
254
- case 13:
255
- if (!(query.scene === 'device' && isInIframe())) {
256
- _context.n = 14;
257
- break;
258
- }
259
245
  // 如果是在 iframe 上显示(嵌入小麦), 使用小麦平台的历史曲线弹窗
260
246
  window.parent.postMessage({
261
247
  event: 'show-point-history-modal',
@@ -267,23 +253,23 @@ var Player = function Player(_ref) {
267
253
  }
268
254
  }, '*');
269
255
  return _context.a(2);
270
- case 14:
256
+ case 13:
271
257
  setActiveIndicatorNos([]);
272
258
  setActivePointIds(_res.data.map(function (v) {
273
259
  return v.pointId;
274
260
  }));
275
261
  setVisibleDialogHistory(true);
276
- _context.n = 16;
262
+ _context.n = 15;
277
263
  break;
278
- case 15:
279
- _context.p = 15;
264
+ case 14:
265
+ _context.p = 14;
280
266
  _t2 = _context.v;
281
267
  console.error(_t2);
282
268
  message.error('oops, 出错了');
283
- case 16:
269
+ case 15:
284
270
  return _context.a(2);
285
271
  }
286
- }, _callee, null, [[9, 15], [2, 6]]);
272
+ }, _callee, null, [[9, 14], [2, 6]]);
287
273
  }));
288
274
  return function handler(_x) {
289
275
  return _ref2.apply(this, arguments);
@@ -294,7 +280,7 @@ var Player = function Player(_ref) {
294
280
  return function () {
295
281
  emitter.off(eventName, handler);
296
282
  };
297
- }, [query, mittMeta, onHistoryEvent]);
283
+ }, [query, mittMeta, embedded]);
298
284
 
299
285
  // 监听显示点位写入弹窗事件
300
286
  useEffect(function () {
@@ -277,13 +277,15 @@ var Display = function Display(_ref) {
277
277
  }, !!q && jsonConfig && /*#__PURE__*/React.createElement(ScenePlayerByFormat, {
278
278
  config: jsonConfig,
279
279
  query: q,
280
- onEvent: onEvent
280
+ onEvent: onEvent,
281
+ embedded: !!query_
281
282
  }), !loading && !jsonConfig && /*#__PURE__*/React.createElement(ScadaEmpty, null));
282
283
  };
283
284
  var ScenePlayerByFormat = function ScenePlayerByFormat(_ref5) {
284
285
  var config = _ref5.config,
285
286
  query = _ref5.query,
286
- onEvent = _ref5.onEvent;
287
+ onEvent = _ref5.onEvent,
288
+ embedded = _ref5.embedded;
287
289
  var handleEvent = function handleEvent(event) {
288
290
  if (onEvent) {
289
291
  onEvent(event);
@@ -307,7 +309,7 @@ var ScenePlayerByFormat = function ScenePlayerByFormat(_ref5) {
307
309
  jsonConfig: config,
308
310
  query: query,
309
311
  onEvent: handleEvent,
310
- onHistoryEvent: onEvent
312
+ embedded: embedded
311
313
  });
312
314
  } catch (error) {
313
315
  return /*#__PURE__*/React.createElement("div", {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "coolcare-lite-scada-component",
3
- "version": "4.1.6",
3
+ "version": "4.1.7",
4
4
  "scripts": {
5
5
  "start": "cross-env PORT=8000 UMI_ENV=prod umi dev",
6
6
  "prepare:3d": "node scripts/build-scada.mjs studio",
@@ -9,6 +9,7 @@
9
9
  "build:generalfushi": "node scripts/build-scada.mjs generalfushi",
10
10
  "build:yimin": "node scripts/build-scada.mjs yimin",
11
11
  "build:staging": "node scripts/build-scada.mjs staging",
12
+ "test:history": "node --test tests/player-history.test.cjs",
12
13
  "test:3d": "node scripts/test-scada.mjs",
13
14
  "build:component": "father build",
14
15
  "prettier": "prettier --write '**/*.{js,jsx,tsx,ts,less,md,json}'",