@react-typed-forms/schemas-html 4.1.0 → 4.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.
|
@@ -3,12 +3,14 @@ export interface DefaultDialogRenderOptions {
|
|
|
3
3
|
classes?: {
|
|
4
4
|
className?: string;
|
|
5
5
|
titleClass?: string;
|
|
6
|
+
containerClass?: string;
|
|
6
7
|
};
|
|
7
8
|
}
|
|
8
9
|
export declare const defaultDialogOptions: {
|
|
9
10
|
classes: {
|
|
10
11
|
className: string;
|
|
11
12
|
titleClass: string;
|
|
13
|
+
containerClass: string;
|
|
12
14
|
};
|
|
13
15
|
};
|
|
14
16
|
export declare function createDialogRenderer(options?: DefaultDialogRenderOptions): import("@react-typed-forms/schemas").GroupRendererRegistration;
|
|
@@ -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,
|
|
@@ -1018,7 +1019,8 @@ function renderWizard(props, isChildVisible) {
|
|
|
1018
1019
|
var defaultDialogOptions = {
|
|
1019
1020
|
classes: {
|
|
1020
1021
|
className: "",
|
|
1021
|
-
titleClass: "text-2xl font-bold"
|
|
1022
|
+
titleClass: "text-2xl font-bold",
|
|
1023
|
+
containerClass: "relative m-4 p-4 min-w-[400px] max-w-[80%] rounded-lg bg-white shadow-sm"
|
|
1022
1024
|
}
|
|
1023
1025
|
};
|
|
1024
1026
|
function createDialogRenderer(options) {
|
|
@@ -1055,7 +1057,8 @@ function DefaultDialogRenderer(_ref) {
|
|
|
1055
1057
|
var _deepMerge = schemas.deepMerge(options, defaultDialogOptions),
|
|
1056
1058
|
_deepMerge$classes = _deepMerge.classes,
|
|
1057
1059
|
titleClass = _deepMerge$classes.titleClass,
|
|
1058
|
-
className = _deepMerge$classes.className
|
|
1060
|
+
className = _deepMerge$classes.className,
|
|
1061
|
+
containerClass = _deepMerge$classes.containerClass;
|
|
1059
1062
|
var open = core.useControl(false);
|
|
1060
1063
|
var overlayState = ariaBase.createOverlayState(open);
|
|
1061
1064
|
var actionOnClick = function actionOnClick(action) {
|
|
@@ -1093,6 +1096,7 @@ function DefaultDialogRenderer(_ref) {
|
|
|
1093
1096
|
}), props.designMode ? designContent() : open.value && /*#__PURE__*/jsxRuntime.jsx(ariaBase.Modal, {
|
|
1094
1097
|
state: overlayState,
|
|
1095
1098
|
isDismissable: true,
|
|
1099
|
+
containerClass: containerClass,
|
|
1096
1100
|
children: dialogContent
|
|
1097
1101
|
})]
|
|
1098
1102
|
});
|
|
@@ -2055,7 +2059,7 @@ function createButtonActionRenderer(actionId, options) {
|
|
|
2055
2059
|
var iconElement = icon && /*#__PURE__*/jsxRuntime.jsx(I, {
|
|
2056
2060
|
iconName: icon.name,
|
|
2057
2061
|
iconLibrary: icon.library,
|
|
2058
|
-
className: iconPlacement == schemas.IconPlacement.BeforeText ? options.iconBeforeClass : options.iconAfterClass
|
|
2062
|
+
className: schemas.rendererClass(textClass, iconPlacement == schemas.IconPlacement.BeforeText ? options.iconBeforeClass : options.iconAfterClass)
|
|
2059
2063
|
});
|
|
2060
2064
|
var textClassNames = schemas.rendererClass(textClass, isLink ? options.linkTextClass : schemas.rendererClass(options.textClass, actionStyle == schemas.ActionStyle.Secondary ? options.secondaryTextClass : options.primaryTextClass));
|
|
2061
2065
|
var textElement = actionContent != null ? actionContent : actionText && /*#__PURE__*/jsxRuntime.jsx(Span, {
|
|
@@ -2141,6 +2145,7 @@ function createDefaultDataRenderer(options) {
|
|
|
2141
2145
|
className: "@ " + schemas.rendererClass(p.className, displayOnlyClass),
|
|
2142
2146
|
children: /*#__PURE__*/jsxRuntime.jsx(DefaultDisplayOnly, {
|
|
2143
2147
|
dataNode: props.dataNode,
|
|
2148
|
+
state: props.state,
|
|
2144
2149
|
schemaInterface: props.dataContext.schemaInterface,
|
|
2145
2150
|
className: props.className,
|
|
2146
2151
|
textClass: props.textClass,
|
|
@@ -2420,8 +2425,11 @@ function DefaultHtmlIconRenderer(_ref9) {
|
|
|
2420
2425
|
switch (iconLibrary) {
|
|
2421
2426
|
case schemas.IconLibrary.FontAwesome:
|
|
2422
2427
|
return "fa fa-" + iconName;
|
|
2423
|
-
|
|
2428
|
+
case schemas.IconLibrary.Material:
|
|
2429
|
+
case schemas.IconLibrary.CssClass:
|
|
2424
2430
|
return iconName;
|
|
2431
|
+
default:
|
|
2432
|
+
return iconLibrary + " fa-" + iconName;
|
|
2425
2433
|
}
|
|
2426
2434
|
};
|
|
2427
2435
|
var iconName = _ref9.iconName,
|