mirror of
https://github.com/nocobase/nocobase
synced 2024-11-15 23:36:15 +00:00
Merge branch 'next' into 730
This commit is contained in:
commit
bab0661d5c
@ -19,7 +19,7 @@ import { useCollectionManager_deprecated, useCollection_deprecated } from '../..
|
||||
import { useFieldComponentName } from '../../../../common/useFieldComponentName';
|
||||
import { useCollection } from '../../../../data-source';
|
||||
import { fieldComponentSettingsItem } from '../../../../data-source/commonsSettingsItem';
|
||||
import { useDesignable, useValidateSchema } from '../../../../schema-component';
|
||||
import { useDesignable, useValidateSchema, useCompile } from '../../../../schema-component';
|
||||
import {
|
||||
useIsFieldReadPretty,
|
||||
useIsFormReadPretty,
|
||||
@ -53,6 +53,7 @@ export const fieldSettingsFormItem = new SchemaSettings({
|
||||
const { dn } = useDesignable();
|
||||
const field = useField<Field>();
|
||||
const fieldSchema = useFieldSchema();
|
||||
const compile = useCompile();
|
||||
const { getCollectionJoinField } = useCollectionManager_deprecated();
|
||||
const { getField } = useCollection_deprecated();
|
||||
const collectionField =
|
||||
@ -75,16 +76,15 @@ export const fieldSettingsFormItem = new SchemaSettings({
|
||||
},
|
||||
} as ISchema,
|
||||
onSubmit({ title }) {
|
||||
if (title) {
|
||||
field.title = title;
|
||||
fieldSchema.title = title;
|
||||
dn.emit('patch', {
|
||||
schema: {
|
||||
'x-uid': fieldSchema['x-uid'],
|
||||
title: fieldSchema.title,
|
||||
},
|
||||
});
|
||||
}
|
||||
const result = title.trim() === '' ? collectionField?.uiSchema?.title : title;
|
||||
field.title = compile(result);
|
||||
fieldSchema.title = result;
|
||||
dn.emit('patch', {
|
||||
schema: {
|
||||
'x-uid': fieldSchema['x-uid'],
|
||||
title: fieldSchema.title,
|
||||
},
|
||||
});
|
||||
dn.refresh();
|
||||
},
|
||||
};
|
||||
|
@ -17,7 +17,7 @@ import { SchemaSettings } from '../../../../application/schema-settings/SchemaSe
|
||||
import { useCollectionManager_deprecated, useCollection_deprecated } from '../../../../collection-manager';
|
||||
import { useFieldComponentName } from '../../../../common/useFieldComponentName';
|
||||
import { fieldComponentSettingsItem } from '../../../../data-source/commonsSettingsItem';
|
||||
import { EditOperator, useDesignable, useValidateSchema } from '../../../../schema-component';
|
||||
import { EditOperator, useDesignable, useValidateSchema, useCompile } from '../../../../schema-component';
|
||||
import { SchemaSettingsDefaultValue } from '../../../../schema-settings/SchemaSettingsDefaultValue';
|
||||
|
||||
const fieldComponentNameMap = (name: string) => {
|
||||
@ -49,6 +49,7 @@ export const filterFormItemFieldSettings = new SchemaSettings({
|
||||
const { t } = useTranslation();
|
||||
const { dn } = useDesignable();
|
||||
const field = useField<Field>();
|
||||
const compile = useCompile();
|
||||
const fieldSchema = useFieldSchema();
|
||||
const { getCollectionJoinField } = useCollectionManager_deprecated();
|
||||
const { getField } = useCollection_deprecated();
|
||||
@ -72,16 +73,16 @@ export const filterFormItemFieldSettings = new SchemaSettings({
|
||||
},
|
||||
} as ISchema,
|
||||
onSubmit({ title }) {
|
||||
if (title) {
|
||||
field.title = title;
|
||||
fieldSchema.title = title;
|
||||
dn.emit('patch', {
|
||||
schema: {
|
||||
'x-uid': fieldSchema['x-uid'],
|
||||
title: fieldSchema.title,
|
||||
},
|
||||
});
|
||||
}
|
||||
const result = title.trim() === '' ? collectionField?.uiSchema?.title : title;
|
||||
field.title = compile(result);
|
||||
fieldSchema.title = result;
|
||||
dn.emit('patch', {
|
||||
schema: {
|
||||
'x-uid': fieldSchema['x-uid'],
|
||||
title: fieldSchema.title,
|
||||
},
|
||||
});
|
||||
|
||||
dn.refresh();
|
||||
},
|
||||
};
|
||||
|
@ -30,6 +30,7 @@ export const EditTitle = () => {
|
||||
const fieldSchema = useFieldSchema();
|
||||
const { t } = useTranslation();
|
||||
const { dn } = useDesignable();
|
||||
const compile = useCompile();
|
||||
const collectionField = getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
|
||||
|
||||
return collectionField ? (
|
||||
@ -53,16 +54,16 @@ export const EditTitle = () => {
|
||||
} as ISchema
|
||||
}
|
||||
onSubmit={({ title }) => {
|
||||
if (title) {
|
||||
field.title = title;
|
||||
fieldSchema.title = title;
|
||||
dn.emit('patch', {
|
||||
schema: {
|
||||
'x-uid': fieldSchema['x-uid'],
|
||||
title: fieldSchema.title,
|
||||
},
|
||||
});
|
||||
}
|
||||
const result = title.trim() === '' ? collectionField?.uiSchema?.title : title;
|
||||
field.title = compile(result);
|
||||
fieldSchema.title = title;
|
||||
dn.emit('patch', {
|
||||
schema: {
|
||||
'x-uid': fieldSchema['x-uid'],
|
||||
title: fieldSchema.title,
|
||||
},
|
||||
});
|
||||
|
||||
dn.refresh();
|
||||
}}
|
||||
/>
|
||||
|
@ -13,7 +13,7 @@ import _ from 'lodash';
|
||||
import React from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { useCollection_deprecated, useCollectionManager_deprecated } from '../collection-manager';
|
||||
import { useDesignable } from '../schema-component';
|
||||
import { useDesignable, useCompile } from '../schema-component';
|
||||
import { SchemaSettingsModalItem, SchemaSettingsSwitchItem } from '../schema-settings';
|
||||
import { getTempFieldState } from '../schema-settings/LinkageRules/bindLinkageRulesToFiled';
|
||||
|
||||
@ -28,6 +28,7 @@ export const GeneralSchemaItems: React.FC<{
|
||||
const fieldSchema = useFieldSchema();
|
||||
const { t } = useTranslation();
|
||||
const { dn, refresh } = useDesignable();
|
||||
const compile = useCompile();
|
||||
const collectionField = getField(fieldSchema['name']) || getCollectionJoinField(fieldSchema['x-collection-field']);
|
||||
return (
|
||||
<>
|
||||
@ -52,16 +53,16 @@ export const GeneralSchemaItems: React.FC<{
|
||||
} as ISchema
|
||||
}
|
||||
onSubmit={({ title }) => {
|
||||
if (title) {
|
||||
field.title = title;
|
||||
fieldSchema.title = title;
|
||||
dn.emit('patch', {
|
||||
schema: {
|
||||
'x-uid': fieldSchema['x-uid'],
|
||||
title: fieldSchema.title,
|
||||
},
|
||||
});
|
||||
}
|
||||
const result = title.trim() === '' ? collectionField?.uiSchema?.title : title;
|
||||
field.title = compile(result);
|
||||
fieldSchema.title = title;
|
||||
dn.emit('patch', {
|
||||
schema: {
|
||||
'x-uid': fieldSchema['x-uid'],
|
||||
title: fieldSchema.title,
|
||||
},
|
||||
});
|
||||
|
||||
dn.refresh();
|
||||
}}
|
||||
/>
|
||||
|
@ -15,7 +15,7 @@ import { SchemaSettingOptions } from '../application';
|
||||
import { useSchemaToolbar } from '../application/schema-toolbar';
|
||||
import { useCollection_deprecated, useCollectionManager_deprecated } from '../collection-manager';
|
||||
import { SchemaSettingsLinkageRules } from '../schema-settings';
|
||||
import { useIsFieldReadPretty } from '../schema-component';
|
||||
import { useIsFieldReadPretty, useCompile } from '../schema-component';
|
||||
import { useCollection } from '../data-source';
|
||||
|
||||
export const generalSettingsItems: SchemaSettingOptions['items'] = [
|
||||
@ -25,6 +25,7 @@ export const generalSettingsItems: SchemaSettingOptions['items'] = [
|
||||
useComponentProps() {
|
||||
const { t } = useTranslation();
|
||||
const { dn } = useDesignable();
|
||||
const compile = useCompile();
|
||||
const field = useField<Field>();
|
||||
const fieldSchema = useFieldSchema();
|
||||
const { getCollectionJoinField } = useCollectionManager_deprecated();
|
||||
@ -49,16 +50,16 @@ export const generalSettingsItems: SchemaSettingOptions['items'] = [
|
||||
},
|
||||
} as ISchema,
|
||||
onSubmit({ title }) {
|
||||
if (title) {
|
||||
field.title = title;
|
||||
fieldSchema.title = title;
|
||||
dn.emit('patch', {
|
||||
schema: {
|
||||
'x-uid': fieldSchema['x-uid'],
|
||||
title: fieldSchema.title,
|
||||
},
|
||||
});
|
||||
}
|
||||
const result = title.trim() === '' ? collectionField?.uiSchema?.title : title;
|
||||
field.title = compile(result);
|
||||
fieldSchema.title = title;
|
||||
dn.emit('patch', {
|
||||
schema: {
|
||||
'x-uid': fieldSchema['x-uid'],
|
||||
title: fieldSchema.title,
|
||||
},
|
||||
});
|
||||
|
||||
dn.refresh();
|
||||
},
|
||||
};
|
||||
|
@ -22,6 +22,7 @@ import {
|
||||
useValidateSchema,
|
||||
fieldComponentSettingsItem,
|
||||
EditValidationRules,
|
||||
useCompile,
|
||||
} from '@nocobase/client';
|
||||
import _ from 'lodash';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
@ -46,6 +47,7 @@ export const bulkEditFormItemSettings = new SchemaSettings({
|
||||
type: 'modal',
|
||||
useComponentProps() {
|
||||
const { t } = useTranslation();
|
||||
const compile = useCompile();
|
||||
const { dn } = useDesignable();
|
||||
const field = useField<Field>();
|
||||
const fieldSchema = useFieldSchema();
|
||||
@ -70,16 +72,16 @@ export const bulkEditFormItemSettings = new SchemaSettings({
|
||||
},
|
||||
},
|
||||
onSubmit({ title }) {
|
||||
if (title) {
|
||||
field.title = title;
|
||||
fieldSchema.title = title;
|
||||
dn.emit('patch', {
|
||||
schema: {
|
||||
'x-uid': fieldSchema['x-uid'],
|
||||
title: fieldSchema.title,
|
||||
},
|
||||
});
|
||||
}
|
||||
const result = title.trim() === '' ? collectionField?.uiSchema?.title : title;
|
||||
field.title = compile(result);
|
||||
fieldSchema.title = title;
|
||||
dn.emit('patch', {
|
||||
schema: {
|
||||
'x-uid': fieldSchema['x-uid'],
|
||||
title: fieldSchema.title,
|
||||
},
|
||||
});
|
||||
|
||||
dn.refresh();
|
||||
},
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user