Giter VIP home page Giter VIP logo

Comments (9)

fbessou avatar fbessou commented on June 10, 2024

Subschema are currently not supported. Currently the only supported types are string, number/integer and boolean.
You could probably create a custom field type and its value accessor to be able to represent the subschema (maybe using itself a SchemaForm ).

from ngx-schema-form.

Freest10 avatar Freest10 commented on June 10, 2024

Ok, thx) I hope in the next version it will be native)

from ngx-schema-form.

fbessou avatar fbessou commented on June 10, 2024

Maybe I have misunderstood what you were asking.
Do you want to be able to build a form from this kind of schema ?

{
  "properties": {
    "name": {
      "type": "string"
    },
    "address": {
      "type": "object",
      "properties": {
        "street": {
          "type": "string"
        },
        "city": {
          "type": "string"
        },
        "zip": {
          "type": "string"
        }
      }
    }
  }
}

with address having its own subschema ?

from ngx-schema-form.

Freest10 avatar Freest10 commented on June 10, 2024

Yes, I want create something like in this example - http://jspears.github.io/subschema/#/Loader?_k=4hk4x7. When I click on the button "Add", shows a new form.

from ngx-schema-form.

fbessou avatar fbessou commented on June 10, 2024

Ok, neither arrays nor subschema are supported yet but note that if you want to display a field conditionally, you can use the showIf property:

"properties": {
  "name": {
    "type": "string"
  },
  "showAddress": {
    "type": "boolean"
  },
  "address": {
    "type": "string",
    "visibleIf": {"showAddress":[true]}
  }
}

from ngx-schema-form.

Freest10 avatar Freest10 commented on June 10, 2024

Thx) I am very need in subschema for my project)

from ngx-schema-form.

fbessou avatar fbessou commented on June 10, 2024

As I previously said, currently nested schemas are not implemented.
You have to flatten your schema and can use fieldsets to visually organise your data.

{
    "$schema": "http://json-schema.org/draft-04/hyper-schema#",
    "type": "object",
    "properties": {
        "firstName": {
            "type": "string",
            "placeholder": "First name",
            "minLength": 2,
            "maxLength": 40,
            "title": "First name",
            "description": "First name"
        },
        "inpBtn": {
            "type": "inputWithButton",
            "placeholder": "First name",
            "minLength": 2,
            "maxLength": 40,
            "title": "First name",
            "description": "First name"
        }, 
        "street": {
            "type": "string",
            "placeholder": "Street",
            "title": "Street",
            "description": "Street"
        },
        "city": {
            "type": "string"
        },
        "zip": {
            "type": "string"
        }
    },
    "fieldsets":[{
        "id": "info",
        "fields":[ "firstName","inpBtn"]
    },{
        "id": "address",
        "fields":[ "street", "city", "zip"]
    }],
    "required": ["street"]
}

from ngx-schema-form.

Freest10 avatar Freest10 commented on June 10, 2024

Yes, thx) I incorrectly translated your phrase))

from ngx-schema-form.

fbessou avatar fbessou commented on June 10, 2024

Subschemas are supported.

from ngx-schema-form.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.