@react-typed-forms/schemas-html 4.0.1 → 4.1.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/components/DefaultDisplayOnly.d.ts +3 -2
- package/lib/index.cjs +10 -6
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +11 -7
- package/lib/index.js.map +1 -1
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { FormRenderer, SchemaDataNode, SchemaInterface } from "@react-typed-forms/schemas";
|
|
3
|
-
export declare function DefaultDisplayOnly({ dataNode, className, emptyText, schemaInterface, style, renderer, textClass, inline, }: {
|
|
2
|
+
import { ControlState, FormRenderer, SchemaDataNode, SchemaInterface } from "@react-typed-forms/schemas";
|
|
3
|
+
export declare function DefaultDisplayOnly({ dataNode, className, emptyText, schemaInterface, style, renderer, textClass, inline, state, }: {
|
|
4
4
|
dataNode: SchemaDataNode;
|
|
5
5
|
schemaInterface: SchemaInterface;
|
|
6
6
|
className?: string;
|
|
@@ -9,4 +9,5 @@ export declare function DefaultDisplayOnly({ dataNode, className, emptyText, sch
|
|
|
9
9
|
inline: boolean;
|
|
10
10
|
renderer: FormRenderer;
|
|
11
11
|
emptyText?: string | null;
|
|
12
|
+
state: ControlState;
|
|
12
13
|
}): JSX.Element;
|
package/lib/index.cjs
CHANGED
|
@@ -644,8 +644,9 @@ function DefaultDisplayOnly(_ref) {
|
|
|
644
644
|
style = _ref.style,
|
|
645
645
|
renderer = _ref.renderer,
|
|
646
646
|
textClass = _ref.textClass,
|
|
647
|
-
inline = _ref.inline
|
|
648
|
-
|
|
647
|
+
inline = _ref.inline,
|
|
648
|
+
state = _ref.state;
|
|
649
|
+
var text = state.display != null ? state.display : (_ref2 = schemaInterface.isEmptyValue(dataNode.schema.field, dataNode.control.value) ? emptyText : schemaInterface.textValueForData(dataNode)) != null ? _ref2 : "";
|
|
649
650
|
var Div = renderer.html.Div;
|
|
650
651
|
return /*#__PURE__*/jsxRuntime.jsx(Div, {
|
|
651
652
|
style: style,
|
|
@@ -763,21 +764,23 @@ function createTabsRenderer(options) {
|
|
|
763
764
|
renderType: schemas.GroupRenderType.Tabs
|
|
764
765
|
});
|
|
765
766
|
function renderAllTabs(_ref, isVisible) {
|
|
767
|
+
var _tabIndex$value;
|
|
766
768
|
var options = _ref.options,
|
|
767
769
|
_ref$groupProps = _ref.groupProps,
|
|
768
770
|
designMode = _ref$groupProps.designMode,
|
|
769
771
|
formNode = _ref$groupProps.formNode,
|
|
770
772
|
className = _ref$groupProps.className,
|
|
771
773
|
renderChild = _ref$groupProps.renderChild,
|
|
774
|
+
state = _ref$groupProps.state,
|
|
772
775
|
tabOptions = _ref.tabOptions;
|
|
773
|
-
var tabIndex =
|
|
776
|
+
var tabIndex = state.meta.fields.tabIndex.as();
|
|
774
777
|
var tabClass = options.tabClass,
|
|
775
778
|
labelClass = options.labelClass,
|
|
776
779
|
tabListClass = options.tabListClass,
|
|
777
780
|
inactiveClass = options.inactiveClass,
|
|
778
781
|
activeClass = options.activeClass,
|
|
779
782
|
contentClass = options.contentClass;
|
|
780
|
-
var currentTab = tabIndex.value;
|
|
783
|
+
var currentTab = (_tabIndex$value = tabIndex.value) != null ? _tabIndex$value : 0;
|
|
781
784
|
return designMode ? /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
782
785
|
children: formNode.getChildNodes().map(function (x, i) {
|
|
783
786
|
return renderTabs([x], i);
|
|
@@ -1865,7 +1868,7 @@ function createOptionalAdornment(options) {
|
|
|
1865
1868
|
function OptionalEditRenderer(_ref2) {
|
|
1866
1869
|
var _effect = core.useComponentTracking();
|
|
1867
1870
|
try {
|
|
1868
|
-
var _options$setNullText;
|
|
1871
|
+
var _renderMultiValues, _options$setNullText;
|
|
1869
1872
|
var children = _ref2.children,
|
|
1870
1873
|
options = _ref2.options,
|
|
1871
1874
|
adornment = _ref2.adornment,
|
|
@@ -1873,7 +1876,7 @@ function OptionalEditRenderer(_ref2) {
|
|
|
1873
1876
|
renderMultiValues = _ref2.renderMultiValues,
|
|
1874
1877
|
allValues = _ref2.allValues,
|
|
1875
1878
|
nullToggler = _ref2.nullToggler;
|
|
1876
|
-
renderMultiValues != null ?
|
|
1879
|
+
(_renderMultiValues = renderMultiValues) != null ? _renderMultiValues : renderMultiValues = function renderMultiValues() {
|
|
1877
1880
|
var _options$multiValuesT;
|
|
1878
1881
|
return (_options$multiValuesT = options.multiValuesText) != null ? _options$multiValuesT : "Differing values";
|
|
1879
1882
|
};
|
|
@@ -2139,6 +2142,7 @@ function createDefaultDataRenderer(options) {
|
|
|
2139
2142
|
className: "@ " + schemas.rendererClass(p.className, displayOnlyClass),
|
|
2140
2143
|
children: /*#__PURE__*/jsxRuntime.jsx(DefaultDisplayOnly, {
|
|
2141
2144
|
dataNode: props.dataNode,
|
|
2145
|
+
state: props.state,
|
|
2142
2146
|
schemaInterface: props.dataContext.schemaInterface,
|
|
2143
2147
|
className: props.className,
|
|
2144
2148
|
textClass: props.textClass,
|