@json-editor/json-editor 2.6.1 → 2.7.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 +24 -0
- package/README.md +131 -18
- package/dist/jsoneditor.js +2 -2
- package/dist/nonmin/jsoneditor.js +2607 -582
- package/dist/nonmin/jsoneditor.js.map +1 -1
- package/docs/form-submission.html +76 -0
- package/package.json +4 -3
- package/release-notes.md +2 -0
- package/src/core.js +36 -37
- package/src/defaults.js +9 -2
- package/src/editors/array.js +12 -1
- package/src/editors/autocomplete.js +4 -3
- package/src/editors/button.js +1 -1
- package/src/editors/multiselect.js +14 -5
- package/src/editors/string.js +4 -0
- 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 +98 -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/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/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/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,29 @@
|
|
|
1
1
|
### Unreleased
|
|
2
2
|
|
|
3
|
+
### 2.7.0
|
|
4
|
+
|
|
5
|
+
- Fixed array uniqueItems sorting bug
|
|
6
|
+
- Configurable icons for type button editors
|
|
7
|
+
- Fixed autocomplete options rendering
|
|
8
|
+
- Editor gets .je-ready class when ready
|
|
9
|
+
- Regenerate unique UUID when copying arrays
|
|
10
|
+
- Added infoText for checkbox on "Spectre" and "Bootstrap 3" Themes
|
|
11
|
+
- Added configurable error messages at editor schema level feature
|
|
12
|
+
- Added form submission case study and linked it in the readme
|
|
13
|
+
- Fixed range output value rendering
|
|
14
|
+
- Added automated test for references
|
|
15
|
+
- Added SimpleMDE test page
|
|
16
|
+
- JSON pointers support for definitions
|
|
17
|
+
- Added infoText for multiselect enum
|
|
18
|
+
- Updated packages and fixed npm audits
|
|
19
|
+
- Using latest jquery in docs to resolve vulnerabilities
|
|
20
|
+
- fixed bug in upload editor
|
|
21
|
+
- Updated release-motes.md
|
|
22
|
+
- Added feature: override error messages in schema options
|
|
23
|
+
- fixed arbitrary JSON pointers not returning the schema at the pointer path
|
|
24
|
+
- Add infoText for enums with format `checkbox` (default)
|
|
25
|
+
- updated `jodit` devDependency (jodit markup changes)
|
|
26
|
+
|
|
3
27
|
### 2.6.1
|
|
4
28
|
|
|
5
29
|
- Fix for #900 to close the properties modal when we click outside modal
|
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/
|
|
@@ -521,7 +522,7 @@ Some of The [hyper-schema][hyper] specification is supported as well.
|
|
|
521
522
|
|
|
522
523
|
### $ref and definitions
|
|
523
524
|
|
|
524
|
-
JSON Editor supports schema references to external URLs and local definitions. Here's an example
|
|
525
|
+
JSON Editor supports schema references to external URLs and local definitions as well as JSON Pointers. Here's an example:
|
|
525
526
|
|
|
526
527
|
```json
|
|
527
528
|
{
|
|
@@ -533,6 +534,9 @@ JSON Editor supports schema references to external URLs and local definitions.
|
|
|
533
534
|
},
|
|
534
535
|
"location": {
|
|
535
536
|
"$ref": "http://mydomain.com/geo.json"
|
|
537
|
+
},
|
|
538
|
+
"birthday": {
|
|
539
|
+
"$ref": "http://mydomain.com/person.json#/definitions/birthdate"
|
|
536
540
|
}
|
|
537
541
|
},
|
|
538
542
|
"definitions": {
|
|
@@ -867,6 +871,55 @@ You can enable [Ace editor options](https://github.com/ajaxorg/ace/wiki/Configur
|
|
|
867
871
|
}
|
|
868
872
|
```
|
|
869
873
|
|
|
874
|
+
### Special editors
|
|
875
|
+
|
|
876
|
+
JSONEditor features specialized types of editors.
|
|
877
|
+
|
|
878
|
+
#### Button editor
|
|
879
|
+
|
|
880
|
+
Creates a button whose click callback can be defined in `JSONEditor.defaults.callbacks`. Options:
|
|
881
|
+
|
|
882
|
+
- `icon`: Renders an icon into the button. Must be supported by the iconLib used.
|
|
883
|
+
- `validated`: With `true` the button is disabled until the whole editor is valid.
|
|
884
|
+
- `action`: the name of the callback that will be invoked when the button is clicked. Callbacks
|
|
885
|
+
must be defined in `JSONEditor.defaults.callbacks`.
|
|
886
|
+
|
|
887
|
+
```js
|
|
888
|
+
JSONEditor.defaults.callbacks = {
|
|
889
|
+
"button" : {
|
|
890
|
+
"myAction" : function (jseditor, e) {
|
|
891
|
+
alert('Button action')
|
|
892
|
+
}
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
```
|
|
896
|
+
|
|
897
|
+
```json
|
|
898
|
+
{
|
|
899
|
+
"type": "button",
|
|
900
|
+
"title": "Search",
|
|
901
|
+
"options": {
|
|
902
|
+
"button": {
|
|
903
|
+
"icon": "search",
|
|
904
|
+
"action": "myAction",
|
|
905
|
+
"validated": true
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
```
|
|
910
|
+
|
|
911
|
+
#### Info editor
|
|
912
|
+
|
|
913
|
+
Displays a label and a description text.
|
|
914
|
+
|
|
915
|
+
```json
|
|
916
|
+
{
|
|
917
|
+
"type": "info",
|
|
918
|
+
"title": "Important:",
|
|
919
|
+
"description": "Lorem ipsum dolor"
|
|
920
|
+
}
|
|
921
|
+
```
|
|
922
|
+
|
|
870
923
|
#### Booleans
|
|
871
924
|
|
|
872
925
|
The default boolean editor is a select box with options "true" and "false". To use a checkbox instead, set the format to `checkbox`.
|
|
@@ -1035,23 +1088,24 @@ Editor Options
|
|
|
1035
1088
|
|
|
1036
1089
|
Editors can accept options which alter the behavior in some way.
|
|
1037
1090
|
|
|
1038
|
-
*
|
|
1039
|
-
*
|
|
1040
|
-
*
|
|
1041
|
-
*
|
|
1042
|
-
*
|
|
1043
|
-
*
|
|
1044
|
-
*
|
|
1045
|
-
*
|
|
1046
|
-
*
|
|
1047
|
-
*
|
|
1048
|
-
*
|
|
1049
|
-
*
|
|
1050
|
-
*
|
|
1051
|
-
*
|
|
1052
|
-
*
|
|
1053
|
-
*
|
|
1054
|
-
*
|
|
1091
|
+
* `collapsed` - If set to true, the editor will start collapsed (works for objects and arrays)
|
|
1092
|
+
* `disable_array_add` - If set to true, the "add row" button will be hidden (works for arrays)
|
|
1093
|
+
* `disable_array_delete` - If set to true, all of the "delete" buttons will be hidden (works for arrays)
|
|
1094
|
+
* `disable_array_delete_all_rows` - If set to true, just the "delete all rows" button will be hidden (works for arrays)
|
|
1095
|
+
* `disable_array_delete_last_row` - If set to true, just the "delete last row" buttons will be hidden (works for arrays)
|
|
1096
|
+
* `disable_array_reorder` - If set to true, the "move up/down" buttons will be hidden (works for arrays)
|
|
1097
|
+
* `disable_collapse` - If set to true, the collapse button will be hidden (works for objects and arrays)
|
|
1098
|
+
* `disable_edit_json` - If set to true, the Edit JSON button will be hidden (works for objects)
|
|
1099
|
+
* `disable_properties` - If set to true, the Edit Properties button will be hidden (works for objects)
|
|
1100
|
+
* `array_controls_top` - If set to true, array controls (add, delete etc) will be displayed at top of list (works for arrays)
|
|
1101
|
+
* `enum` - See [Enum options](#enum-options)
|
|
1102
|
+
* `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.
|
|
1103
|
+
* `expand_height` - If set to true, the input will auto expand/contract to fit the content. Works best with textareas.
|
|
1104
|
+
* `grid_columns` - Explicitly set the number of grid columns (1-12) for the editor if it's within an object using a grid layout.
|
|
1105
|
+
* `hidden` - If set to true, the editor will not appear in the UI (works for all types)
|
|
1106
|
+
* `input_height` - Explicitly set the height of the input element. Should be a valid CSS width string (e.g. "100px"). Works best with textareas.
|
|
1107
|
+
* `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.
|
|
1108
|
+
* `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().
|
|
1055
1109
|
|
|
1056
1110
|
```json
|
|
1057
1111
|
{
|
|
@@ -1086,6 +1140,43 @@ Using the option `infoText`, will create a info button, displaying the text you
|
|
|
1086
1140
|
}
|
|
1087
1141
|
```
|
|
1088
1142
|
|
|
1143
|
+
Enum options
|
|
1144
|
+
------------------
|
|
1145
|
+
|
|
1146
|
+
Using the option `enum`, it is possible to modify how enums with format `checkbox` (default) are displayed in the editor.
|
|
1147
|
+
It is an array of objects (described below), which must be in the same order as defined with the `enum` keyword.
|
|
1148
|
+
|
|
1149
|
+
Currently, the following is supported:
|
|
1150
|
+
|
|
1151
|
+
* `title`: *Optional* Display value shown instead of the enum value
|
|
1152
|
+
* `infoText`: *Optional* Creates an info button next to the title, displaying the text you set, on hovering.
|
|
1153
|
+
|
|
1154
|
+
It is possible also to set these options only for some enum values, to skip one enum value, define an empty object (`{}`).
|
|
1155
|
+
|
|
1156
|
+
```json
|
|
1157
|
+
{
|
|
1158
|
+
"type": "array",
|
|
1159
|
+
"items": {
|
|
1160
|
+
"type": "string",
|
|
1161
|
+
"enum": ["1", "2", "3", "4"],
|
|
1162
|
+
"options": {
|
|
1163
|
+
"enum": [
|
|
1164
|
+
{},
|
|
1165
|
+
{
|
|
1166
|
+
"title": "Title 2"
|
|
1167
|
+
},
|
|
1168
|
+
{ "infoText": "InfoText 3" },
|
|
1169
|
+
{
|
|
1170
|
+
"title": "Title 4",
|
|
1171
|
+
"infoText": "InfoText 4"
|
|
1172
|
+
}
|
|
1173
|
+
]
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
```
|
|
1178
|
+
|
|
1179
|
+
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.
|
|
1089
1180
|
|
|
1090
1181
|
Dependencies
|
|
1091
1182
|
------------------
|
|
@@ -1542,6 +1633,28 @@ By default, all instances of JSON Editor will use the `en` language. To overrid
|
|
|
1542
1633
|
JSONEditor.defaults.language = "es";
|
|
1543
1634
|
```
|
|
1544
1635
|
|
|
1636
|
+
You can also override translations per editor in the it's schema options.
|
|
1637
|
+
|
|
1638
|
+
````json
|
|
1639
|
+
"error_const": {
|
|
1640
|
+
"type": "string",
|
|
1641
|
+
"title": "error_const",
|
|
1642
|
+
"const": "test",
|
|
1643
|
+
"default": "something else",
|
|
1644
|
+
"options": {
|
|
1645
|
+
"error_messages": {
|
|
1646
|
+
"en": {
|
|
1647
|
+
"error_const": "CUSTOM EN: Value must be the constant value"
|
|
1648
|
+
},
|
|
1649
|
+
"es": {
|
|
1650
|
+
"error_const": "CUSTOM ES: Value must be the constant value"
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
}
|
|
1654
|
+
}
|
|
1655
|
+
````
|
|
1656
|
+
|
|
1657
|
+
|
|
1545
1658
|
Button Customization
|
|
1546
1659
|
-----------------
|
|
1547
1660
|
|