@react-typed-forms/schemas-html 4.0.0 → 4.0.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/adornments/optionalAdornment.d.ts +3 -6
- package/lib/index.cjs +12 -12
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +22 -20
- package/lib/index.js.map +1 -1
- package/package.json +2 -2
|
@@ -9,6 +9,7 @@ export interface OptionalRenderProps {
|
|
|
9
9
|
nullToggler: Control<boolean>;
|
|
10
10
|
dataContext: ControlDataContext;
|
|
11
11
|
options: DefaultOptionalAdornmentOptions;
|
|
12
|
+
dataControl: Control<any>;
|
|
12
13
|
}
|
|
13
14
|
export interface DefaultOptionalAdornmentOptions {
|
|
14
15
|
className?: string;
|
|
@@ -23,10 +24,6 @@ export interface DefaultOptionalAdornmentOptions {
|
|
|
23
24
|
customRender?: (props: OptionalRenderProps) => ReactNode;
|
|
24
25
|
}
|
|
25
26
|
export declare function createOptionalAdornment(options?: DefaultOptionalAdornmentOptions): AdornmentRendererRegistration;
|
|
26
|
-
export declare function OptionalEditRenderer({ children, options, adornment, editing,
|
|
27
|
-
|
|
28
|
-
children: ReactNode;
|
|
29
|
-
adornment: OptionalAdornment;
|
|
30
|
-
editing: Control<boolean | undefined>;
|
|
31
|
-
dataControl: Control<any>;
|
|
27
|
+
export declare function OptionalEditRenderer({ children, options, adornment, editing, renderMultiValues, allValues, nullToggler, }: OptionalRenderProps & {
|
|
28
|
+
renderMultiValues?: (allValues: Control<unknown[]>) => ReactNode;
|
|
32
29
|
}): JSX.Element;
|
package/lib/index.cjs
CHANGED
|
@@ -1842,21 +1842,17 @@ function createOptionalAdornment(options) {
|
|
|
1842
1842
|
className: options.checkClass
|
|
1843
1843
|
}))(rl);
|
|
1844
1844
|
schemas.wrapMarkup("children", function (children) {
|
|
1845
|
-
|
|
1845
|
+
var props = {
|
|
1846
1846
|
allValues: schemas.getAllValues(dataControl),
|
|
1847
1847
|
editing: editing,
|
|
1848
1848
|
children: children,
|
|
1849
1849
|
adornment: adornment,
|
|
1850
1850
|
nullToggler: nullToggler,
|
|
1851
1851
|
dataContext: dataContext,
|
|
1852
|
-
options: options
|
|
1853
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(OptionalEditRenderer, {
|
|
1854
|
-
children: children,
|
|
1855
1852
|
options: options,
|
|
1856
|
-
editing: editing.as(),
|
|
1857
|
-
adornment: adornment,
|
|
1858
1853
|
dataControl: dataControl
|
|
1859
|
-
}
|
|
1854
|
+
};
|
|
1855
|
+
return options.customRender ? options.customRender(props) : /*#__PURE__*/jsxRuntime.jsx(OptionalEditRenderer, _extends({}, props));
|
|
1860
1856
|
})(rl);
|
|
1861
1857
|
},
|
|
1862
1858
|
priority: 0,
|
|
@@ -1869,14 +1865,18 @@ function createOptionalAdornment(options) {
|
|
|
1869
1865
|
function OptionalEditRenderer(_ref2) {
|
|
1870
1866
|
var _effect = core.useComponentTracking();
|
|
1871
1867
|
try {
|
|
1872
|
-
var _options$setNullText
|
|
1868
|
+
var _options$setNullText;
|
|
1873
1869
|
var children = _ref2.children,
|
|
1874
1870
|
options = _ref2.options,
|
|
1875
1871
|
adornment = _ref2.adornment,
|
|
1876
1872
|
editing = _ref2.editing,
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1873
|
+
renderMultiValues = _ref2.renderMultiValues,
|
|
1874
|
+
allValues = _ref2.allValues,
|
|
1875
|
+
nullToggler = _ref2.nullToggler;
|
|
1876
|
+
renderMultiValues != null ? renderMultiValues : renderMultiValues = function renderMultiValues() {
|
|
1877
|
+
var _options$multiValuesT;
|
|
1878
|
+
return (_options$multiValuesT = options.multiValuesText) != null ? _options$multiValuesT : "Differing values";
|
|
1879
|
+
};
|
|
1880
1880
|
var multipleValues = allValues.value.length > 1;
|
|
1881
1881
|
var nullEdit = adornment.allowNull ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1882
1882
|
className: options.nullWrapperClass,
|
|
@@ -1892,7 +1892,7 @@ function OptionalEditRenderer(_ref2) {
|
|
|
1892
1892
|
className: options.className,
|
|
1893
1893
|
children: multipleValues && editing.value === false ? /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1894
1894
|
className: options.multiValuesClass,
|
|
1895
|
-
children: (
|
|
1895
|
+
children: renderMultiValues(allValues)
|
|
1896
1896
|
}) : /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1897
1897
|
className: options.childWrapperClass,
|
|
1898
1898
|
children: [nullEdit, children]
|