mirror of
https://gitee.com/nocobase/nocobase.git
synced 2025-07-02 03:02:19 +08:00
fix: issue where right-fixed column does not align to the right when there are fewer columns (#5690)
This commit is contained in:
parent
64da031cef
commit
ff36b35352
@ -195,26 +195,26 @@ export const tableBlockSettings = new SchemaSettings({
|
|||||||
const fieldSchema = useFieldSchema();
|
const fieldSchema = useFieldSchema();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { dn } = useDesignable();
|
const { dn } = useDesignable();
|
||||||
|
const schema = fieldSchema.reduceProperties((_, s) => {
|
||||||
|
if (s['x-component'] === 'TableV2') {
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
}, null);
|
||||||
return {
|
return {
|
||||||
title: t('Table size'),
|
title: t('Table size'),
|
||||||
value: field.componentProps?.size || 'middle',
|
value: schema?.['x-component-props']?.size || 'middle',
|
||||||
options: [
|
options: [
|
||||||
{ label: t('Large'), value: 'large' },
|
{ label: t('Large'), value: 'large' },
|
||||||
{ label: t('Middle'), value: 'middle' },
|
{ label: t('Middle'), value: 'middle' },
|
||||||
{ label: t('Small'), value: 'small' },
|
{ label: t('Small'), value: 'small' },
|
||||||
],
|
],
|
||||||
onChange: (size) => {
|
onChange: (size) => {
|
||||||
const schema = fieldSchema.reduceProperties((_, s) => {
|
|
||||||
if (s['x-component'] === 'TableV2') {
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
}, null);
|
|
||||||
schema['x-component-props'] = schema['x-component-props'] || {};
|
schema['x-component-props'] = schema['x-component-props'] || {};
|
||||||
schema['x-component-props']['size'] = size;
|
schema['x-component-props']['size'] = size;
|
||||||
dn.emit('patch', {
|
dn.emit('patch', {
|
||||||
schema: {
|
schema: {
|
||||||
['x-uid']: schema['x-uid'],
|
['x-uid']: schema['x-uid'],
|
||||||
'x-decorator-props': schema['x-component-props'],
|
'x-component-props': schema['x-component-props'],
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -178,7 +178,7 @@ const useTableColumns = (props: { showDel?: any; isSubTable?: boolean }, paginat
|
|||||||
return columns;
|
return columns;
|
||||||
}
|
}
|
||||||
const res = [
|
const res = [
|
||||||
...adjustColumnOrder(columns),
|
...columns,
|
||||||
{
|
{
|
||||||
title: render(),
|
title: render(),
|
||||||
dataIndex: 'TABLE_COLUMN_INITIALIZER',
|
dataIndex: 'TABLE_COLUMN_INITIALIZER',
|
||||||
@ -186,7 +186,7 @@ const useTableColumns = (props: { showDel?: any; isSubTable?: boolean }, paginat
|
|||||||
render: designable
|
render: designable
|
||||||
? () => <div style={{ width: '100%', minWidth: '180px' }} className="nb-column-initializer" />
|
? () => <div style={{ width: '100%', minWidth: '180px' }} className="nb-column-initializer" />
|
||||||
: null,
|
: null,
|
||||||
fixed: 'right',
|
fixed: designable ? 'right' : 'none',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
@ -224,7 +224,7 @@ const useTableColumns = (props: { showDel?: any; isSubTable?: boolean }, paginat
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return adjustColumnOrder(res);
|
||||||
}, [columns, exists, field, render, props.showDel, designable]);
|
}, [columns, exists, field, render, props.showDel, designable]);
|
||||||
|
|
||||||
return tableColumns;
|
return tableColumns;
|
||||||
@ -588,7 +588,6 @@ const InternalNocoBaseTable = React.memo(
|
|||||||
field,
|
field,
|
||||||
...others
|
...others
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
className={cx(
|
className={cx(
|
||||||
@ -609,6 +608,12 @@ const InternalNocoBaseTable = React.memo(
|
|||||||
.ant-table-body {
|
.ant-table-body {
|
||||||
min-height: ${tableHeight}px;
|
min-height: ${tableHeight}px;
|
||||||
}
|
}
|
||||||
|
.ant-table-small .ant-table-cell {
|
||||||
|
padding: 8px 16px;
|
||||||
|
}
|
||||||
|
.ant-table-middle .ant-table-cell {
|
||||||
|
padding: 12px 16px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user