add visibility delegates for fields in edit form
This commit is contained in:
@@ -31,7 +31,7 @@ class FieldEditButton:
|
||||
|
||||
@dataclass
|
||||
class CommandButton:
|
||||
command: ContextData | Callable[[ContextData, Any], ContextData] | str
|
||||
command: ContextData | Callable[["BotEntity", "BotContext"], ContextData] | str
|
||||
caption: str | LazyProxy | Callable[["BotEntity", "BotContext"], str] | None = None
|
||||
visibility: Callable[["BotEntity", "BotContext"], bool] | None = None
|
||||
|
||||
@@ -113,6 +113,12 @@ class _BaseFieldDescriptor:
|
||||
is_visible: (
|
||||
bool | Callable[["FieldDescriptor", "BotEntity", "BotContext"], bool] | None
|
||||
) = None
|
||||
is_visible_in_edit_form: (
|
||||
bool
|
||||
| Callable[["FieldDescriptor", Union["BotEntity", Any], "BotContext"], bool]
|
||||
| None
|
||||
) = None
|
||||
validator: Callable[[Any, "BotContext"], Union[bool, str]] | None = None
|
||||
localizable: bool = False
|
||||
bool_false_value: str | LazyProxy = "no"
|
||||
bool_true_value: str | LazyProxy = "yes"
|
||||
@@ -219,6 +225,7 @@ class CommandCallbackContext[UT: UserBase]:
|
||||
db_session: AsyncSession
|
||||
user: UT
|
||||
app: "QBotApp"
|
||||
app_state: State
|
||||
state_data: dict[str, Any]
|
||||
state: FSMContext
|
||||
form_data: dict[str, Any]
|
||||
|
||||
Reference in New Issue
Block a user