@json-editor/json-editor 2.9.0-beta.0 → 2.9.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 (58) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/README.md +16 -7
  3. package/dist/jsoneditor.js +2 -2
  4. package/dist/jsoneditor.js.LICENSE.txt +15 -0
  5. package/dist/jsoneditor.js.map +1 -0
  6. package/dist/nonmin/jsoneditor.js +989 -127
  7. package/dist/nonmin/jsoneditor.js.map +1 -1
  8. package/docs/index.html +22 -10
  9. package/docs/meta_schema.json +3 -2
  10. package/docs/starrating.html +2 -6
  11. package/package.json +4 -2
  12. package/src/defaults.js +9 -1
  13. package/src/editor.js +17 -3
  14. package/src/editors/array.js +7 -4
  15. package/src/editors/multiselect.js +1 -0
  16. package/src/editors/object.css +3 -3
  17. package/src/editors/object.css.js +1 -1
  18. package/src/editors/object.js +5 -2
  19. package/src/editors/table.js +11 -4
  20. package/src/editors/upload.js +3 -2
  21. package/src/themes/barebones.js +3 -1
  22. package/src/themes/bootstrap5.css +97 -0
  23. package/src/themes/bootstrap5.css.js +3 -0
  24. package/src/themes/bootstrap5.js +623 -0
  25. package/src/themes/index.js +2 -0
  26. package/src/themes/tailwind.js +2 -2
  27. package/tests/codeceptjs/core_test.js +107 -17
  28. package/tests/codeceptjs/editors/array_test.js +6 -5
  29. package/tests/codeceptjs/editors/button_test.js +7 -6
  30. package/tests/codeceptjs/editors/checkbox_test.js +3 -2
  31. package/tests/codeceptjs/editors/integer_test.js +3 -2
  32. package/tests/codeceptjs/editors/issues/issue-gh-1158_test.js +10 -0
  33. package/tests/codeceptjs/editors/issues/issue-gh-1257_test.js +13 -0
  34. package/tests/codeceptjs/editors/number_test.js +2 -1
  35. package/tests/codeceptjs/editors/object_test.js +39 -38
  36. package/tests/codeceptjs/editors/option-no_default_values_test.js +1 -1
  37. package/tests/codeceptjs/editors/programmatic-changes_test.js +3 -2
  38. package/tests/codeceptjs/editors/tabs_test.js +5 -3
  39. package/tests/codeceptjs/editors/validation_test.js +3 -1
  40. package/tests/codeceptjs/meta-schema_test.js +72 -4
  41. package/tests/codeceptjs/schemaloader_test.js +2 -1
  42. package/tests/codeceptjs/test-config.js +3 -0
  43. package/tests/codeceptjs/themes_test.js +14 -0
  44. package/tests/pages/anyof-2.html +90 -0
  45. package/tests/pages/anyof.html +1 -1
  46. package/tests/pages/container-attributes.html +50 -0
  47. package/tests/pages/issues/issue-gh-1158.html +50 -0
  48. package/tests/pages/issues/issue-gh-1233-failing.html +46 -0
  49. package/tests/pages/issues/issue-gh-1233-passing.html +49 -0
  50. package/tests/pages/issues/issue-gh-1257.html +77 -0
  51. package/tests/pages/meta-schema.html +747 -0
  52. package/tests/pages/meta_schema.json +3 -16
  53. package/tests/pages/oneof-2.html +90 -0
  54. package/tests/pages/per-editor-options.html +44 -0
  55. package/tests/pages/stepper.html +2 -2
  56. package/tests/pages/themes.html +2 -0
  57. /package/tests/pages/{table-move-events.html → array-events-table.html} +0 -0
  58. /package/tests/pages/{array-move-events.html → array-events.html} +0 -0
@@ -625,20 +625,6 @@
625
625
  "tilte":"title"
626
626
  }
627
627
  },
628
- "enum": {
629
- "type": "array",
630
- "items": {
631
- "type": "object",
632
- "properties": {
633
- "title": {
634
- "type": "string"
635
- },
636
- "infoText":{
637
- "type": "string"
638
- }
639
- }
640
- }
641
- },
642
628
  "grid_columns":{
643
629
  "type":"integer",
644
630
  "default": 1,
@@ -655,9 +641,10 @@
655
641
  }
656
642
  }
657
643
  },
