plantain-00 / schema-based-json-editor

A reactjs and vuejs component of schema based json editor.
MIT License
168 stars 38 forks source link

how to hide or remove 'not exists' checkbox. #25

Closed Rajkapoor1 closed 5 years ago

Rajkapoor1 commented 5 years ago

Version(if relevant): 1.0.0

Environment(if relevant):

I'm using angular verrsion 8.0.0

Code(if relevant):

<json-editor [schema]="schema" [initialValue]="value"

theme="bootstrap3"
icon="fontawesome4">

in appcomponent.ts file, I have defined schema object as below schema = { type : 'object', title: 'schema generator', description: 'dfdfd', properties: { stringExample : { type: 'string', title: 'A string example', description: 'a string description', default: 'a default string example', minLength: 15, maxLength: 20, propertyOrder: 1 }, stringExample1 : { type: 'string', title: 'Name', description: 'Name', default: 'Rajesh', minLength: 15, maxLength: 20, propertyOrder: 2 } } };


here I'm expecting to show only 2 text boxes but after executing above code, in addition with textboxes, it shows 2 checkboxes and 1 button control. 
checkboxes which has caption 'not exists' . Basically it toggles the other textbox visibility. 
is there any way to hide or unshow this checkbox and directly shows textboxes?
plantain-00 commented 5 years ago

Can you try to add "required": ["stringExample"]

Rajkapoor1 commented 5 years ago

Hi, I tried by adding required in below schema but still, it shows checkboxes. schema = { type : 'object', title: 'schema generator', description: 'dfdfd', properties: { stringExample : { type: 'string', title: 'A string example', description: 'a string description', default: 'a default string example', minLength: 15, maxLength: 20, propertyOrder: 1 }, stringExample1 : { type: 'string', title: 'Name', description: 'Name', default: 'danial', minLength: 15, maxLength: 20, propertyOrder: 2 }, required: ['stringExample'] } }; not sure what I'm missing here.

Rajkapoor1 commented 5 years ago

image

Rajkapoor1 commented 5 years ago

above is output which shows 'not exists' checkboxes.

plantain-00 commented 5 years ago
{
  "type": "object",
  "title": "schema generator",
  "description": "dfdfd",
  "properties": {
    "stringExample": {
      "type": "string",
      "title": "A string example",
      "description": "a string description",
      "default": "a default string example",
      "minLength": 15,
      "maxLength": 20,
      "propertyOrder": 1
    },
    "stringExample1": {
      "type": "string",
      "title": "Name",
      "description": "Name",
      "default": "danial",
      "minLength": 15,
      "maxLength": 20,
      "propertyOrder": 2
    }
  },
  "required": [
    "stringExample"
  ]
}
Rajkapoor1 commented 5 years ago

Thanks a lot, it works. is there any way to set the text to the button which expand/collapse the elements? button which shows in above, below 'schema generator' text.?

plantain-00 commented 5 years ago

It seems you set icon="fontawesome4", but didn't load font awesome 4. Or just remove icon property, its optional.

Rajkapoor1 commented 5 years ago

Thanks a lot, it works.