]> git.proxmox.com Git - ui/proxmox-yew-widget-toolkit.git/log
ui/proxmox-yew-widget-toolkit.git
5 weeks agolist: remove key property, because it is already in the standard widget properties
Dietmar Maurer [Fri, 13 Dec 2024 10:45:04 +0000 (11:45 +0100)]
list: remove key property, because it is already in the standard widget properties

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 weeks agolist: add separator property
Dietmar Maurer [Fri, 13 Dec 2024 08:43:13 +0000 (09:43 +0100)]
list: add separator property

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 weeks agolist: split out list tile observer code
Dietmar Maurer [Fri, 13 Dec 2024 08:26:34 +0000 (09:26 +0100)]
list: split out list tile observer code

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 weeks agolist: use list tiles with forcable height
Dietmar Maurer [Fri, 13 Dec 2024 06:57:07 +0000 (07:57 +0100)]
list: use list tiles with forcable height

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 weeks agolist: remove separator property to simplify development
Dietmar Maurer [Thu, 12 Dec 2024 10:37:21 +0000 (11:37 +0100)]
list: remove separator property to simplify development

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 weeks agolist tile: add force_height property
Dietmar Maurer [Thu, 12 Dec 2024 07:14:52 +0000 (08:14 +0100)]
list tile: add force_height property

This restricts the used container height, but still renders the tile with full
height so that we still get resize events with the correct size.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 weeks agotab: change default style to MaterialPrimary
Dietmar Maurer [Thu, 12 Dec 2024 08:55:59 +0000 (09:55 +0100)]
tab: change default style to MaterialPrimary

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 weeks agolist: add ARIA roles
Dietmar Maurer [Tue, 10 Dec 2024 12:29:39 +0000 (13:29 +0100)]
list: add ARIA roles

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 weeks agocleanup: list: remove unused code, use better names
Dietmar Maurer [Tue, 10 Dec 2024 11:26:39 +0000 (12:26 +0100)]
cleanup: list: remove unused code, use better names

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 weeks agolist: compute tail height
Dietmar Maurer [Tue, 10 Dec 2024 11:12:32 +0000 (12:12 +0100)]
list: compute tail height

Instead of using a bad esitimation.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 weeks agolist: fix for missing onscroll event.
Dietmar Maurer [Tue, 10 Dec 2024 09:28:38 +0000 (10:28 +0100)]
list: fix for missing onscroll event.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 weeks agolist: rate limit TileResize events
Dietmar Maurer [Mon, 9 Dec 2024 13:24:53 +0000 (14:24 +0100)]
list: rate limit TileResize events

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 weeks agolist: observe tile resizes
Dietmar Maurer [Mon, 9 Dec 2024 11:52:37 +0000 (12:52 +0100)]
list: observe tile resizes

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 weeks agolist_tile: add resize_callback
Dietmar Maurer [Mon, 9 Dec 2024 11:10:53 +0000 (12:10 +0100)]
list_tile: add resize_callback

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 weeks agolist: improve inline docs
Dietmar Maurer [Sun, 8 Dec 2024 15:36:43 +0000 (16:36 +0100)]
list: improve inline docs

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 weeks agorename ProxmoxLanguageSelector to PwtLanguageSelector
Dietmar Maurer [Sat, 7 Dec 2024 14:14:52 +0000 (15:14 +0100)]
rename ProxmoxLanguageSelector to PwtLanguageSelector

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 weeks agodocs: avoid useless re-export docs
Dietmar Maurer [Sat, 7 Dec 2024 11:00:53 +0000 (12:00 +0100)]
docs: avoid useless re-export docs

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 weeks agolist: improve docs
Dietmar Maurer [Sat, 7 Dec 2024 10:08:19 +0000 (11:08 +0100)]
list: improve docs

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 weeks agodocs: fix compiler warning
Dietmar Maurer [Sat, 7 Dec 2024 09:42:00 +0000 (10:42 +0100)]
docs: fix compiler warning

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 weeks agolist: improve docu
Dietmar Maurer [Sat, 7 Dec 2024 09:33:17 +0000 (10:33 +0100)]
list: improve docu

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 weeks agolist: set scroll_to to correct size estimations
Dietmar Maurer [Fri, 6 Dec 2024 16:04:47 +0000 (17:04 +0100)]
list: set scroll_to to correct size estimations

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
5 weeks agolist: improve virtual scroll by tracking all tile sizes
Dietmar Maurer [Fri, 6 Dec 2024 08:48:53 +0000 (09:48 +0100)]
list: improve virtual scroll by tracking all tile sizes

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
6 weeks agolanguage: make LANGUAGE thread local
Shannon Sterz [Tue, 3 Dec 2024 11:04:50 +0000 (12:04 +0100)]
language: make LANGUAGE thread local

