From 497ddefcc87b048a53edc28f849d006da1f187b8 Mon Sep 17 00:00:00 2001
From: lhbxs <596850703@qq.com>
Date: Thu, 2 Nov 2023 11:37:37 +0800
Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=E4=BF=AE=E5=A4=8D=20switch=20defau?=
=?UTF-8?q?ltValue=20=E9=85=8D=E7=BD=AE=E6=97=A0=E6=95=88?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
packages/form-render/src/render-core/FieldItem/main.tsx | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/packages/form-render/src/render-core/FieldItem/main.tsx b/packages/form-render/src/render-core/FieldItem/main.tsx
index 66784e409..38993fc24 100644
--- a/packages/form-render/src/render-core/FieldItem/main.tsx
+++ b/packages/form-render/src/render-core/FieldItem/main.tsx
@@ -11,7 +11,9 @@ import getRuleList from '../../models/validates';
const UpperContext: any = createContext(() => {});
const valuePropNameMap = {
checkbox: 'checked',
- switch: 'checked'
+ switch: 'checked',
+ Checkbox: 'checked',
+ Switch: 'checked'
};
import {
@@ -142,7 +144,7 @@ export default (props: any) => {
const maxWidth = getValueFromKey('maxWidth');
const { labelCol, fieldCol } = getFormItemLayout(Math.floor(24 / span * 1), schema, { displayType, labelWidth, _labelCol, _fieldCol });
const valuePropName = schema.valuePropName || valuePropNameMap[widgetName] || undefined;
-
+ debugger;
if (readOnly) {
fieldProps.readOnly = readOnly;
}
@@ -170,8 +172,10 @@ export default (props: any) => {
}
const initialValue = schema.default ?? schema.defaultValue;
+ debugger;
const classRest = { 'fr-hide-label': label === 'fr-hide-label', 'fr-inline-field': inlineSelf, 'fr-field-visibility': !visible, [schema.className] : !! schema.className };
+
const formItem = (
Date: Thu, 2 Nov 2023 11:44:23 +0800
Subject: [PATCH 2/2] =?UTF-8?q?feat:=20labelWidget=E3=80=81descWidget=20?=
=?UTF-8?q?=E5=A2=9E=E5=8A=A0=20addons=20=E5=AF=B9=E8=B1=A1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
packages/form-render/src/render-core/FieldItem/main.tsx | 6 ++----
packages/form-render/src/render-core/FieldItem/module.tsx | 6 +++---
2 files changed, 5 insertions(+), 7 deletions(-)
diff --git a/packages/form-render/src/render-core/FieldItem/main.tsx b/packages/form-render/src/render-core/FieldItem/main.tsx
index 38993fc24..8a577b466 100644
--- a/packages/form-render/src/render-core/FieldItem/main.tsx
+++ b/packages/form-render/src/render-core/FieldItem/main.tsx
@@ -126,7 +126,7 @@ export default (props: any) => {
}
// Render field components
- let label = getLabel(schema, displayType, widgets);
+ let label = getLabel(schema, displayType, widgets, fieldProps.addons);
let noStyle = getValueFromKey('noStyle');
const span = getColSpan(formCtx, upperCtx, schema);
@@ -144,7 +144,7 @@ export default (props: any) => {
const maxWidth = getValueFromKey('maxWidth');
const { labelCol, fieldCol } = getFormItemLayout(Math.floor(24 / span * 1), schema, { displayType, labelWidth, _labelCol, _fieldCol });
const valuePropName = schema.valuePropName || valuePropNameMap[widgetName] || undefined;
- debugger;
+
if (readOnly) {
fieldProps.readOnly = readOnly;
}
@@ -172,10 +172,8 @@ export default (props: any) => {
}
const initialValue = schema.default ?? schema.defaultValue;
- debugger;
const classRest = { 'fr-hide-label': label === 'fr-hide-label', 'fr-inline-field': inlineSelf, 'fr-field-visibility': !visible, [schema.className] : !! schema.className };
-
const formItem = (
{
return path;
};
-export const getLabel = (schema: any, displayType: string, widgets: any) => {
+export const getLabel = (schema: any, displayType: string, widgets: any, addons: any) => {
const { title, description, descWidget, labelWidget } = schema;
const LabelNode = widgets[labelWidget];
if (LabelNode) {
- return
+ return
}
if ((!description && !descWidget)) {
@@ -113,7 +113,7 @@ export const getLabel = (schema: any, displayType: string, widgets: any) => {
const RenderDesc = () => {
const Widget = widgets[descWidget];
if (Widget) {
- return ;
+ return ;
}
if (description) {