@json-editor/json-editor 2.9.0 → 2.10.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 (106) hide show
  1. package/.github/workflows/build.yml +2 -0
  2. package/CHANGELOG.md +29 -7
  3. package/README.md +47 -1
  4. package/config/codeceptjs_helpers.js +4 -8
  5. package/config/karma.conf.js +0 -4
  6. package/config/webpack.common.js +1 -1
  7. package/config/webpack.dev.js +1 -1
  8. package/config/webpack.nonmin.js +1 -1
  9. package/config/webpack.prod.js +0 -1
  10. package/dist/dev/jsoneditor.js +3687 -0
  11. package/dist/jsoneditor.js +2 -14
  12. package/dist/jsoneditor.js.LICENSE.txt +1 -1
  13. package/dist/jsoneditor.js.map +1 -1
  14. package/dist/nonmin/jsoneditor.js +25744 -26450
  15. package/dist/nonmin/jsoneditor.js.map +1 -1
  16. package/docs/css_integration.html +17 -15
  17. package/docs/custom-editor.html +92 -0
  18. package/docs/datetime.html +37 -2
  19. package/docs/index.html +4 -1
  20. package/docs/meta_schema.json +426 -398
  21. package/package.json +26 -24
  22. package/src/defaults.js +15 -1
  23. package/src/editor.js +23 -6
  24. package/src/editors/integer.js +5 -3
  25. package/src/editors/multiple.js +67 -8
  26. package/src/editors/number.js +5 -3
  27. package/src/editors/object.js +0 -1
  28. package/src/editors/radio.js +4 -6
  29. package/src/editors/select.js +0 -6
  30. package/src/iconlibs/bootstrap.js +28 -0
  31. package/src/iconlibs/index.js +2 -0
  32. package/src/resolvers.js +5 -2
  33. package/src/schemaloader.js +3 -1
  34. package/src/themes/bootstrap3.js +1 -1
  35. package/src/utilities.js +22 -0
  36. package/src/validator.js +93 -0
  37. package/tests/codeceptjs/constrains/contains_test.js +36 -0
  38. package/tests/codeceptjs/constrains/dependentSchemas_test.js +15 -0
  39. package/tests/codeceptjs/constrains/if-then-else_test.js +143 -0
  40. package/tests/codeceptjs/core_test.js +46 -46
  41. package/tests/codeceptjs/editors/advanced_test.js +12 -11
  42. package/tests/codeceptjs/editors/array_any_of_test.js +37 -37
  43. package/tests/codeceptjs/editors/array_test.js +784 -794
  44. package/tests/codeceptjs/editors/autocomplete_test.js +4 -6
  45. package/tests/codeceptjs/editors/button_test.js +30 -29
  46. package/tests/codeceptjs/editors/checkbox_test.js +19 -18
  47. package/tests/codeceptjs/editors/colorpicker_test.js +20 -18
  48. package/tests/codeceptjs/editors/datetime_test.js +11 -11
  49. package/tests/codeceptjs/editors/inheritance_test.js +8 -9
  50. package/tests/codeceptjs/editors/integer_test.js +77 -78
  51. package/tests/codeceptjs/editors/jodit_test.js +18 -19
  52. package/tests/codeceptjs/editors/multiselect_test.js +6 -6
  53. package/tests/codeceptjs/editors/number_test.js +72 -71
  54. package/tests/codeceptjs/editors/object_test.js +52 -26
  55. package/tests/codeceptjs/editors/option-no_default_values_test.js +6 -6
  56. package/tests/codeceptjs/editors/programmatic-changes_test.js +4 -5
  57. package/tests/codeceptjs/editors/radio_test.js +1 -1
  58. package/tests/codeceptjs/editors/range_test.js +2 -4
  59. package/tests/codeceptjs/editors/rating_test.js +1 -1
  60. package/tests/codeceptjs/editors/select_test.js +5 -7
  61. package/tests/codeceptjs/editors/stepper_test.js +8 -10
  62. package/tests/codeceptjs/editors/string_test.js +16 -16
  63. package/tests/codeceptjs/editors/table-confirm-delete_test.js +11 -13
  64. package/tests/codeceptjs/editors/tabs_test.js +1 -1
  65. package/tests/codeceptjs/editors/uuid_test.js +15 -15
  66. package/tests/codeceptjs/editors/validation_test.js +2 -2
  67. package/tests/codeceptjs/issues/issue-gh-1133_test.js +9 -0
  68. package/tests/codeceptjs/issues/issue-gh-1158-2_test.js +10 -0
  69. package/tests/codeceptjs/{editors/issues → issues}/issue-gh-1158_test.js +1 -3
  70. package/tests/codeceptjs/issues/issue-gh-1164_test.js +10 -0
  71. package/tests/codeceptjs/issues/issue-gh-1211_test.js +17 -0
  72. package/tests/codeceptjs/{editors/issues → issues}/issue-gh-1257_test.js +3 -5
  73. package/tests/codeceptjs/issues/issue-gh-1338_test.js +16 -0
  74. package/tests/codeceptjs/issues/issue-gh-1347_test.js +8 -0
  75. package/tests/codeceptjs/issues/issue-gh-795_test.js +13 -0
  76. package/tests/codeceptjs/issues/issue-gh-810_test.js +52 -0
  77. package/tests/codeceptjs/issues/issue-gh-812_test.js +25 -0
  78. package/tests/codeceptjs/meta-schema_test.js +12 -12
  79. package/tests/codeceptjs/schemaloader_test.js +8 -8
  80. package/tests/codeceptjs/themes_test.js +40 -9
  81. package/tests/pages/autocomplete.html +1 -0
  82. package/tests/pages/contains.html +38 -0
  83. package/tests/pages/dependentSchemas.html +52 -0
  84. package/tests/pages/if-else.html +57 -0
  85. package/tests/pages/if-then-else-allOf.html +117 -0
  86. package/tests/pages/if-then-else.html +64 -0
  87. package/tests/pages/if-then.html +57 -0
  88. package/tests/pages/issues/issue-gh-1133.html +64 -0
  89. package/tests/pages/issues/issue-gh-1158-2.html +189 -0
  90. package/tests/pages/issues/issue-gh-1164.html +71 -0
  91. package/tests/pages/issues/issue-gh-1165.html +63 -0
  92. package/tests/pages/issues/issue-gh-1165.json +8 -0
  93. package/tests/pages/issues/issue-gh-1211.html +1022 -0
  94. package/tests/pages/issues/issue-gh-1338.html +74 -0
  95. package/tests/pages/issues/issue-gh-1347.html +142 -0
  96. package/tests/pages/issues/issue-gh-795.html +58 -0
  97. package/tests/pages/issues/issue-gh-810.html +149 -0
  98. package/tests/pages/maxContains.html +39 -0
  99. package/tests/pages/meta-schema.html +28 -0
  100. package/tests/pages/meta_schema.json +426 -398
  101. package/tests/pages/minContains.html +39 -0
  102. package/tests/pages/number.html +18 -0
  103. package/tests/pages/option-dependencies.html +106 -0
  104. package/tests/pages/themes.html +3 -1
  105. package/tests/unit/core.spec.js +8 -10
  106. package/tests/codeceptjs/editors/issues/issue-gh-812_test.js +0 -32