in rust edition 2024 [1] it is no longer allowed to use references to
`static mut` variables. the recommended way of dealing with this is to
use inner mutability. this usually requires the wrapped trait to
implement `Sync` to be thread safe. however, `SharedState` uses `Rc`s
for its implementation, which do not implement `Sync` and so
`SharedState` cannot be `Sync`.

using `Rc`s in WASM is usually fine as WASM code generally isn't
multi-threaded. there are some ways to exploit parallelism, but they are
fairly limited (e.g. web workers). so following this logic, make
`LANGUAGE` thread local. this will allow us to use edition 2024 without
too many changes.

[1]:
https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
6 weeks agogettext_wrapper: use inner mutability for CATALOG
Shannon Sterz [Tue, 3 Dec 2024 11:04:49 +0000 (12:04 +0100)]
gettext_wrapper: use inner mutability for CATALOG

in the rust edition 2024 [1] `static mut` are not allowed to be
referenced anymore, as doing so has always been undefined behaviour. the
recommended way to work around this is to use inner mutability. so use a
`RWLock` here.

[1]:
https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
6 weeks agolanguage: use inner mutability for AVAILABLE_LANUGAGES
Shannon Sterz [Tue, 3 Dec 2024 11:04:48 +0000 (12:04 +0100)]
language: use inner mutability for AVAILABLE_LANUGAGES

in rust edition 2024 taking references to `static mut` variables will be
disallowed [1]. the recommended way to adapting to this is using inner
mutability. so use a OnceLock here to ensure that the set of available
languages can only be set once.

[1]:
https://doc.rust-lang.org/nightly/edition-guide/rust-2024/static-mut-references.html

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
6 weeks agolib: mark unused parameters
Shannon Sterz [Tue, 3 Dec 2024 11:04:47 +0000 (12:04 +0100)]
lib: mark unused parameters

this avoids a compiler warning about unused parameters

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
6 weeks agowidget: form: use value from form ctx if given
Dominik Csapak [Mon, 2 Dec 2024 13:09:43 +0000 (14:09 +0100)]
widget: form: use value from form ctx if given

so that we can use the display field with loaded values too.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
6 weeks agostate: loader: don't unnecessarily notify listeners
Dominik Csapak [Mon, 2 Dec 2024 13:09:42 +0000 (14:09 +0100)]
state: loader: don't unnecessarily notify listeners

in the `load` method, we just setup the loading itself, but the write
guard does that on every `Drop`. To prevent that and only trigger
the `on_change` callback when the data really changed, combine the
calls to `write()` here so we only have one guard and disable the
notification on it.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
6 weeks agolist: set overflow-anchor to none
Dietmar Maurer [Tue, 3 Dec 2024 09:17:01 +0000 (10:17 +0100)]
list: set overflow-anchor to none

also see: https://github.com/facebook/react/issues/27044

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
6 weeks agolist: set yew keys on all list items to keep item state
Dietmar Maurer [Sat, 30 Nov 2024 08:41:10 +0000 (09:41 +0100)]
list: set yew keys on all list items to keep item state

