@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.
Files changed (88) hide show
  1. package/.github/workflows/build.yml +12 -3
  2. package/CHANGELOG.md +34 -0
  3. package/README.md +163 -18
  4. package/dist/jsoneditor.js +2 -2
  5. package/dist/nonmin/jsoneditor.js +2710 -651
  6. package/dist/nonmin/jsoneditor.js.map +1 -1
  7. package/docs/cleave.html +1 -1
  8. package/docs/datetime.html +1 -1
  9. package/docs/describedby.html +1 -1
  10. package/docs/form-submission.html +162 -0
  11. package/docs/index.html +2 -2
  12. package/docs/materialize_css.html +1 -1
  13. package/docs/radio.html +1 -1
  14. package/docs/select2.html +1 -1
  15. package/docs/selectize.html +1 -1
  16. package/docs/starrating.html +1 -1
  17. package/docs/wysiwyg.html +1 -1
  18. package/package.json +4 -3
  19. package/release-notes.md +2 -0
  20. package/src/core.js +36 -37
  21. package/src/defaults.js +10 -2
  22. package/src/editor.js +1 -1
  23. package/src/editors/array.js +12 -1
  24. package/src/editors/autocomplete.js +4 -3
  25. package/src/editors/button.js +1 -1
  26. package/src/editors/checkbox.js +3 -1
  27. package/src/editors/hidden.js +3 -1
  28. package/src/editors/multiselect.js +17 -6
  29. package/src/editors/object.js +3 -4
  30. package/src/editors/radio.js +8 -3
  31. package/src/editors/select.js +3 -1
  32. package/src/editors/signature.js +3 -1
  33. package/src/editors/string.js +7 -1
  34. package/src/editors/table.js +20 -2
  35. package/src/editors/upload.js +1 -1
  36. package/src/editors/uuid.js +2 -12
  37. package/src/iconlib.js +1 -1
  38. package/src/schemaloader.js +231 -108
  39. package/src/style.css +3 -0
  40. package/src/style.css.js +1 -1
  41. package/src/theme.js +0 -2
  42. package/src/themes/bootstrap3.js +1 -0
  43. package/src/themes/spectre.js +2 -1
  44. package/src/utilities.js +18 -0
  45. package/src/validator.js +36 -34
  46. package/tests/codeceptjs/codecept.json +1 -1
  47. package/tests/codeceptjs/core_test.js +104 -0
  48. package/tests/codeceptjs/editors/advanced_test.js +1 -1
  49. package/tests/codeceptjs/editors/array_test.js +74 -0
  50. package/tests/codeceptjs/editors/autocomplete_test.js +16 -0
  51. package/tests/codeceptjs/editors/button_test.js +10 -3
  52. package/tests/codeceptjs/editors/integer_test.js +7 -2
  53. package/tests/codeceptjs/editors/jodit_test.js +3 -3
  54. package/tests/codeceptjs/editors/object_test.js +29 -9
  55. package/tests/codeceptjs/editors/range_test.js +12 -0
  56. package/tests/codeceptjs/editors/uuid_test.js +31 -4
  57. package/tests/docker-compose.yml +1 -1
  58. package/tests/fixtures/definitions.json +22 -0
  59. package/tests/fixtures/properties.json +20 -0
  60. package/tests/pages/array-checkboxes-infotext.html +52 -0
  61. package/tests/pages/array-move-events.html +4 -2
  62. package/tests/pages/array-unique-items-sort.html +78 -0
  63. package/tests/pages/autocomplete.html +69 -0
  64. package/tests/pages/button-icons.html +38 -0
  65. package/tests/pages/core.html +4 -2
  66. package/tests/pages/error-messages.html +47 -0
  67. package/tests/pages/grid-strict.html +6 -10
  68. package/tests/pages/grid.html +0 -4
  69. package/tests/pages/issues/issue-gh-812.html +4 -2
  70. package/tests/pages/meta_schema.json +14 -0
  71. package/tests/pages/object-required-properties.html +7 -7
  72. package/tests/pages/object-with-dependencies-array.html +29 -19
  73. package/tests/pages/range.html +60 -0
  74. package/tests/pages/ready.html +43 -0
  75. package/tests/pages/references.html +162 -0
  76. package/tests/pages/string-simplemde-editor.html +81 -0
  77. package/tests/pages/table-move-events.html +4 -1
  78. package/tests/pages/urn.html +11 -8
  79. package/tests/pages/use-name-attributes.html +206 -0
  80. package/tests/pages/uuid.html +89 -50
  81. package/tests/pages/validation-messages.json +705 -0
  82. package/tests/unit/core.spec.js +79 -66
  83. package/tests/unit/editor.spec.js +20 -8
  84. package/tests/unit/editors/array.spec.js +3 -2
  85. package/tests/unit/editors/object.spec.js +3 -1
  86. package/tests/unit/editors/table.spec.js +4 -2
  87. package/tests/unit/schemaloader.spec.js +77 -105
  88. package/tests/unit/validator.spec.js +2 -2
@@ -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
- <div class="form-group">
13
- <textarea id="value" class="form-control" rows="10"></textarea>
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
- var formContainer = document.querySelector('#form-container')
22
- var value = document.querySelector('#value')
23
- var getValue = document.querySelector('#get-value')
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
- var today = (offset) => {
26
- var t = new Date()
27
- t.setDate(t.getDate() + (offset || 0))
28
- return t.toISOString().split('T')[0]
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
- var schema = {
32
- 'type': 'object',
33
- 'properties': {
34
- 'uuid': {
35
- 'type': 'string',
36
- 'format': 'uuid',
37
- 'title': 'single uuid',
38
- 'required': true,
39
- 'default': 'banana'
40
- },
41
- 'uuidArray': {
42
- 'type': 'array',
43
- 'title': 'uuid array',
44
- 'required': true,
45
- 'items': {
46
- 'type': 'object',
47
- 'properties': {
48
- 'uuid': {
49
- 'type': 'string',
50
- 'format': 'uuid'
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
- getValue.addEventListener('click', function () {
65
- value.value = JSON.stringify(editor.getValue())
66
- console.log(editor.getValue())
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
- </script>
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>