@json-editor/json-editor 2.15.0 → 2.15.2

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 (68) hide show
  1. package/.env +0 -4
  2. package/.github/workflows/build.yml +5 -5
  3. package/CHANGELOG.md +19 -0
  4. package/README.md +16 -0
  5. package/config/codeceptjs_helpers.js +11 -0
  6. package/dist/jsoneditor.js +1 -1
  7. package/dist/jsoneditor.js.LICENSE.txt +1 -1
  8. package/dist/nonmin/jsoneditor.js +502 -152
  9. package/dist/nonmin/jsoneditor.js.map +1 -1
  10. package/package.json +1 -1
  11. package/src/core.js +11 -0
  12. package/src/defaults.js +2 -1
  13. package/src/editor.js +26 -15
  14. package/src/editors/ace.js +1 -0
  15. package/src/editors/array/choices.js +1 -0
  16. package/src/editors/array/select2.js +2 -0
  17. package/src/editors/array/selectize.js +2 -0
  18. package/src/editors/array.js +81 -0
  19. package/src/editors/base64.js +2 -0
  20. package/src/editors/checkbox.js +13 -1
  21. package/src/editors/choices.js +2 -0
  22. package/src/editors/colorpicker.js +2 -0
  23. package/src/editors/datetime.js +2 -0
  24. package/src/editors/describedby.js +2 -0
  25. package/src/editors/enum.js +3 -1
  26. package/src/editors/hidden.js +2 -0
  27. package/src/editors/jodit.js +2 -0
  28. package/src/editors/multiple.js +2 -0
  29. package/src/editors/multiselect.js +2 -0
  30. package/src/editors/object.js +10 -3
  31. package/src/editors/radio.js +2 -0
  32. package/src/editors/sceditor.js +2 -0
  33. package/src/editors/select.js +9 -4
  34. package/src/editors/select2.js +2 -0
  35. package/src/editors/selectize.js +2 -0
  36. package/src/editors/signature.js +2 -0
  37. package/src/editors/simplemde.js +3 -1
  38. package/src/editors/starrating.js +2 -0
  39. package/src/editors/string.js +2 -0
  40. package/src/editors/table.js +19 -2
  41. package/src/editors/upload.js +2 -0
  42. package/src/editors/uuid.js +2 -0
  43. package/src/resolvers.js +1 -1
  44. package/src/theme.js +23 -0
  45. package/src/themes/bootstrap3.css +53 -0
  46. package/src/themes/bootstrap3.css.js +1 -1
  47. package/src/themes/bootstrap3.js +30 -0
  48. package/src/themes/bootstrap4.js +27 -0
  49. package/src/themes/bootstrap5.js +28 -0
  50. package/src/themes/spectre.js +28 -0
  51. package/src/themes/tailwind.css +54 -0
  52. package/src/themes/tailwind.css.js +1 -1
  53. package/src/themes/tailwind.js +26 -0
  54. package/tests/codeceptjs/core_test.js +28 -0
  55. package/tests/codeceptjs/editors/integer_test.js +3 -1
  56. package/tests/codeceptjs/editors/multiple_test.js +27 -0
  57. package/tests/codeceptjs/editors/select_test.js +12 -0
  58. package/tests/codeceptjs/issues/issue-gh-1562_test.js +12 -0
  59. package/tests/codeceptjs/issues/issue-gh-1586_test.js +15 -0
  60. package/tests/docker-compose-local.yml +2 -1
  61. package/tests/pages/editor-show-validation-errors.html +54 -0
  62. package/tests/pages/enforce-const.html +10 -18
  63. package/tests/pages/integer.html +9 -10
  64. package/tests/pages/issues/issue-gh-1562.html +170 -0
  65. package/tests/pages/issues/issue-gh-1586.html +48 -0
  66. package/tests/pages/opt-in-widget.html +134 -0
  67. package/tests/pages/select-values.html +91 -0
  68. package/tests/pages/switcher-option.html +69 -0
package/.env CHANGED
@@ -1,6 +1,2 @@
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
@@ -46,14 +46,14 @@ jobs:
46
46
  # run: |
47
47
  # npm install
48
48
  - name: Install
49
- run: docker-compose run -T --rm node npm install
49
+ run: docker compose run -T --rm node npm install
50
50
  - name: Start
