fix: 修改汇总区块兼容视图没有字段的情况 (#923)

Reviewed-on: daoyoucloud/tachybase#923
Co-authored-by: wjh <wwwjh0710@163.com>
Co-committed-by: wjh <wwwjh0710@163.com>
This commit is contained in:
wjh 2024-05-08 17:50:26 +08:00 committed by sealday
parent 3e58c54aa8
commit ffc9236728
2 changed files with 14 additions and 3 deletions

View File

@ -126,6 +126,13 @@ const createGroupBlockSchema = (options) => {
}, },
}, },
}; };
if (!sumItem.length) {
delete schema['x-decorator-props']['resource_deprecated'];
}
if (collection.template === 'view' && !sumItem.length) {
delete schema['x-decorator-props']['action'];
delete schema['x-decorator-props']['groupField'];
}
return schema; return schema;
}; };

View File

@ -104,7 +104,7 @@ const modalSchema = (t, params, valueOption, decimal) => {
placeholder: '{{t("type")}}', placeholder: '{{t("type")}}',
}, },
enum: fieldType, enum: fieldType,
require: true, required: true,
}, },
field: { field: {
type: 'string', type: 'string',
@ -114,11 +114,13 @@ const modalSchema = (t, params, valueOption, decimal) => {
placeholder: '{{t("field")}}', placeholder: '{{t("field")}}',
}, },
'x-visbile': false, 'x-visbile': false,
required: false,
enum: valueOption, enum: valueOption,
'x-reactions': { 'x-reactions': {
dependencies: ['.type'], dependencies: ['.type'],
fulfill: { fulfill: {
schema: { schema: {
required: "{{$deps[0]==='field'}}",
'x-visible': "{{$deps[0]==='field'}}", 'x-visible': "{{$deps[0]==='field'}}",
}, },
}, },
@ -132,11 +134,13 @@ const modalSchema = (t, params, valueOption, decimal) => {
placeholder: '{{t("reqUrl")}}', placeholder: '{{t("reqUrl")}}',
addonBefore: <PullRequestOutlined />, addonBefore: <PullRequestOutlined />,
}, },
required: false,
'x-visible': false, 'x-visible': false,
'x-reactions': { 'x-reactions': {
dependencies: ['.type'], dependencies: ['.type'],
fulfill: { fulfill: {
schema: { schema: {
required: "{{$deps[0]==='custom'}}",
'x-visible': "{{$deps[0]==='custom'}}", 'x-visible': "{{$deps[0]==='custom'}}",
}, },
}, },
@ -150,7 +154,7 @@ const modalSchema = (t, params, valueOption, decimal) => {
placeholder: '{{t("format")}}', placeholder: '{{t("format")}}',
}, },
enum: transformers.option, enum: transformers.option,
require: true, required: true,
}, },
digits: { digits: {
type: 'string', type: 'string',
@ -178,7 +182,7 @@ const modalSchema = (t, params, valueOption, decimal) => {
placeholder: '{{t("style")}}', placeholder: '{{t("style")}}',
}, },
enum: styleOption, enum: styleOption,
require: true, required: true,
}, },
remove: { remove: {
type: 'void', type: 'void',