@react-typed-forms/schemas-rn 2.1.0 → 2.2.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.
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { FormRenderer, FormStateNode, SchemaDataNode, SchemaInterface } from "@react-typed-forms/schemas";
3
- export declare function DefaultDisplayOnly({ dataNode, className, emptyText, schemaInterface, style, renderer, textClass, inline, state, }: {
3
+ export declare function DefaultDisplayOnly({ dataNode, className, emptyText, noSelection, schemaInterface, style, renderer, textClass, inline, state, }: {
4
4
  dataNode: SchemaDataNode;
5
5
  schemaInterface: SchemaInterface;
6
6
  className?: string;
@@ -9,5 +9,6 @@ export declare function DefaultDisplayOnly({ dataNode, className, emptyText, sch
9
9
  inline: boolean;
10
10
  renderer: FormRenderer;
11
11
  emptyText?: string | null;
12
+ noSelection?: boolean | null;
12
13
  state: FormStateNode;
13
14
  }): import("react/jsx-runtime").JSX.Element;
@@ -1,8 +1,11 @@
1
- import { HtmlComponents } from "@react-typed-forms/schemas";
1
+ import { HtmlDivProperties, HtmlComponents } from "@react-typed-forms/schemas";
2
2
  import { AdornmentRendererRegistration, DataRendererRegistration, DefaultRenderers, LabelRendererRegistration } from "@react-typed-forms/schemas";
3
3
  import { DefaultRendererOptions, DefaultDataRendererOptions, DefaultLabelRendererOptions, DefaultAdornmentRendererOptions } from "./rendererOptions";
4
4
  export declare function createDefaultDataRenderer(options?: DefaultDataRendererOptions): DataRendererRegistration;
5
5
  export declare function createDefaultAdornmentRenderer(options?: DefaultAdornmentRendererOptions): AdornmentRendererRegistration;
6
6
  export declare function createDefaultLabelRenderer(options?: DefaultLabelRendererOptions): LabelRendererRegistration;
7
+ export declare function RNDiv({ className, html, children, textClass, text, style, inline, role, noSelection, ...props }: HtmlDivProperties & {
8
+ noSelection?: boolean | null;
9
+ }): import("react/jsx-runtime").JSX.Element;
7
10
  export declare const ReactNativeHtmlComponents: HtmlComponents;
8
11
  export declare function createDefaultRenderers(options?: DefaultRendererOptions): DefaultRenderers;
package/lib/index.cjs CHANGED
@@ -618,6 +618,9 @@ function RNHtmlRenderer(_ref) {
618
618
  style: style,
619
619
  className: className,
620
620
  children: jsxRuntime.jsx(RenderHtml__default["default"], _extends({
621
+ defaultTextProps: {
622
+ selectable: true
623
+ },
621
624
  contentWidth: contentWidth != null ? contentWidth : reactNative.Dimensions.get("window").width,
622
625
  source: source
623
626
  }, props))
@@ -1393,6 +1396,7 @@ function DefaultDisplayOnly(_ref) {
1393
1396
  var dataNode = _ref.dataNode,
1394
1397
  className = _ref.className,
1395
1398
  emptyText = _ref.emptyText,
1399
+ noSelection = _ref.noSelection,
1396
1400
  schemaInterface = _ref.schemaInterface,
1397
1401
  style = _ref.style,
1398
1402
  renderer = _ref.renderer,
@@ -1401,13 +1405,13 @@ function DefaultDisplayOnly(_ref) {
1401
1405
  state = _ref.state;
1402
1406
  var display = state.resolved.display;
1403
1407
  var text = display != null ? display : (_ref2 = schemaInterface.isEmptyValue(dataNode.schema.field, dataNode.control.value) ? emptyText : schemaInterface.textValueForData(dataNode)) != null ? _ref2 : "";
1404
- var Div = renderer.html.Div;
1405
- return jsxRuntime.jsx(Div, {
1408
+ return jsxRuntime.jsx(RNDiv, {
1406
1409
  style: style,
1407
1410
  className: className,
1408
1411
  textClass: textClass,
1409
1412
  text: text,
1410
- inline: inline
1413
+ inline: inline,
1414
+ noSelection: noSelection
1411
1415
  });
1412
1416
  } finally {
1413
1417
  _effect();
@@ -2454,7 +2458,7 @@ function createButtonActionRenderer(actionId, options) {
2454
2458
 
2455
2459
  var _excluded = ["inline", "textClass", "children", "notWrapInText", "androidRippleColor", "nonTextContent", "onClick"],
2456
2460
  _excluded2 = ["className", "html", "children", "textClass", "text", "style", "inline", "role"],
2457
- _excluded3 = ["className", "html", "children", "textClass", "text", "style", "inline", "role"],
2461
+ _excluded3 = ["className", "html", "children", "textClass", "text", "style", "inline", "role", "noSelection"],
2458
2462
  _excluded4 = ["id", "type", "onChangeValue", "onChangeChecked", "checked", "value"];
2459
2463
  function createDefaultDataRenderer(options) {
2460
2464
  var _options$checkboxOpti, _options$checkboxOpti2, _options$radioOptions, _options$checkListOpt;
@@ -2513,7 +2517,8 @@ function createDefaultDataRenderer(options) {
2513
2517
  style: props.style,
2514
2518
  inline: props.inline,
2515
2519
  renderer: renderers,
2516
- emptyText: schemas.isDisplayOnlyRenderer(renderOptions) && renderOptions.emptyText ? renderOptions.emptyText : defaultEmptyText
2520
+ emptyText: schemas.isDisplayOnlyRenderer(renderOptions) && renderOptions.emptyText ? renderOptions.emptyText : defaultEmptyText,
2521
+ noSelection: schemas.isDisplayOnlyRenderer(renderOptions) ? renderOptions.noSelection : undefined
2517
2522
  })
2518
2523
  });
2519
2524
  };
@@ -2802,6 +2807,7 @@ function RNDiv(_ref8) {
2802
2807
  style = _ref8.style,
2803
2808
  inline = _ref8.inline,
2804
2809
  role = _ref8.role,
2810
+ noSelection = _ref8.noSelection,
2805
2811
  props = _objectWithoutPropertiesLoose(_ref8, _excluded3);
2806
2812
  if (html != null) {
2807
2813
  return jsxRuntime.jsx(RNHtmlRenderer, _extends({}, props, {
@@ -2812,6 +2818,7 @@ function RNDiv(_ref8) {
2812
2818
  return jsxRuntime.jsx(reactNative.Text, {
2813
2819
  style: style,
2814
2820
  className: textClass,
2821
+ selectable: !noSelection,
2815
2822
  children: text != null ? text : children
2816
2823
  });
2817
2824
  }
@@ -2823,6 +2830,7 @@ function RNDiv(_ref8) {
2823
2830
  }, props, {
2824
2831
  children: jsxRuntime.jsx(reactNative.Text, {
2825
2832
  className: textClass,
2833
+ selectable: !noSelection,
2826
2834
  children: text
2827
2835
  })
2828
2836
  }));
@@ -2935,6 +2943,7 @@ exports.Icon = Icon;
2935
2943
  exports.RNButton = RNButton$1;
2936
2944
  exports.RNCheckbox = RNCheckbox;
2937
2945
  exports.RNDialog = RNDialog;
2946
+ exports.RNDiv = RNDiv;
2938
2947
  exports.RNHtmlRenderer = RNHtmlRenderer;
2939
2948
  exports.RNRadioItem = RNRadioItem;
2940
2949
  exports.RNSelectRenderer = RNSelectRenderer;