@flexem/fc-gui 3.0.0-alpha.159 → 3.0.0-alpha.160
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 +95 -9
- 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/main-element.js +16 -0
- package/elements/numerical-display/numerical-display-element.d.ts +6 -0
- package/elements/numerical-display/numerical-display-element.js +44 -1
- package/elements/numerical-display/numerical-display-element.metadata.json +1 -1
- package/modal/write-value/write-value-modal.component.js +7 -4
- package/model/numerical-display/numerical-operation.d.ts +10 -2
- package/package.json +1 -1
- package/utils/numerical-operation.service.js +28 -4
|
@@ -38330,6 +38330,9 @@ class numerical_display_element_NumericalDisplayElement extends readable_element
|
|
|
38330
38330
|
this.guiContext = guiContext;
|
|
38331
38331
|
this.displayText = '';
|
|
38332
38332
|
this.enableDataParsed = false;
|
|
38333
|
+
// 上下限变量的实时缓存值(仅当上下限配置为变量类型时使用)
|
|
38334
|
+
this._resolvedUpperLimitValue = undefined;
|
|
38335
|
+
this._resolvedLowerLimitValue = undefined;
|
|
38333
38336
|
this.logger = injector.get(logger["b" /* LOGGER_SERVICE_TOKEN */]);
|
|
38334
38337
|
this.dataTypeService = injector.get(data_type_service["a" /* DataTypeService */]);
|
|
38335
38338
|
this.fractionDigitService = injector.get(fraction_digit_service["a" /* FractionDigitService */]);
|
|
@@ -38349,6 +38352,22 @@ class numerical_display_element_NumericalDisplayElement extends readable_element
|
|
|
38349
38352
|
}
|
|
38350
38353
|
this.initElement();
|
|
38351
38354
|
}
|
|
38355
|
+
/** 当数值上限配置为变量类型时,返回变量名;否则返回 undefined */
|
|
38356
|
+
get upperLimitVariableName() {
|
|
38357
|
+
const upper = this.model.numericalUpperLimit;
|
|
38358
|
+
if (upper && typeof upper === 'object' && upper.type === 1 && upper.variableName) {
|
|
38359
|
+
return upper.variableName;
|
|
38360
|
+
}
|
|
38361
|
+
return undefined;
|
|
38362
|
+
}
|
|
38363
|
+
/** 当数值下限配置为变量类型时,返回变量名;否则返回 undefined */
|
|
38364
|
+
get lowerLimitVariableName() {
|
|
38365
|
+
const lower = this.model.numericalLowerLimit;
|
|
38366
|
+
if (lower && typeof lower === 'object' && lower.type === 1 && lower.variableName) {
|
|
38367
|
+
return lower.variableName;
|
|
38368
|
+
}
|
|
38369
|
+
return undefined;
|
|
38370
|
+
}
|
|
38352
38371
|
get writeVariableName() {
|
|
38353
38372
|
return this.readVariableName;
|
|
38354
38373
|
}
|
|
@@ -38366,6 +38385,17 @@ class numerical_display_element_NumericalDisplayElement extends readable_element
|
|
|
38366
38385
|
*/
|
|
38367
38386
|
reportValueChanged(value) {
|
|
38368
38387
|
var _a, _b, _c;
|
|
38388
|
+
// 拦截上下限变量推送,更新缓存值
|
|
38389
|
+
if (this.upperLimitVariableName && value.variableName === this.upperLimitVariableName) {
|
|
38390
|
+
const num = Number(value.value);
|
|
38391
|
+
this._resolvedUpperLimitValue = (value.value != null && !isNaN(num)) ? num : undefined;
|
|
38392
|
+
return;
|
|
38393
|
+
}
|
|
38394
|
+
if (this.lowerLimitVariableName && value.variableName === this.lowerLimitVariableName) {
|
|
38395
|
+
const num = Number(value.value);
|
|
38396
|
+
this._resolvedLowerLimitValue = (value.value != null && !isNaN(num)) ? num : undefined;
|
|
38397
|
+
return;
|
|
38398
|
+
}
|
|
38369
38399
|
// 处理系统变量"当前语种ID"
|
|
38370
38400
|
if (value.variableName === '当前语种ID') {
|
|
38371
38401
|
let displayValue = value.value;
|
|
@@ -38502,7 +38532,20 @@ class numerical_display_element_NumericalDisplayElement extends readable_element
|
|
|
38502
38532
|
if (null == this.writeVariableName) {
|
|
38503
38533
|
return;
|
|
38504
38534
|
}
|
|
38505
|
-
|
|
38535
|
+
// 获取数值操作配置,上下限变量类型已在 reportValueChanged 中实时更新到缓存
|
|
38536
|
+
const numericalOperation = this.numericalOperationService.getNumericalOperations(this.model);
|
|
38537
|
+
// 用缓存的实时值替换变量类型上下限
|
|
38538
|
+
if (typeof numericalOperation.numericalUpperLimit === 'object' && numericalOperation.numericalUpperLimit.type === 1) {
|
|
38539
|
+
numericalOperation.numericalUpperLimit = this._resolvedUpperLimitValue != null
|
|
38540
|
+
? this._resolvedUpperLimitValue
|
|
38541
|
+
: (this.dataTypeService.getMaxValue(this.model.version || 0, this.model.dataType || 0, this.model.fBoxDataType || 0) || 0);
|
|
38542
|
+
}
|
|
38543
|
+
if (typeof numericalOperation.numericalLowerLimit === 'object' && numericalOperation.numericalLowerLimit.type === 1) {
|
|
38544
|
+
numericalOperation.numericalLowerLimit = this._resolvedLowerLimitValue != null
|
|
38545
|
+
? this._resolvedLowerLimitValue
|
|
38546
|
+
: (this.dataTypeService.getMinValue(this.model.version || 0, this.model.dataType || 0, this.model.fBoxDataType || 0) || 0);
|
|
38547
|
+
}
|
|
38548
|
+
const args = new WriteValueModalArgs(this.writeVariableName, this.model.dataType, this.model.fBoxDataType, this.model.integerDigits, this.model.fractionDigits, numericalOperation, this.model.version, this.enableDataParsed, this.releasedVariableService, this.guiContext);
|
|
38506
38549
|
this.writeValueMmodalRef = this.modalService.show(write_value_modal_component["a" /* WriteValueModalComponent */], {
|
|
38507
38550
|
initialState: { args: args }, backdrop: 'static', class: 'gui-modal-dialog-position', animated: false
|
|
38508
38551
|
});
|
|
@@ -43744,6 +43787,17 @@ class main_element_MainElement {
|
|
|
43744
43787
|
if (variableName && !variableNames.find(v => Object(lodash["isEqual"])(variableName, v))) {
|
|
43745
43788
|
variableNames.push(element.readVariableName);
|
|
43746
43789
|
}
|
|
43790
|
+
// 数值显示元件:上下限变量类型时,将上下限变量名也加入订阅
|
|
43791
|
+
if (element instanceof numerical_display_element_NumericalDisplayElement) {
|
|
43792
|
+
const upperLimitVarName = element.upperLimitVariableName;
|
|
43793
|
+
if (upperLimitVarName && !variableNames.find(v => Object(lodash["isEqual"])(upperLimitVarName, v))) {
|
|
43794
|
+
variableNames.push(upperLimitVarName);
|
|
43795
|
+
}
|
|
43796
|
+
const lowerLimitVarName = element.lowerLimitVariableName;
|
|
43797
|
+
if (lowerLimitVarName && !variableNames.find(v => Object(lodash["isEqual"])(lowerLimitVarName, v))) {
|
|
43798
|
+
variableNames.push(lowerLimitVarName);
|
|
43799
|
+
}
|
|
43800
|
+
}
|
|
43747
43801
|
}
|
|
43748
43802
|
});
|
|
43749
43803
|
return variableNames;
|
|
@@ -43782,6 +43836,11 @@ class main_element_MainElement {
|
|
|
43782
43836
|
e.minVariableName === value.variableName || e.maxVariableName === value.variableName))) {
|
|
43783
43837
|
e.reportValueChanged(value);
|
|
43784
43838
|
}
|
|
43839
|
+
// 数值显示元件:上下限变量推送分发
|
|
43840
|
+
if (e instanceof numerical_display_element_NumericalDisplayElement && value.variableName && (e.upperLimitVariableName === value.variableName ||
|
|
43841
|
+
e.lowerLimitVariableName === value.variableName)) {
|
|
43842
|
+
e.reportValueChanged(value);
|
|
43843
|
+
}
|
|
43785
43844
|
if (e.readVariableName === value.systemName) {
|
|
43786
43845
|
const rect = (_a = e.currentRect) === null || _a === void 0 ? void 0 : _a[0];
|
|
43787
43846
|
const deviceId = this.getVirtualDeviceIdFromRect(rect);
|
|
@@ -44778,17 +44837,20 @@ let WriteValueModalComponent = class WriteValueModalComponent {
|
|
|
44778
44837
|
this.writeValueRangeText = this.getWriteValueRangeText();
|
|
44779
44838
|
}
|
|
44780
44839
|
setValueRangeAccordToDataParsed(option) {
|
|
44840
|
+
// 上下限已在 numerical-display-element.ts 中解析为数值,直接使用
|
|
44841
|
+
const resolvedUpperLimit = Number(this.numericalOperation.numericalUpperLimit);
|
|
44842
|
+
const resolvedLowerLimit = Number(this.numericalOperation.numericalLowerLimit);
|
|
44781
44843
|
if (this.dataTypeService.isFloat(option.version, this.dataType) || this.enableNumericalOperation) {
|
|
44782
44844
|
this.maxValueLimit = this.dataTypeService.getMaxValue(option.version, this.dataType, this.fBoxDataType);
|
|
44783
44845
|
this.minValueLimit = this.dataTypeService.getMinValue(option.version, this.dataType, this.fBoxDataType);
|
|
44784
|
-
this.numericalLowerLimit =
|
|
44785
|
-
this.numericalUpperLimit =
|
|
44846
|
+
this.numericalLowerLimit = resolvedLowerLimit;
|
|
44847
|
+
this.numericalUpperLimit = resolvedUpperLimit;
|
|
44786
44848
|
}
|
|
44787
44849
|
else {
|
|
44788
44850
|
this.maxValueLimit = +this.fractionDigitService.movePoint(this.dataTypeService.getMaxValue(option.version, this.dataType, this.fBoxDataType), -this.fractionDigits);
|
|
44789
44851
|
this.minValueLimit = +this.fractionDigitService.movePoint(this.dataTypeService.getMinValue(option.version, this.dataType, this.fBoxDataType), -this.fractionDigits);
|
|
44790
|
-
this.numericalLowerLimit = +this.fractionDigitService.movePoint(
|
|
44791
|
-
this.numericalUpperLimit = +this.fractionDigitService.movePoint(
|
|
44852
|
+
this.numericalLowerLimit = +this.fractionDigitService.movePoint(resolvedLowerLimit, -this.fractionDigits);
|
|
44853
|
+
this.numericalUpperLimit = +this.fractionDigitService.movePoint(resolvedUpperLimit, -this.fractionDigits);
|
|
44792
44854
|
}
|
|
44793
44855
|
const minValue = this.numericalOperationService.getWriteMinValue(this.minValueLimit, this.numericalOperation);
|
|
44794
44856
|
const maxValue = this.numericalOperationService.getWriteMaxValue(this.maxValueLimit, this.numericalOperation);
|
|
@@ -45362,10 +45424,34 @@ let numerical_operation_service_NumericalOperationService = class NumericalOpera
|
|
|
45362
45424
|
}
|
|
45363
45425
|
getNumericalOperations(model) {
|
|
45364
45426
|
const numericalOperation = {};
|
|
45365
|
-
|
|
45366
|
-
|
|
45367
|
-
|
|
45368
|
-
|
|
45427
|
+
// 处理上限:兼容老结构(number)和新结构(变量对象)
|
|
45428
|
+
if (model.numericalUpperLimit || model.numericalUpperLimit === 0) {
|
|
45429
|
+
if (typeof model.numericalUpperLimit === 'object' && model.numericalUpperLimit.type === 1) {
|
|
45430
|
+
// 新结构:变量类型,保留原对象
|
|
45431
|
+
numericalOperation.numericalUpperLimit = model.numericalUpperLimit;
|
|
45432
|
+
}
|
|
45433
|
+
else {
|
|
45434
|
+
// 老结构:数字类型
|
|
45435
|
+
numericalOperation.numericalUpperLimit = +model.numericalUpperLimit;
|
|
45436
|
+
}
|
|
45437
|
+
}
|
|
45438
|
+
else {
|
|
45439
|
+
numericalOperation.numericalUpperLimit = this.dataTypeService.getMaxValue(model.version, model.dataType, model.fBoxDataType, model.integerDigits, model.fractionDigits);
|
|
45440
|
+
}
|
|
45441
|
+
// 处理下限:兼容老结构(number)和新结构(变量对象)
|
|
45442
|
+
if (model.numericalLowerLimit || model.numericalLowerLimit === 0) {
|
|
45443
|
+
if (typeof model.numericalLowerLimit === 'object' && model.numericalLowerLimit.type === 1) {
|
|
45444
|
+
// 新结构:变量类型,保留原对象
|
|
45445
|
+
numericalOperation.numericalLowerLimit = model.numericalLowerLimit;
|
|
45446
|
+
}
|
|
45447
|
+
else {
|
|
45448
|
+
// 老结构:数字类型
|
|
45449
|
+
numericalOperation.numericalLowerLimit = +model.numericalLowerLimit;
|
|
45450
|
+
}
|
|
45451
|
+
}
|
|
45452
|
+
else {
|
|
45453
|
+
numericalOperation.numericalLowerLimit = this.dataTypeService.getMinValue(model.version, model.dataType, model.fBoxDataType, model.integerDigits, model.fractionDigits);
|
|
45454
|
+
}
|
|
45369
45455
|
numericalOperation.enableNumericalOperation = model.enableNumericalOperation;
|
|
45370
45456
|
if (model.enableNumericalOperation) {
|
|
45371
45457
|
numericalOperation.type = model.numericalOperationSetting.type;
|