@json-editor/json-editor 2.15.1 → 2.15.2
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 +5 -5
- package/CHANGELOG.md +15 -0
- package/README.md +16 -0
- package/dist/jsoneditor.js +1 -1
- package/dist/jsoneditor.js.LICENSE.txt +1 -1
- package/dist/nonmin/jsoneditor.js +496 -149
- package/dist/nonmin/jsoneditor.js.map +1 -1
- package/package.json +1 -1
- package/src/core.js +11 -0
- package/src/defaults.js +2 -1
- package/src/editor.js +26 -15
- package/src/editors/ace.js +1 -0
- package/src/editors/array/choices.js +1 -0
- package/src/editors/array/select2.js +2 -0
- package/src/editors/array/selectize.js +2 -0
- package/src/editors/array.js +81 -0
- package/src/editors/base64.js +2 -0
- package/src/editors/checkbox.js +13 -1
- package/src/editors/choices.js +2 -0
- package/src/editors/colorpicker.js +2 -0
- package/src/editors/datetime.js +2 -0
- package/src/editors/describedby.js +2 -0
- package/src/editors/enum.js +3 -1
- package/src/editors/hidden.js +2 -0
- package/src/editors/jodit.js +2 -0
- package/src/editors/multiple.js +2 -0
- package/src/editors/multiselect.js +2 -0
- package/src/editors/object.js +10 -3
- package/src/editors/radio.js +2 -0
- package/src/editors/sceditor.js +2 -0
- package/src/editors/select.js +2 -1
- package/src/editors/select2.js +2 -0
- package/src/editors/selectize.js +2 -0
- package/src/editors/signature.js +2 -0
- package/src/editors/simplemde.js +3 -1
- package/src/editors/starrating.js +2 -0
- package/src/editors/string.js +2 -0
- package/src/editors/table.js +19 -2
- package/src/editors/upload.js +2 -0
- package/src/editors/uuid.js +2 -0
- package/src/resolvers.js +1 -1
- package/src/theme.js +23 -0
- package/src/themes/bootstrap3.css +53 -0
- package/src/themes/bootstrap3.css.js +1 -1
- package/src/themes/bootstrap3.js +30 -0
- package/src/themes/bootstrap4.js +27 -0
- package/src/themes/bootstrap5.js +28 -0
- package/src/themes/spectre.js +28 -0
- package/src/themes/tailwind.css +54 -0
- package/src/themes/tailwind.css.js +1 -1
- package/src/themes/tailwind.js +26 -0
- package/tests/codeceptjs/core_test.js +28 -0
- package/tests/codeceptjs/editors/multiple_test.js +27 -0
- package/tests/codeceptjs/issues/issue-gh-1562_test.js +12 -0
- package/tests/codeceptjs/issues/issue-gh-1586_test.js +15 -0
- package/tests/pages/editor-show-validation-errors.html +54 -0
- package/tests/pages/enforce-const.html +10 -18
- package/tests/pages/issues/issue-gh-1562.html +170 -0
- package/tests/pages/issues/issue-gh-1586.html +48 -0
- package/tests/pages/opt-in-widget.html +134 -0
- package/tests/pages/switcher-option.html +69 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<title>issue-1562</title>
|
|
6
|
+
<script src="../../../dist/jsoneditor.js"></script>
|
|
7
|
+
<link rel="stylesheet" id="theme-link" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
|
|
8
|
+
<link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
|
|
12
|
+
<div class="container">
|
|
13
|
+
<h1>Test</h1>
|
|
14
|
+
<div id='editor-container'></div>
|
|
15
|
+
|
|
16
|
+
<div class="form-group">
|
|
17
|
+
<label for="textarea-value">Value</label>
|
|
18
|
+
<textarea class="form-control" id="textarea-value" cols="30" rows="10"></textarea>
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<script>
|
|
23
|
+
var editorContainer = document.querySelector('#editor-container')
|
|
24
|
+
var textareaValue = document.querySelector('#textarea-value')
|
|
25
|
+
var schema = {
|
|
26
|
+
"type": "object",
|
|
27
|
+
"format": "grid",
|
|
28
|
+
"options": {
|
|
29
|
+
"collapsed": false,
|
|
30
|
+
"grid_columns": 12,
|
|
31
|
+
"disable_properties": true
|
|
32
|
+
},
|
|
33
|
+
"defaultProperties": [
|
|
34
|
+
"model"
|
|
35
|
+
],
|
|
36
|
+
"required": [
|
|
37
|
+
"model"
|
|
38
|
+
],
|
|
39
|
+
"properties": {
|
|
40
|
+
"model": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"format": "grid",
|
|
43
|
+
"options": {
|
|
44
|
+
"collapsed": false,
|
|
45
|
+
"grid_columns": 12,
|
|
46
|
+
"disable_properties": true
|
|
47
|
+
},
|
|
48
|
+
"defaultProperties": [
|
|
49
|
+
"name",
|
|
50
|
+
"entities"
|
|
51
|
+
],
|
|
52
|
+
"required": [
|
|
53
|
+
"name",
|
|
54
|
+
"entities"
|
|
55
|
+
],
|
|
56
|
+
"properties": {
|
|
57
|
+
"name": {
|
|
58
|
+
"type": "string",
|
|
59
|
+
"propertyOrder": 0,
|
|
60
|
+
"description": "Name of the Model",
|
|
61
|
+
"default": "",
|
|
62
|
+
"pattern": "^\\S+$",
|
|
63
|
+
"options": {
|
|
64
|
+
"grid_columns": 3
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"entities": {
|
|
68
|
+
"type": "object",
|
|
69
|
+
"format": "grid",
|
|
70
|
+
"options": {
|
|
71
|
+
"collapsed": false,
|
|
72
|
+
"grid_columns": 12
|
|
73
|
+
},
|
|
74
|
+
"additionalProperties": {
|
|
75
|
+
"type": "object",
|
|
76
|
+
"format": "grid",
|
|
77
|
+
"options": {
|
|
78
|
+
"grid_columns": 12,
|
|
79
|
+
"collapsed": true,
|
|
80
|
+
"disable_properties": true
|
|
81
|
+
},
|
|
82
|
+
"defaultProperties": [
|
|
83
|
+
"name",
|
|
84
|
+
"properties"
|
|
85
|
+
],
|
|
86
|
+
"required": [
|
|
87
|
+
"name",
|
|
88
|
+
"properties"
|
|
89
|
+
],
|
|
90
|
+
"properties": {
|
|
91
|
+
"name": {
|
|
92
|
+
"description": "The name of the entity",
|
|
93
|
+
"type": "string",
|
|
94
|
+
"propertyOrder": 0,
|
|
95
|
+
"default": "",
|
|
96
|
+
"pattern": "^[A-Z]\\S+$",
|
|
97
|
+
"options": {
|
|
98
|
+
"grid_columns": 4
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
"properties": {
|
|
102
|
+
"type": "object",
|
|
103
|
+
"format": "grid",
|
|
104
|
+
"options": {
|
|
105
|
+
"grid_columns": 12,
|
|
106
|
+
"collapsed": true,
|
|
107
|
+
"disable_properties": false
|
|
108
|
+
},
|
|
109
|
+
"default": {
|
|
110
|
+
"id": {
|
|
111
|
+
"name": "id"
|
|
112
|
+
},
|
|
113
|
+
"created": {
|
|
114
|
+
"name": "created"
|
|
115
|
+
},
|
|
116
|
+
"lastUpdated": {
|
|
117
|
+
"name": "lastUpdated"
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
"propertyOrder": 5,
|
|
121
|
+
"additionalProperties": {
|
|
122
|
+
"type": "object",
|
|
123
|
+
"format": "grid",
|
|
124
|
+
"options": {
|
|
125
|
+
"collapsed": true,
|
|
126
|
+
"grid_columns": 12,
|
|
127
|
+
"disable_properties": true
|
|
128
|
+
},
|
|
129
|
+
"defaultProperties": [
|
|
130
|
+
"name"
|
|
131
|
+
],
|
|
132
|
+
"required": [
|
|
133
|
+
"name"
|
|
134
|
+
],
|
|
135
|
+
"properties": {
|
|
136
|
+
"name": {
|
|
137
|
+
"description": "The name of the property",
|
|
138
|
+
"type": "string",
|
|
139
|
+
"propertyOrder": 0,
|
|
140
|
+
"default": "",
|
|
141
|
+
"pattern": "^\\S+$",
|
|
142
|
+
"options": {
|
|
143
|
+
"grid_columns": 4
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
var editor = new JSONEditor(editorContainer, {
|
|
158
|
+
schema: schema,
|
|
159
|
+
theme: 'bootstrap4',
|
|
160
|
+
iconlib: 'fontawesome',
|
|
161
|
+
show_errors: 'always',
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
editor.on('change', function () {
|
|
165
|
+
textareaValue.value = JSON.stringify(editor.getValue())
|
|
166
|
+
})
|
|
167
|
+
</script>
|
|
168
|
+
|
|
169
|
+
</body>
|
|
170
|
+
</html>`
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>GitHub Issue 1586</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
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/simplemde/latest/simplemde.min.css">
|
|
9
|
+
<script src="../../../dist/jsoneditor.js"></script>
|
|
10
|
+
</head>
|
|
11
|
+
<body>
|
|
12
|
+
<div class="container">
|
|
13
|
+
<textarea class="form-control" id="value" cols="30" rows="10"></textarea>
|
|
14
|
+
<a href="https://github.com/json-editor/json-editor/issues/1585">GitHub Issue 1586</a>
|
|
15
|
+
<div id='editor_holder'></div>
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
<script>
|
|
19
|
+
var value = document.querySelector('#value')
|
|
20
|
+
|
|
21
|
+
var defaultSchema = {
|
|
22
|
+
"type": "array",
|
|
23
|
+
"items": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"properties": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"subtype": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"properties": {
|
|
30
|
+
"type": "string"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"required": [
|
|
35
|
+
"subtype"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
var editor = new JSONEditor(document.getElementById('editor_holder'), {
|
|
41
|
+
schema: defaultSchema,
|
|
42
|
+
show_errors: 'always',
|
|
43
|
+
show_opt_in: true,
|
|
44
|
+
prompt_before_delete: false
|
|
45
|
+
})
|
|
46
|
+
</script>
|
|
47
|
+
</body>
|
|
48
|
+
</html>
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<title>opt-in-widget</title>
|
|
6
|
+
<script src="../../dist/jsoneditor.js"></script>
|
|
7
|
+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
|
|
8
|
+
<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css">-->
|
|
9
|
+
<!-- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.2/dist/css/bootstrap.min.css">-->
|
|
10
|
+
<!-- <link rel="stylesheet" href="https://unpkg.com/spectre.css/dist/spectre.min.css">-->
|
|
11
|
+
<!-- <link rel="stylesheet" href="https://unpkg.com/tailwindcss@^1.0/dist/tailwind.min.css">-->
|
|
12
|
+
<link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
|
|
13
|
+
</head>
|
|
14
|
+
<body>
|
|
15
|
+
|
|
16
|
+
<div class="container">
|
|
17
|
+
<div id='editor-container'></div>
|
|
18
|
+
<div class="form-group">
|
|
19
|
+
<label for="value">Value</label>
|
|
20
|
+
<textarea class="form-control" id="value" cols="30" rows="30"></textarea>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
<script>
|
|
25
|
+
const editorContainer = document.querySelector('#editor-container')
|
|
26
|
+
const schema = {
|
|
27
|
+
"title": "Register",
|
|
28
|
+
"type": "object",
|
|
29
|
+
"properties": {
|
|
30
|
+
"email": {
|
|
31
|
+
"title": "Email",
|
|
32
|
+
"type": "string",
|
|
33
|
+
"format": "email",
|
|
34
|
+
"minLength": 6
|
|
35
|
+
},
|
|
36
|
+
"password": {
|
|
37
|
+
"title": "Password",
|
|
38
|
+
"type": "string",
|
|
39
|
+
"format": "password",
|
|
40
|
+
"minLength": 8
|
|
41
|
+
},
|
|
42
|
+
"name": {
|
|
43
|
+
"title": "Name",
|
|
44
|
+
"type": "string",
|
|
45
|
+
"default": "Random-223"
|
|
46
|
+
},
|
|
47
|
+
"gender": {
|
|
48
|
+
"title": "Gender",
|
|
49
|
+
"type": "string",
|
|
50
|
+
"enum": [
|
|
51
|
+
"Male",
|
|
52
|
+
"Female",
|
|
53
|
+
"Other"
|
|
54
|
+
]
|
|
55
|
+
},
|
|
56
|
+
"address": {
|
|
57
|
+
"title": "Address",
|
|
58
|
+
"type": "object",
|
|
59
|
+
"properties": {
|
|
60
|
+
"street": {
|
|
61
|
+
"title": "Street",
|
|
62
|
+
"type": "string",
|
|
63
|
+
},
|
|
64
|
+
"number": {
|
|
65
|
+
"title": "Number",
|
|
66
|
+
"type": "string",
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"pets": {
|
|
71
|
+
"type": "array",
|
|
72
|
+
"format": "table",
|
|
73
|
+
"title": "Pets",
|
|
74
|
+
"uniqueItems": true,
|
|
75
|
+
"items": {
|
|
76
|
+
"type": "object",
|
|
77
|
+
"title": "Pet",
|
|
78
|
+
"properties": {
|
|
79
|
+
"type": {
|
|
80
|
+
"type": "string",
|
|
81
|
+
"enum": [
|
|
82
|
+
"cat",
|
|
83
|
+
"dog",
|
|
84
|
+
"bird",
|
|
85
|
+
"reptile",
|
|
86
|
+
"other"
|
|
87
|
+
],
|
|
88
|
+
"default": "dog"
|
|
89
|
+
},
|
|
90
|
+
"name": {
|
|
91
|
+
"type": "string"
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
"default": [
|
|
96
|
+
{
|
|
97
|
+
"type": "dog",
|
|
98
|
+
"name": "Walter"
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
"agree": {
|
|
103
|
+
"title": "Agree",
|
|
104
|
+
"description": "lorem ipsum bla bla",
|
|
105
|
+
"type": "boolean",
|
|
106
|
+
"format": "checkbox"
|
|
107
|
+
},
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const editor = new JSONEditor(editorContainer, {
|
|
112
|
+
schema: schema,
|
|
113
|
+
theme: 'bootstrap3',
|
|
114
|
+
// theme: 'bootstrap4',
|
|
115
|
+
// theme: 'bootstrap5',
|
|
116
|
+
// theme: 'spectre',
|
|
117
|
+
// theme: 'tailwind',
|
|
118
|
+
iconlib: 'fontawesome',
|
|
119
|
+
show_opt_in: true,
|
|
120
|
+
opt_in_widget: 'switch',
|
|
121
|
+
disable_collapse: true,
|
|
122
|
+
disable_edit_json: true,
|
|
123
|
+
disable_properties: true
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
const textareaValue = document.querySelector('#value')
|
|
127
|
+
|
|
128
|
+
editor.on('change', function () {
|
|
129
|
+
textareaValue.value = JSON.stringify(editor.getValue())
|
|
130
|
+
})
|
|
131
|
+
</script>
|
|
132
|
+
|
|
133
|
+
</body>
|
|
134
|
+
</html>
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8"/>
|
|
5
|
+
<title>switcher-option</title>
|
|
6
|
+
<script src="../../dist/jsoneditor.js"></script>
|
|
7
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css">
|
|
8
|
+
<link rel="stylesheet" id="iconlib-link" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css">
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
|
|
12
|
+
<div class="container">
|
|
13
|
+
<div id='editor-container'></div>
|
|
14
|
+
<div class="form-group">
|
|
15
|
+
<label for="textarea-value">Value</label>
|
|
16
|
+
<textarea class="form-control" id="textarea-value" cols="30" rows="30"></textarea>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
|
|
20
|
+
<script>
|
|
21
|
+
const editorContainer = document.querySelector('#editor-container')
|
|
22
|
+
const schema = {
|
|
23
|
+
"title": "Register",
|
|
24
|
+
"type": "object",
|
|
25
|
+
"properties": {
|
|
26
|
+
"name": {
|
|
27
|
+
"title": "Name",
|
|
28
|
+
"type": "string",
|
|
29
|
+
"options": {
|
|
30
|
+
"switcher": false,
|
|
31
|
+
"error_messages": {
|
|
32
|
+
"en": {
|
|
33
|
+
"error_oneOf": "If provided, value must be at least 4 and at most 10",
|
|
34
|
+
"error_anyOf": "If provided, value must be at least 4 and at most 10"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"anyOf": [
|
|
39
|
+
{
|
|
40
|
+
"const": ""
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
"minLength": 4,
|
|
44
|
+
"maxLength": 10
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const editor = new JSONEditor(editorContainer, {
|
|
52
|
+
schema: schema,
|
|
53
|
+
theme: 'bootstrap4',
|
|
54
|
+
iconlib: 'fontawesome',
|
|
55
|
+
show_errors: 'always',
|
|
56
|
+
disable_collapse: true,
|
|
57
|
+
disable_edit_json: true,
|
|
58
|
+
disable_properties: true
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
const textareaValue = document.querySelector('#textarea-value')
|
|
62
|
+
|
|
63
|
+
editor.on('change', function () {
|
|
64
|
+
textareaValue.value = JSON.stringify(editor.getValue(), null, 2)
|
|
65
|
+
})
|
|
66
|
+
</script>
|
|
67
|
+
|
|
68
|
+
</body>
|
|
69
|
+
</html>
|