neos / neos-ui

Neos CMS UI written in ReactJS with Immutable data structures.
GNU General Public License v3.0
265 stars 134 forks source link

Add allowEmpty option to RangeSlider #3001

Open jonnitto opened 2 years ago

jonnitto commented 2 years ago

Currently, the range slider can not be empty. We should ad this option

jonnitto commented 2 years ago

Styling is hard:

CleanShot 2021-12-16 at 14 48 57@2x

or

CleanShot 2021-12-16 at 14 49 35@2x

or

CleanShot 2021-12-16 at 14 53 11@2x

Personally, I think option three is the best

jonnitto commented 2 years ago

BTW, this works only properly if the type of the property is a string, otherwise, it will set it the value to 0.

mhsdesign commented 2 years ago

is this range editor the first editor with type int|null ? - i guess currently a none value is casted to 0 right?

mhsdesign commented 2 years ago

i think this fat 'X' button is (always) quite massive - and i see many editors applying them. Can there be maybe a more subtle way? Lightroom (adobe) handles this by displaying an option 'reset' above each control group when holding alt/option... but that may be overkill for editors.

how about double clicking the blue slide handle (but that should probably be reserved for resetting to defaultValue)

mhsdesign commented 2 years ago

image

Maybe we can add an empty button and reset to default button like this - or similar

Sebobo commented 2 years ago

Why should it be empty if min and max are always required / have defaults?

Sebobo commented 1 year ago

Should we close this? IMO it doesn't make so much sense to have required min/max values and defaults and then allow null

jonnitto commented 1 year ago

Yep, let's close this

mhsdesign commented 12 months ago

@grebaldi i just remembered this one while testing https://github.com/neos/neos-ui/pull/3535 - as its now possible to set integer types to null via the ui, should we allow it also for the range editor?

My general thought is that unless you have a property with an notemptyvalidator its ALWAYS legal to set the property to null. And thus it should also be doable via the ui.

grebaldi commented 12 months ago

I think we need to approach this entire problem differently.

It's a bit awkward imho that we rely on the presence of some Neos.Neos/Validation/NotEmptyValidator to figure out whether a property is mandatory or optional. In fact, we don't really ever know whether a property is mandatory or optional.

I think nullability should be part of the NodeType Schema, either through type description

properties:
  myOptionalIntegerProperty:
    type: ?integer

or through flag

properties:
  myOptionalIntegerProperty:
    type: integer
    required: false # or `optional: true`

This should imply the presence of Neos.Neos/Validation/NotEmptyValidator, while it also allows the editor implementation to make decisions based on the nullability of the given property type.

This doesn't solve the particular design problem here, but at least it would give us a basis to decide whether or not to show a "clear"- or "reset"-button.

mhsdesign commented 12 months ago

@grebaldi exactly what @bwaidelich and me have in mind ;) https://github.com/neos/neos-development-collection/issues/4304#issuecomment-1578965994 the validators are dirt ^^

mhsdesign commented 12 months ago

the required flag could also replace the allowEmpty flag for selectboxes