@json-editor/json-editor 2.6.0 → 2.8.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.
- package/.github/workflows/build.yml +12 -3
- package/CHANGELOG.md +34 -0
- package/README.md +163 -18
- package/dist/jsoneditor.js +2 -2
- package/dist/nonmin/jsoneditor.js +2710 -651
- package/dist/nonmin/jsoneditor.js.map +1 -1
- package/docs/cleave.html +1 -1
- package/docs/datetime.html +1 -1
- package/docs/describedby.html +1 -1
- package/docs/form-submission.html +162 -0
- package/docs/index.html +2 -2
- package/docs/materialize_css.html +1 -1
- package/docs/radio.html +1 -1
- package/docs/select2.html +1 -1
- package/docs/selectize.html +1 -1
- package/docs/starrating.html +1 -1
- package/docs/wysiwyg.html +1 -1
- package/package.json +4 -3
- package/release-notes.md +2 -0
- package/src/core.js +36 -37
- package/src/defaults.js +10 -2
- package/src/editor.js +1 -1
- package/src/editors/array.js +12 -1
- package/src/editors/autocomplete.js +4 -3
- package/src/editors/button.js +1 -1
- package/src/editors/checkbox.js +3 -1
- package/src/editors/hidden.js +3 -1
- package/src/editors/multiselect.js +17 -6
- package/src/editors/object.js +3 -4
- package/src/editors/radio.js +8 -3
- package/src/editors/select.js +3 -1
- package/src/editors/signature.js +3 -1
- package/src/editors/string.js +7 -1
- package/src/editors/table.js +20 -2
- package/src/editors/upload.js +1 -1
- package/src/editors/uuid.js +2 -12
- package/src/iconlib.js +1 -1
- package/src/schemaloader.js +231 -108
- package/src/style.css +3 -0
- package/src/style.css.js +1 -1
- package/src/theme.js +0 -2
- package/src/themes/bootstrap3.js +1 -0
- package/src/themes/spectre.js +2 -1
- package/src/utilities.js +18 -0
- package/src/validator.js +36 -34
- package/tests/codeceptjs/codecept.json +1 -1
- package/tests/codeceptjs/core_test.js +104 -0
- package/tests/codeceptjs/editors/advanced_test.js +1 -1
- package/tests/codeceptjs/editors/array_test.js +74 -0
- package/tests/codeceptjs/editors/autocomplete_test.js +16 -0
- package/tests/codeceptjs/editors/button_test.js +10 -3
- package/tests/codeceptjs/editors/integer_test.js +7 -2
- package/tests/codeceptjs/editors/jodit_test.js +3 -3
- package/tests/codeceptjs/editors/object_test.js +29 -9
- package/tests/codeceptjs/editors/range_test.js +12 -0
- package/tests/codeceptjs/editors/uuid_test.js +31 -4
- package/tests/docker-compose.yml +1 -1
- package/tests/fixtures/definitions.json +22 -0
- package/tests/fixtures/properties.json +20 -0
- package/tests/pages/array-checkboxes-infotext.html +52 -0
- package/tests/pages/array-move-events.html +4 -2
- package/tests/pages/array-unique-items-sort.html +78 -0
- package/tests/pages/autocomplete.html +69 -0
- package/tests/pages/button-icons.html +38 -0
- package/tests/pages/core.html +4 -2
- package/tests/pages/error-messages.html +47 -0
- package/tests/pages/grid-strict.html +6 -10
- package/tests/pages/grid.html +0 -4
- package/tests/pages/issues/issue-gh-812.html +4 -2
- package/tests/pages/meta_schema.json +14 -0
- package/tests/pages/object-required-properties.html +7 -7
- package/tests/pages/object-with-dependencies-array.html +29 -19
- package/tests/pages/range.html +60 -0
- package/tests/pages/ready.html +43 -0
- package/tests/pages/references.html +162 -0
- package/tests/pages/string-simplemde-editor.html +81 -0
- package/tests/pages/table-move-events.html +4 -1
- package/tests/pages/urn.html +11 -8
- package/tests/pages/use-name-attributes.html +206 -0
- package/tests/pages/uuid.html +89 -50
- package/tests/pages/validation-messages.json +705 -0
- package/tests/unit/core.spec.js +79 -66
- package/tests/unit/editor.spec.js +20 -8
- package/tests/unit/editors/array.spec.js +3 -2
- package/tests/unit/editors/object.spec.js +3 -1
- package/tests/unit/editors/table.spec.js +4 -2
- package/tests/unit/schemaloader.spec.js +77 -105
- package/tests/unit/validator.spec.js +2 -2
|
@@ -22,7 +22,7 @@ jobs:
|
|
|
22
22
|
include:
|
|
23
23
|
- selenium-browser: "chrome"
|
|
24
24
|
build-env: "build.prod"
|
|
25
|
-
-
|
|
25
|
+
- selenium-browser: "chrome"
|
|
26
26
|
build-env: "build.nonmin.travis"
|
|
27
27
|
- selenium-browser: "firefox"
|
|
28
28
|
build-env: "build.prod"
|
|
@@ -50,9 +50,18 @@ jobs:
|
|
|
50
50
|
- name: Build
|
|
51
51
|
run: docker-compose run -T --rm node npm run ${BUILD_ENV}
|
|
52
52
|
- name: Test
|
|
53
|
-
run:
|
|
53
|
+
run: |
|
|
54
|
+
docker-compose exec -T node codeceptjs -c /repo/tests/codeceptjs/codecept.json run-multiple basic:${SELENIUM_BROWSER} --invert --grep '@optional'
|
|
55
|
+
pwd
|
|
56
|
+
ls -la codeceptjs/output
|
|
57
|
+
- name: Test Artifacts
|
|
58
|
+
if: always()
|
|
59
|
+
uses: actions/upload-artifact@v3
|
|
60
|
+
with:
|
|
61
|
+
name: codeceptjs-output
|
|
62
|
+
path: tests/codeceptjs/output
|
|
63
|
+
retention-days: 30
|
|
54
64
|
- name: Test (optional)
|
|
55
65
|
continue-on-error: true
|
|
56
66
|
run: docker-compose exec -T node codeceptjs -c /repo/tests/codeceptjs/codecept.json run-multiple basic:${SELENIUM_BROWSER} --grep '@optional'
|
|
57
67
|
|
|
58
|
-
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
### Unreleased
|
|
2
2
|
|
|
3
|
+
### 2.7.1
|
|
4
|
+
|
|
5
|
+
- Added feature: use_name_attributes option
|
|
6
|
+
|
|
7
|
+
### 2.7.0
|
|
8
|
+
|
|
9
|
+
- Fixed array uniqueItems sorting bug
|
|
10
|
+
- Configurable icons for type button editors
|
|
11
|
+
- Fixed autocomplete options rendering
|
|
12
|
+
- Editor gets .je-ready class when ready
|
|
13
|
+
- Regenerate unique UUID when copying arrays
|
|
14
|
+
- Added infoText for checkbox on "Spectre" and "Bootstrap 3" Themes
|
|
15
|
+
- Added configurable error messages at editor schema level feature
|
|
16
|
+
- Added form submission case study and linked it in the readme
|
|
17
|
+
- Fixed range output value rendering
|
|
18
|
+
- Added automated test for references
|
|
19
|
+
- Added SimpleMDE test page
|
|
20
|
+
- JSON pointers support for definitions
|
|
21
|
+
- Added infoText for multiselect enum
|
|
22
|
+
- Updated packages and fixed npm audits
|
|
23
|
+
- Using latest jquery in docs to resolve vulnerabilities
|
|
24
|
+
- fixed bug in upload editor
|
|
25
|
+
- Updated release-motes.md
|
|
26
|
+
- Added feature: override error messages in schema options
|
|
27
|
+
- fixed arbitrary JSON pointers not returning the schema at the pointer path
|
|
28
|
+
- Add infoText for enums with format `checkbox` (default)
|
|
29
|
+
- updated `jodit` devDependency (jodit markup changes)
|
|
30
|
+
|
|
31
|
+
### 2.6.1
|
|
32
|
+
|
|
33
|
+
- Fix for #900 to close the properties modal when we click outside modal
|
|
34
|
+
- fix: Rework use of event.path to prevent a ReferenceError in Safari
|
|
35
|
+
- Fix for dependencies when dependency is an array
|
|
36
|
+
|
|
3
37
|
### 2.6.0
|
|
4
38
|
|
|
5
39
|
- set show_opt_in per object editor
|
package/README.md
CHANGED
|
@@ -11,6 +11,7 @@ Some pull requests added from the original repo.
|
|
|
11
11
|
JSON Editor takes a JSON Schema and uses it to generate an HTML form.
|
|
12
12
|
It has full support for JSON Schema version 3 and 4 and can integrate with several popular CSS frameworks (bootstrap, spectre, tailwind).
|
|
13
13
|
|
|
14
|
+
Take a look at this [example](https://json-editor.github.io/json-editor/form-submission.html) for a simple form submission case study.
|
|
14
15
|
### Online Demo
|
|
15
16
|
|
|
16
17
|
Check out an interactive demo: https://json-editor.github.io/json-editor/
|
|
@@ -294,6 +295,11 @@ Here are all the available options:
|
|
|
294
295
|
<td>A callback function to resolve an undefined Uniform Resource Name (URN) for <code>$ref</code>. The function receives a URN and callback to pass back a serialized JSON response. The function should return a boolean (true if the URN can be resolved; false otherwise).</td>
|
|
295
296
|
<td><code>false</code></td>
|
|
296
297
|
</tr>
|
|
298
|
+
<tr>
|
|
299
|
+
<td>use_name_attributes</td>
|
|
300
|
+
<td>If <code>true</code>, control inputs <code>name</code> attributes will be set.</td>
|
|
301
|
+
<td><code>true</code></td>
|
|
302
|
+
</tr>
|
|
297
303
|
</tbody>
|
|
298
304
|
</table>
|
|
299
305
|
|
|
@@ -521,7 +527,7 @@ Some of The [hyper-schema][hyper] specification is supported as well.
|
|
|
521
527
|
|
|
522
528
|
### $ref and definitions
|
|
523
529
|
|
|
524
|
-
JSON Editor supports schema references to external URLs and local definitions. Here's an example
|
|
530
|
+
JSON Editor supports schema references to external URLs and local definitions as well as JSON Pointers. Here's an example:
|
|
525
531
|
|
|
526
532
|
```json
|
|
527
533
|
{
|
|
@@ -533,6 +539,9 @@ JSON Editor supports schema references to external URLs and local definitions.
|
|
|
533
539
|
},
|
|
534
540
|
"location": {
|
|
535
541
|
"$ref": "http://mydomain.com/geo.json"
|
|
542
|
+
},
|
|
543
|
+
"birthday": {
|
|
544
|
+
"$ref": "http://mydomain.com/person.json#/definitions/birthdate"
|
|
536
545
|
}
|
|
537
546
|
},
|
|
538
547
|
"definitions": {
|
|
@@ -752,6 +761,33 @@ __SimpleMDE__ is a simple Markdown editor with live preview. To use it, set the
|
|
|
752
761
|
}
|
|
753
762
|
```
|
|
754
763
|
|
|
764
|
+
To customize the editor, add the [configuration](https://github.com/sparksuite/simplemde-markdown-editor#configuration) in the `simplemde` option:
|
|
765
|
+
|
|
766
|
+
```json
|
|
767
|
+
{
|
|
768
|
+
"type": "string",
|
|
769
|
+
"format": "markdown",
|
|
770
|
+
"options": {
|
|
771
|
+
"simplemde": {
|
|
772
|
+
"toolbar": [
|
|
773
|
+
"bold",
|
|
774
|
+
"italic",
|
|
775
|
+
"heading",
|
|
776
|
+
"|",
|
|
777
|
+
"link",
|
|
778
|
+
"quote",
|
|
779
|
+
"|",
|
|
780
|
+
"preview",
|
|
781
|
+
"fullscreen",
|
|
782
|
+
"guide"
|
|
783
|
+
],
|
|
784
|
+
"spellChecker": false
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
```
|
|
789
|
+
|
|
790
|
+
|
|
755
791
|
__Ace Editor__ is a syntax highlighting source code editor. You can use it by setting the format to any of the following:
|
|
756
792
|
|
|
757
793
|
* actionscript
|
|
@@ -840,6 +876,55 @@ You can enable [Ace editor options](https://github.com/ajaxorg/ace/wiki/Configur
|
|
|
840
876
|
}
|
|
841
877
|
```
|
|
842
878
|
|
|
879
|
+
### Special editors
|
|
880
|
+
|
|
881
|
+
JSONEditor features specialized types of editors.
|
|
882
|
+
|
|
883
|
+
#### Button editor
|
|
884
|
+
|
|
885
|
+
Creates a button whose click callback can be defined in `JSONEditor.defaults.callbacks`. Options:
|
|
886
|
+
|
|
887
|
+
- `icon`: Renders an icon into the button. Must be supported by the iconLib used.
|
|
888
|
+
- `validated`: With `true` the button is disabled until the whole editor is valid.
|
|
889
|
+
- `action`: the name of the callback that will be invoked when the button is clicked. Callbacks
|
|
890
|
+
must be defined in `JSONEditor.defaults.callbacks`.
|
|
891
|
+
|
|
892
|
+
```js
|
|
893
|
+
JSONEditor.defaults.callbacks = {
|
|
894
|
+
"button" : {
|
|
895
|
+
"myAction" : function (jseditor, e) {
|
|
896
|
+
alert('Button action')
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
```
|
|
901
|
+
|
|
902
|
+
```json
|
|
903
|
+
{
|
|
904
|
+
"type": "button",
|
|
905
|
+
"title": "Search",
|
|
906
|
+
"options": {
|
|
907
|
+
"button": {
|
|
908
|
+
"icon": "search",
|
|
909
|
+
"action": "myAction",
|
|
910
|
+
"validated": true
|
|
911
|
+
}
|
|
912
|
+
}
|
|
913
|
+
}
|
|
914
|
+
```
|
|
915
|
+
|
|
916
|
+
#### Info editor
|
|
917
|
+
|
|
918
|
+
Displays a label and a description text.
|
|
919
|
+
|
|
920
|
+
```json
|
|
921
|
+
{
|
|
922
|
+
"type": "info",
|
|
923
|
+
"title": "Important:",
|
|
924
|
+
"description": "Lorem ipsum dolor"
|
|
925
|
+
}
|
|
926
|
+
```
|
|
927
|
+
|
|
843
928
|
#### Booleans
|
|
844
929
|
|
|
845
930
|
The default boolean editor is a select box with options "true" and "false". To use a checkbox instead, set the format to `checkbox`.
|
|
@@ -1008,23 +1093,24 @@ Editor Options
|
|
|
1008
1093
|
|
|
1009
1094
|
Editors can accept options which alter the behavior in some way.
|
|
1010
1095
|
|
|
1011
|
-
*
|
|
1012
|
-
*
|
|
1013
|
-
*
|
|
1014
|
-
*
|
|
1015
|
-
*
|
|
1016
|
-
*
|
|
1017
|
-
*
|
|
1018
|
-
*
|
|
1019
|
-
*
|
|
1020
|
-
*
|
|
1021
|
-
*
|
|
1022
|
-
*
|
|
1023
|
-
*
|
|
1024
|
-
*
|
|
1025
|
-
*
|
|
1026
|
-
*
|
|
1027
|
-
*
|
|
1096
|
+
* `collapsed` - If set to true, the editor will start collapsed (works for objects and arrays)
|
|
1097
|
+
* `disable_array_add` - If set to true, the "add row" button will be hidden (works for arrays)
|
|
1098
|
+
* `disable_array_delete` - If set to true, all of the "delete" buttons will be hidden (works for arrays)
|
|
1099
|
+
* `disable_array_delete_all_rows` - If set to true, just the "delete all rows" button will be hidden (works for arrays)
|
|
1100
|
+
* `disable_array_delete_last_row` - If set to true, just the "delete last row" buttons will be hidden (works for arrays)
|
|
1101
|
+
* `disable_array_reorder` - If set to true, the "move up/down" buttons will be hidden (works for arrays)
|
|
1102
|
+
* `disable_collapse` - If set to true, the collapse button will be hidden (works for objects and arrays)
|
|
1103
|
+
* `disable_edit_json` - If set to true, the Edit JSON button will be hidden (works for objects)
|
|
1104
|
+
* `disable_properties` - If set to true, the Edit Properties button will be hidden (works for objects)
|
|
1105
|
+
* `array_controls_top` - If set to true, array controls (add, delete etc) will be displayed at top of list (works for arrays)
|
|
1106
|
+
* `enum` - See [Enum options](#enum-options)
|
|
1107
|
+
* `enum_titles` - An array of display values to use for select box options in the same order as defined with the `enum` keyword. Works with schema using enum values.
|
|
1108
|
+
* `expand_height` - If set to true, the input will auto expand/contract to fit the content. Works best with textareas.
|
|
1109
|
+
* `grid_columns` - Explicitly set the number of grid columns (1-12) for the editor if it's within an object using a grid layout.
|
|
1110
|
+
* `hidden` - If set to true, the editor will not appear in the UI (works for all types)
|
|
1111
|
+
* `input_height` - Explicitly set the height of the input element. Should be a valid CSS width string (e.g. "100px"). Works best with textareas.
|
|
1112
|
+
* `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.
|
|
1113
|
+
* `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().
|
|
1028
1114
|
|
|
1029
1115
|
```json
|
|
1030
1116
|
{
|
|
@@ -1059,6 +1145,43 @@ Using the option `infoText`, will create a info button, displaying the text you
|
|
|
1059
1145
|
}
|
|
1060
1146
|
```
|
|
1061
1147
|
|
|
1148
|
+
Enum options
|
|
1149
|
+
------------------
|
|
1150
|
+
|
|
1151
|
+
Using the option `enum`, it is possible to modify how enums with format `checkbox` (default) are displayed in the editor.
|
|
1152
|
+
It is an array of objects (described below), which must be in the same order as defined with the `enum` keyword.
|
|
1153
|
+
|
|
1154
|
+
Currently, the following is supported:
|
|
1155
|
+
|
|
1156
|
+
* `title`: *Optional* Display value shown instead of the enum value
|
|
1157
|
+
* `infoText`: *Optional* Creates an info button next to the title, displaying the text you set, on hovering.
|
|
1158
|
+
|
|
1159
|
+
It is possible also to set these options only for some enum values, to skip one enum value, define an empty object (`{}`).
|
|
1160
|
+
|
|
1161
|
+
```json
|
|
1162
|
+
{
|
|
1163
|
+
"type": "array",
|
|
1164
|
+
"items": {
|
|
1165
|
+
"type": "string",
|
|
1166
|
+
"enum": ["1", "2", "3", "4"],
|
|
1167
|
+
"options": {
|
|
1168
|
+
"enum": [
|
|
1169
|
+
{},
|
|
1170
|
+
{
|
|
1171
|
+
"title": "Title 2"
|
|
1172
|
+
},
|
|
1173
|
+
{ "infoText": "InfoText 3" },
|
|
1174
|
+
{
|
|
1175
|
+
"title": "Title 4",
|
|
1176
|
+
"infoText": "InfoText 4"
|
|
1177
|
+
}
|
|
1178
|
+
]
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
}
|
|
1182
|
+
```
|
|
1183
|
+
|
|
1184
|
+
If both options `enum_titles[x]` and `enum[x].title` are set for the enum value `x`, than the title set under `enum[x].title` will be used.
|
|
1062
1185
|
|
|
1063
1186
|
Dependencies
|
|
1064
1187
|
------------------
|
|
@@ -1515,6 +1638,28 @@ By default, all instances of JSON Editor will use the `en` language. To overrid
|
|
|
1515
1638
|
JSONEditor.defaults.language = "es";
|
|
1516
1639
|
```
|
|
1517
1640
|
|
|
1641
|
+
You can also override translations per editor in the it's schema options.
|
|
1642
|
+
|
|
1643
|
+
````json
|
|
1644
|
+
"error_const": {
|
|
1645
|
+
"type": "string",
|
|
1646
|
+
"title": "error_const",
|
|
1647
|
+
"const": "test",
|
|
1648
|
+
"default": "something else",
|
|
1649
|
+
"options": {
|
|
1650
|
+
"error_messages": {
|
|
1651
|
+
"en": {
|
|
1652
|
+
"error_const": "CUSTOM EN: Value must be the constant value"
|
|
1653
|
+
},
|
|
1654
|
+
"es": {
|
|
1655
|
+
"error_const": "CUSTOM ES: Value must be the constant value"
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
````
|
|
1661
|
+
|
|
1662
|
+
|
|
1518
1663
|
Button Customization
|
|
1519
1664
|
-----------------
|
|
1520
1665
|
|