@flexem/fc-gui 3.0.0-alpha.113 → 3.0.0-alpha.115
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/bundles/@flexem/fc-gui.umd.js +130 -23
- package/bundles/@flexem/fc-gui.umd.js.map +1 -1
- package/bundles/@flexem/fc-gui.umd.min.js +2 -2
- package/bundles/@flexem/fc-gui.umd.min.js.map +1 -1
- package/communication/variable/variable-communicator.d.ts +1 -0
- package/communication/variable/variable-value.d.ts +3 -1
- package/communication/variable/variable-value.js +3 -1
- package/communication/variable/variable-value.metadata.json +1 -1
- package/elements/base/readable-element.js +4 -1
- package/elements/base/state-control-element.js +3 -0
- package/elements/historical-curve/historical-curve.element.d.ts +1 -0
- package/elements/historical-curve/historical-curve.element.js +28 -2
- package/elements/historical-curve/historical-curve.element.metadata.json +1 -1
- package/elements/main-element.js +2 -1
- package/elements/per-view-variable-communicator.d.ts +1 -0
- package/elements/per-view-variable-communicator.js +3 -0
- package/elements/per-view-variable-communicator.metadata.json +1 -1
- package/elements/switch-indicator-light/switch-indicator-light-element.js +2 -4
- package/elements/video/video-element.js +7 -1
- package/gui/gui-view.d.ts +2 -0
- package/gui/gui-view.js +54 -13
- package/gui/gui-view.metadata.json +1 -1
- package/package.json +1 -1
- package/remote/communication/variable/remote-variable-communicator.d.ts +3 -0
- package/remote/communication/variable/remote-variable-communicator.js +24 -0
- package/remote/communication/variable/remote-variable-communicator.metadata.json +1 -1
- package/remote/communication/variable/remote-variable-protocol.d.ts +2 -0
|
@@ -21868,11 +21868,13 @@ var variable_communicator = __webpack_require__(262);
|
|
|
21868
21868
|
|
|
21869
21869
|
// CONCATENATED MODULE: ./.tmp/communication/variable/variable-value.ts
|
|
21870
21870
|
class VariableValue {
|
|
21871
|
-
constructor(variableName, state, value, timeStamp) {
|
|
21871
|
+
constructor(variableName, state, value, timeStamp, systemName, customStatus) {
|
|
21872
21872
|
this.variableName = variableName;
|
|
21873
21873
|
this.state = state;
|
|
21874
21874
|
this.value = value;
|
|
21875
21875
|
this.timeStamp = timeStamp;
|
|
21876
|
+
this.systemName = systemName;
|
|
21877
|
+
this.customStatus = customStatus;
|
|
21876
21878
|
}
|
|
21877
21879
|
}
|
|
21878
21880
|
|
|
@@ -35094,6 +35096,9 @@ class state_control_element_StateControlElement extends conditional_dynamic_disp
|
|
|
35094
35096
|
if (!this.currentRect.length) {
|
|
35095
35097
|
return;
|
|
35096
35098
|
}
|
|
35099
|
+
// 元件绑定设备状态时不需要在右上角显示状态
|
|
35100
|
+
if (this.$element[0].dataset.model.includes('设备状态'))
|
|
35101
|
+
return;
|
|
35097
35102
|
const document = this.$element[0].ownerDocument;
|
|
35098
35103
|
const imgObj = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
|
35099
35104
|
if (imgObj) {
|
|
@@ -35312,7 +35317,7 @@ class readable_element_ReadableElement extends conditional_enable_element_Condit
|
|
|
35312
35317
|
}
|
|
35313
35318
|
reportValueChanged(value) {
|
|
35314
35319
|
Object(lodash["forEach"])(this.elementStates, elementState => {
|
|
35315
|
-
if (elementState.variableName === value.variableName) {
|
|
35320
|
+
if (elementState.variableName === value.variableName || elementState.variableName === value.systemName) {
|
|
35316
35321
|
elementState.state = value.state;
|
|
35317
35322
|
this.changeStates();
|
|
35318
35323
|
}
|
|
@@ -35322,6 +35327,9 @@ class readable_element_ReadableElement extends conditional_enable_element_Condit
|
|
|
35322
35327
|
|| value.variableName === this.maxVariableName) {
|
|
35323
35328
|
this.updateVariableValue(value.value, value.variableName);
|
|
35324
35329
|
}
|
|
35330
|
+
if (value.systemName === '设备状态') {
|
|
35331
|
+
this.updateVariableValue(value.customStatus, '设备状态');
|
|
35332
|
+
}
|
|
35325
35333
|
}
|
|
35326
35334
|
}
|
|
35327
35335
|
|
|
@@ -37112,6 +37120,28 @@ class historical_curve_element_HistoricalCurveElement extends conditional_displa
|
|
|
37112
37120
|
}
|
|
37113
37121
|
});
|
|
37114
37122
|
}
|
|
37123
|
+
setupTooltipAutoHide(chart) {
|
|
37124
|
+
const chartContainer = this.rootElement.select('.nv-focus').node();
|
|
37125
|
+
if (!chartContainer || !chart)
|
|
37126
|
+
return;
|
|
37127
|
+
let timeoutId;
|
|
37128
|
+
// 鼠标移入图表时显示 tooltip
|
|
37129
|
+
chartContainer.addEventListener('mouseover', () => {
|
|
37130
|
+
hideTooltipAfterDelay();
|
|
37131
|
+
});
|
|
37132
|
+
const clearTooltipTimeout = () => {
|
|
37133
|
+
if (timeoutId) {
|
|
37134
|
+
clearTimeout(timeoutId);
|
|
37135
|
+
timeoutId = null;
|
|
37136
|
+
}
|
|
37137
|
+
};
|
|
37138
|
+
const hideTooltipAfterDelay = () => {
|
|
37139
|
+
clearTooltipTimeout();
|
|
37140
|
+
timeoutId = setTimeout(() => {
|
|
37141
|
+
chart.tooltip.hidden(true);
|
|
37142
|
+
}, 2000); // 2秒延迟
|
|
37143
|
+
};
|
|
37144
|
+
}
|
|
37115
37145
|
renderChart(result) {
|
|
37116
37146
|
const chartWidth = this.model.displaySetting.size.width;
|
|
37117
37147
|
const chartHeight = this.model.displaySetting.size.height - this.displayOption.operationAreaHeight - this.displayOption.operationAreaMarginTop;
|
|
@@ -37123,12 +37153,16 @@ class historical_curve_element_HistoricalCurveElement extends conditional_displa
|
|
|
37123
37153
|
});
|
|
37124
37154
|
this.data = data;
|
|
37125
37155
|
nv_d3["addGraph"](() => {
|
|
37156
|
+
let chart;
|
|
37126
37157
|
if (this.model.displaySetting.curveType === CurveType.BarGroup || this.model.displaySetting.curveType === CurveType.BarStack) {
|
|
37127
|
-
|
|
37158
|
+
chart = this.getMultiBarWithFocusChart(chartWidth, chartHeight, data);
|
|
37128
37159
|
}
|
|
37129
37160
|
else {
|
|
37130
|
-
|
|
37161
|
+
chart = this.getLineChart(chartWidth, chartHeight, data);
|
|
37131
37162
|
}
|
|
37163
|
+
// 设置 tooltip 自动隐藏逻辑
|
|
37164
|
+
this.setupTooltipAutoHide(chart);
|
|
37165
|
+
return chart;
|
|
37132
37166
|
});
|
|
37133
37167
|
}
|
|
37134
37168
|
initPoint() {
|
|
@@ -39396,9 +39430,7 @@ class switch_indicator_light_element_SwitchIndicatorLightElement extends conditi
|
|
|
39396
39430
|
this.isWriteRestorationDownValue = true;
|
|
39397
39431
|
}, 1000);
|
|
39398
39432
|
}
|
|
39399
|
-
|
|
39400
|
-
on_event.preventDefault();
|
|
39401
|
-
}
|
|
39433
|
+
on_event.preventDefault();
|
|
39402
39434
|
}
|
|
39403
39435
|
});
|
|
39404
39436
|
this.rootElement.on(this.isMobileMode && isMobile ? 'touchend' : 'mouseup', () => {
|
|
@@ -39428,7 +39460,7 @@ class switch_indicator_light_element_SwitchIndicatorLightElement extends conditi
|
|
|
39428
39460
|
this.isWriteRestorationDownValue = false;
|
|
39429
39461
|
if (!this.model.useIndicatorLight) {
|
|
39430
39462
|
this.switchToState(0);
|
|
39431
|
-
if (on_event
|
|
39463
|
+
if (on_event) {
|
|
39432
39464
|
on_event.preventDefault();
|
|
39433
39465
|
}
|
|
39434
39466
|
}
|
|
@@ -40350,7 +40382,7 @@ class video_element_VideoElement extends conditional_display_element_Conditional
|
|
|
40350
40382
|
playsInline webkit-playsinline `;
|
|
40351
40383
|
if (this.isMobileMode) {
|
|
40352
40384
|
if (isAndroid) {
|
|
40353
|
-
videoHtml += '
|
|
40385
|
+
videoHtml += ' muted></video>';
|
|
40354
40386
|
}
|
|
40355
40387
|
else {
|
|
40356
40388
|
videoHtml += ' controls muted></video>';
|
|
@@ -40372,6 +40404,12 @@ class video_element_VideoElement extends conditional_display_element_Conditional
|
|
|
40372
40404
|
}
|
|
40373
40405
|
try {
|
|
40374
40406
|
this.videoPlayer = new EZUIPlayer(videoId);
|
|
40407
|
+
if (isAndroid) {
|
|
40408
|
+
// 确保在 EZUIPlayer 初始化后才调用 play 方法
|
|
40409
|
+
this.videoPlayer.on('canplay', () => {
|
|
40410
|
+
this.videoPlayer.play();
|
|
40411
|
+
});
|
|
40412
|
+
}
|
|
40375
40413
|
}
|
|
40376
40414
|
catch (err) {
|
|
40377
40415
|
console.log(err);
|
|
@@ -41558,7 +41596,8 @@ class main_element_MainElement {
|
|
|
41558
41596
|
Object(lodash["each"])(values, value => {
|
|
41559
41597
|
Object(lodash["each"])(this.elements, e => {
|
|
41560
41598
|
if (e instanceof readable_element_ReadableElement) {
|
|
41561
|
-
if (
|
|
41599
|
+
if ((value.variableName && (e.readVariableName === value.variableName ||
|
|
41600
|
+
e.minVariableName === value.variableName || e.maxVariableName === value.variableName)) || e.readVariableName === value.systemName) {
|
|
41562
41601
|
e.reportValueChanged(value);
|
|
41563
41602
|
}
|
|
41564
41603
|
}
|
|
@@ -41659,6 +41698,9 @@ class per_view_variable_communicator_PerViewVariableCommunicator {
|
|
|
41659
41698
|
writeWordByBit(variableName, index, value) {
|
|
41660
41699
|
return this._rawVariableCommunicator.writeWordByBit(variableName, index, value);
|
|
41661
41700
|
}
|
|
41701
|
+
requestVirtualDeviceState() {
|
|
41702
|
+
return this._rawVariableCommunicator.requestVirtualDeviceState();
|
|
41703
|
+
}
|
|
41662
41704
|
subscribeVariableState(variableName) {
|
|
41663
41705
|
return this.subscribeVariableStates([variableName]).pipe(Object(operators_["map"])(values => values[0]));
|
|
41664
41706
|
}
|
|
@@ -41757,22 +41799,57 @@ class gui_view_GuiView {
|
|
|
41757
41799
|
this.openVariableStatesSubscription.unsubscribe();
|
|
41758
41800
|
}
|
|
41759
41801
|
this.openedVariableNames = this.mainElement.getVariableNames();
|
|
41760
|
-
if (this.openedVariableNames.
|
|
41761
|
-
|
|
41802
|
+
if (this.openedVariableNames.indexOf('设备状态') !== -1) {
|
|
41803
|
+
if (this.requestVirtualDeviceState) {
|
|
41804
|
+
this.requestVirtualDeviceState.unsubscribe();
|
|
41805
|
+
}
|
|
41806
|
+
if (this.requestVirtualDeviceState) {
|
|
41807
|
+
this.requestVirtualDeviceState.unsubscribe();
|
|
41808
|
+
}
|
|
41809
|
+
if (this.openedVariableNames.length === 1) {
|
|
41810
|
+
this.normalOpenedVariableNames(['设备状态']);
|
|
41811
|
+
this.requestVirtualDeviceState =
|
|
41812
|
+
this.perViewVariableCommunicator.requestVirtualDeviceState().subscribe({
|
|
41813
|
+
complete: () => { }
|
|
41814
|
+
});
|
|
41815
|
+
}
|
|
41816
|
+
else {
|
|
41817
|
+
this.openVariableStatesSubscription =
|
|
41818
|
+
this.perViewVariableCommunicator.subscribeVariableStates(this.openedVariableNames).subscribe((states) => {
|
|
41819
|
+
this.mainElement.reportVariableStates(states);
|
|
41820
|
+
const normalVariableNames = [];
|
|
41821
|
+
Object(lodash["each"])(states, v => {
|
|
41822
|
+
if (v.state === communication["d" /* VariableStateEnum */].Normal && normalVariableNames.indexOf(v.variableName) === -1) {
|
|
41823
|
+
normalVariableNames.push(v.variableName);
|
|
41824
|
+
}
|
|
41825
|
+
});
|
|
41826
|
+
normalVariableNames.push('设备状态');
|
|
41827
|
+
this.normalOpenedVariableNames(normalVariableNames);
|
|
41828
|
+
this.requestVirtualDeviceState =
|
|
41829
|
+
this.perViewVariableCommunicator.requestVirtualDeviceState().subscribe({
|
|
41830
|
+
complete: () => { }
|
|
41831
|
+
});
|
|
41832
|
+
});
|
|
41833
|
+
}
|
|
41762
41834
|
}
|
|
41763
|
-
|
|
41764
|
-
|
|
41765
|
-
|
|
41766
|
-
|
|
41767
|
-
|
|
41768
|
-
|
|
41769
|
-
|
|
41835
|
+
else {
|
|
41836
|
+
if (this.openedVariableNames.length === 0) {
|
|
41837
|
+
return;
|
|
41838
|
+
}
|
|
41839
|
+
this.openVariableStatesSubscription =
|
|
41840
|
+
this.perViewVariableCommunicator.subscribeVariableStates(this.openedVariableNames).subscribe((states) => {
|
|
41841
|
+
this.mainElement.reportVariableStates(states);
|
|
41842
|
+
const normalVariableNames = [];
|
|
41843
|
+
Object(lodash["each"])(states, v => {
|
|
41844
|
+
if (v.state === communication["d" /* VariableStateEnum */].Normal && normalVariableNames.indexOf(v.variableName) === -1) {
|
|
41845
|
+
normalVariableNames.push(v.variableName);
|
|
41846
|
+
}
|
|
41847
|
+
});
|
|
41848
|
+
if (normalVariableNames.length > 0) {
|
|
41849
|
+
this.normalOpenedVariableNames(normalVariableNames);
|
|
41770
41850
|
}
|
|
41771
41851
|
});
|
|
41772
|
-
|
|
41773
|
-
this.normalOpenedVariableNames(normalVariableNames);
|
|
41774
|
-
}
|
|
41775
|
-
});
|
|
41852
|
+
}
|
|
41776
41853
|
}
|
|
41777
41854
|
popView(viewIndex, hostContainerId, el) {
|
|
41778
41855
|
return this.context.configStore.viewStore.getViewConfig(viewIndex).pipe(Object(operators_["map"])(view => {
|
|
@@ -41866,6 +41943,12 @@ class gui_view_GuiView {
|
|
|
41866
41943
|
if (this.openVariableStatesSubscription) {
|
|
41867
41944
|
this.openVariableStatesSubscription.unsubscribe();
|
|
41868
41945
|
}
|
|
41946
|
+
if (this.requestVirtualDeviceState) {
|
|
41947
|
+
this.requestVirtualDeviceState.unsubscribe();
|
|
41948
|
+
}
|
|
41949
|
+
if (this.virtualDeviceStatesChanged) {
|
|
41950
|
+
this.virtualDeviceStatesChanged.unsubscribe();
|
|
41951
|
+
}
|
|
41869
41952
|
if (this.openVariablesSubscription) {
|
|
41870
41953
|
this.openVariablesSubscription.unsubscribe();
|
|
41871
41954
|
}
|
|
@@ -64184,6 +64267,7 @@ class remote_variable_communicator_RemoteVariableCommunicator {
|
|
|
64184
64267
|
});
|
|
64185
64268
|
this.doVariableStatesChanged();
|
|
64186
64269
|
this.doVariableValuesChanged();
|
|
64270
|
+
this.doVirtualDeviceStatesChanged();
|
|
64187
64271
|
this.doAlarmChanged();
|
|
64188
64272
|
}
|
|
64189
64273
|
doAlarmChanged() {
|
|
@@ -64214,6 +64298,25 @@ class remote_variable_communicator_RemoteVariableCommunicator {
|
|
|
64214
64298
|
});
|
|
64215
64299
|
});
|
|
64216
64300
|
}
|
|
64301
|
+
doVirtualDeviceStatesChanged() {
|
|
64302
|
+
if (this.virtualDeviceStatesChangedSubscription !== undefined) {
|
|
64303
|
+
this.virtualDeviceStatesChangedSubscription.unsubscribe();
|
|
64304
|
+
}
|
|
64305
|
+
this.virtualDeviceStatesChangedSubscription =
|
|
64306
|
+
this.remoteVariableProtocol.virtualDeviceStatesChanged.subscribe((deviceStates) => {
|
|
64307
|
+
Object(lodash["each"])(deviceStates, deviceState => {
|
|
64308
|
+
const variableName = '设备状态';
|
|
64309
|
+
this.variableValueCache.set(variableName, deviceState);
|
|
64310
|
+
const data = Object.assign(Object.assign({}, deviceState), { systemName: '设备状态' });
|
|
64311
|
+
if (this.observers.has(variableName)) {
|
|
64312
|
+
Object(lodash["each"])(this.observers.get(variableName), ob => {
|
|
64313
|
+
// TODO 同一个ob监听多个变量的情况,组合成数组一次推送。
|
|
64314
|
+
ob.next([data]);
|
|
64315
|
+
});
|
|
64316
|
+
}
|
|
64317
|
+
});
|
|
64318
|
+
});
|
|
64319
|
+
}
|
|
64217
64320
|
doVariableStatesChanged() {
|
|
64218
64321
|
if (this.variableStatesChangedSubscription !== undefined) {
|
|
64219
64322
|
this.variableStatesChangedSubscription.unsubscribe();
|
|
@@ -64287,6 +64390,9 @@ class remote_variable_communicator_RemoteVariableCommunicator {
|
|
|
64287
64390
|
subscribeVariableState(variableName) {
|
|
64288
64391
|
return this.subscribeVariableStates([variableName]).pipe(Object(operators_["map"])(values => values[0]));
|
|
64289
64392
|
}
|
|
64393
|
+
requestVirtualDeviceState() {
|
|
64394
|
+
return this.remoteVariableProtocol.requestVirtualDeviceState();
|
|
64395
|
+
}
|
|
64290
64396
|
openVariables(variableNames, appId = '') {
|
|
64291
64397
|
return new Observable["a" /* Observable */](observer => {
|
|
64292
64398
|
let variablesToStart = [];
|
|
@@ -64389,6 +64495,7 @@ class remote_variable_communicator_RemoteVariableCommunicator {
|
|
|
64389
64495
|
this.connectedSubscription.unsubscribe();
|
|
64390
64496
|
this.variableStatesChangedSubscription.unsubscribe();
|
|
64391
64497
|
this.variableValuesChangedSubscription.unsubscribe();
|
|
64498
|
+
this.virtualDeviceStatesChangedSubscription.unsubscribe();
|
|
64392
64499
|
this.alarmChangedSubscription.unsubscribe();
|
|
64393
64500
|
if (this.logger && this.logger.isDebugEnabled()) {
|
|
64394
64501
|
this.logger.debug('[VariableCommunicator] RemoteVariableCommunicator disposed.');
|