Giter Club home page Giter Club logo

nova-json-schema-field's People

Contributors

nikolaysav avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

eberkund

nova-json-schema-field's Issues

Support for multiple html input types

@NikolaySav thanks a ton for this project.

In the edit form, all input fields are rendered as text. This makes it inconvenient for numeric fields and dates.

A single line fix to FormField.vue opens up this field to multiple HTML input types.

Original (lines 24-26):

  <div class="w-1/2 py-6">
      <input :id="key" type="text"
             class="w-full form-control form-input form-input-bordered"

New:

  <div class="w-1/2 py-6">
      <input :id="key" :type="property.format || property.type || 'text'"
             class="w-full form-control form-input form-input-bordered"

Now we can use this in the following schema:

  {
      "type": "object",
      "required": [
          "event_name",
          "start_date",
          "duration"
      ],
      "properties": {
          "event_name": {
              "description": "Event Name"
          },
          "start_date": {
              "type": "string",
              "format": "date",
              "description": "Start Date"
          },
          "duration": {
              "type": "number",
              "description": "Duration in Days"
          }
      }
  }

Now the event_name, start_date, duration fields are rendered using the appropriate HTML input fields.

Can you please update your code? Thanks!

Content now showing in resource detail page

Hello friend

I am using this package to let users fill in an array in a user friendly way. This array is stored as a string (json object) in the database. Everything works great however in de detail page of resource the field is not displayed.

This is my detail page:

Screenshot 2019-08-06 at 09 10 09

This is my edit page:

Screenshot 2019-08-06 at 09 10 45

It is stored correctly in the database but something goes wrong when trying to display it in the detail page.

Set schema dinamically

Hi there. Loving this package. Any ideas how can I implement this in a way that I can solve the schema on runtime?

Let's say you have User that belongs to Organization. The Organization has their required fields stored in them. So when editing a User you can say: the fields for this User belonging to some Organization are given by $this->schema($resource) or something like that.

Support array of objects?

Blank field display when I used nova-json-schema-field with schema Array of objects

public function fields() {
    return [
        NovaJsonSchemaField::make('Options', $this->optionsSchema())
              ->listClass('list-reset')
    ]
}

public function optionsSchema() {
        return [
            'type' => 'array',
            'items' => [
                'type' => 'object',
                'required' => ['name'],
                'properties' => [
                    'name' => [
                        'type' => 'string'
                    ]
                ]
            ]
        ];
    }

does not work anymore ?

Just tried to use this

NovaJsonSchemaField::make('Schema', $this->schema()),
    public function schema()
    {
        return [
            'type' => 'object',
            'required' => [
                'foo',
                'bar',
            ],
            'properties' => [
                'bar' => [
                    'type' => 'integer',
                ],
                'foo' => [
                    'type' => 'integer',
                    'description' => 'foo',
                ],
            ],
        ];
    }

And it doesn't throw any error but it just displays a blank field?

Tried with return []; too and same blank field

Am I misunderstanding how to use this?

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.