@json-editor/json-editor 2.14.1 → 2.15.1
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/.eslintrc +4 -1
- package/.github/workflows/build.yml +5 -4
- package/CHANGELOG.md +25 -0
- package/README.md +32 -1
- package/config/codeceptjs_helpers.js +11 -0
- package/config/webpack.common.js +2 -6
- package/dist/jsoneditor.js +1 -1
- package/dist/jsoneditor.js.LICENSE.txt +1 -1
- package/dist/nonmin/jsoneditor.js +4124 -3939
- package/dist/nonmin/jsoneditor.js.map +1 -1
- package/docs/meta-schema.html +793 -0
- package/package.json +13 -13
- package/src/core.js +5 -1
- package/src/defaults.js +9 -2
- package/src/editor.js +33 -14
- package/src/editors/array.js +3 -6
- package/src/editors/base64.js +3 -0
- package/src/editors/describedby.js +2 -2
- package/src/editors/enum.js +9 -1
- package/src/editors/info.js +8 -0
- package/src/editors/multiple.js +9 -2
- package/src/editors/object.js +26 -7
- package/src/editors/radio.js +5 -2
- package/src/editors/select.js +23 -8
- package/src/editors/select2.js +1 -1
- package/src/editors/starrating.js +5 -4
- package/src/editors/string.js +16 -2
- package/src/editors/table.js +2 -2
- package/src/iconlib.js +0 -1
- package/src/schemaloader.js +2 -2
- package/src/style.css +4 -0
- package/src/style.css.js +1 -1
- package/src/templates/default.js +2 -2
- package/src/theme.js +13 -3
- package/src/themes/index.js +0 -1
- package/src/validator.js +4 -4
- package/tests/Dockerfile +1 -1
- package/tests/codeceptjs/core_test.js +8 -2
- package/tests/codeceptjs/editors/array_test.js +11 -6
- package/tests/codeceptjs/editors/autocomplete_test.js +0 -1
- package/tests/codeceptjs/editors/integer_test.js +3 -5
- package/tests/codeceptjs/editors/object_test.js +8 -0
- package/tests/codeceptjs/editors/rating_test.js +1 -1
- package/tests/codeceptjs/editors/select_test.js +30 -0
- package/tests/codeceptjs/editors/starrating_test.js +15 -0
- package/tests/codeceptjs/editors/string_test.js +7 -0
- package/tests/codeceptjs/issues/issue-gh-1158_test.js +1 -1
- package/tests/codeceptjs/issues/issue-gh-1164_test.js +0 -1
- package/tests/codeceptjs/issues/issue-gh-1383_test.js +1 -1
- package/tests/codeceptjs/issues/issue-gh-1452_test.js +10 -0
- package/tests/codeceptjs/issues/issue-gh-1525_test.js +9 -0
- package/tests/codeceptjs/issues/issue-gh-1536_test.js +12 -0
- package/tests/codeceptjs/issues/issue-gh-1538_test.js +10 -0
- package/tests/codeceptjs/issues/issue-gh-1541_test.js +8 -0
- package/tests/docker-compose.yml +0 -1
- package/tests/pages/array-events-table.html +39 -31
- package/tests/pages/array-events.html +39 -31
- package/tests/pages/assets/autocomplete.css +1 -0
- package/tests/pages/assets/autocomplete.min.js +1 -0
- package/tests/pages/autocomplete.html +4 -4
- package/tests/pages/enforce-const.html +176 -0
- package/tests/pages/integer.html +9 -10
- package/tests/pages/issues/issue-gh-1452.html +98 -0
- package/tests/pages/issues/issue-gh-1525.html +62 -0
- package/tests/pages/issues/issue-gh-1536.html +55 -0
- package/tests/pages/issues/issue-gh-1538.html +56 -0
- package/tests/pages/issues/issue-gh-1541.html +51 -0
- package/tests/pages/issues/issue-gh-1541.json +9 -0
- package/tests/pages/placeholder-options.html +57 -0
- package/tests/pages/prompt-paste-max-length-reached.html +51 -0
- package/tests/pages/remove-false-properties.html +85 -0
- package/tests/pages/select-values.html +91 -0
- package/tests/pages/starrating.html +86 -0
- package/tests/unit/editor.spec.js +1 -1
package/.eslintrc
CHANGED
|
@@ -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
|
|
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@
|
|
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
|
|
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,30 @@
|
|
|
1
1
|
### Unreleased
|
|
2
2
|
|
|
3
|
+
### 2.15.1
|
|
4
|
+
|
|
5
|
+
- Fixed #1563 and #1558. Select values not displayed
|
|
6
|
+
|
|
7
|
+
### 2.15.0
|
|
8
|
+
|
|
9
|
+
- Added option enforce_const
|
|
10
|
+
- Fixed #1525 select2 setValue append new item
|
|
11
|
+
- Added remove_false_properties object option
|
|
12
|
+
- Updated GitHub workflows
|
|
13
|
+
- Added prompt_paste_max_length_reached option
|
|
14
|
+
- Fixed #1512 "dependencies" autocomplete inside array tables cropping
|
|
15
|
+
- Allow for Base64 custom input attributes
|
|
16
|
+
- Added 'add' and 'switch' events
|
|
17
|
+
- Fixed "dependencies" issues
|
|
18
|
+
- Fixed npm audits and packages upgrades
|
|
19
|
+
- Fixed issue #1541 Failure to parse schema with "default"
|
|
20
|
+
- Fixed rating "undefined" value when type of integer
|
|
21
|
+
- Added meta-schema example to the readme
|
|
22
|
+
- Fixed issue #1514 Cannot use more than one class in "class" option for links
|
|
23
|
+
- Fixed info disable/enable
|
|
24
|
+
- Added options: "has_placeholder_option" and "placeholder_option_text"
|
|
25
|
+
- Fixed issue #1498 Dependant fields not created after JSON update at change of the controlling field
|
|
26
|
+
- Added 'copyRow' event
|
|
27
|
+
|
|
3
28
|
### 2.14.1
|
|
4
29
|
|
|
5
30
|
- 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
|
{
|
|
@@ -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) {
|
package/config/webpack.common.js
CHANGED
|
@@ -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 }}',
|