And remove unused code.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
6 weeks agodocs: improve list tile example
Dietmar Maurer [Sat, 30 Nov 2024 08:39:33 +0000 (09:39 +0100)]
docs: improve list tile example

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
7 weeks agolist: use grid layout and allow to set grid-template-columns
Dietmar Maurer [Thu, 28 Nov 2024 13:25:46 +0000 (14:25 +0100)]
list: use grid layout and allow to set grid-template-columns

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
7 weeks agoadd new list tile widget
Dietmar Maurer [Wed, 27 Nov 2024 11:56:51 +0000 (12:56 +0100)]
add new list tile widget

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
7 weeks agoadd new list widget with virtual scrolling
Dietmar Maurer [Wed, 27 Nov 2024 08:39:48 +0000 (09:39 +0100)]
add new list widget with virtual scrolling

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
7 weeks agodocs: fix typo
Dietmar Maurer [Wed, 27 Nov 2024 08:16:29 +0000 (09:16 +0100)]
docs: fix typo

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
7 weeks agocleanup: remove unused size observer from data table
Dietmar Maurer [Tue, 26 Nov 2024 11:32:06 +0000 (12:32 +0100)]
cleanup: remove unused size observer from data table

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
7 weeks agocleanup: use style helper
Dietmar Maurer [Tue, 26 Nov 2024 11:18:33 +0000 (12:18 +0100)]
cleanup: use style helper

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
7 weeks agowidget: selector: limit error messages to width of input
Dominik Csapak [Fri, 22 Nov 2024 08:14:22 +0000 (09:14 +0100)]
widget: selector: limit error messages to width of input

but no less than 400px. Otherwise the error message is not bound
in widht, and can take up a very large amount of space horizontally.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
7 weeks agowidget: selector: show load mask when loading
Dominik Csapak [Fri, 22 Nov 2024 08:14:21 +0000 (09:14 +0100)]
widget: selector: show load mask when loading

so the user knows what is happening

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
8 weeks agocleanup: use IntoOptionalKey trait
Dietmar Maurer [Thu, 21 Nov 2024 09:53:19 +0000 (10:53 +0100)]
cleanup: use IntoOptionalKey trait

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
8 weeks agofix doc tests
Dietmar Maurer [Thu, 21 Nov 2024 08:38:52 +0000 (09:38 +0100)]
fix doc tests

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
8 weeks agocombine storage location and state_id
Dietmar Maurer [Wed, 20 Nov 2024 09:31:31 +0000 (10:31 +0100)]
combine storage location and state_id

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
8 weeks agowidget: dropdown: remove unnecessary style
Dominik Csapak [Mon, 18 Nov 2024 12:02:35 +0000 (13:02 +0100)]
widget: dropdown: remove unnecessary style

this did not work anyway because our aligning code removed the overflow
property.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
8 weeks agowidget: dropdown: make popover behavior manual
Dominik Csapak [Mon, 18 Nov 2024 12:02:34 +0000 (13:02 +0100)]
widget: dropdown: make popover behavior manual

otherwise the popover is dismissed by e.g. clicking in the field
when it's editable, which produces an undesired effect.
(It's then "closed" but still visible because of our css classes, and
now our aligning logic is wrong because popovers behave differently when
open vs closed)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
8 weeks agowidget: dropdown: mark non-editable dropdowns with 'readonly' attribute
Dominik Csapak [Mon, 18 Nov 2024 12:02:33 +0000 (13:02 +0100)]
widget: dropdown: mark non-editable dropdowns with 'readonly' attribute

