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