@flexem/fc-gui 3.0.0-alpha.17 → 3.0.0-alpha.171
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 +424 -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/assets/img/exclamation-outline-circle.png +0 -0
- package/bundles/@flexem/fc-gui.umd.js +39304 -34437
- package/bundles/@flexem/fc-gui.umd.js.map +1 -1
- package/bundles/@flexem/fc-gui.umd.min.js +5 -5
- package/bundles/@flexem/fc-gui.umd.min.js.map +1 -1
- package/communication/variable/variable-communicator.d.ts +5 -0
- package/communication/variable/variable-state-enum.d.ts +1 -0
- package/communication/variable/variable-state-enum.js +1 -0
- package/communication/variable/variable-state-enum.metadata.json +1 -1
- package/communication/variable/variable-value.d.ts +4 -1
- package/communication/variable/variable-value.js +4 -1
- package/communication/variable/variable-value.metadata.json +1 -1
- package/config/alarm/alarm.store.d.ts +6 -0
- package/config/alarm/alarm.store.js +0 -0
- package/config/alarm/alarm.store.metadata.json +1 -0
- package/config/alarm/get-alarms-args.d.ts +12 -0
- package/config/alarm/get-alarms-args.js +13 -0
- package/config/alarm/get-alarms-args.metadata.json +1 -0
- package/config/alarm/index.d.ts +2 -0
- package/config/alarm/index.js +1 -0
- package/config/alarm/index.metadata.json +1 -0
- package/config/config-store.d.ts +2 -0
- package/config/gui-feature-config.d.ts +3 -0
- package/config/gui-feature-config.js +3 -0
- package/config/gui-feature-config.metadata.json +1 -0
- package/config/index.d.ts +2 -0
- package/config/index.js +2 -0
- package/config/index.metadata.json +1 -1
- package/config/variable/variable-store.d.ts +1 -0
- package/elements/air-quality/air-quality-element.d.ts +31 -0
- package/elements/air-quality/air-quality-element.js +194 -0
- package/elements/air-quality/air-quality-element.metadata.json +1 -0
- package/elements/alarm/alarm-element.d.ts +69 -0
- package/elements/alarm/alarm-element.js +497 -0
- package/elements/alarm/alarm-element.metadata.json +1 -0
- package/elements/bar-graph-element.d.ts +10 -2
- package/elements/bar-graph-element.js +135 -5
- package/elements/bar-graph-element.metadata.json +1 -1
- package/elements/base/readable-element.d.ts +6 -1
- package/elements/base/readable-element.js +66 -2
- package/elements/base/readable-element.metadata.json +1 -1
- package/elements/base/state-control-element.d.ts +3 -1
- package/elements/base/state-control-element.js +21 -5
- package/elements/character-display/character-display-element.js +3 -2
- package/elements/character-display/character-display-element.metadata.json +1 -1
- package/elements/datetime-display/datetime-display-element.d.ts +1 -0
- package/elements/datetime-display/datetime-display-element.js +10 -2
- package/elements/datetime-display/datetime-display-element.metadata.json +1 -1
- package/elements/datetime-display/time-zone-select-json.d.ts +8 -0
- package/elements/datetime-display/time-zone-select-json.js +558 -0
- package/elements/historical-curve/historical-curve.element.d.ts +41 -3
- package/elements/historical-curve/historical-curve.element.js +662 -32
- package/elements/historical-curve/historical-curve.element.metadata.json +1 -1
- package/elements/main-element.d.ts +1 -0
- package/elements/main-element.js +75 -9
- package/elements/main-element.metadata.json +1 -1
- package/elements/meter-element.d.ts +7 -1
- package/elements/meter-element.js +76 -7
- package/elements/meter-element.metadata.json +1 -1
- package/elements/numerical-display/numerical-display-element.d.ts +22 -3
- package/elements/numerical-display/numerical-display-element.js +145 -12
- package/elements/numerical-display/numerical-display-element.metadata.json +1 -1
- package/elements/per-view-variable-communicator.d.ts +4 -0
- package/elements/per-view-variable-communicator.js +21 -1
- package/elements/per-view-variable-communicator.metadata.json +1 -1
- package/elements/ring-graph/ring-graph-element.d.ts +13 -1
- package/elements/ring-graph/ring-graph-element.js +164 -3
- package/elements/ring-graph/ring-graph-element.metadata.json +1 -1
- package/elements/scroll-alarm/scroll-alarm-element.d.ts +78 -0
- package/elements/scroll-alarm/scroll-alarm-element.js +843 -0
- package/elements/scroll-alarm/scroll-alarm-element.metadata.json +1 -0
- package/elements/shared/graph/graph-state-element.d.ts +1 -0
- package/elements/shared/graph/graph-state-element.js +30 -1
- package/elements/shared/graph/graph-state-element.metadata.json +1 -1
- package/elements/shared/text/text-element.d.ts +14 -0
- package/elements/shared/text/text-element.js +42 -4
- package/elements/shared/text/text-element.metadata.json +1 -1
- package/elements/shared/text/text-state-element.d.ts +39 -2
- package/elements/shared/text/text-state-element.js +242 -67
- package/elements/shared/text/text-state-element.metadata.json +1 -1
- package/elements/static-elements/hyperlink-element.d.ts +28 -2
- package/elements/static-elements/hyperlink-element.js +153 -4
- package/elements/static-elements/hyperlink-element.metadata.json +1 -1
- package/elements/static-elements/text-element.d.ts +28 -2
- package/elements/static-elements/text-element.js +162 -12
- package/elements/static-elements/text-element.metadata.json +1 -1
- package/elements/switch-indicator-light/bit-indicator-light-operator.d.ts +1 -0
- package/elements/switch-indicator-light/bit-indicator-light-operator.js +10 -3
- package/elements/switch-indicator-light/bit-indicator-light-operator.metadata.json +1 -1
- package/elements/switch-indicator-light/switch-indicator-light-element.d.ts +11 -2
- package/elements/switch-indicator-light/switch-indicator-light-element.js +70 -12
- package/elements/switch-indicator-light/switch-indicator-light-element.metadata.json +1 -1
- package/elements/switch-indicator-light/word-indicator-light-operator.d.ts +1 -0
- package/elements/switch-indicator-light/word-indicator-light-operator.js +10 -3
- package/elements/switch-indicator-light/word-indicator-light-operator.metadata.json +1 -1
- package/elements/video/video-element.d.ts +10 -0
- package/elements/video/video-element.js +119 -21
- package/elements/video/video-element.metadata.json +1 -1
- package/elements/view-operation/view-operation.element.d.ts +28 -2
- package/elements/view-operation/view-operation.element.js +163 -4
- package/elements/view-operation/view-operation.element.metadata.json +1 -1
- package/elements/weather/weater-element.js +0 -1
- package/gui/gui-context.d.ts +25 -2
- package/gui/gui-host.d.ts +1 -1
- package/gui/gui-view.d.ts +4 -1
- package/gui/gui-view.js +69 -8
- package/gui/gui-view.metadata.json +1 -1
- package/gui/gui.component.d.ts +3 -0
- package/gui/gui.component.js +15 -2
- package/gui/gui.component.metadata.json +1 -1
- package/localization/localization.service.d.ts +12 -0
- package/localization/localization.service.js +16 -4
- package/localization/localization.service.metadata.json +1 -1
- package/localization/localization.service.zh_CN.js +14 -2
- package/localization/localization.service.zh_CN.metadata.json +1 -1
- package/modal/write-character/write-character-modal.component.html +4 -4
- package/modal/write-character/write-character-modal.component.js +2 -2
- package/modal/write-character/write-character-modal.component.less +15 -0
- package/modal/write-character/write-character-modal.component.metadata.json +1 -1
- package/modal/write-value/write-value-modal-args.d.ts +5 -1
- package/modal/write-value/write-value-modal-args.js +3 -1
- package/modal/write-value/write-value-modal-args.metadata.json +1 -1
- package/modal/write-value/write-value-modal.component.d.ts +13 -7
- package/modal/write-value/write-value-modal.component.html +10 -5
- package/modal/write-value/write-value-modal.component.js +95 -20
- package/modal/write-value/write-value-modal.component.less +16 -1
- package/modal/write-value/write-value-modal.component.metadata.json +1 -1
- package/model/air-quality/air-quality-info.d.ts +23 -0
- package/model/air-quality/air-quality-info.js +4 -0
- package/model/air-quality/air-quality-info.metadata.json +1 -0
- package/model/air-quality/air-quality.model.d.ts +7 -0
- package/model/air-quality/air-quality.model.js +0 -0
- package/model/air-quality/air-quality.model.metadata.json +1 -0
- package/model/alarm/alarm.model.d.ts +13 -0
- package/model/alarm/alarm.model.js +0 -0
- package/model/alarm/alarm.model.metadata.json +1 -0
- package/model/bar-graph/bar-graph.d.ts +4 -0
- package/model/base/font-setting-model.d.ts +22 -1
- package/model/base/font-setting-model.metadata.json +1 -1
- package/model/base/readable-model.d.ts +4 -0
- package/model/datetime-display/datetime-display.d.ts +1 -0
- package/model/historical-curve/historical-curve-axis-settings.d.ts +11 -0
- package/model/historical-curve/historical-curve-axis-settings.js +5 -0
- package/model/historical-curve/historical-curve-axis-settings.metadata.json +1 -1
- package/model/historical-curve/historical-curve-chanel.model.d.ts +8 -0
- package/model/meter/meter.d.ts +4 -0
- package/model/numerical-display/numerical-operation.d.ts +10 -2
- package/model/ring-graph/ring-graph.model.d.ts +8 -0
- package/model/scroll-alarm/scroll-alarm.model.d.ts +21 -0
- package/model/scroll-alarm/scroll-alarm.model.js +0 -0
- package/model/scroll-alarm/scroll-alarm.model.metadata.json +1 -0
- package/model/shared/state/state.d.ts +1 -0
- package/model/shared/state/state.js +1 -0
- package/model/shared/state/state.metadata.json +1 -1
- package/model/shared/text/font.d.ts +1 -1
- package/model/shared/text/text.d.ts +3 -0
- package/model/switch-indicator-light/switch-indicator-light.d.ts +2 -0
- package/model/view-operation/view-operation-element.model.d.ts +7 -1
- package/package.json +1 -1
- package/public_api.js +1 -0
- package/remote/communication/variable/remote-variable-communicator.d.ts +30 -0
- package/remote/communication/variable/remote-variable-communicator.js +193 -3
- package/remote/communication/variable/remote-variable-communicator.metadata.json +1 -1
- package/remote/communication/variable/remote-variable-protocol.d.ts +8 -0
- package/service/index.d.ts +4 -0
- package/service/index.js +1 -0
- package/service/index.metadata.json +1 -1
- package/service/language.service.d.ts +37 -0
- package/service/language.service.js +0 -0
- package/service/language.service.metadata.json +1 -0
- package/service/released-variable/index.d.ts +1 -0
- package/service/released-variable/index.js +0 -0
- package/service/released-variable/index.metadata.json +1 -0
- package/service/released-variable/released-variable.service.d.ts +4 -0
- package/service/released-variable/released-variable.service.js +0 -0
- package/service/released-variable/released-variable.service.metadata.json +1 -0
- package/service/system-text-library.service.d.ts +77 -0
- package/service/system-text-library.service.js +29 -0
- package/service/system-text-library.service.metadata.json +1 -0
- package/service/text-library.service.d.ts +49 -0
- package/service/text-library.service.js +0 -0
- package/service/text-library.service.metadata.json +1 -0
- package/service/weather.service.d.ts +1 -0
- package/shared/gui-consts.d.ts +3 -0
- package/shared/gui-consts.js +3 -0
- package/shared/gui-consts.metadata.json +1 -1
- package/utils/data-type/fbox-data-type.service.js +40 -0
- package/utils/numerical-operation.service.js +28 -4
|
@@ -1,8 +1,29 @@
|
|
|
1
|
+
export interface TextLibrarySetting {
|
|
2
|
+
readonly labelType: 'text' | 'textLibrary';
|
|
3
|
+
readonly selectedTextLibraryItem?: string | number;
|
|
4
|
+
readonly selectedTextItem?: string | number;
|
|
5
|
+
}
|
|
6
|
+
export interface TextCultures {
|
|
7
|
+
readonly cultures: {
|
|
8
|
+
[languageCode: string]: string;
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
export interface FontStyleCultures {
|
|
12
|
+
readonly [languageCode: string]: {
|
|
13
|
+
readonly fontSize: string;
|
|
14
|
+
readonly fontStyle: string;
|
|
15
|
+
readonly fontColor: string;
|
|
16
|
+
readonly isUnderline: boolean;
|
|
17
|
+
readonly textAlign: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
1
20
|
export interface FontSettingModel {
|
|
2
|
-
readonly text: string;
|
|
21
|
+
readonly text: string | TextCultures;
|
|
3
22
|
readonly stroke: string;
|
|
4
23
|
readonly font: string;
|
|
5
24
|
readonly fontSize: string;
|
|
6
25
|
readonly isUnderline: boolean;
|
|
7
26
|
readonly textAlign: string;
|
|
27
|
+
readonly textLibrary?: TextLibrarySetting;
|
|
28
|
+
readonly fontStyleCultures?: FontStyleCultures;
|
|
8
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"FontSettingModel":{"__symbolic":"interface"}}}]
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"TextLibrarySetting":{"__symbolic":"interface"},"TextCultures":{"__symbolic":"interface"},"FontStyleCultures":{"__symbolic":"interface"},"FontSettingModel":{"__symbolic":"interface"}}}]
|
|
@@ -7,4 +7,8 @@ export interface ReadableModel extends ConditionalEnableModel {
|
|
|
7
7
|
readonly version?: number;
|
|
8
8
|
readonly variableName?: string;
|
|
9
9
|
readonly readVariable?: VariableDefinition;
|
|
10
|
+
readonly minVariable?: any;
|
|
11
|
+
readonly maxVariable?: any;
|
|
12
|
+
readonly minValueType?: any;
|
|
13
|
+
readonly maxValueType?: any;
|
|
10
14
|
}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import { Font } from '../shared/text/font';
|
|
2
2
|
export interface HistoricalCurveAxisSettings {
|
|
3
|
+
readonly yAxisRangeType: AxisRangeType;
|
|
4
|
+
readonly yAxisMax?: number;
|
|
5
|
+
readonly yAxisMin?: number;
|
|
3
6
|
readonly axisColor: string;
|
|
4
7
|
readonly showAxisLabel: boolean;
|
|
5
8
|
readonly axisLabelFont: Font;
|
|
9
|
+
readonly showTick?: boolean;
|
|
10
|
+
readonly xAxisTickColor?: string;
|
|
11
|
+
readonly yAxisTickColor?: string;
|
|
12
|
+
readonly filterBackgroudColor?: string;
|
|
13
|
+
}
|
|
14
|
+
export declare enum AxisRangeType {
|
|
15
|
+
Auto = 0,
|
|
16
|
+
Custom = 1
|
|
6
17
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"HistoricalCurveAxisSettings":{"__symbolic":"interface"}}}]
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"HistoricalCurveAxisSettings":{"__symbolic":"interface"},"AxisRangeType":{"Auto":0,"Custom":1}}}]
|
package/model/meter/meter.d.ts
CHANGED
|
@@ -10,4 +10,8 @@ export interface Meter extends ReadableModel {
|
|
|
10
10
|
readonly radius: number;
|
|
11
11
|
readonly min: number;
|
|
12
12
|
readonly max: number;
|
|
13
|
+
readonly masterDivisionNumber: number;
|
|
14
|
+
readonly subDivisionNumber: number;
|
|
15
|
+
readonly integerDigits: number;
|
|
16
|
+
readonly fractionDigits: number;
|
|
13
17
|
}
|
|
@@ -2,8 +2,16 @@ import { NumericalOperationType } from '../../utils/numerical-operation-type';
|
|
|
2
2
|
import { ProportionalConversion } from './proportional-conversion';
|
|
3
3
|
import { Zoom } from './zoom';
|
|
4
4
|
export interface NumericalOperation {
|
|
5
|
-
numericalUpperLimit: number
|
|
6
|
-
|
|
5
|
+
numericalUpperLimit: number | {
|
|
6
|
+
type: number;
|
|
7
|
+
variableName: string;
|
|
8
|
+
variableVersion?: number;
|
|
9
|
+
};
|
|
10
|
+
numericalLowerLimit: number | {
|
|
11
|
+
type: number;
|
|
12
|
+
variableName: string;
|
|
13
|
+
variableVersion?: number;
|
|
14
|
+
};
|
|
7
15
|
enableNumericalOperation: boolean;
|
|
8
16
|
type: NumericalOperationType;
|
|
9
17
|
proportionalConversion: ProportionalConversion;
|
|
@@ -22,4 +22,12 @@ export interface RingGraphModel extends ConditionalDisplayModel {
|
|
|
22
22
|
readonly alarmRange?: AlarmRangeModel;
|
|
23
23
|
readonly showPercentage: boolean;
|
|
24
24
|
readonly percentageFont?: Font;
|
|
25
|
+
readonly minVariable?: any;
|
|
26
|
+
readonly maxVariable?: any;
|
|
27
|
+
readonly minValueType?: any;
|
|
28
|
+
readonly maxValueType?: any;
|
|
29
|
+
readonly masterDivisionNumber: number;
|
|
30
|
+
readonly subDivisionNumber: number;
|
|
31
|
+
readonly integerDigits: number;
|
|
32
|
+
readonly fractionDigits: number;
|
|
25
33
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ConditionalDynamicDisplayModel } from '../base/conditional-dynamic-display-model';
|
|
2
|
+
import { Point, Size } from '../shared';
|
|
3
|
+
import { DynamicDisplayModel } from '../shared/dynamic-display/dynamic-display-model';
|
|
4
|
+
export interface ScrollAlarmModel extends ConditionalDynamicDisplayModel {
|
|
5
|
+
readonly version: number;
|
|
6
|
+
readonly size: Size;
|
|
7
|
+
readonly location: Point;
|
|
8
|
+
readonly generalSetting?: any;
|
|
9
|
+
readonly filterSetting?: any;
|
|
10
|
+
readonly widths: number[];
|
|
11
|
+
readonly heights: number[];
|
|
12
|
+
readonly columLabels: string[];
|
|
13
|
+
readonly levelText: string[];
|
|
14
|
+
readonly scrollSetting?: {
|
|
15
|
+
readonly scrollInterval?: number;
|
|
16
|
+
readonly scrollDirection?: 'vertical' | 'horizontal';
|
|
17
|
+
readonly pauseOnHover?: boolean;
|
|
18
|
+
readonly autoPlay?: boolean;
|
|
19
|
+
};
|
|
20
|
+
readonly dynamicSetting?: DynamicDisplayModel;
|
|
21
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"ScrollAlarmModel":{"__symbolic":"interface"}}}]
|
|
@@ -5,5 +5,6 @@ export var State;
|
|
|
5
5
|
State[State["Unbind"] = 2] = "Unbind";
|
|
6
6
|
State[State["Abnormal"] = 3] = "Abnormal";
|
|
7
7
|
State[State["Loading"] = 4] = "Loading";
|
|
8
|
+
State[State["InvalidMonitor"] = 5] = "InvalidMonitor";
|
|
8
9
|
State[State["Disable"] = 9] = "Disable";
|
|
9
10
|
})(State || (State = {}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"State":{"Normal":0,"Offline":1,"Unbind":2,"Abnormal":3,"Loading":4,"Disable":9}}}]
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"State":{"Normal":0,"Offline":1,"Unbind":2,"Abnormal":3,"Loading":4,"InvalidMonitor":5,"Disable":9}}}]
|
|
@@ -5,6 +5,7 @@ import { ConditionalEnableModel } from '../base/conditional-enable-model';
|
|
|
5
5
|
import { ConditionItemModel, GraphSetting, Point, Size } from '../shared';
|
|
6
6
|
import { DynamicDisplayModel } from '../shared/dynamic-display/dynamic-display-model';
|
|
7
7
|
import { SecurityModel } from '../base/security-model';
|
|
8
|
+
import { TextLibrarySetting } from '../base/font-setting-model';
|
|
8
9
|
export interface SwitchIndicatorLight extends ConditionalEnableModel, SecurityModel {
|
|
9
10
|
/**
|
|
10
11
|
* @type {(number)}
|
|
@@ -30,4 +31,5 @@ export interface SwitchIndicatorLight extends ConditionalEnableModel, SecurityMo
|
|
|
30
31
|
readonly isAwaysEnable?: boolean;
|
|
31
32
|
readonly enableItems?: ConditionItemModel[];
|
|
32
33
|
readonly fixedPositionType?: number;
|
|
34
|
+
readonly textLibrary?: TextLibrarySetting;
|
|
33
35
|
}
|
|
@@ -2,12 +2,14 @@ import { Size, Text, GraphSetting } from '../shared';
|
|
|
2
2
|
import { ConditionalEnableModel } from '../base/conditional-enable-model';
|
|
3
3
|
import { SecurityModel } from '../base';
|
|
4
4
|
import { ViewOperationType } from './view-operation-type';
|
|
5
|
+
import { TextLibrarySetting } from '../base/font-setting-model';
|
|
5
6
|
export interface ViewOperationElementModel extends ConditionalEnableModel, SecurityModel {
|
|
6
7
|
/**
|
|
7
8
|
* 版本 2 : 动态行为调整
|
|
8
9
|
* 版本 3 :使能控制调整
|
|
9
10
|
* 版本 4 :新增操作记录
|
|
10
|
-
* 版本 5
|
|
11
|
+
* 版本 5 :新增页面操作类型,之前类型都为"切换页面"
|
|
12
|
+
* 版本 6 :新增文本库支持
|
|
11
13
|
*/
|
|
12
14
|
readonly version?: number;
|
|
13
15
|
readonly viewIndex?: number;
|
|
@@ -16,4 +18,8 @@ export interface ViewOperationElementModel extends ConditionalEnableModel, Secur
|
|
|
16
18
|
readonly useGraph: boolean;
|
|
17
19
|
readonly graphSetting: GraphSetting;
|
|
18
20
|
readonly operationType: ViewOperationType;
|
|
21
|
+
/**
|
|
22
|
+
* 文本库配置(版本6新增)
|
|
23
|
+
*/
|
|
24
|
+
readonly textLibrary?: TextLibrarySetting;
|
|
19
25
|
}
|
package/package.json
CHANGED
package/public_api.js
CHANGED
|
@@ -9,6 +9,7 @@ export declare class RemoteVariableCommunicator implements VariableCommunicator
|
|
|
9
9
|
private appIdVariablesMap;
|
|
10
10
|
private connectedSubscription;
|
|
11
11
|
private variableValuesChangedSubscription;
|
|
12
|
+
private virtualDeviceStatesChangedSubscription;
|
|
12
13
|
private variablesToBeOpened;
|
|
13
14
|
private variablesToBeClosed;
|
|
14
15
|
private variableValueCache;
|
|
@@ -17,14 +18,43 @@ export declare class RemoteVariableCommunicator implements VariableCommunicator
|
|
|
17
18
|
private variableStateCache;
|
|
18
19
|
private variableStatesToBeOpened;
|
|
19
20
|
private variableStatesToBeClosed;
|
|
21
|
+
private alarmObservers;
|
|
22
|
+
private alarmChangedSubscription;
|
|
23
|
+
private systemVariableHandlers;
|
|
24
|
+
private offlineValueCache;
|
|
20
25
|
constructor(remoteVariableProtocol: RemoteVariableProtocol, logger: LoggerService);
|
|
26
|
+
private doAlarmChanged;
|
|
21
27
|
private doVariableValuesChanged;
|
|
28
|
+
private doVirtualDeviceStatesChanged;
|
|
22
29
|
private doVariableStatesChanged;
|
|
30
|
+
/**
|
|
31
|
+
* 预填充离线变量值缓存,由 GuiContext 在组态加载时一次性调用。
|
|
32
|
+
* 若状态推送早于接口返回,变量已在 Offline 状态,则直接推送;
|
|
33
|
+
* 否则缓存等待状态事件到来时推送。
|
|
34
|
+
*/
|
|
35
|
+
setOfflineValueCache(variableName: string, value: any): void;
|
|
23
36
|
subscribeVariableStates(variableNames: string[]): Observable<VariableState[]>;
|
|
24
37
|
subscribeVariableState(variableName: string): Observable<VariableState>;
|
|
38
|
+
requestVirtualDeviceState(): Observable<void>;
|
|
25
39
|
openVariables(variableNames: string[], appId?: string): Observable<VariableValue[]>;
|
|
26
40
|
openVariable(variableName: string, appId?: string): Observable<VariableValue>;
|
|
27
41
|
write(variableName: string, value: any): Observable<VariableValue>;
|
|
28
42
|
writeWordByBit(variableName: string, index: number, value: number): Observable<VariableValue>;
|
|
43
|
+
subscribeUserDeviceAlarms(appId?: string): Observable<any[]>;
|
|
44
|
+
subscribeUserOneDeviceAlarms(appId?: string): Observable<any>;
|
|
45
|
+
/**
|
|
46
|
+
* 注册系统变量处理器
|
|
47
|
+
* @param variableName 变量名(如"当前语种ID")
|
|
48
|
+
* @param getValue 获取值的函数
|
|
49
|
+
* @param setValue 设置值的函数
|
|
50
|
+
*/
|
|
51
|
+
registerSystemVariableHandler(variableName: string, getValue: () => Promise<any>, setValue: (value: any) => Promise<void>): void;
|
|
52
|
+
/**
|
|
53
|
+
* 通知系统变量值变化
|
|
54
|
+
* 用于在系统变量值改变时通知所有订阅者
|
|
55
|
+
* @param variableName 变量名
|
|
56
|
+
* @param value 新值
|
|
57
|
+
*/
|
|
58
|
+
notifySystemVariableChange(variableName: string, value: any): void;
|
|
29
59
|
dispose(): void;
|
|
30
60
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { each, remove, uniq } from 'lodash';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
3
|
import { map } from 'rxjs/operators';
|
|
4
|
+
import { VariableStateEnum } from '../../../communication';
|
|
4
5
|
import { StringifyingMap } from '../../../core';
|
|
6
|
+
import { GuiFeatureConfig } from '../../../config';
|
|
5
7
|
export class RemoteVariableCommunicator {
|
|
6
8
|
constructor(remoteVariableProtocol, logger) {
|
|
7
9
|
this.remoteVariableProtocol = remoteVariableProtocol;
|
|
@@ -10,6 +12,11 @@ export class RemoteVariableCommunicator {
|
|
|
10
12
|
this.appIdVariablesMap = new Map();
|
|
11
13
|
this.variableStateObservers = new Map();
|
|
12
14
|
this.variableStateCache = new Map();
|
|
15
|
+
this.alarmObservers = [];
|
|
16
|
+
// 系统变量处理器
|
|
17
|
+
this.systemVariableHandlers = new Map();
|
|
18
|
+
// 预加载的离线变量最新值缓存(组态加载时一次性填充,推送后即删除)
|
|
19
|
+
this.offlineValueCache = new Map();
|
|
13
20
|
this.variableValueCache = new StringifyingMap(k => JSON.stringify(k));
|
|
14
21
|
this.connectedSubscription = this.remoteVariableProtocol.connected.subscribe(() => {
|
|
15
22
|
const variableNamesToStart = [];
|
|
@@ -23,6 +30,18 @@ export class RemoteVariableCommunicator {
|
|
|
23
30
|
});
|
|
24
31
|
this.doVariableStatesChanged();
|
|
25
32
|
this.doVariableValuesChanged();
|
|
33
|
+
this.doVirtualDeviceStatesChanged();
|
|
34
|
+
this.doAlarmChanged();
|
|
35
|
+
}
|
|
36
|
+
doAlarmChanged() {
|
|
37
|
+
if (this.alarmChangedSubscription !== undefined) {
|
|
38
|
+
this.alarmChangedSubscription.unsubscribe();
|
|
39
|
+
}
|
|
40
|
+
this.alarmChangedSubscription = this.remoteVariableProtocol.virtualDeviceAlarmsChanged.subscribe((alarms) => {
|
|
41
|
+
each(this.alarmObservers, ob => {
|
|
42
|
+
ob.next(alarms);
|
|
43
|
+
});
|
|
44
|
+
});
|
|
26
45
|
}
|
|
27
46
|
doVariableValuesChanged() {
|
|
28
47
|
if (this.variableValuesChangedSubscription !== undefined) {
|
|
@@ -42,6 +61,25 @@ export class RemoteVariableCommunicator {
|
|
|
42
61
|
});
|
|
43
62
|
});
|
|
44
63
|
}
|
|
64
|
+
doVirtualDeviceStatesChanged() {
|
|
65
|
+
if (this.virtualDeviceStatesChangedSubscription !== undefined) {
|
|
66
|
+
this.virtualDeviceStatesChangedSubscription.unsubscribe();
|
|
67
|
+
}
|
|
68
|
+
this.virtualDeviceStatesChangedSubscription =
|
|
69
|
+
this.remoteVariableProtocol.virtualDeviceStatesChanged.subscribe((deviceStates) => {
|
|
70
|
+
each(deviceStates, deviceState => {
|
|
71
|
+
const variableName = '设备状态';
|
|
72
|
+
this.variableValueCache.set(variableName, deviceState);
|
|
73
|
+
const data = Object.assign(Object.assign({}, deviceState), { systemName: '设备状态' });
|
|
74
|
+
if (this.observers.has(variableName)) {
|
|
75
|
+
each(this.observers.get(variableName), ob => {
|
|
76
|
+
// TODO 同一个ob监听多个变量的情况,组合成数组一次推送。
|
|
77
|
+
ob.next([data]);
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
}
|
|
45
83
|
doVariableStatesChanged() {
|
|
46
84
|
if (this.variableStatesChangedSubscription !== undefined) {
|
|
47
85
|
this.variableStatesChangedSubscription.unsubscribe();
|
|
@@ -53,13 +91,69 @@ export class RemoteVariableCommunicator {
|
|
|
53
91
|
this.variableStateCache.set(variableName, state);
|
|
54
92
|
if (this.variableStateObservers.has(variableName)) {
|
|
55
93
|
each(this.variableStateObservers.get(variableName), ob => {
|
|
56
|
-
// TODO 同一个ob监听多个变量的情况,组合成数组一次推送。
|
|
57
94
|
ob.next([state]);
|
|
58
95
|
});
|
|
59
96
|
}
|
|
97
|
+
// 离线时推送最后已知值给值订阅者
|
|
98
|
+
if (GuiFeatureConfig.isOfflineDisplayEnabled && state.state === VariableStateEnum.Offline) {
|
|
99
|
+
let cachedValue;
|
|
100
|
+
// 优先用最后一次收到的值(可能是在线时推送的),覆盖所有切页/重连场景
|
|
101
|
+
if (this.variableValueCache.has(variableName)) {
|
|
102
|
+
cachedValue = this.variableValueCache.get(variableName).value;
|
|
103
|
+
}
|
|
104
|
+
else if (this.offlineValueCache.has(variableName)) {
|
|
105
|
+
// 兜底:变量从未收到过值,用预加载的离线值
|
|
106
|
+
cachedValue = this.offlineValueCache.get(variableName);
|
|
107
|
+
}
|
|
108
|
+
if (cachedValue !== null && cachedValue !== undefined) {
|
|
109
|
+
const variableValue = {
|
|
110
|
+
variableName,
|
|
111
|
+
value: cachedValue,
|
|
112
|
+
state: VariableStateEnum.Offline
|
|
113
|
+
};
|
|
114
|
+
this.variableValueCache.set(variableName, variableValue);
|
|
115
|
+
if (this.observers.has(variableName)) {
|
|
116
|
+
each(this.observers.get(variableName), ob => {
|
|
117
|
+
ob.next([variableValue]);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
60
122
|
});
|
|
61
123
|
});
|
|
62
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* 预填充离线变量值缓存,由 GuiContext 在组态加载时一次性调用。
|
|
127
|
+
* 若状态推送早于接口返回,变量已在 Offline 状态,则直接推送;
|
|
128
|
+
* 否则缓存等待状态事件到来时推送。
|
|
129
|
+
*/
|
|
130
|
+
setOfflineValueCache(variableName, value) {
|
|
131
|
+
if (!GuiFeatureConfig.isOfflineDisplayEnabled) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
if (value === null || value === undefined) {
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
const cachedState = this.variableStateCache.get(variableName);
|
|
138
|
+
if (cachedState && cachedState.state === VariableStateEnum.Offline) {
|
|
139
|
+
// 状态已推送过,直接补推值给订阅者
|
|
140
|
+
const variableValue = {
|
|
141
|
+
variableName,
|
|
142
|
+
value,
|
|
143
|
+
state: VariableStateEnum.Offline
|
|
144
|
+
};
|
|
145
|
+
this.variableValueCache.set(variableName, variableValue);
|
|
146
|
+
if (this.observers.has(variableName)) {
|
|
147
|
+
each(this.observers.get(variableName), ob => {
|
|
148
|
+
ob.next([variableValue]);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
// 状态还未推送,先缓存,等待状态事件
|
|
154
|
+
this.offlineValueCache.set(variableName, value);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
63
157
|
subscribeVariableStates(variableNames) {
|
|
64
158
|
return new Observable(observer => {
|
|
65
159
|
let variableNamesToStart = [];
|
|
@@ -115,6 +209,9 @@ export class RemoteVariableCommunicator {
|
|
|
115
209
|
subscribeVariableState(variableName) {
|
|
116
210
|
return this.subscribeVariableStates([variableName]).pipe(map(values => values[0]));
|
|
117
211
|
}
|
|
212
|
+
requestVirtualDeviceState() {
|
|
213
|
+
return this.remoteVariableProtocol.requestVirtualDeviceState();
|
|
214
|
+
}
|
|
118
215
|
openVariables(variableNames, appId = '') {
|
|
119
216
|
return new Observable(observer => {
|
|
120
217
|
let variablesToStart = [];
|
|
@@ -140,7 +237,33 @@ export class RemoteVariableCommunicator {
|
|
|
140
237
|
}
|
|
141
238
|
}
|
|
142
239
|
});
|
|
143
|
-
|
|
240
|
+
// 过滤掉系统变量,它们不需要通过SignalR订阅
|
|
241
|
+
const normalVariables = variablesToStart.filter(v => !this.systemVariableHandlers.has(v));
|
|
242
|
+
const systemVariables = variablesToStart.filter(v => this.systemVariableHandlers.has(v));
|
|
243
|
+
// 处理系统变量的初始值
|
|
244
|
+
systemVariables.forEach(variableName => {
|
|
245
|
+
const handler = this.systemVariableHandlers.get(variableName);
|
|
246
|
+
if (handler && handler.getValue) {
|
|
247
|
+
void handler.getValue().then(value => {
|
|
248
|
+
const variableValue = {
|
|
249
|
+
variableName: variableName,
|
|
250
|
+
value: value,
|
|
251
|
+
state: 1 // Normal state
|
|
252
|
+
};
|
|
253
|
+
this.variableValueCache.set(variableName, variableValue);
|
|
254
|
+
if (this.observers.has(variableName)) {
|
|
255
|
+
each(this.observers.get(variableName), ob => {
|
|
256
|
+
ob.next([variableValue]);
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
}).catch(error => {
|
|
260
|
+
if (this.logger) {
|
|
261
|
+
this.logger.error(`[RemoteVariableCommunicator] Failed to get system variable "${variableName}" value:`, error);
|
|
262
|
+
}
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
variablesToStart = uniq(normalVariables);
|
|
144
267
|
if (variablesToStart && variablesToStart.length > 0) {
|
|
145
268
|
if (!this.variablesToBeOpened) {
|
|
146
269
|
this.variablesToBeOpened = [];
|
|
@@ -185,8 +308,24 @@ export class RemoteVariableCommunicator {
|
|
|
185
308
|
}
|
|
186
309
|
write(variableName, value) {
|
|
187
310
|
if (!variableName) {
|
|
188
|
-
return
|
|
311
|
+
return new Observable(observer => {
|
|
312
|
+
observer.complete();
|
|
313
|
+
});
|
|
189
314
|
}
|
|
315
|
+
// 检查是否为系统变量
|
|
316
|
+
if (this.systemVariableHandlers.has(variableName)) {
|
|
317
|
+
const handler = this.systemVariableHandlers.get(variableName);
|
|
318
|
+
// 调用系统变量的setValue处理器
|
|
319
|
+
void handler.setValue(value).catch(error => {
|
|
320
|
+
if (this.logger) {
|
|
321
|
+
this.logger.error('[RemoteVariableCommunicator] Failed to set system variable value:', error);
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
return new Observable(__ => {
|
|
325
|
+
/* 系统变量通过自己的机制通知变化 */
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
// 普通变量通过SignalR写入
|
|
190
329
|
this.remoteVariableProtocol.writeVariable(variableName, value);
|
|
191
330
|
return new Observable(__ => {
|
|
192
331
|
/* do nothing right now, if want value change immediately, can use this code below:
|
|
@@ -203,11 +342,62 @@ export class RemoteVariableCommunicator {
|
|
|
203
342
|
observer.next(new VariableValue(variable, VariableStateEnum.DataNormal, value))*/
|
|
204
343
|
});
|
|
205
344
|
}
|
|
345
|
+
subscribeUserDeviceAlarms(appId = '') {
|
|
346
|
+
return new Observable(observer => {
|
|
347
|
+
this.alarmObservers.push(observer);
|
|
348
|
+
this.remoteVariableProtocol.subscribeVirtualDeviceAlarms(appId);
|
|
349
|
+
return () => {
|
|
350
|
+
this.remoteVariableProtocol.unsubscribeVirtualDeviceAlarms(appId);
|
|
351
|
+
};
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
subscribeUserOneDeviceAlarms(appId = '') {
|
|
355
|
+
return new Observable(observer => {
|
|
356
|
+
const subscription = this.remoteVariableProtocol.historyAlarmChanged.subscribe(value => observer.next(value), error => observer.error(error), () => observer.complete());
|
|
357
|
+
this.remoteVariableProtocol.subscribeUserOneDeviceAlarms(appId);
|
|
358
|
+
return () => {
|
|
359
|
+
subscription.unsubscribe();
|
|
360
|
+
this.remoteVariableProtocol.unsubscribeUserOneDeviceAlarms(appId);
|
|
361
|
+
};
|
|
362
|
+
});
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* 注册系统变量处理器
|
|
366
|
+
* @param variableName 变量名(如"当前语种ID")
|
|
367
|
+
* @param getValue 获取值的函数
|
|
368
|
+
* @param setValue 设置值的函数
|
|
369
|
+
*/
|
|
370
|
+
registerSystemVariableHandler(variableName, getValue, setValue) {
|
|
371
|
+
this.systemVariableHandlers.set(variableName, { getValue, setValue });
|
|
372
|
+
}
|
|
373
|
+
/**
|
|
374
|
+
* 通知系统变量值变化
|
|
375
|
+
* 用于在系统变量值改变时通知所有订阅者
|
|
376
|
+
* @param variableName 变量名
|
|
377
|
+
* @param value 新值
|
|
378
|
+
*/
|
|
379
|
+
notifySystemVariableChange(variableName, value) {
|
|
380
|
+
const variableValue = {
|
|
381
|
+
variableName: variableName,
|
|
382
|
+
value: value,
|
|
383
|
+
state: 1 // Normal state
|
|
384
|
+
};
|
|
385
|
+
// 更新缓存
|
|
386
|
+
this.variableValueCache.set(variableName, variableValue);
|
|
387
|
+
// 通知所有订阅者
|
|
388
|
+
if (this.observers.has(variableName)) {
|
|
389
|
+
each(this.observers.get(variableName), ob => {
|
|
390
|
+
ob.next([variableValue]);
|
|
391
|
+
});
|
|
392
|
+
}
|
|
393
|
+
}
|
|
206
394
|
dispose() {
|
|
207
395
|
// TODO调用所有的ob.complete()。
|
|
208
396
|
this.connectedSubscription.unsubscribe();
|
|
209
397
|
this.variableStatesChangedSubscription.unsubscribe();
|
|
210
398
|
this.variableValuesChangedSubscription.unsubscribe();
|
|
399
|
+
this.virtualDeviceStatesChangedSubscription.unsubscribe();
|
|
400
|
+
this.alarmChangedSubscription.unsubscribe();
|
|
211
401
|
if (this.logger && this.logger.isDebugEnabled()) {
|
|
212
402
|
this.logger.debug('[VariableCommunicator] RemoteVariableCommunicator disposed.');
|
|
213
403
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{"RemoteVariableCommunicator":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"./remote-variable-protocol","name":"RemoteVariableProtocol","line":
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{"RemoteVariableCommunicator":{"__symbolic":"class","members":{"__ctor__":[{"__symbolic":"constructor","parameters":[{"__symbolic":"reference","module":"./remote-variable-protocol","name":"RemoteVariableProtocol","line":38,"character":57},{"__symbolic":"reference","module":"../../../logger","name":"LoggerService","line":38,"character":106}]}],"doAlarmChanged":[{"__symbolic":"method"}],"doVariableValuesChanged":[{"__symbolic":"method"}],"doVirtualDeviceStatesChanged":[{"__symbolic":"method"}],"doVariableStatesChanged":[{"__symbolic":"method"}],"setOfflineValueCache":[{"__symbolic":"method"}],"subscribeVariableStates":[{"__symbolic":"method"}],"subscribeVariableState":[{"__symbolic":"method"}],"requestVirtualDeviceState":[{"__symbolic":"method"}],"openVariables":[{"__symbolic":"method"}],"openVariable":[{"__symbolic":"method"}],"write":[{"__symbolic":"method"}],"writeWordByBit":[{"__symbolic":"method"}],"subscribeUserDeviceAlarms":[{"__symbolic":"method"}],"subscribeUserOneDeviceAlarms":[{"__symbolic":"method"}],"registerSystemVariableHandler":[{"__symbolic":"method"}],"notifySystemVariableChange":[{"__symbolic":"method"}],"dispose":[{"__symbolic":"method"}]}}}}]
|
|
@@ -4,10 +4,18 @@ export interface RemoteVariableProtocol {
|
|
|
4
4
|
connected: Observable<void>;
|
|
5
5
|
variableStatesChanged: Observable<VariableValue[]>;
|
|
6
6
|
variableValuesChanged: Observable<VariableValue[]>;
|
|
7
|
+
virtualDeviceAlarmsChanged: Observable<any>;
|
|
7
8
|
tryOpenVariables(variableNames: string[], appId: string): Observable<void>;
|
|
8
9
|
tryStopVariables(variableNames: string[], appId: string): Observable<void>;
|
|
9
10
|
writeVariable(variableName: string, value: any): Observable<void>;
|
|
10
11
|
writeVariableWordByBit(variableName: string, index: number, value: number): Observable<void>;
|
|
12
|
+
requestVirtualDeviceState(): Observable<void>;
|
|
13
|
+
virtualDeviceStatesChanged: Observable<any>;
|
|
11
14
|
subscribeVariableStates(variableNames: string[]): Observable<void>;
|
|
12
15
|
unsubscribeVariableStates(variableNames: string[]): Observable<void>;
|
|
16
|
+
subscribeVirtualDeviceAlarms(appId: string): any;
|
|
17
|
+
unsubscribeVirtualDeviceAlarms(appId: string): any;
|
|
18
|
+
subscribeUserOneDeviceAlarms(appId: string): any;
|
|
19
|
+
unsubscribeUserOneDeviceAlarms(appId: string): any;
|
|
20
|
+
historyAlarmChanged: Observable<any>;
|
|
13
21
|
}
|
package/service/index.d.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
export { WeatherService } from './weather.service';
|
|
2
2
|
export { PermissionChecker } from './permission-checker';
|
|
3
|
+
export { ReleasedVariableService } from './released-variable';
|
|
3
4
|
export * from './operation-record';
|
|
4
5
|
export * from './video';
|
|
6
|
+
export * from './text-library.service';
|
|
7
|
+
export * from './language.service';
|
|
8
|
+
export * from './system-text-library.service';
|
package/service/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './system-text-library.service';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[{"__symbolic":"module","version":4,"metadata":{},"exports":[{"from":"./weather.service","export":["WeatherService"]},{"from":"./permission-checker","export":["PermissionChecker"]},{"from":"./operation-record"},{"from":"./video"}]}]
|
|
1
|
+
[{"__symbolic":"module","version":4,"metadata":{},"exports":[{"from":"./weather.service","export":["WeatherService"]},{"from":"./permission-checker","export":["PermissionChecker"]},{"from":"./released-variable","export":["ReleasedVariableService"]},{"from":"./operation-record"},{"from":"./video"},{"from":"./text-library.service"},{"from":"./language.service"},{"from":"./system-text-library.service"}]}]
|