@flexem/fc-gui 3.0.0-alpha.10 → 3.0.0-alpha.101
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/CHANGELOG.md +419 -0
- package/bundles/@flexem/fc-gui.umd.js +18551 -17071
- package/bundles/@flexem/fc-gui.umd.js.map +1 -1
- package/bundles/@flexem/fc-gui.umd.min.js +5 -5
- package/bundles/@flexem/fc-gui.umd.min.js.map +1 -1
- package/communication/variable/variable-communicator.d.ts +1 -0
- package/config/alarm/alarm.store.d.ts +6 -0
- package/config/alarm/alarm.store.js +0 -0
- package/config/alarm/alarm.store.metadata.json +1 -0
- package/config/alarm/get-alarms-args.d.ts +9 -0
- package/config/alarm/get-alarms-args.js +9 -0
- package/config/alarm/get-alarms-args.metadata.json +1 -0
- package/config/alarm/index.d.ts +2 -0
- package/config/alarm/index.js +1 -0
- package/config/alarm/index.metadata.json +1 -0
- package/config/config-store.d.ts +2 -0
- package/config/index.d.ts +1 -0
- package/config/index.js +1 -0
- package/config/index.metadata.json +1 -1
- package/elements/air-quality/air-quality-element.d.ts +31 -0
- package/elements/air-quality/air-quality-element.js +194 -0
- package/elements/air-quality/air-quality-element.metadata.json +1 -0
- package/elements/alarm/alarm-element.d.ts +44 -0
- package/elements/alarm/alarm-element.js +386 -0
- package/elements/alarm/alarm-element.metadata.json +1 -0
- package/elements/bar-graph-element.d.ts +7 -1
- package/elements/bar-graph-element.js +70 -4
- package/elements/bar-graph-element.metadata.json +1 -1
- package/elements/base/readable-element.d.ts +6 -1
- package/elements/base/readable-element.js +31 -2
- package/elements/base/readable-element.metadata.json +1 -1
- package/elements/historical-curve/historical-curve.element.d.ts +4 -0
- package/elements/historical-curve/historical-curve.element.js +204 -19
- package/elements/historical-curve/historical-curve.element.metadata.json +1 -1
- package/elements/main-element.js +25 -4
- package/elements/main-element.metadata.json +1 -1
- package/elements/meter-element.d.ts +7 -1
- package/elements/meter-element.js +76 -7
- package/elements/meter-element.metadata.json +1 -1
- package/elements/numerical-display/numerical-display-element.d.ts +8 -2
- package/elements/numerical-display/numerical-display-element.js +55 -11
- package/elements/numerical-display/numerical-display-element.metadata.json +1 -1
- package/elements/per-view-variable-communicator.d.ts +2 -0
- package/elements/per-view-variable-communicator.js +8 -0
- package/elements/per-view-variable-communicator.metadata.json +1 -1
- package/elements/ring-graph/ring-graph-element.d.ts +10 -1
- package/elements/ring-graph/ring-graph-element.js +106 -3
- package/elements/ring-graph/ring-graph-element.metadata.json +1 -1
- package/elements/shared/graph/graph-state-element.js +0 -3
- package/elements/shared/text/text-element.js +13 -2
- package/elements/shared/text/text-state-element.js +1 -1
- package/elements/switch-indicator-light/bit-switch-operator.d.ts +1 -0
- package/elements/switch-indicator-light/bit-switch-operator.js +19 -0
- package/elements/switch-indicator-light/bit-switch-operator.metadata.json +1 -1
- package/elements/switch-indicator-light/switch-indicator-light-element.d.ts +8 -0
- package/elements/switch-indicator-light/switch-indicator-light-element.js +93 -23
- package/elements/switch-indicator-light/switch-indicator-light-element.metadata.json +1 -1
- package/elements/switch-indicator-light/switch-operator.d.ts +1 -0
- package/elements/switch-indicator-light/word-switch-operator.d.ts +1 -0
- package/elements/switch-indicator-light/word-switch-operator.js +6 -0
- package/elements/switch-indicator-light/word-switch-operator.metadata.json +1 -1
- package/elements/video/video-element.d.ts +4 -0
- package/elements/video/video-element.js +74 -20
- package/elements/video/video-element.metadata.json +1 -1
- package/elements/view-operation/view-operation.element.js +8 -0
- package/elements/weather/weater-element.js +0 -1
- package/gui/gui-context.d.ts +2 -1
- package/gui/gui-host.d.ts +1 -1
- package/gui/gui.component.d.ts +3 -0
- package/gui/gui.component.js +15 -2
- package/gui/gui.component.metadata.json +1 -1
- package/localization/localization.service.d.ts +7 -0
- package/localization/localization.service.js +8 -1
- package/localization/localization.service.metadata.json +1 -1
- package/localization/localization.service.zh_CN.js +8 -1
- package/localization/localization.service.zh_CN.metadata.json +1 -1
- package/modal/write-value/write-value-modal-args.d.ts +3 -1
- package/modal/write-value/write-value-modal-args.js +2 -1
- package/modal/write-value/write-value-modal-args.metadata.json +1 -1
- package/modal/write-value/write-value-modal.component.d.ts +8 -7
- package/modal/write-value/write-value-modal.component.html +9 -4
- package/modal/write-value/write-value-modal.component.js +49 -22
- package/modal/write-value/write-value-modal.component.metadata.json +1 -1
- package/model/air-quality/air-quality-info.d.ts +23 -0
- package/model/air-quality/air-quality-info.js +4 -0
- package/model/air-quality/air-quality-info.metadata.json +1 -0
- package/model/air-quality/air-quality.model.d.ts +7 -0
- package/model/air-quality/air-quality.model.js +0 -0
- package/model/air-quality/air-quality.model.metadata.json +1 -0
- package/model/alarm/alarm.model.d.ts +13 -0
- package/model/alarm/alarm.model.js +0 -0
- package/model/alarm/alarm.model.metadata.json +1 -0
- package/model/bar-graph/bar-graph.d.ts +4 -0
- package/model/base/readable-model.d.ts +4 -0
- package/model/historical-curve/historical-curve-axis-settings.d.ts +10 -0
- package/model/historical-curve/historical-curve-axis-settings.js +5 -0
- package/model/historical-curve/historical-curve-axis-settings.metadata.json +1 -1
- package/model/historical-curve/historical-curve-chanel.model.d.ts +8 -0
- package/model/meter/meter.d.ts +4 -0
- package/model/ring-graph/ring-graph.model.d.ts +8 -0
- package/model/switch-indicator-light/bit-switch-operation.d.ts +2 -1
- package/model/switch-indicator-light/bit-switch-operation.js +1 -0
- package/model/switch-indicator-light/bit-switch-operation.metadata.json +1 -1
- package/package.json +1 -1
- package/remote/communication/variable/remote-variable-communicator.d.ts +4 -0
- package/remote/communication/variable/remote-variable-communicator.js +23 -1
- package/remote/communication/variable/remote-variable-communicator.metadata.json +1 -1
- package/remote/communication/variable/remote-variable-protocol.d.ts +3 -0
- package/service/index.d.ts +1 -0
- package/service/index.metadata.json +1 -1
- package/service/released-variable/index.d.ts +1 -0
- package/service/released-variable/index.js +0 -0
- package/service/released-variable/index.metadata.json +1 -0
- package/service/released-variable/released-variable.service.d.ts +4 -0
- package/service/released-variable/released-variable.service.js +0 -0
- package/service/released-variable/released-variable.service.metadata.json +1 -0
- package/service/weather.service.d.ts +1 -0
- package/shared/gui-consts.d.ts +2 -0
- package/shared/gui-consts.js +2 -0
- package/shared/gui-consts.metadata.json +1 -1
- package/utils/data-type/data-type.service.d.ts +3 -3
- package/utils/data-type/data-type.service.js +31 -7
- package/utils/data-type/fbox-data-type.service.js +40 -0
- package/utils/numerical-operation.service.js +2 -2
|
@@ -10,6 +10,7 @@ import { HistoricalCurveElementStatus } from './historical-curve-element-status'
|
|
|
10
10
|
import { LOGGER_SERVICE_TOKEN } from '../../logger';
|
|
11
11
|
import { GlobalSettings, DisplayMode } from '../../settings';
|
|
12
12
|
import { CurveType } from '../../model/historical-curve/curve-type';
|
|
13
|
+
import { AxisRangeType } from '../../model/historical-curve/historical-curve-axis-settings';
|
|
13
14
|
export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
14
15
|
constructor(element, injector, permissionChecker, variableCommunicator, variableStore, historyDataStore, signalRAppId) {
|
|
15
16
|
super(element, permissionChecker, variableCommunicator, variableStore, signalRAppId);
|
|
@@ -21,13 +22,14 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
21
22
|
marginRight: 20,
|
|
22
23
|
mobileMinWidth: 450,
|
|
23
24
|
operationAreaHeight: 32,
|
|
24
|
-
operationAreaMarginTop:
|
|
25
|
+
operationAreaMarginTop: 25,
|
|
25
26
|
operationSelectFontSize: '16px',
|
|
26
27
|
operationButtonWidth: 24,
|
|
27
28
|
operationButtonHeight: 24,
|
|
28
29
|
operationButtonMargin: 4
|
|
29
30
|
};
|
|
30
31
|
this.elementStatus = HistoricalCurveElementStatus.Loading;
|
|
32
|
+
this.data = [];
|
|
31
33
|
this.logger = injector.get(LOGGER_SERVICE_TOKEN);
|
|
32
34
|
this.localization = injector.get(LOCALIZATION);
|
|
33
35
|
this.timePeriods = this.getValidTimePeriods();
|
|
@@ -38,7 +40,7 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
38
40
|
}, this.model.displaySetting.refreshInterval * 1000);
|
|
39
41
|
this.isMobileMode = DisplayMode.Mobile === injector.get(GlobalSettings).displayMode;
|
|
40
42
|
if (this.isMobileMode) {
|
|
41
|
-
this.displayOption.operationAreaMarginTop =
|
|
43
|
+
this.displayOption.operationAreaMarginTop = 35;
|
|
42
44
|
if (this.model.displaySetting.size.width >= this.displayOption.mobileMinWidth) {
|
|
43
45
|
this.displayOption.operationAreaHeight = 68;
|
|
44
46
|
this.displayOption.operationSelectFontSize = '24px';
|
|
@@ -54,11 +56,16 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
54
56
|
if (this.chartElement) {
|
|
55
57
|
this.chartElement.tooltip.hidden(true);
|
|
56
58
|
}
|
|
59
|
+
if (this.resizeEventListener) {
|
|
60
|
+
this.resizeEventListener.clear();
|
|
61
|
+
}
|
|
57
62
|
this.logger.debug(`[GUI]Dispose Histoical Curve Refresh Interval:${d3.time.format('%x %X')(new Date())}`);
|
|
58
63
|
}
|
|
59
64
|
getValidTimePeriods() {
|
|
60
65
|
const timePeriods = new Array();
|
|
66
|
+
timePeriods.push({ key: 6, name: this.localization.lastThirtyMinutes });
|
|
61
67
|
timePeriods.push({ key: 1, name: this.localization.lastOneHour });
|
|
68
|
+
timePeriods.push({ key: 7, name: this.localization.lastEightHour });
|
|
62
69
|
timePeriods.push({ key: 2, name: this.localization.lastTwentyFourHours });
|
|
63
70
|
timePeriods.push({ key: 3, name: this.localization.lastSevenDays });
|
|
64
71
|
timePeriods.push({ key: 4, name: this.localization.lastThirtyDays });
|
|
@@ -84,6 +91,12 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
84
91
|
case 5:
|
|
85
92
|
this.startTime = moment().subtract(1, 'years');
|
|
86
93
|
break;
|
|
94
|
+
case 6:
|
|
95
|
+
this.startTime = moment().subtract(30, 'minutes');
|
|
96
|
+
break;
|
|
97
|
+
case 7:
|
|
98
|
+
this.startTime = moment().subtract(8, 'hours');
|
|
99
|
+
break;
|
|
87
100
|
default:
|
|
88
101
|
this.startTime = moment().subtract(1, 'days');
|
|
89
102
|
}
|
|
@@ -131,6 +144,7 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
131
144
|
each(result, v => values.push({ x: moment(v.time).local().toDate().valueOf(), y: v.values[key] }));
|
|
132
145
|
data.push({ key: channel.name, area: channel.projectEnabled, values: values });
|
|
133
146
|
});
|
|
147
|
+
this.data = data;
|
|
134
148
|
nv.addGraph(() => {
|
|
135
149
|
if (this.model.displaySetting.curveType === CurveType.BarGroup || this.model.displaySetting.curveType === CurveType.BarStack) {
|
|
136
150
|
return this.getMultiBarWithFocusChart(chartWidth, chartHeight, data);
|
|
@@ -140,10 +154,57 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
140
154
|
}
|
|
141
155
|
});
|
|
142
156
|
}
|
|
157
|
+
initPoint() {
|
|
158
|
+
try {
|
|
159
|
+
const legendList = this.$element
|
|
160
|
+
.find('.nv-legend')
|
|
161
|
+
.find('.nv-series');
|
|
162
|
+
let hiddenCount = 0;
|
|
163
|
+
for (let i = 0; i < this.data.length; i++) {
|
|
164
|
+
const channel = this.model.dataSetting.channels[i];
|
|
165
|
+
if (legendList.eq(i).children().eq(0).css('fill-opacity') === '1') {
|
|
166
|
+
const pointList = this.$element
|
|
167
|
+
.find('.nv-scatterWrap')
|
|
168
|
+
.find('.nv-series-' + (i - hiddenCount))
|
|
169
|
+
.find('.nv-point');
|
|
170
|
+
if (pointList && pointList.length) {
|
|
171
|
+
for (let j = 0; j < pointList.length; j++) {
|
|
172
|
+
const point = pointList.eq(j);
|
|
173
|
+
const previousPoint = pointList.eq(j - 1);
|
|
174
|
+
if (j && point.attr('transform').split(',')[1] !== previousPoint.attr('transform').split(',')[1]) {
|
|
175
|
+
if (channel.enablePoint && channel.pointColor) {
|
|
176
|
+
const pointStyle = {
|
|
177
|
+
'stroke-opacity': 1,
|
|
178
|
+
'stroke-width': '2px',
|
|
179
|
+
'stroke': channel.pointColor,
|
|
180
|
+
'fill-opacity': 1,
|
|
181
|
+
'fill': channel.pointColor
|
|
182
|
+
};
|
|
183
|
+
point.addClass('nv-mark-point');
|
|
184
|
+
point.css(pointStyle);
|
|
185
|
+
previousPoint.addClass('nv-mark-point');
|
|
186
|
+
previousPoint.css(pointStyle);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
hiddenCount++;
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
catch (e) {
|
|
198
|
+
console.log(e);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
143
201
|
getLineChart(chartWidth, chartHeight, data) {
|
|
144
202
|
const chart = nv.models.lineChart().showLegend(true)
|
|
145
203
|
.margin({ top: 0, bottom: 0, left: this.displayOption.marginLeft, right: this.displayOption.marginRight })
|
|
146
204
|
.noData(this.localization.chartNoData);
|
|
205
|
+
if (this.model.displaySetting.axisSetting.yAxisRangeType === AxisRangeType.Custom) {
|
|
206
|
+
chart.yDomain([this.model.displaySetting.axisSetting.yAxisMin, this.model.displaySetting.axisSetting.yAxisMax]);
|
|
207
|
+
}
|
|
147
208
|
if (!this.isMobileMode) {
|
|
148
209
|
chart.focusEnable(true);
|
|
149
210
|
chart.focus.margin({ top: 10, right: 0, bottom: 0, left: 0 });
|
|
@@ -151,11 +212,20 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
151
212
|
chart.focus.showXAxis(false);
|
|
152
213
|
}
|
|
153
214
|
this.renderCommonProperty(chart, chartWidth, chartHeight, data);
|
|
154
|
-
// if in Mobile mode and width is less than the min width, then hide operation area
|
|
155
|
-
if (this.isMobileMode && this.model.displaySetting.size.width < this.displayOption.mobileMinWidth) {
|
|
156
|
-
return chart;
|
|
157
|
-
}
|
|
158
215
|
this.renderOperationArea(chartWidth, chartHeight);
|
|
216
|
+
this.initPoint();
|
|
217
|
+
chart.legend.dispatch.on('legendClick', () => {
|
|
218
|
+
setTimeout(() => {
|
|
219
|
+
this.$element.find('.nv-mark-point').css({
|
|
220
|
+
'stroke-opacity': 0,
|
|
221
|
+
'stroke-width': 0,
|
|
222
|
+
'stroke': 'unset',
|
|
223
|
+
'fill-opacity': 0,
|
|
224
|
+
'fill': 'unset'
|
|
225
|
+
}).removeClass('nv-mark-point');
|
|
226
|
+
this.initPoint();
|
|
227
|
+
}, 1);
|
|
228
|
+
});
|
|
159
229
|
return chart;
|
|
160
230
|
}
|
|
161
231
|
getMultiBarWithFocusChart(chartWidth, chartHeight, data) {
|
|
@@ -172,16 +242,15 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
172
242
|
chart.multibar.stacked(true);
|
|
173
243
|
chart.multibar2.stacked(true);
|
|
174
244
|
}
|
|
245
|
+
if (this.model.displaySetting.axisSetting.yAxisRangeType === AxisRangeType.Custom) {
|
|
246
|
+
chart.yDomain([this.model.displaySetting.axisSetting.yAxisMin, this.model.displaySetting.axisSetting.yAxisMax]);
|
|
247
|
+
}
|
|
175
248
|
if (!this.isMobileMode) {
|
|
176
249
|
chart.focusEnable(true);
|
|
177
250
|
chart.focusShowAxisX(false);
|
|
178
251
|
}
|
|
179
252
|
chart.xAxis.tickFormat(d => this.timeFormat(d, '%x %X'));
|
|
180
253
|
this.renderCommonProperty(chart, chartWidth, chartHeight, data);
|
|
181
|
-
// if in Mobile mode and width is less than the min width, then hide operation area
|
|
182
|
-
if (this.isMobileMode && this.model.displaySetting.size.width < this.displayOption.mobileMinWidth) {
|
|
183
|
-
return chart;
|
|
184
|
-
}
|
|
185
254
|
this.renderOperationArea(chartWidth, chartHeight);
|
|
186
255
|
const focusContext = this.rootElement.select('.nv-context');
|
|
187
256
|
focusContext.select('.nv-barsWrap.nvd3-svg').attr('transform', 'translate(0,30)');
|
|
@@ -196,9 +265,27 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
196
265
|
return chart;
|
|
197
266
|
}
|
|
198
267
|
renderCommonProperty(chart, chartWidth, chartHeight, data) {
|
|
268
|
+
var _a, _b;
|
|
199
269
|
chart.tooltip.headerFormatter(d => this.timeFormat(d, '%x %X'));
|
|
200
270
|
if (this.model.displaySetting.showAxis) {
|
|
201
|
-
chart.xAxis.showMaxMin(true).tickFormat(d =>
|
|
271
|
+
chart.xAxis.showMaxMin(true).tickFormat(d => {
|
|
272
|
+
this.$element.find('.nv-mark-point').css({
|
|
273
|
+
'stroke-opacity': 0,
|
|
274
|
+
'stroke-width': 0,
|
|
275
|
+
'stroke': 'unset',
|
|
276
|
+
'fill-opacity': 0,
|
|
277
|
+
'fill': 'unset'
|
|
278
|
+
}).removeClass('nv-mark-point');
|
|
279
|
+
clearTimeout(this.timer);
|
|
280
|
+
this.timer = undefined;
|
|
281
|
+
this.timer = setTimeout(() => {
|
|
282
|
+
this.initPoint();
|
|
283
|
+
}, 100);
|
|
284
|
+
if (this.currentTimePeriod === 3 || this.currentTimePeriod === 4 || this.currentTimePeriod === 5) {
|
|
285
|
+
return this.timeFormat(d, '%y-%m-%d');
|
|
286
|
+
}
|
|
287
|
+
return this.timeFormat(Number(d), '%X');
|
|
288
|
+
});
|
|
202
289
|
if (this.model.displaySetting.axisSetting) {
|
|
203
290
|
if (this.model.displaySetting.axisSetting.showAxisLabel && this.model.displaySetting.axisSetting.axisLabelFont) {
|
|
204
291
|
chart.xAxis.fontSize(this.model.displaySetting.axisSetting.axisLabelFont.fontSize);
|
|
@@ -219,47 +306,145 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
219
306
|
chart.color(this.model.dataSetting.channels.map(c => c.connectorColor));
|
|
220
307
|
this.rootElement.append('g').datum(data).call(chart);
|
|
221
308
|
this.rootElement.selectAll('.nv-noData').attr('x', chartWidth / 2).attr('y', chartHeight / 2 + this.displayOption.operationAreaHeight);
|
|
222
|
-
nv.utils.windowResize(() => {
|
|
309
|
+
this.resizeEventListener = nv.utils.windowResize(() => {
|
|
223
310
|
chart.update();
|
|
224
311
|
this.rootElement.selectAll('.nv-noData').attr('x', chartWidth / 2).attr('y', chartHeight / 2 + this.displayOption.operationAreaHeight);
|
|
225
312
|
});
|
|
313
|
+
const fontSize = (_b = (_a = this.model.displaySetting.axisSetting) === null || _a === void 0 ? void 0 : _a.axisLabelFont) === null || _b === void 0 ? void 0 : _b.fontSize;
|
|
226
314
|
this.rootElement.selectAll('.domain').style('stroke-opacity', 1);
|
|
227
315
|
if (this.model.displaySetting.showAxis && this.model.displaySetting.axisSetting) {
|
|
228
316
|
const axisColor = this.model.displaySetting.axisSetting.axisColor;
|
|
229
317
|
this.rootElement.selectAll('.domain').style('stroke', axisColor);
|
|
230
|
-
if (this.model.displaySetting.axisSetting.showAxisLabel) {
|
|
231
|
-
const fontSize = this.model.displaySetting.axisSetting.axisLabelFont.fontSize;
|
|
318
|
+
if (fontSize && this.model.displaySetting.axisSetting.showAxisLabel) {
|
|
232
319
|
this.rootElement.selectAll('.nv-axisMaxMin').select('text').style('font-size', fontSize);
|
|
233
320
|
}
|
|
234
321
|
}
|
|
322
|
+
let strokeWidth = 0;
|
|
323
|
+
if (this.model.displaySetting.axisSetting.showTick !== false) {
|
|
324
|
+
strokeWidth = 1;
|
|
325
|
+
}
|
|
326
|
+
this.rootElement
|
|
327
|
+
.selectAll('.nv-x')
|
|
328
|
+
.selectAll('.tick')
|
|
329
|
+
.selectAll('line')
|
|
330
|
+
.attr('style', `stroke:${this.model.displaySetting.axisSetting.xAxisTickColor || 'rgb(127, 147, 159)'};stroke-width:${strokeWidth};`);
|
|
331
|
+
this.rootElement
|
|
332
|
+
.selectAll('.nv-y')
|
|
333
|
+
.selectAll('.tick')
|
|
334
|
+
.selectAll('line')
|
|
335
|
+
.attr('style', `stroke:${this.model.displaySetting.axisSetting.yAxisTickColor || 'rgb(127, 147, 159)'};stroke-width:${strokeWidth};`);
|
|
336
|
+
if (fontSize && this.currentTimePeriod === 3 || this.currentTimePeriod === 4 || this.currentTimePeriod === 5) {
|
|
337
|
+
const self = this;
|
|
338
|
+
this.rootElement
|
|
339
|
+
.selectAll('.nv-x')
|
|
340
|
+
.selectAll('.tick')
|
|
341
|
+
.selectAll('text')
|
|
342
|
+
.data(function (d) {
|
|
343
|
+
return [self.timeFormat(Number(d), '%y-%m-%d'), self.timeFormat(Number(d), '%H:%M:%S')];
|
|
344
|
+
})
|
|
345
|
+
.enter()
|
|
346
|
+
.append('text')
|
|
347
|
+
.attr('class', 'full-date')
|
|
348
|
+
.attr('x', 0)
|
|
349
|
+
.attr('y', 0)
|
|
350
|
+
.attr('dy', '2.3em')
|
|
351
|
+
.style('text-anchor', 'middle')
|
|
352
|
+
.style('font-size', fontSize)
|
|
353
|
+
.text((d) => d);
|
|
354
|
+
this.rootElement
|
|
355
|
+
.selectAll('.nv-axisMaxMin-x')
|
|
356
|
+
.selectAll('text')
|
|
357
|
+
.data(function (d) {
|
|
358
|
+
return [self.timeFormat(Number(d), '%y-%m-%d'), self.timeFormat(Number(d), '%H:%M:%S')];
|
|
359
|
+
})
|
|
360
|
+
.enter()
|
|
361
|
+
.append('text')
|
|
362
|
+
.attr('class', 'full-date')
|
|
363
|
+
.attr('x', 0)
|
|
364
|
+
.attr('y', 0)
|
|
365
|
+
.attr('dy', '2.3em')
|
|
366
|
+
.style('text-anchor', 'middle')
|
|
367
|
+
.style('font-size', fontSize)
|
|
368
|
+
.text((d) => d);
|
|
369
|
+
const focusWrap = this.rootElement.selectAll('.nv-focusWrap');
|
|
370
|
+
if (focusWrap.size()) {
|
|
371
|
+
let h = focusWrap.attr('transform');
|
|
372
|
+
if (h && h.length && h.indexOf(',') !== -1) {
|
|
373
|
+
h = h.slice(0, -1).split(',')[1];
|
|
374
|
+
this.rootElement
|
|
375
|
+
.selectAll('.nv-focusWrap')
|
|
376
|
+
.attr('transform', `translate(0,${Number(h) + 15})`);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
const resizeObserver = new window.MutationObserver(() => {
|
|
380
|
+
this.rootElement
|
|
381
|
+
.selectAll('.nv-x')
|
|
382
|
+
.selectAll('.tick')
|
|
383
|
+
.selectAll('.full-date')
|
|
384
|
+
.remove();
|
|
385
|
+
this.rootElement
|
|
386
|
+
.selectAll('.nv-x')
|
|
387
|
+
.selectAll('.tick')
|
|
388
|
+
.selectAll('text')
|
|
389
|
+
.data(function (d) {
|
|
390
|
+
return [self.timeFormat(Number(d), '%y-%m-%d'), self.timeFormat(Number(d), '%H:%M:%S')];
|
|
391
|
+
})
|
|
392
|
+
.enter()
|
|
393
|
+
.append('text')
|
|
394
|
+
.attr('class', 'full-date')
|
|
395
|
+
.attr('x', 0)
|
|
396
|
+
.attr('y', 0)
|
|
397
|
+
.attr('dy', '2.3em')
|
|
398
|
+
.style('text-anchor', 'middle')
|
|
399
|
+
.style('font-size', fontSize)
|
|
400
|
+
.text((d) => d);
|
|
401
|
+
});
|
|
402
|
+
const extent = document.getElementsByClassName('extent');
|
|
403
|
+
if (extent.length) {
|
|
404
|
+
resizeObserver.observe(extent[0], { attributes: true });
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
this.rootElement
|
|
409
|
+
.selectAll('.full-date')
|
|
410
|
+
.remove();
|
|
411
|
+
}
|
|
235
412
|
}
|
|
236
413
|
renderOperationArea(chartWidth, chartHeight) {
|
|
237
414
|
const operationArea = this.rootElement.append('g').attr('transform', `translate(0,${chartHeight + this.displayOption.operationAreaMarginTop})`)
|
|
238
415
|
.append('foreignObject').attr('width', chartWidth).attr('height', this.displayOption.operationAreaHeight).attr('fill', 'none')
|
|
239
416
|
.append('xhtml:div').style('height', (this.displayOption.operationAreaHeight - 4) + 'px').style('overflow', 'hidden').style('margin-top', '4px');
|
|
240
417
|
const selectElement = operationArea.append('select').style('margin-left', this.displayOption.marginLeft + 'px')
|
|
418
|
+
.style('background-color', 'inherit')
|
|
241
419
|
.style('font-size', this.displayOption.operationSelectFontSize).on('change', () => {
|
|
242
420
|
const displayTimePeriod = this.rootElement.select('select').property('value');
|
|
243
421
|
this.updateTimeRange(displayTimePeriod);
|
|
244
422
|
this.reRenderElement(this.startTime, this.endTime, this.displayOption.dataLimit, HistoricalCurveTimeRange.BeginOpenEndOpen);
|
|
245
423
|
});
|
|
424
|
+
const rect = this.$element.parent().parent().find('rect');
|
|
425
|
+
const fillColor = rect.attr('fill');
|
|
246
426
|
const options = selectElement.selectAll('option').data(this.timePeriods).enter().append('option');
|
|
247
|
-
options.text(d => d.name).attr('value', d => d.key).property('selected', d => d.key === Number(this.currentTimePeriod))
|
|
427
|
+
options.text(d => d.name).attr('value', d => d.key).property('selected', d => d.key === Number(this.currentTimePeriod))
|
|
428
|
+
.style('background-color', fillColor);
|
|
248
429
|
const buttonWidth = this.displayOption.operationButtonWidth + 'px', buttonHeight = this.displayOption.operationButtonHeight + 'px';
|
|
249
430
|
operationArea.append('button').style('width', buttonWidth).style('height', buttonHeight).style('border', 'none')
|
|
250
|
-
.style('float', 'right').style('background
|
|
431
|
+
.style('float', 'right').style('background-image', 'url(assets/img/last_page.svg)')
|
|
432
|
+
.style('background-color', 'inherit')
|
|
251
433
|
.on('click', () => { this.loadLastPage(); });
|
|
252
434
|
operationArea.append('button').style('width', buttonWidth).style('height', buttonHeight).style('border', 'none')
|
|
253
|
-
.style('float', 'right').style('background
|
|
435
|
+
.style('float', 'right').style('background-image', 'url(assets/img/next_page.svg)')
|
|
254
436
|
.style('margin', `0 ${this.displayOption.operationButtonMargin}px 0 0`)
|
|
437
|
+
.style('background-color', 'inherit')
|
|
255
438
|
.on('click', () => { this.loadNextPage(); });
|
|
256
439
|
operationArea.append('button').style('width', buttonWidth).style('height', buttonHeight).style('border', 'none')
|
|
257
|
-
.style('float', 'right').style('background
|
|
440
|
+
.style('float', 'right').style('background-image', 'url(assets/img/previous_page.svg)')
|
|
258
441
|
.style('margin', `0 ${this.displayOption.operationButtonMargin}px 0 0`)
|
|
442
|
+
.style('background-color', 'inherit')
|
|
259
443
|
.on('click', () => { this.loadPreviousPage(); });
|
|
260
444
|
operationArea.append('button').style('width', buttonWidth).style('height', buttonHeight).style('border', 'none')
|
|
261
|
-
.style('float', 'right').style('background
|
|
445
|
+
.style('float', 'right').style('background-image', 'url(assets/img/first_page.svg)')
|
|
262
446
|
.style('margin', `0 ${this.displayOption.operationButtonMargin}px 0 0`)
|
|
447
|
+
.style('background-color', 'inherit')
|
|
263
448
|
.on('click', () => { this.loadFirstPage(); });
|
|
264
449
|
}
|
|
265
450
|
timeFormat(datetime, specifier) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"HistoricalCurveElement":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../base/conditional-display-element","name":"ConditionalDisplayElement","line":
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"HistoricalCurveElement":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../base/conditional-display-element","name":"ConditionalDisplayElement","line":21,"character":44},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":66,"character":25,"context":{"typeName":"HTMLElement"}},{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":67,"character":18},{"__symbolic":"reference","module":"../../service","name":"PermissionChecker","line":68,"character":27},{"__symbolic":"reference","module":"../../communication","name":"VariableCommunicator","line":69,"character":30},{"__symbolic":"reference","module":"../../config","name":"VariableStore","line":70,"character":23},{"__symbolic":"reference","module":"../../config","name":"HistoryDataStore","line":71,"character":43},{"__symbolic":"reference","name":"string"}]}],"dispose":[{"__symbolic":"method"}],"getValidTimePeriods":[{"__symbolic":"method"}],"updateTimeRange":[{"__symbolic":"method"}],"updateQueryTimeRange":[{"__symbolic":"method"}],"reRenderElement":[{"__symbolic":"method"}],"renderElement":[{"__symbolic":"method"}],"renderChart":[{"__symbolic":"method"}],"initPoint":[{"__symbolic":"method"}],"getLineChart":[{"__symbolic":"method"}],"getMultiBarWithFocusChart":[{"__symbolic":"method"}],"renderCommonProperty":[{"__symbolic":"method"}],"renderOperationArea":[{"__symbolic":"method"}],"timeFormat":[{"__symbolic":"method"}],"loadFirstPage":[{"__symbolic":"method"}],"loadNextPage":[{"__symbolic":"method"}],"loadPreviousPage":[{"__symbolic":"method"}],"loadLastPage":[{"__symbolic":"method"}],"initElementStatus":[{"__symbolic":"method"}],"updateElementStatus":[{"__symbolic":"method"}],"setStatusAsUnbound":[{"__symbolic":"method"}],"setStatusAsLoading":[{"__symbolic":"method"}],"setStatusAsLoadFailed":[{"__symbolic":"method"}],"renderStatus":[{"__symbolic":"method"}],"clearStatus":[{"__symbolic":"method"}]}}}}]
|
package/elements/main-element.js
CHANGED
|
@@ -27,6 +27,8 @@ import { PolygonElement } from './vector-graphics/polygon-element';
|
|
|
27
27
|
import { HyperlinkElement } from './static-elements/hyperlink-element';
|
|
28
28
|
import { VideoElement } from './video/video-element';
|
|
29
29
|
import { WeatherElement } from './weather/weater-element';
|
|
30
|
+
import { AirQualityElement } from './air-quality/air-quality-element';
|
|
31
|
+
import { AlarmElement } from './alarm/alarm-element';
|
|
30
32
|
export class MainElement {
|
|
31
33
|
constructor(injector, bsModalService, context, variableCommunicator, popupViewService, signalRAppId) {
|
|
32
34
|
this.injector = injector;
|
|
@@ -58,7 +60,7 @@ export class MainElement {
|
|
|
58
60
|
const category = $(element).data('model').category;
|
|
59
61
|
switch (category) {
|
|
60
62
|
case GuiConsts.components.numericalDisplayKey:
|
|
61
|
-
const numericalDisplayElement = new NumericalDisplayElement(element, this.injector, this.bsModalService, this.context.permissionChecker, this.variableCommunicator, this.context.configStore.graphStore, this.context.operationRecordService, this.context.securityChecker, this.context.configStore.variableStore, this.injector.get(LOCALIZATION), this.signalRAppId);
|
|
63
|
+
const numericalDisplayElement = new NumericalDisplayElement(element, this.injector, this.bsModalService, this.context.permissionChecker, this.variableCommunicator, this.context.configStore.graphStore, this.context.operationRecordService, this.context.releasedVariableService, this.context.securityChecker, this.context.configStore.variableStore, this.injector.get(LOCALIZATION), this.signalRAppId);
|
|
62
64
|
this.elements.push(numericalDisplayElement);
|
|
63
65
|
break;
|
|
64
66
|
case GuiConsts.components.imageKey:
|
|
@@ -125,6 +127,12 @@ export class MainElement {
|
|
|
125
127
|
case GuiConsts.components.weatherKey:
|
|
126
128
|
this.elements.push(new WeatherElement(element, this.injector, this.context.permissionChecker, this.variableCommunicator, this.context.configStore.variableStore, this.context.weatherService, this.signalRAppId));
|
|
127
129
|
break;
|
|
130
|
+
case GuiConsts.components.airQualityKey:
|
|
131
|
+
this.elements.push(new AirQualityElement(element, this.injector, this.context.permissionChecker, this.variableCommunicator, this.context.configStore.variableStore, this.context.weatherService, this.signalRAppId));
|
|
132
|
+
break;
|
|
133
|
+
case GuiConsts.components.alarmKey:
|
|
134
|
+
this.elements.push(new AlarmElement(element, this.injector, this.context.permissionChecker, this.variableCommunicator, this.context.configStore.variableStore, this.context.configStore.alarmsStore, this.signalRAppId));
|
|
135
|
+
break;
|
|
128
136
|
}
|
|
129
137
|
});
|
|
130
138
|
this.initBackground();
|
|
@@ -204,7 +212,7 @@ export class MainElement {
|
|
|
204
212
|
initElementState() {
|
|
205
213
|
forEach(this.elements, element => {
|
|
206
214
|
if (element instanceof ReadableElement) {
|
|
207
|
-
element.init(element.readVariableName);
|
|
215
|
+
element.init(element.readVariableName || element.maxVariableName || element.minVariableName);
|
|
208
216
|
}
|
|
209
217
|
else if (element instanceof HistoricalCurveElement) {
|
|
210
218
|
element.initElementStatus();
|
|
@@ -215,8 +223,20 @@ export class MainElement {
|
|
|
215
223
|
getVariableNames() {
|
|
216
224
|
const variableNames = new Array();
|
|
217
225
|
forEach(this.elements, element => {
|
|
226
|
+
var _a, _b;
|
|
218
227
|
if (element instanceof ReadableElement) {
|
|
228
|
+
const maxVariableName = (_a = element) === null || _a === void 0 ? void 0 : _a.maxVariableName;
|
|
229
|
+
const maxValueType = element.maxValueType;
|
|
230
|
+
const minVariableName = (_b = element) === null || _b === void 0 ? void 0 : _b.minVariableName;
|
|
231
|
+
const minValueType = element.minValueType;
|
|
219
232
|
const variableName = element.readVariableName;
|
|
233
|
+
// 最大最小值选择变量类型时,其中一个未绑定变量不进行开点操作 - FLEXCLOUD-1817
|
|
234
|
+
if (maxValueType && maxVariableName && !variableNames.find(v => isEqual(maxVariableName, v))) {
|
|
235
|
+
variableNames.push(maxVariableName);
|
|
236
|
+
}
|
|
237
|
+
if (minValueType && minVariableName && !variableNames.find(v => isEqual(minVariableName, v))) {
|
|
238
|
+
variableNames.push(minVariableName);
|
|
239
|
+
}
|
|
220
240
|
if (variableName && !variableNames.find(v => isEqual(variableName, v))) {
|
|
221
241
|
variableNames.push(element.readVariableName);
|
|
222
242
|
}
|
|
@@ -242,7 +262,7 @@ export class MainElement {
|
|
|
242
262
|
each(values, value => {
|
|
243
263
|
each(this.elements, e => {
|
|
244
264
|
if (e instanceof ReadableElement) {
|
|
245
|
-
if (e.readVariableName === value.variableName) {
|
|
265
|
+
if (e.readVariableName === value.variableName || e.minVariableName === value.variableName || e.maxVariableName === value.variableName) {
|
|
246
266
|
e.reportValueChanged(value);
|
|
247
267
|
}
|
|
248
268
|
}
|
|
@@ -252,7 +272,8 @@ export class MainElement {
|
|
|
252
272
|
dispose() {
|
|
253
273
|
each(this.elements, e => {
|
|
254
274
|
if (e instanceof HistoricalCurveElement || e instanceof VideoElement
|
|
255
|
-
|| e instanceof WeatherElement || e instanceof NumericalDisplayElement || e instanceof TextElement
|
|
275
|
+
|| e instanceof WeatherElement || e instanceof NumericalDisplayElement || e instanceof TextElement
|
|
276
|
+
|| e instanceof AirQualityElement) {
|
|
256
277
|
e.dispose();
|
|
257
278
|
}
|
|
258
279
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"MainElement":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"MainElement":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":55,"character":43},{"__symbolic":"reference","module":"ngx-bootstrap/modal","name":"BsModalService","line":56,"character":41},{"__symbolic":"reference","module":"../gui/gui-context","name":"GuiContext","line":57,"character":34},{"__symbolic":"reference","module":"../communication","name":"VariableCommunicator","line":58,"character":47},{"__symbolic":"reference","module":"../view/popup-view.service","name":"PopupViewService","line":59,"character":43},null]}],"load":[{"__symbolic":"method"}],"uniformStretch":[{"__symbolic":"method"}],"changeVideoStyle":[{"__symbolic":"method"}],"horizontalStretch":[{"__symbolic":"method"}],"initElementState":[{"__symbolic":"method"}],"getVariableNames":[{"__symbolic":"method"}],"reportVariableStates":[{"__symbolic":"method"}],"reportVariableValues":[{"__symbolic":"method"}],"dispose":[{"__symbolic":"method"}],"checkIsLoaded":[{"__symbolic":"method"}],"initBackground":[{"__symbolic":"method"}],"getImageEl":[{"__symbolic":"method"}]}}}}]
|
|
@@ -5,16 +5,22 @@ import { ReadableElement } from './base';
|
|
|
5
5
|
import { VariableStore } from '../config';
|
|
6
6
|
import { PermissionChecker } from '../service';
|
|
7
7
|
export declare class MeterElement extends ReadableElement {
|
|
8
|
+
private static DEFAULT_MIN_VALUE;
|
|
9
|
+
private static DEFAULT_MAX_VALUE;
|
|
8
10
|
private readonly $handEl;
|
|
9
11
|
private readonly arcPath$;
|
|
10
12
|
private cx;
|
|
11
13
|
private cy;
|
|
12
14
|
private offsetY;
|
|
13
15
|
private mainElementTransform;
|
|
16
|
+
private valueObj;
|
|
17
|
+
private isNeedUpdateScale;
|
|
14
18
|
readonly model: Meter;
|
|
15
19
|
constructor(element: HTMLElement, permissionChecker: PermissionChecker, variableCommunicator: VariableCommunicator, variableStore: VariableStore, localization: Localization, signalRAppId: string);
|
|
16
|
-
|
|
20
|
+
private updateValueObj;
|
|
21
|
+
updateVariableValue(value: number, variableName: any): void;
|
|
17
22
|
private initFrameNode;
|
|
23
|
+
private updateScale;
|
|
18
24
|
private getAngle;
|
|
19
25
|
private directionPoint;
|
|
20
26
|
}
|
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
import { ReadableElement } from './base';
|
|
2
|
+
import { isNumber } from 'lodash';
|
|
3
|
+
import { VariableValueType } from '../model/shared/condition/variable-value-type';
|
|
2
4
|
export class MeterElement extends ReadableElement {
|
|
3
5
|
constructor(element, permissionChecker, variableCommunicator, variableStore, localization, signalRAppId) {
|
|
4
6
|
super(element, permissionChecker, variableCommunicator, variableStore, localization, signalRAppId);
|
|
5
7
|
this.cx = 0;
|
|
6
8
|
this.cy = 0;
|
|
7
9
|
this.offsetY = 0;
|
|
10
|
+
this.valueObj = {};
|
|
11
|
+
this.isNeedUpdateScale = false;
|
|
12
|
+
if ((this.model.minValueType === VariableValueType.Constant && this.model.maxValueType === VariableValueType.Variable)
|
|
13
|
+
|| this.model.maxValueType === VariableValueType.Constant && this.model.minValueType === VariableValueType.Variable) {
|
|
14
|
+
this.isNeedUpdateScale = true;
|
|
15
|
+
this.updateScale();
|
|
16
|
+
this.isNeedUpdateScale = false;
|
|
17
|
+
}
|
|
8
18
|
let mainEl$;
|
|
9
19
|
if (this.model.version && this.model.version > 3) {
|
|
10
20
|
mainEl$ = this.$element.find('[data-id="main"]');
|
|
@@ -31,18 +41,75 @@ export class MeterElement extends ReadableElement {
|
|
|
31
41
|
this.changeStates();
|
|
32
42
|
});
|
|
33
43
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
44
|
+
updateValueObj(value, variableName) {
|
|
45
|
+
var _a, _b, _c;
|
|
46
|
+
if (((_a = this.model.readVariable) === null || _a === void 0 ? void 0 : _a.name) === variableName) {
|
|
47
|
+
this.isNeedUpdateScale = false;
|
|
48
|
+
this.valueObj.value = value;
|
|
49
|
+
}
|
|
50
|
+
if (((_b = this.model.minVariable) === null || _b === void 0 ? void 0 : _b.name) === variableName) {
|
|
51
|
+
this.isNeedUpdateScale = true;
|
|
52
|
+
this.valueObj.min = value;
|
|
53
|
+
}
|
|
54
|
+
if (((_c = this.model.maxVariable) === null || _c === void 0 ? void 0 : _c.name) === variableName) {
|
|
55
|
+
this.isNeedUpdateScale = true;
|
|
56
|
+
this.valueObj.max = value;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
updateVariableValue(value, variableName) {
|
|
60
|
+
this.updateValueObj(value, variableName);
|
|
61
|
+
this.updateScale();
|
|
62
|
+
const angle = this.getAngle();
|
|
63
|
+
if (isNumber(angle)) {
|
|
64
|
+
this.$handEl.attr('transform', this.mainElementTransform + ` translate(0,${this.offsetY}) rotate(${angle}, ${this.cx}, ${this.cy})`);
|
|
65
|
+
}
|
|
37
66
|
}
|
|
38
67
|
initFrameNode() {
|
|
39
68
|
const b = Snap(this.$element[0]).getBBox();
|
|
40
69
|
this.rootElement.append('rect').attr('id', 'StateFrame').attr('width', b.width).attr('height', b.height).attr('fill', 'transparent');
|
|
41
70
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
71
|
+
updateScale() {
|
|
72
|
+
if (!this.isNeedUpdateScale) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
let min = this.model.minValueType ? this.valueObj.min : this.model.min;
|
|
76
|
+
let max = this.model.maxValueType ? this.valueObj.max : this.model.max;
|
|
77
|
+
min = Number(min);
|
|
78
|
+
max = Number(max);
|
|
79
|
+
if (isNaN(min) || isNaN(max)) {
|
|
80
|
+
min = MeterElement.DEFAULT_MIN_VALUE;
|
|
81
|
+
max = MeterElement.DEFAULT_MAX_VALUE;
|
|
82
|
+
}
|
|
83
|
+
const avgSacle = ((max - min) / this.model.masterDivisionNumber).toFixed(5);
|
|
84
|
+
const textElements = this.$element.find('g:first > text');
|
|
85
|
+
for (let i = 0; i < textElements.length; i++) {
|
|
86
|
+
const text = textElements[i];
|
|
87
|
+
if (!text.innerHTML) {
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
let sacleValue = ((Number(avgSacle) * i) + min).toFixed(0);
|
|
91
|
+
// 整数位和小数位格式化;
|
|
92
|
+
if (this.model.fractionDigits > 0) {
|
|
93
|
+
sacleValue = (sacleValue / Math.pow(10, this.model.fractionDigits)).toFixed(this.model.fractionDigits);
|
|
94
|
+
}
|
|
95
|
+
if (!isNaN(sacleValue)) {
|
|
96
|
+
text.innerHTML = sacleValue;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
getAngle() {
|
|
101
|
+
let min = this.model.minValueType ? this.valueObj.min : this.model.min;
|
|
102
|
+
let max = this.model.maxValueType ? this.valueObj.max : this.model.max;
|
|
103
|
+
min = Number(min);
|
|
104
|
+
max = Number(max);
|
|
105
|
+
if (isNaN(min) || isNaN(max)) {
|
|
106
|
+
min = MeterElement.DEFAULT_MIN_VALUE;
|
|
107
|
+
max = MeterElement.DEFAULT_MAX_VALUE;
|
|
108
|
+
}
|
|
109
|
+
if (!this.valueObj.value && isNaN(Number(this.valueObj.value))) {
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
const value = Math.min(Math.max(this.valueObj.value || 0, min), max);
|
|
46
113
|
const len = (value - min) / (max - min);
|
|
47
114
|
const arcPath = Snap(this.arcPath$[0]);
|
|
48
115
|
const b = arcPath.getBBox(true);
|
|
@@ -68,3 +135,5 @@ export class MeterElement extends ReadableElement {
|
|
|
68
135
|
return c;
|
|
69
136
|
}
|
|
70
137
|
}
|
|
138
|
+
MeterElement.DEFAULT_MIN_VALUE = 0;
|
|
139
|
+
MeterElement.DEFAULT_MAX_VALUE = 100;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"MeterElement":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"./base","name":"ReadableElement","line":
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"MeterElement":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"./base","name":"ReadableElement","line":9,"character":34},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":25,"character":25,"context":{"typeName":"HTMLElement"}},{"__symbolic":"reference","module":"../service","name":"PermissionChecker","line":25,"character":57},{"__symbolic":"reference","module":"../communication","name":"VariableCommunicator","line":26,"character":30},{"__symbolic":"reference","module":"../config","name":"VariableStore","line":26,"character":67},{"__symbolic":"reference","module":"../localization","name":"Localization","line":26,"character":96},{"__symbolic":"reference","name":"string"}]}],"updateValueObj":[{"__symbolic":"method"}],"updateVariableValue":[{"__symbolic":"method"}],"initFrameNode":[{"__symbolic":"method"}],"updateScale":[{"__symbolic":"method"}],"getAngle":[{"__symbolic":"method"}],"directionPoint":[{"__symbolic":"method"}]},"statics":{"DEFAULT_MIN_VALUE":0,"DEFAULT_MAX_VALUE":100}}}}]
|
|
@@ -3,7 +3,7 @@ import { BsModalService } from 'ngx-bootstrap/modal';
|
|
|
3
3
|
import { GraphStore, VariableStore } from '../../config';
|
|
4
4
|
import { Localization } from '../../localization';
|
|
5
5
|
import { NumericalDisplay } from '../../model';
|
|
6
|
-
import { PermissionChecker, OperationRecordService } from '../../service';
|
|
6
|
+
import { PermissionChecker, OperationRecordService, ReleasedVariableService } from '../../service';
|
|
7
7
|
import { VariableCommunicator } from '../../communication';
|
|
8
8
|
import { ReadableElement } from '../base/readable-element';
|
|
9
9
|
import { SecurityChecker } from '../../security';
|
|
@@ -11,6 +11,7 @@ export declare class NumericalDisplayElement extends ReadableElement {
|
|
|
11
11
|
private readonly modalService;
|
|
12
12
|
private readonly graphStore;
|
|
13
13
|
private readonly operationRecordService;
|
|
14
|
+
private readonly releasedVariableService;
|
|
14
15
|
private readonly securityChecker;
|
|
15
16
|
private readonly dataTypeService;
|
|
16
17
|
private readonly fractionDigitService;
|
|
@@ -21,8 +22,13 @@ export declare class NumericalDisplayElement extends ReadableElement {
|
|
|
21
22
|
private readonly logger;
|
|
22
23
|
private displayForeignObject;
|
|
23
24
|
private enableDataParsed;
|
|
25
|
+
private writeValueMmodalRef;
|
|
26
|
+
private recordValue;
|
|
27
|
+
private showValue;
|
|
28
|
+
private numericalOperation;
|
|
29
|
+
private restorationTimer;
|
|
24
30
|
get writeVariableName(): string;
|
|
25
|
-
constructor(element: HTMLElement, injector: Injector, modalService: BsModalService, permissionChecker: PermissionChecker, variableCommunicator: VariableCommunicator, graphStore: GraphStore, operationRecordService: OperationRecordService, securityChecker: SecurityChecker, variableStore: VariableStore, localization: Localization, signalRAppId: string);
|
|
31
|
+
constructor(element: HTMLElement, injector: Injector, modalService: BsModalService, permissionChecker: PermissionChecker, variableCommunicator: VariableCommunicator, graphStore: GraphStore, operationRecordService: OperationRecordService, releasedVariableService: ReleasedVariableService, securityChecker: SecurityChecker, variableStore: VariableStore, localization: Localization, signalRAppId: string);
|
|
26
32
|
dispose(): void;
|
|
27
33
|
initElement(): any;
|
|
28
34
|
private checkElementPassword;
|