Skip to content

Commit

Permalink
Set data-path attribute on inputs #3488
Browse files Browse the repository at this point in the history
  • Loading branch information
ashklianko committed May 21, 2024
1 parent c300177 commit ad17642
Showing 1 changed file with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ export class InputOccurrenceView
}
};

const updatePathCall = setInterval(() => {
this.updateInputElDataPath();
}, 1000);

this.onRemoved(() => {
if (this.property) {
this.property.unPropertyValueChanged(this.propertyValueChangedHandler);
Expand All @@ -170,6 +174,8 @@ export class InputOccurrenceView
if (this.inputTypeView) {
this.inputTypeView.unOccurrenceValueChanged(this.occurrenceValueChangedHandler);
}

clearInterval(updatePathCall);
});

this.removeButtonEl.onClicked((event: MouseEvent) => {
Expand Down Expand Up @@ -203,4 +209,9 @@ export class InputOccurrenceView
this.validationErrorBlock.setHtml(errorMessage);
this.toggleClass('invalid', !!errorMessage);
}

private updateInputElDataPath(): void {
this.inputElement.getEl().setAttribute('data-path', this.getDataPath()?.toString().replace(/\./g, '/'));
}

}

0 comments on commit ad17642

Please sign in to comment.