this way some browser behaviors change, like e.g. the text is
not spell-checked (which makes no sense for a non-editable value)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 months agofix previous commit: correctly set focus on the .selected element (not on the picker...
Dietmar Maurer [Mon, 18 Nov 2024 10:22:25 +0000 (11:22 +0100)]
fix previous commit: correctly set focus on the .selected element (not on the picker itself)

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2 months agowidget: dropdown: properly focus the selected element
Dominik Csapak [Thu, 14 Nov 2024 14:36:48 +0000 (15:36 +0100)]
widget: dropdown: properly focus the selected element

we currently always have a datatable as a picker, so the selected
element must be the cell, as the row (which gets the 'selected' class)
is not selectable (it has no tabindex)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2 months agowidget: dropdown: use popover instead of a dialog
Dominik Csapak [Thu, 14 Nov 2024 14:36:47 +0000 (15:36 +0100)]
widget: dropdown: use popover instead of a dialog

by using popovers, we don't have get the messy focus behaviour of
dialogs, for example those focus the first element when the dialog is
opened, which often is the header menu of a datatable.

This also makes the code a bit shorter, since we can restore the focus
before the popover is fully closed (and simply hide it as soon as
possible).

for now we have to use our own bindings to show/hide/togglePopover, but
this can be removed with a later web-sys version.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 months agoasync_pool: implement send_future
Dietmar Maurer [Fri, 8 Nov 2024 09:17:14 +0000 (10:17 +0100)]
async_pool: implement send_future

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2 months agoasync pool: add 'send_future' wrapper
Dominik Csapak [Fri, 8 Nov 2024 08:51:59 +0000 (09:51 +0100)]
async pool: add 'send_future' wrapper

a wrapper for `Context::send_future` since this is useful sometimes.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2 months agoAsyncPool: simplify atomic counter usage
Dietmar Maurer [Fri, 25 Oct 2024 14:26:09 +0000 (16:26 +0200)]
AsyncPool: simplify atomic counter usage

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2 months agowidget: remove useless `try_from` call in theme density selector
Shannon Sterz [Wed, 23 Oct 2024 12:52:56 +0000 (14:52 +0200)]
widget: remove useless `try_from` call in theme density selector

the enum member `SetThemeDensity` already only takes values of type
`ThemeDensity`. so the `try_from` here converts from `ThemeDensity`
to `ThemeDensity` which is pointless and trivially must always
succeed. remove it so that the compiler stops complaining about
irrefutable patterns.

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
2 months agoAsyncPool: impl Clone and PartialEq
Dietmar Maurer [Wed, 23 Oct 2024 12:00:54 +0000 (14:00 +0200)]
AsyncPool: impl Clone and PartialEq

So that we can use it inside callbacks (and maybe use it
as Component properties).

2 months agoadd new AsyncPool class
Dietmar Maurer [Wed, 23 Oct 2024 10:27:27 +0000 (12:27 +0200)]
add new AsyncPool class

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2 months agoSearchDropdown: use async abort guard
Dietmar Maurer [Wed, 23 Oct 2024 10:22:00 +0000 (12:22 +0200)]
SearchDropdown: use async abort guard

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2 months agomove WebSysAbortGuard to separate file
Dietmar Maurer [Wed, 23 Oct 2024 10:14:05 +0000 (12:14 +0200)]
move WebSysAbortGuard to separate file

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2 months agocleanup: move AsyncAbortGuard to top level
Dietmar Maurer [Wed, 23 Oct 2024 10:07:33 +0000 (12:07 +0200)]
cleanup: move AsyncAbortGuard to top level

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2 months agomake fetch_catalog abortable
Dietmar Maurer [Wed, 23 Oct 2024 09:47:11 +0000 (11:47 +0200)]
make fetch_catalog abortable

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2 months agoSelector: use async abort guard
Dietmar Maurer [Wed, 23 Oct 2024 09:26:20 +0000 (11:26 +0200)]
Selector: use async abort guard

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2 months agoLoader: use AsyncAbortGuard
Dietmar Maurer [Wed, 23 Oct 2024 09:08:08 +0000 (11:08 +0200)]
Loader: use AsyncAbortGuard

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2 months agoadd async abort guard
Dietmar Maurer [Wed, 23 Oct 2024 08:58:54 +0000 (10:58 +0200)]
add async abort guard

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2 months agomake default http_get method abortable
Dietmar Maurer [Wed, 23 Oct 2024 08:22:49 +0000 (10:22 +0200)]
make default http_get method abortable

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
3 months agocss: add `Opacity` class helper
Dominik Csapak [Wed, 16 Oct 2024 10:06:57 +0000 (12:06 +0200)]
css: add `Opacity` class helper

for our pwt-opacity-X classes

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 months agowidget style builder: add `opacity` helper
Dominik Csapak [Wed, 16 Oct 2024 10:06:56 +0000 (12:06 +0200)]
widget style builder: add `opacity` helper

to set the opacity of an element

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 months agowidget style builder: add `flex` helper
Dominik Csapak [Wed, 16 Oct 2024 10:06:55 +0000 (12:06 +0200)]
widget style builder: add `flex` helper

so instead of setting the flex property via style, we have
a way to do it in a more controlled way that's similar to how it's done
in extjs

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 months agotab bar: remove unnecessary and unused format! macro
Shannon Sterz [Tue, 15 Oct 2024 15:24:19 +0000 (17:24 +0200)]
tab bar: remove unnecessary and unused format! macro

this looks like it was accidentally added as it does nothing but
generate a compiler warning now. so remove it.

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
3 months agoInputPanel: add code to add hidden fields
Dietmar Maurer [Thu, 10 Oct 2024 08:22:18 +0000 (10:22 +0200)]
InputPanel: add code to add hidden fields

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
3 months agoadd a contributions section to the readme
Dietmar Maurer [Wed, 9 Oct 2024 09:49:12 +0000 (11:49 +0200)]
add a contributions section to the readme

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
3 months agowidget: form: make selector load only when enabled
Shannon Sterz [Tue, 8 Oct 2024 09:02:19 +0000 (11:02 +0200)]
widget: form: make selector load only when enabled

loading when a selector is disabled doesn't serve any purpose as users
can't select the loaded entries anyway. so only load when the
selector is enabled. also makes sure that the selector loads if it
was previously disabled and is now enabled.

Signed-off-by: Shannon Sterz <s.sterz@proxmox.com>
3 months agowidget: data table: extend fixme comment
Dominik Csapak [Tue, 8 Oct 2024 11:16:00 +0000 (13:16 +0200)]
widget: data table: extend fixme comment

so we know later what we wanted to change here without diving into the
git log

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 months agowidget: data table: react to column changes
Dominik Csapak [Tue, 8 Oct 2024 10:31:33 +0000 (12:31 +0200)]
widget: data table: react to column changes

the headers are part of the properties, so if they change, we should
react to that. Until now, we only accepted them at the first 'create'
call, which meant that when the columns changed afterwards (e.g. when we
want to pass different data to the renderer) it did not get rerendered
with the new information.

To do this, refactor the header processing code from 'create' into it's
own function, and call it also when the headers changed in the 'changed'
method.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 months agowidget: input panel: fix key generation for labels
Dominik Csapak [Mon, 7 Oct 2024 10:25:53 +0000 (12:25 +0200)]
widget: input panel: fix key generation for labels

yews key mechanism does not work on markup level, but on component
level. So the attempt to auto-generate keys for FieldLabels in the view
method instead of the input panel was misguided, since that does not
actually give the label itself a key.

This was noticed on all input panels where we dynamically added/removed
fields, since then the whole form was reset because of the missing keys.
(E.g. the ACME DNS plugin panel)

Instead generate the label key like before in the input panel itself,
but only when the FieldLabel itself does not already have one set.
(so users can manually override that if they want)

Fixes: bd58deb (widget: input panel: use FieldLabel instead of just text)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 months agowidget: input panel: adapt to recent grid column change
Dominik Csapak [Thu, 3 Oct 2024 13:24:50 +0000 (15:24 +0200)]
widget: input panel: adapt to recent grid column change

we changed the layout to a 5 column grid (one spacer in the middle),
but forgot to add the middle column when we set the label_width or
field_width manually.

add the same middle column as in the css here

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 months agocss: allow custom css lengths
Dominik Csapak [Thu, 3 Oct 2024 13:24:49 +0000 (15:24 +0200)]
css: allow custom css lengths

when they're &'static str. This allows us to write things like:

```
Foo::new()
    .width("auto")
```

instead of

```
Foo::new()
    .style("width", "auto")
```

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 months agomove SubmitCallback to props folder
Dietmar Maurer [Wed, 2 Oct 2024 07:20:13 +0000 (09:20 +0200)]
move SubmitCallback to props folder

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
3 months agomake SubmitCallback generic
Dietmar Maurer [Wed, 2 Oct 2024 07:17:09 +0000 (09:17 +0200)]
make SubmitCallback generic

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
3 months agodoc: adapt to recent checkbox/radio button changes
Dominik Csapak [Mon, 30 Sep 2024 12:52:08 +0000 (14:52 +0200)]
doc: adapt to recent checkbox/radio button changes

by replacing references to the `Boolean` component with `Checkbox`
and adding the RadioButton reference

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 months agowidget: radio button: fix doc tests
Dominik Csapak [Mon, 30 Sep 2024 12:52:07 +0000 (14:52 +0200)]
widget: radio button: fix doc tests

and improve the example text slightly (so it makes more sense)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 months agowidget: align: fix doc references
Dominik Csapak [Mon, 30 Sep 2024 12:52:06 +0000 (14:52 +0200)]
widget: align: fix doc references

change to 'crate' and make the relevant functions public (for wasm32 and
non wasm32)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 months agowidget: rtl switcher: expose std/input props
Dominik Csapak [Mon, 30 Sep 2024 12:52:05 +0000 (14:52 +0200)]
widget: rtl switcher: expose std/input props

so that users can e.g. set the id for a label

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 months agowidget: form: rename Boolean to Checkbox
Dominik Csapak [Mon, 30 Sep 2024 11:22:41 +0000 (13:22 +0200)]
widget: form: rename Boolean to Checkbox

and remove old `Checkbox` implementation. Since we now have a separate
RadioButton component and the Boolean one has more features that should
cover all use cases of the old Checkbox field, simply rename the Boolean
to Checkbox.

Also having only one Checkbox component  instead of two separate ones is
less confusing and less error prone.

This makes it necessary to adapt all code paths using either Checkbox or
Boolean, but these changes should be rather trivial:
* either changing the submit_on/off_values where we used a checkbox
  previously
* or rename Boolean to Checkbox

If we missed some use case for the Checkbox, we can either simply add it
again, or use a more generic Field with input_type 'checkbox' instead.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 months agowidget: form: add RadioButton component
Dominik Csapak [Mon, 30 Sep 2024 11:22:40 +0000 (13:22 +0200)]
widget: form: add RadioButton component

instead of reusing the Checkbox component for creating radio buttons,
have a separate component for that. This makes it easier to specialize
the code for that use case.

The code is mostly a mix of Checkbox and Boolean (for some of the newer
features), with the irrelevant portions stripped out.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 months agowidget: boolean: implement custom on/off values
Dominik Csapak [Mon, 30 Sep 2024 11:22:39 +0000 (13:22 +0200)]
widget: boolean: implement custom on/off values

sometimes it's useful to map the checked/unchecked state to different
submit values than true/false, e.g. for inverted checkboxes or if the
api does not accept true/false but e.g. 1/0 instead.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 months agodocs: further improve toplevel docu
Dietmar Maurer [Mon, 30 Sep 2024 08:24:06 +0000 (10:24 +0200)]
docs: further improve toplevel docu

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
3 months agodocs: list all input elements on the start page
Dietmar Maurer [Sun, 29 Sep 2024 14:06:33 +0000 (16:06 +0200)]
docs: list all input elements on the start page

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
3 months agocleanup: fix links inside doc comments
Dietmar Maurer [Sun, 29 Sep 2024 10:50:23 +0000 (12:50 +0200)]
cleanup: fix links inside doc comments

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
3 months agodocs: update readme, mention the new examples repository
Dietmar Maurer [Sun, 29 Sep 2024 10:29:08 +0000 (12:29 +0200)]
docs: update readme, mention the new examples repository

3 months agominor doc cleanups
Dietmar Maurer [Sun, 29 Sep 2024 08:19:18 +0000 (10:19 +0200)]
minor doc cleanups

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
3 months agobump version to 0.3.0, prepare for public release
Dietmar Maurer [Fri, 27 Sep 2024 15:24:30 +0000 (17:24 +0200)]
bump version to 0.3.0, prepare for public release

We moved the examples code into a sparate git repository using:

 git filter-repo --subdirectory-filter examples
 git filter-repo --path tauri-example --invert-paths

The repository is called: proxmox-widget-toolkit-examples.

Then used the following command to cleanup this repository:

 git filter-repo --invert-paths --path examples --path .gitmodules --path www --path scss --path assets

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
3 months agoimpl WidgetStyleBuilder for NavigationDrawer
Dietmar Maurer [Thu, 26 Sep 2024 10:06:58 +0000 (12:06 +0200)]
impl WidgetStyleBuilder for NavigationDrawer

3 months agowidget: input panel: use FieldLabel instead of just text
Dominik Csapak [Wed, 25 Sep 2024 13:11:08 +0000 (15:11 +0200)]
widget: input panel: use FieldLabel instead of just text

this simplifies the code here a bit, and makes it possible to give
each label separate classes and styles (such as alignment for example)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 months agowidget: move FieldLabel functionality into Boolean
Dominik Csapak [Wed, 25 Sep 2024 13:11:07 +0000 (15:11 +0200)]
widget: move FieldLabel functionality into Boolean

We only ever need labels on the right side (called box label now), only
on checkboxes, so it does not really make sense to have a separate
widget for that.

For now we only accept text as the label, but we could change that
later if we need that.

This makes the 'FieldLabel' available and ready to use elsewhere, e.g.
the input panel.

For convenience, we implement some From traits for it, so one can use a
bare string to create such a field label.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 months agowidget: boolean: improve html markup to be more sensible
Dominik Csapak [Wed, 25 Sep 2024 13:11:06 +0000 (15:11 +0200)]
widget: boolean: improve html markup to be more sensible

Currently we "misused" the tooltip as part of the markup, but put a
container around for css purposes.

Instead make the actual checkbox/switch markup completely independent
from the tooltip and only move the onclick handler there.

This way it's more easy to add other things like a 'boxLabel' later.

While we're changing the markup anyway, remove the use of the html!
macro and use our builtin builder classes for containers and icons.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 months agowidget: input panel: remove gap configuration
Dominik Csapak [Wed, 25 Sep 2024 13:07:05 +0000 (15:07 +0200)]
widget: input panel: remove gap configuration

it was only a single class, that can also added directly, no use in
having a specialized option for it

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 months agowidget: boolean: make clickable area react to clicks
Dominik Csapak [Tue, 24 Sep 2024 13:14:45 +0000 (15:14 +0200)]
widget: boolean: make clickable area react to clicks

same as for the checkbox field in commit:
a3361fc (widget: checkbox: make clickable area react to clicks)

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
3 months agowidget: checkbox: make clickable area react to clicks
Dominik Csapak [Mon, 23 Sep 2024 12:28:31 +0000 (14:28 +0200)]
widget: checkbox: make clickable area react to clicks

the outer container contains the visual cues for clicking the checkbox,
but only the inner actual checkbox reacted to clicks. Move the onclick
handler to the outer container so the click behavior matches the
visuals.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 months agocss: add `FontColor` enum
Dominik Csapak [Thu, 12 Sep 2024 12:05:00 +0000 (14:05 +0200)]
css: add `FontColor` enum

so we can refer to the `pwt-color-XXX` classes without using the bare
class names.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 months agocss: add `FlexFit` struct
Dominik Csapak [Thu, 12 Sep 2024 12:04:59 +0000 (14:04 +0200)]
css: add `FlexFit` struct

so to use the `pwt-flex-fit` class without having to rely on the bare
css class name.

I did not put it in the `Flex` enum, since it does not only change the
flex value, but also the over flow auto.

It's a shorthand for using Flex::Fill + Overflow::Auto, but since we use
that often, this could come in handy

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 months agocss: add `Custom` color scheme variant
Dominik Csapak [Thu, 12 Sep 2024 12:04:58 +0000 (14:04 +0200)]
css: add `Custom` color scheme variant

this can be useful if the theme or project defines it's own color
schemes, but still want to refer to them in the code without having to
use bare css classes

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
4 months agocss: add `DarkSurface` color scheme to enum
Dominik Csapak [Thu, 12 Sep 2024 12:04:57 +0000 (14:04 +0200)]
css: add `DarkSurface` color scheme to enum

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>