@json-editor/json-editor 2.5.2 → 2.6.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 +5 -2
- package/.github/PULL_REQUEST_TEMPLATE.md +6 -6
- package/.github/workflows/build.yml +58 -0
- package/CHANGELOG.md +41 -1
- package/CONTRIBUTING.md +1 -1
- package/README.md +39 -4
- package/README_ADDON.md +65 -0
- package/config/codeceptjs_helpers.js +4 -0
- package/dist/jsoneditor.js +2 -2
- package/dist/nonmin/jsoneditor.js +3711 -3324
- 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/index.html +4 -2
- package/docs/materialize_css.html +1 -1
- package/docs/meta_schema.json +0 -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 +27 -26
- package/release-notes.md +9 -9
- package/src/core.js +1 -0
- package/src/defaults.js +182 -94
- package/src/editor.js +28 -9
- package/src/editors/array.js +20 -16
- package/src/editors/autocomplete.js +1 -0
- package/src/editors/base64.js +5 -4
- package/src/editors/button.js +2 -2
- package/src/editors/checkbox.js +3 -3
- package/src/editors/datetime.js +2 -2
- package/src/editors/info.js +1 -1
- package/src/editors/multiple.js +8 -2
- package/src/editors/multiselect.js +5 -3
- package/src/editors/object.js +35 -21
- package/src/editors/radio.js +9 -4
- package/src/editors/select.js +6 -6
- package/src/editors/signature.js +3 -2
- package/src/editors/starrating.js +5 -5
- package/src/editors/string.js +6 -4
- package/src/editors/table.js +24 -14
- package/src/editors/upload.js +4 -3
- package/src/editors/uuid.js +1 -1
- package/src/iconlibs/index.js +2 -0
- package/src/iconlibs/openiconic.js +28 -0
- package/src/schemaloader.js +112 -28
- package/src/theme.js +6 -3
- package/src/themes/bootstrap3.js +4 -4
- package/src/themes/bootstrap4.js +11 -3
- package/src/themes/html.js +1 -2
- package/src/themes/materialize.js +1 -1
- package/src/themes/spectre.js +11 -8
- package/src/themes/tailwind.js +1 -1
- package/src/validator.js +128 -16
- package/tests/codeceptjs/core_test.js +125 -1
- package/tests/codeceptjs/editors/array_test.js +13 -11
- package/tests/codeceptjs/editors/button_test.js +6 -1
- package/tests/codeceptjs/editors/issues/issue-gh-812_test.js +32 -0
- package/tests/codeceptjs/editors/number_test.js +1 -1
- package/tests/codeceptjs/editors/object_test.js +216 -100
- package/tests/codeceptjs/editors/programmatic-changes_test.js +3 -1
- package/tests/codeceptjs/editors/radio_test.js +10 -0
- package/tests/codeceptjs/editors/rating_test.js +10 -11
- package/tests/codeceptjs/editors/select_test.js +17 -15
- package/tests/codeceptjs/editors/stepper_test.js +13 -1
- package/tests/codeceptjs/editors/string_test.js +81 -80
- package/tests/codeceptjs/editors/table-confirm-delete_test.js +58 -56
- package/tests/codeceptjs/editors/tabs_test.js +12 -10
- package/tests/codeceptjs/editors/validation_test.js +10 -8
- package/tests/codeceptjs/meta-schema_test.js +13 -14
- package/tests/codeceptjs/schemaloader_test.js +13 -0
- package/tests/codeceptjs/steps_file.js +4 -3
- package/tests/codeceptjs/themes_test.js +31 -0
- package/tests/docker-compose.yml +4 -3
- package/tests/fixtures/validation.json +382 -1
- package/tests/pages/_demo.html +2 -0
- package/tests/pages/anyof.html +80 -0
- package/tests/pages/issues/issue-gh-812.html +110 -0
- package/tests/pages/issues/issue-gh-848.html +81 -0
- package/tests/pages/meta_schema.json +0 -1
- package/tests/pages/object-no-additional-properties.html +27 -12
- package/tests/pages/object-required-properties.html +43 -9
- package/tests/pages/object-show-opt-in.html +110 -0
- package/tests/pages/object-with-dependencies-array.html +56 -0
- package/tests/pages/oneof.html +103 -0
- package/tests/pages/read-only.html +19 -4
- package/tests/pages/stepper-manual.html +57 -0
- package/tests/pages/themes.html +2 -0
- package/tests/pages/translate-property.html +247 -0
- package/tests/pages/urn.html +93 -0
- package/tests/unit/core.spec.js +2 -0
- package/tests/unit/defaults.spec.js +4 -2
- package/tests/unit/editor.spec.js +2 -0
- package/tests/unit/editors/array.spec.js +86 -0
- package/tests/unit/editors/table.spec.js +91 -0
- package/tests/unit/schemaloader.spec.js +362 -3
- package/tests/unit/validator.spec.js +14 -2
package/docs/cleave.html
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
11
11
|
|
|
12
12
|
<!-- jQuery -->
|
|
13
|
-
<script src="https://cdn.jsdelivr.net/npm/jquery@3.
|
|
13
|
+
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
|
|
14
14
|
|
|
15
15
|
<!-- Bootstrap4 -->
|
|
16
16
|
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
|
package/docs/datetime.html
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
11
11
|
|
|
12
12
|
<!-- jQuery -->
|
|
13
|
-
<script src="https://cdn.jsdelivr.net/npm/jquery@3.
|
|
13
|
+
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
|
|
14
14
|
|
|
15
15
|
<!-- Bootstrap4 -->
|
|
16
16
|
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
|
package/docs/describedby.html
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
9
9
|
|
|
10
10
|
<!-- jQuery -->
|
|
11
|
-
<script src="https://cdn.jsdelivr.net/npm/jquery@3.
|
|
11
|
+
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
|
|
12
12
|
|
|
13
13
|
<!-- Bootstrap4 -->
|
|
14
14
|
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
|
package/docs/index.html
CHANGED
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
<option value='fontawesome4'>fontawesome 4</option>
|
|
72
72
|
<option value='fontawesome5'>fontawesome 5</option>
|
|
73
73
|
<option value='jqueryui'>jQuery UI</option>
|
|
74
|
+
<option value='openiconic'>Open Iconic</option>
|
|
74
75
|
<option value='spectre'>Spectre</option>
|
|
75
76
|
</select>
|
|
76
77
|
</div>
|
|
@@ -318,6 +319,7 @@
|
|
|
318
319
|
fontawesome4: 'https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.0.3/css/font-awesome.css',
|
|
319
320
|
fontawesome5: 'https://use.fontawesome.com/releases/v5.6.1/css/all.css',
|
|
320
321
|
jqueryui: 'https://code.jquery.com/ui/1.10.3/themes/south-street/jquery-ui.css',
|
|
322
|
+
openiconic: 'https://cdnjs.cloudflare.com/ajax/libs/open-iconic/1.1.1/font/css/open-iconic.min.css',
|
|
321
323
|
spectre: 'https://unpkg.com/spectre.css/dist/spectre-icons.min.css'
|
|
322
324
|
}
|
|
323
325
|
iconlibLink.href = iconLibMap[data.options.iconlib]
|
|
@@ -362,7 +364,7 @@
|
|
|
362
364
|
},
|
|
363
365
|
sceditor: {
|
|
364
366
|
js: [
|
|
365
|
-
'https://cdn.jsdelivr.net/npm/jquery@3.
|
|
367
|
+
'https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js',
|
|
366
368
|
'https://cdn.jsdelivr.net/npm/sceditor@2.1.3/minified/sceditor.min.js',
|
|
367
369
|
'https://cdn.jsdelivr.net/npm/sceditor@2.1.3/minified/formats/bbcode.js',
|
|
368
370
|
'https://cdn.jsdelivr.net/npm/sceditor@2.1.3/minified/formats/xhtml.js'
|
|
@@ -381,7 +383,7 @@
|
|
|
381
383
|
},
|
|
382
384
|
select2: {
|
|
383
385
|
js: [
|
|
384
|
-
'https://cdn.jsdelivr.net/npm/jquery@3.
|
|
386
|
+
'https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js',
|
|
385
387
|
'https://cdn.jsdelivr.net/npm/select2@4.0.6-rc.1/dist/js/select2.min.js'
|
|
386
388
|
],
|
|
387
389
|
css: [
|
|
@@ -75,7 +75,7 @@
|
|
|
75
75
|
</div>
|
|
76
76
|
</div>
|
|
77
77
|
|
|
78
|
-
<script type="text/javascript" src="https://code.jquery.com/jquery-3.
|
|
78
|
+
<script type="text/javascript" src="https://code.jquery.com/jquery-3.5.0.min.js"></script>
|
|
79
79
|
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/materialize/1.0.0/js/materialize.min.js"></script>
|
|
80
80
|
|
|
81
81
|
<script>
|
package/docs/meta_schema.json
CHANGED
package/docs/radio.html
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
11
11
|
|
|
12
12
|
<!-- jQuery -->
|
|
13
|
-
<script src="https://cdn.jsdelivr.net/npm/jquery@3.
|
|
13
|
+
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
|
|
14
14
|
|
|
15
15
|
<!-- Bootstrap4 -->
|
|
16
16
|
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
|
package/docs/select2.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<title>JSON Editor Select2 Integration Example</title>
|
|
6
6
|
<!-- jQuery -->
|
|
7
|
-
<script src="https://cdn.jsdelivr.net/npm/jquery@3.
|
|
7
|
+
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
|
|
8
8
|
|
|
9
9
|
<script src="https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/jsoneditor.min.js"></script>
|
|
10
10
|
|
package/docs/selectize.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<title>JSON Editor Selectize Integration Example</title>
|
|
6
6
|
<!-- jQuery -->
|
|
7
|
-
<script src="https://cdn.jsdelivr.net/npm/jquery@3.
|
|
7
|
+
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
|
|
8
8
|
|
|
9
9
|
<script src="https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/jsoneditor.min.js"></script>
|
|
10
10
|
|
package/docs/starrating.html
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
11
11
|
|
|
12
12
|
<!-- jQuery -->
|
|
13
|
-
<script src="https://cdn.jsdelivr.net/npm/jquery@3.
|
|
13
|
+
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
|
|
14
14
|
|
|
15
15
|
<!-- Bootstrap4 -->
|
|
16
16
|
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">
|
package/docs/wysiwyg.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="utf-8" />
|
|
5
5
|
<title>JSON Editor WYSIWYG Example</title>
|
|
6
6
|
<!-- jQuery -->
|
|
7
|
-
<script src="https://cdn.jsdelivr.net/npm/jquery@3.
|
|
7
|
+
<script src="https://cdn.jsdelivr.net/npm/jquery@3.6.0/dist/jquery.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>
|
|
8
8
|
|
|
9
9
|
<script src="https://cdn.jsdelivr.net/npm/@json-editor/json-editor@latest/dist/jsoneditor.min.js"></script>
|
|
10
10
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@json-editor/json-editor",
|
|
3
3
|
"title": "JSONEditor",
|
|
4
4
|
"description": "JSON Schema based editor",
|
|
5
|
-
"version": "2.
|
|
5
|
+
"version": "2.6.1",
|
|
6
6
|
"main": "dist/jsoneditor.js",
|
|
7
7
|
"author": {
|
|
8
8
|
"name": "Jeremy Dorn",
|
|
@@ -53,48 +53,49 @@
|
|
|
53
53
|
"node": ">= 0.8.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@babel/core": "^7.
|
|
57
|
-
"@babel/plugin-transform-runtime": "^7.
|
|
58
|
-
"@babel/preset-env": "^7.
|
|
59
|
-
"@babel/runtime": "^7.
|
|
60
|
-
"ace-builds": "^1.4.
|
|
61
|
-
"babel-loader": "^8.
|
|
56
|
+
"@babel/core": "^7.14.0",
|
|
57
|
+
"@babel/plugin-transform-runtime": "^7.13.15",
|
|
58
|
+
"@babel/preset-env": "^7.14.1",
|
|
59
|
+
"@babel/runtime": "^7.14.0",
|
|
60
|
+
"ace-builds": "^1.4.12",
|
|
61
|
+
"babel-loader": "^8.2.2",
|
|
62
62
|
"clean-webpack-plugin": "^3.0.0",
|
|
63
|
-
"cleave.js": "^1.
|
|
64
|
-
"codeceptjs": "^2.6.
|
|
65
|
-
"css-loader": "^3.
|
|
63
|
+
"cleave.js": "^1.6.0",
|
|
64
|
+
"codeceptjs": "^2.6.11",
|
|
65
|
+
"css-loader": "^3.6.0",
|
|
66
66
|
"css2json": "^1.1.1",
|
|
67
|
-
"cssnano": "^4.1.
|
|
67
|
+
"cssnano": "^4.1.11",
|
|
68
68
|
"eslint": "^6.8.0",
|
|
69
69
|
"eslint-loader": "^2.2.1",
|
|
70
|
+
"fast-deep-equal": "^3.1.3",
|
|
70
71
|
"http-server": "^0.12.3",
|
|
71
|
-
"jasmine": "^3.
|
|
72
|
-
"jasmine-core": "^3.
|
|
73
|
-
"jodit": "
|
|
74
|
-
"jquery": "^3.
|
|
75
|
-
"karma": "^5.
|
|
72
|
+
"jasmine": "^3.7.0",
|
|
73
|
+
"jasmine-core": "^3.7.1",
|
|
74
|
+
"jodit": "~3.3.24",
|
|
75
|
+
"jquery": "^3.6.0",
|
|
76
|
+
"karma": "^5.2.3",
|
|
76
77
|
"karma-chrome-launcher": "^3.1.0",
|
|
77
78
|
"karma-jasmine": "^2.0.1",
|
|
78
|
-
"karma-jasmine-html-reporter": "^1.
|
|
79
|
-
"karma-sourcemap-loader": "^0.3.
|
|
79
|
+
"karma-jasmine-html-reporter": "^1.6.0",
|
|
80
|
+
"karma-sourcemap-loader": "^0.3.8",
|
|
80
81
|
"karma-webpack": "^4.0.2",
|
|
81
|
-
"mathjs": "^
|
|
82
|
+
"mathjs": "^7.5.1",
|
|
82
83
|
"mini-css-extract-plugin": "^0.8.2",
|
|
83
84
|
"mocha": "^6.2.2",
|
|
84
85
|
"mochawesome": "^4.1.0",
|
|
85
|
-
"postcss-loader": "^
|
|
86
|
+
"postcss-loader": "^5.2.0",
|
|
86
87
|
"puppeteer": "^1.20.0",
|
|
87
88
|
"remove-strict-webpack-plugin": "^0.1.2",
|
|
88
89
|
"sceditor": "^2.1.3",
|
|
89
90
|
"sinon": "^8.1.1",
|
|
90
|
-
"standard": "^14.3.
|
|
91
|
-
"style-loader": "^1.
|
|
92
|
-
"webpack": "^4.
|
|
93
|
-
"webpack-cli": "^3.3.
|
|
94
|
-
"webpack-dev-server": "^3.11.
|
|
91
|
+
"standard": "^14.3.4",
|
|
92
|
+
"style-loader": "^1.3.0",
|
|
93
|
+
"webpack": "^4.46.0",
|
|
94
|
+
"webpack-cli": "^3.3.12",
|
|
95
|
+
"webpack-dev-server": "^3.11.2",
|
|
95
96
|
"webpack-merge": "^4.2.2"
|
|
96
97
|
},
|
|
97
98
|
"dependencies": {
|
|
98
|
-
"core-js": "^3.
|
|
99
|
+
"core-js": "^3.12.1"
|
|
99
100
|
}
|
|
100
101
|
}
|
package/release-notes.md
CHANGED
|
@@ -77,12 +77,12 @@ Aditionally, all editors had a single dependency on `JSONEditor` via the `.defa
|
|
|
77
77
|
|
|
78
78
|
For now I have passed in `JSONEditor.defaults` as `defaults`.
|
|
79
79
|
|
|
80
|
-
### NPM Release
|
|
81
|
-
|
|
82
|
-
1.
|
|
83
|
-
2.
|
|
84
|
-
3. NPM login: `npm login`
|
|
85
|
-
4. Build new version: `npm version 2.
|
|
86
|
-
|
|
87
|
-
The `npm version` command will automatically build the source files & test the new generated script files.
|
|
88
|
-
On success the `postversion` script will push the source to GitHub and publish the version on NPM.
|
|
80
|
+
### NPM Release
|
|
81
|
+
|
|
82
|
+
1. Update `CHANGELOG.md`
|
|
83
|
+
2. Switch to `release` branch and `merge master into release`
|
|
84
|
+
3. NPM login: `npm login`
|
|
85
|
+
4. Build new version: `npm version 2.x.x`
|
|
86
|
+
|
|
87
|
+
The `npm version` command will automatically build the source files & test the new generated script files.
|
|
88
|
+
On success the `postversion` script will push the source to GitHub and publish the version on NPM.
|
package/src/core.js
CHANGED
|
@@ -22,6 +22,7 @@ export class JSONEditor {
|
|
|
22
22
|
this.schema = this.options.schema
|
|
23
23
|
this.template = this.options.template
|
|
24
24
|
this.translate = this.options.translate || JSONEditor.defaults.translate
|
|
25
|
+
this.translateProperty = this.options.translateProperty || JSONEditor.defaults.translateProperty
|
|
25
26
|
this.uuid = 0
|
|
26
27
|
this.__data = {}
|
|
27
28
|
const themeName = this.options.theme || JSONEditor.defaults.theme
|
package/src/defaults.js
CHANGED
|
@@ -29,164 +29,229 @@ languages.en = {
|
|
|
29
29
|
*/
|
|
30
30
|
error_notset: 'Property must be set',
|
|
31
31
|
/**
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
* When a string must not be empty
|
|
33
|
+
*/
|
|
34
34
|
error_notempty: 'Value required',
|
|
35
35
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
36
|
+
* When a value is not one of the enumerated values
|
|
37
|
+
*/
|
|
38
38
|
error_enum: 'Value must be one of the enumerated values',
|
|
39
39
|
/**
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
* When a value is not equal to the constant
|
|
41
|
+
*/
|
|
42
|
+
error_const: 'Value must be the constant value',
|
|
43
|
+
/**
|
|
44
|
+
* When a value doesn't validate any schema of a 'anyOf' combination
|
|
45
|
+
*/
|
|
42
46
|
error_anyOf: 'Value must validate against at least one of the provided schemas',
|
|
43
47
|
/**
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
48
|
+
* When a value doesn't validate
|
|
49
|
+
* @variables This key takes one variable: The number of schemas the value does not validate
|
|
50
|
+
*/
|
|
47
51
|
error_oneOf: 'Value must validate against exactly one of the provided schemas. It currently validates against {{0}} of the schemas.',
|
|
48
52
|
/**
|
|
49
|
-
|
|
50
|
-
|
|
53
|
+
* When a value does not validate a 'not' schema
|
|
54
|
+
*/
|
|
51
55
|
error_not: 'Value must not validate against the provided schema',
|
|
52
56
|
/**
|
|
53
|
-
|
|
54
|
-
|
|
57
|
+
* When a value does not match any of the provided types
|
|
58
|
+
*/
|
|
55
59
|
error_type_union: 'Value must be one of the provided types',
|
|
56
60
|
/**
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
61
|
+
* When a value does not match the given type
|
|
62
|
+
* @variables This key takes one variable: The type the value should be of
|
|
63
|
+
*/
|
|
60
64
|
error_type: 'Value must be of type {{0}}',
|
|
61
65
|
/**
|
|
62
|
-
|
|
63
|
-
|
|
66
|
+
* When the value validates one of the disallowed types
|
|
67
|
+
*/
|
|
64
68
|
error_disallow_union: 'Value must not be one of the provided disallowed types',
|
|
65
69
|
/**
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
* When the value validates a disallowed type
|
|
71
|
+
* @variables This key takes one variable: The type the value should not be of
|
|
72
|
+
*/
|
|
69
73
|
error_disallow: 'Value must not be of type {{0}}',
|
|
70
74
|
/**
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
75
|
+
* When a value is not a multiple of or divisible by a given number
|
|
76
|
+
* @variables This key takes one variable: The number mentioned above
|
|
77
|
+
*/
|
|
74
78
|
error_multipleOf: 'Value must be a multiple of {{0}}',
|
|
75
79
|
/**
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
80
|
+
* When a value is greater than it's supposed to be (exclusive)
|
|
81
|
+
* @variables This key takes one variable: The maximum
|
|
82
|
+
*/
|
|
79
83
|
error_maximum_excl: 'Value must be less than {{0}}',
|
|
80
84
|
/**
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
* When a value is greater than it's supposed to be (inclusive
|
|
86
|
+
* @variables This key takes one variable: The maximum
|
|
87
|
+
*/
|
|
84
88
|
error_maximum_incl: 'Value must be at most {{0}}',
|
|
85
89
|
/**
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
90
|
+
* When a value is lesser than it's supposed to be (exclusive)
|
|
91
|
+
* @variables This key takes one variable: The minimum
|
|
92
|
+
*/
|
|
89
93
|
error_minimum_excl: 'Value must be greater than {{0}}',
|
|
90
94
|
/**
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
95
|
+
* When a value is lesser than it's supposed to be (inclusive)
|
|
96
|
+
* @variables This key takes one variable: The minimum
|
|
97
|
+
*/
|
|
94
98
|
error_minimum_incl: 'Value must be at least {{0}}',
|
|
95
99
|
/**
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
100
|
+
* When a value have too many characters
|
|
101
|
+
* @variables This key takes one variable: The maximum character count
|
|
102
|
+
*/
|
|
99
103
|
error_maxLength: 'Value must be at most {{0}} characters long',
|
|
100
104
|
/**
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
105
|
+
* When a value does not have enough characters
|
|
106
|
+
* @variables This key takes one variable: The minimum character count
|
|
107
|
+
*/
|
|
104
108
|
error_minLength: 'Value must be at least {{0}} characters long',
|
|
105
109
|
/**
|
|
106
|
-
|
|
107
|
-
|
|
110
|
+
* When a value does not match a given pattern
|
|
111
|
+
*/
|
|
108
112
|
error_pattern: 'Value must match the pattern {{0}}',
|
|
109
113
|
/**
|
|
110
|
-
|
|
111
|
-
|
|
114
|
+
* When an array has additional items whereas it is not supposed to
|
|
115
|
+
*/
|
|
112
116
|
error_additionalItems: 'No additional items allowed in this array',
|
|
113
117
|
/**
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
118
|
+
* When there are to many items in an array
|
|
119
|
+
* @variables This key takes one variable: The maximum item count
|
|
120
|
+
*/
|
|
117
121
|
error_maxItems: 'Value must have at most {{0}} items',
|
|
118
122
|
/**
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
123
|
+
* When there are not enough items in an array
|
|
124
|
+
* @variables This key takes one variable: The minimum item count
|
|
125
|
+
*/
|
|
122
126
|
error_minItems: 'Value must have at least {{0}} items',
|
|
123
127
|
/**
|
|
124
|
-
|
|
125
|
-
|
|
128
|
+
* When an array is supposed to have unique items but has duplicates
|
|
129
|
+
*/
|
|
126
130
|
error_uniqueItems: 'Array must have unique items',
|
|
127
131
|
/**
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
132
|
+
* When there are too many properties in an object
|
|
133
|
+
* @variables This key takes one variable: The maximum property count
|
|
134
|
+
*/
|
|
131
135
|
error_maxProperties: 'Object must have at most {{0}} properties',
|
|
132
136
|
/**
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
137
|
+
* When there are not enough properties in an object
|
|
138
|
+
* @variables This key takes one variable: The minimum property count
|
|
139
|
+
*/
|
|
136
140
|
error_minProperties: 'Object must have at least {{0}} properties',
|
|
137
141
|
/**
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
142
|
+
* When a required property is not defined
|
|
143
|
+
* @variables This key takes one variable: The name of the missing property
|
|
144
|
+
*/
|
|
141
145
|
error_required: "Object is missing the required property '{{0}}'",
|
|
142
146
|
/**
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
147
|
+
* When there is an additional property is set whereas there should be none
|
|
148
|
+
* @variables This key takes one variable: The name of the additional property
|
|
149
|
+
*/
|
|
146
150
|
error_additional_properties: 'No additional properties allowed, but property {{0}} is set',
|
|
147
151
|
/**
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
152
|
+
* When there is a propertyName that sets a max length and a property name exceeds the max length
|
|
153
|
+
* @variables This key takes one variable: The name of the invalid property
|
|
154
|
+
*/
|
|
155
|
+
error_property_names_exceeds_maxlength: 'Property name {{0}} exceeds maxLength',
|
|
156
|
+
/**
|
|
157
|
+
* When there is a propertyName that sets an enum and a property name matches none of the possible enum
|
|
158
|
+
* @variables This key takes one variable: The name of the invalid property
|
|
159
|
+
*/
|
|
160
|
+
error_property_names_enum_mismatch: 'Property name {{0}} does not match any enum values',
|
|
161
|
+
/**
|
|
162
|
+
* When there is a propertyName that sets a const and a property does not match the const value
|
|
163
|
+
* @variables This key takes one variable: The name of the invalid property
|
|
164
|
+
*/
|
|
165
|
+
error_property_names_const_mismatch: 'Property name {{0}} does not match the const value',
|
|
166
|
+
/**
|
|
167
|
+
* When there is a propertyName that sets a pattern and a property name does not match the pattern
|
|
168
|
+
* @variables This key takes one variable: The name of the invalid property
|
|
169
|
+
*/
|
|
170
|
+
error_property_names_pattern_mismatch: 'Property name {{0}} does not match pattern',
|
|
171
|
+
/**
|
|
172
|
+
* When the propertyName is set to false and there is at least one property
|
|
173
|
+
* @variables This key takes one variable: The name of the invalid property
|
|
174
|
+
*/
|
|
175
|
+
error_property_names_false: 'Property name {{0}} fails when propertyName is false',
|
|
176
|
+
/**
|
|
177
|
+
* When the propertyName specifies a maxLength that is not a number
|
|
178
|
+
* @variables This key takes one variable: The name of the current property
|
|
179
|
+
*/
|
|
180
|
+
error_property_names_maxlength: 'Property name {{0}} cannot match invalid maxLength',
|
|
181
|
+
/**
|
|
182
|
+
* When the propertyName specifies an enum that is not an array
|
|
183
|
+
* @variables This key takes one variable: The name of the current property
|
|
184
|
+
*/
|
|
185
|
+
error_property_names_enum: 'Property name {{0}} cannot match invalid enum',
|
|
186
|
+
/**
|
|
187
|
+
* When the propertyName specifies a pattern that is not a string
|
|
188
|
+
* @variables This key takes one variable: The name of the current property
|
|
189
|
+
*/
|
|
190
|
+
error_property_names_pattern: 'Property name {{0}} cannot match invalid pattern',
|
|
191
|
+
/**
|
|
192
|
+
* When the propertyName is unsupported
|
|
193
|
+
* @variables This key takes one variable: The name of the invalid propertyName
|
|
194
|
+
*/
|
|
195
|
+
error_property_names_unsupported: 'Unsupported propertyName {{0}}',
|
|
196
|
+
/**
|
|
197
|
+
* When a dependency is not resolved
|
|
198
|
+
* @variables This key takes one variable: The name of the missing property for the dependency
|
|
199
|
+
*/
|
|
151
200
|
error_dependency: 'Must have property {{0}}',
|
|
152
201
|
/**
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
202
|
+
* When a date is in incorrect format
|
|
203
|
+
* @variables This key takes one variable: The valid format
|
|
204
|
+
*/
|
|
156
205
|
error_date: 'Date must be in the format {{0}}',
|
|
157
206
|
/**
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
207
|
+
* When a time is in incorrect format
|
|
208
|
+
* @variables This key takes one variable: The valid format
|
|
209
|
+
*/
|
|
161
210
|
error_time: 'Time must be in the format {{0}}',
|
|
162
211
|
/**
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
212
|
+
* When a datetime-local is in incorrect format
|
|
213
|
+
* @variables This key takes one variable: The valid format
|
|
214
|
+
*/
|
|
166
215
|
error_datetime_local: 'Datetime must be in the format {{0}}',
|
|
167
216
|
/**
|
|
168
|
-
|
|
169
|
-
|
|
217
|
+
* When a integer date is less than 1 January 1970
|
|
218
|
+
*/
|
|
170
219
|
error_invalid_epoch: 'Date must be greater than 1 January 1970',
|
|
171
220
|
/**
|
|
172
|
-
|
|
173
|
-
|
|
221
|
+
* When an IPv4 is in incorrect format
|
|
222
|
+
*/
|
|
174
223
|
error_ipv4: 'Value must be a valid IPv4 address in the form of 4 numbers between 0 and 255, separated by dots',
|
|
175
224
|
/**
|
|
176
|
-
|
|
177
|
-
|
|
225
|
+
* When an IPv6 is in incorrect format
|
|
226
|
+
*/
|
|
178
227
|
error_ipv6: 'Value must be a valid IPv6 address',
|
|
179
228
|
/**
|
|
180
|
-
|
|
181
|
-
|
|
229
|
+
* When a hostname is in incorrect format
|
|
230
|
+
*/
|
|
182
231
|
error_hostname: 'The hostname has the wrong format',
|
|
183
232
|
/**
|
|
184
|
-
|
|
185
|
-
|
|
233
|
+
* Text/Title on Save button
|
|
234
|
+
*/
|
|
235
|
+
button_save: 'Save',
|
|
236
|
+
/**
|
|
237
|
+
* Text/Title on Copy button
|
|
238
|
+
*/
|
|
239
|
+
button_copy: 'Copy',
|
|
240
|
+
/**
|
|
241
|
+
* Text/Title on Cancel button
|
|
242
|
+
*/
|
|
243
|
+
button_cancel: 'Cancel',
|
|
244
|
+
/**
|
|
245
|
+
* Text/Title on Add button
|
|
246
|
+
*/
|
|
247
|
+
button_add: 'Add',
|
|
248
|
+
/**
|
|
249
|
+
* Text on Delete All buttons
|
|
250
|
+
*/
|
|
186
251
|
button_delete_all: 'All',
|
|
187
252
|
/**
|
|
188
|
-
|
|
189
|
-
|
|
253
|
+
* Title on Delete All buttons
|
|
254
|
+
*/
|
|
190
255
|
button_delete_all_title: 'Delete All',
|
|
191
256
|
/**
|
|
192
257
|
* Text on Delete Last buttons
|
|
@@ -212,10 +277,19 @@ languages.en = {
|
|
|
212
277
|
*/
|
|
213
278
|
button_move_up_title: 'Move up',
|
|
214
279
|
/**
|
|
280
|
+
* Text on Object Properties buttons
|
|
281
|
+
*/
|
|
282
|
+
button_properties: 'Properties',
|
|
283
|
+
/**
|
|
215
284
|
* Title on Object Properties buttons
|
|
216
285
|
*/
|
|
217
286
|
button_object_properties: 'Object Properties',
|
|
218
287
|
/**
|
|
288
|
+
* Title on Copy Row button
|
|
289
|
+
* @variable This key takes one variable: The title of object to delete
|
|
290
|
+
*/
|
|
291
|
+
button_copy_row_title: 'Copy {{0}}',
|
|
292
|
+
/**
|
|
219
293
|
* Title on Delete Row buttons
|
|
220
294
|
* @variable This key takes one variable: The title of object to delete
|
|
221
295
|
*/
|
|
@@ -237,6 +311,14 @@ languages.en = {
|
|
|
237
311
|
*/
|
|
238
312
|
button_expand: 'Expand',
|
|
239
313
|
/**
|
|
314
|
+
* Title on Edit JSON buttons
|
|
315
|
+
*/
|
|
316
|
+
button_edit_json: 'Edit JSON',
|
|
317
|
+
/**
|
|
318
|
+
* Text/Title on Upload buttons
|
|
319
|
+
*/
|
|
320
|
+
button_upload: 'Upload',
|
|
321
|
+
/**
|
|
240
322
|
* Title on Flatpickr toggle buttons
|
|
241
323
|
*/
|
|
242
324
|
flatpickr_toggle_button: 'Toggle',
|
|
@@ -263,6 +345,7 @@ Object.entries(editors).forEach(([i, editor]) => { editors[i].options = editor.o
|
|
|
263
345
|
|
|
264
346
|
/* Default upload handler */
|
|
265
347
|
function upload (type, file, cbs) {
|
|
348
|
+
// eslint-disable-next-line no-console
|
|
266
349
|
console.log('Upload handler required for upload editor')
|
|
267
350
|
}
|
|
268
351
|
|
|
@@ -271,9 +354,7 @@ function translate (key, variables) {
|
|
|
271
354
|
const lang = defaults.languages[defaults.language]
|
|
272
355
|
if (!lang) throw new Error(`Unknown language ${defaults.language}`)
|
|
273
356
|
|
|
274
|
-
let string = lang[key] || defaults.languages[default_language][key]
|
|
275
|
-
|
|
276
|
-
if (typeof string === 'undefined') throw new Error(`Unknown translate string ${key}`)
|
|
357
|
+
let string = lang[key] || defaults.languages[default_language][key] || key
|
|
277
358
|
|
|
278
359
|
if (variables) {
|
|
279
360
|
for (let i = 0; i < variables.length; i++) {
|
|
@@ -284,6 +365,12 @@ function translate (key, variables) {
|
|
|
284
365
|
return string
|
|
285
366
|
}
|
|
286
367
|
|
|
368
|
+
/* Text element translate function */
|
|
369
|
+
|
|
370
|
+
function translateProperty (text, variables) {
|
|
371
|
+
return text
|
|
372
|
+
}
|
|
373
|
+
|
|
287
374
|
/* Default options when initializing JSON Editor */
|
|
288
375
|
const options = {
|
|
289
376
|
upload,
|
|
@@ -307,5 +394,6 @@ export const defaults = {
|
|
|
307
394
|
custom_validators,
|
|
308
395
|
default_language,
|
|
309
396
|
language,
|
|
310
|
-
translate
|
|
397
|
+
translate,
|
|
398
|
+
translateProperty
|
|
311
399
|
}
|