@json-editor/json-editor 2.9.0 → 2.9.1

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 (60) hide show
  1. package/.github/workflows/build.yml +2 -0
  2. package/CHANGELOG.md +11 -7
  3. package/config/codeceptjs_helpers.js +4 -8
  4. package/config/karma.conf.js +0 -4
  5. package/config/webpack.common.js +1 -1
  6. package/config/webpack.dev.js +1 -1
  7. package/config/webpack.nonmin.js +1 -1
  8. package/config/webpack.prod.js +0 -1
  9. package/dist/dev/jsoneditor.js +3687 -0
  10. package/dist/jsoneditor.js +2 -14
  11. package/dist/jsoneditor.js.LICENSE.txt +1 -1
  12. package/dist/jsoneditor.js.map +1 -1
  13. package/dist/nonmin/jsoneditor.js +25354 -26381
  14. package/dist/nonmin/jsoneditor.js.map +1 -1
  15. package/docs/datetime.html +37 -2
  16. package/package.json +26 -24
  17. package/src/editors/integer.js +5 -3
  18. package/src/editors/multiple.js +3 -1
  19. package/src/editors/number.js +5 -3
  20. package/src/editors/radio.js +4 -6
  21. package/src/editors/select.js +0 -6
  22. package/tests/codeceptjs/core_test.js +20 -20
  23. package/tests/codeceptjs/editors/advanced_test.js +1 -1
  24. package/tests/codeceptjs/editors/array_any_of_test.js +2 -2
  25. package/tests/codeceptjs/editors/array_test.js +15 -15
  26. package/tests/codeceptjs/editors/autocomplete_test.js +3 -3
  27. package/tests/codeceptjs/editors/button_test.js +5 -5
  28. package/tests/codeceptjs/editors/checkbox_test.js +2 -2
  29. package/tests/codeceptjs/editors/colorpicker_test.js +2 -2
  30. package/tests/codeceptjs/editors/datetime_test.js +4 -4
  31. package/tests/codeceptjs/editors/inheritance_test.js +1 -1
  32. package/tests/codeceptjs/editors/integer_test.js +6 -6
  33. package/tests/codeceptjs/editors/issues/issue-gh-1133_test.js +11 -0
  34. package/tests/codeceptjs/editors/issues/issue-gh-1158_test.js +1 -1
  35. package/tests/codeceptjs/editors/issues/issue-gh-1164_test.js +12 -0
  36. package/tests/codeceptjs/editors/issues/issue-gh-1257_test.js +1 -1
  37. package/tests/codeceptjs/editors/issues/issue-gh-812_test.js +1 -1
  38. package/tests/codeceptjs/editors/jodit_test.js +2 -2
  39. package/tests/codeceptjs/editors/multiselect_test.js +1 -1
  40. package/tests/codeceptjs/editors/number_test.js +14 -12
  41. package/tests/codeceptjs/editors/object_test.js +13 -13
  42. package/tests/codeceptjs/editors/option-no_default_values_test.js +2 -2
  43. package/tests/codeceptjs/editors/programmatic-changes_test.js +2 -2
  44. package/tests/codeceptjs/editors/radio_test.js +1 -1
  45. package/tests/codeceptjs/editors/range_test.js +1 -1
  46. package/tests/codeceptjs/editors/rating_test.js +1 -1
  47. package/tests/codeceptjs/editors/select_test.js +2 -2
  48. package/tests/codeceptjs/editors/stepper_test.js +3 -3
  49. package/tests/codeceptjs/editors/string_test.js +8 -8
  50. package/tests/codeceptjs/editors/table-confirm-delete_test.js +4 -4
  51. package/tests/codeceptjs/editors/tabs_test.js +1 -1
  52. package/tests/codeceptjs/editors/uuid_test.js +5 -5
  53. package/tests/codeceptjs/editors/validation_test.js +1 -1
  54. package/tests/codeceptjs/meta-schema_test.js +4 -4
  55. package/tests/codeceptjs/schemaloader_test.js +1 -1
  56. package/tests/codeceptjs/themes_test.js +9 -9
  57. package/tests/pages/issues/issue-gh-1133.html +64 -0
  58. package/tests/pages/issues/issue-gh-1164.html +71 -0
  59. package/tests/pages/number.html +18 -0
  60. package/tests/unit/core.spec.js +6 -5
