mirror of
https://gitee.com/sui-feng-cb/AzurLaneAutoScript1
synced 2026-04-10 05:12:09 +08:00
Opt: Leave only one option if a select is disabled
to stop people from asking why event is not selectable
This commit is contained in:
@@ -333,15 +333,25 @@ def put_arg_select(kwargs: T_Output_Kwargs) -> Output:
|
|||||||
disabled: bool = kwargs.pop("disabled", False)
|
disabled: bool = kwargs.pop("disabled", False)
|
||||||
_: str = kwargs.pop("invalid_feedback", None)
|
_: str = kwargs.pop("invalid_feedback", None)
|
||||||
|
|
||||||
option = []
|
if disabled:
|
||||||
if options:
|
label = value
|
||||||
for opt, label in zip(options, options_label):
|
for opt, opt_label in zip(options, options_label):
|
||||||
o = {"label": label, "value": opt}
|
if opt == value:
|
||||||
if value == opt:
|
label = opt_label
|
||||||
o["selected"] = True
|
break
|
||||||
else:
|
option = [{
|
||||||
o["disabled"] = disabled
|
"label": label,
|
||||||
option.append(o)
|
"value": value,
|
||||||
|
"selected": True,
|
||||||
|
}]
|
||||||
|
else:
|
||||||
|
option = []
|
||||||
|
if options:
|
||||||
|
for opt, label in zip(options, options_label):
|
||||||
|
o = {"label": label, "value": opt}
|
||||||
|
if value == opt:
|
||||||
|
o["selected"] = True
|
||||||
|
option.append(o)
|
||||||
kwargs["options"] = option
|
kwargs["options"] = option
|
||||||
|
|
||||||
return put_scope(
|
return put_scope(
|
||||||
|
|||||||
Reference in New Issue
Block a user