vaadin / flow-components

Java counterpart of Vaadin Web Components
101 stars 66 forks source link

Upload is missing isReadOnly #6345

Open sveinnetnordic opened 5 months ago

sveinnetnordic commented 5 months 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 5 months ago

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

uploadField.element.isEnabled = false
uploadField.isDropAllowed = false
Legioth commented 5 months ago

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

sveinnetnordic commented 5 months 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 5 months 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 5 months 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