View DataRow+ViewModelConvertible.swift
This file contains 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) | |
) | |
} |
View DataRow.swift
This file contains 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" |
View DataRow.py
This file contains 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 |
View DataRow.py
This file contains 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 | |
@classmethod | |
def component_type(cls) -> ComponentType: | |
return ComponentType.DATA_ROW_STACKED | |
class Layout(str, Enum): |
View ViewModel.swift
This file contains 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 |
View Action.py
This file contains 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: |
View SDUIComponent.swift
This file contains 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 | |
} |
View SDUIComponent.ts
This file contains 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 |
View SDUIComponent.kt
This file contains 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 |
View SDUIComponent.swift
This file contains 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) | |
} |
NewerOlder