658
-
659
644
  "schema":{
660
- "$ref":"#/definitions/schemaBase",
645
+ "allOf":[{
646
+ "$ref":"#/definitions/schemaBase"
647
+ }],
661
648
  "options":{
662
649
  "keep_oneof_values":false
663
650
  },
@@ -0,0 +1,90 @@
1
+ <!DOCTYPE html>
2
+ <html lang="de">
3
+ <head>
4
+ <meta charset="utf-8"/>
5
+ <title>oneOf</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
+
12
+ <div class="container">
13
+ <label for="value">Value</label>
14
+ <textarea class="form-control" id="value" rows="12" style="font-size: 12px; font-family: monospace;"></textarea>
15
+ <button id="set-value">Set Value</button>
16
+ <div class='json-editor-container'></div>
17
+ </div>
18
+
19
+ <script>
20
+ var jsonEditorContainer = document.querySelector('.json-editor-container')
21
+ var value = document.querySelector('#value')
22
+ var setValue = document.querySelector('#set-value')
23
+ var schema = {
24
+ 'title': 'oneOf',
25
+ 'type': 'object',
26
+ 'properties': {
27
+ 'test': {
28
+ 'oneOf': [
29
+ {
30
+ 'type': 'string',
31
+ 'title': 'Value, string',
32
+ 'const': 'test'
33
+ },
34
+ {
35
+ 'type': 'boolean',
36
+ 'title': 'Value, boolean',
37
+ 'const': true
38
+ },
39
+ {
40
+ 'type': 'array',
41
+ 'title': 'Value, array',
42
+ 'const': [0]
43
+ },
44
+ {
45
+ 'type': 'object',
46
+ 'title': 'Value, object',
47
+ 'required': ['test'],
48
+ 'const': { 'test': 'test' }
49
+ },
50
+ {
51
+ 'type': 'number',
52
+ 'title': 'Value, number',
53
+ 'const': 1.1
54
+ },
55
+ {
56
+ 'type': 'integer',
57
+ 'title': 'Value, integer',
58
+ 'const': 1.1
59
+ },
60
+ {
61
+ 'type': 'null',
62
+ 'title': 'Value, null'
63
+ }
64
+ ]
65
+ }
66
+ }
67
+ }
68
+
69
+ var editor = new JSONEditor(jsonEditorContainer, {
70
+ schema: schema,
71
+ theme: 'bootstrap4',
72
+ show_errors: 'always',
73
+ iconlib: 'fontawesome5',
74
+ disable_collapse: true,
75
+ disable_edit_json: true,
76
+ disable_properties: true,
77
+ keep_oneof_values: false
78
+ })
79
+
80
+ editor.on('change', function () {
81
+ value.value = JSON.stringify(editor.getValue())
82
+ })
83
+
84
+ setValue.addEventListener('click', function () {
85
+ editor.setValue(JSON.parse(value.value))
86
+ })
87
+ </script>
88
+
89
+ </body>
90
+ </html>
@@ -0,0 +1,44 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8"/>
5
+ <title>Per Editor Options</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
+
12
+ <div class="container">
13
+ <h1>Test: Per Editor Options</h1>
14
+ <div class='json-editor-container'></div>
15
+ </div>
16
+
17
+ <script>
18
+ JSONEditor.defaults.editors.object.options.collapsed = true;
19
+
20
+ var jsonEditorContainer = document.querySelector('.json-editor-container');
21
+ var value = document.querySelector('.value');
22
+
23
+ var schema = {
24
+ "title": "Configuration",
25
+ "type": "object",
26
+ "properties": {
27
+ "test": {
28
+ "type": "boolean",
29
+ "title": "test"
30
+ }
31
+ }
32
+ }
33
+
34
+ var editor = new JSONEditor(jsonEditorContainer, {
35
+ schema: schema,
36
+ theme: 'bootstrap4',
37
+ disable_edit_json: true,
38
+ disable_properties: true,
39
+ array_controls_top: true,
40
+ iconlib: 'fontawesome5'
41
+ })
42
+ </script>
43
+ </body>
44
+ </html>
@@ -3,7 +3,7 @@
3
3
  <head>
4
4
  <meta charset="utf-8"/>
5
5
  <title>Stepper</title>
6
- <link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
6
+ <link rel="stylesheet" id="theme-link" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/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="https://cdn.jsdelivr.net/npm/mathjs@5.3.1/dist/math.min.js" class="external_mathjs"></script>
9
9
  <script src="../../dist/jsoneditor.js"></script>
@@ -38,7 +38,7 @@
38
38
 
39
39
  var editor = new JSONEditor(jsonEditorContainer, {
40
40
  schema: schema,
41
- theme: 'bootstrap4',
41
+ theme: 'bootstrap5',
42
42
  use_default_values: false,
43
43
  required_by_default: true,
44
44
  show_errors: 'always'
@@ -16,6 +16,7 @@
16
16
  <option value='bootstrap2'>Bootstrap 2</option>
17
17
  <option value='bootstrap3'>Bootstrap 3</option>
18
18
  <option value='bootstrap4'>Bootstrap 4</option>
19
+ <option value='bootstrap5'>Bootstrap 5</option>
19
20
  <option value='foundation3'>Foundation 3</option>
20
21
  <option value='foundation4'>Foundation 4</option>
21
22
  <option value='foundation5'>Foundation 5</option>
@@ -487,6 +488,7 @@
487
488
  bootstrap2: 'https://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.2/css/bootstrap-combined.min.css',
488
489
  bootstrap3: 'https://netdna.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css',
489
490
  bootstrap4: 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css',
491
+ bootstrap5: 'https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css',
490
492
  foundation3: 'https://cdnjs.cloudflare.com/ajax/libs/foundation/3.2.5/stylesheets/foundation.css',
491
493
  foundation4: 'https://cdnjs.cloudflare.com/ajax/libs/foundation/4.3.2/css/foundation.min.css',
492
494
  foundation5: 'https://cdnjs.cloudflare.com/ajax/libs/foundation/5.5.3/css/foundation.min.css',