@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,208 @@
|
|
|
1
|
+
/* CSS variables */
|
|
2
|
+
* {
|
|
3
|
+
--primary-color: #5755d9;
|
|
4
|
+
--gray-color: #bcc3ce;
|
|
5
|
+
--light-color: #fff;
|
|
6
|
+
}
|
|
7
|
+
/* Remove slider focus shadow */
|
|
8
|
+
.slider:focus {
|
|
9
|
+
box-shadow: none;
|
|
10
|
+
}
|
|
11
|
+
/* Add margin between header and top buttons */
|
|
12
|
+
h4 > label + .btn-group {
|
|
13
|
+
margin-left: 1rem;
|
|
14
|
+
}
|
|
15
|
+
/* Remove right margin on right-aligned button */
|
|
16
|
+
.text-right > button {
|
|
17
|
+
margin-right: 0 !important;
|
|
18
|
+
}
|
|
19
|
+
/* Remove left margin on left-aligned button */
|
|
20
|
+
.text-left > button {
|
|
21
|
+
margin-left: 0 !important;
|
|
22
|
+
}
|
|
23
|
+
/* Fix fontsize in Properties modal and increase size of modal box */
|
|
24
|
+
.property-selector {
|
|
25
|
+
font-size: 0.7rem;
|
|
26
|
+
font-weight: normal;
|
|
27
|
+
max-height: 260px !important;
|
|
28
|
+
width: 395px !important;
|
|
29
|
+
}
|
|
30
|
+
/* Remove checkbox margins in Properties modal */
|
|
31
|
+
.property-selector .form-checkbox {
|
|
32
|
+
margin: 0;
|
|
33
|
+
}
|
|
34
|
+
/* Prevent textarea from being resized horizontally */
|
|
35
|
+
textarea {
|
|
36
|
+
width: 100%;
|
|
37
|
+
min-height: 2rem;
|
|
38
|
+
resize: vertical;
|
|
39
|
+
}
|
|
40
|
+
/* Remove gap between table element borders */
|
|
41
|
+
table {
|
|
42
|
+
border-collapse: collapse;
|
|
43
|
+
}
|
|
44
|
+
/* reduce table padding */
|
|
45
|
+
.table td {
|
|
46
|
+
padding: 0.4rem 0.4rem;
|
|
47
|
+
}
|
|
48
|
+
/* margin for checkbox label */
|
|
49
|
+
.mr-5 {
|
|
50
|
+
margin-right: 1rem !important;
|
|
51
|
+
}
|
|
52
|
+
/* Hover on input block (Should be removed in final version) */
|
|
53
|
+
div[data-schematype]:not([data-schematype="object"]) {
|
|
54
|
+
transition: 0.5s;
|
|
55
|
+
}
|
|
56
|
+
/* Hover on input block (Should be removed in final version) */
|
|
57
|
+
div[data-schematype]:not([data-schematype="object"]):hover {
|
|
58
|
+
background-color: #eee;
|
|
59
|
+
}
|
|
60
|
+
/* Option: table_border */
|
|
61
|
+
.je-table-border td {
|
|
62
|
+
border: 0.05rem solid #dadee4 !important;
|
|
63
|
+
}
|
|
64
|
+
/* Infobutton */
|
|
65
|
+
.btn-info {
|
|
66
|
+
font-size: 0.5rem;
|
|
67
|
+
font-weight: bold;
|
|
68
|
+
height: 0.8rem;
|
|
69
|
+
padding: 0.15rem 0;
|
|
70
|
+
line-height: 0.8;
|
|
71
|
+
margin: 0.3rem 0 0.3rem 0.1rem;
|
|
72
|
+
}
|
|
73
|
+
/* Select box for oneOf, anyOf and allOf */
|
|
74
|
+
.je-label + select {
|
|
75
|
+
min-width: 5rem;
|
|
76
|
+
}
|
|
77
|
+
/* Option: label_bold */
|
|
78
|
+
.je-label {
|
|
79
|
+
font-weight: 600;
|
|
80
|
+
}
|
|
81
|
+
/* Infobutton */
|
|
82
|
+
.btn-action.btn-info {
|
|
83
|
+
width: 0.8rem;
|
|
84
|
+
}
|
|
85
|
+
/* Option: object_border */
|
|
86
|
+
.je-border {
|
|
87
|
+
border: 0.05rem solid #dadee4;
|
|
88
|
+
}
|
|
89
|
+
.je-panel {
|
|
90
|
+
padding: 0.2rem;
|
|
91
|
+
margin: 0.2rem;
|
|
92
|
+
background-color: rgba(218, 222, 228, 0.1);
|
|
93
|
+
}
|
|
94
|
+
.je-panel-top {
|
|
95
|
+
padding: 0.2rem;
|
|
96
|
+
margin: 0.2rem;
|
|
97
|
+
background-color: rgba(218, 222, 228, 0.1);
|
|
98
|
+
}
|
|
99
|
+
/* Red * after label if field is required */
|
|
100
|
+
.required:after {
|
|
101
|
+
content: " *";
|
|
102
|
+
color: red;
|
|
103
|
+
font: inherit;
|
|
104
|
+
}
|
|
105
|
+
/* option: align_bottom */
|
|
106
|
+
.je-align-bottom {
|
|
107
|
+
margin-top: auto;
|
|
108
|
+
}
|
|
109
|
+
/* Description */
|
|
110
|
+
.je-desc {
|
|
111
|
+
font-size: smaller;
|
|
112
|
+
margin: 0.2rem 0;
|
|
113
|
+
}
|
|
114
|
+
/* Upload editor preview image */
|
|
115
|
+
.je-upload-preview img {
|
|
116
|
+
float: left;
|
|
117
|
+
margin: 0 0.5rem 0.5rem 0;
|
|
118
|
+
max-width: 100%;
|
|
119
|
+
max-height: 5rem;
|
|
120
|
+
border: 3px solid white;
|
|
121
|
+
box-shadow: 0px 0px 8px rgba(0, 0, 0, 0.3);
|
|
122
|
+
box-sizing: border-box;
|
|
123
|
+
}
|
|
124
|
+
.je-dropzone {
|
|
125
|
+
position: relative;
|
|
126
|
+
margin: 0.5rem 0;
|
|
127
|
+
border: 2px dashed black;
|
|
128
|
+
width: 100%;
|
|
129
|
+
height: 60px;
|
|
130
|
+
background: teal;
|
|
131
|
+
transition: all 0.5s;
|
|
132
|
+
}
|
|
133
|
+
.je-dropzone:before {
|
|
134
|
+
position: absolute;
|
|
135
|
+
content: attr(data-text);
|
|
136
|
+
color: rgba(0, 0, 0, 0.6);
|
|
137
|
+
left: 50%;
|
|
138
|
+
top: 50%;
|
|
139
|
+
transform: translate(-50%, -50%);
|
|
140
|
+
}
|
|
141
|
+
.je-dropzone.valid-dropzone {
|
|
142
|
+
background: green;
|
|
143
|
+
}
|
|
144
|
+
.je-dropzone.invalid-dropzone {
|
|
145
|
+
background: red;
|
|
146
|
+
}
|
|
147
|
+
/* Option: object_indent */
|
|
148
|
+
.columns .container.je-noindent {
|
|
149
|
+
padding-left: 0;
|
|
150
|
+
padding-right: 0;
|
|
151
|
+
}
|
|
152
|
+
/* Adjustments for Selectize styling */
|
|
153
|
+
.selectize-control.multi .item {
|
|
154
|
+
background: var(--primary-color) !important;
|
|
155
|
+
}
|
|
156
|
+
/* Adjustments for Select2 styling */
|
|
157
|
+
.select2-container--default
|
|
158
|
+
.select2-selection--single
|
|
159
|
+
.select2-selection__arrow {
|
|
160
|
+
display: none;
|
|
161
|
+
}
|
|
162
|
+
.select2-container--default .select2-selection--single {
|
|
163
|
+
border: none;
|
|
164
|
+
}
|
|
165
|
+
.select2-container .select2-selection--single .select2-selection__rendered {
|
|
166
|
+
padding: 0;
|
|
167
|
+
}
|
|
168
|
+
.select2-container .select2-search--inline .select2-search__field {
|
|
169
|
+
margin-top: 0;
|
|
170
|
+
}
|
|
171
|
+
.select2-container--default.select2-container--focus
|
|
172
|
+
.select2-selection--multiple {
|
|
173
|
+
border: 0.05rem solid var(--gray-color);
|
|
174
|
+
}
|
|
175
|
+
.select2-container--default
|
|
176
|
+
.select2-selection--multiple
|
|
177
|
+
.select2-selection__choice {
|
|
178
|
+
margin: 0.4rem 0.2rem 0.2rem 0;
|
|
179
|
+
padding: 2px 5px;
|
|
180
|
+
background-color: var(--primary-color);
|
|
181
|
+
color: var(--light-color);
|
|
182
|
+
}
|
|
183
|
+
.select2-container--default .select2-search--inline .select2-search__field {
|
|
184
|
+
line-height: normal;
|
|
185
|
+
}
|
|
186
|
+
/* Adjustment styling for Choices */
|
|
187
|
+
.choices {
|
|
188
|
+
margin-bottom: auto;
|
|
189
|
+
}
|
|
190
|
+
.choices__list--multiple .choices__item {
|
|
191
|
+
border: none;
|
|
192
|
+
background-color: var(--primary-color);
|
|
193
|
+
color: var(--light-color);
|
|
194
|
+
}
|
|
195
|
+
.choices[data-type*="select-multiple"] .choices__button {
|
|
196
|
+
border-left: 0.05rem solid #2826a6;
|
|
197
|
+
}
|
|
198
|
+
.choices__inner {
|
|
199
|
+
font-size: inherit;
|
|
200
|
+
min-height: 20px;
|
|
201
|
+
padding: 4px 7.5px 4px 3.75px;
|
|
202
|
+
}
|
|
203
|
+
.choices[data-type*="select-one"] .choices__inner {
|
|
204
|
+
padding-bottom: 4px;
|
|
205
|
+
}
|
|
206
|
+
.choices__list--dropdown .choices__item {
|
|
207
|
+
font-size: inherit;
|
|
208
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
/* eslint-disable */
|
|
2
|
+
export default {"*":"--primary-color:%235755d9;--gray-color:%23bcc3ce;--light-color:%23fff",".slider:focus":"box-shadow:none","h4 > label + .btn-group":"margin-left:1rem",".text-right > button":"margin-right:0%20!important",".text-left > button":"margin-left:0%20!important",".property-selector":"font-size:0.7rem;font-weight:normal;max-height:260px%20!important;width:395px%20!important",".property-selector .form-checkbox":"margin:0","textarea":"width:100%25;min-height:2rem;resize:vertical","table":"border-collapse:collapse",".table td":"padding:0.4rem%200.4rem",".mr-5":"margin-right:1rem%20!important","div[data-schematype]:not([data-schematype='object'])":"transition:0.5s","div[data-schematype]:not([data-schematype='object']):hover":"background-color:%23eee",".je-table-border td":"border:0.05rem%20solid%20%23dadee4%20!important",".btn-info":"font-size:0.5rem;font-weight:bold;height:0.8rem;padding:0.15rem%200;line-height:0.8;margin:0.3rem%200%200.3rem%200.1rem",".je-label + select":"min-width:5rem",".je-label":"font-weight:600",".btn-action.btn-info":"width:0.8rem",".je-border":"border:0.05rem%20solid%20%23dadee4",".je-panel":"padding:0.2rem;margin:0.2rem;background-color:rgba(218%2C%20222%2C%20228%2C%200.1)",".je-panel-top":"padding:0.2rem;margin:0.2rem;background-color:rgba(218%2C%20222%2C%20228%2C%200.1)",".required:after":"content:%22%20*%22;color:red;font:inherit",".je-align-bottom":"margin-top:auto",".je-desc":"font-size:smaller;margin:0.2rem%200",".je-upload-preview img":"float:left;margin:0%200.5rem%200.5rem%200;max-width:100%25;max-height:5rem;border:3px%20solid%20white;box-shadow:0px%200px%208px%20rgba(0%2C%200%2C%200%2C%200.3);box-sizing:border-box",".je-dropzone":"position:relative;margin:0.5rem%200;border:2px%20dashed%20black;width:100%25;height:60px;background:teal;transition:all%200.5s",".je-dropzone:before":"position:absolute;content:attr(data-text);color:rgba(0%2C%200%2C%200%2C%200.6);left:50%25;top:50%25;transform:translate(-50%25%2C%20-50%25)",".je-dropzone.valid-dropzone":"background:green",".je-dropzone.invalid-dropzone":"background:red",".columns .container.je-noindent":"padding-left:0;padding-right:0",".selectize-control.multi .item":"background:var(--primary-color)%20!important",".select2-container--default .select2-selection--single .select2-selection__arrow":"display:none",".select2-container--default .select2-selection--single":"border:none",".select2-container .select2-selection--single .select2-selection__rendered":"padding:0",".select2-container .select2-search--inline .select2-search__field":"margin-top:0",".select2-container--default.select2-container--focus .select2-selection--multiple":"border:0.05rem%20solid%20var(--gray-color)",".select2-container--default .select2-selection--multiple .select2-selection__choice":"margin:0.4rem%200.2rem%200.2rem%200;padding:2px%205px;background-color:var(--primary-color);color:var(--light-color)",".select2-container--default .select2-search--inline .select2-search__field":"line-height:normal",".choices":"margin-bottom:auto",".choices__list--multiple .choices__item":"border:none;background-color:var(--primary-color);color:var(--light-color)",".choices[data-type*='select-multiple'] .choices__button":"border-left:0.05rem%20solid%20%232826a6",".choices__inner":"font-size:inherit;min-height:20px;padding:4px%207.5px%204px%203.75px",".choices[data-type*='select-one'] .choices__inner":"padding-bottom:4px",".choices__list--dropdown .choices__item":"font-size:inherit"}
|
|
3
|
+
/* eslint-enable */
|
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
/* Spectre Theme using Spectre CSS framework. <https://picturepan2.github.io/spectre/index.html> */
|
|
2
|
+
import { AbstractTheme } from '../theme.js'
|
|
3
|
+
import rules from './spectre.css.js'
|
|
4
|
+
|
|
5
|
+
/* Config options that allows changing various aspects of the output */
|
|
6
|
+
const options = {
|
|
7
|
+
disable_theme_rules: false, /* Disable creation of Inline Style Rules */
|
|
8
|
+
label_bold: true, /* Element labels bold */
|
|
9
|
+
align_bottom: false, /* Align elements to bottom of flex container */
|
|
10
|
+
object_indent: false, /* Indent nested object elements */
|
|
11
|
+
object_border: false, /* Add border around object elements */
|
|
12
|
+
table_border: false, /* Add border to array "table" row and cells */
|
|
13
|
+
table_zebrastyle: false, /* Add "zebra style" to array "table" rows */
|
|
14
|
+
input_size: 'normal' /* Size of input and select elements. "small", "normal", "large" */
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export class spectreTheme extends AbstractTheme {
|
|
18
|
+
constructor (jsoneditor) {
|
|
19
|
+
super(jsoneditor, options)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Functions for setting up the grid container, row and columns */
|
|
23
|
+
setGridColumnSize (el, size, offset) {
|
|
24
|
+
el.classList.add(`col-${size}`)
|
|
25
|
+
if (offset) el.classList.add('col-mx-auto')
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
getGridContainer () {
|
|
29
|
+
const el = document.createElement('div')
|
|
30
|
+
el.classList.add('container')
|
|
31
|
+
if (!this.options.object_indent) el.classList.add('je-noindent')
|
|
32
|
+
return el
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
getGridRow () {
|
|
36
|
+
const el = document.createElement('div')
|
|
37
|
+
el.classList.add('columns')
|
|
38
|
+
return el
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
getGridColumn () {
|
|
42
|
+
const el = document.createElement('div')
|
|
43
|
+
el.classList.add('column')
|
|
44
|
+
if (this.options.align_bottom) el.classList.add('je-align-bottom')
|
|
45
|
+
return el
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/* Used for "type: object" or "type: array" (except if "format: tabs-top") */
|
|
49
|
+
getIndentedPanel () {
|
|
50
|
+
const el = document.createElement('div')
|
|
51
|
+
el.classList.add('je-panel')
|
|
52
|
+
if (this.options.object_border) el.classList.add('je-border')
|
|
53
|
+
return el
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/* Used for "type: array" with "format: tabs-top" */
|
|
57
|
+
getTopIndentedPanel () {
|
|
58
|
+
const el = document.createElement('div')
|
|
59
|
+
el.classList.add('je-panel-top')
|
|
60
|
+
if (this.options.object_border) el.classList.add('je-border')
|
|
61
|
+
return el
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/* Button functions */
|
|
65
|
+
getHeaderButtonHolder () {
|
|
66
|
+
const el = this.getButtonHolder()
|
|
67
|
+
return el
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* Button holder for the buttons */
|
|
71
|
+
getButtonHolder () {
|
|
72
|
+
const el = super.getButtonHolder()
|
|
73
|
+
el.classList.add('btn-group')
|
|
74
|
+
return el
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
getFormButtonHolder (buttonAlign) {
|
|
78
|
+
const el = super.getFormButtonHolder()
|
|
79
|
+
el.classList.remove('btn-group')
|
|
80
|
+
el.classList.add('d-block')
|
|
81
|
+
if (buttonAlign === 'center') el.classList.add('text-center')
|
|
82
|
+
else if (buttonAlign === 'right') el.classList.add('text-right')
|
|
83
|
+
else el.classList.add('text-left')
|
|
84
|
+
return el
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
getFormButton (text, icon, title) {
|
|
88
|
+
const el = super.getFormButton(text, icon, title)
|
|
89
|
+
el.classList.add('btn', 'btn-primary', 'mx-2', 'my-1')
|
|
90
|
+
if (this.options.input_size !== 'small') el.classList.remove('btn-sm')
|
|
91
|
+
if (this.options.input_size === 'large') el.classList.add('btn-lg')
|
|
92
|
+
return el
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
getButton (text, icon, title) {
|
|
96
|
+
const el = super.getButton(text, icon, title)
|
|
97
|
+
el.classList.add('btn', 'btn-sm', 'btn-primary', 'mr-2', 'my-1')
|
|
98
|
+
return el
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
getHeader (text, pathDepth) {
|
|
102
|
+
const el = document.createElement('h4')
|
|
103
|
+
if (typeof text === 'string') {
|
|
104
|
+
el.textContent = text
|
|
105
|
+
} else {
|
|
106
|
+
el.appendChild(text)
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
el.style.display = 'inline-block'
|
|
110
|
+
|
|
111
|
+
return el
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
getFormInputDescription (text) {
|
|
115
|
+
const el = super.getFormInputDescription(text)
|
|
116
|
+
el.classList.add('je-desc', 'hide-sm')
|
|
117
|
+
return el
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* Label for all elements except checkbox and radio */
|
|
121
|
+
getFormInputLabel (text, req) {
|
|
122
|
+
const el = super.getFormInputLabel(text, req)
|
|
123
|
+
if (this.options.label_bold) el.classList.add('je-label')
|
|
124
|
+
return el
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/* Checkbox elements */
|
|
128
|
+
/* ToDo: Rename function names for consistency */
|
|
129
|
+
getCheckbox () {
|
|
130
|
+
const el = this.getFormInputField('checkbox')
|
|
131
|
+
return el
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
getCheckboxLabel (text, req) {
|
|
135
|
+
const el = super.getCheckboxLabel(text, req); const icon = document.createElement('i')
|
|
136
|
+
icon.classList.add('form-icon')
|
|
137
|
+
el.classList.add('form-checkbox', 'mr-5')
|
|
138
|
+
el.insertBefore(icon, el.firstChild)
|
|
139
|
+
return el
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
getFormCheckboxControl (label, input, compact) {
|
|
143
|
+
label.insertBefore(input, label.firstChild) /* Move input into label element */
|
|
144
|
+
if (compact) label.classList.add('form-inline')
|
|
145
|
+
return label
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
getMultiCheckboxHolder (controls, label, description, infoText) {
|
|
149
|
+
return super.getMultiCheckboxHolder(controls, label, description, infoText)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/* Radio elements */
|
|
153
|
+
getFormRadio (attributes) {
|
|
154
|
+
const el = this.getFormInputField('radio')
|
|
155
|
+
for (const key in attributes) {
|
|
156
|
+
el.setAttribute(key, attributes[key])
|
|
157
|
+
}
|
|
158
|
+
return el
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
getFormRadioLabel (text, req) {
|
|
162
|
+
const el = super.getFormRadioLabel(text, req); const icon = document.createElement('i')
|
|
163
|
+
icon.classList.add('form-icon')
|
|
164
|
+
el.classList.add('form-radio')
|
|
165
|
+
el.insertBefore(icon, el.firstChild)
|
|
166
|
+
return el
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
getFormRadioControl (label, input, compact) {
|
|
170
|
+
label.insertBefore(input, label.firstChild) /* Move input into label element */
|
|
171
|
+
if (compact) label.classList.add('form-inline')
|
|
172
|
+
return label
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/* Create input field */
|
|
176
|
+
getFormInputField (type) {
|
|
177
|
+
const el = super.getFormInputField(type)
|
|
178
|
+
if (!['checkbox', 'radio'].includes(type)) {
|
|
179
|
+
el.classList.add('form-input')
|
|
180
|
+
}
|
|
181
|
+
return el
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/* Create input field for type="range" */
|
|
185
|
+
getRangeInput (min, max, step) {
|
|
186
|
+
const el = this.getFormInputField('range')
|
|
187
|
+
el.classList.add('slider')
|
|
188
|
+
el.classList.remove('form-input')
|
|
189
|
+
el.setAttribute('oninput', 'this.setAttribute("value", this.value)')
|
|
190
|
+
el.setAttribute('min', min)
|
|
191
|
+
el.setAttribute('max', max)
|
|
192
|
+
el.setAttribute('step', step)
|
|
193
|
+
return el
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
getRangeControl (input, output) {
|
|
197
|
+
const el = super.getRangeControl(input, output)
|
|
198
|
+
el.classList.add('text-center')
|
|
199
|
+
return el
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
/* Create select box field */
|
|
203
|
+
getSelectInput (options, multiple) {
|
|
204
|
+
const el = super.getSelectInput(options)
|
|
205
|
+
el.classList.add('form-select')
|
|
206
|
+
return el
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/* Create textarea field */
|
|
210
|
+
getTextareaInput () {
|
|
211
|
+
const el = document.createElement('textarea')
|
|
212
|
+
el.classList.add('form-input')
|
|
213
|
+
return el
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
getFormControl (label, input, description, infoText) {
|
|
217
|
+
const group = document.createElement('div')
|
|
218
|
+
group.classList.add('form-group')
|
|
219
|
+
|
|
220
|
+
if (label && (input.type === 'checkbox' || input.type === 'radio')) {
|
|
221
|
+
group.classList.add(input.type)
|
|
222
|
+
label.insertBefore(input, label.firstChild)
|
|
223
|
+
group.appendChild(label)
|
|
224
|
+
} else {
|
|
225
|
+
if (label) {
|
|
226
|
+
label.classList.add('form-label')
|
|
227
|
+
group.appendChild(label)
|
|
228
|
+
if (infoText) label.appendChild(infoText)
|
|
229
|
+
}
|
|
230
|
+
group.appendChild(input)
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (this.options.input_size === 'small') input.classList.add('input-sm', 'select-sm')
|
|
234
|
+
else if (this.options.input_size === 'large') input.classList.add('input-lg', 'select-lg')
|
|
235
|
+
if (input.type !== 'checkbox') group.appendChild(input)
|
|
236
|
+
|
|
237
|
+
if (description) group.appendChild(description)
|
|
238
|
+
|
|
239
|
+
return group
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/* Create input group (input field with buttons) */
|
|
243
|
+
getInputGroup (input, buttons) {
|
|
244
|
+
if (!input) return
|
|
245
|
+
|
|
246
|
+
const inputGroup = document.createElement('div')
|
|
247
|
+
inputGroup.classList.add('input-group')
|
|
248
|
+
inputGroup.appendChild(input)
|
|
249
|
+
for (let i = 0; i < buttons.length; i++) {
|
|
250
|
+
buttons[i].classList.add('input-group-btn')
|
|
251
|
+
buttons[i].classList.remove('btn-sm', 'mr-2', 'my-1')
|
|
252
|
+
inputGroup.appendChild(buttons[i])
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
return inputGroup
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/* Create button for displaying infotext tooltip */
|
|
259
|
+
getInfoButton (text) {
|
|
260
|
+
const popover = document.createElement('div')
|
|
261
|
+
popover.classList.add('popover', 'popover-left', 'float-right')
|
|
262
|
+
|
|
263
|
+
const button = document.createElement('button')
|
|
264
|
+
button.classList.add('btn', 'btn-secondary', 'btn-info', 'btn-action', 's-circle')
|
|
265
|
+
button.setAttribute('tabindex', '-1') /* exclude element from tab order */
|
|
266
|
+
popover.appendChild(button)
|
|
267
|
+
|
|
268
|
+
const icon = document.createTextNode('I')
|
|
269
|
+
button.appendChild(icon)
|
|
270
|
+
|
|
271
|
+
const container = document.createElement('div')
|
|
272
|
+
container.classList.add('popover-container')
|
|
273
|
+
popover.appendChild(container)
|
|
274
|
+
|
|
275
|
+
const card = document.createElement('div')
|
|
276
|
+
card.classList.add('card')
|
|
277
|
+
container.appendChild(card)
|
|
278
|
+
|
|
279
|
+
const cardbody = document.createElement('div')
|
|
280
|
+
cardbody.classList.add('card-body')
|
|
281
|
+
cardbody.innerHTML = text
|
|
282
|
+
card.appendChild(cardbody)
|
|
283
|
+
|
|
284
|
+
return popover
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/* Functions for rendering array with format: "table" */
|
|
288
|
+
getTable () {
|
|
289
|
+
const el = super.getTable()
|
|
290
|
+
el.classList.add('table', 'table-scroll')
|
|
291
|
+
if (this.options.table_border) el.classList.add('je-table-border')
|
|
292
|
+
if (this.options.table_zebrastyle) el.classList.add('table-striped')
|
|
293
|
+
return el
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/* Function for rendering progressbar */
|
|
297
|
+
getProgressBar () {
|
|
298
|
+
const progressBar = super.getProgressBar()
|
|
299
|
+
progressBar.classList.add('progress')
|
|
300
|
+
return progressBar
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/* Containers for array with format: "tab" */
|
|
304
|
+
getTabHolder (propertyName) {
|
|
305
|
+
const pName = typeof propertyName === 'undefined' ? '' : propertyName
|
|
306
|
+
const el = document.createElement('div')
|
|
307
|
+
el.classList.add('columns')
|
|
308
|
+
el.innerHTML = `<div class="column col-2"></div><div class="column col-10 content" id="${pName}"></div>`
|
|
309
|
+
return el
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
/* Containers for array with format: "tab-top" */
|
|
313
|
+
getTopTabHolder (propertyName) {
|
|
314
|
+
const pName = typeof propertyName === 'undefined' ? '' : propertyName
|
|
315
|
+
const el = document.createElement('div')
|
|
316
|
+
el.innerHTML = `<ul class="tab"></ul><div class="content" id="${pName}"></div>`
|
|
317
|
+
return el
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
/* Tab button for array with format: "tab" */
|
|
321
|
+
getTab (span, tabId) {
|
|
322
|
+
const el = document.createElement('a')
|
|
323
|
+
el.classList.add('btn', 'btn-secondary', 'btn-block')
|
|
324
|
+
el.setAttribute('href', `#${tabId}`)
|
|
325
|
+
el.appendChild(span)
|
|
326
|
+
return el
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/* Tab button for array with format: "tab-top" */
|
|
330
|
+
getTopTab (span, tabId) {
|
|
331
|
+
const el = document.createElement('li')
|
|
332
|
+
el.id = tabId
|
|
333
|
+
el.classList.add('tab-item')
|
|
334
|
+
|
|
335
|
+
/* Spectre needs an a tag inside the tab item, not a span */
|
|
336
|
+
const a = document.createElement('a')
|
|
337
|
+
a.setAttribute('href', `#${tabId}`)
|
|
338
|
+
a.appendChild(span)
|
|
339
|
+
|
|
340
|
+
el.appendChild(a)
|
|
341
|
+
return el
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
markTabActive (row) {
|
|
345
|
+
row.tab.classList.add('active')
|
|
346
|
+
if (typeof row.rowPane !== 'undefined') row.rowPane.style.display = ''
|
|
347
|
+
else row.container.style.display = ''
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
markTabInactive (row) {
|
|
351
|
+
row.tab.classList.remove('active')
|
|
352
|
+
if (typeof row.rowPane !== 'undefined') row.rowPane.style.display = 'none'
|
|
353
|
+
else row.container.style.display = 'none'
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
afterInputReady (input) {
|
|
357
|
+
if (input.localName === 'select') {
|
|
358
|
+
/* Selectize adjustments */
|
|
359
|
+
if (input.classList.contains('selectized')) {
|
|
360
|
+
const selectized = input.nextSibling
|
|
361
|
+
if (selectized) {
|
|
362
|
+
/* Remove Spectre class 'form-select' as this conflicts with Selectize styling */
|
|
363
|
+
selectized.classList.remove('form-select')
|
|
364
|
+
Array.from(selectized.querySelectorAll('.form-select')).forEach(el => {
|
|
365
|
+
el.classList.remove('form-select')
|
|
366
|
+
})
|
|
367
|
+
}
|
|
368
|
+
/* Select2 ajustments */
|
|
369
|
+
} else if (input.classList.contains('select2-hidden-accessible')) {
|
|
370
|
+
const select2 = input.nextSibling
|
|
371
|
+
const single = select2 && select2.querySelector('.select2-selection--single')
|
|
372
|
+
/* Add Spectre 'form-select' to single-select2 elements */
|
|
373
|
+
if (single) select2.classList.add('form-select')
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
if (input.controlgroup) return
|
|
378
|
+
input.controlgroup = this.closest(input, '.form-group')
|
|
379
|
+
if (this.closest(input, '.compact')) {
|
|
380
|
+
input.controlgroup.style.marginBottom = 0
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
/* Controls output of errormessages displayed in form */
|
|
385
|
+
addInputError (input, text) {
|
|
386
|
+
if (!input.controlgroup) return
|
|
387
|
+
input.controlgroup.classList.add('has-error')
|
|
388
|
+
if (!input.errmsg) {
|
|
389
|
+
input.errmsg = document.createElement('p')
|
|
390
|
+
input.errmsg.classList.add('form-input-hint')
|
|
391
|
+
input.controlgroup.appendChild(input.errmsg)
|
|
392
|
+
}
|
|
393
|
+
input.errmsg.classList.remove('d-hide')
|
|
394
|
+
input.errmsg.textContent = text
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
removeInputError (input) {
|
|
398
|
+
if (!input.errmsg) return
|
|
399
|
+
input.errmsg.classList.add('d-hide')
|
|
400
|
+
input.controlgroup.classList.remove('has-error')
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
/* Custom stylesheet rules. (Does not support comma separated selectors) */
|
|
405
|
+
/* Will create a stylesheet in document head with the id "theme-spectre" if not exists. */
|
|
406
|
+
spectreTheme.rules = rules
|