@json-editor/json-editor 2.11.0 → 2.13.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 (89) hide show
  1. package/.env +1 -1
  2. package/CHANGELOG.md +19 -0
  3. package/README.md +90 -6
  4. package/README_ADDON.md +5 -1
  5. package/dist/jsoneditor.js +1 -1
  6. package/dist/jsoneditor.js.LICENSE.txt +1 -1
  7. package/dist/nonmin/jsoneditor.js +417 -227
  8. package/dist/nonmin/jsoneditor.js.map +1 -1
  9. package/docs/cleave.html +1 -1
  10. package/docs/datetime.html +1 -1
  11. package/docs/describedby.html +1 -1
  12. package/docs/index.html +66 -14
  13. package/docs/meta_schema.json +16 -1
  14. package/docs/radio.html +1 -1
  15. package/docs/scripts/ajv-validator.js +8695 -0
  16. package/docs/select2.html +1 -1
  17. package/docs/selectize.html +2 -5
  18. package/docs/signature.html +12 -11
  19. package/docs/wysiwyg.html +1 -1
  20. package/package.json +1 -1
  21. package/src/core.js +10 -1
  22. package/src/defaults.js +3 -1
  23. package/src/editor.js +19 -1
  24. package/src/editors/array/selectize.js +0 -2
  25. package/src/editors/array.js +24 -13
  26. package/src/editors/base64.js +9 -0
  27. package/src/editors/button.js +8 -2
  28. package/src/editors/integer.js +3 -2
  29. package/src/editors/multiple.js +3 -0
  30. package/src/editors/number.js +4 -2
  31. package/src/editors/object.js +71 -3
  32. package/src/editors/signature.js +16 -16
  33. package/src/editors/simplemde.js +2 -1
  34. package/src/editors/string.js +4 -0
  35. package/src/editors/table.js +17 -14
  36. package/src/resolvers.js +13 -6
  37. package/src/schemaloader.js +13 -0
  38. package/src/theme.js +4 -0
  39. package/src/themes/bootstrap3.js +6 -0
  40. package/src/themes/bootstrap4.js +6 -0
  41. package/src/themes/bootstrap5.js +6 -0
  42. package/src/validator.js +28 -0
  43. package/tests/codeceptjs/codecept.json +1 -1
  44. package/tests/codeceptjs/constrains/contains_test.js +3 -2
  45. package/tests/codeceptjs/constrains/dependentRequired_test.js +33 -0
  46. package/tests/codeceptjs/constrains/dependentSchemas_test.js +1 -0
  47. package/tests/codeceptjs/core_test.js +14 -4
  48. package/tests/codeceptjs/editors/advanced_test.js +1 -1
  49. package/tests/codeceptjs/editors/array_test.js +59 -0
  50. package/tests/codeceptjs/editors/autocomplete_test.js +3 -1
  51. package/tests/codeceptjs/editors/object_test.js +20 -0
  52. package/tests/codeceptjs/editors/tabs_test.js +1 -1
  53. package/tests/codeceptjs/issues/issue-gh-1330_test.js +8 -0
  54. package/tests/codeceptjs/issues/issue-gh-1338_test.js +2 -0
  55. package/tests/codeceptjs/issues/issue-gh-1364_test.js +13 -0
  56. package/tests/codeceptjs/issues/issue-gh-1367_test.js +11 -0
  57. package/tests/codeceptjs/issues/issue-gh-1383_test.js +9 -0
  58. package/tests/codeceptjs/issues/issue-gh-1384_test.js +9 -0
  59. package/tests/codeceptjs/issues/issue-gh-1410_test.js +13 -0
  60. package/tests/codeceptjs/issues/issue-gh-1422_test.js +9 -0
  61. package/tests/codeceptjs/issues/issue-gh-1431_test.js +12 -0
  62. package/tests/codeceptjs/issues/issue-gh-1439_test.js +12 -0
  63. package/tests/docker-compose-local.yml +4 -0
  64. package/tests/pages/array-header-template.html +59 -0
  65. package/tests/pages/array-selectize-create.html +62 -0
  66. package/tests/pages/array-table-responsive.html +65 -0
  67. package/tests/pages/button-icons.html +1 -1
  68. package/tests/pages/button_state_mode_1.html +34 -0
  69. package/tests/pages/button_state_mode_2.html +35 -0
  70. package/tests/pages/dependentRequired.html +71 -0
  71. package/tests/pages/issues/issue-gh-1330.html +52 -0
  72. package/tests/pages/issues/issue-gh-1364.html +64 -0
  73. package/tests/pages/issues/issue-gh-1367.html +49 -0
  74. package/tests/pages/issues/issue-gh-1383.html +31 -0
  75. package/tests/pages/issues/issue-gh-1383.json +14 -0
  76. package/tests/pages/issues/issue-gh-1384.html +31 -0
  77. package/tests/pages/issues/issue-gh-1384.json +36 -0
  78. package/tests/pages/issues/issue-gh-1410.html +57 -0
  79. package/tests/pages/issues/issue-gh-1422.html +68 -0
  80. package/tests/pages/issues/issue-gh-1431.html +49 -0
  81. package/tests/pages/issues/issue-gh-1439.html +69 -0
  82. package/tests/pages/keep_only_existing_values.html +1 -1
  83. package/tests/pages/load-events.html +60 -0
  84. package/tests/pages/meta-schema.html +16 -2
  85. package/tests/pages/meta_schema.json +5 -1
  86. package/tests/pages/object-case-sensitive-property-search-false.html +41 -0
  87. package/tests/pages/object-case-sensitive-property-search-true.html +41 -0
  88. package/dist/dev/jsoneditor.js +0 -3687
  89. package/dist/jsoneditor.js.map +0 -1
