refactor: formula field should not trigger form value change (#3518)
* refactor: formula field should not trigger form value change * style: list block style improve
This commit is contained in:
parent
85af594004
commit
f2dc49c7c0
@ -60,22 +60,14 @@ export const ActionModal: ComposedActionDrawer<ModalProps> = observer(
|
|||||||
)}
|
)}
|
||||||
footer={
|
footer={
|
||||||
footerSchema ? (
|
footerSchema ? (
|
||||||
<div
|
<RecursionField
|
||||||
className={css`
|
basePath={field.address}
|
||||||
display: flex;
|
schema={schema}
|
||||||
justify-content: flex-end;
|
onlyRenderProperties
|
||||||
width: 100%;
|
filterProperties={(s) => {
|
||||||
`}
|
return s['x-component'] === footerNodeName;
|
||||||
>
|
}}
|
||||||
<RecursionField
|
/>
|
||||||
basePath={field.address}
|
|
||||||
schema={schema}
|
|
||||||
onlyRenderProperties
|
|
||||||
filterProperties={(s) => {
|
|
||||||
return s['x-component'] === footerNodeName;
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
) : (
|
) : (
|
||||||
false
|
false
|
||||||
)
|
)
|
||||||
|
@ -40,7 +40,7 @@ const InternalListBlockProvider = (props) => {
|
|||||||
line-height: 34px;
|
line-height: 34px;
|
||||||
}
|
}
|
||||||
.ant-formily-item-feedback-layout-loose {
|
.ant-formily-item-feedback-layout-loose {
|
||||||
margin-bottom: 0;
|
margin-bottom: 12px;
|
||||||
}
|
}
|
||||||
`)}
|
`)}
|
||||||
>
|
>
|
||||||
|
@ -2,13 +2,26 @@ import React from 'react';
|
|||||||
import { ObjectField } from '@formily/core';
|
import { ObjectField } from '@formily/core';
|
||||||
import { useField } from '@formily/react';
|
import { useField } from '@formily/react';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
|
import { css, cx } from '@emotion/css';
|
||||||
|
import { useDesignable } from '../../hooks';
|
||||||
|
|
||||||
import { RecordProvider } from '../../../record-provider';
|
import { RecordProvider } from '../../../record-provider';
|
||||||
|
|
||||||
export const ListItem = (props) => {
|
export const ListItem = (props) => {
|
||||||
const field = useField<ObjectField>();
|
const field = useField<ObjectField>();
|
||||||
|
const { designable } = useDesignable();
|
||||||
return (
|
return (
|
||||||
<div className={classnames('itemCss', props.className)}>
|
<div
|
||||||
|
className={cx(classnames(props.className), [
|
||||||
|
'itemCss',
|
||||||
|
css`
|
||||||
|
.nb-action-bar {
|
||||||
|
gap: 20px !important;
|
||||||
|
margin-top: ${designable ? '20px' : '0px'};
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
])}
|
||||||
|
>
|
||||||
<RecordProvider record={field.value}>{props.children}</RecordProvider>
|
<RecordProvider record={field.value}>{props.children}</RecordProvider>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -2,12 +2,11 @@ import { genStyleHook } from '../__builtins__';
|
|||||||
|
|
||||||
const useStyles = genStyleHook('nb-list', (token) => {
|
const useStyles = genStyleHook('nb-list', (token) => {
|
||||||
const { componentCls } = token;
|
const { componentCls } = token;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
[componentCls]: {
|
[componentCls]: {
|
||||||
width: '100%',
|
width: '100%',
|
||||||
marginBottom: token.marginLG,
|
marginBottom: 0,
|
||||||
'.nb-action-bar:not(:empty)': { marginTop: token.marginXS },
|
// '.nb-action-bar:not(:empty)': { marginTop: token.marginXS },
|
||||||
'&:hover': { '> .general-schema-designer': { display: 'block' } },
|
'&:hover': { '> .general-schema-designer': { display: 'block' } },
|
||||||
'> .general-schema-designer': {
|
'> .general-schema-designer': {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
@ -35,12 +34,10 @@ const useStyles = genStyleHook('nb-list', (token) => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
'.itemCss': {
|
'.itemCss': {
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
flexDirection: 'column',
|
flexDirection: 'column',
|
||||||
|
|
||||||
'&:not(:first-child)': {
|
'&:not(:first-child)': {
|
||||||
paddingTop: token.paddingContentVertical,
|
paddingTop: token.paddingContentVertical,
|
||||||
},
|
},
|
||||||
|
@ -88,7 +88,7 @@ export function Result(props) {
|
|||||||
setEditingValue(v);
|
setEditingValue(v);
|
||||||
}
|
}
|
||||||
setEditingValue(v);
|
setEditingValue(v);
|
||||||
others?.onChange?.(v);
|
form.setValuesIn(fieldName, v);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
const Component = TypedComponents[dataType] ?? InputString;
|
const Component = TypedComponents[dataType] ?? InputString;
|
||||||
|
Loading…
Reference in New Issue
Block a user