Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/form/examples/dynamic-form.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
textarea {
limel-code-editor {
--code-editor-max-height: 20rem;
width: 100%;
min-height: 300px;
}
39 changes: 24 additions & 15 deletions src/components/form/examples/dynamic-form.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, h, State } from '@stencil/core';
import { Component, h, Host, State } from '@stencil/core';
import { FormSchema, ValidationStatus } from '@limetech/lime-elements';

/**
Expand Down Expand Up @@ -44,28 +44,37 @@ export class DynamicFormExample {
}

public render() {
return [
<textarea onChange={this.handleTextChange}>{this.text}</textarea>,
Copy link
Contributor

Choose a reason for hiding this comment

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

in the previous version, one could typ inside the textarea and see the results live in the form below. We should make sure that the same thing happens when using the code-editor

Copy link
Contributor

Choose a reason for hiding this comment

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

On testing it doesn't seem to update live in the form below.

Copy link
Contributor

Choose a reason for hiding this comment

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

Screen.Recording.2025-08-11.at.13.45.29.mov

it seems that the form updates are 1 character behind the actual input of the code editor 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

it's OK to just close the issue and PR too. This is only in the documentations and we don't have to spend time on fixing it. The equation of the efforts versus value added, is a bit questionable 😅

<br />,
<limel-form
onChange={this.handleFormChange}
onValidate={this.handleValidate}
value={this.formData}
schema={this.schema}
/>,
<limel-example-value value={this.formData} />,
<limel-example-value label="Errors" value={this.errors} />,
];
return (
<Host>
<limel-code-editor
language="json"
lineNumbers={true}
lint={true}
fold={true}
onChange={this.handleTextChange}
value={this.text}
/>
<br />
<limel-form
onChange={this.handleFormChange}
onValidate={this.handleValidate}
value={this.formData}
schema={this.schema}
/>
<limel-example-value value={this.formData} />
<limel-example-value label="Errors" value={this.errors} />
</Host>
);
}

private handleFormChange = (event: CustomEvent) => {
this.formData = event.detail;
};

private handleTextChange = (event) => {
this.text = event.target.value;
this.text = event.detail;
try {
const json = JSON.parse(event.target.value);
const json = JSON.parse(event.detail);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@Kiarokh I redefined this to fix the lagging render issue in the last fixup

if (json) {
this.schema = json;
}
Expand Down