在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:brutusin/json-forms开源软件地址:https://github.com/brutusin/json-forms开源编程语言:JavaScript 97.1%开源软件介绍:json-forms
Status
Table of Contents: Features
UsageInclude the main library dependencies: <link rel="stylesheet" href='dist/css/brutusin-json-forms.min.css'/>
<script src="dist/js/brutusin-json-forms.min.js"></script> Optionally, include the bootstrap extension (requires bootstrap): <script src="dist/js/brutusin-json-forms-bootstrap.min.js"></script> Create the javascript var schema = {"type": "boolean"}
var BrutusinForms = brutusin["json-forms"];
var bf = BrutusinForms.create(schema); And finally render the form inside a container with optional preloaded JSON initial data, var container = document.getElementById('container');
bf.render(container, data); Demohttp://brutusin.org/json-forms/ Dynamic schemasThis library supports dynamic schemas, that is, subschemas that can change depending on the value of other parts of the data. This lets creating dynamic forms that vary their shape depending on the values entered by the user. This is extremely useful for big autogenerated schemas, that aggregates lots of subschemas and have functional bindings, given that it allows to show the user a simpler, non-error-prone form, also avoiding asking for unneeded data. Dynamic schemas are built upon two main blocks:
|
Member | Description |
---|---|
BrutusinForms.create(schema) |
BrutusinForms factory method |
BrutusinForms.addDecorator(f(htmlElement, schema)) |
Register a callback function to be notified after an HTML element has been rendered (passed as parameter). See brutusin-json-forms-bootstrap.js for an example of bootstrap decorator. |
BrutusinForms.postRender(instance) |
Callback function to be notified after a BrutusinForms instance has been rendered (passed as parameter) |
BrutusinForms.instances |
Array containing all the BrutusinForms instances created in the document by the factory method. |
Member | Description |
---|---|
bf.render(container, data) |
Renders the form inside the the container, with the specified data preloaded |
bf.validate() |
Returns true if the input data entered by the user passes validation |
bf.getData() |
Returns the javascript object with the data entered by the user |
bf.schemaResolver(schemaIdArray, data) |
Schema resolver for dynamic schemas |
http://www.jsdelivr.com/projects/brutusin.json-forms
https://github.com/brutusin/json-forms/issues
Contributions are always welcome and greatly appreciated!
Apache License, Version 2.0
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论