@flexem/fc-gui 3.0.0-alpha.80 → 3.0.0-alpha.81
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 +5 -0
- package/bundles/@flexem/fc-gui.umd.js +72 -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/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -40047,11 +40047,17 @@ C140,111.8,99.2,158.4,78,178.6z M78,40.4c-17.8,0-32.4,14.4-32.4,32.2s14.5,32.2,3
|
|
|
40047
40047
|
|
|
40048
40048
|
|
|
40049
40049
|
|
|
40050
|
+
var AlaertElementStatus;
|
|
40051
|
+
(function (AlaertElementStatus) {
|
|
40052
|
+
AlaertElementStatus[AlaertElementStatus["Normal"] = 0] = "Normal";
|
|
40053
|
+
AlaertElementStatus[AlaertElementStatus["Loading"] = 1] = "Loading"; // 加载中
|
|
40054
|
+
})(AlaertElementStatus || (AlaertElementStatus = {}));
|
|
40050
40055
|
class alarm_element_AlarmElement extends conditional_display_element_ConditionalDisplayElement {
|
|
40051
40056
|
constructor(element, injector, permissionChecker, variableCommunicator, variableStore, alarmsStore, signalRAppId) {
|
|
40052
40057
|
var _a;
|
|
40053
40058
|
super(element, permissionChecker, variableCommunicator, variableStore, signalRAppId);
|
|
40054
40059
|
this.alarmsStore = alarmsStore;
|
|
40060
|
+
this.elementStatus = AlaertElementStatus.Loading;
|
|
40055
40061
|
this.displayOption = {
|
|
40056
40062
|
dataLimit: 500,
|
|
40057
40063
|
dataZoomHeight: 32,
|
|
@@ -40072,6 +40078,7 @@ class alarm_element_AlarmElement extends conditional_display_element_Conditional
|
|
|
40072
40078
|
this.totalCount = 0;
|
|
40073
40079
|
this.pageSize = 5;
|
|
40074
40080
|
this.rootElement.selectAll('*').remove();
|
|
40081
|
+
this.setStatusAsLoading();
|
|
40075
40082
|
this.logger = injector.get(logger["b" /* LOGGER_SERVICE_TOKEN */]);
|
|
40076
40083
|
this.localization = injector.get(_tmp_localization["b" /* LOCALIZATION */]);
|
|
40077
40084
|
this.variableCommunicator = variableCommunicator;
|
|
@@ -40092,13 +40099,13 @@ class alarm_element_AlarmElement extends conditional_display_element_Conditional
|
|
|
40092
40099
|
variableCommunicator.subscribeUserDeviceAlarms(signalRAppId).subscribe(alarms => {
|
|
40093
40100
|
alarms.forEach(alarm => {
|
|
40094
40101
|
if (this.alarmNames.indexOf(alarm.name) !== -1) {
|
|
40095
|
-
this.
|
|
40102
|
+
this.getAlarmData();
|
|
40096
40103
|
return;
|
|
40097
40104
|
}
|
|
40098
40105
|
});
|
|
40099
40106
|
});
|
|
40100
40107
|
}
|
|
40101
|
-
this.
|
|
40108
|
+
this.getAlarmData();
|
|
40102
40109
|
}
|
|
40103
40110
|
else {
|
|
40104
40111
|
this.totalCount = 0;
|
|
@@ -40124,7 +40131,9 @@ class alarm_element_AlarmElement extends conditional_display_element_Conditional
|
|
|
40124
40131
|
timePeriods.push({ key: 5, name: this.localization.lastOneYear });
|
|
40125
40132
|
return timePeriods;
|
|
40126
40133
|
}
|
|
40127
|
-
|
|
40134
|
+
getAlarmData() {
|
|
40135
|
+
this.rootElement.selectAll('*').remove();
|
|
40136
|
+
this.setStatusAsLoading();
|
|
40128
40137
|
clearTimeout(this.getAlarmDataId);
|
|
40129
40138
|
this.getAlarmDataId = setTimeout(() => {
|
|
40130
40139
|
if (this.model.filterSetting.alarmType) {
|
|
@@ -40151,7 +40160,7 @@ class alarm_element_AlarmElement extends conditional_display_element_Conditional
|
|
|
40151
40160
|
this.currentAlarmList = result.items;
|
|
40152
40161
|
if (!result.items.length && result.totalCount) {
|
|
40153
40162
|
this.page = 0;
|
|
40154
|
-
this.
|
|
40163
|
+
this.getAlarmData();
|
|
40155
40164
|
return;
|
|
40156
40165
|
}
|
|
40157
40166
|
this.alarmList = this.currentAlarmList.map(item => [
|
|
@@ -40167,7 +40176,6 @@ class alarm_element_AlarmElement extends conditional_display_element_Conditional
|
|
|
40167
40176
|
}, 500);
|
|
40168
40177
|
}
|
|
40169
40178
|
renderElement() {
|
|
40170
|
-
this.rootElement.selectAll('*').remove();
|
|
40171
40179
|
const elementHeight = this.model.size.height;
|
|
40172
40180
|
this.element = document.createElementNS('http://www.w3.org/2000/svg', 'foreignObject');
|
|
40173
40181
|
this.element.setAttribute('width', this.model.size.width.toString());
|
|
@@ -40279,7 +40287,7 @@ class alarm_element_AlarmElement extends conditional_display_element_Conditional
|
|
|
40279
40287
|
.style('font-size', this.displayOption.operationSelectFontSize).on('change', () => {
|
|
40280
40288
|
const displayTimePeriod = this.rootElement.select('select').property('value');
|
|
40281
40289
|
this.updateTimeRange(displayTimePeriod);
|
|
40282
|
-
this.
|
|
40290
|
+
this.getAlarmData();
|
|
40283
40291
|
});
|
|
40284
40292
|
const options = selectElement.selectAll('option').data(this.timePeriods).enter().append('option');
|
|
40285
40293
|
options.text(d => d.name).attr('value', d => d.key).property('selected', d => d.key === Number(this.currentTimePeriod));
|
|
@@ -40300,6 +40308,7 @@ class alarm_element_AlarmElement extends conditional_display_element_Conditional
|
|
|
40300
40308
|
.style('float', 'right').style('background', 'white').style('background-image', 'url(assets/img/first_page.svg)')
|
|
40301
40309
|
.style('margin', `0 ${this.displayOption.operationButtonMargin}px 0 0`)
|
|
40302
40310
|
.on('click', () => { this.loadFirstPage(); });
|
|
40311
|
+
this.setStatusAsNormal();
|
|
40303
40312
|
}
|
|
40304
40313
|
updateTimeRange(timePeriodType) {
|
|
40305
40314
|
this.currentTimePeriod = +timePeriodType;
|
|
@@ -40333,7 +40342,7 @@ class alarm_element_AlarmElement extends conditional_display_element_Conditional
|
|
|
40333
40342
|
loadFirstPage() {
|
|
40334
40343
|
if (this.page > 0) {
|
|
40335
40344
|
this.page = 0;
|
|
40336
|
-
this.
|
|
40345
|
+
this.getAlarmData();
|
|
40337
40346
|
}
|
|
40338
40347
|
}
|
|
40339
40348
|
loadNextPage() {
|
|
@@ -40342,13 +40351,13 @@ class alarm_element_AlarmElement extends conditional_display_element_Conditional
|
|
|
40342
40351
|
last_page--;
|
|
40343
40352
|
if (this.page < last_page) {
|
|
40344
40353
|
this.page++;
|
|
40345
|
-
this.
|
|
40354
|
+
this.getAlarmData();
|
|
40346
40355
|
}
|
|
40347
40356
|
}
|
|
40348
40357
|
loadPreviousPage() {
|
|
40349
40358
|
if (this.page > 0) {
|
|
40350
40359
|
this.page--;
|
|
40351
|
-
this.
|
|
40360
|
+
this.getAlarmData();
|
|
40352
40361
|
}
|
|
40353
40362
|
}
|
|
40354
40363
|
loadLastPage() {
|
|
@@ -40357,8 +40366,61 @@ class alarm_element_AlarmElement extends conditional_display_element_Conditional
|
|
|
40357
40366
|
last_page--;
|
|
40358
40367
|
if (this.page !== last_page) {
|
|
40359
40368
|
this.page = last_page;
|
|
40360
|
-
this.
|
|
40369
|
+
this.getAlarmData();
|
|
40370
|
+
}
|
|
40371
|
+
}
|
|
40372
|
+
setStatusAsNormal() {
|
|
40373
|
+
this.elementStatus = AlaertElementStatus.Normal;
|
|
40374
|
+
this.clearStatus();
|
|
40375
|
+
}
|
|
40376
|
+
setStatusAsLoading() {
|
|
40377
|
+
this.elementStatus = AlaertElementStatus.Loading;
|
|
40378
|
+
this.renderStatus('assets/img/loading.svg', '#226abc');
|
|
40379
|
+
}
|
|
40380
|
+
renderStatus(icon, stroke) {
|
|
40381
|
+
if (this.elementStatus === AlaertElementStatus.Normal) {
|
|
40382
|
+
this.clearStatus();
|
|
40383
|
+
return;
|
|
40384
|
+
}
|
|
40385
|
+
this.rootElement.append('rect').attr('id', 'StateFrame').attr('fill', 'transparent')
|
|
40386
|
+
.attr('width', this.model.size.width)
|
|
40387
|
+
.attr('height', this.model.size.height);
|
|
40388
|
+
const document = this.$element[0].ownerDocument;
|
|
40389
|
+
const currentRect = this.$element.find('rect#StateFrame').first();
|
|
40390
|
+
if (!currentRect.length) {
|
|
40391
|
+
return;
|
|
40392
|
+
}
|
|
40393
|
+
this.$element.find('image#StateImage').remove();
|
|
40394
|
+
const imgObj = document.createElementNS('http://www.w3.org/2000/svg', 'image');
|
|
40395
|
+
if (imgObj) {
|
|
40396
|
+
let x = Number(currentRect[0].getAttribute('width')) - 20;
|
|
40397
|
+
const currentRectX = currentRect[0].getAttribute('x');
|
|
40398
|
+
if (currentRectX !== null) {
|
|
40399
|
+
x += Number(currentRectX);
|
|
40400
|
+
}
|
|
40401
|
+
currentRect[0].setAttribute('stroke', stroke);
|
|
40402
|
+
currentRect[0].setAttribute('stroke-opacity', '0.5');
|
|
40403
|
+
imgObj.href.baseVal = icon;
|
|
40404
|
+
imgObj.setAttributeNS(null, 'id', 'StateImage');
|
|
40405
|
+
imgObj.setAttributeNS(null, 'x', x.toString());
|
|
40406
|
+
imgObj.setAttributeNS(null, 'y', '0');
|
|
40407
|
+
imgObj.setAttributeNS(null, 'height', '20px');
|
|
40408
|
+
imgObj.setAttributeNS(null, 'width', '20px');
|
|
40409
|
+
const titleElement = document.createElementNS('http://www.w3.org/2000/svg', 'title');
|
|
40410
|
+
imgObj.appendChild(titleElement);
|
|
40411
|
+
this.$element.append(imgObj);
|
|
40412
|
+
}
|
|
40413
|
+
}
|
|
40414
|
+
clearStatus() {
|
|
40415
|
+
const currentRect = this.$element.find('rect#StateFrame').first();
|
|
40416
|
+
if (!currentRect.length) {
|
|
40417
|
+
return;
|
|
40418
|
+
}
|
|
40419
|
+
const stroke = currentRect[0].getAttribute('stroke');
|
|
40420
|
+
if (stroke) {
|
|
40421
|
+
currentRect[0].removeAttribute('stroke');
|
|
40361
40422
|
}
|
|
40423
|
+
this.$element.find('image#StateImage').remove();
|
|
40362
40424
|
}
|
|
40363
40425
|
}
|
|
40364
40426
|
|