-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Stefan Kuethe
committed
Sep 24, 2024
1 parent
5e6b419
commit a7ddcf3
Showing
5 changed files
with
145 additions
and
21 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from pydantic import BaseModel | ||
|
||
from typing import Optional | ||
|
||
from ._utils import as_camel_dict_recursive | ||
from enum import Enum | ||
|
||
|
||
class Editors(Enum): | ||
NUMBER = "number" | ||
INPUT = "input" | ||
STAR = "star" | ||
PROGRESS = "progress" | ||
|
||
|
||
class Editor(BaseModel): | ||
@property | ||
def name(self) -> str: | ||
return "" | ||
|
||
def to_dict(self) -> dict: | ||
return as_camel_dict_recursive(self.model_dump(exclude_none=True)) | ||
|
||
|
||
class NumberEditor(Editor): | ||
min: Optional[float] = None | ||
max: Optional[float] = None | ||
step: Optional[float] = None | ||
|
||
@property | ||
def name(self) -> str: | ||
return Editors.NUMBER.value | ||
|
||
|
||
class StarEditor(Editor): | ||
@property | ||
def name(self) -> str: | ||
return Editors.STAR.value | ||
|
||
class ProgressEditor(Editor): | ||
min: Optional[float] = None | ||
max: Optional[float] = None | ||
element_attributes: Optional[dict] = None | ||
|
||
@property | ||
def name(self) -> str: | ||
return Editors.PROGRESS.value |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from enum import Enum | ||
from pydantic import BaseModel | ||
from typing import Optional | ||
from ._utils import as_camel_dict_recursive | ||
|
||
class Formatters(Enum): | ||
STAR = "star" | ||
PROGRESS = "progress" | ||
TICK_CROSS = "tickCross" | ||
|
||
class Formatter(BaseModel): | ||
def to_dict(self) -> dict: | ||
return as_camel_dict_recursive(self.model_dump(exclude_none=True)) | ||
|
||
@property | ||
def name(self) -> str: | ||
return "" | ||
|
||
class StarFormatter(Formatter): | ||
stars: Optional[int] = None | ||
|
||
@property | ||
def name(self) -> str: | ||
return Formatters.STAR.value |
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