Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 4de701d

Browse files
committed
Update readme
1 parent 552235a commit 4de701d

File tree

1 file changed

+46
-42
lines changed

1 file changed

+46
-42
lines changed

‎README.md

Lines changed: 46 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,32 +2,9 @@
22

33
# json-form
44

5-
This module generates form based on JSON Schema, its keywords are documented in this spec: http://json-schema.org/latest/json-schema-validation.html
6-
7-
![image](https://user-images.githubusercontent.com/184172/38784098-c30536fe-4104-11e8-95bb-58c4f5eca24f.png)
8-
9-
Published in gh-pages: https://1602.github.io/json-form/
10-
11-
12-
<!---
13-
```
14-
<custom-element-demo>
15-
<template>
16-
<script src="../webcomponentsjs/webcomponents-lite.js"></script>
17-
<link rel="stylesheet" href="https://unpkg.com/@ubio/css@1.3.11/index.css">
18-
<link rel="import" href="json-form.html">
19-
<next-code-block></next-code-block>
20-
</template>
21-
</custom-element-demo>
22-
```
23-
-->
24-
```html
25-
<json-form
26-
schema='{"type":"string","title":"Hello","description":"A brief but helpful description of value","maxLength":5}'
27-
value='"world"'
28-
></json-form>
29-
```
5+
This module generates form based on JSON Schema, its keywords are documented in this spec: http://json-schema.org/latest/json-schema-validation.html. It focuses on simplicity rather than completeness of JSON Schema spec coverage. For example, we don't try to guess style of `oneOf`.
306

7+
View demo: https://json-tools.github.io/json-form/
318

329
Development progress:
3310

@@ -37,41 +14,68 @@ Development progress:
3714
- [x] material design styles
3815
- [x] demo for two use-cases: text editing, flat object editing
3916
- [x] editing of number and boolean
40-
- [x] customizable widgets
17+
- [x] customizable widgets (extending json schema with ui schema)
4118
- [x] password field
4219
- [x] mark required fields with *
4320
- [x] basic array editing capabilities
4421
- [x] rules to disable or hide form elements based on conditions
22+
- [x] multiline editing
23+
- [x] editing as json
24+
- [x] dealing with `undefined` (erase optional property)
25+
- [x] editing array of items
26+
- [x] html5 autocomplete for enum
4527

4628
Next steps will be some of those (not necessarily in this order):
4729

48-
- [ ] multiline editing
49-
- [ ] range widget for numbers
30+
- [ ] expandable mode for large/nested forms
31+
- [ ] form layout customisation
32+
- [ ] custom widgets api (e.g. range)
5033
- [ ] radiogroup widget for enum
5134
- [ ] optional field indication (configurable alternative to required)
52-
- [ ] dealing with `undefined` (erase property)
53-
- [ ] editing as json
54-
- [ ] form layout customisation
55-
- [ ] editing array of items
5635
- [ ] editing dictionary (object with additionalItems = true)
5736
- [ ] display of object-level errors
58-
- [ ] expandable mode for large/nested forms
5937

60-
## Setup for development
38+
## Development
39+
40+
### Installation
41+
42+
This module uses `create-elm-app` in order to not clutter project with unrelated dependencies.
6143

62-
1. Install dependencies
6344
```
64-
yarn
45+
npm install -g create-elm-app
6546
```
66-
2. Run local dev server to facilitate hot module reloading
47+
48+
### Local development server
49+
50+
You may want to run local dev server to facilitate hot module reloading.
51+
6752
```
68-
yarn dev
53+
elm-app start
6954
```
7055

71-
## Project structure
56+
### Build and deploy demo to github pages
57+
58+
```
59+
elm-app build
60+
gh-pages -d build
61+
```
62+
63+
## Design approach
64+
65+
### JSON Schema
66+
67+
A few notes on how json schema interpeted by form generator.
68+
69+
#### Types
70+
71+
For the sake of simpliticy form generator uses a "type" keyword of JSON Schema in order to identify type of the field. When "type" keyword is an array or types or missing then value edited as json string. Boolean renders toggle, but can be customized to render a checkbox.
72+
73+
#### Title
74+
75+
Title rendered as label for terminal input fields (leaf nodes of the value), and as h3 headers for objects.
76+
77+
#### Required
7278

73-
All sources live in `./src`, package code that will be published to the elm package registry is in `./src/Json/Form.elm`.
79+
Keyword `required` of object type used to identify whether to display * near the label. Optional text fields also have button to erase value displayed.
7480

75-
All [json-form-custom-element](https://www.webcomponents.org/element/json-form-custom-element) web-component related sources live in a different repo: https://github.com/1602/json-form-custom-element
7681

77-
Contributors welcome, submit an issue to open a discussion.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /