Skip to content

Feature request: Object property / key selection #95

Closed
@acidMyke

Description

@acidMyke

Hi CarlosNZ,

To provide easier selection of object properties.

I'm proposing a new prop restrictAddSelection, similar to restrictTypeSelection, where the user is given a dropdown, if prop is provided and if the data is object, to be able to select the appropriate key to add, instead of requiring user to type out the prop key.

My original plan is for this feature to merge with the existing restrictAdd prop but, after thinking it through, it will conflict with existing usage. In order for the dropdown to appear, restrictAddSelection needs to be called when the add input field is rendered, whereas restrictAdd is only called after the new key is added for validation. Do let me your opinion on this.

Possible Syntax:

type AddFilterFunction = (input: NodeData) => boolean | string[]
interface JsonEditorProps {
  //...
  restrictAddSelection?: boolean | string[] | AddFilterFunction
}

Mock-up:
add-dropdown-mockup

I could try to implement the feature if you don't mind.

Look forward to your response.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions