@steroidsjs/core 3.0.25 → 3.0.26
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/package.json
CHANGED
|
@@ -125,6 +125,8 @@ function fieldWrapper(componentId, Component, optionsConfig) {
|
|
|
125
125
|
return obj;
|
|
126
126
|
}, {});
|
|
127
127
|
var attribute = Object.values(attributesProps)[0];
|
|
128
|
+
// Get full path to the field, it is necessary for displaying errors in nested fields, for example, in FieldList
|
|
129
|
+
var errorsAttribute = [props.prefix, attribute].filter(Boolean).join('.');
|
|
128
130
|
// Get UI props and create Field Class dynamically (for add field props - input, errors, model, ...)
|
|
129
131
|
var metaProps = (0, react_1.useMemo)(function () { return components.ui.getFieldProps(componentId, model, attribute); }, [components.ui, attribute, model]);
|
|
130
132
|
if (!Component.DynamicField) {
|
|
@@ -136,7 +138,7 @@ function fieldWrapper(componentId, Component, optionsConfig) {
|
|
|
136
138
|
return components.ui.renderView(Component.DynamicField, __assign(__assign({}, props), { size: props.size || DEFAULT_SIZE }));
|
|
137
139
|
}
|
|
138
140
|
var size = props.size || context.size || DEFAULT_SIZE;
|
|
139
|
-
return components.ui.renderView(FieldLayout_1["default"], __assign(__assign({}, attributesProps), { size: size, className: props.fieldLayoutClassName, required: (0, has_1["default"])(props, 'required') ? props.required : metaProps.required, label: options.label === false ? null : ((0, has_1["default"])(props, 'label') ? props.label : metaProps.label), hint: (0, has_1["default"])(props, 'hint') ? props.hint : metaProps.hint, errors: props.errors, id: inputId, children: (React.createElement(Component.DynamicField, __assign({}, props, { id: inputId, size: size }))) }));
|
|
141
|
+
return components.ui.renderView(FieldLayout_1["default"], __assign(__assign({}, attributesProps), { errorsAttribute: errorsAttribute, size: size, className: props.fieldLayoutClassName, required: (0, has_1["default"])(props, 'required') ? props.required : metaProps.required, label: options.label === false ? null : ((0, has_1["default"])(props, 'label') ? props.label : metaProps.label), hint: (0, has_1["default"])(props, 'hint') ? props.hint : metaProps.hint, errors: props.errors, id: inputId, children: (React.createElement(Component.DynamicField, __assign({}, props, { id: inputId, size: size }))) }));
|
|
140
142
|
};
|
|
141
143
|
NewComponent.WrappedComponent = Component;
|
|
142
144
|
NewComponent.displayName = componentId;
|
|
@@ -33,7 +33,7 @@ var hooks_1 = require("../../../hooks");
|
|
|
33
33
|
function FieldLayout(props) {
|
|
34
34
|
var components = (0, hooks_1.useComponents)();
|
|
35
35
|
// Error from state
|
|
36
|
-
var errors = (0, hooks_1.useForm)().formSelector(function (state) { return (0, get_1["default"])(state, 'errors.' + props.
|
|
36
|
+
var errors = (0, hooks_1.useForm)().formSelector(function (state) { return (0, get_1["default"])(state, 'errors.' + props.errorsAttribute); });
|
|
37
37
|
var viewProps = (0, react_1.useMemo)(function () { return ({
|
|
38
38
|
errors: props.errors || errors,
|
|
39
39
|
className: props.className,
|