@luomus/laji-form 15.1.21 → 15.1.22
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.
|
@@ -10,6 +10,7 @@ const React = require("react");
|
|
|
10
10
|
const PropTypes = require("prop-types");
|
|
11
11
|
const VirtualSchemaField_1 = require("../VirtualSchemaField");
|
|
12
12
|
const utils_1 = require("../../utils");
|
|
13
|
+
const merge = require("deepmerge");
|
|
13
14
|
let InputWithDefaultValueButtonField = class InputWithDefaultValueButtonField extends React.Component {
|
|
14
15
|
constructor() {
|
|
15
16
|
super(...arguments);
|
|
@@ -28,14 +29,15 @@ let InputWithDefaultValueButtonField = class InputWithDefaultValueButtonField ex
|
|
|
28
29
|
let { schema, uiSchema } = props;
|
|
29
30
|
const { buttonField, buttonLabel } = utils_1.getUiOptions(uiSchema);
|
|
30
31
|
const innerUiSchema = utils_1.getInnerUiSchema(uiSchema);
|
|
31
|
-
const
|
|
32
|
-
|
|
32
|
+
const buttonFieldJSONPointer = utils_1.uiSchemaJSONPointer(schema, buttonField);
|
|
33
|
+
const buttonFieldUiSchema = merge(utils_1.parseJSONPointer(innerUiSchema, buttonFieldJSONPointer) || {}, {
|
|
33
34
|
"ui:widget": "InputWithDefaultValueButtonWidget",
|
|
34
35
|
"ui:options": {
|
|
35
36
|
buttonLabel,
|
|
36
37
|
onClick: this.onClick
|
|
37
|
-
}
|
|
38
|
-
}
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
uiSchema = utils_1.updateSafelyWithJSONPointer(innerUiSchema, buttonFieldUiSchema, buttonFieldJSONPointer);
|
|
39
41
|
return Object.assign(Object.assign({}, props), { uiSchema });
|
|
40
42
|
}
|
|
41
43
|
};
|