refactor: adjust default column width to 100 in table (#5625)

* refactor: adjust default column width to 100 in table

* fix: test
This commit is contained in:
Katherine 2024-11-12 15:20:50 +08:00 committed by GitHub
parent 6badfd8983
commit dafc3a16a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 8 additions and 8 deletions

View File

@ -87,8 +87,8 @@ test.describe('configure actions column', () => {
expect(Math.floor(box.width)).toBe(width);
};
// 列宽度默认为 200
await expectActionsColumnWidth(200);
// 列宽度默认为 100
await expectActionsColumnWidth(100);
await page.getByText('Actions', { exact: true }).hover();
await page.getByLabel('designer-schema-settings-TableV2.Column-fieldSettings:TableColumn-users').hover();

View File

@ -51,7 +51,7 @@ export const Resizable = () => {
'x-decorator': 'FormItem',
'x-component': 'InputNumber',
'x-component-props': {},
default: fieldSchema?.['x-component-props']?.width || 200,
default: fieldSchema?.['x-component-props']?.width || 100,
},
},
} as ISchema

View File

@ -321,8 +321,8 @@ test.describe('configure actions column', () => {
test('column width', async ({ page, mockPage }) => {
await mockPage(oneEmptyTable).goto();
// 列宽度默认为 200
await expect(page.getByRole('columnheader', { name: 'Actions', exact: true })).toHaveJSProperty('offsetWidth', 200);
// 列宽度默认为 100
await expect(page.getByRole('columnheader', { name: 'Actions', exact: true })).toHaveJSProperty('offsetWidth', 100);
await page.getByText('Actions', { exact: true }).hover();
await page.getByLabel('designer-schema-settings-TableV2.Column-TableV2.ActionColumnDesigner-').hover();

View File

@ -122,7 +122,7 @@ export const tableColumnSettings = new SchemaSettings({
title: t('Column width'),
properties: {
width: {
default: columnSchema?.['x-component-props']?.['width'] || 200,
default: columnSchema?.['x-component-props']?.['width'] || 100,
'x-decorator': 'FormItem',
'x-component': 'InputNumber',
'x-component-props': {},

View File

@ -172,7 +172,7 @@ export const TableColumnDesigner = (props) => {
title: t('Column width'),
properties: {
width: {
default: columnSchema?.['x-component-props']?.['width'] || 200,
default: columnSchema?.['x-component-props']?.['width'] || 100,
'x-decorator': 'FormItem',
'x-component': 'InputNumber',
'x-component-props': {},

View File

@ -129,7 +129,7 @@ const useTableColumns = (props: { showDel?: any; isSubTable?: boolean }, paginat
sorter: s['x-component-props']?.['sorter'],
columnHidden,
...s['x-component-props'],
width: columnHidden && !designable ? 0 : s['x-component-props']?.width || 200,
width: columnHidden && !designable ? 0 : s['x-component-props']?.width || 100,
render: (v, record) => {
// 这行代码会导致这里的测试不通过packages/core/client/src/modules/blocks/data-blocks/table/__e2e__/schemaInitializer.test.ts:189
// if (collectionFields?.length === 1 && collectionFields[0]['x-read-pretty'] && v == undefined) return null;