package/.env CHANGED
@@ -1,2 +1,2 @@
1
1
  COMPOSE_PROJECT_NAME=json-editor
2
- COMPOSE_FILE=./tests/docker-compose.yml
2
+ COMPOSE_FILE=./tests/docker-compose.yml:./tests/docker-compose-local.yml
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  ### Unreleased
2
2
 
3
+ ### 2.13.0
4
+
5
+ - Added feature #1448 enumTitle for headerTemplates
6
+ - Fixed issue #1442 tpe button editors
7
+ - Fixed issue #1433 simplemde editor data sync
8
+ - Added schema validation in playground
9
+ - Fixed tests timing issues
10
+
11
+ ### 2.12.0
12
+
13
+ - Fixed issue #1422: use_default_values: false deletes valid values while true sets invalid default values
14
+ - Added feature: load-events
15
+ - Fixed issue #1410: Schema for "additionalProperties" does not override "no_additional_properties: true"
16
+ - Added feature: table-responsive
17
+ - Fixed readme-broken-link
18
+ - Updated integrity checks in example pages
19
+
3
20
  ### 2.11.0
4
21
 
5
22
  - Fixed issue #746 and #645: Selectize with create = true should add items
@@ -11,6 +28,8 @@
11
28
  - Updated playground ace editor config
12
29
  - Added button_state_mode options
13
30
  - Added support for case-insensitive properties search
31
+ - Fixed issue #746 and #645 Selectize with create = true should add Items
32
+ - Added support for case insensitive properties search
14
33
  - Added support for dependentRequired constrains
15
34
  - Fixed issue #1367: Signature editor not returning base64 data
16
35
  - Fixed issue #1237: more coherent ui for Base64 editor
package/README.md CHANGED
@@ -315,6 +315,16 @@ Here are all the available options:
315
315
  <td>If <code>true</code>, control inputs <code>name</code> attributes will be set.</td>
316
316
  <td><code>true</code></td>
317
317
  </tr>
318
+ <tr>
319
+ <td>button_state_mode</td>
320
+ <td>If <code>1</code>, inactive buttons are hidden. If <code>2</code>, inactive buttons are disabled.</td>
321
+ <td><code>1</code></td>
322
+ </tr>
323
+ <tr>
324
+ <td>case_sensitive_property_search</td>
325
+ <td>This property controls whether property searches in an object editor are case-sensitive</td>
326
+ <td><code>true</code></td>
327
+ </tr>
318
328
  </tbody>
