Neos-ui: Dynamic configuration doesn't work for group or editor

Created on 2 Mar 2018  路  12Comments  路  Source: neos/neos-ui

The feature #1618 does not work for setting the inspector group or editor (as the example in the PR shows) because that part of the configuration is extracted before the processing happens. It would be nice though to be able to do that.

Bug

Most helpful comment

@dimaip This is it :)

All 12 comments

@dimaip This is it :)

I looked into this a while ago, and it's not easy to fix without huge render performance penalty.
I propose to not support moving a property dynamically between groups, but instead to add an additional option to hide and editor, e.g.:

  ui:
    inspector:
      hidden: true

@dimaip Would love to have something like this for dynamically show properties. I have to deal with circumstances with somehow depending properties quite often and it would be charming and less confusing for editors to display only the needed ones.

@dennisirmscher wouldn't this help https://github.com/neos/neos-ui/issues/1682#issuecomment-386269035?

@dimaip It totally would! :)

@dennisirmscher I think it would be quite trivial to implement here: https://github.com/neos/neos-ui/blob/master/packages/neos-ui-editors/src/EditorEnvelope/index.js#L146
E.g. check for hidden and then just return null.
Wanna give it a shot?

All right, this is working so far. I added a property hidden to the inspector like this (shortened):

'foo':
  type: boolean
'image':
  ui:
    inspector:
      hidden: 'ClientEval:node.properties.foo ? false : true'

The property image now disappears if foo is set to false:

dynamic configuration

Of cause the value of the property image won't get removed as only the editor get's removed from the inspector. I don't think it would be a god idea to the delete the value but let the developer take care of dealing with the properties.

@dimaip wanted to discuss the naming of the property as hidden might not be the best option. Any other suggestions?

Yeah it definitely shouldn't mess with the value.
I can't suggest anything better than hidden so far.

Next steps:

So we leave it named hidden?

I鈥榣l take care about the documentation and create the PRs. Thank you for your support!

I'd say so.
I've updated my previous answer with a few links to ease your task.

The feature #1618 does not work for setting the inspector group or editor

I just found out, it works for changing the editor on the fly. Here is an example of switching between the LinkEditor and the TextEditor:

ezgif-3-1835568229

But I guess this can break quite quickly, e.g. when entering a value in the TextEditor the LinkEditor can't handle.

Yeah, this behavior should be used with caution. Though on compatible data types it could work quite well.
ClientEval: is a super powerful low-level hack basically. (and yes, I love low-level hacks)

Was this page helpful?
0 / 5 - 0 ratings