@@ -9,6 +9,8 @@ jobs:
9
9
  runs-on: ubuntu-latest
10
10
  steps:
11
11
  - uses: actions/checkout@v1
12
+ - name: Node version
13
+ run: node -v
12
14
  - name: Install
13
15
  run: npm install
14
16
  - name: Test
package/CHANGELOG.md CHANGED
@@ -1,14 +1,36 @@
1
1
  ### Unreleased
2
2
 
3
+ ### 2.10.0
4
+
5
+ - Fixed schema loader bug and added test for relative issues
6
+ - Using multiple for schemas with if-then-else
7
+ - Added support for shell script highlighting
8
+ - Added support for contains, minContains and maxContains constrains
9
+ - Added support for if-then-else constrains
10
+ - Added support for dependentSchemas constrains
11
+ - Added support for absolute paths in dependencies
12
+ - Added support for bootstrap icons
13
+ - Added custom editor example page
14
+ - Added bootstrap 5 theme option in example page
15
+ - Fixed property checkboxes display
16
+ - Updated array delete message
17
+ - Refactored tests with codeceptjs native waitForValue()
18
+ - Fixed bootstrap 3 import warnings
19
+ - Updated autocomplete example with library css
20
+
21
+ ### 2.9.1
22
+
23
+ - Fixed past merge
24
+
3
25
  ### 2.9.0
