@flexem/fc-gui 3.0.0-alpha.180 → 3.0.0-alpha.181
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 +618 -223
- package/bundles/@flexem/fc-gui.umd.js.map +1 -1
- package/bundles/@flexem/fc-gui.umd.min.js +4 -4
- package/bundles/@flexem/fc-gui.umd.min.js.map +1 -1
- package/elements/alarm/alarm-element.d.ts +20 -0
- package/elements/alarm/alarm-element.js +312 -70
- package/elements/alarm/alarm-element.metadata.json +1 -1
- package/elements/base/state-control-element.d.ts +10 -0
- package/elements/base/state-control-element.js +21 -3
- package/elements/base/state-control-element.metadata.json +1 -1
- package/elements/character-display/character-display-element.d.ts +9 -0
- package/elements/character-display/character-display-element.js +15 -0
- package/elements/character-display/character-display-element.metadata.json +1 -1
- package/elements/historical-curve/historical-curve.element.d.ts +1 -0
- package/elements/historical-curve/historical-curve.element.js +35 -22
- package/elements/historical-curve/historical-curve.element.metadata.json +1 -1
- package/elements/main-element.js +2 -1
- package/elements/numerical-display/numerical-display-element.d.ts +9 -0
- package/elements/numerical-display/numerical-display-element.js +15 -0
- package/elements/numerical-display/numerical-display-element.metadata.json +1 -1
- package/elements/switch-indicator-light/switch-indicator-light-element.d.ts +9 -0
- package/elements/switch-indicator-light/switch-indicator-light-element.js +15 -0
- package/elements/switch-indicator-light/switch-indicator-light-element.metadata.json +1 -1
- package/elements/view-operation/view-operation.element.js +2 -1
- package/gui/gui-view.d.ts +15 -1
- package/gui/gui-view.js +78 -4
- package/gui/gui-view.metadata.json +1 -1
- package/model/alarm/alarm.model.d.ts +1 -0
- package/model/character-display/character-display.d.ts +1 -0
- package/model/historical-curve/historical-curve.display-settings.d.ts +1 -0
- package/model/numerical-display/numerical-display.d.ts +1 -0
- package/model/settings/popup/view-popup-location-type.d.ts +2 -1
- package/model/settings/popup/view-popup-location-type.js +1 -0
- package/model/settings/popup/view-popup-location-type.metadata.json +1 -1
- package/model/switch-indicator-light/switch-indicator-light.d.ts +1 -0
- package/package.json +1 -1
- package/view/popup-view.service.d.ts +1 -1
|
@@ -309,4 +309,19 @@ export class CharacterDisplayElement extends ReadableElement {
|
|
|
309
309
|
this.rootElement.select('image').attr('xlink:href', null);
|
|
310
310
|
}
|
|
311
311
|
}
|
|
312
|
+
/**
|
|
313
|
+
* 提供元件尺寸信息用于状态图标缩放
|
|
314
|
+
*/
|
|
315
|
+
getElementSizeForIconScale() {
|
|
316
|
+
var _a, _b;
|
|
317
|
+
if (this.model.size) {
|
|
318
|
+
return {
|
|
319
|
+
width: this.model.size.width,
|
|
320
|
+
height: this.model.size.height,
|
|
321
|
+
initWidth: (_a = this.model.initSize) === null || _a === void 0 ? void 0 : _a.width,
|
|
322
|
+
initHeight: (_b = this.model.initSize) === null || _b === void 0 ? void 0 : _b.height
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
return null;
|
|
326
|
+
}
|
|
312
327
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"CharacterDisplayElement":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../base/readable-element","name":"ReadableElement","line":20,"character":45},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":29,"character":25,"context":{"typeName":"HTMLElement"}},{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":29,"character":48},{"__symbolic":"reference","module":"ngx-bootstrap/modal","name":"BsModalService","line":30,"character":39},{"__symbolic":"reference","module":"../../communication","name":"VariableCommunicator","line":31,"character":30},{"__symbolic":"reference","module":"../../config","name":"GraphStore","line":32,"character":37},{"__symbolic":"reference","module":"../../service","name":"PermissionChecker","line":33,"character":27},{"__symbolic":"reference","module":"../../service","name":"OperationRecordService","line":34,"character":49},{"__symbolic":"reference","module":"../../security","name":"SecurityChecker","line":35,"character":42},{"__symbolic":"reference","module":"../../config","name":"VariableStore","line":36,"character":23},{"__symbolic":"reference","module":"../../localization","name":"Localization","line":37,"character":22},{"__symbolic":"reference","name":"string"}]}],"updateVariableValue":[{"__symbolic":"method"}],"changeStates":[{"__symbolic":"method"}],"updateDisplayValue":[{"__symbolic":"method"}],"getVariableValueText":[{"__symbolic":"method"}],"characterDisplayText":[{"__symbolic":"method"}],"initElement":[{"__symbolic":"method"}],"initVariableText":[{"__symbolic":"method"}],"initClickEvent":[{"__symbolic":"method"}],"checkElementPassword":[{"__symbolic":"method"}],"doWriteCharacterValue":[{"__symbolic":"method"}],"recordOperation":[{"__symbolic":"method"}],"changeGraph":[{"__symbolic":"method"}]}}}}]
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"CharacterDisplayElement":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../base/readable-element","name":"ReadableElement","line":20,"character":45},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":29,"character":25,"context":{"typeName":"HTMLElement"}},{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":29,"character":48},{"__symbolic":"reference","module":"ngx-bootstrap/modal","name":"BsModalService","line":30,"character":39},{"__symbolic":"reference","module":"../../communication","name":"VariableCommunicator","line":31,"character":30},{"__symbolic":"reference","module":"../../config","name":"GraphStore","line":32,"character":37},{"__symbolic":"reference","module":"../../service","name":"PermissionChecker","line":33,"character":27},{"__symbolic":"reference","module":"../../service","name":"OperationRecordService","line":34,"character":49},{"__symbolic":"reference","module":"../../security","name":"SecurityChecker","line":35,"character":42},{"__symbolic":"reference","module":"../../config","name":"VariableStore","line":36,"character":23},{"__symbolic":"reference","module":"../../localization","name":"Localization","line":37,"character":22},{"__symbolic":"reference","name":"string"}]}],"updateVariableValue":[{"__symbolic":"method"}],"changeStates":[{"__symbolic":"method"}],"updateDisplayValue":[{"__symbolic":"method"}],"getVariableValueText":[{"__symbolic":"method"}],"characterDisplayText":[{"__symbolic":"method"}],"initElement":[{"__symbolic":"method"}],"initVariableText":[{"__symbolic":"method"}],"initClickEvent":[{"__symbolic":"method"}],"checkElementPassword":[{"__symbolic":"method"}],"doWriteCharacterValue":[{"__symbolic":"method"}],"recordOperation":[{"__symbolic":"method"}],"changeGraph":[{"__symbolic":"method"}],"getElementSizeForIconScale":[{"__symbolic":"method"}]}}}}]
|
|
@@ -51,6 +51,7 @@ export declare class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
51
51
|
private _fullscreenChangeHandler;
|
|
52
52
|
private _resizeHideHandler;
|
|
53
53
|
constructor(element: HTMLElement, injector: Injector, permissionChecker: PermissionChecker, variableCommunicator: VariableCommunicator, variableStore: VariableStore, historyDataStore: HistoryDataStore, signalRAppId: string, systemTextLibraryService?: SystemTextLibraryService, languageService?: LanguageService, guiContext?: GuiContext, releasedVariableService?: ReleasedVariableService);
|
|
54
|
+
private getIconScale;
|
|
54
55
|
dispose(): void;
|
|
55
56
|
private initKeyboardListener;
|
|
56
57
|
private setNeedResize;
|
|
@@ -72,6 +72,16 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
72
72
|
// 订阅语种变化事件 和 文本库缓存更新事件
|
|
73
73
|
this.subscribeLanguageChange();
|
|
74
74
|
}
|
|
75
|
+
getIconScale() {
|
|
76
|
+
const initSize = this.model.displaySetting.initSize;
|
|
77
|
+
const size = this.model.displaySetting.size;
|
|
78
|
+
if (!initSize || !initSize.width || !initSize.height) {
|
|
79
|
+
return 1;
|
|
80
|
+
}
|
|
81
|
+
const scaleX = size.width / initSize.width;
|
|
82
|
+
const scaleY = size.height / initSize.height;
|
|
83
|
+
return Math.min(scaleX, scaleY);
|
|
84
|
+
}
|
|
75
85
|
dispose() {
|
|
76
86
|
clearInterval(this.refreshIntervalId);
|
|
77
87
|
if (this.chartElement) {
|
|
@@ -337,7 +347,10 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
337
347
|
}
|
|
338
348
|
renderChart(result) {
|
|
339
349
|
const chartWidth = this.model.displaySetting.size.width;
|
|
340
|
-
const
|
|
350
|
+
const scale = this.getIconScale();
|
|
351
|
+
// 图表主体与底部操作区之间的预留高度,需要与操作区渲染时使用的同一个 scale 保持一致,
|
|
352
|
+
// 否则图表按未缩放高度占满后,缩放后的操作区会超出元件整体高度
|
|
353
|
+
const chartHeight = this.model.displaySetting.size.height - (this.displayOption.operationAreaHeight + this.displayOption.operationAreaMarginTop) * scale;
|
|
341
354
|
const data = new Array();
|
|
342
355
|
each(this.model.dataSetting.channels, (channel, key) => {
|
|
343
356
|
const values = new Array();
|
|
@@ -347,10 +360,10 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
347
360
|
this.data = data;
|
|
348
361
|
let chart;
|
|
349
362
|
if (this.model.displaySetting.curveType === CurveType.BarGroup || this.model.displaySetting.curveType === CurveType.BarStack) {
|
|
350
|
-
chart = this.getMultiBarWithFocusChart(chartWidth, chartHeight, data);
|
|
363
|
+
chart = this.getMultiBarWithFocusChart(chartWidth, chartHeight, data, scale);
|
|
351
364
|
}
|
|
352
365
|
else {
|
|
353
|
-
chart = this.getLineChart(chartWidth, chartHeight, data);
|
|
366
|
+
chart = this.getLineChart(chartWidth, chartHeight, data, scale);
|
|
354
367
|
}
|
|
355
368
|
// 设置 tooltip 自动隐藏逻辑
|
|
356
369
|
this.setupTooltipAutoHide(chart);
|
|
@@ -400,7 +413,7 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
400
413
|
console.log(e);
|
|
401
414
|
}
|
|
402
415
|
}
|
|
403
|
-
getLineChart(chartWidth, chartHeight, data) {
|
|
416
|
+
getLineChart(chartWidth, chartHeight, data, scale = 1) {
|
|
404
417
|
const chart = nv.models.lineChart().showLegend(true)
|
|
405
418
|
.margin({ top: 0, bottom: 0, left: this.displayOption.marginLeft, right: this.displayOption.marginRight })
|
|
406
419
|
.noData(this.localization.chartNoData);
|
|
@@ -414,7 +427,7 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
414
427
|
chart.focus.showXAxis(false);
|
|
415
428
|
}
|
|
416
429
|
this.renderCommonProperty(chart, chartWidth, chartHeight, data);
|
|
417
|
-
this.renderOperationArea(chartWidth, chartHeight);
|
|
430
|
+
this.renderOperationArea(chartWidth, chartHeight, scale);
|
|
418
431
|
this.initPoint();
|
|
419
432
|
chart.legend.dispatch.on('legendClick', () => {
|
|
420
433
|
setTimeout(() => {
|
|
@@ -430,7 +443,7 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
430
443
|
});
|
|
431
444
|
return chart;
|
|
432
445
|
}
|
|
433
|
-
getMultiBarWithFocusChart(chartWidth, chartHeight, data) {
|
|
446
|
+
getMultiBarWithFocusChart(chartWidth, chartHeight, data, scale = 1) {
|
|
434
447
|
const chart = nv.models.multiBarWithFocusChart()
|
|
435
448
|
.margin({
|
|
436
449
|
top: 0, bottom: 0, left: this.displayOption.marginLeft, right: this.displayOption.marginRight
|
|
@@ -453,7 +466,7 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
453
466
|
}
|
|
454
467
|
chart.xAxis.tickFormat(d => this.timeFormat(d, '%x %X'));
|
|
455
468
|
this.renderCommonProperty(chart, chartWidth, chartHeight, data);
|
|
456
|
-
this.renderOperationArea(chartWidth, chartHeight);
|
|
469
|
+
this.renderOperationArea(chartWidth, chartHeight, scale);
|
|
457
470
|
const focusContext = this.rootElement.select('.nv-context');
|
|
458
471
|
focusContext.select('.nv-barsWrap.nvd3-svg').attr('transform', 'translate(0,30)');
|
|
459
472
|
focusContext.select('.nv-brushBackground').attr('transform', 'translate(0,30)');
|
|
@@ -614,17 +627,17 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
614
627
|
.remove();
|
|
615
628
|
}
|
|
616
629
|
}
|
|
617
|
-
renderOperationArea(chartWidth, chartHeight) {
|
|
630
|
+
renderOperationArea(chartWidth, chartHeight, scale = 1) {
|
|
618
631
|
const backgroundColor = this.model.displaySetting.axisSetting.filterBackgroudColor || 'inherit';
|
|
619
|
-
const operationArea = this.rootElement.append('g').attr('transform', `translate(0,${chartHeight + this.displayOption.operationAreaMarginTop})`)
|
|
620
|
-
.append('foreignObject').attr('width', chartWidth).attr('height', this.displayOption.operationAreaHeight).attr('fill', 'none')
|
|
621
|
-
.append('xhtml:div').style('height', (this.displayOption.operationAreaHeight - 4) + 'px').style('overflow', 'hidden').style('margin-top', '4px');
|
|
632
|
+
const operationArea = this.rootElement.append('g').attr('transform', `translate(0,${chartHeight + this.displayOption.operationAreaMarginTop * scale})`)
|
|
633
|
+
.append('foreignObject').attr('width', chartWidth).attr('height', this.displayOption.operationAreaHeight * scale).attr('fill', 'none')
|
|
634
|
+
.append('xhtml:div').style('height', (this.displayOption.operationAreaHeight * scale - 4) + 'px').style('overflow', 'hidden').style('margin-top', '4px');
|
|
622
635
|
const rect = this.$element.parent().parent().find('rect');
|
|
623
636
|
const fillColor = rect.attr('fill');
|
|
624
637
|
const dropdownBg = this.model.displaySetting.axisSetting.filterBackgroudColor || fillColor || '#fff';
|
|
625
638
|
const dropdownWrapper = operationArea.append('div')
|
|
626
639
|
.style('display', 'inline-block')
|
|
627
|
-
.style('margin-left', this.displayOption.marginLeft + 'px')
|
|
640
|
+
.style('margin-left', (this.displayOption.marginLeft * scale) + 'px')
|
|
628
641
|
.style('vertical-align', 'middle');
|
|
629
642
|
const selectedText = this.timePeriods.find(t => t.key === Number(this.currentTimePeriod));
|
|
630
643
|
const arrowIconUrl = 'url("data:image/svg+xml,'
|
|
@@ -636,14 +649,14 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
636
649
|
.style('background-image', arrowIconUrl)
|
|
637
650
|
.style('background-repeat', 'no-repeat')
|
|
638
651
|
.style('background-position', 'right 4px center')
|
|
639
|
-
.style('font-size', this.displayOption.operationSelectFontSize)
|
|
652
|
+
.style('font-size', (parseFloat(this.displayOption.operationSelectFontSize) * scale) + 'px')
|
|
640
653
|
.style('cursor', 'pointer')
|
|
641
654
|
.style('padding', '0 18px 0 4px')
|
|
642
655
|
.style('border', '1px solid #ccc')
|
|
643
656
|
.style('border-radius', '2px')
|
|
644
657
|
.style('white-space', 'nowrap')
|
|
645
|
-
.style('line-height', (this.displayOption.operationAreaHeight - 8) + 'px')
|
|
646
|
-
.style('min-height', (this.displayOption.operationAreaHeight - 8) + 'px')
|
|
658
|
+
.style('line-height', (this.displayOption.operationAreaHeight * scale - 8) + 'px')
|
|
659
|
+
.style('min-height', (this.displayOption.operationAreaHeight * scale - 8) + 'px')
|
|
647
660
|
.text(selectedText ? selectedText.name : '');
|
|
648
661
|
const dropdownListEl = document.createElement('div');
|
|
649
662
|
dropdownListEl.style.cssText = 'display:none;position:fixed;background:' + dropdownBg
|
|
@@ -658,9 +671,9 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
658
671
|
.style('padding', '4px 8px')
|
|
659
672
|
.style('cursor', 'pointer')
|
|
660
673
|
.style('white-space', 'nowrap')
|
|
661
|
-
.style('font-size', this.displayOption.operationSelectFontSize)
|
|
662
|
-
.style('line-height', (this.displayOption.operationAreaHeight - 8) + 'px')
|
|
663
|
-
.style('min-height', (this.displayOption.operationAreaHeight - 8) + 'px')
|
|
674
|
+
.style('font-size', (parseFloat(this.displayOption.operationSelectFontSize) * scale) + 'px')
|
|
675
|
+
.style('line-height', (this.displayOption.operationAreaHeight * scale - 8) + 'px')
|
|
676
|
+
.style('min-height', (this.displayOption.operationAreaHeight * scale - 8) + 'px')
|
|
664
677
|
.style('background', tp.key === Number(this.currentTimePeriod) ? '#1890ff' : 'transparent')
|
|
665
678
|
.style('color', tp.key === Number(this.currentTimePeriod) ? '#fff' : '#333')
|
|
666
679
|
.text(tp.name)
|
|
@@ -755,24 +768,24 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
755
768
|
window.addEventListener('resize', this._resizeHideHandler);
|
|
756
769
|
// 滚动时收起
|
|
757
770
|
document.addEventListener('scroll', hideDropdown, true);
|
|
758
|
-
const buttonWidth = this.displayOption.operationButtonWidth + 'px', buttonHeight = this.displayOption.operationButtonHeight + 'px';
|
|
771
|
+
const buttonWidth = (this.displayOption.operationButtonWidth * scale) + 'px', buttonHeight = (this.displayOption.operationButtonHeight * scale) + 'px';
|
|
759
772
|
operationArea.append('button').style('width', buttonWidth).style('height', buttonHeight).style('border', 'none')
|
|
760
773
|
.style('float', 'right').style('background-image', 'url(assets/img/black_last_page.png)')
|
|
761
774
|
.style('background-color', backgroundColor).style('background-size', 'cover')
|
|
762
775
|
.on('click', () => { this.loadLastPage(); });
|
|
763
776
|
operationArea.append('button').style('width', buttonWidth).style('height', buttonHeight).style('border', 'none')
|
|
764
777
|
.style('float', 'right').style('background-image', 'url(assets/img/black_next_page.png)')
|
|
765
|
-
.style('margin', `0 ${this.displayOption.operationButtonMargin}px 0 0`)
|
|
778
|
+
.style('margin', `0 ${this.displayOption.operationButtonMargin * scale}px 0 0`)
|
|
766
779
|
.style('background-color', backgroundColor).style('background-size', 'cover')
|
|
767
780
|
.on('click', () => { this.loadNextPage(); });
|
|
768
781
|
operationArea.append('button').style('width', buttonWidth).style('height', buttonHeight).style('border', 'none')
|
|
769
782
|
.style('float', 'right').style('background-image', 'url(assets/img/black_previous_page.png)')
|
|
770
|
-
.style('margin', `0 ${this.displayOption.operationButtonMargin}px 0 0`)
|
|
783
|
+
.style('margin', `0 ${this.displayOption.operationButtonMargin * scale}px 0 0`)
|
|
771
784
|
.style('background-color', backgroundColor).style('background-size', 'cover')
|
|
772
785
|
.on('click', () => { this.loadPreviousPage(); });
|
|
773
786
|
operationArea.append('button').style('width', buttonWidth).style('height', buttonHeight).style('border', 'none')
|
|
774
787
|
.style('float', 'right').style('background-image', 'url(assets/img/black_first_page.png)')
|
|
775
|
-
.style('margin', `0 ${this.displayOption.operationButtonMargin}px 0 0`)
|
|
788
|
+
.style('margin', `0 ${this.displayOption.operationButtonMargin * scale}px 0 0`)
|
|
776
789
|
.style('background-color', backgroundColor).style('background-size', 'cover')
|
|
777
790
|
.on('click', () => { this.loadFirstPage(); });
|
|
778
791
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"HistoricalCurveElement":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../base/conditional-display-element","name":"ConditionalDisplayElement","line":23,"character":44},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":77,"character":25,"context":{"typeName":"HTMLElement"}},{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":78,"character":18},{"__symbolic":"reference","module":"../../service","name":"PermissionChecker","line":79,"character":27},{"__symbolic":"reference","module":"../../communication","name":"VariableCommunicator","line":80,"character":30},{"__symbolic":"reference","module":"../../config","name":"VariableStore","line":81,"character":23},{"__symbolic":"reference","module":"../../config","name":"HistoryDataStore","line":82,"character":43},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","module":"../../service","name":"SystemTextLibraryService","line":84,"character":52},{"__symbolic":"reference","module":"../../service","name":"LanguageService","line":85,"character":43},{"__symbolic":"reference","module":"../../gui/gui-context","name":"GuiContext","line":86,"character":38},{"__symbolic":"reference","module":"../../service","name":"ReleasedVariableService","line":87,"character":51}]}],"dispose":[{"__symbolic":"method"}],"initKeyboardListener":[{"__symbolic":"method"}],"subscribeLanguageChange":[{"__symbolic":"method"}],"updateLanguageTexts":[{"__symbolic":"method"}],"getCurrentCulture":[{"__symbolic":"method"}],"getValidTimePeriods":[{"__symbolic":"method"}],"getTimePeriodText":[{"__symbolic":"method"}],"updateTimeRange":[{"__symbolic":"method"}],"updateQueryTimeRange":[{"__symbolic":"method"}],"reRenderElement":[{"__symbolic":"method"}],"renderElement":[{"__symbolic":"method"}],"setupTooltipAutoHide":[{"__symbolic":"method"}],"renderChart":[{"__symbolic":"method"}],"initPoint":[{"__symbolic":"method"}],"getLineChart":[{"__symbolic":"method"}],"getMultiBarWithFocusChart":[{"__symbolic":"method"}],"renderCommonProperty":[{"__symbolic":"method"}],"renderOperationArea":[{"__symbolic":"method"}],"timeFormat":[{"__symbolic":"method"}],"fmtDatetimeLocal":[{"__symbolic":"method"}],"showCustomTimeRangeModal":[{"__symbolic":"method"}],"showCustomTimeRangeModalFallback":[{"__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"}]}}}}]
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"HistoricalCurveElement":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../base/conditional-display-element","name":"ConditionalDisplayElement","line":23,"character":44},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":77,"character":25,"context":{"typeName":"HTMLElement"}},{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":78,"character":18},{"__symbolic":"reference","module":"../../service","name":"PermissionChecker","line":79,"character":27},{"__symbolic":"reference","module":"../../communication","name":"VariableCommunicator","line":80,"character":30},{"__symbolic":"reference","module":"../../config","name":"VariableStore","line":81,"character":23},{"__symbolic":"reference","module":"../../config","name":"HistoryDataStore","line":82,"character":43},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","module":"../../service","name":"SystemTextLibraryService","line":84,"character":52},{"__symbolic":"reference","module":"../../service","name":"LanguageService","line":85,"character":43},{"__symbolic":"reference","module":"../../gui/gui-context","name":"GuiContext","line":86,"character":38},{"__symbolic":"reference","module":"../../service","name":"ReleasedVariableService","line":87,"character":51}]}],"getIconScale":[{"__symbolic":"method"}],"dispose":[{"__symbolic":"method"}],"initKeyboardListener":[{"__symbolic":"method"}],"subscribeLanguageChange":[{"__symbolic":"method"}],"updateLanguageTexts":[{"__symbolic":"method"}],"getCurrentCulture":[{"__symbolic":"method"}],"getValidTimePeriods":[{"__symbolic":"method"}],"getTimePeriodText":[{"__symbolic":"method"}],"updateTimeRange":[{"__symbolic":"method"}],"updateQueryTimeRange":[{"__symbolic":"method"}],"reRenderElement":[{"__symbolic":"method"}],"renderElement":[{"__symbolic":"method"}],"setupTooltipAutoHide":[{"__symbolic":"method"}],"renderChart":[{"__symbolic":"method"}],"initPoint":[{"__symbolic":"method"}],"getLineChart":[{"__symbolic":"method"}],"getMultiBarWithFocusChart":[{"__symbolic":"method"}],"renderCommonProperty":[{"__symbolic":"method"}],"renderOperationArea":[{"__symbolic":"method"}],"timeFormat":[{"__symbolic":"method"}],"fmtDatetimeLocal":[{"__symbolic":"method"}],"showCustomTimeRangeModal":[{"__symbolic":"method"}],"showCustomTimeRangeModalFallback":[{"__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
|
@@ -318,7 +318,8 @@ export class MainElement {
|
|
|
318
318
|
each(this.elements, e => {
|
|
319
319
|
if (e instanceof HistoricalCurveElement || e instanceof VideoElement
|
|
320
320
|
|| e instanceof WeatherElement || e instanceof NumericalDisplayElement || e instanceof TextElement
|
|
321
|
-
|| e instanceof AirQualityElement || e instanceof SwitchIndicatorLightElement || e instanceof ScrollAlarmElement
|
|
321
|
+
|| e instanceof AirQualityElement || e instanceof SwitchIndicatorLightElement || e instanceof ScrollAlarmElement
|
|
322
|
+
|| e instanceof AlarmElement) {
|
|
322
323
|
e.dispose();
|
|
323
324
|
}
|
|
324
325
|
});
|
|
@@ -57,4 +57,13 @@ export declare class NumericalDisplayElement extends ReadableElement {
|
|
|
57
57
|
private formatFloatDisplayText;
|
|
58
58
|
private isNumeric;
|
|
59
59
|
private formatDisplayTextUnit;
|
|
60
|
+
/**
|
|
61
|
+
* 提供元件尺寸信息用于状态图标缩放
|
|
62
|
+
*/
|
|
63
|
+
protected getElementSizeForIconScale(): {
|
|
64
|
+
width: number;
|
|
65
|
+
height: number;
|
|
66
|
+
initWidth?: number;
|
|
67
|
+
initHeight?: number;
|
|
68
|
+
} | null;
|
|
60
69
|
}
|
|
@@ -491,4 +491,19 @@ export class NumericalDisplayElement extends ReadableElement {
|
|
|
491
491
|
}
|
|
492
492
|
return displayText;
|
|
493
493
|
}
|
|
494
|
+
/**
|
|
495
|
+
* 提供元件尺寸信息用于状态图标缩放
|
|
496
|
+
*/
|
|
497
|
+
getElementSizeForIconScale() {
|
|
498
|
+
var _a, _b;
|
|
499
|
+
if (this.model.size) {
|
|
500
|
+
return {
|
|
501
|
+
width: this.model.size.width,
|
|
502
|
+
height: this.model.size.height,
|
|
503
|
+
initWidth: (_a = this.model.initSize) === null || _a === void 0 ? void 0 : _a.width,
|
|
504
|
+
initHeight: (_b = this.model.initSize) === null || _b === void 0 ? void 0 : _b.height
|
|
505
|
+
};
|
|
506
|
+
}
|
|
507
|
+
return null;
|
|
508
|
+
}
|
|
494
509
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"NumericalDisplayElement":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../base/readable-element","name":"ReadableElement","line":29,"character":45},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":73,"character":25,"context":{"typeName":"HTMLElement"}},{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":74,"character":18},{"__symbolic":"reference","module":"ngx-bootstrap/modal","name":"BsModalService","line":75,"character":39},{"__symbolic":"reference","module":"../../service","name":"PermissionChecker","line":76,"character":27},{"__symbolic":"reference","module":"../../communication","name":"VariableCommunicator","line":77,"character":30},{"__symbolic":"reference","module":"../../config","name":"GraphStore","line":78,"character":37},{"__symbolic":"reference","module":"../../service","name":"OperationRecordService","line":79,"character":49},{"__symbolic":"reference","module":"../../service","name":"ReleasedVariableService","line":80,"character":50},{"__symbolic":"reference","module":"../../security","name":"SecurityChecker","line":81,"character":42},{"__symbolic":"reference","module":"../../config","name":"VariableStore","line":82,"character":23},{"__symbolic":"reference","module":"../../localization","name":"Localization","line":83,"character":22},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","module":"../../gui/gui-context","name":"GuiContext","line":85,"character":38}]}],"dispose":[{"__symbolic":"method"}],"reportValueChanged":[{"__symbolic":"method"}],"initElement":[{"__symbolic":"method"}],"checkElementPassword":[{"__symbolic":"method"}],"initVariableText":[{"__symbolic":"method"}],"initGraphAndText":[{"__symbolic":"method"}],"doWriteValue":[{"__symbolic":"method"}],"recordOperation":[{"__symbolic":"method"}],"changeStates":[{"__symbolic":"method"}],"updateVariableValue":[{"__symbolic":"method"}],"updateDisplayText":[{"__symbolic":"method"}],"rebuildTextElement":[{"__symbolic":"method"}],"formatNumericalDisplayText":[{"__symbolic":"method"}],"formatFloatDisplayText":[{"__symbolic":"method"}],"isNumeric":[{"__symbolic":"method"}],"formatDisplayTextUnit":[{"__symbolic":"method"}]}}}}]
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"NumericalDisplayElement":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../base/readable-element","name":"ReadableElement","line":29,"character":45},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":73,"character":25,"context":{"typeName":"HTMLElement"}},{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":74,"character":18},{"__symbolic":"reference","module":"ngx-bootstrap/modal","name":"BsModalService","line":75,"character":39},{"__symbolic":"reference","module":"../../service","name":"PermissionChecker","line":76,"character":27},{"__symbolic":"reference","module":"../../communication","name":"VariableCommunicator","line":77,"character":30},{"__symbolic":"reference","module":"../../config","name":"GraphStore","line":78,"character":37},{"__symbolic":"reference","module":"../../service","name":"OperationRecordService","line":79,"character":49},{"__symbolic":"reference","module":"../../service","name":"ReleasedVariableService","line":80,"character":50},{"__symbolic":"reference","module":"../../security","name":"SecurityChecker","line":81,"character":42},{"__symbolic":"reference","module":"../../config","name":"VariableStore","line":82,"character":23},{"__symbolic":"reference","module":"../../localization","name":"Localization","line":83,"character":22},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","module":"../../gui/gui-context","name":"GuiContext","line":85,"character":38}]}],"dispose":[{"__symbolic":"method"}],"reportValueChanged":[{"__symbolic":"method"}],"initElement":[{"__symbolic":"method"}],"checkElementPassword":[{"__symbolic":"method"}],"initVariableText":[{"__symbolic":"method"}],"initGraphAndText":[{"__symbolic":"method"}],"doWriteValue":[{"__symbolic":"method"}],"recordOperation":[{"__symbolic":"method"}],"changeStates":[{"__symbolic":"method"}],"updateVariableValue":[{"__symbolic":"method"}],"updateDisplayText":[{"__symbolic":"method"}],"rebuildTextElement":[{"__symbolic":"method"}],"formatNumericalDisplayText":[{"__symbolic":"method"}],"formatFloatDisplayText":[{"__symbolic":"method"}],"isNumeric":[{"__symbolic":"method"}],"formatDisplayTextUnit":[{"__symbolic":"method"}],"getElementSizeForIconScale":[{"__symbolic":"method"}]}}}}]
|
|
@@ -40,6 +40,15 @@ export declare class SwitchIndicatorLightElement extends ConditionalEnableElemen
|
|
|
40
40
|
private currentStateIdChange;
|
|
41
41
|
private switchToState;
|
|
42
42
|
private initGraphAndText;
|
|
43
|
+
/**
|
|
44
|
+
* 提供元件尺寸信息用于状态图标缩放
|
|
45
|
+
*/
|
|
46
|
+
protected getElementSizeForIconScale(): {
|
|
47
|
+
width: number;
|
|
48
|
+
height: number;
|
|
49
|
+
initWidth?: number;
|
|
50
|
+
initHeight?: number;
|
|
51
|
+
} | null;
|
|
43
52
|
/**
|
|
44
53
|
* 释放资源
|
|
45
54
|
*/
|
|
@@ -263,6 +263,21 @@ export class SwitchIndicatorLightElement extends ConditionalEnableElement {
|
|
|
263
263
|
this.textStateElement = new TextStateElement(this.model.states, width, height, this.logger, this.model.version, this.model.states, this.model.textLibrary, this.textLibraryService, this.languageService, this.guiContext, true, this.model.fontStyleCultures);
|
|
264
264
|
this.$element.append(this.textStateElement.Element);
|
|
265
265
|
}
|
|
266
|
+
/**
|
|
267
|
+
* 提供元件尺寸信息用于状态图标缩放
|
|
268
|
+
*/
|
|
269
|
+
getElementSizeForIconScale() {
|
|
270
|
+
var _a, _b;
|
|
271
|
+
if (this.model.size) {
|
|
272
|
+
return {
|
|
273
|
+
width: this.model.size.width,
|
|
274
|
+
height: this.model.size.height,
|
|
275
|
+
initWidth: (_a = this.model.initSize) === null || _a === void 0 ? void 0 : _a.width,
|
|
276
|
+
initHeight: (_b = this.model.initSize) === null || _b === void 0 ? void 0 : _b.height
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
return null;
|
|
280
|
+
}
|
|
266
281
|
/**
|
|
267
282
|
* 释放资源
|
|
268
283
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"SwitchIndicatorLightElement":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../base/conditional-enable-element","name":"ConditionalEnableElement","line":33,"character":49},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":52,"character":25,"context":{"typeName":"HTMLElement"}},{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":53,"character":18},{"__symbolic":"reference","module":"ngx-bootstrap/modal","name":"BsModalService","line":54,"character":39},{"__symbolic":"reference","module":"../../communication","name":"VariableCommunicator","line":55,"character":30},{"__symbolic":"reference","module":"../../config","name":"GraphStore","line":56,"character":37},{"__symbolic":"reference","module":"../../service","name":"PermissionChecker","line":57,"character":27},{"__symbolic":"reference","module":"../../service","name":"OperationRecordService","line":58,"character":49},{"__symbolic":"reference","module":"../../security","name":"SecurityChecker","line":59,"character":42},{"__symbolic":"reference","module":"../../config","name":"VariableStore","line":60,"character":23},{"__symbolic":"reference","module":"../../localization","name":"Localization","line":61,"character":22},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","module":"../../service","name":"TextLibraryService","line":63,"character":46},{"__symbolic":"reference","module":"../../service","name":"LanguageService","line":64,"character":43},{"__symbolic":"reference","module":"../../gui/gui-context","name":"GuiContext","line":65,"character":38}]}],"handleMouseUp":[{"__symbolic":"method"}],"initOnDocMouseUpEvent":[{"__symbolic":"method"}],"checkElementPassword":[{"__symbolic":"method"}],"doSwitchOperator":[{"__symbolic":"method"}],"writeValue":[{"__symbolic":"method"}],"initSwitchOperator":[{"__symbolic":"method"}],"initIndictorLightOperator":[{"__symbolic":"method"}],"currentStateIdChange":[{"__symbolic":"method"}],"switchToState":[{"__symbolic":"method"}],"initGraphAndText":[{"__symbolic":"method"}],"dispose":[{"__symbolic":"method"}],"checkState":[{"__symbolic":"method"}]}}}}]
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"SwitchIndicatorLightElement":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../base/conditional-enable-element","name":"ConditionalEnableElement","line":33,"character":49},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":52,"character":25,"context":{"typeName":"HTMLElement"}},{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":53,"character":18},{"__symbolic":"reference","module":"ngx-bootstrap/modal","name":"BsModalService","line":54,"character":39},{"__symbolic":"reference","module":"../../communication","name":"VariableCommunicator","line":55,"character":30},{"__symbolic":"reference","module":"../../config","name":"GraphStore","line":56,"character":37},{"__symbolic":"reference","module":"../../service","name":"PermissionChecker","line":57,"character":27},{"__symbolic":"reference","module":"../../service","name":"OperationRecordService","line":58,"character":49},{"__symbolic":"reference","module":"../../security","name":"SecurityChecker","line":59,"character":42},{"__symbolic":"reference","module":"../../config","name":"VariableStore","line":60,"character":23},{"__symbolic":"reference","module":"../../localization","name":"Localization","line":61,"character":22},{"__symbolic":"reference","name":"string"},{"__symbolic":"reference","module":"../../service","name":"TextLibraryService","line":63,"character":46},{"__symbolic":"reference","module":"../../service","name":"LanguageService","line":64,"character":43},{"__symbolic":"reference","module":"../../gui/gui-context","name":"GuiContext","line":65,"character":38}]}],"handleMouseUp":[{"__symbolic":"method"}],"initOnDocMouseUpEvent":[{"__symbolic":"method"}],"checkElementPassword":[{"__symbolic":"method"}],"doSwitchOperator":[{"__symbolic":"method"}],"writeValue":[{"__symbolic":"method"}],"initSwitchOperator":[{"__symbolic":"method"}],"initIndictorLightOperator":[{"__symbolic":"method"}],"currentStateIdChange":[{"__symbolic":"method"}],"switchToState":[{"__symbolic":"method"}],"initGraphAndText":[{"__symbolic":"method"}],"getElementSizeForIconScale":[{"__symbolic":"method"}],"dispose":[{"__symbolic":"method"}],"checkState":[{"__symbolic":"method"}]}}}}]
|
|
@@ -177,7 +177,8 @@ export class ViewOperationElement extends ConditionalEnableElement {
|
|
|
177
177
|
popView() {
|
|
178
178
|
const viewIndex = this.model.viewIndex;
|
|
179
179
|
if (null != viewIndex) {
|
|
180
|
-
|
|
180
|
+
const triggerRect = this.$element[0].getBoundingClientRect();
|
|
181
|
+
this.popupViewService.popView(viewIndex, this.hostContainerId, this.el, triggerRect).subscribe(() => this.recordViewOperation(), error => this.logger.error(`ToggleView(${viewIndex}) failed. ${error}`));
|
|
181
182
|
$(`#${this.hostContainerId} video`)
|
|
182
183
|
.addClass('video-hidden')
|
|
183
184
|
.css('visibility', 'hidden');
|
package/gui/gui-view.d.ts
CHANGED
|
@@ -12,6 +12,8 @@ export declare class GuiView implements PopupViewService {
|
|
|
12
12
|
private readonly bsModalService;
|
|
13
13
|
private readonly context;
|
|
14
14
|
private readonly parentView?;
|
|
15
|
+
/** showShadow() 给阴影留白,内容整体右下偏移的量,"按钮附近"定位需要据此修正才能让可见内容与按钮对齐 */
|
|
16
|
+
private static readonly SHADOW_INSET;
|
|
15
17
|
get element(): HTMLElement;
|
|
16
18
|
get rawWidth(): number;
|
|
17
19
|
get rawHeight(): number;
|
|
@@ -34,7 +36,19 @@ export declare class GuiView implements PopupViewService {
|
|
|
34
36
|
resize(size: Size, resizeMode: ViewResizeMode, svgRootClass: string): void;
|
|
35
37
|
load(config: ViewModel, guiOptions: GuiOptions): void;
|
|
36
38
|
loadElementState(): void;
|
|
37
|
-
popView(viewIndex: number, hostContainerId: string, el: ElementRef): Observable<void>;
|
|
39
|
+
popView(viewIndex: number, hostContainerId: string, el: ElementRef, triggerRect?: DOMRect): Observable<void>;
|
|
40
|
+
/**
|
|
41
|
+
* 把屏幕像素矩形(如按钮的 getBoundingClientRect)换算为当前画面 SVG 坐标系下的矩形。
|
|
42
|
+
* 用 getScreenCTM 而不是简单的宽高比换算,因为画面容器宽高比与 rawWidth/rawHeight 不一致时
|
|
43
|
+
* SVG 会按 preserveAspectRatio 留白(letterbox),线性比例换算会有偏差。
|
|
44
|
+
*/
|
|
45
|
+
private toLocalRect;
|
|
46
|
+
/**
|
|
47
|
+
* 按钮附近:按钮与弹出画面之间留缝隙,两侧都放得下时默认放右侧,放不下时放在放得下的一侧;
|
|
48
|
+
* 竖直方向默认与按钮顶部对齐,下方放不下时改为与按钮底部对齐;
|
|
49
|
+
* 左右两侧都放不下(弹窗比画面还宽)时直接退化为画面居中,不再跟随按钮
|
|
50
|
+
*/
|
|
51
|
+
private getNearButtonPosition;
|
|
38
52
|
closeView(): void;
|
|
39
53
|
moveView(movementX: number, movementY: number): void;
|
|
40
54
|
showMusk(): void;
|
package/gui/gui-view.js
CHANGED
|
@@ -141,7 +141,7 @@ export class GuiView {
|
|
|
141
141
|
}
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
|
-
popView(viewIndex, hostContainerId, el) {
|
|
144
|
+
popView(viewIndex, hostContainerId, el, triggerRect) {
|
|
145
145
|
return this.context.configStore.viewStore.getViewConfig(viewIndex).pipe(map(view => {
|
|
146
146
|
if (!view.config || !view.config.length) {
|
|
147
147
|
throw new ConfigIsEmptyError();
|
|
@@ -162,6 +162,10 @@ export class GuiView {
|
|
|
162
162
|
x = settings.popup.location.x;
|
|
163
163
|
y = settings.popup.location.y;
|
|
164
164
|
}
|
|
165
|
+
else if (settings.popup.locationType === ViewPopupLocationType.NearButton && triggerRect) {
|
|
166
|
+
const hasShadow = settings.popup.backdropType === ViewPopupBackdropType.Shadow && !this.isMobileMode;
|
|
167
|
+
({ x, y } = this.getNearButtonPosition(popView, triggerRect, hasShadow));
|
|
168
|
+
}
|
|
165
169
|
else {
|
|
166
170
|
x = (this.rawWidth - popView.rawWidth) / 2;
|
|
167
171
|
y = (this.rawHeight - popView.rawHeight) / 2;
|
|
@@ -181,6 +185,73 @@ export class GuiView {
|
|
|
181
185
|
this.element.appendChild(popView.element);
|
|
182
186
|
}));
|
|
183
187
|
}
|
|
188
|
+
/**
|
|
189
|
+
* 把屏幕像素矩形(如按钮的 getBoundingClientRect)换算为当前画面 SVG 坐标系下的矩形。
|
|
190
|
+
* 用 getScreenCTM 而不是简单的宽高比换算,因为画面容器宽高比与 rawWidth/rawHeight 不一致时
|
|
191
|
+
* SVG 会按 preserveAspectRatio 留白(letterbox),线性比例换算会有偏差。
|
|
192
|
+
*/
|
|
193
|
+
toLocalRect(rect) {
|
|
194
|
+
const svgRoot = this.element;
|
|
195
|
+
const ctm = svgRoot.getScreenCTM && svgRoot.getScreenCTM();
|
|
196
|
+
if (ctm) {
|
|
197
|
+
const inverse = ctm.inverse();
|
|
198
|
+
const toLocal = (clientX, clientY) => {
|
|
199
|
+
const pt = svgRoot.createSVGPoint();
|
|
200
|
+
pt.x = clientX;
|
|
201
|
+
pt.y = clientY;
|
|
202
|
+
return pt.matrixTransform(inverse);
|
|
203
|
+
};
|
|
204
|
+
const topLeft = toLocal(rect.left, rect.top);
|
|
205
|
+
const bottomRight = toLocal(rect.right, rect.bottom);
|
|
206
|
+
return {
|
|
207
|
+
x: topLeft.x,
|
|
208
|
+
y: topLeft.y,
|
|
209
|
+
width: bottomRight.x - topLeft.x,
|
|
210
|
+
height: bottomRight.y - topLeft.y
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
const viewRect = this.element.getBoundingClientRect();
|
|
214
|
+
const scaleX = viewRect.width ? this.rawWidth / viewRect.width : 1;
|
|
215
|
+
const scaleY = viewRect.height ? this.rawHeight / viewRect.height : 1;
|
|
216
|
+
return {
|
|
217
|
+
x: (rect.left - viewRect.left) * scaleX,
|
|
218
|
+
y: (rect.top - viewRect.top) * scaleY,
|
|
219
|
+
width: rect.width * scaleX,
|
|
220
|
+
height: rect.height * scaleY
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* 按钮附近:按钮与弹出画面之间留缝隙,两侧都放得下时默认放右侧,放不下时放在放得下的一侧;
|
|
225
|
+
* 竖直方向默认与按钮顶部对齐,下方放不下时改为与按钮底部对齐;
|
|
226
|
+
* 左右两侧都放不下(弹窗比画面还宽)时直接退化为画面居中,不再跟随按钮
|
|
227
|
+
*/
|
|
228
|
+
getNearButtonPosition(popView, triggerRect, hasShadow) {
|
|
229
|
+
const gap = 20;
|
|
230
|
+
const { x: buttonX, y: buttonY, width: buttonWidth, height: buttonHeight } = this.toLocalRect(triggerRect);
|
|
231
|
+
const rightX = buttonX + buttonWidth + gap;
|
|
232
|
+
const leftX = buttonX - gap - popView.rawWidth;
|
|
233
|
+
const fitsRight = rightX + popView.rawWidth <= this.rawWidth;
|
|
234
|
+
const fitsLeft = leftX >= 0;
|
|
235
|
+
let x;
|
|
236
|
+
let y;
|
|
237
|
+
if (!fitsRight && !fitsLeft) {
|
|
238
|
+
x = (this.rawWidth - popView.rawWidth) / 2;
|
|
239
|
+
y = (this.rawHeight - popView.rawHeight) / 2;
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
x = fitsRight ? rightX : leftX;
|
|
243
|
+
const fitsBelow = buttonY + popView.rawHeight <= this.rawHeight;
|
|
244
|
+
y = fitsBelow ? buttonY : buttonY + buttonHeight - popView.rawHeight;
|
|
245
|
+
if (hasShadow) {
|
|
246
|
+
// 阴影会把可见内容整体右下偏移 SHADOW_INSET,这里反向补偏移让可见内容而不是容器本身对齐按钮
|
|
247
|
+
x -= GuiView.SHADOW_INSET;
|
|
248
|
+
y -= GuiView.SHADOW_INSET;
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
x = Math.max(0, Math.min(x, this.rawWidth - popView.rawWidth));
|
|
252
|
+
y = Math.max(0, Math.min(y, this.rawHeight - popView.rawHeight));
|
|
253
|
+
return { x, y };
|
|
254
|
+
}
|
|
184
255
|
closeView() {
|
|
185
256
|
if (!this.parentView) {
|
|
186
257
|
return;
|
|
@@ -218,10 +289,11 @@ export class GuiView {
|
|
|
218
289
|
if (!container) {
|
|
219
290
|
return;
|
|
220
291
|
}
|
|
292
|
+
const inset = GuiView.SHADOW_INSET;
|
|
221
293
|
container.setAttribute('filter', `url(#${filterId})`);
|
|
222
|
-
container.setAttribute('x',
|
|
223
|
-
container.setAttribute('y',
|
|
224
|
-
$(this.element).children('g').attr('transform',
|
|
294
|
+
container.setAttribute('x', String(inset));
|
|
295
|
+
container.setAttribute('y', String(inset));
|
|
296
|
+
$(this.element).children('g').attr('transform', `matrix(1, 0, 0, 1, ${inset}, ${inset})`);
|
|
225
297
|
}
|
|
226
298
|
hideMusk() {
|
|
227
299
|
if (this.muskElement) {
|
|
@@ -263,3 +335,5 @@ export class GuiView {
|
|
|
263
335
|
}
|
|
264
336
|
}
|
|
265
337
|
}
|
|
338
|
+
/** showShadow() 给阴影留白,内容整体右下偏移的量,"按钮附近"定位需要据此修正才能让可见内容与按钮对齐 */
|
|
339
|
+
GuiView.SHADOW_INSET = 5;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"GuiView":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"GuiView":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":54,"character":43},{"__symbolic":"reference","module":"ngx-bootstrap/modal","name":"BsModalService","line":55,"character":41},{"__symbolic":"reference","module":"./gui-context","name":"GuiContext","line":56,"character":34},{"__symbolic":"reference","name":"GuiView"}]}],"resize":[{"__symbolic":"method"}],"load":[{"__symbolic":"method"}],"loadElementState":[{"__symbolic":"method"}],"popView":[{"__symbolic":"method"}],"toLocalRect":[{"__symbolic":"method"}],"getNearButtonPosition":[{"__symbolic":"method"}],"closeView":[{"__symbolic":"method"}],"moveView":[{"__symbolic":"method"}],"showMusk":[{"__symbolic":"method"}],"showShadow":[{"__symbolic":"method"}],"hideMusk":[{"__symbolic":"method"}],"dispose":[{"__symbolic":"method"}],"normalOpenedVariableNames":[{"__symbolic":"method"}]},"statics":{"SHADOW_INSET":5}}}}]
|
|
@@ -3,6 +3,7 @@ import { Point, Size } from '../shared';
|
|
|
3
3
|
export interface AlarmModel extends ConditionalDisplayModel {
|
|
4
4
|
readonly version: number;
|
|
5
5
|
readonly size: Size;
|
|
6
|
+
readonly initSize?: Size;
|
|
6
7
|
readonly location: Point;
|
|
7
8
|
readonly generalSetting?: any;
|
|
8
9
|
readonly filterSetting?: any;
|
|
@@ -12,6 +12,7 @@ export interface CharacterDisplay extends ReadableModel, SecurityModel {
|
|
|
12
12
|
readonly graphSetting: GraphSetting;
|
|
13
13
|
readonly charCount: number;
|
|
14
14
|
readonly size: Size;
|
|
15
|
+
readonly initSize?: Size;
|
|
15
16
|
readonly useGraph: boolean;
|
|
16
17
|
readonly accessPermission: any;
|
|
17
18
|
readonly showVariableText?: boolean;
|
|
@@ -4,6 +4,7 @@ import { HistoricalCurveAxisSettings } from './historical-curve-axis-settings';
|
|
|
4
4
|
import { CurveType } from './curve-type';
|
|
5
5
|
export interface HistoricalCurveDisplaySettings {
|
|
6
6
|
readonly size: Size;
|
|
7
|
+
readonly initSize?: Size;
|
|
7
8
|
readonly location: Point;
|
|
8
9
|
/**
|
|
9
10
|
* 刷新周期(秒)
|
|
@@ -4,6 +4,7 @@ import { NumericalOperationSettings } from './numerical-operation-settings';
|
|
|
4
4
|
import { DisplayDataType } from '../shared/data-type/display-data-type';
|
|
5
5
|
export interface NumericalDisplay extends ReadableModel, SecurityModel {
|
|
6
6
|
readonly size: Size;
|
|
7
|
+
readonly initSize?: Size;
|
|
7
8
|
readonly useGraph: boolean;
|
|
8
9
|
readonly stroke: string;
|
|
9
10
|
readonly font: string;
|
|
@@ -2,4 +2,5 @@ export var ViewPopupLocationType;
|
|
|
2
2
|
(function (ViewPopupLocationType) {
|
|
3
3
|
ViewPopupLocationType[ViewPopupLocationType["Center"] = 0] = "Center";
|
|
4
4
|
ViewPopupLocationType[ViewPopupLocationType["Custom"] = 1] = "Custom";
|
|
5
|
+
ViewPopupLocationType[ViewPopupLocationType["NearButton"] = 2] = "NearButton";
|
|
5
6
|
})(ViewPopupLocationType || (ViewPopupLocationType = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"ViewPopupLocationType":{"Center":0,"Custom":1}}}]
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"ViewPopupLocationType":{"Center":0,"Custom":1,"NearButton":2}}}]
|
|
@@ -25,6 +25,7 @@ export interface SwitchIndicatorLight extends ConditionalEnableModel, SecurityMo
|
|
|
25
25
|
readonly graphSetting?: GraphSetting;
|
|
26
26
|
readonly location: Point;
|
|
27
27
|
readonly size: Size;
|
|
28
|
+
readonly initSize?: Size;
|
|
28
29
|
readonly isAwaysDisplay?: boolean;
|
|
29
30
|
readonly conditionItems?: ConditionItemModel[];
|
|
30
31
|
readonly dynamicSetting?: DynamicDisplayModel;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { ElementRef } from '@angular/core';
|
|
3
3
|
export interface PopupViewService {
|
|
4
|
-
popView(viewIndex: number, hostContainerId: string, el: ElementRef): Observable<void>;
|
|
4
|
+
popView(viewIndex: number, hostContainerId: string, el: ElementRef, triggerRect?: DOMRect): Observable<void>;
|
|
5
5
|
closeView(): any;
|
|
6
6
|
moveView(movementX: number, movementY: number): any;
|
|
7
7
|
}
|