@flexem/fc-gui 3.0.0-alpha.103 → 3.0.0-alpha.105
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 +11 -1
- package/assets/img/black_first_page.png +0 -0
- package/assets/img/black_last_page.png +0 -0
- package/assets/img/black_next_page.png +0 -0
- package/assets/img/black_previous_page.png +0 -0
- package/bundles/@flexem/fc-gui.umd.js +50 -48
- 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/bar-graph-element.d.ts +0 -1
- package/elements/bar-graph-element.js +14 -16
- package/elements/bar-graph-element.metadata.json +1 -1
- package/elements/historical-curve/historical-curve.element.js +11 -10
- package/elements/ring-graph/ring-graph-element.js +25 -22
- package/model/historical-curve/historical-curve-axis-settings.d.ts +1 -0
- package/package.json +1 -1
|
@@ -19,7 +19,6 @@ export declare class BarGraphElement extends ReadableElement {
|
|
|
19
19
|
private valueObj;
|
|
20
20
|
private isNeedUpdateScale;
|
|
21
21
|
private needAddNumber;
|
|
22
|
-
private needInitTransform;
|
|
23
22
|
get readVariableName(): string;
|
|
24
23
|
constructor(element: HTMLElement, permissionChecker: PermissionChecker, variableCommunicator: VariableCommunicator, variableStore: VariableStore, localization: Localization, signalRAppId: string);
|
|
25
24
|
private initTransform;
|
|
@@ -13,7 +13,6 @@ export class BarGraphElement extends ReadableElement {
|
|
|
13
13
|
this.valueObj = {};
|
|
14
14
|
this.isNeedUpdateScale = false;
|
|
15
15
|
this.needAddNumber = 0;
|
|
16
|
-
this.needInitTransform = true;
|
|
17
16
|
if ((this.model.minValueType === VariableValueType.Constant && this.model.maxValueType === VariableValueType.Variable)
|
|
18
17
|
|| this.model.maxValueType === VariableValueType.Constant && this.model.minValueType === VariableValueType.Variable) {
|
|
19
18
|
this.isNeedUpdateScale = true;
|
|
@@ -29,9 +28,7 @@ export class BarGraphElement extends ReadableElement {
|
|
|
29
28
|
this.$barRect.attr('transform', this.defaultTransform);
|
|
30
29
|
}
|
|
31
30
|
setTimeout(() => {
|
|
32
|
-
|
|
33
|
-
this.initFrameNode();
|
|
34
|
-
}
|
|
31
|
+
this.initFrameNode();
|
|
35
32
|
});
|
|
36
33
|
}
|
|
37
34
|
get readVariableName() {
|
|
@@ -53,8 +50,10 @@ export class BarGraphElement extends ReadableElement {
|
|
|
53
50
|
if (this.needAddNumber <= 3)
|
|
54
51
|
return;
|
|
55
52
|
this.$element[0].childNodes.forEach((node, index) => {
|
|
56
|
-
const matrixE = node.transform.baseVal[0].matrix.e;
|
|
57
|
-
node.transform.baseVal[0].matrix.e = matrixE + (this.needAddNumber - 3) * 7;
|
|
53
|
+
// const matrixE = node.transform.baseVal[0].matrix.e;
|
|
54
|
+
// node.transform.baseVal[0].matrix.e = matrixE + (this.needAddNumber - 3) * 7;
|
|
55
|
+
if (!node.transform.baseVal[0])
|
|
56
|
+
return;
|
|
58
57
|
if (node.nodeName === 'g') {
|
|
59
58
|
const nodeValue = node.attributes['clip-path'].value.replace('url(#', '').replace(')', '');
|
|
60
59
|
const rootNode = node.parentNode.parentNode.parentElement;
|
|
@@ -66,8 +65,8 @@ export class BarGraphElement extends ReadableElement {
|
|
|
66
65
|
const values = [];
|
|
67
66
|
line.split(' ').forEach((item) => {
|
|
68
67
|
const nItem = Number(item);
|
|
69
|
-
if (
|
|
70
|
-
item = nItem
|
|
68
|
+
if (nItem === -1) {
|
|
69
|
+
item = nItem - (this.needAddNumber - 3) * 7;
|
|
71
70
|
}
|
|
72
71
|
values.push(item);
|
|
73
72
|
});
|
|
@@ -83,8 +82,7 @@ export class BarGraphElement extends ReadableElement {
|
|
|
83
82
|
initFrameNode() {
|
|
84
83
|
const arcPath = Snap(this.$element[0]);
|
|
85
84
|
const b = arcPath.getBBox(true);
|
|
86
|
-
|
|
87
|
-
this.rootElement.append('rect').attr('id', 'StateFrame').attr('width', width).attr('height', b.height).attr('fill', 'transparent');
|
|
85
|
+
this.rootElement.append('rect').attr('id', 'StateFrame').attr('width', b.width).attr('height', b.height).attr('fill', 'transparent');
|
|
88
86
|
}
|
|
89
87
|
updateValueObj(value, variableName) {
|
|
90
88
|
var _a, _b, _c;
|
|
@@ -114,13 +112,9 @@ export class BarGraphElement extends ReadableElement {
|
|
|
114
112
|
min = BarGraphElement.DEFAULT_MIN_VALUE;
|
|
115
113
|
max = BarGraphElement.DEFAULT_MAX_VALUE;
|
|
116
114
|
}
|
|
117
|
-
if (this.model.maxValueType === VariableValueType.Variable
|
|
115
|
+
if (this.model.maxValueType === VariableValueType.Variable || this.model.minValueType === VariableValueType.Variable) {
|
|
118
116
|
this.needAddNumber = max.toString().length > min.toString().length ? max.toString().length : min.toString().length;
|
|
119
|
-
|
|
120
|
-
this.initTransform();
|
|
121
|
-
this.initFrameNode();
|
|
122
|
-
this.needInitTransform = false;
|
|
123
|
-
}
|
|
117
|
+
this.initTransform();
|
|
124
118
|
}
|
|
125
119
|
const avgSacle = ((max - min) / this.model.masterDivisionNumber).toFixed(5);
|
|
126
120
|
for (let i = 0; i < textElements.length; i++) {
|
|
@@ -155,6 +149,10 @@ export class BarGraphElement extends ReadableElement {
|
|
|
155
149
|
}
|
|
156
150
|
break;
|
|
157
151
|
}
|
|
152
|
+
if (this.model.minValueType !== VariableValueType.Constant && this.model.maxValueType === VariableValueType.Constant) {
|
|
153
|
+
const maxLen = this.model.max && this.model.max.toString().length;
|
|
154
|
+
translateX += maxLen > 2 ? (maxLen - 3) * 7 : 0;
|
|
155
|
+
}
|
|
158
156
|
text.transform.baseVal[0].matrix.e = translateX;
|
|
159
157
|
}
|
|
160
158
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"BarGraphElement":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"./base/readable-element","name":"ReadableElement","line":10,"character":37},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"BarGraphElement":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"./base/readable-element","name":"ReadableElement","line":10,"character":37},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":39,"character":25,"context":{"typeName":"HTMLElement"}},{"__symbolic":"reference","module":"../service","name":"PermissionChecker","line":39,"character":57},{"__symbolic":"reference","module":"../communication","name":"VariableCommunicator","line":40,"character":30},{"__symbolic":"reference","module":"../config","name":"VariableStore","line":41,"character":23},{"__symbolic":"reference","module":"../localization","name":"Localization","line":42,"character":22},{"__symbolic":"reference","name":"string"}]}],"initTransform":[{"__symbolic":"method"}],"initFrameNode":[{"__symbolic":"method"}],"updateValueObj":[{"__symbolic":"method"}],"updateScale":[{"__symbolic":"method"}],"updateVariableValue":[{"__symbolic":"method"}]},"statics":{"DEFAULT_MIN_VALUE":0,"DEFAULT_MAX_VALUE":100}}}}]
|
|
@@ -411,11 +411,12 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
413
|
renderOperationArea(chartWidth, chartHeight) {
|
|
414
|
+
const backgroundColor = this.model.displaySetting.axisSetting.filterBackgroudColor || 'inherit';
|
|
414
415
|
const operationArea = this.rootElement.append('g').attr('transform', `translate(0,${chartHeight + this.displayOption.operationAreaMarginTop})`)
|
|
415
416
|
.append('foreignObject').attr('width', chartWidth).attr('height', this.displayOption.operationAreaHeight).attr('fill', 'none')
|
|
416
417
|
.append('xhtml:div').style('height', (this.displayOption.operationAreaHeight - 4) + 'px').style('overflow', 'hidden').style('margin-top', '4px');
|
|
417
418
|
const selectElement = operationArea.append('select').style('margin-left', this.displayOption.marginLeft + 'px')
|
|
418
|
-
.style('background-color',
|
|
419
|
+
.style('background-color', backgroundColor)
|
|
419
420
|
.style('font-size', this.displayOption.operationSelectFontSize).on('change', () => {
|
|
420
421
|
const displayTimePeriod = this.rootElement.select('select').property('value');
|
|
421
422
|
this.updateTimeRange(displayTimePeriod);
|
|
@@ -425,26 +426,26 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
|
|
|
425
426
|
const fillColor = rect.attr('fill');
|
|
426
427
|
const options = selectElement.selectAll('option').data(this.timePeriods).enter().append('option');
|
|
427
428
|
options.text(d => d.name).attr('value', d => d.key).property('selected', d => d.key === Number(this.currentTimePeriod))
|
|
428
|
-
.style('background-color', fillColor);
|
|
429
|
+
.style('background-color', this.model.displaySetting.axisSetting.filterBackgroudColor || fillColor);
|
|
429
430
|
const buttonWidth = this.displayOption.operationButtonWidth + 'px', buttonHeight = this.displayOption.operationButtonHeight + 'px';
|
|
430
431
|
operationArea.append('button').style('width', buttonWidth).style('height', buttonHeight).style('border', 'none')
|
|
431
|
-
.style('float', 'right').style('background-image', 'url(assets/img/
|
|
432
|
-
.style('background-color', '
|
|
432
|
+
.style('float', 'right').style('background-image', 'url(assets/img/black_last_page.png)')
|
|
433
|
+
.style('background-color', backgroundColor).style('background-size', 'cover')
|
|
433
434
|
.on('click', () => { this.loadLastPage(); });
|
|
434
435
|
operationArea.append('button').style('width', buttonWidth).style('height', buttonHeight).style('border', 'none')
|
|
435
|
-
.style('float', 'right').style('background-image', 'url(assets/img/
|
|
436
|
+
.style('float', 'right').style('background-image', 'url(assets/img/black_next_page.png)')
|
|
436
437
|
.style('margin', `0 ${this.displayOption.operationButtonMargin}px 0 0`)
|
|
437
|
-
.style('background-color', '
|
|
438
|
+
.style('background-color', backgroundColor).style('background-size', 'cover')
|
|
438
439
|
.on('click', () => { this.loadNextPage(); });
|
|
439
440
|
operationArea.append('button').style('width', buttonWidth).style('height', buttonHeight).style('border', 'none')
|
|
440
|
-
.style('float', 'right').style('background-image', 'url(assets/img/
|
|
441
|
+
.style('float', 'right').style('background-image', 'url(assets/img/black_previous_page.png)')
|
|
441
442
|
.style('margin', `0 ${this.displayOption.operationButtonMargin}px 0 0`)
|
|
442
|
-
.style('background-color', '
|
|
443
|
+
.style('background-color', backgroundColor).style('background-size', 'cover')
|
|
443
444
|
.on('click', () => { this.loadPreviousPage(); });
|
|
444
445
|
operationArea.append('button').style('width', buttonWidth).style('height', buttonHeight).style('border', 'none')
|
|
445
|
-
.style('float', 'right').style('background-image', 'url(assets/img/
|
|
446
|
+
.style('float', 'right').style('background-image', 'url(assets/img/black_first_page.png)')
|
|
446
447
|
.style('margin', `0 ${this.displayOption.operationButtonMargin}px 0 0`)
|
|
447
|
-
.style('background-color', '
|
|
448
|
+
.style('background-color', backgroundColor).style('background-size', 'cover')
|
|
448
449
|
.on('click', () => { this.loadFirstPage(); });
|
|
449
450
|
}
|
|
450
451
|
timeFormat(datetime, specifier) {
|
|
@@ -24,9 +24,7 @@ export class RingGraphElement extends ReadableElement {
|
|
|
24
24
|
this._barElement$ = el$.find('path[data-id="barArc"]');
|
|
25
25
|
this._textElement$ = el$.find('text[data-id="pText"]');
|
|
26
26
|
setTimeout(() => {
|
|
27
|
-
|
|
28
|
-
this.initFrameNode();
|
|
29
|
-
}
|
|
27
|
+
this.initFrameNode();
|
|
30
28
|
this.changeStates();
|
|
31
29
|
});
|
|
32
30
|
}
|
|
@@ -60,12 +58,12 @@ export class RingGraphElement extends ReadableElement {
|
|
|
60
58
|
const variable = new VariableDefinition(this.model.maxVariable.name, this.model.maxVariable.groupName, this.model.maxVariable.dataSourceCode, this.model.maxVariable.variableVersion);
|
|
61
59
|
return VariableUtil.getConvertedVariableName(this.variableStore, variable);
|
|
62
60
|
}
|
|
63
|
-
initTransformFun() {
|
|
64
|
-
if (this.needAddNumber <= 3)
|
|
65
|
-
return;
|
|
61
|
+
initTransformFun(len) {
|
|
66
62
|
this.$element[0].childNodes.forEach((node) => {
|
|
67
|
-
|
|
68
|
-
|
|
63
|
+
if (!node.transform.baseVal[0])
|
|
64
|
+
return;
|
|
65
|
+
// const matrixE = node.transform.baseVal[0].matrix.e;
|
|
66
|
+
// node.transform.baseVal[0].matrix.e = matrixE + len * 5;
|
|
69
67
|
if (node.nodeName === 'g') {
|
|
70
68
|
const nodeValue = node.attributes['clip-path'].value.replace('url(#', '').replace(')', '');
|
|
71
69
|
const rootNode = node.parentNode.parentNode.parentElement;
|
|
@@ -77,8 +75,8 @@ export class RingGraphElement extends ReadableElement {
|
|
|
77
75
|
const values = [];
|
|
78
76
|
line.split(' ').forEach((item) => {
|
|
79
77
|
const nItem = Number(item);
|
|
80
|
-
if (!isNaN(nItem) && (index === 1 || nItem === -1)) {
|
|
81
|
-
item = nItem > 0 ? nItem + (
|
|
78
|
+
if (!isNaN(nItem) && (index === 1 || index === 2 || nItem === -1)) {
|
|
79
|
+
item = nItem > 0 ? (index === 1 || index === 2 ? nItem + (len + 2) * 8 : nItem + len * 8) : nItem - len * 8;
|
|
82
80
|
}
|
|
83
81
|
values.push(item);
|
|
84
82
|
});
|
|
@@ -91,8 +89,7 @@ export class RingGraphElement extends ReadableElement {
|
|
|
91
89
|
initFrameNode() {
|
|
92
90
|
const arcPath = Snap(this.$element[0]);
|
|
93
91
|
const b = arcPath.getBBox(true);
|
|
94
|
-
|
|
95
|
-
this.rootElement.append('rect').attr('id', 'StateFrame').attr('width', width).attr('height', b.height).attr('fill', 'transparent');
|
|
92
|
+
this.rootElement.append('rect').attr('id', 'StateFrame').attr('width', b.width).attr('height', b.height).attr('fill', 'transparent');
|
|
96
93
|
}
|
|
97
94
|
init(variableName) {
|
|
98
95
|
if (variableName) {
|
|
@@ -124,7 +121,6 @@ export class RingGraphElement extends ReadableElement {
|
|
|
124
121
|
}
|
|
125
122
|
updateScale() {
|
|
126
123
|
// 刻度模糊问题
|
|
127
|
-
let isInitTransform = false;
|
|
128
124
|
const matrix = this.$element[0].transform.baseVal[0].matrix;
|
|
129
125
|
if (!this.$element[0].style.transform) {
|
|
130
126
|
this.$element[0].style.transform = `translate3d(${matrix.e}px, ${matrix.f}px, 0)`;
|
|
@@ -141,11 +137,13 @@ export class RingGraphElement extends ReadableElement {
|
|
|
141
137
|
min = RingGraphElement.DEFAULT_MIN_VALUE;
|
|
142
138
|
max = RingGraphElement.DEFAULT_MAX_VALUE;
|
|
143
139
|
}
|
|
144
|
-
if (this.model.minValueType === VariableValueType.Variable) {
|
|
145
|
-
|
|
146
|
-
if (
|
|
147
|
-
this.
|
|
148
|
-
this.
|
|
140
|
+
if (this.model.minValueType === VariableValueType.Variable || this.model.maxValueType === VariableValueType.Variable) {
|
|
141
|
+
const len = max.toString().length > min.toString().length ? max.toString().length : min.toString().length;
|
|
142
|
+
if (Math.abs(len - this.needAddNumber) > 2) {
|
|
143
|
+
const width = this.$element.find('rect').attr('width');
|
|
144
|
+
this.$element.find('rect').attr('width', Number(width) + (len - this.needAddNumber) * 8);
|
|
145
|
+
this.initTransformFun(Math.abs(len - this.needAddNumber));
|
|
146
|
+
this.needAddNumber = len;
|
|
149
147
|
}
|
|
150
148
|
}
|
|
151
149
|
const avgSacle = ((max - min) / this.model.masterDivisionNumber).toFixed(5);
|
|
@@ -160,18 +158,23 @@ export class RingGraphElement extends ReadableElement {
|
|
|
160
158
|
sacleValue = (sacleValue / Math.pow(10, this.model.fractionDigits)).toFixed(this.model.fractionDigits);
|
|
161
159
|
}
|
|
162
160
|
if (!isNaN(sacleValue)) {
|
|
161
|
+
const oriValue = text.innerHTML;
|
|
163
162
|
text.innerHTML = sacleValue;
|
|
164
|
-
isInitTransform = true;
|
|
165
163
|
if (this.model.minValueType !== VariableValueType.Constant || this.model.maxValueType !== VariableValueType.Constant) {
|
|
166
164
|
// FLEXCLOUD-2619 刻度显示不全问题
|
|
167
165
|
const order = (i + 1) / textElements.length;
|
|
168
|
-
|
|
169
|
-
|
|
166
|
+
const len = oriValue.toString().length - sacleValue.toString().length;
|
|
167
|
+
if (order <= 0.7 && len > 1 && !this.initTransform) {
|
|
168
|
+
text.transform.baseVal[0].matrix.e += (len - 1) * 5;
|
|
169
|
+
}
|
|
170
|
+
if (order > 0.7 && Math.abs(len) > 0) {
|
|
171
|
+
text.transform.baseVal[0].matrix.e += len > 1 ? (len - 1) * 5 : len < -1 ? (len + 1) * 5 : len * 5;
|
|
172
|
+
text.transform.baseVal[0].matrix.e += len === -2 ? -3 : 0;
|
|
170
173
|
}
|
|
171
174
|
}
|
|
172
175
|
}
|
|
173
176
|
}
|
|
174
|
-
this.initTransform =
|
|
177
|
+
this.initTransform = true;
|
|
175
178
|
}
|
|
176
179
|
updateVariableValue(value, variableName) {
|
|
177
180
|
this.updateValueObj(value, variableName);
|