Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#2248 After table row is deleted, propertyListener callback has same … #2249

Merged
merged 6 commits into from
Dec 3, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -542,8 +542,8 @@ export default class PropertiesController {
} else if (subControl.valueDef.propType === "enum") {
val = subControl.values[0];
} else if (subControl.valueDef.propType === "integer" ||
subControl.valueDef.propType === "long" ||
subControl.valueDef.propType === "double") {
subControl.valueDef.propType === "long" ||
subControl.valueDef.propType === "double") {
val = 0;
} else if (subControl.valueDef.propType === "structure") {
val = {};
Expand Down Expand Up @@ -1115,6 +1115,15 @@ export default class PropertiesController {
getPropertyValue(inPropertyId, options, defaultValue) {
const propertyId = this.convertPropertyId(inPropertyId);
const propertyValue = this.propertiesStore.getPropertyValue(propertyId);
let parsedValue;
if (Array.isArray(propertyValue)) {
parsedValue = propertyValue.map((itm) => itm);
} else if (propertyValue && typeof propertyValue === "object") {
// Shallow copy for objects
parsedValue = { ...propertyValue };
} else {
parsedValue = propertyValue;
}
let filteredValue = defaultValue;

// don't return hidden/disabled values
Expand Down Expand Up @@ -1166,7 +1175,7 @@ export default class PropertiesController {
if (options && options.applyProperties === true) {
return this._convertObjectStructure(propertyId, propertyValue);
}
return propertyValue;
return parsedValue;
}

removePropertyValue(inPropertyId) {
Expand Down Expand Up @@ -1279,7 +1288,7 @@ export default class PropertiesController {
const control = this.getControl({ name: parameterRef });
if (PropertyUtils.isSubControlStructureObjectType(control)) {
conditionalDefaultValues[parameterRef] =
PropertyUtils.convertObjectStructureToArray(control.valueDef.isList, control.subControls, conditionalDefaultValues[parameterRef]);
PropertyUtils.convertObjectStructureToArray(control.valueDef.isList, control.subControls, conditionalDefaultValues[parameterRef]);
}
this.propertiesStore.updatePropertyValue({ name: parameterRef }, conditionalDefaultValues[parameterRef]);
}
Expand Down Expand Up @@ -2045,7 +2054,7 @@ export default class PropertiesController {
});
const isDifference = consecutiveAry.every((value) => value === 1);
if (isDifference && ((staticRows.includes(0) && !staticRows.includes(controlValue.length - 1)) ||
(!staticRows.includes(0) && staticRows.includes(controlValue.length - 1)))) {
(!staticRows.includes(0) && staticRows.includes(controlValue.length - 1)))) {
isValid = true;
} else {
isValid = false;
Expand Down
Loading