Skip to content
Snippets Groups Projects
Verified Commit 595dbdd5 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Add missing options

parent 9436c03f
No related branches found
No related tags found
No related merge requests found
...@@ -67,9 +67,9 @@ on any `CharField`:: ...@@ -67,9 +67,9 @@ on any `CharField`::
In your template, make sure to include the form media of your form somewhere In your template, make sure to include the form media of your form somewhere
**after** the form. **after** the form.
Right now, only simple fields with blocks and delimiters are supported. In the The `CleaveWidget` supports all options `Cleave.js`_ supports, as described
future, `django-cleavejs`_ will support all `Cleave.js`_ options and also provide in its `options documentation`_. In the future, `django-cleavejs`_ will also
pre-configured widgets for certain types. provide shortcuts.
Example Example
------- -------
...@@ -83,4 +83,5 @@ It is reduced to a minimal working example for the reader's convenience. ...@@ -83,4 +83,5 @@ It is reduced to a minimal working example for the reader's convenience.
.. _poetry: https://python-poetry.org/ .. _poetry: https://python-poetry.org/
.. _Cleave.js: https://nosir.github.io/cleave.js/ .. _Cleave.js: https://nosir.github.io/cleave.js/
.. _django-yarnpkg: https://edugit.org/AlekSIS/libs/django-yarnpkg .. _django-yarnpkg: https://edugit.org/AlekSIS/libs/django-yarnpkg
.. _options documentation: https://github.com/nosir/cleave.js/blob/master/doc/options.md
.. _Git repository: https://edugit.org/AlekSIS/libs/django-cleavejs .. _Git repository: https://edugit.org/AlekSIS/libs/django-cleavejs
...@@ -12,11 +12,46 @@ __all__ = ("CleaveWidget",) ...@@ -12,11 +12,46 @@ __all__ = ("CleaveWidget",)
@dataclass @dataclass
class CleaveWidget(TextInput): class CleaveWidget(TextInput):
# Options as defined by the original Cleave.js options object # Generic options
blocks: Optional[Sequence[int]] = None blocks: Optional[Sequence[int]] = None
delimiter: Optional[str] = None delimiter: Optional[str] = None
delimiters: Optional[Sequence[str]] = None delimiters: Optional[Sequence[str]] = None
delimiterLazyShow: Optional[bool] = None delimiterLazyShow: Optional[bool] = None
prefix: Optional[str] = None
noImmediatePrefix: Optional[bool] = None
rawValueTrimPrefix: Optional[bool] = None
numericOnly: Optional[bool] = None
uppercase: Optional[bool] = None
lowercase: Optional[bool] = None
swapHiddenInput: Optional[bool] = None
# Numeral options
numeral: Optional[bool] = None
numeralThousandsGroupStyle: Optional[bool] = None
numeralIntegerScale: Optional[int] = None
numeralDecimalScale: Optional[int] = None
numeralDecimalMark: Optional[str] = None
numeralPositiveOnly: Optional[bool] = None
signBeforePrefix: Optional[bool] = None
tailPrefix: Optional[bool] = None
stripLeadingZeroes: Optional[bool] = None
# Date/Time options
date: Optional[bool] = None
datePattern: Optional[Sequence[str]] = None
dateMin: Optional[str] = None
dateMax: Optional[str] = None
time: Optional[bool] = None
timePattern: Optional[Sequence[str]] = None
timeFormat: Optional[str] = None
# Phone number options
phone: Optional[bool] = None
phoneRegionCode: Optional[str] = None
# Credit card number options
creditCard: Optional[bool] = None
creditCardStrictMode: Optional[bool] = None
attrs: InitVar[Optional[Dict[str, str]]] = None attrs: InitVar[Optional[Dict[str, str]]] = None
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment