@json-editor/json-editor 2.6.0 → 2.8.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/.github/workflows/build.yml +12 -3
- package/CHANGELOG.md +34 -0
- package/README.md +163 -18
- package/dist/jsoneditor.js +2 -2
- package/dist/nonmin/jsoneditor.js +2710 -651
- 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/form-submission.html +162 -0
- package/docs/index.html +2 -2
- package/docs/materialize_css.html +1 -1
- package/docs/radio.html +1 -1
- package/docs/select2.html +1 -1
- package/docs/selectize.html +1 -1
- package/docs/starrating.html +1 -1
- package/docs/wysiwyg.html +1 -1
- package/package.json +4 -3
- package/release-notes.md +2 -0
- package/src/core.js +36 -37
- package/src/defaults.js +10 -2
- package/src/editor.js +1 -1
- package/src/editors/array.js +12 -1
- package/src/editors/autocomplete.js +4 -3
- package/src/editors/button.js +1 -1
- package/src/editors/checkbox.js +3 -1
- package/src/editors/hidden.js +3 -1
- package/src/editors/multiselect.js +17 -6
- package/src/editors/object.js +3 -4
- package/src/editors/radio.js +8 -3
- package/src/editors/select.js +3 -1
- package/src/editors/signature.js +3 -1
- package/src/editors/string.js +7 -1
- package/src/editors/table.js +20 -2
- package/src/editors/upload.js +1 -1
- package/src/editors/uuid.js +2 -12
- package/src/iconlib.js +1 -1
- package/src/schemaloader.js +231 -108
- package/src/style.css +3 -0
- package/src/style.css.js +1 -1
- package/src/theme.js +0 -2
- package/src/themes/bootstrap3.js +1 -0
- package/src/themes/spectre.js +2 -1
- package/src/utilities.js +18 -0
- package/src/validator.js +36 -34
- package/tests/codeceptjs/codecept.json +1 -1
- package/tests/codeceptjs/core_test.js +104 -0
- package/tests/codeceptjs/editors/advanced_test.js +1 -1
- package/tests/codeceptjs/editors/array_test.js +74 -0
- package/tests/codeceptjs/editors/autocomplete_test.js +16 -0
- package/tests/codeceptjs/editors/button_test.js +10 -3
- package/tests/codeceptjs/editors/integer_test.js +7 -2
- package/tests/codeceptjs/editors/jodit_test.js +3 -3
- package/tests/codeceptjs/editors/object_test.js +29 -9
- package/tests/codeceptjs/editors/range_test.js +12 -0
- package/tests/codeceptjs/editors/uuid_test.js +31 -4
- package/tests/docker-compose.yml +1 -1
- package/tests/fixtures/definitions.json +22 -0
- package/tests/fixtures/properties.json +20 -0
- package/tests/pages/array-checkboxes-infotext.html +52 -0
- package/tests/pages/array-move-events.html +4 -2
- package/tests/pages/array-unique-items-sort.html +78 -0
- package/tests/pages/autocomplete.html +69 -0
- package/tests/pages/button-icons.html +38 -0
- package/tests/pages/core.html +4 -2
- package/tests/pages/error-messages.html +47 -0
- package/tests/pages/grid-strict.html +6 -10
- package/tests/pages/grid.html +0 -4
- package/tests/pages/issues/issue-gh-812.html +4 -2
- package/tests/pages/meta_schema.json +14 -0
- package/tests/pages/object-required-properties.html +7 -7
- package/tests/pages/object-with-dependencies-array.html +29 -19
- package/tests/pages/range.html +60 -0
- package/tests/pages/ready.html +43 -0
- package/tests/pages/references.html +162 -0
- package/tests/pages/string-simplemde-editor.html +81 -0
- package/tests/pages/table-move-events.html +4 -1
- package/tests/pages/urn.html +11 -8
- package/tests/pages/use-name-attributes.html +206 -0
- package/tests/pages/uuid.html +89 -50
- package/tests/pages/validation-messages.json +705 -0
- package/tests/unit/core.spec.js +79 -66
- package/tests/unit/editor.spec.js +20 -8
- package/tests/unit/editors/array.spec.js +3 -2
- package/tests/unit/editors/object.spec.js +3 -1
- package/tests/unit/editors/table.spec.js +4 -2
- package/tests/unit/schemaloader.spec.js +77 -105
- package/tests/unit/validator.spec.js +2 -2
package/tests/pages/uuid.html
CHANGED
|
@@ -1,72 +1,111 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
2
|
<html lang="en">
|
|
3
|
+
|
|
3
4
|
<head>
|
|
4
|
-
<meta charset="utf-8"/>
|
|
5
|
+
<meta charset="utf-8" />
|
|
5
6
|
<script src="../../dist/jsoneditor.js"></script>
|
|
6
7
|
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
|
7
8
|
<title>object-no-duplicated-id</title>
|
|
8
9
|
</head>
|
|
10
|
+
|
|
9
11
|
<body>
|
|
10
12
|
|
|
11
|
-
<div class="container">
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
<div class="container">
|
|
14
|
+
<div class="form-group">
|
|
15
|
+
<textarea id="value" class="form-control" rows="10"></textarea>
|
|
16
|
+
</div>
|
|
17
|
+
<button id="get-value" class='btn btn-secondary'>get value</button>
|
|
18
|
+
<hr>
|
|
19
|
+
<div id='form-container'></div>
|
|
14
20
|
</div>
|
|
15
|
-
<button id="get-value" class='btn btn-secondary'>get value</button>
|
|
16
|
-
<hr>
|
|
17
|
-
<div id='form-container'></div>
|
|
18
|
-
</div>
|
|
19
21
|
|
|
20
|
-
<script>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
<script>
|
|
23
|
+
var formContainer = document.querySelector('#form-container')
|
|
24
|
+
var value = document.querySelector('#value')
|
|
25
|
+
var getValue = document.querySelector('#get-value')
|
|
24
26
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
var today = (offset) => {
|
|
28
|
+
var t = new Date()
|
|
29
|
+
t.setDate(t.getDate() + (offset || 0))
|
|
30
|
+
return t.toISOString().split('T')[0]
|
|
31
|
+
}
|
|
30
32
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
'
|
|
49
|
-
|
|
50
|
-
|
|
33
|
+
var schema = {
|
|
34
|
+
'type': 'object',
|
|
35
|
+
'properties': {
|
|
36
|
+
'uuid': {
|
|
37
|
+
'type': 'string',
|
|
38
|
+
'format': 'uuid',
|
|
39
|
+
'title': 'single uuid',
|
|
40
|
+
'required': true,
|
|
41
|
+
'default': 'banana'
|
|
42
|
+
},
|
|
43
|
+
'uuidStringArray': {
|
|
44
|
+
'type': 'array',
|
|
45
|
+
'required': true,
|
|
46
|
+
'title': 'array of uuids',
|
|
47
|
+
'items': {
|
|
48
|
+
'type': 'string',
|
|
49
|
+
'format': 'uuid',
|
|
50
|
+
'title': 'uuid string array item'
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
'uuidObjectArray': {
|
|
54
|
+
'type': 'array',
|
|
55
|
+
'title': 'array of objects with uuid property',
|
|
56
|
+
'required': true,
|
|
57
|
+
'items': {
|
|
58
|
+
'title': 'uuid object array item',
|
|
59
|
+
'type': 'object',
|
|
60
|
+
'properties': {
|
|
61
|
+
'uuid': {
|
|
62
|
+
'type': 'string',
|
|
63
|
+
'format': 'uuid'
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
'uuidStringTable': {
|
|
69
|
+
'type': 'array',
|
|
70
|
+
'required': true,
|
|
71
|
+
'format': 'table',
|
|
72
|
+
'title': 'array of uuids (table)',
|
|
73
|
+
'items': {
|
|
74
|
+
'title': 'uuid string table item',
|
|
75
|
+
'type': 'string',
|
|
76
|
+
'format': 'uuid'
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
'uuidObjectTable': {
|
|
80
|
+
"type": "array",
|
|
81
|
+
"format": "table",
|
|
82
|
+
"title": "Array of objects (Table) with uuid property",
|
|
83
|
+
"items": {
|
|
84
|
+
'title': 'uuid object table item',
|
|
85
|
+
"type": "object",
|
|
86
|
+
"properties": {
|
|
87
|
+
"uuid": {
|
|
88
|
+
"type": "string",
|
|
89
|
+
"format": "uuid",
|
|
90
|
+
}
|
|
51
91
|
}
|
|
52
92
|
}
|
|
53
93
|
}
|
|
54
94
|
}
|
|
55
95
|
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
var editor = new JSONEditor(formContainer, {
|
|
59
|
-
schema: schema,
|
|
60
|
-
theme: 'bootstrap4',
|
|
61
|
-
show_errors: 'always'
|
|
62
|
-
})
|
|
63
96
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
97
|
+
var editor = new JSONEditor(formContainer, {
|
|
98
|
+
schema: schema,
|
|
99
|
+
theme: 'bootstrap4',
|
|
100
|
+
show_errors: 'always',
|
|
101
|
+
enable_array_copy: true,
|
|
102
|
+
})
|
|
68
103
|
|
|
69
|
-
|
|
104
|
+
getValue.addEventListener('click', function () {
|
|
105
|
+
value.value = JSON.stringify(editor.getValue())
|
|
106
|
+
console.log(editor.getValue())
|
|
107
|
+
})
|
|
70
108
|
|
|
109
|
+
</script>
|
|
71
110
|
</body>
|
|
72
|
-
</html>
|
|
111
|
+
</html>
|