@react-typed-forms/schemas 14.3.0 → 14.3.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/lib/index.cjs +7 -6
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +7 -6
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/createFormRenderer.tsx +16 -11
package/lib/index.js
CHANGED
|
@@ -2791,25 +2791,26 @@ function createFormRenderer(customRenderers = [], defaultRenderers) {
|
|
|
2791
2791
|
return renderer.render(props, labelStart, labelEnd, formRenderers);
|
|
2792
2792
|
}
|
|
2793
2793
|
function renderData(props) {
|
|
2794
|
-
var _dataRegistrations$fi;
|
|
2795
2794
|
const {
|
|
2796
2795
|
renderOptions,
|
|
2797
2796
|
field
|
|
2798
2797
|
} = props;
|
|
2799
2798
|
const options = hasOptions(props);
|
|
2800
2799
|
const renderType = renderOptions.type;
|
|
2801
|
-
const renderer =
|
|
2802
|
-
const result = renderer.render(props, formRenderers);
|
|
2800
|
+
const renderer = dataRegistrations.find(matchesRenderer);
|
|
2801
|
+
const result = (renderer != null ? renderer : defaultRenderers.data).render(props, formRenderers);
|
|
2803
2802
|
if (typeof result === "function") return result;
|
|
2804
2803
|
return l => _extends({}, l, {
|
|
2805
2804
|
children: result
|
|
2806
2805
|
});
|
|
2807
2806
|
function matchesRenderer(x) {
|
|
2808
2807
|
var _x$collection, _field$collection, _x$options;
|
|
2808
|
+
const noMatch = x.match ? !x.match(props, renderOptions) : undefined;
|
|
2809
|
+
if (noMatch === true) return false;
|
|
2809
2810
|
const matchCollection = ((_x$collection = x.collection) != null ? _x$collection : false) === (props.elementIndex == null && ((_field$collection = field.collection) != null ? _field$collection : false));
|
|
2810
|
-
const
|
|
2811
|
-
const
|
|
2812
|
-
return matchCollection && ((_x$options = x.options) != null ? _x$options : false) === options && (
|
|
2811
|
+
const isSchemaAllowed = !!x.schemaType && renderType == DataRenderType.Standard ? isOneOf(x.schemaType, field.type) : undefined;
|
|
2812
|
+
const isRendererAllowed = !!x.renderType && isOneOf(x.renderType, renderType);
|
|
2813
|
+
return matchCollection && ((_x$options = x.options) != null ? _x$options : false) === options && (isSchemaAllowed || isRendererAllowed || !x.renderType && !x.schemaType && noMatch === false);
|
|
2813
2814
|
}
|
|
2814
2815
|
}
|
|
2815
2816
|
function renderGroup(props) {
|