This package components are built in json files, each json contains the following information
- the names of the component (each component can have multiple names)
- the fields
name: string
the name of the fielddata-type: string
which decides the migration database row typehtml-type: string
which decides the html input typevalidation: string
which creates the validation for this fieldnullable: boolean
which mean that this field can be nullindex: boolean
which means this field should be on the index page table
html-type="checkbox"
=string
with an array of valueshtml-type="radio"
=enum
with an array of valueshtml-type="date"
=date
html-type="month"
=date
html-type="week"
=date
html-type="time"
=time
html-type="text"
=text
html-type="textarea"
=text
will render text area fieldhtml-type="email"
=string
html-type="url"
=text
html-type="tel"
=string
html-type="color"
=string
html-type="file"
=string
accept method to be developedhtml-type="number"
=integer
(typefloat
addsstep="any"
to input)
This is the json file for Article
component
{
"names": [
"Article","Blog","Essay"
],
"fields": [
{
"name": "title",
"data-type": "string",
"html-type": "text",
"validation": "required|string|min:1|max:255",
"nullable": false,
"index": true
},
{
"name": "description",
"data-type": "text",
"html-type": "textarea",
"validation": "nullable|min:3|max:1000",
"nullable": true,
"index": false
},
{
"name": "body",
"data-type": "text",
"html-type": "textarea",
"validation": "required|min:3",
"nullable": false,
"index": false
},
{
"name": "thumbnail",
"data-type": "string",
"html-type": "file",
"validation": "nullable|image",
"nullable": true,
"index": true
}
]
}
You can find the full list of models here src/Models
To write a component, you have to provide a content of a json file like the one in the example
if you want to provide a pull-request, you can add the component file or files inside src/Models
and add the names array to src/model_names.json