fix: field required when setting sorting rules (#1885)
This commit is contained in:
		
							parent
							
								
									2060bd4d44
								
							
						
					
					
						commit
						27cdd7b78a
					
				@ -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': {
 | 
			
		||||
 | 
			
		||||
@ -158,6 +158,7 @@ export const DetailsDesigner = () => {
 | 
			
		||||
                        field: {
 | 
			
		||||
                          type: 'string',
 | 
			
		||||
                          enum: sortFields,
 | 
			
		||||
                          required: true,
 | 
			
		||||
                          'x-decorator': 'FormItem',
 | 
			
		||||
                          'x-component': 'Select',
 | 
			
		||||
                          'x-component-props': {
 | 
			
		||||
 | 
			
		||||
@ -155,6 +155,7 @@ export const GridCardDesigner = () => {
 | 
			
		||||
                          field: {
 | 
			
		||||
                            type: 'string',
 | 
			
		||||
                            enum: sortFields,
 | 
			
		||||
                            required:true,
 | 
			
		||||
                            'x-decorator': 'FormItem',
 | 
			
		||||
                            'x-component': 'Select',
 | 
			
		||||
                            'x-component-props': {
 | 
			
		||||
 | 
			
		||||
@ -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': {
 | 
			
		||||
 | 
			
		||||
@ -133,6 +133,7 @@ export const TableSelectorDesigner = () => {
 | 
			
		||||
                          field: {
 | 
			
		||||
                            type: 'string',
 | 
			
		||||
                            enum: sortFields,
 | 
			
		||||
                            required:true,
 | 
			
		||||
                            'x-decorator': 'FormItem',
 | 
			
		||||
                            'x-component': 'Select',
 | 
			
		||||
                            'x-component-props': {
 | 
			
		||||
 | 
			
		||||
@ -107,6 +107,7 @@ export const TableVoidDesigner = () => {
 | 
			
		||||
                        field: {
 | 
			
		||||
                          type: 'string',
 | 
			
		||||
                          enum: sortFields,
 | 
			
		||||
                          required:true,
 | 
			
		||||
                          'x-decorator': 'FormItem',
 | 
			
		||||
                          'x-component': 'Select',
 | 
			
		||||
                          'x-component-props': {
 | 
			
		||||
 | 
			
		||||
@ -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': {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user