@json-editor/json-editor 2.14.1 → 2.15.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 (73) hide show
  1. package/.env +4 -0
  2. package/.eslintrc +4 -1
  3. package/.github/workflows/build.yml +5 -4
  4. package/CHANGELOG.md +21 -0
  5. package/README.md +32 -1
  6. package/config/webpack.common.js +2 -6
  7. package/dist/jsoneditor.js +1 -1
  8. package/dist/jsoneditor.js.LICENSE.txt +1 -1
  9. package/dist/nonmin/jsoneditor.js +4121 -3939
  10. package/dist/nonmin/jsoneditor.js.map +1 -1
  11. package/docs/meta-schema.html +793 -0
  12. package/package.json +13 -13
  13. package/src/core.js +5 -1
  14. package/src/defaults.js +9 -2
  15. package/src/editor.js +33 -14
  16. package/src/editors/array.js +3 -6
  17. package/src/editors/base64.js +3 -0
  18. package/src/editors/describedby.js +2 -2
  19. package/src/editors/enum.js +9 -1
  20. package/src/editors/info.js +8 -0
  21. package/src/editors/multiple.js +9 -2
  22. package/src/editors/object.js +26 -7
  23. package/src/editors/radio.js +5 -2
  24. package/src/editors/select.js +19 -8
  25. package/src/editors/select2.js +1 -1
  26. package/src/editors/starrating.js +5 -4
  27. package/src/editors/string.js +16 -2
  28. package/src/editors/table.js +2 -2
  29. package/src/iconlib.js +0 -1
  30. package/src/schemaloader.js +2 -2
  31. package/src/style.css +4 -0
  32. package/src/style.css.js +1 -1
  33. package/src/templates/default.js +2 -2
  34. package/src/theme.js +13 -3
  35. package/src/themes/index.js +0 -1
  36. package/src/validator.js +4 -4
  37. package/tests/Dockerfile +1 -1
  38. package/tests/codeceptjs/core_test.js +8 -2
  39. package/tests/codeceptjs/editors/array_test.js +11 -6
  40. package/tests/codeceptjs/editors/autocomplete_test.js +0 -1
  41. package/tests/codeceptjs/editors/integer_test.js +0 -4
  42. package/tests/codeceptjs/editors/object_test.js +8 -0
  43. package/tests/codeceptjs/editors/rating_test.js +1 -1
  44. package/tests/codeceptjs/editors/select_test.js +18 -0
  45. package/tests/codeceptjs/editors/starrating_test.js +15 -0
  46. package/tests/codeceptjs/editors/string_test.js +7 -0
  47. package/tests/codeceptjs/issues/issue-gh-1158_test.js +1 -1
  48. package/tests/codeceptjs/issues/issue-gh-1164_test.js +0 -1
  49. package/tests/codeceptjs/issues/issue-gh-1383_test.js +1 -1
  50. package/tests/codeceptjs/issues/issue-gh-1452_test.js +10 -0
  51. package/tests/codeceptjs/issues/issue-gh-1525_test.js +9 -0
  52. package/tests/codeceptjs/issues/issue-gh-1536_test.js +12 -0
  53. package/tests/codeceptjs/issues/issue-gh-1538_test.js +10 -0
  54. package/tests/codeceptjs/issues/issue-gh-1541_test.js +8 -0
  55. package/tests/docker-compose-local.yml +1 -2
  56. package/tests/docker-compose.yml +0 -1
  57. package/tests/pages/array-events-table.html +39 -31
  58. package/tests/pages/array-events.html +39 -31
  59. package/tests/pages/assets/autocomplete.css +1 -0
  60. package/tests/pages/assets/autocomplete.min.js +1 -0
  61. package/tests/pages/autocomplete.html +4 -4
  62. package/tests/pages/enforce-const.html +176 -0
  63. package/tests/pages/issues/issue-gh-1452.html +98 -0
  64. package/tests/pages/issues/issue-gh-1525.html +62 -0
  65. package/tests/pages/issues/issue-gh-1536.html +55 -0
  66. package/tests/pages/issues/issue-gh-1538.html +56 -0
  67. package/tests/pages/issues/issue-gh-1541.html +51 -0
  68. package/tests/pages/issues/issue-gh-1541.json +9 -0
  69. package/tests/pages/placeholder-options.html +57 -0
  70. package/tests/pages/prompt-paste-max-length-reached.html +51 -0
  71. package/tests/pages/remove-false-properties.html +85 -0
  72. package/tests/pages/starrating.html +86 -0
  73. package/tests/unit/editor.spec.js +1 -1
