Skip to content

Commit

Permalink
disable variable selector when applicable
Browse files Browse the repository at this point in the history
  • Loading branch information
ivicic-petr committed May 9, 2024
1 parent e14a4d8 commit 639c14e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/html/component/properties-editor/default-properties.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ export const functionInputEssentialWithCondition = (id: string): IFunctionInputE
id,
name: 'function-input-essential',
variant: StaticPropertyType.FunctionInputEssentialWithCondition,
target: 'func',
input: 'var',
target: undefined,
input: undefined,
value: Essentiality.TRUE,
context: ''
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,8 @@ export default class StaticInputEssentialCondition extends StaticDynamicProperty
`)}
</select>
<span>${this.getEssentialitySymbol()}</span>
<select id="second-selector" class="uk-select" @change="${this.secondChanged}">
<select id="second-selector" class="uk-select" @change="${this.secondChanged}"
?disabled="${this.property.target === undefined}">
<option value="${undefined}">---</option>
${map(this.getSecondSelectorItems(), (item) => html`
<option value="${item}">${item}</option>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ export default class StaticInputMonotonicCondition extends StaticDynamicProperty
}

firstChanged (event: Event): void {
const value = (event.target as HTMLSelectElement).value
let value: string | undefined = (event.target as HTMLSelectElement).value
value = value === '' ? undefined : value
console.log(value)
if (this.property.variant === StaticPropertyType.FunctionInputMonotonicWithCondition) {
this.updateProperty({
Expand All @@ -76,7 +77,8 @@ export default class StaticInputMonotonicCondition extends StaticDynamicProperty
}

secondChanged (event: Event): void {
const value = (event.target as HTMLSelectElement).value
let value: string | undefined = (event.target as HTMLSelectElement).value
value = value === '' ? undefined : value
if (this.property.variant === StaticPropertyType.FunctionInputMonotonicWithCondition) {
this.updateProperty({
...this.property,
Expand Down Expand Up @@ -130,8 +132,9 @@ export default class StaticInputMonotonicCondition extends StaticDynamicProperty
`)}
</select>
<span>${this.getMonotonicitySymbol()}</span>
<select id="second-selector" class="uk-select" @change="${this.secondChanged}">
<option value="${undefined}">---</option>
<select id="second-selector" class="uk-select" @change="${this.secondChanged}"
?disabled="${this.property.target === undefined}">
<option value="${undefined}">---</option>
${map(this.getSecondSelectorItems(), (item) => html`
<option value="${item}">${item}</option>
`)}
Expand Down

0 comments on commit 639c14e

Please sign in to comment.