Skip to content

Commit

Permalink
add an option to disabled to SpMenu and SpSliderWithLabel
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdullahAlfaraj committed Oct 18, 2023
1 parent 56a70af commit 0ae8bb7
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
2 changes: 0 additions & 2 deletions typescripts/after_detailer/after_detailer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ export class AfterDetailerComponent extends React.Component<{
<SpMenu
title="model"
items={store.data.model_list}
// disabled={script_store.disabled}
// style="width: 199px; margin-right: 5px"
label_item="Select a ADetailer Model"
// id={'model_list'}
Expand Down Expand Up @@ -219,7 +218,6 @@ export class AfterDetailerComponent extends React.Component<{
<SpMenu
title="controlnet inpaint model"
items={store.data.controlnet_models}
// disabled={script_store.disabled}
// style="width: 199px; margin-right: 5px"
label_item="Select a ControlNet Model"
// id={'model_list'}
Expand Down
1 change: 0 additions & 1 deletion typescripts/main/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ export class VAEComponent extends React.Component<{
<SpMenu
title="vae models"
items={store.data.vae_model_list}
// disabled={script_store.disabled}
// style="width: 199px; margin-right: 5px"
label_item="Select A VAE"
// id={'model_list'}
Expand Down
2 changes: 1 addition & 1 deletion typescripts/ultimate_sd_upscaler/scripts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class ScriptComponent extends React.Component<{}> {
<SpMenu
title="Scripts"
items={script_store.scripts_list}
disabled={script_store.disabled}
disabled_items={script_store.disabled}
// style="width: 199px; margin-right: 5px"
label_item="Select A Script"
id={'script_list'}
Expand Down
8 changes: 6 additions & 2 deletions typescripts/util/elements.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export class SpSliderWithLabel extends React.Component<{
output_value?: number // can be use to represent sd value
// slider_value?: number // it's slider value can be from 1 to 100
slider_type?: SliderType
disabled?: boolean
}> {
// const [sliderValue,setSliderValue] = useState<number>(0)
state = { output_value: this.props.output_value || 0, slider_value: 0 }
Expand Down Expand Up @@ -164,6 +165,7 @@ export class SpSliderWithLabel extends React.Component<{
show-value="false"
// id="slControlNetWeight_0"
class="slControlNetWeight_"
disabled={this.props.disabled ? true : void 0}
min={this.in_min}
max={this.in_max}
value={this.state.slider_value}
Expand Down Expand Up @@ -197,7 +199,8 @@ export class SpMenu extends React.Component<{
title?: string
style?: CSSProperties
items?: string[]
disabled?: boolean[]
disabled?: boolean
disabled_items?: boolean[]
label_item?: string
onChange?: any
selected_index?: number
Expand Down Expand Up @@ -238,6 +241,7 @@ export class SpMenu extends React.Component<{
title={this.props.title}
size={this.props.size || 'm'}
style={this.props.style}
disabled={this.props.disabled ? 'disabled' : undefined}
// style={{ width: '199px', marginRight: '5px' }}
>
<sp-menu id={this.props.id} slot="options">
Expand All @@ -263,7 +267,7 @@ export class SpMenu extends React.Component<{
: undefined
}
disabled={
this.props.disabled?.[index]
this.props.disabled_items?.[index]
? 'disabled'
: undefined
}
Expand Down

0 comments on commit 0ae8bb7

Please sign in to comment.