fixes propertyDescriptor is potentially undefined (#1649)

This commit is contained in:
Rainer Wittmann 2021-10-19 11:12:16 +02:00 committed by GitHub
parent 3986d9294c
commit e7743144fe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View file

@ -110,7 +110,7 @@ export class ElsaWorkflowBlueprintViewerScreen {
const activityDescriptor = activityDescriptors.find(x => x.type == source.type);
const properties: Array<ActivityDefinitionProperty> = collection.map(source.inputProperties.data, (value, key) => {
const propertyDescriptor = activityDescriptor.inputProperties.find(x => x.name == key);
const defaultSyntax = propertyDescriptor.defaultSyntax || SyntaxNames.Literal;
const defaultSyntax = propertyDescriptor?.defaultSyntax || SyntaxNames.Literal;
const expressions = {};
expressions[defaultSyntax] = value;
return ({name: key, expressions: expressions, syntax: defaultSyntax});

View file

@ -162,7 +162,7 @@ export class ElsaWorkflowInstanceViewerScreen {
const properties: Array<ActivityDefinitionProperty> = collection.map(activityBlueprint.inputProperties.data, (value, key) => {
const propertyDescriptor = activityDescriptor.inputProperties.find(x => x.name == key) || activityDescriptor.outputProperties.find(x => x.name == key);
const defaultSyntax = propertyDescriptor.defaultSyntax || SyntaxNames.Literal;
const defaultSyntax = propertyDescriptor?.defaultSyntax || SyntaxNames.Literal;
const expressions = {};
const v = activityData[key] || value;
expressions[defaultSyntax] = v;

View file

@ -127,7 +127,7 @@
const propertyEditor = document.createElement('elsa-property-editor');
const propertyDescriptor = activityDescriptor.inputProperties.find(x => x.name === 'Text');
const propertyModel = getOrCreateProperty(activityModel, propertyDescriptor.name);
const defaultSyntax = propertyDescriptor.defaultSyntax || 'Literal';
const defaultSyntax = propertyDescriptor?.defaultSyntax || 'Literal';
const currentValue = propertyModel.expressions[defaultSyntax] || '';
const editorHtml = `<textarea class="focus:elsa-ring-blue-500 focus:elsa-border-blue-500 elsa-block elsa-w-full elsa-min-w-0 elsa-rounded-md sm:elsa-text-sm elsa-border-gray-300" rows="5">${currentValue}</textarea>`;
const editorElement = htmlToElement(editorHtml);