@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
@@ -1,10 +1,11 @@
1
1
  var assert = require('assert');
2
+ const { DEFAULT_WAIT_TIME } = require('./test-config')
2
3
 
3
4
  Feature('schemaloader');
4
5
 
5
6
  Scenario('resolving nested external URNs', async (I) => {
6
7
  I.amOnPage('urn.html');
7
- I.waitForElement('[data-schemapath="root"] h3', 10);
8
+ I.waitForElement('[data-schemapath="root"] h3', DEFAULT_WAIT_TIME);
8
9
  I.seeElementInDOM('[data-schemapath="root.fname"]')
9
10
  I.seeElementInDOM('[data-schemapath="root.lname"]')
10
11
 
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ DEFAULT_WAIT_TIME: 10
3
+ }
@@ -138,6 +138,20 @@ Scenario('It should display button Labels: foundation3 | null', async (I) => {
138
138
  })
139
139
  */
140
140
 
141
+ Scenario('It should display button Labels: bootstrap5 | null', async (I) => {
142
+ I.amOnPage('themes.html')
143
+ I.selectOption('theme', 'Bootstrap 5')
144
+ I.waitForText('Themes Test Page')
145
+ I.waitForText('Collapse')
146
+ I.waitForText('Edit JSON')
147
+ I.waitForText('Object Properties')
148
+ I.waitForText('Delete item')
149
+ I.waitForText('Delete Last item')
150
+ I.waitForText('Delete All')
151
+ I.waitForText('Move down')
152
+ I.waitForText('Move up')
153
+ })
154
+
141
155
  Scenario('It should display button Labels: bootstrap4 | null', async (I) => {
142
156
  I.amOnPage('themes.html')
143
157
  I.selectOption('theme', 'Bootstrap 4')
@@ -0,0 +1,90 @@
1
+ <!DOCTYPE html>
2
+ <html lang="de">
3
+ <head>
4
+ <meta charset="utf-8"/>
5
+ <title>anyOf</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': 'anyOf',
25
+ 'type': 'object',
26
+ 'properties': {
27
+ 'test': {
28
+ 'anyOf': [
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>
@@ -2,7 +2,7 @@
2
2
  <html>
3
3
  <head>
4
4
  <meta charset="utf-8"/>
5
- <title>oneOf</title>
5
+ <title>anyOf</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,50 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8"/>
5
+ <script src="../../dist/jsoneditor.js"></script>
6
+ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
7
+ <title>container attributes</title>
8
+ </head>
9
+ <body>
10
+
11
+ <div class="container">
12
+ <div id='form-container'></div>
13
+ </div>
14
+
15
+ <script>
16
+ var formContainer = document.querySelector('#form-container')
17
+ var value = document.querySelector('#value')
18
+ var getValue = document.querySelector('#get-value')
19
+
20
+ var schema = {
21
+ "title": "Cotainer attributes",
22
+ "type": "object",
23
+ "properties": {
24
+ "some_property": {
25
+ "type": "string",
26
+ "title": "Test Editor",
27
+ "options": {
28
+ "containerAttributes": {
29
+ "class": "container-class",
30
+ "data-schematype": "blank",
31
+ "data-schemapath": "blank",
32
+ "data-schemaid": "blank"
33
+ }
34
+ }
35
+ }
36
+ }
37
+ }
38
+
39
+ var editor = new JSONEditor(formContainer, {
40
+ schema: schema,
41
+ theme: 'bootstrap4',
42
+ show_errors: 'always',
43
+ disable_properties: true,
44
+ disable_collapse: true,
45
+ disable_edit_json: true,
46
+ })
47
+ </script>
48
+
49
+ </body>
50
+ </html>
@@ -0,0 +1,50 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>GitHub Issue 1158</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 1158</a>
13
+ <div id='editor_holder'></div>
14
+ </div>
15
+
16
+ <script>
17
+ var defaultSchema = {
18
+ "title": "Person",
19
+ "type": "object",
20
+ "required": [],
21
+ "definitions": {
22
+ "schema": {
23
+ "type": "string",
24
+ "oneOf": [
25
+ {
26
+ "format": "url"
27
+ },
28
+ {
29
+ "format": "uuid"
30
+ }
31
+ ]
32
+ }
33
+ },
34
+ "properties": {
35
+ "name": {
36
+ "$ref": "#/definitions/schema"
37
+ }
38
+ }
39
+ }
40
+
41
+ var editor = new JSONEditor(document.getElementById('editor_holder'),{
42
+ iconlib: 'fontawesome5',
43
+ object_layout: 'normal',
44
+ schema: defaultSchema,
45
+ show_errors: 'always',
46
+ theme: 'bootstrap4'
47
+ });
48
+ </script>
49
+ </body>
50
+ </html>
@@ -0,0 +1,46 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>GitHub Issue 1233</title>
6
+ <script src="../../../dist/jsoneditor.js"></script>
7
+ </head>
8
+ <body>
9
+ <h1><a href="https://github.com/json-editor/json-editor/issues/1233">GitHub Issue 1233</a></h1>
10
+ <div id='editor_holder'></div>
11
+
12
+ <script>
13
+ var schema = {
14
+ "title": "Person",
15
+ "type": "object",
16
+ "required": [],
17
+ "definitions": {
18
+ "schema": {
19
+ "allOf": [
20
+ {
21
+ "type": "string"
22
+ }
23
+ ],
24
+ "oneOf": [
25
+ {
26
+ "format": "url"
27
+ },
28
+ {
29
+ "format": "uuid"
30
+ }
31
+ ]
32
+ }
33
+ },
34
+ "properties": {
35
+ "name": {
36
+ "$ref": "#/definitions/schema"
37
+ }
38
+ }
39
+ }
40
+
41
+ var editor = new JSONEditor(document.getElementById('editor_holder'),{
42
+ schema: schema
43
+ })
44
+ </script>
45
+ </body>
46
+ </html>
@@ -0,0 +1,49 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <title>GitHub Issue 1233</title>
6
+ <script src="../../../dist/jsoneditor.js"></script>
7
+ </head>
8
+ <body>
9
+ <h1><a href="https://github.com/json-editor/json-editor/issues/1233">GitHub Issue 1233</a></h1>
10
+ <div id='editor_holder'></div>
11
+
12
+ <script>
13
+ var schema = {
14
+ "title": "Person",
15
+ "type": "object",
16
+ "required": [],
17
+ "definitions": {
18
+ "schemaBase": {
19
+ "type": "string"
20
+ },
21
+ "schema": {
22
+ "allOf": [
23
+ {
24
+ "$ref": "#/definitions/schemaBase",
25
+ }
26
+ ],
27
+ "oneOf": [
28
+ {
29
+ "format": "url"
30
+ },
31
+ {
32
+ "format": "uuid"
33
+ }
34
+ ]
35
+ }
36
+ },
37
+ "properties": {
38
+ "name": {
39
+ "$ref": "#/definitions/schema"
40
+ }
41
+ }
42
+ }
43
+
44
+ var editor = new JSONEditor(document.getElementById('editor_holder'),{
45
+ schema: schema
46
+ })
47
+ </script>
48
+ </body>
49
+ </html>
@@ -0,0 +1,77 @@
1
+ <!DOCTYPE html>
2
+ <html lang="de">
3
+ <head>
4
+ <meta charset="utf-8"/>
5
+ <title>GitHub Issue 1257</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><a href="https://github.com/json-editor/json-editor/issues/1257">GitHub Issue 1257</a></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
+ <button id="set-value">Set Value</button>
17
+ <div class='json-editor-container'></div>
18
+ </div>
19
+
20
+ <script>
21
+ var jsonEditorContainer = document.querySelector('.json-editor-container')
22
+ var value = document.querySelector('#value')
23
+ var setValue = document.querySelector('#set-value')
24
+ var schema = {
25
+ "title": "default color array demo",
26
+ "type": "object",
27
+ "properties": {
28
+ "colors": {
29
+ "type": "array",
30
+ "format": "table",
31
+ "title": "colors",
32
+ "uniqueItems": true,
33
+ "items": {
34
+ "type": "object",
35
+ "properties": {
36
+ "text": {
37
+ "type": "string",
38
+ "default": "X"
39
+ },
40
+ "color": {
41
+ "type": "string",
42
+ "format": "color",
43
+ "default": "#fefaac"
44
+ }
45
+ }
46
+ }
47
+ },
48
+ "color": {
49
+ "type": "string",
50
+ "format": "color",
51
+ "default": "#fefaac"
52
+ }
53
+ }
54
+ }
55
+
56
+ var editor = new JSONEditor(jsonEditorContainer, {
57
+ schema: schema,
58
+ theme: 'bootstrap4',
59
+ show_errors: 'always',
60
+ iconlib: 'fontawesome5',
61
+ disable_collapse: true,
62
+ disable_edit_json: true,
63
+ disable_properties: true,
64
+ keep_oneof_values: false
65
+ })
66
+
67
+ editor.on('change', function () {
68
+ value.value = JSON.stringify(editor.getValue())
69
+ })
70
+
71
+ setValue.addEventListener('click', function () {
72
+ editor.setValue(JSON.parse(value.value))
73
+ })
74
+ </script>
75
+
76
+ </body>
77
+ </html>