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 @@
} 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 @@ -1099,6 +1099,7 @@
if (typeof type !== "undefined") {
data.type = type;
}
console.log(data);

Check warning on line 1102 in canvas_modules/common-canvas/src/common-properties/properties-controller.js

View workflow job for this annotation

GitHub Actions / build

Unexpected console statement
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

this.handlers.propertyListener(data);
}
}
Expand All @@ -1115,6 +1116,15 @@
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 +1176,7 @@
if (options && options.applyProperties === true) {
return this._convertObjectStructure(propertyId, propertyValue);
}
return propertyValue;
return parsedValue;
}

removePropertyValue(inPropertyId) {
Expand Down Expand Up @@ -1279,7 +1289,7 @@
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 +2055,7 @@
});
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