MaxKB/apps/common/forms/single_select_field.py
CaptainB 67f3ec34a1
Some checks are pending
sync2gitee / repo-sync (push) Waiting to run
Typos Check / Spell Check with Typos (push) Waiting to run
refactor: 模型设置支持配置参数
2024-10-15 21:22:34 +08:00

40 lines
1.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# coding=utf-8
"""
@project: maxkb
@Author
@file single_select_field.py
@date2023/10/31 18:00
@desc:
"""
from typing import List, Dict
from common.forms import BaseLabel
from common.forms.base_field import TriggerType, BaseExecField
class SingleSelect(BaseExecField):
"""
下拉单选
"""
def __init__(self,
label: str or BaseLabel,
text_field: str,
value_field: str,
option_list: List[str:object],
provider: str = None,
method: str = None,
required: bool = False,
default_value: object = None,
relation_show_field_dict: Dict = None,
relation_trigger_field_dict: Dict = None,
trigger_type: TriggerType = TriggerType.OPTION_LIST,
attrs: Dict[str, object] = None,
props_info: Dict[str, object] = None):
super().__init__("SingleSelect", label, text_field, value_field, provider, method, required, default_value,
relation_show_field_dict, relation_trigger_field_dict, trigger_type, attrs, props_info)
self.option_list = option_list
def to_dict(self):
return {**super().to_dict(), 'option_list': self.option_list}