fix: field required when setting sorting rules (#1885)

This commit is contained in:
katherinehhh 2023-05-18 22:23:47 +08:00 committed by GitHub
parent 2060bd4d44
commit 27cdd7b78a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 9 additions and 2 deletions

View File

@ -161,7 +161,7 @@ FormItem.Designer = function Designer() {
const fieldMode = field?.componentProps?.['mode'] || (isFileField ? 'FileManager' : 'Select');
const isSelectFieldMode = fieldMode === 'Select';
const sort = defaultSort?.map((item: string) => {
return item.startsWith('-')
return item?.startsWith('-')
? {
field: item.substring(1),
direction: 'desc',
@ -494,6 +494,7 @@ FormItem.Designer = function Designer() {
field: {
type: 'string',
enum: sortFields,
required: true,
'x-decorator': 'FormItem',
'x-component': 'Select',
'x-component-props': {

View File

@ -158,6 +158,7 @@ export const DetailsDesigner = () => {
field: {
type: 'string',
enum: sortFields,
required: true,
'x-decorator': 'FormItem',
'x-component': 'Select',
'x-component-props': {

View File

@ -155,6 +155,7 @@ export const GridCardDesigner = () => {
field: {
type: 'string',
enum: sortFields,
required:true,
'x-decorator': 'FormItem',
'x-component': 'Select',
'x-component-props': {

View File

@ -29,7 +29,7 @@ export const TableBlockDesigner = () => {
const defaultResource = fieldSchema?.['x-decorator-props']?.resource;
const supportTemplate = !fieldSchema?.['x-decorator-props']?.disableTemplate;
const sort = defaultSort?.map((item: string) => {
return item.startsWith('-')
return item?.startsWith('-')
? {
field: item.substring(1),
direction: 'desc',
@ -151,6 +151,7 @@ export const TableBlockDesigner = () => {
field: {
type: 'string',
enum: sortFields,
required:true,
'x-decorator': 'FormItem',
'x-component': 'Select',
'x-component-props': {

View File

@ -133,6 +133,7 @@ export const TableSelectorDesigner = () => {
field: {
type: 'string',
enum: sortFields,
required:true,
'x-decorator': 'FormItem',
'x-component': 'Select',
'x-component-props': {

View File

@ -107,6 +107,7 @@ export const TableVoidDesigner = () => {
field: {
type: 'string',
enum: sortFields,
required:true,
'x-decorator': 'FormItem',
'x-component': 'Select',
'x-component-props': {

View File

@ -897,6 +897,7 @@ SchemaSettings.DefaultSortingRules = function DefaultSortingRules(props) {
field: {
type: 'string',
enum: sortFields,
required:true,
'x-decorator': 'FormItem',
'x-component': 'Select',
'x-component-props': {