fix(core): update

This commit is contained in:
Philipp Kunz 2021-11-26 19:05:04 +01:00
parent 750e8cef32
commit c42e8b8bef

View File

@ -260,13 +260,16 @@ export class WccProperties extends LitElement {
}
console.log(anonItem.elementProperties);
const wccFrame = await this.dashboardRef.wccFrame;
let selectedElement: HTMLElement;
let firstFoundInstantiatedElement: HTMLElement;
for (const element of Array.from(wccFrame.children)) {
if (element instanceof (this.selectedItem as any)) {
selectedElement = element as HTMLElement;
firstFoundInstantiatedElement = element as HTMLElement;
break;
}
}
if (!firstFoundInstantiatedElement) {
return;
}
const classProperties: Map<string, any> = anonItem.elementProperties;
if (!classProperties) {
return;
@ -287,38 +290,38 @@ export class WccProperties extends LitElement {
case 'Boolean':
return html`<input
type="checkbox"
?checked=${selectedElement[key]}
?checked=${firstFoundInstantiatedElement[key]}
@input="${(eventArg: any) => {
selectedElement[key] = eventArg.target.checked;
firstFoundInstantiatedElement[key] = eventArg.target.checked;
}}"
/>`;
case 'String':
return html`<input
type="text"
value=${selectedElement[key]}
value=${firstFoundInstantiatedElement[key]}
@input="${(eventArg: any) => {
selectedElement[key] = eventArg.target.value;
firstFoundInstantiatedElement[key] = eventArg.target.value;
}}"
/>`;
case 'Number':
return html`<input
type="number"
value=${selectedElement[key]}
value=${firstFoundInstantiatedElement[key]}
@input="${(eventArg: any) => {
selectedElement[key] = eventArg.target.value;
firstFoundInstantiatedElement[key] = eventArg.target.value;
}}"
/>`;
case 'Enum':
const enumValues: any[] = getEnumValues(property);
return html`<select
@change="${(eventArg: any) => {
selectedElement[key] = eventArg.target.value;
firstFoundInstantiatedElement[key] = eventArg.target.value;
}}"
>
${enumValues.map((valueArg) => {
return html`
<option
?selected=${valueArg === selectedElement[key] ? true : false}
?selected=${valueArg === firstFoundInstantiatedElement[key] ? true : false}
name="${valueArg}"
>
${valueArg}