fix: FixedBlock related ui (#1632)

* fix: the AssociationFilter

* feat: grid dragging area support compact theme
This commit is contained in:
Dunqing 2023-04-02 07:10:05 +08:00 committed by GitHub
parent 4f87de7da5
commit f5171ce6e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 7 deletions

View File

@ -8,6 +8,7 @@ import { SortableItem } from '../../common';
import { useCompile, useDesigner, useProps } from '../../hooks'; import { useCompile, useDesigner, useProps } from '../../hooks';
import { getLabelFormatValue, useLabelUiSchema } from '../record-picker'; import { getLabelFormatValue, useLabelUiSchema } from '../record-picker';
import { AssociationFilter } from './AssociationFilter'; import { AssociationFilter } from './AssociationFilter';
import { EllipsisWithTooltip } from '../input';
const { Panel } = Collapse; const { Panel } = Collapse;
@ -218,13 +219,22 @@ export const AssociationFilterItem = (props) => {
<Tree <Tree
style={{ padding: '16px 0' }} style={{ padding: '16px 0' }}
onExpand={onExpand} onExpand={onExpand}
rootClassName={css`
.ant-tree-node-content-wrapper {
overflow-x: hidden;
}
`}
expandedKeys={expandedKeys} expandedKeys={expandedKeys}
autoExpandParent={autoExpandParent} autoExpandParent={autoExpandParent}
treeData={list} treeData={list}
onSelect={onSelect} onSelect={onSelect}
fieldNames={fieldNames} fieldNames={fieldNames}
titleRender={(node) => { titleRender={(node) => {
return getLabelFormatValue(labelUiSchema, compile(node[labelKey])); return (
<EllipsisWithTooltip ellipsis>
{getLabelFormatValue(labelUiSchema, compile(node[labelKey]))}
</EllipsisWithTooltip>
);
}} }}
selectedKeys={selectedKeys} selectedKeys={selectedKeys}
blockNode blockNode

View File

@ -26,6 +26,8 @@ export const AssociationFilter = (props) => {
'nb-block-item', 'nb-block-item',
props.className, props.className,
css` css`
height: 100%;
overflow-y: auto;
position: relative; position: relative;
&:hover { &:hover {
> .general-schema-designer { > .general-schema-designer {

View File

@ -126,7 +126,7 @@ const ColDivider = (props) => {
className={cls( className={cls(
'nb-col-divider', 'nb-col-divider',
css` css`
width: 24px; width: var(--nb-spacing);
`, `,
)} )}
style={{ ...droppableStyle }} style={{ ...droppableStyle }}
@ -152,7 +152,7 @@ const ColDivider = (props) => {
background: rgba(241, 139, 98, 0.06) !important; background: rgba(241, 139, 98, 0.06) !important;
} }
} }
width: 24px; width: var(--nb-spacing);
height: 100%; height: 100%;
position: absolute; position: absolute;
cursor: col-resize; cursor: col-resize;
@ -219,10 +219,10 @@ const RowDivider = (props) => {
className={cls( className={cls(
'nb-row-divider', 'nb-row-divider',
css` css`
height: 24px; height: var(--nb-spacing);
width: 100%; width: 100%;
position: absolute; position: absolute;
margin-top: -24px; margin-top: calc(-1 * var(--nb-spacing));
`, `,
)} )}
style={{ style={{
@ -370,7 +370,7 @@ Grid.Row = observer(() => {
className={cls( className={cls(
'nb-grid-row', 'nb-grid-row',
css` css`
margin: 0 -24px; margin: 0 calc(-1 * var(--nb-spacing));
display: flex; display: flex;
position: relative; position: relative;
/* z-index: 0; */ /* z-index: 0; */
@ -419,7 +419,7 @@ Grid.Col = observer((props: any) => {
let width = ''; let width = '';
if (cols?.length) { if (cols?.length) {
const w = schema?.['x-component-props']?.['width'] || 100 / cols.length; const w = schema?.['x-component-props']?.['width'] || 100 / cols.length;
width = `calc(${w}% - 24px - 24px / ${cols.length})`; width = `calc(${w}% - var(--nb-spacing) * 2 / ${cols.length})`;
} }
const { setNodeRef } = useDroppable({ const { setNodeRef } = useDroppable({
id: field.address.toString(), id: field.address.toString(),

View File

@ -16,7 +16,11 @@
font-size: inherit !important; font-size: inherit !important;
} }
:root {
--nb-spacing: 24px;
}
.theme-compact { .theme-compact {
--nb-spacing: 16px;
.ant-formily-item { .ant-formily-item {
margin-bottom: 16px; margin-bottom: 16px;
} }