@flexem/fc-gui 3.0.0-alpha.104 → 3.0.0-alpha.106

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}}}}]
@@ -22,7 +22,7 @@ export class DatetimeDisplayElement extends ConditionalDisplayElement {
22
22
  this.getAndSetCurrentTime(format);
23
23
  setInterval(() => {
24
24
  this.getAndSetCurrentTime(format);
25
- }, 1000);
25
+ }, 100);
26
26
  }
27
27
  }
28
28
  getAndSetCurrentTime(format) {
@@ -35,8 +35,12 @@ export declare class HistoricalCurveElement extends ConditionalDisplayElement {
35
35
  private data;
36
36
  private timer;
37
37
  private resizeEventListener;
38
+ private isAndroid;
39
+ private needResize;
38
40
  constructor(element: HTMLElement, injector: Injector, permissionChecker: PermissionChecker, variableCommunicator: VariableCommunicator, variableStore: VariableStore, historyDataStore: HistoryDataStore, signalRAppId: string);
39
41
  dispose(): void;
42
+ private initKeyboardListener;
43
+ private setNeedResize;
40
44
  private getValidTimePeriods;
41
45
  private updateTimeRange;
42
46
  private updateQueryTimeRange;
@@ -30,6 +30,11 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
30
30
  };
31
31
  this.elementStatus = HistoricalCurveElementStatus.Loading;
32
32
  this.data = [];
33
+ this.needResize = true;
34
+ this.setNeedResize = () => {
35
+ this.needResize = false;
36
+ setTimeout(() => this.needResize = true, 500);
37
+ };
33
38
  this.logger = injector.get(LOGGER_SERVICE_TOKEN);
34
39
  this.localization = injector.get(LOCALIZATION);
35
40
  this.timePeriods = this.getValidTimePeriods();
@@ -50,6 +55,7 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
50
55
  }
51
56
  }
52
57
  this.loadFirstPage();
58
+ this.initKeyboardListener();
53
59
  }
54
60
  dispose() {
55
61
  clearInterval(this.refreshIntervalId);
@@ -59,8 +65,19 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
59
65
  if (this.resizeEventListener) {
60
66
  this.resizeEventListener.clear();
61
67
  }
68
+ if (this.isAndroid) {
69
+ window.removeEventListener('native.keyboardshow', this.setNeedResize);
70
+ window.removeEventListener('native.keyboardhide', this.setNeedResize);
71
+ }
62
72
  this.logger.debug(`[GUI]Dispose Histoical Curve Refresh Interval:${d3.time.format('%x %X')(new Date())}`);
63
73
  }
74
+ initKeyboardListener() {
75
+ this.isAndroid = !!navigator.userAgent.match(/(Android)/i);
76
+ if (this.isAndroid) {
77
+ window.addEventListener('native.keyboardshow', this.setNeedResize);
78
+ window.addEventListener('native.keyboardhide', this.setNeedResize);
79
+ }
80
+ }
64
81
  getValidTimePeriods() {
65
82
  const timePeriods = new Array();
66
83
  timePeriods.push({ key: 6, name: this.localization.lastThirtyMinutes });
@@ -307,6 +324,8 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
307
324
  this.rootElement.append('g').datum(data).call(chart);
308
325
  this.rootElement.selectAll('.nv-noData').attr('x', chartWidth / 2).attr('y', chartHeight / 2 + this.displayOption.operationAreaHeight);
309
326
  this.resizeEventListener = nv.utils.windowResize(() => {
327
+ if (!this.needResize)
328
+ return;
310
329
  chart.update();
311
330
  this.rootElement.selectAll('.nv-noData').attr('x', chartWidth / 2).attr('y', chartHeight / 2 + this.displayOption.operationAreaHeight);
312
331
  });
@@ -411,11 +430,12 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
411
430
  }
412
431
  }
