@flexem/fc-gui 3.0.0-alpha.80 → 3.0.0-alpha.82
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 +10 -0
- package/bundles/@flexem/fc-gui.umd.js +86 -10
- package/bundles/@flexem/fc-gui.umd.js.map +1 -1
- package/bundles/@flexem/fc-gui.umd.min.js +1 -1
- package/bundles/@flexem/fc-gui.umd.min.js.map +1 -1
- package/elements/alarm/alarm-element.d.ts +6 -1
- package/elements/alarm/alarm-element.js +72 -10
- package/elements/alarm/alarm-element.metadata.json +1 -1
- package/elements/historical-curve/historical-curve.element.js +14 -0
- package/model/historical-curve/historical-curve-axis-settings.d.ts +3 -0
- package/package.json +1 -1
|
@@ -11,6 +11,7 @@ export declare class AlarmElement extends ConditionalDisplayElement {
|
|
|
11
11
|
readonly variableCommunicator: VariableCommunicator;
|
|
12
12
|
private readonly localization;
|
|
13
13
|
private readonly timePeriods;
|
|
14
|
+
private elementStatus;
|
|
14
15
|
private element;
|
|
15
16
|
private refreshIntervalId;
|
|
16
17
|
private readonly displayOption;
|
|
@@ -27,7 +28,7 @@ export declare class AlarmElement extends ConditionalDisplayElement {
|
|
|
27
28
|
constructor(element: HTMLElement, injector: Injector, permissionChecker: PermissionChecker, variableCommunicator: VariableCommunicator, variableStore: VariableStore, alarmsStore: AlarmsStore, signalRAppId: string);
|
|
28
29
|
dispose(): void;
|
|
29
30
|
private getValidTimePeriods;
|
|
30
|
-
private
|
|
31
|
+
private getAlarmData;
|
|
31
32
|
private renderElement;
|
|
32
33
|
private renderOperationArea;
|
|
33
34
|
private updateTimeRange;
|
|
@@ -36,4 +37,8 @@ export declare class AlarmElement extends ConditionalDisplayElement {
|
|
|
36
37
|
private loadNextPage;
|
|
37
38
|
private loadPreviousPage;
|
|
38
39
|
private loadLastPage;
|
|
40
|
+
private setStatusAsNormal;
|
|
41
|
+
private setStatusAsLoading;
|
|
42
|
+
private renderStatus;
|
|
43
|
+
private clearStatus;
|
|
39
44
|
}
|
|
@@ -4,11 +4,17 @@ import { GetAlarmsArgs } from '../../config';
|
|
|
4
4
|
import * as moment from 'moment';
|
|
5
5
|
import { LOGGER_SERVICE_TOKEN } from '../../logger';
|
|
6
6
|
import { LOCALIZATION } from '../../localization';
|
|
7
|
+
var AlaertElementStatus;
|
|
8
|
+
(function (AlaertElementStatus) {
|
|
9
|
+
AlaertElementStatus[AlaertElementStatus["Normal"] = 0] = "Normal";
|
|
10
|
+
AlaertElementStatus[AlaertElementStatus["Loading"] = 1] = "Loading"; // 加载中
|
|
11
|
+
})(AlaertElementStatus || (AlaertElementStatus = {}));
|
|
7
12
|
export class AlarmElement extends ConditionalDisplayElement {
|
|
8
13
|
constructor(element, injector, permissionChecker, variableCommunicator, variableStore, alarmsStore, signalRAppId) {
|
|
9
14
|
var _a;
|
|
10
15
|
super(element, permissionChecker, variableCommunicator, variableStore, signalRAppId);
|
|
11
16
|
this.alarmsStore = alarmsStore;
|
|
17
|
+
this.elementStatus = AlaertElementStatus.Loading;
|
|
12
18
|
this.displayOption = {
|
|
13
19
|
dataLimit: 500,
|
|
14
20
|
dataZoomHeight: 32,
|
|
@@ -29,6 +35,7 @@ export class AlarmElement extends ConditionalDisplayElement {
|
|
|
29
35
|
this.totalCount = 0;
|
|
30
36
|
this.pageSize = 5;
|
|
31
37
|
this.rootElement.selectAll('*').remove();
|
|
38
|
+
this.setStatusAsLoading();
|
|
32
39
|
this.logger = injector.get(LOGGER_SERVICE_TOKEN);
|
|
33
40
|
this.localization = injector.get(LOCALIZATION);
|
|
34
41
|
this.variableCommunicator = variableCommunicator;
|
|
@@ -49,13 +56,13 @@ export class AlarmElement extends ConditionalDisplayElement {
|
|
|
49
56
|
variableCommunicator.subscribeUserDeviceAlarms(signalRAppId).subscribe(alarms => {
|
|
50
57
|
alarms.forEach(alarm => {
|
|
51
58
|
if (this.alarmNames.indexOf(alarm.name) !== -1) {
|
|
52
|
-
this.
|
|
59
|
+
this.getAlarmData();
|
|
53
60
|
return;
|
|
54
61
|
}
|
|
55
62
|
});
|
|
56
63
|
});
|
|
57
64
|
}
|
|
58
|
-
this.
|
|
65
|
+
this.getAlarmData();
|
|
59
66
|
}
|
|
60
67
|
else {
|
|
61
68
|
this.totalCount = 0;
|
|
@@ -81,7 +88,9 @@ export class AlarmElement extends ConditionalDisplayElement {
|
|
|
81
88
|
timePeriods.push({ key: 5, name: this.localization.lastOneYear });
|
|
82
89
|
return timePeriods;
|
|
83
90
|
}
|
|
84
|
-
|
|
91
|
+
getAlarmData() {
|
|
92
|
+
this.rootElement.selectAll('*').remove();
|
|
93
|
+
this.setStatusAsLoading();
|
|
85
94
|
clearTimeout(this.getAlarmDataId);
|
|
86
95
|
this.getAlarmDataId = setTimeout(() => {
|
|
87
96
|
if (this.model.filterSetting.alarmType) {
|
|
@@ -108,7 +117,7 @@ export class AlarmElement extends ConditionalDisplayElement {
|
|
|
108
117
|
this.currentAlarmList = result.items;
|
|
109
118
|
if (!result.items.length && result.totalCount) {
|
|
110
119
|
this.page = 0;
|
|
111
|
-
this.
|
|
120
|
+
this.getAlarmData();
|
|
112
121
|
return;
|
|
113
122
|
}
|
|
114
123
|
this.alarmList = this.currentAlarmList.map(item => [
|
|
@@ -124,7 +133,6 @@ export class AlarmElement extends ConditionalDisplayElement {
|
|
|
124
133
|
}, 500);
|
|
125
134
|
}
|
|
126
135
|
renderElement() {
|
|
127
|
-
this.rootElement.selectAll('*').remove();
|
|
128
136
|
const elementHeight = this.model.size.height;
|
|
129
137
|
this.element = document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject');
|
|
130
138
|
this.element.setAttribute('width', this.model.size.width.toString());
|
|
@@ -236,7 +244,7 @@ export class AlarmElement extends ConditionalDisplayElement {
|
|
|
236
244
|
.style('font-size', this.displayOption.operationSelectFontSize).on('change', () => {
|
|
237
245
|
const displayTimePeriod = this.rootElement.select('select').property('value');
|
|
238
246
|
this.updateTimeRange(displayTimePeriod);
|
|
239
|
-
this.
|
|
247
|
+
this.getAlarmData();
|
|
240
248
|
});
|
|
241
249
|
const options = selectElement.selectAll('option').data(this.timePeriods).enter().append('option');
|
|
242
250
|
options.text(d => d.name).attr('value', d => d.key).property('selected', d => d.key === Number(this.currentTimePeriod));
|
|
@@ -257,6 +265,7 @@ export class AlarmElement extends ConditionalDisplayElement {
|
|
|
257
265
|
.style('float', 'right').style('background', 'white').style('background-image', 'url(assets/img/first_page.svg)')
|
|
258
266
|
.style('margin', `0 ${this.displayOption.operationButtonMargin}px 0 0`)
|
|
259
267
|
.on('click', () => { this.loadFirstPage(); });
|
|
268
|
+
this.setStatusAsNormal();
|
|
260
269
|
}
|
|
261
270
|
updateTimeRange(timePeriodType) {
|
|
262
271
|
this.currentTimePeriod = +timePeriodType;
|
|
@@ -290,7 +299,7 @@ export class AlarmElement extends ConditionalDisplayElement {
|
|
|
290
299
|
loadFirstPage() {
|
|
291
300
|
if (this.page > 0) {
|
|
292
301
|
this.page = 0;
|
|
293
|
-
this.
|
|
302
|
+
this.getAlarmData();
|
|
294
303
|
}
|
|
295
304
|
}
|
|
296
305
|
loadNextPage() {
|
|
@@ -299,13 +308,13 @@ export class AlarmElement extends ConditionalDisplayElement {
|
|
|
299
308
|
last_page--;
|
|
300
309
|
if (this.page < last_page) {
|
|
301
310
|
this.page++;
|
|
302
|
-
this.
|
|
311
|
+
this.getAlarmData();
|
|
303
312
|
}
|
|
304
313
|
}
|
|
305
314
|
loadPreviousPage() {
|
|
306
315
|
if (this.page > 0) {
|
|
307
316
|
this.page--;
|
|
308
|
-
this.
|
|
317
|
+
this.getAlarmData();
|
|
309
318
|
}
|
|
310
319
|
}
|
|
311
320
|
loadLastPage() {
|
|
@@ -314,7 +323,60 @@ export class AlarmElement extends ConditionalDisplayElement {
|
|
|
314
323
|
last_page--;
|
|
315
324
|
if (this.page !== last_page) {
|
|
316
325
|
this.page = last_page;
|
|
317
|
-
this.
|
|
326
|
+
this.getAlarmData();
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
setStatusAsNormal() {
|
|
330
|
+
this.elementStatus = AlaertElementStatus.Normal;
|
|
331
|
+
this.clearStatus();
|
|
332
|
+
}
|
|
333
|
+
setStatusAsLoading() {
|
|
334
|
+
this.elementStatus = AlaertElementStatus.Loading;
|
|
335
|
+
this.renderStatus('assets/img/loading.svg', '#226abc');
|
|
336
|
+
}
|
|
337
|
+
renderStatus(icon, stroke) {
|
|
338
|
+
if (this.elementStatus === AlaertElementStatus.Normal) {
|
|
339
|
+
this.clearStatus();
|
|
340
|
+
return;
|
|
341
|
+
}
|
|
342
|
+
this.rootElement.append('rect').attr('id', 'StateFrame').attr('fill', 'transparent')
|
|
343
|
+
.attr('width', this.model.size.width)
|
|
344
|
+
.attr('height', this.model.size.height);
|
|
345
|
+
const document = this.$element[0].ownerDocument;
|
|
346
|
+
const currentRect = this.$element.find('rect#StateFrame').first();
|
|
347
|
+
if (!currentRect.length) {
|
|
348
|
+
return;
|
|
349
|
+
}
|
|
350
|
+
this.$element.find('image#StateImage').remove();
|
|
351
|
+
const imgObj = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
|
352
|
+
if (imgObj) {
|
|
353
|
+
let x = Number(currentRect[0].getAttribute('width')) - 20;
|
|
354
|
+
const currentRectX = currentRect[0].getAttribute('x');
|
|
355
|
+
if (currentRectX !== null) {
|
|
356
|
+
x += Number(currentRectX);
|
|
357
|
+
}
|
|
358
|
+
currentRect[0].setAttribute('stroke', stroke);
|
|
359
|
+
currentRect[0].setAttribute('stroke-opacity', '0.5');
|
|
360
|
+
imgObj.href.baseVal = icon;
|
|
361
|
+
imgObj.setAttributeNS(null, 'id', 'StateImage');
|
|
362
|
+
imgObj.setAttributeNS(null, 'x', x.toString());
|
|
363
|
+
imgObj.setAttributeNS(null, 'y', '0');
|
|
364
|
+
imgObj.setAttributeNS(null, 'height', '20px');
|
|
365
|
+
imgObj.setAttributeNS(null, 'width', '20px');
|
|
366
|
+
const titleElement = document.createElementNS('http://www.w3.org/2000/svg', 'title');
|
|
367
|
+
imgObj.appendChild(titleElement);
|
|
368
|
+
this.$element.append(imgObj);
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
clearStatus() {
|
|
372
|
+
const currentRect = this.$element.find('rect#StateFrame').first();
|
|
373
|
+
if (!currentRect.length) {
|
|
374
|
+
return;
|
|
375
|
+
}
|
|
376
|
+
const stroke = currentRect[0].getAttribute('stroke');
|
|
377
|
+
if (stroke) {
|
|
378
|
+
currentRect[0].removeAttribute('stroke');
|
|
318
379
|
}
|
|
380
|
+
this.$element.find('image#StateImage').remove();
|
|
319
381
|
}
|
|
320
382
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"AlarmElement":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../base/conditional-display-element","name":"ConditionalDisplayElement","line":
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"AlarmElement":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../base/conditional-display-element","name":"ConditionalDisplayElement","line":20,"character":34},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":54,"character":25,"context":{"typeName":"HTMLElement"}},{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":55,"character":18},{"__symbolic":"reference","module":"../../service","name":"PermissionChecker","line":56,"character":27},{"__symbolic":"reference","module":"../../communication","name":"VariableCommunicator","line":57,"character":30},{"__symbolic":"reference","module":"../../config","name":"VariableStore","line":58,"character":23},{"__symbolic":"reference","module":"../../config","name":"AlarmsStore","line":59,"character":38},{"__symbolic":"reference","name":"string"}]}],"dispose":[{"__symbolic":"method"}],"getValidTimePeriods":[{"__symbolic":"method"}],"getAlarmData":[{"__symbolic":"method"}],"renderElement":[{"__symbolic":"method"}],"renderOperationArea":[{"__symbolic":"method"}],"updateTimeRange":[{"__symbolic":"method"}],"updateQueryTimeRange":[{"__symbolic":"method"}],"loadFirstPage":[{"__symbolic":"method"}],"loadNextPage":[{"__symbolic":"method"}],"loadPreviousPage":[{"__symbolic":"method"}],"loadLastPage":[{"__symbolic":"method"}],"setStatusAsNormal":[{"__symbolic":"method"}],"setStatusAsLoading":[{"__symbolic":"method"}],"renderStatus":[{"__symbolic":"method"}],"clearStatus":[{"__symbolic":"method"}]}}}}]
|
|
@@ -245,6 +245,20 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
245
245
|
this.rootElement.selectAll('.nv-axisMaxMin').select('text').style('font-size', fontSize);
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
+
let strokeWidth = 0;
|
|
249
|
+
if (this.model.displaySetting.axisSetting.showTick !== false) {
|
|
250
|
+
strokeWidth = 1;
|
|
251
|
+
}
|
|
252
|
+
this.rootElement
|
|
253
|
+
.selectAll('.nv-x')
|
|
254
|
+
.selectAll('.tick')
|
|
255
|
+
.selectAll('line')
|
|
256
|
+
.attr('style', `stroke:${this.model.displaySetting.axisSetting.xAxisTickColor || 'rgb(127, 147, 159)'};stroke-width:${strokeWidth};`);
|
|
257
|
+
this.rootElement
|
|
258
|
+
.selectAll('.nv-y')
|
|
259
|
+
.selectAll('.tick')
|
|
260
|
+
.selectAll('line')
|
|
261
|
+
.attr('style', `stroke:${this.model.displaySetting.axisSetting.yAxisTickColor || 'rgb(127, 147, 159)'};stroke-width:${strokeWidth};`);
|
|
248
262
|
if (fontSize && this.currentTimePeriod === 3 || this.currentTimePeriod === 4 || this.currentTimePeriod === 5) {
|
|
249
263
|
const self = this;
|
|
250
264
|
this.rootElement
|
|
@@ -6,6 +6,9 @@ export interface HistoricalCurveAxisSettings {
|
|
|
6
6
|
readonly axisColor: string;
|
|
7
7
|
readonly showAxisLabel: boolean;
|
|
8
8
|
readonly axisLabelFont: Font;
|
|
9
|
+
readonly showTick?: boolean;
|
|
10
|
+
readonly xAxisTickColor?: string;
|
|
11
|
+
readonly yAxisTickColor?: string;
|
|
9
12
|
}
|
|
10
13
|
export declare enum AxisRangeType {
|
|
11
14
|
Auto = 0,
|