package/.env CHANGED
@@ -1,2 +1,6 @@
1
1
  COMPOSE_PROJECT_NAME=json-editor
2
2
  COMPOSE_FILE=./tests/docker-compose.yml:./tests/docker-compose-local.yml
3
+
4
+
5
+ #image: seleniarm/standalone-chromium:114.0
6
+ #platform: linux/x86_64
package/.eslintrc CHANGED
@@ -2,6 +2,9 @@
2
2
  "extends":["standard"],
3
3
  "env": {"browser": true},
4
4
  "rules": {
5
- "no-console": "error"
5
+ "no-console": "error",
6
+ "camelcase": 0,
7
+ "array-callback-return": 0,
8
+ "no-empty": 0
6
9
  }
7
10
  }
@@ -53,17 +53,18 @@ jobs:
53
53
  run: docker-compose run -T --rm node npm run ${BUILD_ENV}
54
54
  - name: Test
55
55
  run: |
56
- docker-compose exec -T node codeceptjs -c /repo/tests/codeceptjs/codecept.json run-multiple basic:${SELENIUM_BROWSER} --invert --grep '@optional'
56
+ docker-compose exec -T node codeceptjs run-multiple -c /repo/tests/codeceptjs/codecept.json basic:${SELENIUM_BROWSER} --invert --grep '@optional'
57
57
  pwd
58
58
  ls -la codeceptjs/output
59
59
  - name: Test Artifacts
60
60
  if: always()
61
- uses: actions/upload-artifact@v3
61
+ uses: actions/upload-artifact@v4
62
62
  with:
63
- name: codeceptjs-output
63
+ name: codeceptjs-output-${{ matrix.selenium-browser }}-${{ matrix.build-env }}
64
64
  path: tests/codeceptjs/output
65
65
  retention-days: 30
66
+ merge-multiple: true
66
67
  - name: Test (optional)
67
68
  continue-on-error: true
68
- run: docker-compose exec -T node codeceptjs -c /repo/tests/codeceptjs/codecept.json run-multiple basic:${SELENIUM_BROWSER} --grep '@optional'
69
+ run: docker-compose exec -T node codeceptjs run-multiple -c /repo/tests/codeceptjs/codecept.json basic:${SELENIUM_BROWSER} --grep '@optional'
69
70
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  ### Unreleased
2
2
 
3
+ ### 2.15.0
4
+
5
+ - Added option enforce_const
6
+ - Fixed #1525 select2 setValue append new item
7
+ - Added remove_false_properties object option
8
+ - Updated GitHub workflows
9
+ - Added prompt_paste_max_length_reached option
10
+ - Fixed #1512 "dependencies" autocomplete inside array tables cropping
11
+ - Allow for Base64 custom input attributes
12
+ - Added 'add' and 'switch' events
13
+ - Fixed "dependencies" issues
14
+ - Fixed npm audits and packages upgrades
15
+ - Fixed issue #1541 Failure to parse schema with "default"
16
+ - Fixed rating "undefined" value when type of integer
17
+ - Added meta-schema example to the readme
18
+ - Fixed issue #1514 Cannot use more than one class in "class" option for links
19
+ - Fixed info disable/enable
20
+ - Added options: "has_placeholder_option" and "placeholder_option_text"
21
+ - Fixed issue #1498 Dependant fields not created after JSON update at change of the controlling field
22
+ - Added 'copyRow' event
23
+
3
24
  ### 2.14.1
4
25
 
5
26
  - Fixed issue #1272 Multiple editor incorrect dependency inheritance
package/README.md CHANGED
@@ -85,6 +85,7 @@ If you learn best by example, check these out:
85
85
  * Star Rating Editor Example - https://json-editor.github.io/json-editor/starrating.html
