vaadin / flow-components

Java counterpart of Vaadin Web Components
81 stars 63 forks source link

Upload is missing isReadOnly #6345

Open sveinnetnordic opened 3 weeks ago

sveinnetnordic commented 3 weeks ago

Describe your motivation

Found it missing

Describe the solution you'd like

Button and drop filed should be marked readonly and drop should not be allowed

Describe alternatives you've considered

No response

Additional context

No response

sveinnetnordic commented 3 weeks ago

A kind of a workaround, not pretty because the field change:

uploadField.element.isEnabled = false
uploadField.isDropAllowed = false
Legioth commented 3 weeks ago

Related issue: https://github.com/vaadin/web-components/issues/1278

sveinnetnordic commented 3 weeks ago

A better workaround is this then: uploadField.maxFiles = if (it.value) 0 else 1 but need to set it correct for multi/single, and the button changes form Upload file... to Upload files...

TatuLund commented 3 weeks ago

Upload does not have field nature, but it can be used in a custom field. There is an example of using Upload component in CustomField here

https://stackoverflow.com/questions/66154593/vaadin-upload-component-in-binder-e-g-crud-editor

sveinnetnordic commented 3 weeks ago

Upload does not have field nature, but it can be used in a custom field. There is an example of using Upload component in CustomField here

https://stackoverflow.com/questions/66154593/vaadin-upload-component-in-binder-e-g-crud-editor

Setting new UploadField() readonly did not have any effect