Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/theopenwebjp/jsonform-loader
Loader for JSON Form library, for loading dependencies via JS.
https://github.com/theopenwebjp/jsonform-loader
javascript js json json-schema
Last synced: about 22 hours ago
JSON representation
Loader for JSON Form library, for loading dependencies via JS.
- Host: GitHub
- URL: https://github.com/theopenwebjp/jsonform-loader
- Owner: theopenwebjp
- License: mit
- Created: 2018-10-12T14:02:42.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-10-26T23:18:20.000Z (about 1 year ago)
- Last Synced: 2024-10-11T23:10:49.356Z (about 1 month ago)
- Topics: javascript, js, json, json-schema
- Language: JavaScript
- Homepage:
- Size: 618 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Description
- [Loader for JSON Form](https://github.com/jsonform/jsonform)
Loads dependencies by array of keys.
Followng are always loaded because required: css, jquery, underscore
Check ./index.html for a simple demo.
The dependencies required depend on what functionality is needed.
Therefore, I created this demo to load the dependencies programmatically.## Reason for making
In the Github issue on jsonform below, I inquired about an npm module.
Although there is an npm module([jsonform](https://www.npmjs.com/package/jsonform)) available, the dependencies are not loaded together.- [Maintainers and going forward](https://github.com/jsonform/jsonform/issues/177)
## Usage
```bash
npm install @theopenweb/jsonform-loader
```Install dependencies: `npm install`
Place jsonform into lib directory. Default settings work when jsonform is cloned into lib.
Otherwise, use lib from node_modules.Script is in ./dist/bundle.js
To build use `npm run build`.```javascript
// Sets options(mainly urls if using setting non-standard format.)
// const BASE = `../lib/jsonform` // libの場合
const BASE = `../node_modules/jsonform` // node_modulesの場合
const options = {
depsUrl: `${BASE}/jsonform/deps/`, // deps directory url
jsonFormUrl: `${BASE}/jsonform/lib/jsonform.js` // jsonform.js url
}
JsonFormSchema.setOptions(options)// Get array of available keys to set dependencies.
const keys = JsonFormSchema.getKeys()
console.log('available keys', keys)// Load without any optional dependencies.
JsonFormSchema.load().then(()=>{
// CAN USE JsonForm here
})// Load with optional dependencies.
JsonFormSchema.load(keys).then(()=>{
// CAN USE JsonForm with dependencies in keys loaded
})
```## Test
Example can be tested via below:
```bash
npx http-server ./
# Go to http://localhost:8080/examples
```