4
26
 
5
- Updated datetime example page
6
- Updated packages
7
- Fixed issue #1133: default values for each of the oneOf options
8
- Upgraded codeceptjs from 2 to 3
9
- Fixed npm audit issues
10
- Fixed unnecessary Null values included in enums
11
- Fixed radio editors not recognising numerical values
27
+ - Updated datetime example page
28
+ - Updated packages
29
+ - Fixed issue #1133: default values for each of the oneOf options
30
+ - Upgraded codeceptjs from 2 to 3
31
+ - Fixed npm audit issues
32
+ - Fixed unnecessary Null values included in enums
33
+ - Fixed radio editors not recognising numerical values
12
34
 
13
35
  ### 2.9.0-beta.1
14
36
 
package/README.md CHANGED
@@ -462,6 +462,7 @@ The currently supported themes are:
462
462
 
463
463
  * barebones
464
464
  * html (the default)
465
+ * bootstrap3
465
466
  * bootstrap4
466
467
  * bootstrap5
467
468
  * spectre
@@ -471,7 +472,6 @@ Note: The following themes have NOT been updated to 2.x format and will be remov
471
472
  Old 1.x themes displays the message **"This is an old JSON-Editor 1.x Theme and might not display elements correctly when used with the 2.x version"** at the bottom of the form output.
472
473
 
473
474
  * bootstrap2
474
- * bootstrap3
475
475
  * foundation3
476
476
  * foundation4
477
477
  * foundation5
@@ -509,6 +509,7 @@ The supported icon libs are:
509
509
  * fontawesome5
510
510
  * openiconic
511
511
  * spectre
512
+ * bootstrap
512
513
 
513
514
  By default, no icons are used. Just like the CSS theme, you can set the icon lib globally or when initializing:
514
515
 
@@ -1247,6 +1248,51 @@ Here's an example schema:
1247
1248
  }