51
- run: docker-compose up -d ${SELENIUM_BROWSER}
51
+ run: docker compose up -d ${SELENIUM_BROWSER}
52
52
  - name: Build
53
- run: docker-compose run -T --rm node npm run ${BUILD_ENV}
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 run-multiple -c /repo/tests/codeceptjs/codecept.json 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
@@ -66,5 +66,5 @@ jobs:
66
66
  merge-multiple: true
67
67
  - name: Test (optional)
68
68
  continue-on-error: true
69
- run: docker-compose exec -T node codeceptjs run-multiple -c /repo/tests/codeceptjs/codecept.json 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'
70
70
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  ### Unreleased
2
2
 
3
+ ### 2.15.2
4
+
5
+ - Support drag and drop for array item
6
+ - Updated to docker compose commands
7
+ - Updated to docker compose commands
8
+ - Added schema switcher option
9
+ - Added opt_in_widget option (checkboxes and switches for opt int activators)
10
+ - Added enforce_const option
11
+ - Added enforce_const option
12
+ - ShowErrorMessages method
13
+ - Recursively deactivate non required properties, when adding a new row in an array
14
+ - Fixed error in Playground
15
+ - Fixed simpleMde exception
16
+ - Support drag and drop for array item
17
+
18
+ ### 2.15.1
19
+
20
+ - Fixed #1563 and #1558. Select values not displayed
21
+
3
22
  ### 2.15.0
4
23
 
5
24
  - Added option enforce_const
package/README.md CHANGED
@@ -336,6 +336,11 @@ Here are all the available options:
336
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
337
  <td><code>false</code></td>
338
338
  </tr>
339
+ <tr>
340
+ <td>opt_in_widget</td>
341
+ <td>Which widget should be used for opt-in inputs. Possible values are <code>'checkbox'</code> and <code>'switch'</code></td>
342
+ <td><code>'checkbox'</code></td>
343
+ </tr>
339
344
  </tbody>
340
345
  </table>
341
346
 
@@ -409,6 +414,12 @@ const errors = editor.validate({
409
414
  });
410
415
  ```
411
416
 
417
+ Display validation errors on demand
418
+
419
+ ```javascript
420
+ editor.showValidationErrors();
421
+ ```
422
+
412
423
  ### Listen for Changes
413
424
 
414
425
  The `change` event is fired whenever the editor's value changes.
@@ -1126,6 +1137,10 @@ editor.on('deleteAllRows', deletedValues => {
1126
1137
  });
1127
1138
  ```
1128
1139
 
1140
+ Drag and drop for array item is supported to perform a quick item moving.
1141
+ For array editor with format=`tabs` or `tabs-top`, you can drag the tab header directly.
1142
+ For the default array editor (or format=`table`), you have to drag the array item panel with Ctrl key pressed (to avoid side-effect of draggable panel), or drag any text in the input box to another item panel.
1143
+
1129
1144
  #### Schema loader events
1130
1145
 
1131
1146
  When schemas are loaded via a request, the `schemaLoaded` event is triggered individually for each schema after its loading.
@@ -1224,6 +1239,7 @@ Editor Options
1224
1239
 
1225
1240
  Editors can accept options which alter the behavior in some way.
1226
1241
 
1242
+ * `switcher` - If set to false and using oneOf or anyOf, a multiple editor is not created, but validation still applies. Should be used with schemas with same type.
1227
1243
  * `titleHidden` - If set to true, the editor title will be visually hidden
1228
1244
  * `collapsed` - If set to true, the editor will start collapsed (works for objects and arrays)
1229
1245
  * `disable_array_add` - If set to true, the "add row" button will be hidden (works for arrays)
@@ -121,6 +121,17 @@ class customHelpers extends Helper {
121
121
  }
122
122
  }
123
123
 
124
+ async getSelectedValueAndAssert(selector, expectedValue) {
125
+ const helper = this.helpers['Puppeteer'] || this.helpers['WebDriver']
126
+
127
+ const selectValue = await helper.executeScript((sel) => {
128
+ const selectElement = document.querySelector(sel);
129
+ return selectElement.value;
130
+ }, selector);
131
+
132
+ return assert.strictEqual(selectValue, expectedValue);
133
+ }
134
+
124
135
  // Custom isTrue function.
125
136
  // returns boolean value
126
137
  async isTrue (val) {