fix(FilterBlocks): allow adding filter blocks in popup even without a… (#5502)

* fix(FilterBlocks): allow adding filter blocks in popup even without association fields

* chore: make e2e more stable
This commit is contained in:
Zeke Zhang 2024-10-24 11:46:17 +08:00 committed by GitHub
parent f148536491
commit 4fcf7e3815
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 12 deletions

View File

@ -32,7 +32,12 @@ test.describe('Input.Preview', () => {
// 4. 切换图片大小到 Large大小切换正常 // 4. 切换图片大小到 Large大小切换正常
await page.getByLabel('block-item-CollectionField-').hover(); await page.getByLabel('block-item-CollectionField-').hover();
await page.getByLabel('designer-schema-settings-CollectionField-fieldSettings:FormItem-general-general').hover(); await page.getByLabel('designer-schema-settings-CollectionField-fieldSettings:FormItem-general-general').hover();
await page.getByRole('menuitem', { name: 'Size Small' }).click(); await page.getByRole('menuitem', { name: 'Size Small' }).click({
position: {
x: 160,
y: 10,
},
});
await page.getByRole('option', { name: 'Large' }).click(); await page.getByRole('option', { name: 'Large' }).click();
await expect(page.getByLabel('block-item-CollectionField-').getByRole('img').first()).toHaveJSProperty('width', 72); await expect(page.getByLabel('block-item-CollectionField-').getByRole('img').first()).toHaveJSProperty('width', 72);

View File

@ -8,7 +8,7 @@
*/ */
import { Schema } from '@formily/react'; import { Schema } from '@formily/react';
import { useCallback, useMemo } from 'react'; import { useCallback } from 'react';
import { import {
useActionAvailable, useActionAvailable,
useCollection, useCollection,
@ -283,16 +283,6 @@ const commonOptions = {
name: 'filterBlocks', name: 'filterBlocks',
title: '{{t("Filter blocks")}}', title: '{{t("Filter blocks")}}',
type: 'itemGroup', type: 'itemGroup',
useVisible() {
const collection = useCollection();
return useMemo(
() =>
collection.fields.some(
(field) => canMakeAssociationBlock(field) && ['hasMany', 'belongsToMany'].includes(field.type),
),
[collection.fields],
);
},
children: [ children: [
{ {
name: 'filterForm', name: 'filterForm',