319
329
  </table>
320
330
 
@@ -540,7 +550,7 @@ Some of The [hyper-schema][hyper] specification is supported as well.
540
550
 
541
551
  [core]: http://json-schema.org/latest/json-schema-core.html
542
552
  [validation]: http://json-schema.org/latest/json-schema-validation.html
543
- [hyper]: http://json-schema.org/latest/json-schema-hypermedia.html
553
+ [hyper]: https://json-schema.org/draft-07/json-hyper-schema-release-notes
544
554
 
545
555
  ### $ref and definitions
546
556
 
@@ -636,6 +646,52 @@ Show a video preview (using HTML5 video)
636
646
  The `href` property is a template that gets re-evaluated every time the value changes.
637
647
  The variable `self` is always available. Look at the __Dependencies__ section below for how to include other fields or use a custom template engine.
638
648
 
649
+ ### if-then-else
650
+ The if-then-else keywords are used to express conditional validation logic based on the evaluation of a specified condition. The if keyword defines a condition, and depending on whether it evaluates to true or false, the schema specified under either the then or else keywords will be applied.
651
+
652
+ ```json
653
+ {
654
+ "type": "object",
655
+ "properties": {
656
+ "street_address": {
657
+ "type": "string"
658
+ },
659
+ "country": {
660
+ "type": "string",
661
+ "default": "United States of America",
662
+ "enum": [
663
+ "United States of America",
664
+ "Canada"
665
+ ]
666
+ },
667
+ "postal_code": {
668
+ "type": "string"
669
+ }
670
+ },
671
+ "if": {
672
+ "properties": {
673
+ "country": {
674
+ "const": "United States of America"
675
+ }
676
+ }
677
+ },
678
+ "then": {
679
+ "properties": {
680
+ "postal_code": {
681
+ "pattern": "[0-9]{5}(-[0-9]{4})?"
682
+ }
683
+ }
684
+ },
685
+ "else": {
686
+ "properties": {
687
+ "postal_code": {
688
+ "pattern": "[A-Z][0-9][A-Z] [0-9][A-Z][0-9]"
689
+ }
690
+ }
691
+ }
692
+ }
693
+ ```
694
+
639
695
  ### Property Ordering
640
696
 
641
697
  There is no way to specify property ordering in JSON Schema (although this may change in v5 of the spec).
@@ -848,8 +904,10 @@ __Ace Editor__ is a syntax highlighting source code editor. You can use it by se
848
904
  * pgsql
849
905
  * php
850
906
  * python
907
+ * prql
851
908
  * r
852
909
  * ruby
910
+ * rust
853
911
  * sass
854
912
  * scala
855
913
  * scss
@@ -857,10 +915,12 @@ __Ace Editor__ is a syntax highlighting source code editor. You can use it by se
857
915
  * sql
858
916
  * stylus
859
917
  * svg
918
+ * typescript
860
919
  * twig
861
920
  * vbscript
862
921
  * xml
863
922
  * yaml
923
+ * zig
864
924
 
865
925
  ```json
866
926
  {
@@ -925,10 +985,10 @@ Creates a button whose click callback can be defined in `JSONEditor.defaults.cal
925
985
 
926
986
  ```json
927
987
  {
928
- "type": "button",
929
- "title": "Search",
988
+ "format": "button",
930
989
  "options": {
931
990
  "button": {
991
+ "text": "Search",
932
992
  "icon": "search",
933
993
  "action": "myAction",
934
994
  "validated": true
@@ -1038,6 +1098,22 @@ editor.on('deleteAllRows', deletedValues => {
1038
1098
  });
1039
1099
  ```
1040
1100
 
