@react-typed-forms/schemas-html 4.0.0 → 4.1.0
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 +16 -14
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +27 -23
- package/lib/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -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
|
@@ -763,21 +763,23 @@ function createTabsRenderer(options) {
|
|
|
763
763
|
renderType: schemas.GroupRenderType.Tabs
|
|
764
764
|
});
|
|
765
765
|
function renderAllTabs(_ref, isVisible) {
|
|
766
|
+
var _tabIndex$value;
|
|
766
767
|
var options = _ref.options,
|
|
767
768
|
_ref$groupProps = _ref.groupProps,
|
|
768
769
|
designMode = _ref$groupProps.designMode,
|
|
769
770
|
formNode = _ref$groupProps.formNode,
|
|
770
771
|
className = _ref$groupProps.className,
|
|
771
772
|
renderChild = _ref$groupProps.renderChild,
|
|
773
|
+
state = _ref$groupProps.state,
|
|
772
774
|
tabOptions = _ref.tabOptions;
|
|
773
|
-
var tabIndex =
|
|
775
|
+
var tabIndex = state.meta.fields.tabIndex.as();
|
|
774
776
|
var tabClass = options.tabClass,
|
|
775
777
|
labelClass = options.labelClass,
|
|
776
778
|
tabListClass = options.tabListClass,
|
|
777
779
|
inactiveClass = options.inactiveClass,
|
|
778
780
|
activeClass = options.activeClass,
|
|
779
781
|
contentClass = options.contentClass;
|
|
780
|
-
var currentTab = tabIndex.value;
|
|
782
|
+
var currentTab = (_tabIndex$value = tabIndex.value) != null ? _tabIndex$value : 0;
|
|
781
783
|
return designMode ? /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
782
784
|
children: formNode.getChildNodes().map(function (x, i) {
|
|
783
785
|
return renderTabs([x], i);
|
|
@@ -1842,21 +1844,17 @@ function createOptionalAdornment(options) {
|
|
|
1842
1844
|
className: options.checkClass
|
|
1843
1845
|
}))(rl);
|
|
1844
1846
|
schemas.wrapMarkup("children", function (children) {
|
|
1845
|
-
|
|
1847
|
+
var props = {
|
|
1846
1848
|
allValues: schemas.getAllValues(dataControl),
|
|
1847
1849
|
editing: editing,
|
|
1848
1850
|
children: children,
|
|
1849
1851
|
adornment: adornment,
|
|
1850
1852
|
nullToggler: nullToggler,
|
|
1851
1853
|
dataContext: dataContext,
|
|
1852
|
-
options: options
|
|
1853
|
-
}) : /*#__PURE__*/jsxRuntime.jsx(OptionalEditRenderer, {
|
|
1854
|
-
children: children,
|
|
1855
1854
|
options: options,
|
|
1856
|
-
editing: editing.as(),
|
|
1857
|
-
adornment: adornment,
|
|
1858
1855
|
dataControl: dataControl
|
|
1859
|
-
}
|
|
1856
|
+
};
|
|
1857
|
+
return options.customRender ? options.customRender(props) : /*#__PURE__*/jsxRuntime.jsx(OptionalEditRenderer, _extends({}, props));
|
|
1860
1858
|
})(rl);
|
|
1861
1859
|
},
|
|
1862
1860
|
priority: 0,
|
|
@@ -1869,14 +1867,18 @@ function createOptionalAdornment(options) {
|
|
|
1869
1867
|
function OptionalEditRenderer(_ref2) {
|
|
1870
1868
|
var _effect = core.useComponentTracking();
|
|
1871
1869
|
try {
|
|
1872
|
-
var
|
|
1870
|
+
var _renderMultiValues, _options$setNullText;
|
|
1873
1871
|
var children = _ref2.children,
|
|
1874
1872
|
options = _ref2.options,
|
|
1875
1873
|
adornment = _ref2.adornment,
|
|
1876
1874
|
editing = _ref2.editing,
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
|
|
1875
|
+
renderMultiValues = _ref2.renderMultiValues,
|
|
1876
|
+
allValues = _ref2.allValues,
|
|
1877
|
+
nullToggler = _ref2.nullToggler;
|
|
1878
|
+
(_renderMultiValues = renderMultiValues) != null ? _renderMultiValues : renderMultiValues = function renderMultiValues() {
|
|
1879
|
+
var _options$multiValuesT;
|
|
1880
|
+
return (_options$multiValuesT = options.multiValuesText) != null ? _options$multiValuesT : "Differing values";
|
|
1881
|
+
};
|
|
1880
1882
|
var multipleValues = allValues.value.length > 1;
|
|
1881
1883
|
var nullEdit = adornment.allowNull ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1882
1884
|
className: options.nullWrapperClass,
|
|
@@ -1892,7 +1894,7 @@ function OptionalEditRenderer(_ref2) {
|
|
|
1892
1894
|
className: options.className,
|
|
1893
1895
|
children: multipleValues && editing.value === false ? /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1894
1896
|
className: options.multiValuesClass,
|
|
1895
|
-
children: (
|
|
1897
|
+
children: renderMultiValues(allValues)
|
|
1896
1898
|
}) : /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1897
1899
|
className: options.childWrapperClass,
|
|
1898
1900
|
children: [nullEdit, children]
|