@wirenboard/json-editor 2.5.3-wb13
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/.env-dist +2 -0
- package/.eslintrc +7 -0
- package/.gitattributes +1 -0
- package/.github/PULL_REQUEST_TEMPLATE.md +9 -0
- package/.github/issue_template +25 -0
- package/.github/workflows/build.yml +58 -0
- package/.travis.yml +70 -0
- package/CHANGELOG.md +915 -0
- package/CONTRIBUTING.md +92 -0
- package/LICENSE +20 -0
- package/Makefile +26 -0
- package/README.md +1646 -0
- package/README_ADDON.md +573 -0
- package/UPGRADING.md +46 -0
- package/build/CssToJson.js +55 -0
- package/codecept.conf.js +35 -0
- package/config/.eslintrc +7 -0
- package/config/codeceptjs_helpers.js +139 -0
- package/config/helpers.js +10 -0
- package/config/karma.conf.js +93 -0
- package/config/readme.md +31 -0
- package/config/webpack.common.js +75 -0
- package/config/webpack.dev.js +15 -0
- package/config/webpack.nonmin.js +19 -0
- package/config/webpack.prod.js +25 -0
- package/dist/jsoneditor.js +14 -0
- package/dist/nonmin/jsoneditor.js +29097 -0
- package/dist/nonmin/jsoneditor.js.map +1 -0
- package/docs/ace_editor.html +56 -0
- package/docs/advanced.html +136 -0
- package/docs/basic.html +63 -0
- package/docs/basic_person.json +26 -0
- package/docs/choices.html +86 -0
- package/docs/cleave.html +132 -0
- package/docs/colorpicker.html +194 -0
- package/docs/css_integration.html +135 -0
- package/docs/datetime.html +305 -0
- package/docs/describedby.html +161 -0
- package/docs/enumsource.html +67 -0
- package/docs/images/categoriesDemo.png +0 -0
- package/docs/images/inheritance_tree.png +0 -0
- package/docs/images/jsoneditor.png +0 -0
- package/docs/imask.html +192 -0
- package/docs/index.html +579 -0
- package/docs/materialize_css.html +164 -0
- package/docs/meta_schema.json +705 -0
- package/docs/multiple_upload_base64.html +65 -0
- package/docs/person.json +73 -0
- package/docs/polyfills/assign.js +29 -0
- package/docs/radio.html +156 -0
- package/docs/recursive.html +170 -0
- package/docs/select2.html +99 -0
- package/docs/selectize.html +100 -0
- package/docs/signature.html +42 -0
- package/docs/starrating.html +137 -0
- package/docs/upload.html +131 -0
- package/docs/uuid.html +70 -0
- package/docs/wysiwyg.html +56 -0
- package/jasmine.json +11 -0
- package/json-editor-json-editor-2.5.3-wb13.tgz +0 -0
- package/package.json +100 -0
- package/release-notes.md +88 -0
- package/src/core.js +412 -0
- package/src/defaults.js +402 -0
- package/src/editor.js +707 -0
- package/src/editors/ace.js +89 -0
- package/src/editors/array/choices.js +103 -0
- package/src/editors/array/select2.js +110 -0
- package/src/editors/array/selectize.js +103 -0
- package/src/editors/array.css +9 -0
- package/src/editors/array.css.js +3 -0
- package/src/editors/array.js +818 -0
- package/src/editors/autocomplete.js +58 -0
- package/src/editors/base64.js +157 -0
- package/src/editors/button.js +97 -0
- package/src/editors/checkbox.js +95 -0
- package/src/editors/choices.css +3 -0
- package/src/editors/choices.css.js +3 -0
- package/src/editors/choices.js +69 -0
- package/src/editors/colorpicker.js +103 -0
- package/src/editors/datetime.js +141 -0
- package/src/editors/describedby.js +188 -0
- package/src/editors/enum.js +136 -0
- package/src/editors/hidden.js +127 -0
- package/src/editors/index.js +81 -0
- package/src/editors/info.js +20 -0
- package/src/editors/integer.js +19 -0
- package/src/editors/ip.js +36 -0
- package/src/editors/jodit.js +64 -0
- package/src/editors/multiple.js +409 -0
- package/src/editors/multiselect.js +218 -0
- package/src/editors/null.js +18 -0
- package/src/editors/number.js +51 -0
- package/src/editors/object.css +41 -0
- package/src/editors/object.css.js +3 -0
- package/src/editors/object.js +1290 -0
- package/src/editors/radio.js +111 -0
- package/src/editors/sceditor.js +72 -0
- package/src/editors/select.js +370 -0
- package/src/editors/select2.js +110 -0
- package/src/editors/selectize.js +112 -0
- package/src/editors/signature.js +113 -0
- package/src/editors/simplemde.js +100 -0
- package/src/editors/starrating.css +52 -0
- package/src/editors/starrating.css.js +3 -0
- package/src/editors/starrating.js +135 -0
- package/src/editors/stepper.js +27 -0
- package/src/editors/string.js +372 -0
- package/src/editors/table.js +516 -0
- package/src/editors/upload.js +321 -0
- package/src/editors/uuid.js +56 -0
- package/src/iconlib.js +24 -0
- package/src/iconlibs/bootstrap2.js +28 -0
- package/src/iconlibs/bootstrap3.js +28 -0
- package/src/iconlibs/fontawesome3.js +28 -0
- package/src/iconlibs/fontawesome4.js +28 -0
- package/src/iconlibs/fontawesome5.js +28 -0
- package/src/iconlibs/foundation2.js +24 -0
- package/src/iconlibs/foundation3.js +28 -0
- package/src/iconlibs/index.js +25 -0
- package/src/iconlibs/jqueryui.js +28 -0
- package/src/iconlibs/materialicons.js +49 -0
- package/src/iconlibs/openiconic.js +28 -0
- package/src/iconlibs/spectre.js +28 -0
- package/src/resolvers.js +128 -0
- package/src/schemaloader.js +408 -0
- package/src/style.css +150 -0
- package/src/style.css.js +3 -0
- package/src/templates/default.js +52 -0
- package/src/templates/ejs.js +13 -0
- package/src/templates/handlebars.js +1 -0
- package/src/templates/hogan.js +10 -0
- package/src/templates/index.js +21 -0
- package/src/templates/lodash.js +9 -0
- package/src/templates/markup.js +9 -0
- package/src/templates/mustache.js +9 -0
- package/src/templates/swig.js +1 -0
- package/src/templates/underscore.js +9 -0
- package/src/theme.js +659 -0
- package/src/themes/barebones.css +35 -0
- package/src/themes/barebones.css.js +3 -0
- package/src/themes/barebones.js +28 -0
- package/src/themes/bootstrap2.js +319 -0
- package/src/themes/bootstrap3.css +0 -0
- package/src/themes/bootstrap3.css.js +3 -0
- package/src/themes/bootstrap3.js +315 -0
- package/src/themes/bootstrap4.css +89 -0
- package/src/themes/bootstrap4.css.js +3 -0
- package/src/themes/bootstrap4.js +690 -0
- package/src/themes/bootstrap5.css.js +3 -0
- package/src/themes/foundation.js +569 -0
- package/src/themes/html.css +60 -0
- package/src/themes/html.css.js +3 -0
- package/src/themes/html.js +71 -0
- package/src/themes/index.js +28 -0
- package/src/themes/jqueryui.js +198 -0
- package/src/themes/materialize.js +426 -0
- package/src/themes/spectre.css +208 -0
- package/src/themes/spectre.css.js +3 -0
- package/src/themes/spectre.js +406 -0
- package/src/themes/tailwind.css +249 -0
- package/src/themes/tailwind.css.js +3 -0
- package/src/themes/tailwind.js +443 -0
- package/src/utilities.js +138 -0
- package/src/validator.js +877 -0
- package/src/validators/ip-validator.js +51 -0
- package/tests/Dockerfile +3 -0
- package/tests/README.md +48 -0
- package/tests/codeceptjs/codecept.json +42 -0
- package/tests/codeceptjs/constrains/if-then-else_test.js +143 -0
- package/tests/codeceptjs/core_test.js +217 -0
- package/tests/codeceptjs/editors/advanced_test.js +13 -0
- package/tests/codeceptjs/editors/array_any_of_test.js +50 -0
- package/tests/codeceptjs/editors/array_test.js +900 -0
- package/tests/codeceptjs/editors/button_test.js +35 -0
- package/tests/codeceptjs/editors/checkbox_test.js +21 -0
- package/tests/codeceptjs/editors/colorpicker_test.js +27 -0
- package/tests/codeceptjs/editors/datetime_test.js +33 -0
- package/tests/codeceptjs/editors/inheritance_test.js +11 -0
- package/tests/codeceptjs/editors/integer_test.js +84 -0
- package/tests/codeceptjs/editors/issues/issue-gh-812_test.js +32 -0
- package/tests/codeceptjs/editors/jodit_test.js +24 -0
- package/tests/codeceptjs/editors/multiselect_test.js +8 -0
- package/tests/codeceptjs/editors/number_test.js +82 -0
- package/tests/codeceptjs/editors/object_test.js +204 -0
- package/tests/codeceptjs/editors/option-no_default_values_test.js +42 -0
- package/tests/codeceptjs/editors/programmatic-changes_test.js +20 -0
- package/tests/codeceptjs/editors/radio_test.js +10 -0
- package/tests/codeceptjs/editors/rating_test.js +13 -0
- package/tests/codeceptjs/editors/select_test.js +22 -0
- package/tests/codeceptjs/editors/stepper_test.js +27 -0
- package/tests/codeceptjs/editors/string_test.js +118 -0
- package/tests/codeceptjs/editors/table-confirm-delete_test.js +67 -0
- package/tests/codeceptjs/editors/tabs_test.js +14 -0
- package/tests/codeceptjs/editors/uuid_test.js +21 -0
- package/tests/codeceptjs/editors/validation_test.js +14 -0
- package/tests/codeceptjs/meta-schema_test.js +17 -0
- package/tests/codeceptjs/schemaloader_test.js +13 -0
- package/tests/codeceptjs/steps.d.ts +13 -0
- package/tests/codeceptjs/steps_file.js +12 -0
- package/tests/codeceptjs/themes_test.js +519 -0
- package/tests/docker-compose.yml +34 -0
- package/tests/fixtures/basic_person.json +26 -0
- package/tests/fixtures/nested_object.json +26 -0
- package/tests/fixtures/person.json +55 -0
- package/tests/fixtures/recursive.json +8 -0
- package/tests/fixtures/some_types.json +32 -0
- package/tests/fixtures/string.json +3 -0
- package/tests/fixtures/validation.json +1140 -0
- package/tests/pages/_demo.html +475 -0
- package/tests/pages/advanced.html +137 -0
- package/tests/pages/anyof.html +80 -0
- package/tests/pages/array-anyof.html +142 -0
- package/tests/pages/array-checkboxes.html +41 -0
- package/tests/pages/array-choices.html +45 -0
- package/tests/pages/array-integers.html +37 -0
- package/tests/pages/array-move-events.html +61 -0
- package/tests/pages/array-multiselects.html +42 -0
- package/tests/pages/array-nested-arrays.html +40 -0
- package/tests/pages/array-numbers.html +37 -0
- package/tests/pages/array-objects.html +42 -0
- package/tests/pages/array-ratings.html +40 -0
- package/tests/pages/array-selectize.html +51 -0
- package/tests/pages/array-selects.html +36 -0
- package/tests/pages/array-strings.html +36 -0
- package/tests/pages/array.html +42 -0
- package/tests/pages/assets/pages.css +130 -0
- package/tests/pages/button-callbacks.html +77 -0
- package/tests/pages/checkbox-labels.html +114 -0
- package/tests/pages/colorpicker-no-3rd-party.html +43 -0
- package/tests/pages/colorpicker-use-vanilla-picker.html +50 -0
- package/tests/pages/core.html +118 -0
- package/tests/pages/datetime.html +76 -0
- package/tests/pages/form-name.html +108 -0
- package/tests/pages/grid-strict.html +311 -0
- package/tests/pages/grid.html +284 -0
- package/tests/pages/if-then-else-allOf.html +117 -0
- package/tests/pages/inheritance.html +76 -0
- package/tests/pages/integer.html +68 -0
- package/tests/pages/issues/_template.html +50 -0
- package/tests/pages/issues/issue-gh-812.html +110 -0
- package/tests/pages/issues/issue-gh-823-meta-schema.html +35 -0
- package/tests/pages/issues/issue-gh-848.html +81 -0
- package/tests/pages/meta_schema.json +705 -0
- package/tests/pages/number.html +89 -0
- package/tests/pages/object-no-additional-properties.html +65 -0
- package/tests/pages/object-no-duplicated-id.html +68 -0
- package/tests/pages/object-required-properties.html +236 -0
- package/tests/pages/object-with-dependencies-array.html +46 -0
- package/tests/pages/object-with-dependencies.html +60 -0
- package/tests/pages/object.html +79 -0
- package/tests/pages/oneof.html +103 -0
- package/tests/pages/option-no_default_values.html +58 -0
- package/tests/pages/programmatic-changes.html +120 -0
- package/tests/pages/read-only.html +105 -0
- package/tests/pages/select.html +41 -0
- package/tests/pages/stepper.html +59 -0
- package/tests/pages/string-ace-editor.html +52 -0
- package/tests/pages/string-cleave.html +46 -0
- package/tests/pages/string-custom-attributes.html +62 -0
- package/tests/pages/string-formats.html +52 -0
- package/tests/pages/string-formats2.html +57 -0
- package/tests/pages/string-jodit-editor.html +49 -0
- package/tests/pages/string-sceditor.html +62 -0
- package/tests/pages/table-move-events.html +56 -0
- package/tests/pages/table.html +46 -0
- package/tests/pages/tabs.html +131 -0
- package/tests/pages/themes.html +527 -0
- package/tests/pages/translate-property.html +247 -0
- package/tests/pages/urn.html +93 -0
- package/tests/pages/uuid.html +72 -0
- package/tests/pages/validation.html +99 -0
- package/tests/unit/.eslintrc +8 -0
- package/tests/unit/core.spec.js +309 -0
- package/tests/unit/defaults.spec.js +40 -0
- package/tests/unit/editor.spec.js +160 -0
- package/tests/unit/editors/array.spec.js +86 -0
- package/tests/unit/editors/object.spec.js +79 -0
- package/tests/unit/editors/table.spec.js +91 -0
- package/tests/unit/readme.md +35 -0
- package/tests/unit/schemaloader.spec.js +498 -0
- package/tests/unit/validator.spec.js +94 -0
- package/tests/unit/validators/ip-validator.spec.js +62 -0
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<title>oneOf</title>
|
|
6
|
+
<link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
|
7
|
+
<link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
|
|
8
|
+
<script src="../../dist/jsoneditor.js"></script>
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
|
|
12
|
+
<div class="container">
|
|
13
|
+
<textarea class="value form-control" rows="10"></textarea>
|
|
14
|
+
<button class='get-value'>Get Value</button>
|
|
15
|
+
<button class='set-value'>Set Value</button>
|
|
16
|
+
<div class='json-editor-container'></div>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
var jsonEditorContainer = document.querySelector('.json-editor-container');
|
|
22
|
+
var value = document.querySelector('.value');
|
|
23
|
+
|
|
24
|
+
var schema = {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"properties": {
|
|
27
|
+
"p4": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"minLength": 4
|
|
30
|
+
},
|
|
31
|
+
"p5": {
|
|
32
|
+
"oneOf": [
|
|
33
|
+
{
|
|
34
|
+
"type": "object",
|
|
35
|
+
"properties": {
|
|
36
|
+
"p1": {
|
|
37
|
+
"type": "string",
|
|
38
|
+
"minLength": 4
|
|
39
|
+
},
|
|
40
|
+
"p2": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"minLength": 4
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
"required": [
|
|
46
|
+
"p1",
|
|
47
|
+
"p2"
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
"type": "object",
|
|
52
|
+
"properties": {
|
|
53
|
+
"p3": {
|
|
54
|
+
"type": "number"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
"required": [
|
|
58
|
+
"p3"
|
|
59
|
+
]
|
|
60
|
+
}
|
|
61
|
+
],
|
|
62
|
+
"options": {
|
|
63
|
+
"keep_oneof_values": false
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"required": [
|
|
68
|
+
"p4",
|
|
69
|
+
"p5"
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
var editor = new JSONEditor(jsonEditorContainer, {
|
|
74
|
+
schema: schema,
|
|
75
|
+
theme: 'bootstrap4',
|
|
76
|
+
show_errors: 'always',
|
|
77
|
+
iconlib: 'fontawesome5',
|
|
78
|
+
object_layout: 'normal',
|
|
79
|
+
disable_collapse: true,
|
|
80
|
+
disable_edit_json: true,
|
|
81
|
+
disable_properties: true,
|
|
82
|
+
use_default_values: false,
|
|
83
|
+
required_by_default: true,
|
|
84
|
+
disable_array_reorder: true,
|
|
85
|
+
disable_array_delete_all_rows: true,
|
|
86
|
+
disable_array_delete_last_row: true,
|
|
87
|
+
keep_oneof_values: false,
|
|
88
|
+
no_additional_properties: true
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
document.querySelector('.get-value').addEventListener('click', function () {
|
|
92
|
+
value.value = JSON.stringify(editor.getValue());
|
|
93
|
+
console.log(editor.getValue());
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
document.querySelector('.set-value').addEventListener('click', function () {
|
|
97
|
+
editor.setValue({number_range: 2})
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
</script>
|
|
101
|
+
|
|
102
|
+
</body>
|
|
103
|
+
</html>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<title>wysiwyg-sceditor</title>
|
|
6
|
+
|
|
7
|
+
<!-- json editor -->
|
|
8
|
+
<script src="../../dist/jsoneditor.js"></script>
|
|
9
|
+
|
|
10
|
+
<!-- jquery -->
|
|
11
|
+
<script src="./../../node_modules/jquery/dist/jquery.min.js"></script>
|
|
12
|
+
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
|
|
16
|
+
<textarea class="debug" cols="30" rows="10"></textarea>
|
|
17
|
+
<button class='get-value'>Get Value</button>
|
|
18
|
+
<div class='container'></div>
|
|
19
|
+
<button class="force-change">Force onchange</button>
|
|
20
|
+
<script>
|
|
21
|
+
var container = document.querySelector('.container');
|
|
22
|
+
var debug = document.querySelector('.debug');
|
|
23
|
+
|
|
24
|
+
var schema = {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"properties": {
|
|
27
|
+
"number": {
|
|
28
|
+
"type": "number"
|
|
29
|
+
},
|
|
30
|
+
"string": {
|
|
31
|
+
"type": "string"
|
|
32
|
+
},
|
|
33
|
+
"integer": {
|
|
34
|
+
"type": "integer"
|
|
35
|
+
},
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
var editor = new JSONEditor(container, {
|
|
40
|
+
schema: schema,
|
|
41
|
+
use_default_values: false,
|
|
42
|
+
remove_empty_properties: false
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
document.querySelector('.get-value').addEventListener('click', function () {
|
|
46
|
+
debug.value = JSON.stringify(editor.getValue());
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
document.querySelector('.force-change').addEventListener('click', function () {
|
|
50
|
+
document.querySelector('[name="root[integer]"]').dispatchEvent(new Event('change'));
|
|
51
|
+
document.querySelector('[name="root[number]"]').dispatchEvent(new Event('change'));
|
|
52
|
+
document.querySelector('[name="root[string]"]').dispatchEvent(new Event('change'));
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
</script>
|
|
56
|
+
|
|
57
|
+
</body>
|
|
58
|
+
</html>
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<title>Programmatic Changes</title>
|
|
6
|
+
<script src="../../dist/jsoneditor.js"></script>
|
|
7
|
+
<link rel="stylesheet" href="assets/pages.css">
|
|
8
|
+
</head>
|
|
9
|
+
<body>
|
|
10
|
+
|
|
11
|
+
<div class="flex-row">
|
|
12
|
+
<div class="flex-8">
|
|
13
|
+
<div class='container'></div>
|
|
14
|
+
</div>
|
|
15
|
+
<div class="flex-4">
|
|
16
|
+
<textarea class="value" cols="30" rows="30"></textarea>
|
|
17
|
+
<div class="state"></div>
|
|
18
|
+
<div>
|
|
19
|
+
<button class='get-value'>Get Value</button>
|
|
20
|
+
<button class='get-value-pretty'>Get Pretty Value</button>
|
|
21
|
+
</div>
|
|
22
|
+
<div>
|
|
23
|
+
<button class='set-values'>Set Values Programmatically</button>
|
|
24
|
+
</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<script>
|
|
29
|
+
|
|
30
|
+
var container = document.querySelector('.container')
|
|
31
|
+
var value = document.querySelector('.value')
|
|
32
|
+
var getValue = document.querySelector('.get-value')
|
|
33
|
+
var getValuePretty = document.querySelector('.get-value-pretty')
|
|
34
|
+
var setValues = document.querySelector('.set-values')
|
|
35
|
+
var state = document.querySelector('.state')
|
|
36
|
+
var schema = {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"title": "range",
|
|
39
|
+
"properties": {
|
|
40
|
+
"boolean": {
|
|
41
|
+
"title": "boolean",
|
|
42
|
+
"type": "boolean"
|
|
43
|
+
},
|
|
44
|
+
"boolean_checkbox": {
|
|
45
|
+
"title": "boolean checkbox",
|
|
46
|
+
"type": "boolean",
|
|
47
|
+
"format": "checkbox"
|
|
48
|
+
},
|
|
49
|
+
"string": {
|
|
50
|
+
"title": "string",
|
|
51
|
+
"type": "string"
|
|
52
|
+
},
|
|
53
|
+
"integer": {
|
|
54
|
+
"title": "integer",
|
|
55
|
+
"type": "integer"
|
|
56
|
+
},
|
|
57
|
+
"number": {
|
|
58
|
+
"title": "number",
|
|
59
|
+
"type": "number"
|
|
60
|
+
},
|
|
61
|
+
"array": {
|
|
62
|
+
"title": "array",
|
|
63
|
+
"type": "array",
|
|
64
|
+
"format": "tabs",
|
|
65
|
+
"items": {
|
|
66
|
+
"type": "integer",
|
|
67
|
+
"title": "integer"
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"array_checkbox": {
|
|
71
|
+
"type": "array",
|
|
72
|
+
"uniqueItems": true,
|
|
73
|
+
"format": "checkbox",
|
|
74
|
+
"items": {
|
|
75
|
+
"type": "string",
|
|
76
|
+
"enum": ["value1", "value2"]
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
"array_select": {
|
|
80
|
+
"type": "array",
|
|
81
|
+
"uniqueItems": true,
|
|
82
|
+
"format": "select",
|
|
83
|
+
"items": {
|
|
84
|
+
"type": "integer",
|
|
85
|
+
"enum": [1, 2, 3]
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
var editor = new JSONEditor(container, {
|
|
92
|
+
schema: schema
|
|
93
|
+
})
|
|
94
|
+
|
|
95
|
+
editor.on('ready',function() {
|
|
96
|
+
state.innerText = 'READY'
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
getValue.addEventListener('click', function () {
|
|
100
|
+
value.value = JSON.stringify(editor.getValue())
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
getValuePretty.addEventListener('click', function () {
|
|
104
|
+
value.value = JSON.stringify(editor.getValue(), null, 2)
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
setValues.addEventListener('click', function () {
|
|
108
|
+
editor.getEditor('root.boolean').setValue(true);
|
|
109
|
+
editor.getEditor('root.boolean_checkbox').setValue(true);
|
|
110
|
+
editor.getEditor('root.string').setValue('hello');
|
|
111
|
+
editor.getEditor('root.integer').setValue(5);
|
|
112
|
+
editor.getEditor('root.number').setValue(5.5);
|
|
113
|
+
editor.getEditor('root.array').setValue([1, 2, 3]);
|
|
114
|
+
editor.getEditor('root.array_checkbox').setValue(["value1", "value2"]);
|
|
115
|
+
editor.getEditor('root.array_select').setValue([1, 2, 3]);
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
</script>
|
|
119
|
+
</body>
|
|
120
|
+
</html>
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<script src="../../dist/jsoneditor.js"></script>
|
|
6
|
+
</head>
|
|
7
|
+
<body>
|
|
8
|
+
|
|
9
|
+
<textarea class="debug" cols="30" rows="10"></textarea>
|
|
10
|
+
<div class="state"></div>
|
|
11
|
+
<button class='get-value'>Get Value</button>
|
|
12
|
+
<div class='container'></div>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
var container = document.querySelector('.container');
|
|
16
|
+
var debug = document.querySelector('.debug');
|
|
17
|
+
var getValue = document.querySelector('.get-value');
|
|
18
|
+
var state = document.querySelector('.state')
|
|
19
|
+
|
|
20
|
+
var schema = {
|
|
21
|
+
"type": "object",
|
|
22
|
+
"title": "readOnly",
|
|
23
|
+
"properties": {
|
|
24
|
+
"string": {
|
|
25
|
+
"title": "string",
|
|
26
|
+
"type": "string",
|
|
27
|
+
"readOnly": true,
|
|
28
|
+
"default": "some value"
|
|
29
|
+
},
|
|
30
|
+
"number": {
|
|
31
|
+
"title": "number",
|
|
32
|
+
"type": "number",
|
|
33
|
+
"readOnly": true,
|
|
34
|
+
"default": 5.5
|
|
35
|
+
},
|
|
36
|
+
"integer": {
|
|
37
|
+
"title": "integer",
|
|
38
|
+
"type": "integer",
|
|
39
|
+
"readOnly": true,
|
|
40
|
+
"default": 5
|
|
41
|
+
},
|
|
42
|
+
"multiselect": {
|
|
43
|
+
"title": "multiselect",
|
|
44
|
+
"type": "array",
|
|
45
|
+
"format": "multiselect",
|
|
46
|
+
"uniqueItems": true,
|
|
47
|
+
"readOnly": true,
|
|
48
|
+
"items": {
|
|
49
|
+
"type": "string",
|
|
50
|
+
"enum": ["value1","value2"]
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"select": {
|
|
54
|
+
"title": "select",
|
|
55
|
+
"type": "boolean",
|
|
56
|
+
"readOnly": true
|
|
57
|
+
},
|
|
58
|
+
checkbox: {
|
|
59
|
+
"title": "checkbox",
|
|
60
|
+
"format": "checkbox",
|
|
61
|
+
"type": "boolean",
|
|
62
|
+
"readOnly": true
|
|
63
|
+
},
|
|
64
|
+
radio: {
|
|
65
|
+
"title": "radio",
|
|
66
|
+
"format": "radio",
|
|
67
|
+
"type": "string",
|
|
68
|
+
"enum": [
|
|
69
|
+
"yes",
|
|
70
|
+
"no"
|
|
71
|
+
],
|
|
72
|
+
"readOnly": true
|
|
73
|
+
},
|
|
74
|
+
rating: {
|
|
75
|
+
"title": "rating",
|
|
76
|
+
"readOnly": true,
|
|
77
|
+
"type": "integer",
|
|
78
|
+
"format": "rating",
|
|
79
|
+
"maximum": "5",
|
|
80
|
+
"exclusiveMaximum": false
|
|
81
|
+
},
|
|
82
|
+
button: {
|
|
83
|
+
"title": "button",
|
|
84
|
+
"format": "button",
|
|
85
|
+
"readOnly": true
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
var editor = new JSONEditor(container, {
|
|
91
|
+
schema: schema
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
editor.on('ready',function() {
|
|
95
|
+
state.innerText = 'READY'
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
getValue.addEventListener('click', function () {
|
|
99
|
+
debug.value = JSON.stringify(editor.getValue());
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
</script>
|
|
103
|
+
|
|
104
|
+
</body>
|
|
105
|
+
</html>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<title>wysiwyg-sceditor</title>
|
|
6
|
+
<script src="../../dist/jsoneditor.js"></script>
|
|
7
|
+
</head>
|
|
8
|
+
<body>
|
|
9
|
+
|
|
10
|
+
<textarea class="value" cols="30" rows="10"></textarea>
|
|
11
|
+
<button class='get-value'>Get Value</button>
|
|
12
|
+
<div class='container'></div>
|
|
13
|
+
|
|
14
|
+
<script>
|
|
15
|
+
var container = document.querySelector('.container');
|
|
16
|
+
var value = document.querySelector('.value');
|
|
17
|
+
|
|
18
|
+
var schema = {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"properties": {
|
|
21
|
+
"boolean": {
|
|
22
|
+
"type": "boolean",
|
|
23
|
+
"title": "Boolean!",
|
|
24
|
+
"default": true
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
var editor = new JSONEditor(container, {
|
|
30
|
+
schema: schema
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
document.querySelector('.get-value').addEventListener('click', function () {
|
|
34
|
+
value.value = JSON.stringify(editor.getValue());
|
|
35
|
+
console.log(editor.getValue());
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
</script>
|
|
39
|
+
|
|
40
|
+
</body>
|
|
41
|
+
</html>
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<title>Stepper</title>
|
|
6
|
+
<link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
|
7
|
+
<link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
|
|
8
|
+
<script src="https://cdn.jsdelivr.net/npm/mathjs@5.3.1/dist/math.min.js" class="external_mathjs"></script>
|
|
9
|
+
<script src="../../dist/jsoneditor.js"></script>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
|
|
13
|
+
<div class="container">
|
|
14
|
+
<textarea class="value form-control" rows="10"></textarea>
|
|
15
|
+
<button class='get-value'>Get Value</button>
|
|
16
|
+
<button class='set-value'>Set Value</button>
|
|
17
|
+
<div class='json-editor-container'></div>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
<script>
|
|
22
|
+
var jsonEditorContainer = document.querySelector('.json-editor-container');
|
|
23
|
+
var value = document.querySelector('.value');
|
|
24
|
+
|
|
25
|
+
var schema = {
|
|
26
|
+
"type": "object",
|
|
27
|
+
"title": "range",
|
|
28
|
+
"properties": {
|
|
29
|
+
"stepper": {
|
|
30
|
+
'type': 'integer',
|
|
31
|
+
'format': 'stepper',
|
|
32
|
+
"default": "",
|
|
33
|
+
"minimum": 5,
|
|
34
|
+
"maximum": 6
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
var editor = new JSONEditor(jsonEditorContainer, {
|
|
40
|
+
schema: schema,
|
|
41
|
+
theme: 'bootstrap4',
|
|
42
|
+
use_default_values: false,
|
|
43
|
+
required_by_default: true,
|
|
44
|
+
show_errors: 'always'
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
document.querySelector('.get-value').addEventListener('click', function () {
|
|
48
|
+
value.value = JSON.stringify(editor.getValue());
|
|
49
|
+
console.log(editor.getValue());
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
document.querySelector('.set-value').addEventListener('click', function () {
|
|
53
|
+
editor.setValue({number_range: 2})
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
</script>
|
|
57
|
+
|
|
58
|
+
</body>
|
|
59
|
+
</html>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<title>string-ace-editor</title>
|
|
6
|
+
|
|
7
|
+
<!-- json editor -->
|
|
8
|
+
<script src="../../dist/jsoneditor.js"></script>
|
|
9
|
+
|
|
10
|
+
<!-- ace-editor -->
|
|
11
|
+
<script src="./../../node_modules/ace-builds/src-noconflict/ace.js"></script>
|
|
12
|
+
</head>
|
|
13
|
+
<body>
|
|
14
|
+
|
|
15
|
+
<textarea class="debug" cols="30" rows="10"></textarea>
|
|
16
|
+
<button class='get-value'>Get Value</button>
|
|
17
|
+
<div class='container'></div>
|
|
18
|
+
|
|
19
|
+
<script>
|
|
20
|
+
var container = document.querySelector('.container');
|
|
21
|
+
var debug = document.querySelector('.debug');
|
|
22
|
+
|
|
23
|
+
var schema = {
|
|
24
|
+
"type": "array",
|
|
25
|
+
"title": "string-ace-editor",
|
|
26
|
+
"items": {
|
|
27
|
+
"type": "object",
|
|
28
|
+
"properties": {
|
|
29
|
+
"editor": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"format": "yaml"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
JSONEditor.defaults.options.ace = {
|
|
38
|
+
theme: 'ace/theme/twilight'
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
var editor = new JSONEditor(container, {
|
|
42
|
+
schema: schema
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
document.querySelector('.get-value').addEventListener('click', function () {
|
|
46
|
+
debug.value = JSON.stringify(editor.getValue());
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
</body>
|
|
52
|
+
</html>
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<title>string-cleave</title>
|
|
6
|
+
<!-- json editor -->
|
|
7
|
+
<script src="../../dist/jsoneditor.js"></script>
|
|
8
|
+
|
|
9
|
+
<!-- ace-editor -->
|
|
10
|
+
<script src="./../../node_modules/cleave.js/dist/cleave.min.js"></script>
|
|
11
|
+
</head>
|
|
12
|
+
<body>
|
|
13
|
+
|
|
14
|
+
<textarea class="debug" cols="30" rows="10"></textarea>
|
|
15
|
+
<button class='get-value'>Get Value</button>
|
|
16
|
+
<div class='container'></div>
|
|
17
|
+
|
|
18
|
+
<script>
|
|
19
|
+
var container = document.querySelector('.container');
|
|
20
|
+
var debug = document.querySelector('.debug');
|
|
21
|
+
var schema = {
|
|
22
|
+
"type": "object",
|
|
23
|
+
"title": "string-cleave-editor",
|
|
24
|
+
"properties": {
|
|
25
|
+
"cleave_test": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"options": {
|
|
28
|
+
"cleave": {
|
|
29
|
+
"blocks": [4, 3, 3, 4],
|
|
30
|
+
"delimiters": ['.', '.', '-'],
|
|
31
|
+
"uppercase": true
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var editor = new JSONEditor(container, {
|
|
38
|
+
schema: schema
|
|
39
|
+
});
|
|
40
|
+
document.querySelector('.get-value').addEventListener('click', function () {
|
|
41
|
+
debug.value = JSON.stringify(editor.getValue());
|
|
42
|
+
});
|
|
43
|
+
</script>
|
|
44
|
+
|
|
45
|
+
</body>
|
|
46
|
+
</html>
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<title>wysiwyg-sceditor</title>
|
|
6
|
+
|
|
7
|
+
<!-- json editor -->
|
|
8
|
+
<script src="../../dist/jsoneditor.js"></script>
|
|
9
|
+
|
|
10
|
+
<!-- jquery -->
|
|
11
|
+
<script src="./../../node_modules/jquery/dist/jquery.min.js"></script>
|
|
12
|
+
|
|
13
|
+
<!-- sceditor -->
|
|
14
|
+
<script src="./../../node_modules/sceditor/minified/jquery.sceditor.bbcode.min.js"></script>
|
|
15
|
+
<script src="./../../node_modules/sceditor/minified/jquery.sceditor.xhtml.min.js"></script>
|
|
16
|
+
<link rel="stylesheet" href="./../../node_modules/sceditor/minified/themes/default.min.css">
|
|
17
|
+
</head>
|
|
18
|
+
<body>
|
|
19
|
+
|
|
20
|
+
<textarea class="debug" cols="30" rows="10"></textarea>
|
|
21
|
+
<button class='get-value'>Get Value</button>
|
|
22
|
+
<div class='container'></div>
|
|
23
|
+
|
|
24
|
+
<script>
|
|
25
|
+
var container = document.querySelector('.container');
|
|
26
|
+
var debug = document.querySelector('.debug');
|
|
27
|
+
|
|
28
|
+
var schema = {
|
|
29
|
+
type: "object",
|
|
30
|
+
title: "Car",
|
|
31
|
+
properties: {
|
|
32
|
+
custom_attributes: {
|
|
33
|
+
title: "i have a custom attribute",
|
|
34
|
+
type: "string",
|
|
35
|
+
"options": {
|
|
36
|
+
"inputAttributes": {
|
|
37
|
+
"custom-attribute": 'custom-value'
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
// sceditor quirk. Styles must be specified in the options at creation
|
|
45
|
+
// if you want to be able to focus on the iframes he creates.
|
|
46
|
+
JSONEditor.defaults.options.sceditor = {
|
|
47
|
+
//style: '//cdn.jsdelivr.net/sceditor/1.4.3/jquery.sceditor.default.min.css'
|
|
48
|
+
style: ''
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
var editor = new JSONEditor(container, {
|
|
52
|
+
schema: schema
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
document.querySelector('.get-value').addEventListener('click', function () {
|
|
56
|
+
debug.value = JSON.stringify(editor.getValue());
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
</script>
|
|
60
|
+
|
|
61
|
+
</body>
|
|
62
|
+
</html>
|