nikolaysav / nova-json-schema-field Goto Github PK
View Code? Open in Web Editor NEWLaravel Nova field for displaying JSON schema data
Home Page: https://novapackages.com/packages/nsavinov/nova-json-schema-field
Laravel Nova field for displaying JSON schema data
Home Page: https://novapackages.com/packages/nsavinov/nova-json-schema-field
@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!
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:
This is my edit page:
It is stored correctly in the database but something goes wrong when trying to display it in the detail page.
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.
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'
]
]
]
];
}
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?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.