@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
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* * @name JSON Editor
|
|
4
4
|
* * @description JSON Schema Based Editor
|
|
5
5
|
* * This library is the continuation of jdorn's great work (see also https://github.com/jdorn/json-editor/issues/800)
|
|
6
|
-
* * @version "2.15.
|
|
6
|
+
* * @version "2.15.2"
|
|
7
7
|
* * @author Jeremy Dorn
|
|
8
8
|
* * @see https://github.com/jdorn/json-editor/
|
|
9
9
|
* * @see https://github.com/json-editor/json-editor
|
|
@@ -519,7 +519,8 @@ var options = {
|
|
|
519
519
|
show_errors: 'interaction',
|
|
520
520
|
prompt_paste_max_length_reached: false,
|
|
521
521
|
remove_false_properties: false,
|
|
522
|
-
enforce_const: false
|
|
522
|
+
enforce_const: false,
|
|
523
|
+
opt_in_widget: 'checkbox'
|
|
523
524
|
};
|
|
524
525
|
|
|
525
526
|
/* This assignment was previously in index.js but makes more sense here */
|
|
@@ -672,7 +673,7 @@ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e
|
|
|
672
673
|
*/
|
|
673
674
|
var AbstractEditor = /*#__PURE__*/function () {
|
|
674
675
|
function AbstractEditor(options, defaults) {
|
|
675
|
-
var _this$options$enforce;
|
|
676
|
+
var _this$options$enforce, _this$options$opt_in_;
|
|
676
677
|
_classCallCheck(this, AbstractEditor);
|
|
677
678
|
this.defaults = defaults;
|
|
678
679
|
this.jsoneditor = options.jsoneditor;
|
|
@@ -686,7 +687,7 @@ var AbstractEditor = /*#__PURE__*/function () {
|
|
|
686
687
|
this.active = true;
|
|
687
688
|
this.isUiOnly = false;
|
|
688
689
|
this.options = (0,_utilities_js__WEBPACK_IMPORTED_MODULE_33__.extend)({}, this.options || {}, this.schema.options || {}, options.schema.options || {}, options);
|
|
689
|
-
this.
|
|
690
|
+
this.enforceConstEnabled = (_this$options$enforce = this.options.enforce_const) !== null && _this$options$enforce !== void 0 ? _this$options$enforce : this.jsoneditor.options.enforce_const;
|
|
690
691
|
this.formname = this.jsoneditor.options.form_name_root || 'root';
|
|
691
692
|
if (!options.path && !this.schema.id) this.schema.id = this.formname;
|
|
692
693
|
this.path = options.path || this.formname;
|
|
@@ -695,6 +696,7 @@ var AbstractEditor = /*#__PURE__*/function () {
|
|
|
695
696
|
this.key = this.parent !== undefined ? this.path.split('.').slice(this.parent.path.split('.').length).join('.') : this.path;
|
|
696
697
|
this.link_watchers = [];
|
|
697
698
|
this.watchLoop = false;
|
|
699
|
+
this.optInWidget = (_this$options$opt_in_ = this.options.opt_in_widget) !== null && _this$options$opt_in_ !== void 0 ? _this$options$opt_in_ : this.jsoneditor.options.opt_in_widget;
|
|
698
700
|
if (options.container) this.setContainer(options.container);
|
|
699
701
|
this.registerDependencies();
|
|
700
702
|
}
|
|
@@ -885,17 +887,16 @@ var AbstractEditor = /*#__PURE__*/function () {
|
|
|
885
887
|
}
|
|
886
888
|
}, {
|
|
887
889
|
key: "setOptInCheckbox",
|
|
888
|
-
value: function setOptInCheckbox(
|
|
890
|
+
value: function setOptInCheckbox() {
|
|
889
891
|
var _this4 = this;
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
this.optInCheckbox
|
|
897
|
-
this.
|
|
898
|
-
this.optInCheckbox.classList.add('json-editor-opt-in');
|
|
892
|
+
var optIn;
|
|
893
|
+
if (this.optInWidget === 'switch') {
|
|
894
|
+
optIn = this.theme.getOptInSwitch(this.formname);
|
|
895
|
+
} else {
|
|
896
|
+
optIn = this.theme.getOptInCheckbox(this.formname);
|
|
897
|
+
}
|
|
898
|
+
this.optInCheckbox = optIn.checkbox;
|
|
899
|
+
this.optInContainer = optIn.container;
|
|
899
900
|
this.optInCheckbox.addEventListener('click', function () {
|
|
900
901
|
if (_this4.isActive()) {
|
|
901
902
|
_this4.deactivate();
|
|
@@ -912,9 +913,8 @@ var AbstractEditor = /*#__PURE__*/function () {
|
|
|
912
913
|
if (parentOptInEnabled || !parentOptInDisabled && globalOptIn || !parentOptInDefined && globalOptIn) {
|
|
913
914
|
/* and control to type object editors if they are not required */
|
|
914
915
|
if (this.parent && this.parent.schema.type === 'object' && !this.isRequired() && this.header) {
|
|
915
|
-
this.header.
|
|
916
|
-
this.
|
|
917
|
-
this.header.insertBefore(this.optInCheckbox, this.header.firstChild);
|
|
916
|
+
this.header.insertBefore(this.optInContainer, this.header.firstChild);
|
|
917
|
+
this.optInAppended = true;
|
|
918
918
|
}
|
|
919
919
|
}
|
|
920
920
|
}
|
|
@@ -937,7 +937,7 @@ var AbstractEditor = /*#__PURE__*/function () {
|
|
|
937
937
|
this.theme.visuallyHidden(this.label);
|
|
938
938
|
this.theme.visuallyHidden(this.header);
|
|
939
939
|
}
|
|
940
|
-
if (this.
|
|
940
|
+
if (this.enforceConstEnabled && this.schema["const"]) {
|
|
941
941
|
this.disable();
|
|
942
942
|
}
|
|
943
943
|
}
|
|
@@ -1238,8 +1238,17 @@ var AbstractEditor = /*#__PURE__*/function () {
|
|
|
1238
1238
|
}, {
|
|
1239
1239
|
key: "setValue",
|
|
1240
1240
|
value: function setValue(value) {
|
|
1241
|
+
value = this.applyConstFilter(value);
|
|
1241
1242
|
this.value = value;
|
|
1242
1243
|
}
|
|
1244
|
+
}, {
|
|
1245
|
+
key: "applyConstFilter",
|
|
1246
|
+
value: function applyConstFilter(value) {
|
|
1247
|
+
if (this.enforceConstEnabled && typeof this.schema["const"] !== 'undefined') {
|
|
1248
|
+
value = this.schema["const"];
|
|
1249
|
+
}
|
|
1250
|
+
return value;
|
|
1251
|
+
}
|
|
1243
1252
|
}, {
|
|
1244
1253
|
key: "getValue",
|
|
1245
1254
|
value: function getValue() {
|
|
@@ -1288,7 +1297,7 @@ var AbstractEditor = /*#__PURE__*/function () {
|
|
|
1288
1297
|
}, {
|
|
1289
1298
|
key: "getDefault",
|
|
1290
1299
|
value: function getDefault() {
|
|
1291
|
-
if (this.
|
|
1300
|
+
if (this.enforceConstEnabled && this.schema["const"]) {
|
|
1292
1301
|
return this.schema["const"];
|
|
1293
1302
|
}
|
|
1294
1303
|
if (typeof this.schema["default"] !== 'undefined') {
|
|
@@ -1536,6 +1545,7 @@ var AceEditor = /*#__PURE__*/function (_StringEditor) {
|
|
|
1536
1545
|
return _createClass(AceEditor, [{
|
|
1537
1546
|
key: "setValue",
|
|
1538
1547
|
value: function setValue(value, initial, fromTemplate) {
|
|
1548
|
+
value = this.applyConstFilter(value);
|
|
1539
1549
|
var res = _get(_getPrototypeOf(AceEditor.prototype), "setValue", this).call(this, value, initial, fromTemplate);
|
|
1540
1550
|
if (res !== undefined && res.changed && this.ace_editor_instance) {
|
|
1541
1551
|
this.ace_editor_instance.setValue(res.value);
|
|
@@ -1652,7 +1662,8 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1652
1662
|
|
|
1653
1663
|
__webpack_require__.r(__webpack_exports__);
|
|
1654
1664
|
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
1655
|
-
/* harmony export */ ArrayEditor: () => (/* binding */ ArrayEditor)
|
|
1665
|
+
/* harmony export */ ArrayEditor: () => (/* binding */ ArrayEditor),
|
|
1666
|
+
/* harmony export */ supportDragDrop: () => (/* binding */ supportDragDrop)
|
|
1656
1667
|
/* harmony export */ });
|
|
1657
1668
|
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.symbol.js */ "./node_modules/core-js/modules/es.symbol.js");
|
|
1658
1669
|
/* harmony import */ var core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_symbol_js__WEBPACK_IMPORTED_MODULE_0__);
|
|
@@ -1680,41 +1691,43 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
1680
1691
|
/* harmony import */ var core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_11___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_slice_js__WEBPACK_IMPORTED_MODULE_11__);
|
|
1681
1692
|
/* harmony import */ var core_js_modules_es_array_some_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! core-js/modules/es.array.some.js */ "./node_modules/core-js/modules/es.array.some.js");
|
|
1682
1693
|
/* harmony import */ var core_js_modules_es_array_some_js__WEBPACK_IMPORTED_MODULE_12___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_some_js__WEBPACK_IMPORTED_MODULE_12__);
|
|
1683
|
-
/* harmony import */ var
|
|
1684
|
-
/* harmony import */ var
|
|
1685
|
-
/* harmony import */ var
|
|
1686
|
-
/* harmony import */ var
|
|
1687
|
-
/* harmony import */ var
|
|
1688
|
-
/* harmony import */ var
|
|
1689
|
-
/* harmony import */ var
|
|
1690
|
-
/* harmony import */ var
|
|
1691
|
-
/* harmony import */ var
|
|
1692
|
-
/* harmony import */ var
|
|
1693
|
-
/* harmony import */ var
|
|
1694
|
-
/* harmony import */ var
|
|
1695
|
-
/* harmony import */ var
|
|
1696
|
-
/* harmony import */ var
|
|
1697
|
-
/* harmony import */ var
|
|
1698
|
-
/* harmony import */ var
|
|
1699
|
-
/* harmony import */ var
|
|
1700
|
-
/* harmony import */ var
|
|
1701
|
-
/* harmony import */ var
|
|
1702
|
-
/* harmony import */ var
|
|
1703
|
-
/* harmony import */ var
|
|
1704
|
-
/* harmony import */ var
|
|
1705
|
-
/* harmony import */ var
|
|
1706
|
-
/* harmony import */ var
|
|
1707
|
-
/* harmony import */ var
|
|
1708
|
-
/* harmony import */ var
|
|
1709
|
-
/* harmony import */ var
|
|
1710
|
-
/* harmony import */ var
|
|
1711
|
-
/* harmony import */ var
|
|
1712
|
-
/* harmony import */ var
|
|
1713
|
-
/* harmony import */ var
|
|
1714
|
-
/* harmony import */ var
|
|
1715
|
-
/* harmony import */ var
|
|
1716
|
-
/* harmony import */ var
|
|
1717
|
-
/* harmony import */ var
|
|
1694
|
+
/* harmony import */ var core_js_modules_es_array_splice_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! core-js/modules/es.array.splice.js */ "./node_modules/core-js/modules/es.array.splice.js");
|
|
1695
|
+
/* harmony import */ var core_js_modules_es_array_splice_js__WEBPACK_IMPORTED_MODULE_13___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_array_splice_js__WEBPACK_IMPORTED_MODULE_13__);
|
|
1696
|
+
/* harmony import */ var core_js_modules_es_date_to_json_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! core-js/modules/es.date.to-json.js */ "./node_modules/core-js/modules/es.date.to-json.js");
|
|
1697
|
+
/* harmony import */ var core_js_modules_es_date_to_json_js__WEBPACK_IMPORTED_MODULE_14___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_date_to_json_js__WEBPACK_IMPORTED_MODULE_14__);
|
|
1698
|
+
/* harmony import */ var core_js_modules_es_date_to_primitive_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! core-js/modules/es.date.to-primitive.js */ "./node_modules/core-js/modules/es.date.to-primitive.js");
|
|
1699
|
+
/* harmony import */ var core_js_modules_es_date_to_primitive_js__WEBPACK_IMPORTED_MODULE_15___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_date_to_primitive_js__WEBPACK_IMPORTED_MODULE_15__);
|
|
1700
|
+
/* harmony import */ var core_js_modules_es_function_bind_js__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! core-js/modules/es.function.bind.js */ "./node_modules/core-js/modules/es.function.bind.js");
|
|
1701
|
+
/* harmony import */ var core_js_modules_es_function_bind_js__WEBPACK_IMPORTED_MODULE_16___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_function_bind_js__WEBPACK_IMPORTED_MODULE_16__);
|
|
1702
|
+
/* harmony import */ var core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! core-js/modules/es.number.constructor.js */ "./node_modules/core-js/modules/es.number.constructor.js");
|
|
1703
|
+
/* harmony import */ var core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_17___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_number_constructor_js__WEBPACK_IMPORTED_MODULE_17__);
|
|
1704
|
+
/* harmony import */ var core_js_modules_es_object_create_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! core-js/modules/es.object.create.js */ "./node_modules/core-js/modules/es.object.create.js");
|
|
1705
|
+
/* harmony import */ var core_js_modules_es_object_create_js__WEBPACK_IMPORTED_MODULE_18___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_create_js__WEBPACK_IMPORTED_MODULE_18__);
|
|
1706
|
+
/* harmony import */ var core_js_modules_es_object_define_property_js__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! core-js/modules/es.object.define-property.js */ "./node_modules/core-js/modules/es.object.define-property.js");
|
|
1707
|
+
/* harmony import */ var core_js_modules_es_object_define_property_js__WEBPACK_IMPORTED_MODULE_19___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_define_property_js__WEBPACK_IMPORTED_MODULE_19__);
|
|
1708
|
+
/* harmony import */ var core_js_modules_es_object_get_own_property_descriptor_js__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! core-js/modules/es.object.get-own-property-descriptor.js */ "./node_modules/core-js/modules/es.object.get-own-property-descriptor.js");
|
|
1709
|
+
/* harmony import */ var core_js_modules_es_object_get_own_property_descriptor_js__WEBPACK_IMPORTED_MODULE_20___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_get_own_property_descriptor_js__WEBPACK_IMPORTED_MODULE_20__);
|
|
1710
|
+
/* harmony import */ var core_js_modules_es_object_get_prototype_of_js__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! core-js/modules/es.object.get-prototype-of.js */ "./node_modules/core-js/modules/es.object.get-prototype-of.js");
|
|
1711
|
+
/* harmony import */ var core_js_modules_es_object_get_prototype_of_js__WEBPACK_IMPORTED_MODULE_21___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_get_prototype_of_js__WEBPACK_IMPORTED_MODULE_21__);
|
|
1712
|
+
/* harmony import */ var core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! core-js/modules/es.object.keys.js */ "./node_modules/core-js/modules/es.object.keys.js");
|
|
1713
|
+
/* harmony import */ var core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_22___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_keys_js__WEBPACK_IMPORTED_MODULE_22__);
|
|
1714
|
+
/* harmony import */ var core_js_modules_es_object_set_prototype_of_js__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! core-js/modules/es.object.set-prototype-of.js */ "./node_modules/core-js/modules/es.object.set-prototype-of.js");
|
|
1715
|
+
/* harmony import */ var core_js_modules_es_object_set_prototype_of_js__WEBPACK_IMPORTED_MODULE_23___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_set_prototype_of_js__WEBPACK_IMPORTED_MODULE_23__);
|
|
1716
|
+
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! core-js/modules/es.object.to-string.js */ "./node_modules/core-js/modules/es.object.to-string.js");
|
|
1717
|
+
/* harmony import */ var core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_24___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_object_to_string_js__WEBPACK_IMPORTED_MODULE_24__);
|
|
1718
|
+
/* harmony import */ var core_js_modules_es_reflect_construct_js__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! core-js/modules/es.reflect.construct.js */ "./node_modules/core-js/modules/es.reflect.construct.js");
|
|
1719
|
+
/* harmony import */ var core_js_modules_es_reflect_construct_js__WEBPACK_IMPORTED_MODULE_25___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_reflect_construct_js__WEBPACK_IMPORTED_MODULE_25__);
|
|
1720
|
+
/* harmony import */ var core_js_modules_es_reflect_get_js__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! core-js/modules/es.reflect.get.js */ "./node_modules/core-js/modules/es.reflect.get.js");
|
|
1721
|
+
/* harmony import */ var core_js_modules_es_reflect_get_js__WEBPACK_IMPORTED_MODULE_26___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_reflect_get_js__WEBPACK_IMPORTED_MODULE_26__);
|
|
1722
|
+
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! core-js/modules/es.string.iterator.js */ "./node_modules/core-js/modules/es.string.iterator.js");
|
|
1723
|
+
/* harmony import */ var core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_27___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_es_string_iterator_js__WEBPACK_IMPORTED_MODULE_27__);
|
|
1724
|
+
/* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! core-js/modules/web.dom-collections.for-each.js */ "./node_modules/core-js/modules/web.dom-collections.for-each.js");
|
|
1725
|
+
/* harmony import */ var core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_28___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_for_each_js__WEBPACK_IMPORTED_MODULE_28__);
|
|
1726
|
+
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! core-js/modules/web.dom-collections.iterator.js */ "./node_modules/core-js/modules/web.dom-collections.iterator.js");
|
|
1727
|
+
/* harmony import */ var core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_29___default = /*#__PURE__*/__webpack_require__.n(core_js_modules_web_dom_collections_iterator_js__WEBPACK_IMPORTED_MODULE_29__);
|
|
1728
|
+
/* harmony import */ var _editor_js__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ../editor.js */ "./src/editor.js");
|
|
1729
|
+
/* harmony import */ var _utilities_js__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ../utilities.js */ "./src/utilities.js");
|
|
1730
|
+
/* harmony import */ var _array_css_js__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./array.css.js */ "./src/editors/array.css.js");
|
|
1718
1731
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
1719
1732
|
|
|
1720
1733
|
|
|
@@ -1743,6 +1756,7 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
|
|
|
1743
1756
|
|
|
1744
1757
|
|
|
1745
1758
|
|
|
1759
|
+
|
|
1746
1760
|
|
|
1747
1761
|
|
|
1748
1762
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
@@ -1938,6 +1952,7 @@ var ArrayEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
1938
1952
|
value: function onChildEditorChange(editor, eventData) {
|
|
1939
1953
|
this.refreshValue();
|
|
1940
1954
|
this.refreshTabs(true);
|
|
1955
|
+
this.is_dirty = true;
|
|
1941
1956
|
_get(_getPrototypeOf(ArrayEditor.prototype), "onChildEditorChange", this).call(this, editor, eventData);
|
|
1942
1957
|
}
|
|
1943
1958
|
}, {
|
|
@@ -1961,13 +1976,13 @@ var ArrayEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
1961
1976
|
if (this.schema.additionalItems === true) {
|
|
1962
1977
|
return {};
|
|
1963
1978
|
} else if (this.schema.additionalItems) {
|
|
1964
|
-
return (0,
|
|
1979
|
+
return (0,_utilities_js__WEBPACK_IMPORTED_MODULE_31__.extend)({}, this.schema.additionalItems);
|
|
1965
1980
|
}
|
|
1966
1981
|
} else {
|
|
1967
|
-
return (0,
|
|
1982
|
+
return (0,_utilities_js__WEBPACK_IMPORTED_MODULE_31__.extend)({}, this.schema.items[i]);
|
|
1968
1983
|
}
|
|
1969
1984
|
} else if (this.schema.items) {
|
|
1970
|
-
return (0,
|
|
1985
|
+
return (0,_utilities_js__WEBPACK_IMPORTED_MODULE_31__.extend)({}, this.schema.items);
|
|
1971
1986
|
} else {
|
|
1972
1987
|
return {};
|
|
1973
1988
|
}
|
|
@@ -2127,6 +2142,7 @@ var ArrayEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
2127
2142
|
var _this5 = this;
|
|
2128
2143
|
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
2129
2144
|
var initial = arguments.length > 1 ? arguments[1] : undefined;
|
|
2145
|
+
value = this.applyConstFilter(value);
|
|
2130
2146
|
/* Make sure value has between minItems and maxItems items in it */
|
|
2131
2147
|
value = this.ensureArraySize(value);
|
|
2132
2148
|
var serialized = JSON.stringify(value);
|
|
@@ -2276,6 +2292,9 @@ var ArrayEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
2276
2292
|
e.preventDefault();
|
|
2277
2293
|
e.stopPropagation();
|
|
2278
2294
|
});
|
|
2295
|
+
this._supportDragDrop(this.rows[i].tab);
|
|
2296
|
+
} else {
|
|
2297
|
+
this._supportDragDrop(this.rows[i].container, true);
|
|
2279
2298
|
}
|
|
2280
2299
|
var controlsHolder = this.rows[i].title_controls || this.rows[i].array_controls;
|
|
2281
2300
|
|
|
@@ -2353,12 +2372,12 @@ var ArrayEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
2353
2372
|
if (j === i) {
|
|
2354
2373
|
/* Force generation of new UUID if the item has been cloned. */
|
|
2355
2374
|
if (schema.items.type === 'string' && schema.items.format === 'uuid') {
|
|
2356
|
-
row = (0,
|
|
2375
|
+
row = (0,_utilities_js__WEBPACK_IMPORTED_MODULE_31__.generateUUID)();
|
|
2357
2376
|
} else if (schema.items.type === 'object' && schema.items.properties) {
|
|
2358
2377
|
for (var _i = 0, _Object$keys = Object.keys(row); _i < _Object$keys.length; _i++) {
|
|
2359
2378
|
var key = _Object$keys[_i];
|
|
2360
2379
|
if (schema.items.properties && schema.items.properties[key] && schema.items.properties[key].format === 'uuid') {
|
|
2361
|
-
row[key] = (0,
|
|
2380
|
+
row[key] = (0,_utilities_js__WEBPACK_IMPORTED_MODULE_31__.generateUUID)();
|
|
2362
2381
|
}
|
|
2363
2382
|
}
|
|
2364
2383
|
}
|
|
@@ -2427,6 +2446,24 @@ var ArrayEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
2427
2446
|
}
|
|
2428
2447
|
return button;
|
|
2429
2448
|
}
|
|
2449
|
+
}, {
|
|
2450
|
+
key: "_supportDragDrop",
|
|
2451
|
+
value: function _supportDragDrop(tab, useTrigger) {
|
|
2452
|
+
var _this12 = this;
|
|
2453
|
+
supportDragDrop(tab, function (i, j) {
|
|
2454
|
+
var rows = _this12.getValue();
|
|
2455
|
+
var tmp = rows[i];
|
|
2456
|
+
rows.splice(i, 1);
|
|
2457
|
+
rows.splice(j, 0, tmp);
|
|
2458
|
+
_this12.setValue(rows);
|
|
2459
|
+
_this12.active_tab = _this12.rows[j].tab;
|
|
2460
|
+
_this12.refreshTabs();
|
|
2461
|
+
_this12.onChange(true);
|
|
2462
|
+
_this12.jsoneditor.trigger('moveRow', _this12.rows[j]);
|
|
2463
|
+
}, {
|
|
2464
|
+
useTrigger: useTrigger
|
|
2465
|
+
});
|
|
2466
|
+
}
|
|
2430
2467
|
}, {
|
|
2431
2468
|
key: "addControls",
|
|
2432
2469
|
value: function addControls() {
|
|
@@ -2435,7 +2472,7 @@ var ArrayEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
2435
2472
|
|
|
2436
2473
|
/* If it should start collapsed */
|
|
2437
2474
|
if (this.options.collapsed) {
|
|
2438
|
-
(0,
|
|
2475
|
+
(0,_utilities_js__WEBPACK_IMPORTED_MODULE_31__.trigger)(this.toggle_button, 'click');
|
|
2439
2476
|
}
|
|
2440
2477
|
|
|
2441
2478
|
/* Collapse button disabled */
|
|
@@ -2458,7 +2495,7 @@ var ArrayEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
2458
2495
|
}, {
|
|
2459
2496
|
key: "_createToggleButton",
|
|
2460
2497
|
value: function _createToggleButton() {
|
|
2461
|
-
var
|
|
2498
|
+
var _this13 = this;
|
|
2462
2499
|
var button = this.getButton('', 'collapse', 'button_collapse');
|
|
2463
2500
|
button.classList.add('json-editor-btntype-toggle');
|
|
2464
2501
|
this.title.insertBefore(button, this.title.childNodes[0]);
|
|
@@ -2467,18 +2504,18 @@ var ArrayEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
2467
2504
|
button.addEventListener('click', function (e) {
|
|
2468
2505
|
e.preventDefault();
|
|
2469
2506
|
e.stopPropagation();
|
|
2470
|
-
if (
|
|
2471
|
-
if (
|
|
2472
|
-
if (
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2507
|
+
if (_this13.panel) _this13.setButtonState(_this13.panel, _this13.collapsed);
|
|
2508
|
+
if (_this13.tabs_holder) _this13.setButtonState(_this13.tabs_holder, _this13.collapsed);
|
|
2509
|
+
if (_this13.collapsed) {
|
|
2510
|
+
_this13.collapsed = false;
|
|
2511
|
+
_this13.row_holder.style.display = rowHolderDisplay;
|
|
2512
|
+
_this13.controls.style.display = controlsDisplay;
|
|
2513
|
+
_this13.setButtonText(e.currentTarget, '', 'collapse', 'button_collapse');
|
|
2477
2514
|
} else {
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2515
|
+
_this13.collapsed = true;
|
|
2516
|
+
_this13.row_holder.style.display = 'none';
|
|
2517
|
+
_this13.controls.style.display = 'none';
|
|
2518
|
+
_this13.setButtonText(e.currentTarget, '', 'expand', 'button_expand');
|
|
2482
2519
|
}
|
|
2483
2520
|
});
|
|
2484
2521
|
return button;
|
|
@@ -2486,28 +2523,32 @@ var ArrayEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
2486
2523
|
}, {
|
|
2487
2524
|
key: "_createAddRowButton",
|
|
2488
2525
|
value: function _createAddRowButton() {
|
|
2489
|
-
var
|
|
2526
|
+
var _this14 = this;
|
|
2490
2527
|
var button = this.getButton(this.getItemTitle(), 'add', 'button_add_row_title', [this.getItemTitle()]);
|
|
2491
2528
|
button.classList.add('json-editor-btntype-add');
|
|
2492
2529
|
button.addEventListener('click', function (e) {
|
|
2493
2530
|
e.preventDefault();
|
|
2494
2531
|
e.stopPropagation();
|
|
2495
|
-
var i =
|
|
2532
|
+
var i = _this14.rows.length;
|
|
2496
2533
|
var editor;
|
|
2497
|
-
if (
|
|
2498
|
-
editor =
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
if (
|
|
2502
|
-
|
|
2534
|
+
if (_this14.row_cache[i]) {
|
|
2535
|
+
editor = _this14.rows[i] = _this14.row_cache[i];
|
|
2536
|
+
_this14.rows[i].setValue(_this14.rows[i].getDefault(), true);
|
|
2537
|
+
// override cached value, so optional properties are not checked.
|
|
2538
|
+
if (typeof _this14.rows[i].deactivateNonRequiredProperties === 'function') {
|
|
2539
|
+
_this14.rows[i].deactivateNonRequiredProperties(true);
|
|
2540
|
+
}
|
|
2541
|
+
_this14.rows[i].container.style.display = '';
|
|
2542
|
+
if (_this14.rows[i].tab) _this14.rows[i].tab.style.display = '';
|
|
2543
|
+
_this14.rows[i].register();
|
|
2503
2544
|
} else {
|
|
2504
|
-
editor =
|
|
2545
|
+
editor = _this14.addRow();
|
|
2505
2546
|
}
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2547
|
+
_this14.active_tab = _this14.rows[i].tab;
|
|
2548
|
+
_this14.refreshTabs();
|
|
2549
|
+
_this14.refreshValue();
|
|
2550
|
+
_this14.onChange(true);
|
|
2551
|
+
_this14.jsoneditor.trigger('addRow', editor);
|
|
2511
2552
|
});
|
|
2512
2553
|
this.controls.appendChild(button);
|
|
2513
2554
|
return button;
|
|
@@ -2515,28 +2556,28 @@ var ArrayEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
2515
2556
|
}, {
|
|
2516
2557
|
key: "_createDeleteLastRowButton",
|
|
2517
2558
|
value: function _createDeleteLastRowButton() {
|
|
2518
|
-
var
|
|
2559
|
+
var _this15 = this;
|
|
2519
2560
|
var button = this.getButton('button_delete_last', 'subtract', 'button_delete_last_title', [this.getItemTitle()]);
|
|
2520
2561
|
button.classList.add('json-editor-btntype-deletelast');
|
|
2521
2562
|
button.addEventListener('click', function (e) {
|
|
2522
2563
|
e.preventDefault();
|
|
2523
2564
|
e.stopPropagation();
|
|
2524
|
-
if (!
|
|
2565
|
+
if (!_this15.askConfirmation()) {
|
|
2525
2566
|
return false;
|
|
2526
2567
|
}
|
|
2527
|
-
var rows =
|
|
2568
|
+
var rows = _this15.getValue();
|
|
2528
2569
|
var newActiveTab = null;
|
|
2529
2570
|
var editorValue = rows.pop();
|
|
2530
|
-
|
|
2531
|
-
if (
|
|
2532
|
-
newActiveTab =
|
|
2571
|
+
_this15.setValue(rows);
|
|
2572
|
+
if (_this15.rows[_this15.rows.length - 1]) {
|
|
2573
|
+
newActiveTab = _this15.rows[_this15.rows.length - 1].tab;
|
|
2533
2574
|
}
|
|
2534
2575
|
if (newActiveTab) {
|
|
2535
|
-
|
|
2536
|
-
|
|
2576
|
+
_this15.active_tab = newActiveTab;
|
|
2577
|
+
_this15.refreshTabs();
|
|
2537
2578
|
}
|
|
2538
|
-
|
|
2539
|
-
|
|
2579
|
+
_this15.onChange(true);
|
|
2580
|
+
_this15.jsoneditor.trigger('deleteRow', editorValue);
|
|
2540
2581
|
});
|
|
2541
2582
|
this.controls.appendChild(button);
|
|
2542
2583
|
return button;
|
|
@@ -2544,20 +2585,20 @@ var ArrayEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
2544
2585
|
}, {
|
|
2545
2586
|
key: "_createRemoveAllRowsButton",
|
|
2546
2587
|
value: function _createRemoveAllRowsButton() {
|
|
2547
|
-
var
|
|
2588
|
+
var _this16 = this;
|
|
2548
2589
|
var button = this.getButton('button_delete_all', 'delete', 'button_delete_all_title');
|
|
2549
2590
|
button.classList.add('json-editor-btntype-deleteall');
|
|
2550
2591
|
button.addEventListener('click', function (e) {
|
|
2551
2592
|
e.preventDefault();
|
|
2552
2593
|
e.stopPropagation();
|
|
2553
|
-
if (!
|
|
2594
|
+
if (!_this16.askConfirmation()) {
|
|
2554
2595
|
return false;
|
|
2555
2596
|
}
|
|
2556
|
-
var values =
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2597
|
+
var values = _this16.getValue();
|
|
2598
|
+
_this16.empty(true);
|
|
2599
|
+
_this16.setValue([]);
|
|
2600
|
+
_this16.onChange(true);
|
|
2601
|
+
_this16.jsoneditor.trigger('deleteAllRows', values);
|
|
2561
2602
|
});
|
|
2562
2603
|
this.controls.appendChild(button);
|
|
2563
2604
|
return button;
|
|
@@ -2565,12 +2606,12 @@ var ArrayEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
2565
2606
|
}, {
|
|
2566
2607
|
key: "showValidationErrors",
|
|
2567
2608
|
value: function showValidationErrors(errors) {
|
|
2568
|
-
var
|
|
2609
|
+
var _this17 = this;
|
|
2569
2610
|
/* Get all the errors that pertain to this editor */
|
|
2570
2611
|
var myErrors = [];
|
|
2571
2612
|
var otherErrors = [];
|
|
2572
2613
|
errors.forEach(function (error) {
|
|
2573
|
-
if (error.path ===
|
|
2614
|
+
if (error.path === _this17.path) {
|
|
2574
2615
|
myErrors.push(error);
|
|
2575
2616
|
} else {
|
|
2576
2617
|
otherErrors.push(error);
|
|
@@ -2583,7 +2624,7 @@ var ArrayEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
2583
2624
|
this.error_holder.innerHTML = '';
|
|
2584
2625
|
this.error_holder.style.display = '';
|
|
2585
2626
|
myErrors.forEach(function (error) {
|
|
2586
|
-
|
|
2627
|
+
_this17.error_holder.appendChild(_this17.theme.getErrorMessage(error.message));
|
|
2587
2628
|
});
|
|
2588
2629
|
/* Hide error area */
|
|
2589
2630
|
} else {
|
|
@@ -2597,8 +2638,64 @@ var ArrayEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
2597
2638
|
});
|
|
2598
2639
|
}
|
|
2599
2640
|
}]);
|
|
2600
|
-
}(
|
|
2601
|
-
ArrayEditor.rules =
|
|
2641
|
+
}(_editor_js__WEBPACK_IMPORTED_MODULE_30__.AbstractEditor);
|
|
2642
|
+
ArrayEditor.rules = _array_css_js__WEBPACK_IMPORTED_MODULE_32__["default"];
|
|
2643
|
+
|
|
2644
|
+
// drag/drop array item to adjust order
|
|
2645
|
+
// handler(fromIdx, toIdx, fromDom, toDom), opt={useTrigger}
|
|
2646
|
+
// useTrigger=true: pressing ctrl to enable drag
|
|
2647
|
+
function supportDragDrop(tab, handler) {
|
|
2648
|
+
var opt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
2649
|
+
if (opt.useTrigger) {
|
|
2650
|
+
tab.addEventListener('mousedown', function (e) {
|
|
2651
|
+
if (e.ctrlKey) {
|
|
2652
|
+
// window.console.log('enable drag')
|
|
2653
|
+
tab.draggable = true;
|
|
2654
|
+
var fn = function fn(e) {
|
|
2655
|
+
tab.draggable = false;
|
|
2656
|
+
// window.console.log('disable drag')
|
|
2657
|
+
document.removeEventListener('dragend', fn);
|
|
2658
|
+
document.removeEventListener('mouseup', fn);
|
|
2659
|
+
};
|
|
2660
|
+
document.addEventListener('dragend', fn);
|
|
2661
|
+
document.addEventListener('mouseup', fn);
|
|
2662
|
+
}
|
|
2663
|
+
});
|
|
2664
|
+
} else {
|
|
2665
|
+
tab.draggable = true;
|
|
2666
|
+
}
|
|
2667
|
+
tab.addEventListener('dragstart', function (e) {
|
|
2668
|
+
window.curDrag = tab;
|
|
2669
|
+
});
|
|
2670
|
+
tab.addEventListener('dragover', function (e) {
|
|
2671
|
+
if (window.curDrag === null || window.curDrag === tab || window.curDrag.parentElement !== tab.parentElement) {
|
|
2672
|
+
e.dataTransfer.dropEffect = 'none';
|
|
2673
|
+
} else {
|
|
2674
|
+
e.dataTransfer.dropEffect = 'move';
|
|
2675
|
+
}
|
|
2676
|
+
e.preventDefault();
|
|
2677
|
+
});
|
|
2678
|
+
tab.addEventListener('drop', function (e) {
|
|
2679
|
+
e.preventDefault();
|
|
2680
|
+
e.stopPropagation();
|
|
2681
|
+
if (window.curDrag === null || window.curDrag === tab || window.curDrag.parentElement !== tab.parentElement) {
|
|
2682
|
+
return;
|
|
2683
|
+
}
|
|
2684
|
+
var getPos = function getPos(item) {
|
|
2685
|
+
var i = 0;
|
|
2686
|
+
var a = item.parentElement.firstElementChild;
|
|
2687
|
+
while (a !== item && a !== null) {
|
|
2688
|
+
a = a.nextSibling;
|
|
2689
|
+
++i;
|
|
2690
|
+
}
|
|
2691
|
+
return i;
|
|
2692
|
+
};
|
|
2693
|
+
var i = getPos(window.curDrag);
|
|
2694
|
+
var j = getPos(tab);
|
|
2695
|
+
handler(i, j, window.curDrag, tab);
|
|
2696
|
+
window.curDrag = null;
|
|
2697
|
+
});
|
|
2698
|
+
}
|
|
2602
2699
|
|
|
2603
2700
|
/***/ }),
|
|
2604
2701
|
|
|
@@ -2701,6 +2798,7 @@ var ArrayChoicesEditor = /*#__PURE__*/function (_MultiSelectEditor) {
|
|
|
2701
2798
|
key: "setValue",
|
|
2702
2799
|
value: function setValue(value, initial) {
|
|
2703
2800
|
if (this.choices_instance) {
|
|
2801
|
+
value = this.applyConstFilter(value);
|
|
2704
2802
|
/* Make sure we are dealing with an array of strings so we can check for strict equality */
|
|
2705
2803
|
value = [].concat(value).map(function (e) {
|
|
2706
2804
|
return "".concat(e);
|
|
@@ -2909,6 +3007,7 @@ var ArraySelect2Editor = /*#__PURE__*/function (_MultiSelectEditor) {
|
|
|
2909
3007
|
return _createClass(ArraySelect2Editor, [{
|
|
2910
3008
|
key: "setValue",
|
|
2911
3009
|
value: function setValue(value, initial) {
|
|
3010
|
+
value = this.applyConstFilter(value);
|
|
2912
3011
|
if (this.select2_instance) {
|
|
2913
3012
|
/* Make sure we are dealing with an array of strings so we can check for strict equality */
|
|
2914
3013
|
value = [].concat(value).map(function (e) {
|
|
@@ -3114,6 +3213,7 @@ var ArraySelectizeEditor = /*#__PURE__*/function (_MultiSelectEditor) {
|
|
|
3114
3213
|
return _createClass(ArraySelectizeEditor, [{
|
|
3115
3214
|
key: "setValue",
|
|
3116
3215
|
value: function setValue(value, initial) {
|
|
3216
|
+
value = this.applyConstFilter(value);
|
|
3117
3217
|
if (this.selectize_instance) {
|
|
3118
3218
|
/* Make sure we are dealing with an array of strings so we can check for strict equality */
|
|
3119
3219
|
value = [].concat(value).map(function (e) {
|
|
@@ -3636,6 +3736,7 @@ var Base64Editor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
3636
3736
|
}, {
|
|
3637
3737
|
key: "setValue",
|
|
3638
3738
|
value: function setValue(val) {
|
|
3739
|
+
val = this.applyConstFilter(val);
|
|
3639
3740
|
if (this.value !== val) {
|
|
3640
3741
|
if (this.schema.readOnly && this.schema["enum"] && !this.schema["enum"].includes(val)) this.value = this.schema["enum"][0];else this.value = val;
|
|
3641
3742
|
this.input.value = this.value;
|
|
@@ -3954,6 +4055,7 @@ var CheckboxEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
3954
4055
|
return _createClass(CheckboxEditor, [{
|
|
3955
4056
|
key: "setValue",
|
|
3956
4057
|
value: function setValue(value, initial) {
|
|
4058
|
+
value = this.applyConstFilter(value);
|
|
3957
4059
|
value = !!value;
|
|
3958
4060
|
var changed = this.getValue() !== value;
|
|
3959
4061
|
this.value = value;
|
|
@@ -3984,6 +4086,16 @@ var CheckboxEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
3984
4086
|
value: function getNumColumns() {
|
|
3985
4087
|
return Math.min(12, Math.max(this.getTitle().length / 7, 2));
|
|
3986
4088
|
}
|
|
4089
|
+
}, {
|
|
4090
|
+
key: "setOptInCheckbox",
|
|
4091
|
+
value: function setOptInCheckbox() {
|
|
4092
|
+
_get(_getPrototypeOf(CheckboxEditor.prototype), "setOptInCheckbox", this).call(this);
|
|
4093
|
+
if (this.optInAppended) {
|
|
4094
|
+
this.container.insertBefore(this.optInContainer, this.container.firstChild);
|
|
4095
|
+
this.optInContainer.style.verticalAlign = 'top';
|
|
4096
|
+
this.control.style.marginTop = '0';
|
|
4097
|
+
}
|
|
4098
|
+
}
|
|
3987
4099
|
}, {
|
|
3988
4100
|
key: "build",
|
|
3989
4101
|
value: function build() {
|
|
@@ -3998,6 +4110,7 @@ var CheckboxEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
3998
4110
|
this.input = this.theme.getCheckbox();
|
|
3999
4111
|
this.input.id = this.formname;
|
|
4000
4112
|
this.control = this.theme.getFormControl(this.label, this.input, this.description, this.infoButton);
|
|
4113
|
+
this.control.style.display = 'inline-block';
|
|
4001
4114
|
if (this.schema.readOnly || this.schema.readonly) {
|
|
4002
4115
|
this.disable(true);
|
|
4003
4116
|
this.input.disabled = true;
|
|
@@ -4041,7 +4154,7 @@ var CheckboxEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
4041
4154
|
var showErrors = this.jsoneditor.options.show_errors;
|
|
4042
4155
|
var changeOrInteraction = showErrors === 'change' || showErrors === 'interaction';
|
|
4043
4156
|
var never = showErrors === 'never';
|
|
4044
|
-
if (never) {
|
|
4157
|
+
if (never && !this.is_dirty) {
|
|
4045
4158
|
return;
|
|
4046
4159
|
}
|
|
4047
4160
|
if (changeOrInteraction && !this.is_dirty) {
|
|
@@ -4190,6 +4303,7 @@ var ChoicesEditor = /*#__PURE__*/function (_SelectEditor) {
|
|
|
4190
4303
|
return _createClass(ChoicesEditor, [{
|
|
4191
4304
|
key: "setValue",
|
|
4192
4305
|
value: function setValue(value, initial) {
|
|
4306
|
+
value = this.applyConstFilter(value);
|
|
4193
4307
|
if (this.choices_instance) {
|
|
4194
4308
|
/* Sanitize value before setting it */
|
|
4195
4309
|
var sanitized = this.typecast(value || '');
|
|
@@ -4366,6 +4480,7 @@ var ColorEditor = /*#__PURE__*/function (_StringEditor) {
|
|
|
4366
4480
|
}, {
|
|
4367
4481
|
key: "setValue",
|
|
4368
4482
|
value: function setValue(value, initial, fromTemplate) {
|
|
4483
|
+
value = this.applyConstFilter(value);
|
|
4369
4484
|
var res = _get(_getPrototypeOf(ColorEditor.prototype), "setValue", this).call(this, value, initial, fromTemplate);
|
|
4370
4485
|
if (this.picker_instance && this.picker_instance.domElement && res && res.changed) {
|
|
4371
4486
|
this.picker_instance.setColor(res.value, true);
|
|
@@ -4665,6 +4780,7 @@ var DatetimeEditor = /*#__PURE__*/function (_StringEditor) {
|
|
|
4665
4780
|
}, {
|
|
4666
4781
|
key: "setValue",
|
|
4667
4782
|
value: function setValue(value, initial, fromTemplate) {
|
|
4783
|
+
value = this.applyConstFilter(value);
|
|
4668
4784
|
if (this.schema.type === 'string') {
|
|
4669
4785
|
_get(_getPrototypeOf(DatetimeEditor.prototype), "setValue", this).call(this, value, initial, fromTemplate);
|
|
4670
4786
|
if (this.flatpickr) this.flatpickr.setDate(value);
|
|
@@ -4959,6 +5075,7 @@ var DescribedByEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
4959
5075
|
}, {
|
|
4960
5076
|
key: "setValue",
|
|
4961
5077
|
value: function setValue(val, initial) {
|
|
5078
|
+
val = this.applyConstFilter(val);
|
|
4962
5079
|
if (this.editors[this.currentEditor]) {
|
|
4963
5080
|
this.editors[this.currentEditor].setValue(val, initial);
|
|
4964
5081
|
this.refreshValue();
|
|
@@ -5137,7 +5254,7 @@ var EnumEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
5137
5254
|
this.title = this.header = this.label = this.theme.getFormInputLabel(this.getTitle(), this.isRequired());
|
|
5138
5255
|
this.container.appendChild(this.title);
|
|
5139
5256
|
this.options.enum_titles = this.options.enum_titles || [];
|
|
5140
|
-
if (this.
|
|
5257
|
+
if (this.enforceConstEnabled && this.schema["const"]) {
|
|
5141
5258
|
this["enum"] = [this.schema["const"]];
|
|
5142
5259
|
} else {
|
|
5143
5260
|
this["enum"] = this.schema["enum"];
|
|
@@ -5255,6 +5372,7 @@ var EnumEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
5255
5372
|
}, {
|
|
5256
5373
|
key: "setValue",
|
|
5257
5374
|
value: function setValue(val) {
|
|
5375
|
+
val = this.applyConstFilter(val);
|
|
5258
5376
|
if (this.value !== val) {
|
|
5259
5377
|
this.value = val;
|
|
5260
5378
|
this.refreshValue();
|
|
@@ -5386,6 +5504,7 @@ var HiddenEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
5386
5504
|
}, {
|
|
5387
5505
|
key: "setValue",
|
|
5388
5506
|
value: function setValue(value, initial, fromTemplate) {
|
|
5507
|
+
value = this.applyConstFilter(value);
|
|
5389
5508
|
if (this.template && !fromTemplate) {
|
|
5390
5509
|
return;
|
|
5391
5510
|
}
|
|
@@ -6064,6 +6183,7 @@ var JoditEditor = /*#__PURE__*/function (_StringEditor) {
|
|
|
6064
6183
|
return _createClass(JoditEditor, [{
|
|
6065
6184
|
key: "setValue",
|
|
6066
6185
|
value: function setValue(value, initial, fromTemplate) {
|
|
6186
|
+
value = this.applyConstFilter(value);
|
|
6067
6187
|
var res = _get(_getPrototypeOf(JoditEditor.prototype), "setValue", this).call(this, value, initial, fromTemplate);
|
|
6068
6188
|
if (res !== undefined && res.changed && this.jodit_instance) this.jodit_instance.setEditorValue(res.value);
|
|
6069
6189
|
}
|
|
@@ -6563,6 +6683,8 @@ var MultipleEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
6563
6683
|
key: "setValue",
|
|
6564
6684
|
value: function setValue(val, initial) {
|
|
6565
6685
|
var _this4 = this;
|
|
6686
|
+
val = this.applyConstFilter(val);
|
|
6687
|
+
|
|
6566
6688
|
/* Determine type by getting the first one that validates */
|
|
6567
6689
|
|
|
6568
6690
|
var prevType = this.type;
|
|
@@ -6947,6 +7069,7 @@ var MultiSelectEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
6947
7069
|
key: "setValue",
|
|
6948
7070
|
value: function setValue(value, initial) {
|
|
6949
7071
|
var _this3 = this;
|
|
7072
|
+
value = this.applyConstFilter(value);
|
|
6950
7073
|
value = value || [];
|
|
6951
7074
|
if (!Array.isArray(value)) value = [value];
|
|
6952
7075
|
|
|
@@ -7545,7 +7668,9 @@ var ObjectEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
7545
7668
|
if (e.isActive() || e.isUiOnly) {
|
|
7546
7669
|
e.enable();
|
|
7547
7670
|
}
|
|
7548
|
-
e.optInCheckbox
|
|
7671
|
+
if (e.optInCheckbox) {
|
|
7672
|
+
e.optInCheckbox.disabled = false;
|
|
7673
|
+
}
|
|
7549
7674
|
});
|
|
7550
7675
|
}
|
|
7551
7676
|
}
|
|
@@ -8279,7 +8404,7 @@ var ObjectEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
8279
8404
|
this.refreshAddProperties();
|
|
8280
8405
|
|
|
8281
8406
|
/* non required properties start deactivated */
|
|
8282
|
-
this.deactivateNonRequiredProperties();
|
|
8407
|
+
this.deactivateNonRequiredProperties(false);
|
|
8283
8408
|
}
|
|
8284
8409
|
|
|
8285
8410
|
/* Fix table cell ordering */
|
|
@@ -8301,7 +8426,7 @@ var ObjectEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
8301
8426
|
}
|
|
8302
8427
|
}, {
|
|
8303
8428
|
key: "deactivateNonRequiredProperties",
|
|
8304
|
-
value: function deactivateNonRequiredProperties() {
|
|
8429
|
+
value: function deactivateNonRequiredProperties(recursive) {
|
|
8305
8430
|
var _this8 = this;
|
|
8306
8431
|
/* the show_opt_in editor option is for backward compatibility */
|
|
8307
8432
|
var globalOptIn = this.jsoneditor.options.show_opt_in;
|
|
@@ -8316,6 +8441,9 @@ var ObjectEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
8316
8441
|
if (!_this8.isRequiredObject(editor)) {
|
|
8317
8442
|
_this8.editors[key].deactivate();
|
|
8318
8443
|
}
|
|
8444
|
+
if (recursive && typeof _this8.editors[key].deactivateNonRequiredProperties === 'function') {
|
|
8445
|
+
_this8.editors[key].deactivateNonRequiredProperties(recursive);
|
|
8446
|
+
}
|
|
8319
8447
|
});
|
|
8320
8448
|
}
|
|
8321
8449
|
}
|
|
@@ -8766,6 +8894,7 @@ var ObjectEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
8766
8894
|
key: "setValue",
|
|
8767
8895
|
value: function setValue(value, initial) {
|
|
8768
8896
|
var _this13 = this;
|
|
8897
|
+
value = this.applyConstFilter(value);
|
|
8769
8898
|
value = value || {};
|
|
8770
8899
|
if (_typeof(value) !== 'object' || Array.isArray(value)) value = {};
|
|
8771
8900
|
|
|
@@ -9057,6 +9186,7 @@ var RadioEditor = /*#__PURE__*/function (_SelectEditor) {
|
|
|
9057
9186
|
}, {
|
|
9058
9187
|
key: "setValue",
|
|
9059
9188
|
value: function setValue(val) {
|
|
9189
|
+
val = this.applyConstFilter(val);
|
|
9060
9190
|
if (typeof val !== 'string') {
|
|
9061
9191
|
val = String(val);
|
|
9062
9192
|
}
|
|
@@ -9168,6 +9298,7 @@ var ScEditor = /*#__PURE__*/function (_StringEditor) {
|
|
|
9168
9298
|
return _createClass(ScEditor, [{
|
|
9169
9299
|
key: "setValue",
|
|
9170
9300
|
value: function setValue(value, initial, fromTemplate) {
|
|
9301
|
+
value = this.applyConstFilter(value);
|
|
9171
9302
|
var res = _get(_getPrototypeOf(ScEditor.prototype), "setValue", this).call(this, value, initial, fromTemplate);
|
|
9172
9303
|
if (res !== undefined && res.changed && this.sceditor_instance) this.sceditor_instance.val(res.value);
|
|
9173
9304
|
}
|
|
@@ -9373,6 +9504,7 @@ var SelectEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
9373
9504
|
return _createClass(SelectEditor, [{
|
|
9374
9505
|
key: "setValue",
|
|
9375
9506
|
value: function setValue(value, initial) {
|
|
9507
|
+
value = this.applyConstFilter(value);
|
|
9376
9508
|
/* Sanitize value before setting it */
|
|
9377
9509
|
var sanitized = this.typecast(value);
|
|
9378
9510
|
var inEnum = this.enum_options.length > 0 && this.enum_values.includes(sanitized);
|
|
@@ -9732,7 +9864,7 @@ var SelectEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
9732
9864
|
var showErrors = this.jsoneditor.options.show_errors;
|
|
9733
9865
|
var changeOrInteraction = showErrors === 'change' || showErrors === 'interaction';
|
|
9734
9866
|
var never = showErrors === 'never';
|
|
9735
|
-
if (never) {
|
|
9867
|
+
if (never && !this.is_dirty) {
|
|
9736
9868
|
return;
|
|
9737
9869
|
}
|
|
9738
9870
|
if (changeOrInteraction && !this.is_dirty) {
|
|
@@ -9854,6 +9986,7 @@ var Select2Editor = /*#__PURE__*/function (_SelectEditor) {
|
|
|
9854
9986
|
return _createClass(Select2Editor, [{
|
|
9855
9987
|
key: "setValue",
|
|
9856
9988
|
value: function setValue(value, initial) {
|
|
9989
|
+
value = this.applyConstFilter(value);
|
|
9857
9990
|
if (this.select2_instance) {
|
|
9858
9991
|
if (initial) this.is_dirty = false;else if (this.jsoneditor.options.show_errors === 'change') this.is_dirty = true;
|
|
9859
9992
|
var sanitized = this.updateValue(value); /* Sets this.value to sanitized value */
|
|
@@ -10065,6 +10198,7 @@ var SelectizeEditor = /*#__PURE__*/function (_SelectEditor) {
|
|
|
10065
10198
|
return _createClass(SelectizeEditor, [{
|
|
10066
10199
|
key: "setValue",
|
|
10067
10200
|
value: function setValue(value, initial) {
|
|
10201
|
+
value = this.applyConstFilter(value);
|
|
10068
10202
|
if (this.selectize_instance) {
|
|
10069
10203
|
if (initial) this.is_dirty = false;else if (this.jsoneditor.options.show_errors === 'change') this.is_dirty = true;
|
|
10070
10204
|
var sanitized = this.updateValue(value); /* Sets this.value to sanitized value */
|
|
@@ -10360,6 +10494,7 @@ var SignatureEditor = /*#__PURE__*/function (_StringEditor) {
|
|
|
10360
10494
|
}, {
|
|
10361
10495
|
key: "setValue",
|
|
10362
10496
|
value: function setValue(val) {
|
|
10497
|
+
val = this.applyConstFilter(val);
|
|
10363
10498
|
if (typeof SignaturePad === 'function') {
|
|
10364
10499
|
var sanitized = this.sanitize(val);
|
|
10365
10500
|
if (this.value === sanitized) {
|
|
@@ -10483,6 +10618,7 @@ var SimplemdeEditor = /*#__PURE__*/function (_StringEditor) {
|
|
|
10483
10618
|
return _createClass(SimplemdeEditor, [{
|
|
10484
10619
|
key: "setValue",
|
|
10485
10620
|
value: function setValue(value, initial, fromTemplate) {
|
|
10621
|
+
value = this.applyConstFilter(value);
|
|
10486
10622
|
var res = _get(_getPrototypeOf(SimplemdeEditor.prototype), "setValue", this).call(this, value, initial, fromTemplate);
|
|
10487
10623
|
if (res !== undefined && res.changed && this.simplemde_instance) this.simplemde_instance.value(res.value);
|
|
10488
10624
|
}
|
|
@@ -10561,16 +10697,17 @@ var SimplemdeEditor = /*#__PURE__*/function (_StringEditor) {
|
|
|
10561
10697
|
}, {
|
|
10562
10698
|
key: "startListening",
|
|
10563
10699
|
value: function startListening(cm, state) {
|
|
10564
|
-
|
|
10700
|
+
var _this2 = this;
|
|
10701
|
+
var check = function check() {
|
|
10565
10702
|
if (cm.display.wrapper.offsetHeight) {
|
|
10566
|
-
|
|
10703
|
+
_this2.stopListening(cm, state);
|
|
10567
10704
|
if (cm.display.lastWrapHeight !== cm.display.wrapper.clientHeight) {
|
|
10568
10705
|
cm.refresh();
|
|
10569
10706
|
}
|
|
10570
10707
|
} else {
|
|
10571
10708
|
state.timeout = window.setTimeout(check, state.delay);
|
|
10572
10709
|
}
|
|
10573
|
-
}
|
|
10710
|
+
};
|
|
10574
10711
|
state.timeout = window.setTimeout(check, state.delay);
|
|
10575
10712
|
state.hurry = function () {
|
|
10576
10713
|
window.clearTimeout(state.timeout);
|
|
@@ -10830,6 +10967,7 @@ var StarratingEditor = /*#__PURE__*/function (_StringEditor) {
|
|
|
10830
10967
|
}, {
|
|
10831
10968
|
key: "setValue",
|
|
10832
10969
|
value: function setValue(value) {
|
|
10970
|
+
value = this.applyConstFilter(value);
|
|
10833
10971
|
this.value = value;
|
|
10834
10972
|
for (var i = 0; i < this.radioGroup.length; i++) {
|
|
10835
10973
|
if (this.radioGroup[i].value === "".concat(value)) {
|
|
@@ -11114,6 +11252,7 @@ var StringEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
11114
11252
|
}, {
|
|
11115
11253
|
key: "setValue",
|
|
11116
11254
|
value: function setValue(value, initial, fromTemplate) {
|
|
11255
|
+
value = this.applyConstFilter(value);
|
|
11117
11256
|
if (this.template && !fromTemplate) return;
|
|
11118
11257
|
if (!this.shouldBeUnset() && (value === null || typeof value === 'undefined')) value = '';else if (_typeof(value) === 'object') value = JSON.stringify(value);else if (!this.shouldBeUnset() && typeof value !== 'string') value = "".concat(value);
|
|
11119
11258
|
if (value === this.serialized) return;
|
|
@@ -11792,6 +11931,8 @@ var TableEditor = /*#__PURE__*/function (_ArrayEditor) {
|
|
|
11792
11931
|
var _this = this;
|
|
11793
11932
|
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
11794
11933
|
var initial = arguments.length > 1 ? arguments[1] : undefined;
|
|
11934
|
+
value = this.applyConstFilter(value);
|
|
11935
|
+
|
|
11795
11936
|
/* Make sure value has between minItems and maxItems items in it */
|
|
11796
11937
|
value = this.ensureArraySize(value);
|
|
11797
11938
|
var serialized = JSON.stringify(value);
|
|
@@ -11820,7 +11961,6 @@ var TableEditor = /*#__PURE__*/function (_ArrayEditor) {
|
|
|
11820
11961
|
this.refreshValue();
|
|
11821
11962
|
if (numrowsChanged || initial) this.refreshRowButtons();
|
|
11822
11963
|
this.onChange();
|
|
11823
|
-
|
|
11824
11964
|
/* TODO: sortable */
|
|
11825
11965
|
}
|
|
11826
11966
|
}, {
|
|
@@ -11913,6 +12053,7 @@ var TableEditor = /*#__PURE__*/function (_ArrayEditor) {
|
|
|
11913
12053
|
if (!this.hide_move_buttons) {
|
|
11914
12054
|
this.rows[i].movedown_button = this._createMoveDownButton(i, controlsHolder);
|
|
11915
12055
|
}
|
|
12056
|
+
this._supportDragDrop(this.rows[i].row);
|
|
11916
12057
|
if (typeof value !== 'undefined') this.rows[i].setValue(value);
|
|
11917
12058
|
return this.rows[i];
|
|
11918
12059
|
}
|
|
@@ -12020,10 +12161,26 @@ var TableEditor = /*#__PURE__*/function (_ArrayEditor) {
|
|
|
12020
12161
|
holder.appendChild(button);
|
|
12021
12162
|
return button;
|
|
12022
12163
|
}
|
|
12164
|
+
}, {
|
|
12165
|
+
key: "_supportDragDrop",
|
|
12166
|
+
value: function _supportDragDrop(tab) {
|
|
12167
|
+
var _this8 = this;
|
|
12168
|
+
(0,_array_js__WEBPACK_IMPORTED_MODULE_28__.supportDragDrop)(tab, function (i, j) {
|
|
12169
|
+
var rows = _this8.getValue();
|
|
12170
|
+
var tmp = rows[i];
|
|
12171
|
+
rows.splice(i, 1);
|
|
12172
|
+
rows.splice(j, 0, tmp);
|
|
12173
|
+
_this8.setValue(rows);
|
|
12174
|
+
_this8.onChange(true);
|
|
12175
|
+
_this8.jsoneditor.trigger('moveRow', _this8.rows[j]);
|
|
12176
|
+
}, {
|
|
12177
|
+
useTrigger: true
|
|
12178
|
+
});
|
|
12179
|
+
}
|
|
12023
12180
|
}, {
|
|
12024
12181
|
key: "addControls",
|
|
12025
12182
|
value: function addControls() {
|
|
12026
|
-
var
|
|
12183
|
+
var _this9 = this;
|
|
12027
12184
|
this.collapsed = false;
|
|
12028
12185
|
this.toggle_button = this._createToggleButton();
|
|
12029
12186
|
if (this.title_controls) {
|
|
@@ -12031,13 +12188,13 @@ var TableEditor = /*#__PURE__*/function (_ArrayEditor) {
|
|
|
12031
12188
|
this.toggle_button.addEventListener('click', function (e) {
|
|
12032
12189
|
e.preventDefault();
|
|
12033
12190
|
e.stopPropagation();
|
|
12034
|
-
|
|
12035
|
-
if (
|
|
12036
|
-
|
|
12037
|
-
|
|
12191
|
+
_this9.setButtonState(_this9.panel, _this9.collapsed);
|
|
12192
|
+
if (_this9.collapsed) {
|
|
12193
|
+
_this9.collapsed = false;
|
|
12194
|
+
_this9.setButtonText(e.currentTarget, '', 'collapse', 'button_collapse');
|
|
12038
12195
|
} else {
|
|
12039
|
-
|
|
12040
|
-
|
|
12196
|
+
_this9.collapsed = true;
|
|
12197
|
+
_this9.setButtonText(e.currentTarget, '', 'expand', 'button_expand');
|
|
12041
12198
|
}
|
|
12042
12199
|
});
|
|
12043
12200
|
|
|
@@ -12069,17 +12226,17 @@ var TableEditor = /*#__PURE__*/function (_ArrayEditor) {
|
|
|
12069
12226
|
}, {
|
|
12070
12227
|
key: "_createAddRowButton",
|
|
12071
12228
|
value: function _createAddRowButton() {
|
|
12072
|
-
var
|
|
12229
|
+
var _this10 = this;
|
|
12073
12230
|
var button = this.getButton(this.getItemTitle(), 'add', 'button_add_row_title', [this.getItemTitle()]);
|
|
12074
12231
|
button.classList.add('json-editor-btntype-add');
|
|
12075
12232
|
button.addEventListener('click', function (e) {
|
|
12076
12233
|
e.preventDefault();
|
|
12077
12234
|
e.stopPropagation();
|
|
12078
|
-
var editor =
|
|
12079
|
-
|
|
12080
|
-
|
|
12081
|
-
|
|
12082
|
-
|
|
12235
|
+
var editor = _this10.addRow();
|
|
12236
|
+
_this10.refreshValue();
|
|
12237
|
+
_this10.refreshRowButtons();
|
|
12238
|
+
_this10.onChange(true);
|
|
12239
|
+
_this10.jsoneditor.trigger('addRow', editor);
|
|
12083
12240
|
});
|
|
12084
12241
|
this.controls.appendChild(button);
|
|
12085
12242
|
return button;
|
|
@@ -12087,20 +12244,20 @@ var TableEditor = /*#__PURE__*/function (_ArrayEditor) {
|
|
|
12087
12244
|
}, {
|
|
12088
12245
|
key: "_createDeleteLastRowButton",
|
|
12089
12246
|
value: function _createDeleteLastRowButton() {
|
|
12090
|
-
var
|
|
12247
|
+
var _this11 = this;
|
|
12091
12248
|
var button = this.getButton('button_delete_last', 'subtract', 'button_delete_last_title', [this.getItemTitle()]);
|
|
12092
12249
|
button.classList.add('json-editor-btntype-deletelast');
|
|
12093
12250
|
button.addEventListener('click', function (e) {
|
|
12094
12251
|
e.preventDefault();
|
|
12095
12252
|
e.stopPropagation();
|
|
12096
|
-
if (!
|
|
12253
|
+
if (!_this11.askConfirmation()) {
|
|
12097
12254
|
return false;
|
|
12098
12255
|
}
|
|
12099
|
-
var rows =
|
|
12256
|
+
var rows = _this11.getValue();
|
|
12100
12257
|
var editorValue = rows.pop();
|
|
12101
|
-
|
|
12102
|
-
|
|
12103
|
-
|
|
12258
|
+
_this11.setValue(rows);
|
|
12259
|
+
_this11.onChange(true);
|
|
12260
|
+
_this11.jsoneditor.trigger('deleteRow', editorValue);
|
|
12104
12261
|
});
|
|
12105
12262
|
this.controls.appendChild(button);
|
|
12106
12263
|
return button;
|
|
@@ -12108,19 +12265,19 @@ var TableEditor = /*#__PURE__*/function (_ArrayEditor) {
|
|
|
12108
12265
|
}, {
|
|
12109
12266
|
key: "_createRemoveAllRowsButton",
|
|
12110
12267
|
value: function _createRemoveAllRowsButton() {
|
|
12111
|
-
var
|
|
12268
|
+
var _this12 = this;
|
|
12112
12269
|
var button = this.getButton('button_delete_all', 'delete', 'button_delete_all_title');
|
|
12113
12270
|
button.classList.add('json-editor-btntype-deleteall');
|
|
12114
12271
|
button.addEventListener('click', function (e) {
|
|
12115
12272
|
e.preventDefault();
|
|
12116
12273
|
e.stopPropagation();
|
|
12117
|
-
if (!
|
|
12274
|
+
if (!_this12.askConfirmation()) {
|
|
12118
12275
|
return false;
|
|
12119
12276
|
}
|
|
12120
|
-
var values =
|
|
12121
|
-
|
|
12122
|
-
|
|
12123
|
-
|
|
12277
|
+
var values = _this12.getValue();
|
|
12278
|
+
_this12.setValue([]);
|
|
12279
|
+
_this12.onChange(true);
|
|
12280
|
+
_this12.jsoneditor.trigger('deleteAllRows', values);
|
|
12124
12281
|
});
|
|
12125
12282
|
this.controls.appendChild(button);
|
|
12126
12283
|
return button;
|
|
@@ -12527,6 +12684,7 @@ var UploadEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
12527
12684
|
}, {
|
|
12528
12685
|
key: "setValue",
|
|
12529
12686
|
value: function setValue(val) {
|
|
12687
|
+
val = this.applyConstFilter(val);
|
|
12530
12688
|
if (this.value !== val) {
|
|
12531
12689
|
this.value = val;
|
|
12532
12690
|
this.input.value = this.value;
|
|
@@ -12704,6 +12862,7 @@ var UuidEditor = /*#__PURE__*/function (_StringEditor) {
|
|
|
12704
12862
|
}, {
|
|
12705
12863
|
key: "setValue",
|
|
12706
12864
|
value: function setValue(value, initial, fromTemplate) {
|
|
12865
|
+
value = this.applyConstFilter(value);
|
|
12707
12866
|
if (!this.testUuid(value)) value = this.uuid;
|
|
12708
12867
|
this.uuid = value;
|
|
12709
12868
|
_get(_getPrototypeOf(UuidEditor.prototype), "setValue", this).call(this, value, initial, fromTemplate);
|
|
@@ -13834,7 +13993,8 @@ var arraysOfStrings = function arraysOfStrings(schema, je) {
|
|
|
13834
13993
|
|
|
13835
13994
|
/* Use the multiple editor for schemas with `oneOf` or `anyOf` set */
|
|
13836
13995
|
var oneOf = function oneOf(schema) {
|
|
13837
|
-
|
|
13996
|
+
var _schema$options$switc, _schema$options;
|
|
13997
|
+
return (schema.oneOf || schema.anyOf) && ((_schema$options$switc = (_schema$options = schema.options) === null || _schema$options === void 0 ? void 0 : _schema$options.switcher) !== null && _schema$options$switc !== void 0 ? _schema$options$switc : true) === true && 'multiple';
|
|
13838
13998
|
};
|
|
13839
13999
|
|
|
13840
14000
|
/* Use the multiple editor for schemas with `if` set */
|
|
@@ -15298,6 +15458,31 @@ var AbstractTheme = /*#__PURE__*/function () {
|
|
|
15298
15458
|
value: function getContainer() {
|
|
15299
15459
|
return document.createElement('div');
|
|
15300
15460
|
}
|
|
15461
|
+
}, {
|
|
15462
|
+
key: "getOptInCheckbox",
|
|
15463
|
+
value: function getOptInCheckbox(formname) {
|
|
15464
|
+
var container = document.createElement('span');
|
|
15465
|
+
var label = this.getHiddenLabel(formname + ' opt-in');
|
|
15466
|
+
label.setAttribute('for', formname + '-opt-in');
|
|
15467
|
+
label.textContent = formname + '-opt-in';
|
|
15468
|
+
var checkbox = document.createElement('input');
|
|
15469
|
+
checkbox.setAttribute('type', 'checkbox');
|
|
15470
|
+
checkbox.setAttribute('style', 'margin: 0 10px 0 0;');
|
|
15471
|
+
checkbox.setAttribute('id', formname + '-opt-in');
|
|
15472
|
+
checkbox.classList.add('json-editor-opt-in');
|
|
15473
|
+
container.appendChild(checkbox);
|
|
15474
|
+
container.appendChild(label);
|
|
15475
|
+
return {
|
|
15476
|
+
label: label,
|
|
15477
|
+
checkbox: checkbox,
|
|
15478
|
+
container: container
|
|
15479
|
+
};
|
|
15480
|
+
}
|
|
15481
|
+
}, {
|
|
15482
|
+
key: "getOptInSwitch",
|
|
15483
|
+
value: function getOptInSwitch(formname) {
|
|
15484
|
+
return this.getOptInCheckbox();
|
|
15485
|
+
}
|
|
15301
15486
|
}, {
|
|
15302
15487
|
key: "getFloatRightLinkHolder",
|
|
15303
15488
|
value: function getFloatRightLinkHolder() {
|
|
@@ -16209,7 +16394,16 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
16209
16394
|
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
16210
16395
|
/* harmony export */ });
|
|
16211
16396
|
/* eslint-disable */
|
|
16212
|
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
|
16397
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = ({
|
|
16398
|
+
".switch": "position:relative;display:inline-block;width:28px;height:16px;margin-right:10px",
|
|
16399
|
+
".switch input": "opacity:0;width:0;height:0",
|
|
16400
|
+
".switch-slider": "position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:%23ccc;transition:.1s;border-radius:34px",
|
|
16401
|
+
".switch-slider:before": "position:absolute;content:%22%22;height:12px;width:12px;left:1px;top:2px;background-color:white;transition:.1s;border-radius:50%25",
|
|
16402
|
+
"input:checked + .switch-slider": "background-color:%232196F3",
|
|
16403
|
+
"input:focus + .switch-slider": "box-shadow:0%200%201px%20%232196F3",
|
|
16404
|
+
"input:checked + .switch-slider:before": "transform:translateX(12px)",
|
|
16405
|
+
"input:disabled + .switch-slider": "opacity:0.5"
|
|
16406
|
+
});
|
|
16213
16407
|
/* eslint-enable */
|
|
16214
16408
|
|
|
16215
16409
|
/***/ }),
|
|
@@ -16307,6 +16501,31 @@ var bootstrap3Theme = /*#__PURE__*/function (_AbstractTheme) {
|
|
|
16307
16501
|
}
|
|
16308
16502
|
_inherits(bootstrap3Theme, _AbstractTheme);
|
|
16309
16503
|
return _createClass(bootstrap3Theme, [{
|
|
16504
|
+
key: "getOptInSwitch",
|
|
16505
|
+
value: function getOptInSwitch(formname) {
|
|
16506
|
+
var label = this.getHiddenLabel(formname + ' opt-in');
|
|
16507
|
+
label.setAttribute('for', formname + '-opt-in');
|
|
16508
|
+
var container = document.createElement('label');
|
|
16509
|
+
container.classList.add('switch');
|
|
16510
|
+
var checkbox = document.createElement('input');
|
|
16511
|
+
checkbox.setAttribute('type', 'checkbox');
|
|
16512
|
+
checkbox.setAttribute('id', formname + '-opt-in');
|
|
16513
|
+
checkbox.classList.add('json-editor-opt-in');
|
|
16514
|
+
var slider = document.createElement('span');
|
|
16515
|
+
slider.classList.add('switch-slider');
|
|
16516
|
+
var switchLabelText = document.createElement('span');
|
|
16517
|
+
switchLabelText.classList.add('sr-only');
|
|
16518
|
+
switchLabelText.textContent = formname + '-opt-in';
|
|
16519
|
+
container.appendChild(switchLabelText);
|
|
16520
|
+
container.appendChild(checkbox);
|
|
16521
|
+
container.appendChild(slider);
|
|
16522
|
+
return {
|
|
16523
|
+
label: label,
|
|
16524
|
+
checkbox: checkbox,
|
|
16525
|
+
container: container
|
|
16526
|
+
};
|
|
16527
|
+
}
|
|
16528
|
+
}, {
|
|
16310
16529
|
key: "getSelectInput",
|
|
16311
16530
|
value: function getSelectInput(options, multiple) {
|
|
16312
16531
|
var el = _get(_getPrototypeOf(bootstrap3Theme.prototype), "getSelectInput", this).call(this, options);
|
|
@@ -16452,6 +16671,11 @@ var bootstrap3Theme = /*#__PURE__*/function (_AbstractTheme) {
|
|
|
16452
16671
|
if (window.DOMPurify) el.innerHTML = window.DOMPurify.sanitize(text);else el.textContent = this.cleanText(text);
|
|
16453
16672
|
return el;
|
|
16454
16673
|
}
|
|
16674
|
+
}, {
|
|
16675
|
+
key: "getHeaderContainer",
|
|
16676
|
+
value: function getHeaderContainer() {
|
|
16677
|
+
return document.createElement('div');
|
|
16678
|
+
}
|
|
16455
16679
|
}, {
|
|
16456
16680
|
key: "getHeader",
|
|
16457
16681
|
value: function getHeader(text, pathDepth) {
|
|
@@ -16848,6 +17072,32 @@ var bootstrap4Theme = /*#__PURE__*/function (_AbstractTheme) {
|
|
|
16848
17072
|
if (!this.options.object_indent) el.classList.add('je-noindent');
|
|
16849
17073
|
return el;
|
|
16850
17074
|
}
|
|
17075
|
+
}, {
|
|
17076
|
+
key: "getOptInSwitch",
|
|
17077
|
+
value: function getOptInSwitch(formname) {
|
|
17078
|
+
var label = this.getHiddenLabel(formname + ' opt-in');
|
|
17079
|
+
label.setAttribute('for', formname + '-opt-in');
|
|
17080
|
+
var container = document.createElement('div');
|
|
17081
|
+
container.classList.add('custom-control', 'custom-switch', 'd-inline-block', 'fs-6');
|
|
17082
|
+
var checkbox = document.createElement('input');
|
|
17083
|
+
checkbox.setAttribute('type', 'checkbox');
|
|
17084
|
+
checkbox.setAttribute('id', formname + '-opt-in');
|
|
17085
|
+
checkbox.classList.add('custom-control-input', 'json-editor-opt-in');
|
|
17086
|
+
var switchLabel = document.createElement('label');
|
|
17087
|
+
switchLabel.setAttribute('for', formname + '-opt-in');
|
|
17088
|
+
switchLabel.classList.add('custom-control-label');
|
|
17089
|
+
var switchLabelText = document.createElement('span');
|
|
17090
|
+
switchLabelText.classList.add('sr-only');
|
|
17091
|
+
switchLabelText.textContent = formname + '-opt-in';
|
|
17092
|
+
switchLabel.appendChild(switchLabelText);
|
|
17093
|
+
container.appendChild(checkbox);
|
|
17094
|
+
container.appendChild(switchLabel);
|
|
17095
|
+
return {
|
|
17096
|
+
label: label,
|
|
17097
|
+
checkbox: checkbox,
|
|
17098
|
+
container: container
|
|
17099
|
+
};
|
|
17100
|
+
}
|
|
16851
17101
|
}, {
|
|
16852
17102
|
key: "setGridColumnSize",
|
|
16853
17103
|
value: function setGridColumnSize(el, size, offset) {
|
|
@@ -17674,6 +17924,33 @@ var bootstrap5Theme = /*#__PURE__*/function (_AbstractTheme) {
|
|
|
17674
17924
|
if (!this.options.object_indent) el.classList.add('je-noindent');
|
|
17675
17925
|
return el;
|
|
17676
17926
|
}
|
|
17927
|
+
}, {
|
|
17928
|
+
key: "getOptInSwitch",
|
|
17929
|
+
value: function getOptInSwitch(formname) {
|
|
17930
|
+
var label = this.getHiddenLabel(formname + ' opt-in');
|
|
17931
|
+
label.setAttribute('for', formname + '-opt-in');
|
|
17932
|
+
var container = document.createElement('div');
|
|
17933
|
+
container.classList.add('form-check', 'form-switch', 'd-inline-block', 'fs-6');
|
|
17934
|
+
var checkbox = document.createElement('input');
|
|
17935
|
+
checkbox.setAttribute('type', 'checkbox');
|
|
17936
|
+
checkbox.setAttribute('role', 'switch');
|
|
17937
|
+
checkbox.setAttribute('id', formname + '-opt-in');
|
|
17938
|
+
checkbox.classList.add('form-check-input', 'json-editor-opt-in');
|
|
17939
|
+
var switchLabel = document.createElement('label');
|
|
17940
|
+
switchLabel.setAttribute('for', formname + '-opt-in');
|
|
17941
|
+
switchLabel.classList.add('form-check-label');
|
|
17942
|
+
var switchLabelText = document.createElement('span');
|
|
17943
|
+
switchLabelText.classList.add('visually-hidden');
|
|
17944
|
+
switchLabelText.textContent = formname + '-opt-in';
|
|
17945
|
+
switchLabel.appendChild(switchLabelText);
|
|
17946
|
+
container.appendChild(checkbox);
|
|
17947
|
+
container.appendChild(switchLabel);
|
|
17948
|
+
return {
|
|
17949
|
+
label: label,
|
|
17950
|
+
checkbox: checkbox,
|
|
17951
|
+
container: container
|
|
17952
|
+
};
|
|
17953
|
+
}
|
|
17677
17954
|
}, {
|
|
17678
17955
|
key: "setGridColumnSize",
|
|
17679
17956
|
value: function setGridColumnSize(el, size, offset) {
|
|
@@ -18999,10 +19276,36 @@ var spectreTheme = /*#__PURE__*/function (_AbstractTheme) {
|
|
|
18999
19276
|
_classCallCheck(this, spectreTheme);
|
|
19000
19277
|
return _callSuper(this, spectreTheme, [jsoneditor, options]);
|
|
19001
19278
|
}
|
|
19002
|
-
|
|
19003
|
-
/* Functions for setting up the grid container, row and columns */
|
|
19004
19279
|
_inherits(spectreTheme, _AbstractTheme);
|
|
19005
19280
|
return _createClass(spectreTheme, [{
|
|
19281
|
+
key: "getOptInSwitch",
|
|
19282
|
+
value: function getOptInSwitch(formname) {
|
|
19283
|
+
var container = document.createElement('span');
|
|
19284
|
+
container.classList.add('form-group');
|
|
19285
|
+
var label = document.createElement('label');
|
|
19286
|
+
label.classList.add('form-switch', 'd-inline-block');
|
|
19287
|
+
var checkbox = document.createElement('input');
|
|
19288
|
+
checkbox.setAttribute('type', 'checkbox');
|
|
19289
|
+
checkbox.setAttribute('id', formname + '-opt-in');
|
|
19290
|
+
checkbox.classList.add('json-editor-opt-in');
|
|
19291
|
+
var icon = document.createElement('i');
|
|
19292
|
+
icon.classList.add('form-icon');
|
|
19293
|
+
var switchLabelText = document.createElement('span');
|
|
19294
|
+
switchLabelText.classList.add('sr-only');
|
|
19295
|
+
switchLabelText.textContent = formname + '-opt-in';
|
|
19296
|
+
label.appendChild(switchLabelText);
|
|
19297
|
+
label.appendChild(checkbox);
|
|
19298
|
+
label.appendChild(icon);
|
|
19299
|
+
container.appendChild(label);
|
|
19300
|
+
return {
|
|
19301
|
+
label: label,
|
|
19302
|
+
checkbox: checkbox,
|
|
19303
|
+
container: container
|
|
19304
|
+
};
|
|
19305
|
+
}
|
|
19306
|
+
|
|
19307
|
+
/* Functions for setting up the grid container, row and columns */
|
|
19308
|
+
}, {
|
|
19006
19309
|
key: "setGridColumnSize",
|
|
19007
19310
|
value: function setGridColumnSize(el, size, offset) {
|
|
19008
19311
|
el.classList.add("col-".concat(size));
|
|
@@ -19491,7 +19794,15 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
19491
19794
|
".je-dropzone": "position:relative;margin:0.5rem%200;border:2px%20dashed%20black;width:100%25;height:60px;background:teal;transition:all%200.5s",
|
|
19492
19795
|
".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)",
|
|
19493
19796
|
".je-dropzone.valid-dropzone": "background:green",
|
|
19494
|
-
".je-dropzone.invalid-dropzone": "background:red"
|
|
19797
|
+
".je-dropzone.invalid-dropzone": "background:red",
|
|
19798
|
+
".switch": "position:relative;display:inline-block;width:28px;height:16px;margin-right:10px",
|
|
19799
|
+
".switch input": "opacity:0;width:0;height:0",
|
|
19800
|
+
".switch-slider": "position:absolute;cursor:pointer;top:0;left:0;right:0;bottom:0;background-color:%23ccc;transition:.1s;border-radius:34px",
|
|
19801
|
+
".switch-slider:before": "position:absolute;content:%22%22;height:12px;width:12px;left:1px;top:2px;background-color:white;transition:.1s;border-radius:50%25",
|
|
19802
|
+
"input:checked + .switch-slider": "background-color:%232196F3",
|
|
19803
|
+
"input:focus + .switch-slider": "box-shadow:0%200%201px%20%232196F3",
|
|
19804
|
+
"input:checked + .switch-slider:before": "transform:translateX(12px)",
|
|
19805
|
+
"input:disabled + .switch-slider": "opacity:0.5"
|
|
19495
19806
|
});
|
|
19496
19807
|
/* eslint-enable */
|
|
19497
19808
|
|
|
@@ -19614,6 +19925,31 @@ var tailwindTheme = /*#__PURE__*/function (_AbstractTheme) {
|
|
|
19614
19925
|
}
|
|
19615
19926
|
_inherits(tailwindTheme, _AbstractTheme);
|
|
19616
19927
|
return _createClass(tailwindTheme, [{
|
|
19928
|
+
key: "getOptInSwitch",
|
|
19929
|
+
value: function getOptInSwitch(formname) {
|
|
19930
|
+
var label = this.getHiddenLabel(formname + ' opt-in');
|
|
19931
|
+
label.setAttribute('for', formname + '-opt-in');
|
|
19932
|
+
var container = document.createElement('label');
|
|
19933
|
+
container.classList.add('switch');
|
|
19934
|
+
var checkbox = document.createElement('input');
|
|
19935
|
+
checkbox.setAttribute('type', 'checkbox');
|
|
19936
|
+
checkbox.setAttribute('id', formname + '-opt-in');
|
|
19937
|
+
checkbox.classList.add('json-editor-opt-in');
|
|
19938
|
+
var slider = document.createElement('span');
|
|
19939
|
+
slider.classList.add('switch-slider', 'round');
|
|
19940
|
+
var switchLabelText = document.createElement('span');
|
|
19941
|
+
switchLabelText.classList.add('sr-only');
|
|
19942
|
+
switchLabelText.textContent = formname + '-opt-in';
|
|
19943
|
+
container.appendChild(switchLabelText);
|
|
19944
|
+
container.appendChild(checkbox);
|
|
19945
|
+
container.appendChild(slider);
|
|
19946
|
+
return {
|
|
19947
|
+
label: label,
|
|
19948
|
+
checkbox: checkbox,
|
|
19949
|
+
container: container
|
|
19950
|
+
};
|
|
19951
|
+
}
|
|
19952
|
+
}, {
|
|
19617
19953
|
key: "getGridContainer",
|
|
19618
19954
|
value: function getGridContainer() {
|
|
19619
19955
|
var el = document.createElement('div');
|
|
@@ -30998,6 +31334,17 @@ var JSONEditor = /*#__PURE__*/function () {
|
|
|
30998
31334
|
styleSheet.replaceSync(cssText);
|
|
30999
31335
|
shadowRoot.adoptedStyleSheets = [].concat(_toConsumableArray(shadowRoot.adoptedStyleSheets), [styleSheet]);
|
|
31000
31336
|
}
|
|
31337
|
+
}, {
|
|
31338
|
+
key: "showValidationErrors",
|
|
31339
|
+
value: function showValidationErrors(errorList) {
|
|
31340
|
+
var errors = errorList !== null && errorList !== void 0 ? errorList : this.validate();
|
|
31341
|
+
Object.values(this.editors).forEach(function (editor) {
|
|
31342
|
+
if (editor) {
|
|
31343
|
+
editor.is_dirty = true;
|
|
31344
|
+
editor.showValidationErrors(errors);
|
|
31345
|
+
}
|
|
31346
|
+
});
|
|
31347
|
+
}
|
|
31001
31348
|
}]);
|
|
31002
31349
|
}();
|
|
31003
31350
|
JSONEditor.defaults = _defaults_js__WEBPACK_IMPORTED_MODULE_36__.defaults;
|