86
86
  * Upload Editor Example - https://json-editor.github.io/json-editor/upload.html
87
87
  * WYSIWYG Editor Example - https://json-editor.github.io/json-editor/wysiwyg.html
88
+ * Meta schema (schema builder) Example - https://json-editor.github.io/json-editor/meta-schema.html
88
89
 
89
90
  More examples can be found at the [JSON-Editor Interactive Playground](https://pmk65.github.io/jedemov2/dist/demo.html)
90
91
 
@@ -325,6 +326,16 @@ Here are all the available options:
325
326
  <td>This property controls whether property searches in an object editor are case-sensitive</td>
326
327
  <td><code>true</code></td>
327
328
  </tr>
329
+ <tr>
330
+ <td>prompt_paste_max_length_reached</td>
331
+ <td>If <code>true</code>, an alert will be displayed when pasting a value in an input that exceeded maxLength</td>
332
+ <td><code>false</code></td>
333
+ </tr>
334
+ <tr>
335
+ <td>enforce_const</td>
336
+ <td>When set to <code>true</code>, the schema <code>const</code> will serve as the default value, and the editor will prevent any changes to it.</td>
337
+ <td><code>false</code></td>
338
+ </tr>
328
339
  </tbody>
329
340
  </table>
330
341
 
@@ -434,6 +445,23 @@ for (let key in editor.editors) {
434
445
  }
435
446
  ```
436
447
 
448
+ There are also `add` and `switch` events to track changes.
449
+ The `add` event fires when a new object property has just been added.
450
+
451
+ ```javascript
452
+ editor.on('add',(property) => {
453
+ // Do something
454
+ });
455
+ ```
456
+
457
+ The `switch` event fires when the type of one of the object's properties is changed by a type switch on the form.
458
+
459
+ ```javascript
460
+ editor.on('switch',(property) => {
461
+ // Do something
462
+ });
463
+ ```
464
+
437
465
  ### Enable and Disable the Editor
438
466
 
439
467
  This lets you disable editing for the entire form or part of the form.
@@ -1214,7 +1242,10 @@ Editors can accept options which alter the behavior in some way.
1214
1242
  * `hidden` - If set to true, the editor will not appear in the UI (works for all types)
1215
1243
  * `input_height` - Explicitly set the height of the input element. Should be a valid CSS width string (e.g. "100px"). Works best with textareas.
1216
1244
  * `input_width` - Explicitly set the width of the input element. Should be a valid CSS width string (e.g. "100px"). Works for string, number, and integer data types.
1217
- * `remove_empty_properties` - If set to true for an object, empty object properties (i.e. those with falsy values) will not be returned by getValue().
1245
+ * `remove_empty_properties` - If set to `true` for an object, empty object properties (i.e. those with falsy values) will not be returned by getValue().
1246
+ * `remove_false_properties` - If set to `true` for an object, object properties with value `false` will not be returned by getValue().
1247
+ * `has_placeholder_option` - If set to true, a placeholder option will be added to the select editor input.
1248
+ * `placeholder_option_text` - Text displayed in select placeholder option.
1218
1249
 
1219
1250
  ```json
1220
1251
  {
@@ -1,6 +1,7 @@
1
1
  const webpack = require('webpack')
2
2
  const helpers = require('./helpers')
3
3
  const CssToJSON = require('../build/CssToJson')
4
+ const ESLintPlugin = require('eslint-webpack-plugin');
4
5
 
5
6
  const bannerText = `/**
6
7
  * @name JSON Editor
@@ -22,12 +23,6 @@ module.exports = {
22
23
  },
23
24
  module: {
24
25
  rules: [
25
- {
26
- enforce: 'pre',
27
- test: /\.js$/,
28
- exclude: /node_modules/,
29
- loader: 'eslint-loader'
30
- },
31
26
  {
32
27
  test: /\.js|\.css.js$/,
33
28
  exclude: /node_modules/,
@@ -54,6 +49,7 @@ module.exports = {
54
49
  ]
55
50
  },
56
51
  plugins: [
52
+ new ESLintPlugin(),
57
53
  new webpack.BannerPlugin(
58
54
  bannerText.replace(
59
55
  '{{ VERSION }}',