@json-editor/json-editor 2.14.1 → 2.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc +4 -1
- package/.github/workflows/build.yml +5 -4
- package/CHANGELOG.md +25 -0
- package/README.md +32 -1
- package/config/codeceptjs_helpers.js +11 -0
- package/config/webpack.common.js +2 -6
- package/dist/jsoneditor.js +1 -1
- package/dist/jsoneditor.js.LICENSE.txt +1 -1
- package/dist/nonmin/jsoneditor.js +4124 -3939
- package/dist/nonmin/jsoneditor.js.map +1 -1
- package/docs/meta-schema.html +793 -0
- package/package.json +13 -13
- package/src/core.js +5 -1
- package/src/defaults.js +9 -2
- package/src/editor.js +33 -14
- package/src/editors/array.js +3 -6
- package/src/editors/base64.js +3 -0
- package/src/editors/describedby.js +2 -2
- package/src/editors/enum.js +9 -1
- package/src/editors/info.js +8 -0
- package/src/editors/multiple.js +9 -2
- package/src/editors/object.js +26 -7
- package/src/editors/radio.js +5 -2
- package/src/editors/select.js +23 -8
- package/src/editors/select2.js +1 -1
- package/src/editors/starrating.js +5 -4
- package/src/editors/string.js +16 -2
- package/src/editors/table.js +2 -2
- package/src/iconlib.js +0 -1
- package/src/schemaloader.js +2 -2
- package/src/style.css +4 -0
- package/src/style.css.js +1 -1
- package/src/templates/default.js +2 -2
- package/src/theme.js +13 -3
- package/src/themes/index.js +0 -1
- package/src/validator.js +4 -4
- package/tests/Dockerfile +1 -1
- package/tests/codeceptjs/core_test.js +8 -2
- package/tests/codeceptjs/editors/array_test.js +11 -6
- package/tests/codeceptjs/editors/autocomplete_test.js +0 -1
- package/tests/codeceptjs/editors/integer_test.js +3 -5
- package/tests/codeceptjs/editors/object_test.js +8 -0
- package/tests/codeceptjs/editors/rating_test.js +1 -1
- package/tests/codeceptjs/editors/select_test.js +30 -0
- package/tests/codeceptjs/editors/starrating_test.js +15 -0
- package/tests/codeceptjs/editors/string_test.js +7 -0
- package/tests/codeceptjs/issues/issue-gh-1158_test.js +1 -1
- package/tests/codeceptjs/issues/issue-gh-1164_test.js +0 -1
- package/tests/codeceptjs/issues/issue-gh-1383_test.js +1 -1
- package/tests/codeceptjs/issues/issue-gh-1452_test.js +10 -0
- package/tests/codeceptjs/issues/issue-gh-1525_test.js +9 -0
- package/tests/codeceptjs/issues/issue-gh-1536_test.js +12 -0
- package/tests/codeceptjs/issues/issue-gh-1538_test.js +10 -0
- package/tests/codeceptjs/issues/issue-gh-1541_test.js +8 -0
- package/tests/docker-compose.yml +0 -1
- package/tests/pages/array-events-table.html +39 -31
- package/tests/pages/array-events.html +39 -31
- package/tests/pages/assets/autocomplete.css +1 -0
- package/tests/pages/assets/autocomplete.min.js +1 -0
- package/tests/pages/autocomplete.html +4 -4
- package/tests/pages/enforce-const.html +176 -0
- package/tests/pages/integer.html +9 -10
- package/tests/pages/issues/issue-gh-1452.html +98 -0
- package/tests/pages/issues/issue-gh-1525.html +62 -0
- package/tests/pages/issues/issue-gh-1536.html +55 -0
- package/tests/pages/issues/issue-gh-1538.html +56 -0
- package/tests/pages/issues/issue-gh-1541.html +51 -0
- package/tests/pages/issues/issue-gh-1541.json +9 -0
- package/tests/pages/placeholder-options.html +57 -0
- package/tests/pages/prompt-paste-max-length-reached.html +51 -0
- package/tests/pages/remove-false-properties.html +85 -0
- package/tests/pages/select-values.html +91 -0
- package/tests/pages/starrating.html +86 -0
- package/tests/unit/editor.spec.js +1 -1
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="UTF-8">
|
|
5
|
+
<title>remove_false_properties</title>
|
|
6
|
+
<script src="../../dist/jsoneditor.js"></script>
|
|
7
|
+
<link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
|
8
|
+
<link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
|
|
12
|
+
<div class="container">
|
|
13
|
+
<h1>Test</h1>
|
|
14
|
+
<label for="value">Value</label>
|
|
15
|
+
<textarea class="form-control" id="value" rows="12" style="font-size: 12px; font-family: monospace;"></textarea>
|
|
16
|
+
<div id='editor-container'></div>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
const editorContainer = document.querySelector('#editor-container')
|
|
21
|
+
const value = document.querySelector('#value')
|
|
22
|
+
const schema = {
|
|
23
|
+
"type": "object",
|
|
24
|
+
"options": {
|
|
25
|
+
"remove_false_properties": true
|
|
26
|
+
},
|
|
27
|
+
"properties": {
|
|
28
|
+
"a": {
|
|
29
|
+
"type": "boolean",
|
|
30
|
+
"format": "checkbox",
|
|
31
|
+
"options": {
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"a": [
|
|
34
|
+
true
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"b": {
|
|
40
|
+
"type": "boolean",
|
|
41
|
+
"format": "checkbox",
|
|
42
|
+
"options": {
|
|
43
|
+
"remove_false_properties": true
|
|
44
|
+
}
|
|
45
|
+
},
|
|
46
|
+
"c": {
|
|
47
|
+
"type": "boolean",
|
|
48
|
+
"format": "checkbox"
|
|
49
|
+
},
|
|
50
|
+
"d": {
|
|
51
|
+
"type": "boolean",
|
|
52
|
+
"format": "checkbox"
|
|
53
|
+
},
|
|
54
|
+
"e": {
|
|
55
|
+
"type": "boolean",
|
|
56
|
+
"format": "checkbox"
|
|
57
|
+
},
|
|
58
|
+
"f": {
|
|
59
|
+
"type": "boolean",
|
|
60
|
+
"format": "checkbox"
|
|
61
|
+
},
|
|
62
|
+
"g": {
|
|
63
|
+
"type": "boolean",
|
|
64
|
+
"format": "checkbox"
|
|
65
|
+
},
|
|
66
|
+
"h": {
|
|
67
|
+
"type": "boolean",
|
|
68
|
+
"format": "checkbox"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const editor = new JSONEditor(editorContainer, {
|
|
74
|
+
schema: schema,
|
|
75
|
+
theme: 'bootstrap4',
|
|
76
|
+
iconlib: 'fontawesome',
|
|
77
|
+
show_errors: 'always',
|
|
78
|
+
remove_false_properties: false
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
editor.on('change', function () {
|
|
82
|
+
value.value = JSON.stringify(editor.getValue())
|
|
83
|
+
})
|
|
84
|
+
</script>
|
|
85
|
+
</body>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<title>string-simple-mde-editor</title>
|
|
6
|
+
<script src="../../dist/jsoneditor.js"></script>
|
|
7
|
+
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
<div class="container">
|
|
11
|
+
<h1>Test</h1>
|
|
12
|
+
<div class="form-group">
|
|
13
|
+
<label for="value">Value</label>
|
|
14
|
+
<textarea class="form-control" id="value" cols="30" rows="10"></textarea>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<button id="set-value">Set value</button>
|
|
18
|
+
<div id="editor-container"></div>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
const container = document.querySelector("#editor-container")
|
|
23
|
+
const debug = document.querySelector("#value")
|
|
24
|
+
const setValueBtn = document.querySelector("#set-value")
|
|
25
|
+
const schema = {
|
|
26
|
+
"type": "object",
|
|
27
|
+
"properties": {
|
|
28
|
+
"data": {
|
|
29
|
+
"type": "array",
|
|
30
|
+
"uniqueItems": true,
|
|
31
|
+
"format": "table",
|
|
32
|
+
"minLength": 1,
|
|
33
|
+
"items": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"required": [
|
|
36
|
+
"baumart"
|
|
37
|
+
],
|
|
38
|
+
"properties": {
|
|
39
|
+
"baumart": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"enum": [
|
|
42
|
+
"not_set",
|
|
43
|
+
"other_hardwood",
|
|
44
|
+
"beech",
|
|
45
|
+
"oak",
|
|
46
|
+
"spruce"
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const value = {
|
|
56
|
+
"data": [
|
|
57
|
+
{
|
|
58
|
+
"baumart": "other_hardwood",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
"baumart": "beech",
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
"baumart": "oak",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"baumart": "spruce",
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const editor = new JSONEditor(container, {
|
|
73
|
+
disable_collapse: true,
|
|
74
|
+
schema: schema,
|
|
75
|
+
theme: 'bootstrap3'
|
|
76
|
+
})
|
|
77
|
+
|
|
78
|
+
editor.on('ready', () => {
|
|
79
|
+
debug.value = JSON.stringify(editor.getValue())
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
editor.on('change', () => {
|
|
83
|
+
debug.value = JSON.stringify(editor.getValue())
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
setValueBtn.addEventListener('click', () => {
|
|
87
|
+
editor.setValue(value)
|
|
88
|
+
})
|
|
89
|
+
</script>
|
|
90
|
+
</body>
|
|
91
|
+
</html>
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<title>rating</title>
|
|
6
|
+
<script src="../../dist/jsoneditor.js"></script>
|
|
7
|
+
<link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
|
8
|
+
<link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
|
|
12
|
+
<div class="container">
|
|
13
|
+
<h1>Test</h1>
|
|
14
|
+
<div class="form-group">
|
|
15
|
+
<label for="value">Value</label>
|
|
16
|
+
<textarea id="value" class="form-control" rows="10"></textarea>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<div id='editor-container'></div>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
const editorContainer = document.querySelector('#editor-container')
|
|
24
|
+
const value = document.querySelector('#value')
|
|
25
|
+
const schema = {
|
|
26
|
+
type: "object",
|
|
27
|
+
title: "Car",
|
|
28
|
+
properties: {
|
|
29
|
+
integer_rating: {
|
|
30
|
+
type: "integer",
|
|
31
|
+
format: "rating",
|
|
32
|
+
},
|
|
33
|
+
string_rating: {
|
|
34
|
+
type: "string",
|
|
35
|
+
format: "rating",
|
|
36
|
+
},
|
|
37
|
+
starrating: {
|
|
38
|
+
type: "string",
|
|
39
|
+
format: "starrating",
|
|
40
|
+
title: "Starrating",
|
|
41
|
+
description: 'Starrating',
|
|
42
|
+
enum: ["Beginner", "Skilled", "Experienced", "Advanced", "Expert"],
|
|
43
|
+
options: {
|
|
44
|
+
grid_columns: 2
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
starrating2: {
|
|
48
|
+
type: "string",
|
|
49
|
+
format: "starrating",
|
|
50
|
+
title: "Starrating",
|
|
51
|
+
description: 'Starrating with "displayValue=true"',
|
|
52
|
+
enum: ["Beginner", "Skilled", "Experienced", "Advanced", "Expert"],
|
|
53
|
+
options: {
|
|
54
|
+
grid_columns: 2,
|
|
55
|
+
displayValue: true
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
starrating3: {
|
|
59
|
+
type: "string",
|
|
60
|
+
format: "starrating",
|
|
61
|
+
title: "Starrating",
|
|
62
|
+
description: 'Starrating with "displayValue=true"',
|
|
63
|
+
default: "5 Stars",
|
|
64
|
+
enum: ["1 Star", "2 Stars", "3 Stars", "4 Stars", "5 Stars", "6 Stars", "7 Stars", "8 Stars", "9 Stars", "10 Stars"],
|
|
65
|
+
options: {
|
|
66
|
+
grid_columns: 4,
|
|
67
|
+
displayValue: true
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const editor = new JSONEditor(editorContainer, {
|
|
74
|
+
schema: schema,
|
|
75
|
+
theme: 'bootstrap4',
|
|
76
|
+
iconlib: 'fontawesome',
|
|
77
|
+
show_errors: 'always'
|
|
78
|
+
})
|
|
79
|
+
|
|
80
|
+
editor.on('change', function () {
|
|
81
|
+
value.value = JSON.stringify(editor.getValue())
|
|
82
|
+
})
|
|
83
|
+
</script>
|
|
84
|
+
|
|
85
|
+
</body>
|
|
86
|
+
</html>
|