This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public struct DataRow: Codable, Equatable { | |
| public let title: String | |
| public let subtitle: String | |
| public let layout: Layout | |
| public let titleHyperlink: URL? | |
| public let accessoryView: SDUIComponent? | |
| public enum Layout: String { | |
| case vertical = "VERTICAL" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class DataRow(UIComponent): | |
| title: str | |
| subtitle: str | |
| layout: Layout = Layout.HORIZONTAL | |
| title_hyperlink: Optional[Url] = None | |
| accessory_view = Optional[UIComponent] = None | |
| @classmethod | |
| def component_type(cls) -> ComponentType: | |
| return ComponentType.DATA_ROW_STACKED |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func viewModel(context: SDUIContext) -> ViewModel |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Action(BaseModel, ABC): | |
| sdui_action_type: ActionType | |
| def __init__(self, **data) -> None: | |
| data['sdui_action_type'] = self.action_type() | |
| super().__init__(**data) | |
| @classmethod | |
| @abstractmethod | |
| def action_type(cls) -> ActionType: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extension SDUIComponent { | |
| private var concreteModel: Any { | |
| switch self { | |
| case .button(let button): | |
| return button | |
| case .row(let row): | |
| return row | |
| case .text(let text): | |
| return text | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| extension DataRow: ViewModelConvertible { | |
| func viewModel(context: SDUIContext) -> some ViewModel { | |
| return DataRowViewModel( | |
| title: self.title, | |
| titleURL: self.titleHyperlink, | |
| subtitle: self.subtitle, | |
| layout: self.layout.toNativeLayout(), | |
| accessory: accessoryView?.viewModel(context: context) | |
| ) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| SDUIComponent = SDUIButton | SDUIRow | SDUIText |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sealed interface SDUIComponent | |
| data class SDUIButton: SDUIComponent | |
| data class SDUIRow: SDUIComponent | |
| data class SDUIText: SDUIComponent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| enum SDUIComponent: Equatable, Codable { | |
| case button(SDUIButton) | |
| case row(SDUIRow) | |
| case text(SDUIText) | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Row(UIComponent): | |
| title: str | |
| subtitle: Optional[str] = None | |
| @classmethod | |
| def component_type(cls) -> ComponentType: | |
| return ComponentType.BUTTON | |
| @classmethod | |
| def platform_compatibility(cls) -> Dict[Platform, Version]: |
NewerOlder