Merge branch 'next' into develop

This commit is contained in:
nocobase[bot] 2025-04-07 09:50:21 +00:00
commit 1d698dc9dc
4 changed files with 51 additions and 38 deletions

View File

@ -45,16 +45,16 @@ describe('CollectionSelect', () => {
expect(container).toMatchInlineSnapshot(` expect(container).toMatchInlineSnapshot(`
<div> <div>
<div <div
class="css-dev-only-do-not-override-qu8jc9 ant-app" class="css-dev-only-do-not-override-1rquknz ant-app"
style="height: 100%;" style="height: 100%;"
> >
<div <div
aria-label="block-item-demo title" aria-label="block-item-demo title"
class="nb-block-item nb-form-item css-9qorhu ant-nb-block-item css-dev-only-do-not-override-qu8jc9" class="nb-block-item nb-form-item css-9qorhu ant-nb-block-item css-dev-only-do-not-override-1rquknz"
role="button" role="button"
> >
<div <div
class="css-vij405 ant-formily-item ant-formily-item-layout-horizontal ant-formily-item-feedback-layout-loose ant-formily-item-label-align-right ant-formily-item-control-align-left css-dev-only-do-not-override-qu8jc9" class="css-9mlexe ant-formily-item ant-formily-item-layout-horizontal ant-formily-item-feedback-layout-loose ant-formily-item-label-align-right ant-formily-item-control-align-left css-dev-only-do-not-override-1rquknz"
> >
<div <div
class="ant-formily-item-label" class="ant-formily-item-label"
@ -84,7 +84,7 @@ describe('CollectionSelect', () => {
class="ant-formily-item-control-content-component" class="ant-formily-item-control-content-component"
> >
<div <div
class="ant-select css-dev-only-do-not-override-qu8jc9 ant-select-focused ant-select-single ant-select-show-arrow ant-select-show-search" class="ant-select ant-select-outlined css-dev-only-do-not-override-1rquknz ant-select-focused ant-select-single ant-select-show-arrow ant-select-show-search"
data-testid="select-collection" data-testid="select-collection"
role="button" role="button"
> >
@ -98,27 +98,31 @@ describe('CollectionSelect', () => {
class="ant-select-selector" class="ant-select-selector"
> >
<span <span
class="ant-select-selection-search" class="ant-select-selection-wrap"
> >
<input <span
aria-autocomplete="list" class="ant-select-selection-search"
aria-controls="rc_select_TEST_OR_SSR_list" >
aria-expanded="false" <input
aria-haspopup="listbox" aria-autocomplete="list"
aria-owns="rc_select_TEST_OR_SSR_list" aria-controls="rc_select_TEST_OR_SSR_list"
autocomplete="off" aria-expanded="false"
class="ant-select-selection-search-input" aria-haspopup="listbox"
id="rc_select_TEST_OR_SSR" aria-owns="rc_select_TEST_OR_SSR_list"
role="button" autocomplete="off"
type="search" class="ant-select-selection-search-input"
value="" id="rc_select_TEST_OR_SSR"
/> role="button"
</span> type="search"
<span value=""
class="ant-select-selection-item" />
title="Users" </span>
> <span
Users class="ant-select-selection-item"
title="Users"
>
Users
</span>
</span> </span>
</div> </div>
<span <span
@ -182,16 +186,16 @@ describe('CollectionSelect', () => {
expect(container).toMatchInlineSnapshot(` expect(container).toMatchInlineSnapshot(`
<div> <div>
<div <div
class="css-dev-only-do-not-override-qu8jc9 ant-app" class="css-dev-only-do-not-override-1rquknz ant-app"
style="height: 100%;" style="height: 100%;"
> >
<div <div
aria-label="block-item-demo title" aria-label="block-item-demo title"
class="nb-block-item nb-form-item css-9qorhu ant-nb-block-item css-dev-only-do-not-override-qu8jc9" class="nb-block-item nb-form-item css-9qorhu ant-nb-block-item css-dev-only-do-not-override-1rquknz"
role="button" role="button"
> >
<div <div
class="css-vij405 ant-formily-item ant-formily-item-layout-horizontal ant-formily-item-feedback-layout-loose ant-formily-item-label-align-right ant-formily-item-control-align-left css-dev-only-do-not-override-qu8jc9" class="css-9mlexe ant-formily-item ant-formily-item-layout-horizontal ant-formily-item-feedback-layout-loose ant-formily-item-label-align-right ant-formily-item-control-align-left css-dev-only-do-not-override-1rquknz"
> >
<div <div
class="ant-formily-item-label" class="ant-formily-item-label"
@ -222,7 +226,7 @@ describe('CollectionSelect', () => {
> >
<div> <div>
<span <span
class="ant-tag css-dev-only-do-not-override-qu8jc9" class="ant-tag css-dev-only-do-not-override-1rquknz"
> >
Users Users
</span> </span>

View File

@ -34,9 +34,12 @@ export const BlockTemplatePage = () => {
<div> <div>
<div <div
style={{ style={{
margin: -token.margin, marginTop: -token.marginXXL,
marginTop: -token.marginXL, marginLeft: -token.marginLG,
padding: token.paddingSM, marginRight: -token.marginLG,
padding: token.paddingLG,
paddingTop: token.paddingMD,
paddingBottom: token.paddingMD,
background: token.colorBgContainer, background: token.colorBgContainer,
display: 'flex', display: 'flex',
alignItems: 'center', alignItems: 'center',
@ -54,7 +57,13 @@ export const BlockTemplatePage = () => {
]} ]}
/> />
</div> </div>
<div style={{ marginTop: token.marginXL, position: 'relative', zIndex: 0 /** create a new z-index context */ }}> <div
style={{
marginTop: token.marginMD,
position: 'relative',
zIndex: 0 /** create a new z-index context */,
}}
>
<BlockTemplateInfoContext.Provider value={data?.data}> <BlockTemplateInfoContext.Provider value={data?.data}>
<RemoteSchemaComponent uid={schemaUid} /> <RemoteSchemaComponent uid={schemaUid} />
</BlockTemplateInfoContext.Provider> </BlockTemplateInfoContext.Provider>

View File

@ -180,14 +180,14 @@ function shouldDeleteNoComponentSchema(schema: ISchema) {
return true; return true;
} }
const properties = schema?.properties; const properties = schema?.properties;
return properties && Object.values(properties).some((s) => s['x-component'] === undefined); return properties && Object.values(properties).some((s) => s['x-component'] == null);
} }
function cleanSchema(schema?: any) { function cleanSchema(schema?: any) {
const properties = schema?.properties || {}; const properties = schema?.properties || {};
for (const key of Object.keys(properties)) { for (const key of Object.keys(properties)) {
// 如果x-component是undefined // 如果x-component是undefined/null
if (schema.properties[key]['x-component'] === undefined && shouldDeleteNoComponentSchema(schema.properties[key])) { if (schema.properties[key]['x-component'] == null && shouldDeleteNoComponentSchema(schema.properties[key])) {
delete schema.properties[key]; delete schema.properties[key];
} }
// 如果x-component是Grid.Row且内部无任何内容则删除 // 如果x-component是Grid.Row且内部无任何内容则删除
@ -337,7 +337,7 @@ export function getFullSchema(
for (const key in schema.properties) { for (const key in schema.properties) {
const property = schema.properties[key]; const property = schema.properties[key];
schema.properties[key] = getFullSchema(property, templateschemacache, templateInfos, savedSchemaUids); schema.properties[key] = getFullSchema(property, templateschemacache, templateInfos, savedSchemaUids);
if (schema.properties[key]['x-component'] === undefined) { if (schema.properties[key]['x-component'] == null) {
delete schema.properties[key]; // 说明已经从模板中删除了 delete schema.properties[key]; // 说明已经从模板中删除了
} }
} }

View File

@ -376,7 +376,7 @@ function shouldDeleteNoComponentSchema(schema: Schema) {
return true; return true;
} }
const properties = schema?.properties; const properties = schema?.properties;
return properties && Object.values(properties).some((s) => s['x-component'] === undefined); return properties && Object.values(properties).some((s) => s['x-component'] == null);
} }
export function cleanSchema(schema?: Schema, templateId?: string) { export function cleanSchema(schema?: Schema, templateId?: string) {
@ -390,7 +390,7 @@ export function cleanSchema(schema?: Schema, templateId?: string) {
} }
for (const key of Object.keys(properties)) { for (const key of Object.keys(properties)) {
if ( if (
schema.properties[key]['x-component'] === undefined && schema.properties[key]['x-component'] == null &&
!schema.properties[key]['x-template-root-uid'] && !schema.properties[key]['x-template-root-uid'] &&
shouldDeleteNoComponentSchema(schema.properties[key]) shouldDeleteNoComponentSchema(schema.properties[key])
) { ) {