fix: dateformat setting should support sub-table/table block (#3297)
* fix: dateformat should effect immediately in sub-table * refactor: dateformat setting for sub-table/table block * refactor: dateformat setting for sub-table/table block * refactor: schemaSettingsDateFormat
This commit is contained in:
parent
e8759588b5
commit
fda30fd519
@ -11,7 +11,7 @@ import { Collection, useCollection, useCollectionManager } from '../../../collec
|
||||
import { useRecord } from '../../../record-provider';
|
||||
import { generalSettingsItems } from '../../../schema-items/GeneralSettings';
|
||||
import {
|
||||
SchemaSettingsDataFormat,
|
||||
SchemaSettingsDateFormat,
|
||||
SchemaSettingsDataScope,
|
||||
SchemaSettingsDefaultValue,
|
||||
SchemaSettingsSortingRule,
|
||||
@ -732,7 +732,7 @@ export const formItemSettings = new SchemaSettings({
|
||||
},
|
||||
{
|
||||
name: 'dateFormat',
|
||||
Component: SchemaSettingsDataFormat,
|
||||
Component: SchemaSettingsDateFormat,
|
||||
useVisible() {
|
||||
const collectionField = useCollectionField();
|
||||
const isDateField = ['datetime', 'createdAt', 'updatedAt'].includes(collectionField?.interface);
|
||||
|
@ -6,7 +6,7 @@ import { useFormBlockContext } from '../../../block-provider';
|
||||
import { useCollectionManager } from '../../../collection-manager';
|
||||
import {
|
||||
GeneralSchemaDesigner,
|
||||
SchemaSettingsDataFormat,
|
||||
SchemaSettingsDateFormat,
|
||||
SchemaSettingsDataScope,
|
||||
SchemaSettingsDefaultValue,
|
||||
SchemaSettingsDivider,
|
||||
@ -392,7 +392,7 @@ export const TableColumnDesigner = (props) => {
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
{isDateField && <SchemaSettingsDataFormat fieldSchema={fieldSchema} />}
|
||||
{isDateField && <SchemaSettingsDateFormat fieldSchema={fieldSchema} />}
|
||||
{isSubTableColumn &&
|
||||
!field?.readPretty &&
|
||||
['obo', 'oho', 'o2o', 'o2m', 'm2m', 'm2o'].includes(collectionField?.interface) && (
|
||||
|
@ -1428,10 +1428,9 @@ export const SchemaSettingsEnableChildCollections = function EnableChildCollecti
|
||||
);
|
||||
};
|
||||
|
||||
export const SchemaSettingsDataFormat = function DateFormatConfig(props: { fieldSchema: Schema }) {
|
||||
export const SchemaSettingsDateFormat = function DateFormatConfig(props: { fieldSchema: Schema }) {
|
||||
const { fieldSchema } = props;
|
||||
const field = useField();
|
||||
const form = useForm();
|
||||
const { dn } = useDesignable();
|
||||
const { t } = useTranslation();
|
||||
const { getCollectionJoinField } = useCollectionManager();
|
||||
@ -1561,8 +1560,12 @@ export const SchemaSettingsDataFormat = function DateFormatConfig(props: { field
|
||||
};
|
||||
schema['x-component-props'] = fieldSchema['x-component-props'];
|
||||
field.componentProps = fieldSchema['x-component-props'];
|
||||
field.query(`.*.${fieldSchema.name}`).forEach((f) => {
|
||||
f.componentProps = fieldSchema['x-component-props'];
|
||||
//子表格/表格区块
|
||||
const parts = (field.path.entire as string).split('.');
|
||||
parts.pop();
|
||||
const modifiedString = parts.join('.');
|
||||
field.query(`${modifiedString}.*[0:].${fieldSchema.name}`).forEach((f) => {
|
||||
f.setComponentProps({ ...data });
|
||||
});
|
||||
dn.emit('patch', {
|
||||
schema,
|
||||
|
Loading…
Reference in New Issue
Block a user