@flexem/fc-gui 3.0.0-alpha.104 → 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.
@@ -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
- if (this.model.maxValueType !== VariableValueType.Variable || this.model.minValueType !== VariableValueType.Variable) {
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 (!isNaN(nItem) && item < 100) {
70
- item = nItem > 0 ? nItem + (this.needAddNumber - 3) * 7 : nItem - (this.needAddNumber - 3) * 7;
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
- const width = this.needAddNumber <= 3 ? b.width : b.width + (this.needAddNumber - 3) * 7;
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 && this.model.minValueType === 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
- if (this.needInitTransform) {
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":40,"character":25,"context":{"typeName":"HTMLElement"}},{"__symbolic":"reference","module":"../service","name":"PermissionChecker","line":40,"character":57},{"__symbolic":"reference","module":"../communication","name":"VariableCommunicator","line":41,"character":30},{"__symbolic":"reference","module":"../config","name":"VariableStore","line":42,"character":23},{"__symbolic":"reference","module":"../localization","name":"Localization","line":43,"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}}}}]
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', 'inherit')
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/last_page.svg)')
432
- .style('background-color', 'inherit')
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/next_page.svg)')
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', 'inherit')
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/previous_page.svg)')
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', 'inherit')
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/first_page.svg)')
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', 'inherit')
448
+ .style('background-color', backgroundColor).style('background-size', 'cover')
448
449
  .on('click', () => { this.loadFirstPage(); });
449
450
  }
450
451
  timeFormat(datetime, specifier) {
@@ -9,6 +9,7 @@ export interface HistoricalCurveAxisSettings {
9
9
  readonly showTick?: boolean;
10
10
  readonly xAxisTickColor?: string;
11
11
  readonly yAxisTickColor?: string;
12
+ readonly filterBackgroudColor?: string;
12
13
  }
13
14
  export declare enum AxisRangeType {
14
15
  Auto = 0,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "main": "bundles/fc-gui.umd.js",
3
- "version": "3.0.0-alpha.104",
3
+ "version": "3.0.0-alpha.105",
4
4
  "module": "public_api.js",
5
5
  "typings": "public_api.d.ts",
6
6
  "license": "UNLICENSED",