@terrestris/shogun-admin 18.1.0-next.3 → 18.1.0-next.5
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.
|
@@ -77,7 +77,7 @@ export var JSONEditor = function (_a) {
|
|
|
77
77
|
var _b;
|
|
78
78
|
var _c;
|
|
79
79
|
var initialValue = _a.initialValue, onChangeProp = _a.onChange, editorProps = _a.editorProps, entityType = _a.entityType, dataField = _a.dataField, _d = _a.indentSize, indentSize = _d === void 0 ? 2 : _d;
|
|
80
|
-
var _e = useState(
|
|
80
|
+
var _e = useState(), currentValue = _e[0], setCurrentValue = _e[1];
|
|
81
81
|
// We need to keep track of whether the document has been formatted initially. This is necessary
|
|
82
82
|
// because the document will be formatted on mount, which will trigger the onChange event. We
|
|
83
83
|
// don't want to trigger the onChange event on mount, so we need to keep track of whether the
|
|
@@ -217,6 +217,11 @@ export var JSONEditor = function (_a) {
|
|
|
217
217
|
}
|
|
218
218
|
};
|
|
219
219
|
var isEditedManually = isEditedManuallyMap === null || isEditedManuallyMap === void 0 ? void 0 : isEditedManuallyMap["".concat(entityType, ".").concat(dataField)];
|
|
220
|
+
useEffect(function () {
|
|
221
|
+
if (initialValue) {
|
|
222
|
+
setCurrentValue(JSON.stringify(initialValue || undefined, null, indentSize));
|
|
223
|
+
}
|
|
224
|
+
}, [indentSize, initialValue]);
|
|
220
225
|
return (React.createElement(FullscreenWrapper, null,
|
|
221
226
|
React.createElement("div", { className: "json-editor" },
|
|
222
227
|
React.createElement("div", { className: "json-editor-toolbar" },
|
|
@@ -151,7 +151,7 @@ export var GeneralEntityForm = function (_a) {
|
|
|
151
151
|
* @param fieldCfg The FieldConfig
|
|
152
152
|
* @returns An antd FormItem
|
|
153
153
|
*/
|
|
154
|
-
var createFormItem = function (fieldCfg) {
|
|
154
|
+
var createFormItem = function (fieldCfg, index) {
|
|
155
155
|
var _a;
|
|
156
156
|
var copyFieldCfg = _cloneDeep(fieldCfg);
|
|
157
157
|
copyFieldCfg.label = TranslationUtil.getTranslationFromConfig(fieldCfg.label, i18n);
|
|
@@ -179,7 +179,7 @@ export var GeneralEntityForm = function (_a) {
|
|
|
179
179
|
if (copyFieldCfg.component === 'Switch') {
|
|
180
180
|
formItemProps.valuePropName = 'checked';
|
|
181
181
|
}
|
|
182
|
-
var formKey = "".concat(generalEntityRootContext === null || generalEntityRootContext === void 0 ? void 0 : generalEntityRootContext.entityType, "-").concat(form.getFieldValue('id'), "-").concat(copyFieldCfg.dataField || ((_a = copyFieldCfg.component) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()));
|
|
182
|
+
var formKey = "".concat(generalEntityRootContext === null || generalEntityRootContext === void 0 ? void 0 : generalEntityRootContext.entityType, "-").concat(form.getFieldValue('id'), "-").concat(copyFieldCfg.dataField || ((_a = copyFieldCfg.component) === null || _a === void 0 ? void 0 : _a.toLocaleLowerCase()), "-").concat(index);
|
|
183
183
|
if (copyFieldCfg.component) {
|
|
184
184
|
formKey += "-".concat(copyFieldCfg.component.toLocaleLowerCase());
|
|
185
185
|
}
|