-
Notifications
You must be signed in to change notification settings - Fork 10
fix: List component #277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
fix: List component #277
Changes from all commits
14a01d9
57ad56c
97cb0e5
a298ea6
644eb12
a90cd62
c9ad75a
866e849
a7ebcb5
394c132
0a57fab
6c4a9bc
aa89fc2
b2f7847
12ad6c1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,102 @@ | ||
| from pydantic import Field, validator, field_validator | ||
| from typing import List, Optional, Union | ||
| from zt_backend.models.components.zt_component import ZTComponent | ||
| from zt_backend.models.components.validations import validate_color | ||
|
|
||
|
|
||
| class ListComponent(ZTComponent): | ||
| """List the Primary components holding the items in the scorllable format""" | ||
|
|
||
| component: str = Field("v-list", description="Vue component name for List") | ||
| childComponents: List[str] = Field( | ||
| [], description="List of child component ids to be placed within the List" | ||
| ) | ||
|
|
||
| color: str = Field("primary", description="Background color of the List") | ||
| elevation: int = Field( | ||
| None, | ||
| ge=0, | ||
| le=24, | ||
| description="Elevation level of the List. Must be between 0 and 24", | ||
| ) | ||
| density: str = Field( | ||
| None, | ||
| enum=["default", "comfortable", "compact"], | ||
| description="Density of the List", | ||
| ) | ||
| width: Union[int, str] = Field("100%", description="Width of the List") | ||
| height: Union[int, str] = Field("100%", description="Height of the List") | ||
|
|
||
| @field_validator("color") | ||
| def validate_color(cls, color): | ||
| return validate_color(color) | ||
|
|
||
|
|
||
| class ListItem(ZTComponent): | ||
| """List Item helps define properties of individual items in the list""" | ||
|
|
||
| component: str = Field( | ||
| "v-list-item", description="Vue component name for List Item" | ||
| ) | ||
| title: str = Field("", description="item title") | ||
| color: str = Field("primary", description="Background color of the List item") | ||
| elevation: int = Field( | ||
| None, | ||
| ge=0, | ||
| le=24, | ||
| description="Elevation level of the List item. Must be between 0 and 24", | ||
| ) | ||
| density: str = Field( | ||
| "default", | ||
| enum=["default", "comfortable", "compact"], | ||
| description="Density of the List Item: default | comfortable | compact", | ||
| ) | ||
| width: Union[int, str] = Field("100%", description="Width of the List item") | ||
| height: Union[int, str] = Field("100%", description="Height of the List item") | ||
| value: str = Field("", description="value for List Item") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is value used on this?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Created the attribute as per the props in v-list-item API Docs
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is value used for in this context
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Following up |
||
| disabled: bool = Field(False, description="removes ability to click List Item") | ||
| childComponents: List[str] = Field( | ||
| [], | ||
| description="List of child component ids to be placed within the ListItem. List title, subtitle come as the child components of the list item", | ||
| ) | ||
|
|
||
| @field_validator("color") | ||
| def validate_color(cls, color): | ||
| return validate_color(color) | ||
|
|
||
| class ListItemTitle(ZTComponent): | ||
| """List Item Title is used to specify the title of the Lsit Item. Use Text component to provide the title details and pass it to the child component of List Item.""" | ||
|
|
||
| component: str = Field( | ||
| "v-list-item-title", description="Vue component name for List item title" | ||
| ) | ||
| childComponents: List[str] = Field( | ||
| [], | ||
| description="List of child component ids to be placed within the ListItemTitle. Mention v-test component to show the text of title", | ||
| ) | ||
|
|
||
|
|
||
| class ListItemSubtitle(ZTComponent): | ||
| """List Item SubtitleTitle is used to specify the Subtitle of the List Item. Use Text component to provide the text details of the subtitle and pass it to the child component of List Item""" | ||
|
|
||
| component: str = Field( | ||
| "v-list-item-subtitle", description="Vue component name for List Item Subtitle" | ||
| ) | ||
| childComponents: List[str] = Field( | ||
| [], | ||
| description="List of child component ids to be placed within the ListItemTitle. Mention v-test component to show the text of Subtitle", | ||
| ) | ||
|
|
||
| class ListSubheader(ZTComponent): | ||
| """List SubHeader is used to specify the Sub Header of the List. Use Text component to provide the title details and pass it to the child component of List.""" | ||
|
|
||
| component: str = Field( | ||
| "v-list-subheader", description="Vue component name for List SubHeader " | ||
| ) | ||
| inset: bool = Field(False, description="inset for Subheader") | ||
| sticky: bool = Field(False, description="sticky for subehader") | ||
| childComponents: List[str] = Field( | ||
| [], | ||
| description="List of child component ids to be placed within the List Subheader. Mention v-text component to show title for subheader", | ||
Carson-Shaar marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.