[Feature] Add auto-resizing textarea widget with character counter#1083
Conversation
|
This is a nice feature! However, can we:
|
# Conflicts: # sqladmin/statics/css/main.css # sqladmin/widgets.py
Yes, it will need some improvement. |
Theoretically, it could be added, but I'm not sure for what use cases. Databases usually have a character limit out of the box. The number of words is a fairly narrow case, so I'm not sure it'll be useful. |
|
Okay, lets skip word count, you are right. But I still insists auto_resize should be also a param like show_chars_count. Make default true, but, still user should be able to cusomize it. |
… parameters are independent of each other
mmzeynalli
left a comment
There was a problem hiding this comment.
Also, is there a chance to have it "default" field for Text type?
Mapped[str] = mapped_column(String) -> StringField
Mapped[str] = mapped_column(Text) -> TextField
| class_ = " ".join(filter(None, (class_, "autoresize-textarea"))) | ||
| kwargs.setdefault("rows", "1") | ||
|
|
||
| kwargs["class"] = class_ |
There was a problem hiding this comment.
This happens even when class_ is None. Skip instead.
| ) | ||
|
|
||
|
|
||
| class TextAreaWidget(widgets.Input): |
There was a problem hiding this comment.
I think in this case you can downsize call override
| }); | ||
|
|
||
|
|
||
| // Shows the number of characters in a textarea.. |
|
@maxim-f1 Hey, I plan to release new version tomorrow or day after, could you finalize this as well? |
In this case, all text fields will become textareas instead of input fields. It seems this behavior is not expected for short strings of the String CHAR type. |
|
Yes, I suspected that, and was wondering if we can "separate" input from textarea |
|
In my opinion, it is better to make a separate widget for String and CHAR in another MR |
# Conflicts: # sqladmin/fields.py # sqladmin/statics/css/main.css # sqladmin/widgets.py # tests/test_fields.py


Description
This PR introduces a new auto-resizing textarea widget with a dynamic character counter and maximum character validation.
Key Features
maxLengthlimit (e.g.,140 / 400).