@@ -4,7 +4,7 @@ var assert = require('assert')
4
4
 
5
5
  Feature('meta-schema')
6
6
 
7
- Scenario('work with json-schema meta-schema @meta-schema-core', async (I) => {
7
+ Scenario('work with json-schema meta-schema @meta-schema-core', async ({ I }) => {
8
8
  I.amOnPage('meta-schema.html')
9
9
  I.waitForElement('.je-ready')
10
10
 
@@ -56,7 +56,7 @@ Scenario('work with json-schema meta-schema @meta-schema-core', async (I) => {
56
56
  })
57
57
 
58
58
  // https://github.com/json-editor/json-editor/issues/823
59
- Scenario('work with json-schema meta-schema @meta-schema', async (I) => {
59
+ Scenario('work with json-schema meta-schema @meta-schema', async ({ I }) => {
60
60
  I.amOnPage('issues/issue-gh-823-meta-schema.html')
61
61
  I.waitForElement('[data-schemapath="root"] h3', DEFAULT_WAIT_TIME)
62
62
  I.click('Object Properties')
@@ -71,14 +71,14 @@ Scenario('work with json-schema meta-schema @meta-schema', async (I) => {
71
71
  })
72
72
 
73
73
  // https://github.com/json-editor/json-editor/issues/1233
74
- Scenario('passing meta-schema example @meta-schema', async (I) => {
74
+ Scenario('passing meta-schema example @meta-schema', async ({ I }) => {
75
75
  I.amOnPage('issues/issue-gh-1233-passing.html')
76
76
  I.waitForElement('.je-ready', DEFAULT_WAIT_TIME)
77
77
  I.waitForElement('[name="root[name]"]', DEFAULT_WAIT_TIME)
78
78
  })
79
79
 
80
80
  // https://github.com/json-editor/json-editor/issues/1233
81
- Scenario('failing meta-schema example @meta-schema @optional', async (I) => {
81
+ Scenario('failing meta-schema example @meta-schema @optional', async ({ I }) => {
82
82
  I.amOnPage('issues/issue-gh-1233-failing.html')
83
83
  I.waitForElement('.je-ready', DEFAULT_WAIT_TIME)
84
84
  I.waitForElement('[name="root[name]"]', DEFAULT_WAIT_TIME)
@@ -3,7 +3,7 @@ const { DEFAULT_WAIT_TIME } = require('./test-config')
3
3
 
4
4
  Feature('schemaloader');
5
5
 
6
- Scenario('resolving nested external URNs', async (I) => {
6
+ Scenario('resolving nested external URNs', async ({ I }) => {
7
7
  I.amOnPage('urn.html');
8
8
  I.waitForElement('[data-schemapath="root"] h3', DEFAULT_WAIT_TIME);
9
9
  I.seeElementInDOM('[data-schemapath="root.fname"]')
@@ -4,7 +4,7 @@ Feature('themes')
4
4
 
5
5
  // nothing
6
6
 
7
- Scenario('It should display button Labels: null | null', async (I) => {
7
+ Scenario('It should display button Labels: null | null', async ({ I }) => {
8
8
  I.amOnPage('themes.html')
9
9
  I.waitForText('Themes Test Page')
10
10
  I.waitForText('Collapse')
@@ -19,7 +19,7 @@ Scenario('It should display button Labels: null | null', async (I) => {
19
19
 
20
20
  // only themes
21
21
 
22
- Scenario('It should display button Labels: barebones | null', async (I) => {
22
+ Scenario('It should display button Labels: barebones | null', async ({ I }) => {
23
23
  I.amOnPage('themes.html')
24
24
  I.waitForText('Themes Test Page')
25
25
  I.waitForText('Collapse')
@@ -32,7 +32,7 @@ Scenario('It should display button Labels: barebones | null', async (I) => {
32
32
  I.waitForText('Move up')
33
33
  })
34
34
 
35
- Scenario('It should display button Labels: spectre | null', async (I) => {
35
+ Scenario('It should display button Labels: spectre | null', async ({ I }) => {
36
36
  I.amOnPage('themes.html')
37
37
  I.selectOption('theme', 'Spectre')
38
38
  I.waitForText('Themes Test Page')
@@ -138,7 +138,7 @@ 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) => {
141
+ Scenario('It should display button Labels: bootstrap5 | null', async ({ I }) => {
142
142
  I.amOnPage('themes.html')
143
143
  I.selectOption('theme', 'Bootstrap 5')
144
144
  I.waitForText('Themes Test Page')
@@ -152,7 +152,7 @@ Scenario('It should display button Labels: bootstrap5 | null', async (I) => {
152
152
  I.waitForText('Move up')
153
153
  })
154
154
 
155
- Scenario('It should display button Labels: bootstrap4 | null', async (I) => {
155
+ Scenario('It should display button Labels: bootstrap4 | null', async ({ I }) => {
156
156
  I.amOnPage('themes.html')
157
157
  I.selectOption('theme', 'Bootstrap 4')
158
158
  I.waitForText('Themes Test Page')
@@ -166,7 +166,7 @@ Scenario('It should display button Labels: bootstrap4 | null', async (I) => {
166
166
  I.waitForText('Move up')
167
167
  })
168
168
 
169
- Scenario('It should display button Labels: bootstrap3 | null', async (I) => {
169
+ Scenario('It should display button Labels: bootstrap3 | null', async ({ I }) => {
170
170
  I.amOnPage('themes.html')
171
171
  I.selectOption('theme', 'Bootstrap 3')
172
172
  I.waitForText('Themes Test Page')
@@ -227,7 +227,7 @@ Scenario('It should display button Labels: bootstrap2 | null', async (I) => {
227
227
  I.seeElementInDOM('i.icon-list')
228
228
  })
229
229
  */
230
- Scenario('It should hide button Labels: null | bootstrap3', async (I) => {
230
+ Scenario('It should hide button Labels: null | bootstrap3', async ({ I }) => {
231
231
  I.amOnPage('themes.html')
232
232
  I.selectOption('iconlib', 'Bootstrap 3')
233
233
  I.waitForText('Themes Test Page')
@@ -469,7 +469,7 @@ Scenario('It should hide button Labels: null | openiconic', async (I) => {
469
469
  I.seeElementInDOM('i.oi-icon.oi-icon-list')
470
470
  })
471
471
  */
472
- Scenario('It should hide button Labels: null | spectre', async (I) => {
472
+ Scenario('It should hide button Labels: null | spectre', async ({ I }) => {
473
473
  I.amOnPage('themes.html')
474
474
  I.selectOption('iconlib', 'Spectre')
475
475
  I.waitForText('Themes Test Page')
@@ -501,7 +501,7 @@ Scenario('It should hide button Labels: null | spectre', async (I) => {
501
501
 
502
502
  // icons + themes
503
503
 
504
- Scenario('It should hide button Labels: spectre | spectre', async (I) => {
504
+ Scenario('It should hide button Labels: spectre | spectre', async ({ I }) => {
505
505
  I.amOnPage('themes.html')
506
506
  I.selectOption('theme', 'Spectre')
507
507
  I.selectOption('iconlib', 'Spectre')
@@ -0,0 +1,64 @@
1
+ <!DOCTYPE html>
2
+ <html lang="de">
3
+ <head>
4
+ <meta charset="utf-8"/>
5
+ <title>GitHub Issue 1133</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/1133">GitHub Issue 1133</a></h1>
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 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 schema = {
23
+ "title": "MCX JSON Input",
24
+ "type": "object",
25
+ "required": [
26
+ "SaveDataMask"
27
+ ],
28
+ "format": "categories",
29
+ "properties": {
30
+ "SaveDataMask": {
31
+ "oneOf": [
32
+ {
33
+ "title": "Save detected photon flags",
34
+ "type": "string",
35
+ "default": "DP"
36
+ },
37
+ {
38
+ "title": "Save detected photon flags",
39
+ "type": "integer",
40
+ "default": 5,
41
+ "minimum": 0
42
+ }
43
+ ]
44
+ }
45
+ }
46
+ }
47
+
48
+ var editor = new JSONEditor(jsonEditorContainer, {
49
+ schema: schema,
50
+ theme: 'bootstrap4',
51
+ show_errors: 'always',
52
+ iconlib: 'fontawesome5',
53
+ disable_collapse: true,
54
+ disable_edit_json: true,
55
+ disable_properties: true
56
+ })
57
+
58
+ editor.on('change', function () {
59
+ value.value = JSON.stringify(editor.getValue())
60
+ })
61
+ </script>
62
+
63
+ </body>
64
+ </html>
@@ -0,0 +1,71 @@
1
+ <!DOCTYPE html>
2
+ <html lang="de">
3
+ <head>
4
+ <meta charset="utf-8"/>
5
+ <title>GitHub Issue 1164</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/1164">GitHub Issue 1164</a></h1>
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 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 schema = {
23
+ 'type': 'object',
24
+ 'properties': {
25
+ 'arrayEnumSelect': {
26
+ 'title': 'Array enum select',
27
+ 'type': 'array',
28
+ 'minItems': 1,
29
+ 'items': {
30
+ 'type': 'string',
31
+ 'enum': ['one', 'two', 'three']
32
+ }
33
+ },
34
+ 'stringEnumRadio': {
35
+ 'title': 'String enum radio',
36
+ 'type': 'string',
37
+ 'format': 'radio',
38
+ 'enum': ['one', 'two', 'three']
39
+ },
40
+ 'numberEnumRadio': {
41
+ 'title': 'Number enum radio',
42
+ 'type': 'number',
43
+ 'format': 'radio',
44
+ 'enum': [1.1, 2.2, 3.3]
45
+ },
46
+ 'integerEnumRadio': {
47
+ 'title': 'Integer enum radio',
48
+ 'type': 'integer',
49
+ 'format': 'radio',
50
+ 'enum': [1, 2, 3]
51
+ }
52
+ }
53
+ }
54
+
55
+ var editor = new JSONEditor(jsonEditorContainer, {
56
+ schema: schema,
57
+ theme: 'bootstrap4',
58
+ show_errors: 'always',
59
+ iconlib: 'fontawesome5',
60
+ disable_collapse: true,
61
+ disable_edit_json: true,
62
+ disable_properties: true
63
+ })
64
+
65
+ editor.on('change', function () {
66
+ value.value = JSON.stringify(editor.getValue())
67
+ })
68
+ </script>
69
+
70
+ </body>
71
+ </html>
@@ -63,6 +63,24 @@
63
63
  "minimum": 1,
64
64
  "maximum": 10,
65
65
  "step": 0.25
66
+ },
67
+ "stepper_number_default": {
68
+ "title": "stepper number",
69
+ "format": "stepper",
70
+ "type": "number",
71
+ "minimum": 1,
72
+ "maximum": 10,
73
+ "step": 0.25,
74
+ "default": 5
75
+ },
76
+ "stepper_integer_default": {
77
+ "title": "stepper integer",
78
+ "format": "stepper",
79
+ "type": "integer",
80
+ "minimum": 1,
81
+ "maximum": 10,
82
+ "step": 1,
83
+ "default": 5
66
84
  }
67
85
  }
68
86
  };
@@ -217,7 +217,7 @@ describe('JSONEditor', function () {
217
217
  editor.promise.then(() => {
218
218
  expect(editor.getValue()).toEqual({
219
219
  boolean: undefined,
220
- enum: undefined,
220
+ enum: 'foo',
221
221
  integer: undefined,
222
222
  number: undefined,
223
223
  string: undefined,
@@ -235,7 +235,7 @@ describe('JSONEditor', function () {
235
235
  editor.promise.then(() => {
236
236
  expect(editor.getValue()).toEqual({
237
237
  boolean: undefined,
238
- enum: undefined,
238
+ enum: 'foo',
239
239
  integer: undefined,
240
240
  number: undefined,
241
241
  string: undefined,
@@ -249,7 +249,7 @@ describe('JSONEditor', function () {
249
249
 
250
250
  expect(editor.getValue()).toEqual({
251
251
  boolean: undefined,
252
- enum: undefined,
252
+ enum: 'foo',
253
253
  integer: 3,
254
254
  number: 4,
255
255
  string: 'foo',
@@ -263,7 +263,7 @@ describe('JSONEditor', function () {
263
263
 
264
264
  expect(editor.getValue()).toEqual({
265
265
  boolean: undefined,
266
- enum: undefined,
266
+ enum: 'foo',
267
267
  integer: undefined,
268
268
  number: undefined,
269
269
  string: '',
@@ -290,7 +290,8 @@ describe('JSONEditor', function () {
290
290
  editor.promise.then(() => {
291
291
  expect(editor.getValue()).toEqual({
292
292
  string_with_default: 'foobar',
293
- enum_with_default: 'foobar'
293
+ enum_with_default: 'foobar',
294
+ enum_without_default: 'foobar'
294
295
  })
295
296
  })
296
297
  })