@json-editor/json-editor 2.11.0 → 2.12.0
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/.env +1 -1
- package/CHANGELOG.md +11 -0
- package/README.md +77 -1
- package/README_ADDON.md +5 -1
- package/dist/jsoneditor.js +1 -1
- package/dist/jsoneditor.js.LICENSE.txt +1 -1
- package/dist/nonmin/jsoneditor.js +330 -169
- package/dist/nonmin/jsoneditor.js.map +1 -1
- package/docs/cleave.html +1 -1
- package/docs/datetime.html +1 -1
- package/docs/describedby.html +1 -1
- package/docs/index.html +5 -3
- package/docs/meta_schema.json +5 -1
- package/docs/radio.html +1 -1
- package/docs/select2.html +1 -1
- package/docs/selectize.html +2 -5
- package/docs/signature.html +12 -11
- package/docs/wysiwyg.html +1 -1
- package/package.json +1 -1
- package/src/core.js +10 -1
- package/src/defaults.js +3 -1
- package/src/editor.js +1 -1
- package/src/editors/array/selectize.js +0 -2
- package/src/editors/array.js +24 -13
- package/src/editors/base64.js +9 -0
- package/src/editors/integer.js +3 -2
- package/src/editors/multiple.js +3 -0
- package/src/editors/number.js +4 -2
- package/src/editors/object.js +71 -3
- package/src/editors/signature.js +16 -16
- package/src/editors/string.js +4 -0
- package/src/editors/table.js +17 -14
- package/src/resolvers.js +6 -2
- package/src/schemaloader.js +13 -0
- package/src/theme.js +4 -0
- package/src/themes/bootstrap3.js +6 -0
- package/src/themes/bootstrap4.js +6 -0
- package/src/themes/bootstrap5.js +6 -0
- package/src/validator.js +28 -0
- package/tests/codeceptjs/constrains/dependentRequired_test.js +33 -0
- package/tests/codeceptjs/core_test.js +10 -0
- package/tests/codeceptjs/editors/array_test.js +52 -0
- package/tests/codeceptjs/editors/object_test.js +20 -0
- package/tests/codeceptjs/issues/issue-gh-1330_test.js +8 -0
- package/tests/codeceptjs/issues/issue-gh-1338_test.js +2 -0
- package/tests/codeceptjs/issues/issue-gh-1364_test.js +13 -0
- package/tests/codeceptjs/issues/issue-gh-1367_test.js +11 -0
- package/tests/codeceptjs/issues/issue-gh-1383_test.js +9 -0
- package/tests/codeceptjs/issues/issue-gh-1384_test.js +9 -0
- package/tests/codeceptjs/issues/issue-gh-1410_test.js +13 -0
- package/tests/codeceptjs/issues/issue-gh-1422_test.js +9 -0
- package/tests/docker-compose-local.yml +4 -0
- package/tests/pages/array-selectize-create.html +62 -0
- package/tests/pages/array-table-responsive.html +65 -0
- package/tests/pages/button_state_mode_1.html +34 -0
- package/tests/pages/button_state_mode_2.html +35 -0
- package/tests/pages/dependentRequired.html +71 -0
- package/tests/pages/issues/issue-gh-1330.html +52 -0
- package/tests/pages/issues/issue-gh-1364.html +64 -0
- package/tests/pages/issues/issue-gh-1367.html +49 -0
- package/tests/pages/issues/issue-gh-1383.html +31 -0
- package/tests/pages/issues/issue-gh-1383.json +14 -0
- package/tests/pages/issues/issue-gh-1384.html +31 -0
- package/tests/pages/issues/issue-gh-1384.json +36 -0
- package/tests/pages/issues/issue-gh-1410.html +57 -0
- package/tests/pages/issues/issue-gh-1422.html +68 -0
- package/tests/pages/keep_only_existing_values.html +1 -1
- package/tests/pages/load-events.html +60 -0
- package/tests/pages/meta-schema.html +5 -1
- package/tests/pages/meta_schema.json +5 -1
- package/tests/pages/object-case-sensitive-property-search-false.html +41 -0
- package/tests/pages/object-case-sensitive-property-search-true.html +41 -0
- package/dist/dev/jsoneditor.js +0 -3687
- package/dist/jsoneditor.js.map +0 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<title>button_state_mode</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
|
+
<div id='editor-container'></div>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
var editorContainer = document.querySelector('#editor-container')
|
|
18
|
+
var schema = {
|
|
19
|
+
'title': 'button_state_mode',
|
|
20
|
+
'type': 'array',
|
|
21
|
+
'items': {
|
|
22
|
+
'type': 'number'
|
|
23
|
+
},
|
|
24
|
+
'minItems': 3
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
var editor = new JSONEditor(editorContainer, {
|
|
28
|
+
schema: schema,
|
|
29
|
+
theme: 'bootstrap4',
|
|
30
|
+
button_state_mode: 2
|
|
31
|
+
})
|
|
32
|
+
</script>
|
|
33
|
+
|
|
34
|
+
</body>
|
|
35
|
+
</html>
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<title>dependentRequired</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
|
+
<div id='editor-container'></div>
|
|
14
|
+
|
|
15
|
+
<div class="form-group">
|
|
16
|
+
<label for="textarea-value">Value</label>
|
|
17
|
+
<textarea class="form-control" id="textarea-value" cols="30" rows="10"></textarea>
|
|
18
|
+
</div>
|
|
19
|
+
</div>
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
var editorContainer = document.querySelector('#editor-container')
|
|
23
|
+
var textareaValue = document.querySelector('#textarea-value')
|
|
24
|
+
var schema = {
|
|
25
|
+
'title': 'dependentRequired',
|
|
26
|
+
'type': 'object',
|
|
27
|
+
'properties': {
|
|
28
|
+
'name': {
|
|
29
|
+
'type': 'string'
|
|
30
|
+
},
|
|
31
|
+
'credit_card': {
|
|
32
|
+
'type': 'number'
|
|
33
|
+
},
|
|
34
|
+
'billing_address_1': {
|
|
35
|
+
'type': 'string'
|
|
36
|
+
},
|
|
37
|
+
'billing_address_2': {
|
|
38
|
+
'type': 'string'
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
'required': [
|
|
42
|
+
'name'
|
|
43
|
+
],
|
|
44
|
+
'dependentRequired': {
|
|
45
|
+
'credit_card': [
|
|
46
|
+
'billing_address_1',
|
|
47
|
+
],
|
|
48
|
+
'billing_address_1': [
|
|
49
|
+
'billing_address_2',
|
|
50
|
+
],
|
|
51
|
+
'billing_address_2': [
|
|
52
|
+
'billing_address_3',
|
|
53
|
+
]
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
var editor = new JSONEditor(editorContainer, {
|
|
58
|
+
schema: schema,
|
|
59
|
+
theme: 'bootstrap4',
|
|
60
|
+
iconlib: 'fontawesome',
|
|
61
|
+
show_errors: 'always',
|
|
62
|
+
show_opt_in: true
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
editor.on('change', function () {
|
|
66
|
+
textareaValue.value = JSON.stringify(editor.getValue())
|
|
67
|
+
})
|
|
68
|
+
</script>
|
|
69
|
+
|
|
70
|
+
</body>
|
|
71
|
+
</html>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>GitHub Issue 1330</title>
|
|
6
|
+
<link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
|
7
|
+
<link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
|
|
8
|
+
<script src="../../../dist/jsoneditor.js"></script>
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<div class="container">
|
|
12
|
+
<a href="https://github.com/json-editor/json-editor/issues/1330">GitHub Issue 1330</a>
|
|
13
|
+
<div id='editor_holder'></div>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
var defaultSchema = {
|
|
18
|
+
"$id": "https://example.com/person.schema.json",
|
|
19
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
20
|
+
"title": "My Test",
|
|
21
|
+
"type": "object",
|
|
22
|
+
"required": [ "test" ],
|
|
23
|
+
"properties": {
|
|
24
|
+
"test": {
|
|
25
|
+
"type": "array",
|
|
26
|
+
"format": "checkbox",
|
|
27
|
+
"title": "een testje",
|
|
28
|
+
"uniqueItems": true,
|
|
29
|
+
"items": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"$ref": "#/definitions/columns_enum"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"definitions": {
|
|
36
|
+
"columns_enum": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"enum": ["xx", "yy", "zz"]
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
var editor = new JSONEditor(document.getElementById('editor_holder'),{
|
|
44
|
+
iconlib: 'fontawesome5',
|
|
45
|
+
object_layout: 'normal',
|
|
46
|
+
schema: defaultSchema,
|
|
47
|
+
show_errors: 'always',
|
|
48
|
+
theme: 'bootstrap4'
|
|
49
|
+
});
|
|
50
|
+
</script>
|
|
51
|
+
</body>
|
|
52
|
+
</html>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>GitHub Issue 1364</title>
|
|
6
|
+
<link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
|
7
|
+
<link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
|
|
8
|
+
<script src="../../../dist/jsoneditor.js"></script>
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<div class="container">
|
|
12
|
+
<a href="https://github.com/json-editor/json-editor/issues/1158">GitHub Issue 1364</a>
|
|
13
|
+
<label for="value">Value</label>
|
|
14
|
+
<textarea class="form-control" id="value" rows="6" style="font-size: 12px; font-family: monospace;"></textarea>
|
|
15
|
+
<div id='editor_holder'></div>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<script>
|
|
19
|
+
var defaultSchema = {
|
|
20
|
+
"type": "object",
|
|
21
|
+
"properties": {
|
|
22
|
+
"engine": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"enum": ["none", "test1"]
|
|
25
|
+
},
|
|
26
|
+
"child1": {
|
|
27
|
+
"type": "object",
|
|
28
|
+
"properties": {
|
|
29
|
+
"L2Name": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"options": {
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"root.engine": "test1"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"L1Name": {
|
|
40
|
+
"type": "string",
|
|
41
|
+
"options": {
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"root.engine": "test1"
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
var value = document.querySelector('#value')
|
|
51
|
+
var editor = new JSONEditor(document.getElementById('editor_holder'),{
|
|
52
|
+
iconlib: 'fontawesome5',
|
|
53
|
+
object_layout: 'normal',
|
|
54
|
+
schema: defaultSchema,
|
|
55
|
+
show_errors: 'always',
|
|
56
|
+
theme: 'bootstrap4'
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
editor.on('change', function () {
|
|
60
|
+
value.value = JSON.stringify(editor.getValue())
|
|
61
|
+
})
|
|
62
|
+
</script>
|
|
63
|
+
</body>
|
|
64
|
+
</html>
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>GitHub Issue 1367</title>
|
|
6
|
+
<link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
|
7
|
+
<link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
|
|
8
|
+
<script src="https://cdn.jsdelivr.net/npm/signature_pad@2.3.2/dist/signature_pad.js"></script>
|
|
9
|
+
<script src="../../../dist/jsoneditor.js"></script>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div class="container">
|
|
13
|
+
<a href="https://github.com/json-editor/json-editor/issues/1158">GitHub Issue 1367</a>
|
|
14
|
+
<label for="value">Value</label>
|
|
15
|
+
<textarea class="form-control" id="value" rows="6" style="font-size: 12px; font-family: monospace;"></textarea>
|
|
16
|
+
<div id='editor_holder'></div>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
var defaultSchema = {
|
|
21
|
+
'type': 'object',
|
|
22
|
+
'title': 'Document',
|
|
23
|
+
'properties': {
|
|
24
|
+
'signature': {
|
|
25
|
+
'type': 'string',
|
|
26
|
+
'format': 'signature',
|
|
27
|
+
'title': 'Signature',
|
|
28
|
+
'options': {
|
|
29
|
+
'canvas_height': 500
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
var value = document.querySelector('#value')
|
|
36
|
+
var editor = new JSONEditor(document.getElementById('editor_holder'),{
|
|
37
|
+
iconlib: 'fontawesome5',
|
|
38
|
+
object_layout: 'normal',
|
|
39
|
+
schema: defaultSchema,
|
|
40
|
+
show_errors: 'always',
|
|
41
|
+
theme: 'bootstrap4'
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
editor.on('change', function () {
|
|
45
|
+
value.value = JSON.stringify(editor.getValue())
|
|
46
|
+
})
|
|
47
|
+
</script>
|
|
48
|
+
</body>
|
|
49
|
+
</html>
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>GitHub Issue 1383</title>
|
|
6
|
+
<link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
|
7
|
+
<link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
|
|
8
|
+
<script src="../../../dist/jsoneditor.js"></script>
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<div class="container">
|
|
12
|
+
<a href="https://github.com/json-editor/json-editor/issues/1383">GitHub Issue 1383</a>
|
|
13
|
+
<div id='editor_holder'></div>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
var defaultSchema = {
|
|
18
|
+
"$ref": "./issue-gh-1383.json"
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
var editor = new JSONEditor(document.getElementById('editor_holder'),{
|
|
22
|
+
iconlib: 'fontawesome5',
|
|
23
|
+
object_layout: 'normal',
|
|
24
|
+
schema: defaultSchema,
|
|
25
|
+
show_errors: 'always',
|
|
26
|
+
theme: 'bootstrap4',
|
|
27
|
+
ajax: true
|
|
28
|
+
});
|
|
29
|
+
</script>
|
|
30
|
+
</body>
|
|
31
|
+
</html>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
|
|
4
|
+
"properties": {
|
|
5
|
+
"activity-timeout": {
|
|
6
|
+
"description": "How long a CMFActivity-initiated transaction may last, in seconds",
|
|
7
|
+
"default": null,
|
|
8
|
+
"type": [
|
|
9
|
+
"number",
|
|
10
|
+
"null"
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>GitHub Issue 1384</title>
|
|
6
|
+
<link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
|
7
|
+
<link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
|
|
8
|
+
<script src="../../../dist/jsoneditor.js"></script>
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<div class="container">
|
|
12
|
+
<a href="https://github.com/json-editor/json-editor/issues/1384">GitHub Issue 1384</a>
|
|
13
|
+
<div id='editor_holder'></div>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
var defaultSchema = {
|
|
18
|
+
"$ref": "./issue-gh-1384.json"
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
var editor = new JSONEditor(document.getElementById('editor_holder'),{
|
|
22
|
+
iconlib: 'fontawesome5',
|
|
23
|
+
object_layout: 'normal',
|
|
24
|
+
schema: defaultSchema,
|
|
25
|
+
show_errors: 'always',
|
|
26
|
+
theme: 'bootstrap4',
|
|
27
|
+
ajax: true
|
|
28
|
+
});
|
|
29
|
+
</script>
|
|
30
|
+
</body>
|
|
31
|
+
</html>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema#",
|
|
3
|
+
|
|
4
|
+
"description": "Parameters to instantiate ERP5",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"definitions": {
|
|
7
|
+
"tcpv4port": {
|
|
8
|
+
"minimum": 0,
|
|
9
|
+
"maximum": 65535,
|
|
10
|
+
"type": "integer"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"properties": {
|
|
14
|
+
"zope-partition-dict": {
|
|
15
|
+
"description": "Zope layout definition",
|
|
16
|
+
"default": {
|
|
17
|
+
"1": {}
|
|
18
|
+
},
|
|
19
|
+
"patternProperties": {
|
|
20
|
+
".*": {
|
|
21
|
+
"properties": {
|
|
22
|
+
"port-base": {
|
|
23
|
+
"allOf": [
|
|
24
|
+
{
|
|
25
|
+
"$ref": "#/definitions/tcpv4port"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"type": "object"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"type": "object"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>GitHub Issue 1410</title>
|
|
6
|
+
<link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
|
7
|
+
<link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
|
|
8
|
+
<script src="../../../dist/jsoneditor.js"></script>
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<div class="container">
|
|
12
|
+
<a href="https://github.com/json-editor/json-editor/issues/1410">GitHub Issue 1410</a>
|
|
13
|
+
<div id='editor_holder'></div>
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
<script>
|
|
17
|
+
var defaultSchema = {
|
|
18
|
+
'title': 'additionalProperties',
|
|
19
|
+
'type': 'object',
|
|
20
|
+
'properties': {
|
|
21
|
+
"standard": {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"properties": {
|
|
24
|
+
"prop": {
|
|
25
|
+
"title": "Prop",
|
|
26
|
+
"type": "string"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"extras": {
|
|
31
|
+
"type": "object",
|
|
32
|
+
"additionalProperties": {
|
|
33
|
+
"type": ["number", "boolean", "string", "array"],
|
|
34
|
+
"items": {
|
|
35
|
+
"type": ["number", "boolean", "string"]
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"properties": {
|
|
39
|
+
"prop": {
|
|
40
|
+
"title": "Prop",
|
|
41
|
+
"type": "string"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
var editor = new JSONEditor(document.getElementById('editor_holder'),{
|
|
49
|
+
iconlib: 'fontawesome5',
|
|
50
|
+
schema: defaultSchema,
|
|
51
|
+
show_errors: 'always',
|
|
52
|
+
theme: 'bootstrap4',
|
|
53
|
+
no_additional_properties: true
|
|
54
|
+
});
|
|
55
|
+
</script>
|
|
56
|
+
</body>
|
|
57
|
+
</html>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>GitHub Issue 1422</title>
|
|
6
|
+
<link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
|
7
|
+
<link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
|
|
8
|
+
<script src="../../../dist/jsoneditor.js"></script>
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<div class="container">
|
|
12
|
+
<textarea class="form-control" id="value" cols="30" rows="10"></textarea>
|
|
13
|
+
<a href="https://github.com/json-editor/json-editor/issues/1422">GitHub Issue 1422</a>
|
|
14
|
+
<div id='editor_holder'></div>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
var value = document.querySelector('#value')
|
|
19
|
+
var defaultSchema = {
|
|
20
|
+
"type": "object",
|
|
21
|
+
"required": [
|
|
22
|
+
"req",
|
|
23
|
+
"req_with_default"
|
|
24
|
+
],
|
|
25
|
+
"properties": {
|
|
26
|
+
"req": {
|
|
27
|
+
"type": "integer",
|
|
28
|
+
"minimum": 1,
|
|
29
|
+
"maximum": 10
|
|
30
|
+
},
|
|
31
|
+
"opt": {
|
|
32
|
+
"type": "integer",
|
|
33
|
+
"minimum": 1,
|
|
34
|
+
"maximum": 10
|
|
35
|
+
},
|
|
36
|
+
"req_with_default": {
|
|
37
|
+
"type": "integer",
|
|
38
|
+
"default": 5,
|
|
39
|
+
"minimum": 1,
|
|
40
|
+
"maximum": 10
|
|
41
|
+
},
|
|
42
|
+
"opt_with_default": {
|
|
43
|
+
"type": "integer",
|
|
44
|
+
"default": 5,
|
|
45
|
+
"minimum": 1,
|
|
46
|
+
"maximum": 10
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
var editor = new JSONEditor(document.getElementById('editor_holder'),{
|
|
52
|
+
iconlib: 'fontawesome5',
|
|
53
|
+
schema: defaultSchema,
|
|
54
|
+
show_errors: 'always',
|
|
55
|
+
theme: 'bootstrap4',
|
|
56
|
+
use_default_values: false,
|
|
57
|
+
startval: {
|
|
58
|
+
"req": 5,
|
|
59
|
+
"opt": 5
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
editor.on('change', function () {
|
|
64
|
+
value.value = JSON.stringify(editor.getValue())
|
|
65
|
+
})
|
|
66
|
+
</script>
|
|
67
|
+
</body>
|
|
68
|
+
</html>
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<html lang="de">
|
|
3
3
|
<head>
|
|
4
4
|
<meta charset="utf-8"/>
|
|
5
|
-
<title>
|
|
5
|
+
<title>keep_only_existing_values</title>
|
|
6
6
|
<link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
|
7
7
|
<link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
|
|
8
8
|
<script src="../../dist/jsoneditor.js"></script>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<title>Load events</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
|
+
<div id="events-container"></div>
|
|
14
|
+
<div id='editor-container'></div>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<script>
|
|
18
|
+
const eventsContainer = document.querySelector('#events-container')
|
|
19
|
+
const editorContainer = document.querySelector('#editor-container')
|
|
20
|
+
const schema = {
|
|
21
|
+
"title": "Load Events",
|
|
22
|
+
"type": "object",
|
|
23
|
+
"properties": {
|
|
24
|
+
"personA": {
|
|
25
|
+
"$ref": "../fixtures/basic_person.json"
|
|
26
|
+
},
|
|
27
|
+
"personB": {
|
|
28
|
+
"$ref": "../fixtures/person.json"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const editor = new JSONEditor(editorContainer, {
|
|
34
|
+
schema: schema,
|
|
35
|
+
theme: 'bootstrap4',
|
|
36
|
+
iconlib: 'fontawesome',
|
|
37
|
+
disable_collapse: true,
|
|
38
|
+
disable_edit_json: true,
|
|
39
|
+
disable_properties: true,
|
|
40
|
+
ajax: true
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
editor.on('schemaLoaded', function (payload) {
|
|
44
|
+
const schemaUrl = document.createElement('pre')
|
|
45
|
+
const loadedSchema = document.createElement('pre')
|
|
46
|
+
schemaUrl.textContent = payload.schemaUrl
|
|
47
|
+
loadedSchema.textContent = JSON.stringify(payload.schema)
|
|
48
|
+
eventsContainer.appendChild(schemaUrl)
|
|
49
|
+
eventsContainer.appendChild(loadedSchema)
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
editor.on('allSchemasLoaded', function () {
|
|
53
|
+
const loaded = document.createElement('p')
|
|
54
|
+
loaded.textContent = 'All schemas loaded'
|
|
55
|
+
eventsContainer.appendChild(loaded)
|
|
56
|
+
})
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
</body>
|
|
60
|
+
</html>
|
|
@@ -144,8 +144,10 @@
|
|
|
144
144
|
'pgsql',
|
|
145
145
|
'php',
|
|
146
146
|
'python',
|
|
147
|
+
'prql',
|
|
147
148
|
'r',
|
|
148
149
|
'ruby',
|
|
150
|
+
'rust',
|
|
149
151
|
'sass',
|
|
150
152
|
'scala',
|
|
151
153
|
'scss',
|
|
@@ -153,10 +155,12 @@
|
|
|
153
155
|
'sql',
|
|
154
156
|
'stylus',
|
|
155
157
|
'svg',
|
|
158
|
+
'typescript',
|
|
156
159
|
'twig',
|
|
157
160
|
'vbscript',
|
|
158
161
|
'xml',
|
|
159
|
-
'yaml'
|
|
162
|
+
'yaml',
|
|
163
|
+
'zig'
|
|
160
164
|
]
|
|
161
165
|
},
|
|
162
166
|
'minLength': {
|
|
@@ -122,8 +122,10 @@
|
|
|
122
122
|
"pgsql",
|
|
123
123
|
"php",
|
|
124
124
|
"python",
|
|
125
|
+
"prql",
|
|
125
126
|
"r",
|
|
126
127
|
"ruby",
|
|
128
|
+
"rust",
|
|
127
129
|
"sass",
|
|
128
130
|
"scala",
|
|
129
131
|
"scss",
|
|
@@ -131,10 +133,12 @@
|
|
|
131
133
|
"sql",
|
|
132
134
|
"stylus",
|
|
133
135
|
"svg",
|
|
136
|
+
"typescript",
|
|
134
137
|
"twig",
|
|
135
138
|
"vbscript",
|
|
136
139
|
"xml",
|
|
137
|
-
"yaml"
|
|
140
|
+
"yaml",
|
|
141
|
+
"zig"
|
|
138
142
|
]
|
|
139
143
|
},
|
|
140
144
|
"minLength": {
|