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(`
<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%;"
>
<div
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"
>
<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
class="ant-formily-item-label"
@ -84,7 +84,7 @@ describe('CollectionSelect', () => {
class="ant-formily-item-control-content-component"
>
<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"
role="button"
>
@ -96,6 +96,9 @@ describe('CollectionSelect', () => {
</span>
<div
class="ant-select-selector"
>
<span
class="ant-select-selection-wrap"
>
<span
class="ant-select-selection-search"
@ -120,6 +123,7 @@ describe('CollectionSelect', () => {
>
Users
</span>
</span>
</div>
<span
aria-hidden="true"
@ -182,16 +186,16 @@ describe('CollectionSelect', () => {
expect(container).toMatchInlineSnapshot(`
<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%;"
>
<div
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"
>
<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
class="ant-formily-item-label"
@ -222,7 +226,7 @@ describe('CollectionSelect', () => {
>
<div>
<span
class="ant-tag css-dev-only-do-not-override-qu8jc9"
class="ant-tag css-dev-only-do-not-override-1rquknz"
>
Users
</span>

View File

@ -34,9 +34,12 @@ export const BlockTemplatePage = () => {
<div>
<div
style={{
margin: -token.margin,
marginTop: -token.marginXL,
padding: token.paddingSM,
marginTop: -token.marginXXL,
marginLeft: -token.marginLG,
marginRight: -token.marginLG,
padding: token.paddingLG,
paddingTop: token.paddingMD,
paddingBottom: token.paddingMD,
background: token.colorBgContainer,
display: 'flex',
alignItems: 'center',
@ -54,7 +57,13 @@ export const BlockTemplatePage = () => {
]}
/>
</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}>
<RemoteSchemaComponent uid={schemaUid} />
</BlockTemplateInfoContext.Provider>

View File

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

View File

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