1248
1249
  ```
1249
1250
 
1251
+ Keys can also be an absolute path like `root.property.nested_property`
1252
+
1253
+ ```json
1254
+ {
1255
+ "title": "Person",
1256
+ "type": "object",
1257
+ "required": [
1258
+ "gender"
1259
+ ],
1260
+ "properties": {
1261
+ "gender": {
1262
+ "title": "Gender",
1263
+ "type": "string",
1264
+ "enum": [
1265
+ "female",
1266
+ "male"
1267
+ ]
1268
+ },
1269
+ "age": {
1270
+ "type": "object",
1271
+ "properties": {
1272
+ "maleSpecificAge": {
1273
+ "type": "string",
1274
+ "title": "Male specific age question?",
1275
+ "options": {
1276
+ "dependencies": {
1277
+ "root.gender": "male"
1278
+ }
1279
+ }
1280
+ },
1281
+ "femaleSpecificAge": {
1282
+ "type": "string",
1283
+ "title": "Female specific age question?",
1284
+ "options": {
1285
+ "dependencies": {
1286
+ "root.gender": "female"
1287
+ }
1288
+ }
1289
+ }
1290
+ }
1291
+ }
1292
+ }
1293
+ }
1294
+ ```
1295
+
1250
1296
  The `dependencies` keyword from the JSON Schema specification is not nearly flexible enough to handle most use cases,
1251
1297
  so JSON Editor introduces a couple custom keywords that help in this regard.
1252
1298
 
@@ -69,32 +69,28 @@ class customHelpers extends Helper {
69
69
  // Evaluates true if xpath is checked
70
70
  async seeCheckedAttribute (xpath) {
71
71
  const helper = this.helpers['Puppeteer'] || this.helpers['WebDriver']
72
- let res = await helper.grabAttributeFrom(xpath, 'checked')
73
- return assert.ok(res !== null && typeof res !== 'undefined' && res.toString().toLowerCase() === 'true', "\x1b[31mexpected element '\x1b[91m" + xpath + "\x1b[31m' to be checked")
72
+ return await helper.waitForElement(xpath + ':checked')
74
73
  }
75
74
 
76
75
  // Custom dontSeeCheckedAttribute function.
77
76
  // Evaluates true if xpath is not checked
78
77
  async dontSeeCheckedAttribute (xpath) {
79
78
  const helper = this.helpers['Puppeteer'] || this.helpers['WebDriver']
80
- let res = await helper.grabAttributeFrom(xpath, 'checked')
81
- return assert.ok(!(res !== null && typeof res !== 'undefined' && res.toString().toLowerCase() === 'true'), "\x1b[31mexpected element '\x1b[91m" + xpath + "\x1b[31m' NOT to be checked")
79
+ return await helper.waitForInvisible(xpath + ':checked')
82
80
  }
83
81
 
84
82
  // Custom seeDisabledAttribute function.
85
83
  // Evaluates true if xpath is disabled
86
84
  async seeDisabledAttribute (xpath) {
87
85
  const helper = this.helpers['Puppeteer'] || this.helpers['WebDriver']
88
- let res = await helper.grabAttributeFrom(xpath, 'disabled')
89
- return assert.ok(res !== null && typeof res !== 'undefined' && res.toString().toLowerCase() === 'true', "\x1b[31mexpected element '\x1b[91m" + xpath + "\x1b[31m' to be disabled")
86
+ return await helper.waitForElement(xpath + ':disabled')
90
87
  }
91
88
 
92
89
  // Custom dontSeeDisabledAttributet function.
93
90
  // Evaluates true if xpath is not disabled
94
91
  async dontSeeDisabledAttribute (xpath) {
95
92
  const helper = this.helpers['Puppeteer'] || this.helpers['WebDriver']
96
- let res = await helper.grabAttributeFrom(xpath, 'disabled')
97
- return assert.ok(!(res !== null && typeof res !== 'undefined' && res.toString().toLowerCase() === 'true'), "\x1b[31mexpected element '\x1b[91m" + xpath + "\x1b[31m' NOT to be disabled")
93
+ return await helper.waitForInvisible(xpath + ':disabled')
98
94
  }
99
95
 
100
96
  // Custom seeReadOnlyAttribute function.
@@ -44,10 +44,6 @@ module.exports = function (config) {
44
44
  stats: 'errors-only'
45
45
  },
46
46
 
47
- beforeMiddleware: [
48
- 'webpackBlocker'
49
- ],
50
-
51
47
  // test results reporter to use
52
48
  // possible values: 'dots', 'progress'
53
49
  // available reporters: https://npmjs.org/browse/keyword/karma-reporter
@@ -68,7 +68,7 @@ module.exports = {
68
68
  hints: false
69
69
  },
70
70
  devServer: {
71
- contentBase: helpers.root('.'),
71
+ static: helpers.root('.'),
72
72
  historyApiFallback: true,
73
73
  port: 8080
74
74
  }
@@ -5,7 +5,7 @@ const helpers = require('./helpers')
5
5
 
6
6
  module.exports = webpackMerge(commonConfig, {
7
7
  mode: 'development',
8
- devtool: 'cheap-module-eval-source-map',
8
+ devtool: 'eval-cheap-module-source-map',
9
9
  output: {
10
10
  path: helpers.root('dist/dev'),
11
11
  publicPath: '/dist/',
@@ -6,7 +6,7 @@ const helpers = require('./helpers')
6
6
  // See https://webpack.js.org/guides/development/
7
7
  module.exports = (env) => webpackMerge(commonConfig, {
8
8
  mode: 'development',
9
- devtool: '@source-map',
9
+ devtool: 'source-map',
10
10
  output: {
11
11
  path: env && env.travis === true ? helpers.root('dist') : helpers.root('dist/nonmin'),
12
12
  publicPath: '/dist/',
@@ -17,7 +17,6 @@ module.exports = () => {
17
17
  minimize: true
18
18
  },
19
19
  plugins: [
20
- new RemoveStrictPlugin(), // I have put this in to avoid IE throwing error Assignment to read-only properties is not allowed in strict mode
21
20
  // This doesn't seem to actually be minimising the CSS!
22
21
  new webpack.NoEmitOnErrorsPlugin()
23
22
  ]