1101
+ #### Schema loader events
1102
+
1103
+ When schemas are loaded via a request, the `schemaLoaded` event is triggered individually for each schema after its loading.
1104
+ Once the loading of all schemas is completed, the `allSchemasLoaded` event is triggered.
1105
+
1106
+ ```javascript
1107
+ editor.on('schemaLoaded', (payload) => {
1108
+ console.log('schemasLoaded', payload.schemaUrl)
1109
+ console.log('schemasLoaded', payload.schema)
1110
+ })
1111
+
1112
+ editor.on('allSchemasLoaded', () => {
1113
+ console.log('allSchemasLoaded')
1114
+ })
1115
+ ```
1116
+
1041
1117
 
1042
1118
  #### Objects
1043
1119
 
@@ -1640,7 +1716,7 @@ The `title` keyword of a schema is used to add user friendly headers to the edit
1640
1716
  Consider the example of an array of children. Without dynamic headers, the UI for the array elements would show `Child 1`, `Child 2`, etc..
1641
1717
  It would be much nicer if the headers could be dynamic and incorporate information about the children, such as `1 - John (age 9)`, `2 - Sarah (age 11)`.
1642
1718
 
1643
- To accomplish this, use the `headerTemplate` property. All of the watched variables are passed into this template, along with the static title `title` (e.g. "Child"), the 0-based index `i0` (e.g. "0" and "1"), the 1-based index `i1`, and the field's value `self` (e.g. `{"name": "John", "age": 9}`).
1719
+ To accomplish this, use the `headerTemplate` property. All of the watched variables are passed into this template, along with the static title `title` (e.g. "Child"), the 0-based index `i0` (e.g. "0" and "1"), the 1-based index `i1`, extra child variable `properties.${PROPERTY_NAME}.enumTitle` and the field's value `self` (e.g. `{"name": "John", "age": 9}`).
1644
1720
 
1645
1721
  ```js+jinja
1646
1722
  {
@@ -1649,10 +1725,18 @@ To accomplish this, use the `headerTemplate` property. All of the watched varia
1649
1725
  "items": {
1650
1726
  "type": "object",
1651
1727
  "title": "Child",
1652
- "headerTemplate": "{{ i1 }} - {{ self.name }} (age {{ self.age }})",
1728
+ "headerTemplate": "{{ i1 }} - {{ self.name }} (age {{ self.age }}) has a {{ properties.pet.enumTitle }}",
1653
1729
  "properties": {
1654
1730
  "name": { "type": "string" },
1655
- "age": { "type": "integer" }
1731
+ "age": { "type": "integer" },
1732
+ "pet": {
1733
+ "title": "Pet",
1734
+ "type": "string",
1735
+ "enum": [ "pet_1", "pet_2" ],
1736
+ "options": {
1737
+ "enum_titles": [ "Dog", "Cat" ]
1738
+ }
1739
+ }
1656
1740
  }
1657
1741
  }
1658
1742
  }
package/README_ADDON.md CHANGED
@@ -95,8 +95,10 @@ For configuration options, see the [ACE homepage](https://ace.c9.io/://).
95
95
  ``"format": "pgsql"``<br>
96
96
  ``"format": "php"``<br>
97
97
  ``"format": "python"``<br>
98
+ ``"format": "prql"``<br>
98
99
  ``"format": "r"``<br>
99
100
  ``"format": "ruby"``<br>
101
+ ``"format": "rust"``<br>
100
102
  ``"format": "sass"``<br>
101
103
  ``"format": "scala"``<br>
102
104
  ``"format": "scss"``<br>
@@ -105,10 +107,12 @@ For configuration options, see the [ACE homepage](https://ace.c9.io/://).
105
107
  ``"format": "sqlserver"``<br>
106
108
  ``"format": "stylus"``<br>
107
109
  ``"format": "svg"``<br>
110
+ ``"format": "typescript"``<br>
108
111
  ``"format": "twig"``<br>
109
112
  ``"format": "vbscript"``<br>
110
113
  ``"format": "xml"``<br>
111
- ``"format": "yaml"
114
+ ``"format": "yaml"``<br>
115
+ ``"format": "zig"
112
116
  </details>
113
117
 
114
118
  **Supported Types:** string<br>