Skip to content

Commit

Permalink
fix:修复文档中action API的描述错误,并修复action造成的drawer list 表格文字显示与操作栏没对齐的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
昔梦 committed Sep 27, 2024
1 parent 6528ee5 commit 17ff989
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions docs/form-render/api-schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,10 @@ rules: [


### action
- 描述:输入控件支持配置自定义功能槽,显示在输入控件右边,通过 actions 值和 widgets 字段间映射,渲染自定义自定义功能槽。
- 描述:输入控件支持配置自定义功能槽,显示在输入控件右边,通过 action 值和 widgets 字段间映射,渲染自定义自定义功能槽。
- 类型
```js
actions: 'toolWidget' | { widget: 'toolWidget' } // toolWidget 通过 widgets 透传
action: 'toolWidget' | { widget: 'toolWidget' } // toolWidget 通过 widgets 透传
```

## 三、嵌套控件配置项
Expand Down
26 changes: 13 additions & 13 deletions packages/form-render/src/render-core/FieldItem/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import {
FieldWrapperStatus
} from './field';

import {
getParamValue,
import {
getParamValue,
getFieldProps,
getPath,
getLabel,
Expand All @@ -39,7 +39,7 @@ export default (props: any) => {
const upperCtx: any = useContext(UpperContext);

const { form, widgets, methods, globalProps } = configCtx;
const {
const {
reserveLabel,
hidden,
properties,
Expand All @@ -52,7 +52,7 @@ export default (props: any) => {
} = schema;

const getValueFromKey = getParamValue(formCtx, upperCtx, schema);

const widgetName = getWidgetName(schema);
let Widget = getWidget(widgetName, widgets);

Expand Down Expand Up @@ -82,7 +82,7 @@ export default (props: any) => {
}

if (schema.type === 'void') {
return (
return (
<Col span={24}>
<Widget {...fieldProps } />
</Col>
Expand Down Expand Up @@ -180,7 +180,7 @@ export default (props: any) => {
label = null;
if (displayType === 'row') {
label = 'fr-hide-label';
}
}
}

const initialValue = schema.default ?? schema.defaultValue;
Expand All @@ -205,20 +205,20 @@ export default (props: any) => {
validateTrigger={ validateTrigger ?? (fieldRef?.current?.validator ? 'onSubmit' : 'onChange') }
>
{fieldProps.onStatusChange ? (
<FieldWrapperStatus
<FieldWrapperStatus
Field={Widget}
fieldProps={fieldProps}
maxWidth={maxWidth}
initialValue={initialValue}
acitonRender={() => action}
acitonRender={action ? () => action : undefined}
/>
) : (
<FieldWrapper
Field={Widget}
fieldProps={fieldProps}
maxWidth={maxWidth}
initialValue={initialValue}
acitonRender={() => action}
acitonRender={action ? () => action : undefined}
/>
)}
</Form.Item>
Expand All @@ -227,7 +227,7 @@ export default (props: any) => {
if (inlineSelf) {
if (noStyle) {
return (
<div
<div
className={classnames('fr-inline-field', { 'fr-field-visibility': !visible, [schema.className] : !! schema.className })}
>
{formItem}
Expand All @@ -238,11 +238,11 @@ export default (props: any) => {
}

return (
<Col
span={span}
<Col
span={span}
className={classnames(null, { 'fr-field-visibility': !visible })}
>
{formItem}
</Col>
);
}
}

0 comments on commit 17ff989

Please sign in to comment.