@json-editor/json-editor 2.10.0 → 2.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/README.md +5 -0
- package/dist/jsoneditor.js +1 -1
- package/dist/jsoneditor.js.LICENSE.txt +1 -1
- package/dist/nonmin/jsoneditor.js +19 -2
- package/dist/nonmin/jsoneditor.js.map +1 -1
- package/package.json +1 -1
- package/src/editors/multiple.js +14 -3
- package/src/utilities.js +10 -0
- package/tests/codeceptjs/constrains/if-then-else_test.js +43 -0
- package/tests/codeceptjs/core_test.js +8 -0
- package/tests/pages/if-then-else-disable-fields.html +69 -0
- package/tests/pages/keep_only_existing_values.html +80 -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.10.
|
|
6
|
+
* * @version "2.10.1"
|
|
7
7
|
* * @author Jeremy Dorn
|
|
8
8
|
* * @see https://github.com/jdorn/json-editor/
|
|
9
9
|
* * @see https://github.com/json-editor/json-editor
|
|
@@ -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.10.
|
|
6
|
+
* * @version "2.10.1"
|
|
7
7
|
* * @author Jeremy Dorn
|
|
8
8
|
* * @see https://github.com/jdorn/json-editor/
|
|
9
9
|
* * @see https://github.com/json-editor/json-editor
|
|
@@ -6234,6 +6234,9 @@ var MultipleEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
6234
6234
|
this.editors.forEach(function (editor, type) {
|
|
6235
6235
|
if (!editor) return;
|
|
6236
6236
|
if (_this.type === type) {
|
|
6237
|
+
if (_this.keep_only_existing_values) {
|
|
6238
|
+
currentValue = (0,_utilities_js__WEBPACK_IMPORTED_MODULE_32__.overwriteExistingProperties)(editor.getValue(), currentValue);
|
|
6239
|
+
}
|
|
6237
6240
|
if (_this.keep_values || _this["if"]) editor.setValue(currentValue, true);
|
|
6238
6241
|
editor.container.style.display = '';
|
|
6239
6242
|
} else {
|
|
@@ -6292,6 +6295,9 @@ var MultipleEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
6292
6295
|
this.keep_values = true;
|
|
6293
6296
|
if (typeof this.jsoneditor.options.keep_oneof_values !== 'undefined') this.keep_values = this.jsoneditor.options.keep_oneof_values;
|
|
6294
6297
|
if (typeof this.options.keep_oneof_values !== 'undefined') this.keep_values = this.options.keep_oneof_values;
|
|
6298
|
+
this.keep_only_existing_values = false;
|
|
6299
|
+
if (typeof this.jsoneditor.options.keep_only_existing_values !== 'undefined') this.keep_only_existing_values = this.jsoneditor.options.keep_only_existing_values;
|
|
6300
|
+
if (typeof this.options.keep_only_existing_values !== 'undefined') this.keep_only_existing_values = this.options.keep_only_existing_values;
|
|
6295
6301
|
if (this.schema.oneOf) {
|
|
6296
6302
|
this.oneOf = true;
|
|
6297
6303
|
this.types = this.schema.oneOf;
|
|
@@ -6389,6 +6395,9 @@ var MultipleEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
6389
6395
|
}
|
|
6390
6396
|
_this3.validators[i] = new _validator_js__WEBPACK_IMPORTED_MODULE_31__.Validator(_this3.jsoneditor, schema, validatorOptions, _this3.defaults);
|
|
6391
6397
|
});
|
|
6398
|
+
this.jsoneditor.on('change', function () {
|
|
6399
|
+
_this3.switchIf();
|
|
6400
|
+
});
|
|
6392
6401
|
this.switchEditor(0);
|
|
6393
6402
|
}
|
|
6394
6403
|
}, {
|
|
@@ -6398,7 +6407,6 @@ var MultipleEditor = /*#__PURE__*/function (_AbstractEditor) {
|
|
|
6398
6407
|
this.refreshValue();
|
|
6399
6408
|
this.refreshHeaderText();
|
|
6400
6409
|
}
|
|
6401
|
-
this.switchIf();
|
|
6402
6410
|
_get(_getPrototypeOf(MultipleEditor.prototype), "onChildEditorChange", this).call(this);
|
|
6403
6411
|
}
|
|
6404
6412
|
}, {
|
|
@@ -19716,6 +19724,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
19716
19724
|
/* harmony export */ "isObject": () => (/* binding */ isObject),
|
|
19717
19725
|
/* harmony export */ "isPlainObject": () => (/* binding */ isPlainObject),
|
|
19718
19726
|
/* harmony export */ "mergeDeep": () => (/* binding */ mergeDeep),
|
|
19727
|
+
/* harmony export */ "overwriteExistingProperties": () => (/* binding */ overwriteExistingProperties),
|
|
19719
19728
|
/* harmony export */ "trigger": () => (/* binding */ trigger)
|
|
19720
19729
|
/* harmony export */ });
|
|
19721
19730
|
/* harmony import */ var core_js_modules_es_array_is_array_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! core-js/modules/es.array.is-array.js */ "./node_modules/core-js/modules/es.array.is-array.js");
|
|
@@ -19917,6 +19926,14 @@ function mergeDeep(target) {
|
|
|
19917
19926
|
}
|
|
19918
19927
|
return mergeDeep.apply(void 0, [target].concat(sources));
|
|
19919
19928
|
}
|
|
19929
|
+
function overwriteExistingProperties(obj1, obj2) {
|
|
19930
|
+
Object.keys(obj2).forEach(function (key) {
|
|
19931
|
+
if (key in obj1) {
|
|
19932
|
+
obj1[key] = obj2[key];
|
|
19933
|
+
}
|
|
19934
|
+
});
|
|
19935
|
+
return obj1;
|
|
19936
|
+
}
|
|
19920
19937
|
|
|
19921
19938
|
/***/ }),
|
|
19922
19939
|
|