@react-typed-forms/schemas 11.2.2 → 11.3.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/lib/components/DefaultLayout.d.ts +3 -2
- package/lib/index.js +7 -3
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { RenderedLayout } from "../controlRender";
|
|
2
|
-
import React from "react";
|
|
2
|
+
import React, { ReactNode } from "react";
|
|
3
3
|
export interface DefaultLayoutRendererOptions {
|
|
4
4
|
className?: string;
|
|
5
5
|
errorClass?: string;
|
|
6
|
+
renderError?: (errorText: string | null | undefined) => ReactNode;
|
|
6
7
|
}
|
|
7
|
-
export declare function DefaultLayout({ errorClass, layout: { controlEnd, controlStart, label, children, errorControl }, }: DefaultLayoutRendererOptions & {
|
|
8
|
+
export declare function DefaultLayout({ errorClass, renderError, layout: { controlEnd, controlStart, label, children, errorControl }, }: DefaultLayoutRendererOptions & {
|
|
8
9
|
layout: RenderedLayout;
|
|
9
10
|
}): React.JSX.Element;
|
package/lib/index.js
CHANGED
|
@@ -1942,6 +1942,12 @@ function DefaultLayout(_ref) {
|
|
|
1942
1942
|
var _effect = core.useComponentTracking();
|
|
1943
1943
|
try {
|
|
1944
1944
|
var errorClass = _ref.errorClass,
|
|
1945
|
+
_ref$renderError = _ref.renderError,
|
|
1946
|
+
renderError = _ref$renderError === void 0 ? function (e) {
|
|
1947
|
+
return e && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1948
|
+
className: errorClass
|
|
1949
|
+
}, e);
|
|
1950
|
+
} : _ref$renderError,
|
|
1945
1951
|
_ref$layout = _ref.layout,
|
|
1946
1952
|
controlEnd = _ref$layout.controlEnd,
|
|
1947
1953
|
controlStart = _ref$layout.controlStart,
|
|
@@ -1950,9 +1956,7 @@ function DefaultLayout(_ref) {
|
|
|
1950
1956
|
errorControl = _ref$layout.errorControl;
|
|
1951
1957
|
var ec = errorControl;
|
|
1952
1958
|
var errorText = ec && ec.touched ? ec.error : undefined;
|
|
1953
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, label, controlStart, children, errorText
|
|
1954
|
-
className: errorClass
|
|
1955
|
-
}, errorText), controlEnd);
|
|
1959
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, label, controlStart, children, renderError(errorText), controlEnd);
|
|
1956
1960
|
} finally {
|
|
1957
1961
|
_effect();
|
|
1958
1962
|
}
|