413
432
  renderOperationArea(chartWidth, chartHeight) {
433
+ const backgroundColor = this.model.displaySetting.axisSetting.filterBackgroudColor || 'inherit';
414
434
  const operationArea = this.rootElement.append('g').attr('transform', `translate(0,${chartHeight + this.displayOption.operationAreaMarginTop})`)
415
435
  .append('foreignObject').attr('width', chartWidth).attr('height', this.displayOption.operationAreaHeight).attr('fill', 'none')
416
436
  .append('xhtml:div').style('height', (this.displayOption.operationAreaHeight - 4) + 'px').style('overflow', 'hidden').style('margin-top', '4px');
417
437
  const selectElement = operationArea.append('select').style('margin-left', this.displayOption.marginLeft + 'px')
418
- .style('background-color', 'inherit')
438
+ .style('background-color', backgroundColor)
419
439
  .style('font-size', this.displayOption.operationSelectFontSize).on('change', () => {
420
440
  const displayTimePeriod = this.rootElement.select('select').property('value');
421
441
  this.updateTimeRange(displayTimePeriod);
@@ -425,26 +445,26 @@ export class HistoricalCurveElement extends ConditionalDisplayElement {
425
445
  const fillColor = rect.attr('fill');
426
446
  const options = selectElement.selectAll('option').data(this.timePeriods).enter().append('option');
427
447
  options.text(d => d.name).attr('value', d => d.key).property('selected', d => d.key === Number(this.currentTimePeriod))
428
- .style('background-color', fillColor);
448
+ .style('background-color', this.model.displaySetting.axisSetting.filterBackgroudColor || fillColor);
429
449
  const buttonWidth = this.displayOption.operationButtonWidth + 'px', buttonHeight = this.displayOption.operationButtonHeight + 'px';
430
450
  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')
451
+ .style('float', 'right').style('background-image', 'url(assets/img/black_last_page.png)')
452
+ .style('background-color', backgroundColor).style('background-size', 'cover')
433
453
  .on('click', () => { this.loadLastPage(); });
434
454
  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)')
455
+ .style('float', 'right').style('background-image', 'url(assets/img/black_next_page.png)')
436
456
  .style('margin', `0 ${this.displayOption.operationButtonMargin}px 0 0`)
437
- .style('background-color', 'inherit')
457
+ .style('background-color', backgroundColor).style('background-size', 'cover')
438
458
  .on('click', () => { this.loadNextPage(); });
439
459
  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)')
460
+ .style('float', 'right').style('background-image', 'url(assets/img/black_previous_page.png)')
441
461
  .style('margin', `0 ${this.displayOption.operationButtonMargin}px 0 0`)
442
- .style('background-color', 'inherit')
462
+ .style('background-color', backgroundColor).style('background-size', 'cover')
443
463
  .on('click', () => { this.loadPreviousPage(); });
444
464
  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)')
465
+ .style('float', 'right').style('background-image', 'url(assets/img/black_first_page.png)')
446
466
  .style('margin', `0 ${this.displayOption.operationButtonMargin}px 0 0`)
447
- .style('background-color', 'inherit')
467
+ .style('background-color', backgroundColor).style('background-size', 'cover')
448
468
  .on('click', () => { this.loadFirstPage(); });
449
469
  }
450
470
  timeFormat(datetime, specifier) {
@@ -1 +1 @@
1
- [{"__symbolic":"module","version":4,"metadata":{"HistoricalCurveElement":{"__symbolic":"class","extends":{"__symbolic":"reference","module":"../base/conditional-display-element","name":"ConditionalDisplayElement","line":21,"character":44},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":66,"character":25,"context":{"typeName":"HTMLElement"}},{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":67,"character":18},{"__symbolic":"reference","module":"../../service","name":"PermissionChecker","line":68,"character":27},{"__symbolic":"reference","module":"../../communication","name":"VariableCommunicator","line":69,"character":30},{"__symbolic":"reference","module":"../../config","name":"VariableStore","line":70,"character":23},{"__symbolic":"reference","module":"../../config","name":"HistoryDataStore","line":71,"character":43},{"__symbolic":"reference","name":"string"}]}],"dispose":[{"__symbolic":"method"}],"getValidTimePeriods":[{"__symbolic":"method"}],"updateTimeRange":[{"__symbolic":"method"}],"updateQueryTimeRange":[{"__symbolic":"method"}],"reRenderElement":[{"__symbolic":"method"}],"renderElement":[{"__symbolic":"method"}],"renderChart":[{"__symbolic":"method"}],"initPoint":[{"__symbolic":"method"}],"getLineChart":[{"__symbolic":"method"}],"getMultiBarWithFocusChart":[{"__symbolic":"method"}],"renderCommonProperty":[{"__symbolic":"method"}],"renderOperationArea":[{"__symbolic":"method"}],"timeFormat":[{"__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":21,"character":44},"members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"error","message":"Could not resolve type","line":68,"character":25,"context":{"typeName":"HTMLElement"}},{"__symbolic":"reference","module":"@angular/core","name":"Injector","line":69,"character":18},{"__symbolic":"reference","module":"../../service","name":"PermissionChecker","line":70,"character":27},{"__symbolic":"reference","module":"../../communication","name":"VariableCommunicator","line":71,"character":30},{"__symbolic":"reference","module":"../../config","name":"VariableStore","line":72,"character":23},{"__symbolic":"reference","module":"../../config","name":"HistoryDataStore","line":73,"character":43},{"__symbolic":"reference","name":"string"}]}],"dispose":[{"__symbolic":"method"}],"initKeyboardListener":[{"__symbolic":"method"}],"getValidTimePeriods":[{"__symbolic":"method"}],"updateTimeRange":[{"__symbolic":"method"}],"updateQueryTimeRange":[{"__symbolic":"method"}],"reRenderElement":[{"__symbolic":"method"}],"renderElement":[{"__symbolic":"method"}],"renderChart":[{"__symbolic":"method"}],"initPoint":[{"__symbolic":"method"}],"getLineChart":[{"__symbolic":"method"}],"getMultiBarWithFocusChart":[{"__symbolic":"method"}],"renderCommonProperty":[{"__symbolic":"method"}],"renderOperationArea":[{"__symbolic":"method"}],"timeFormat":[{"__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"}]}}}}]
@@ -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.106",
4
4
  "module": "public_api.js",
5
5
  "typings": "public_api.d.ts",
6
6
  "license": "UNLICENSED",