Skip to content

Commit

Permalink
fix(editor): data-source-field-select透传eventData
Browse files Browse the repository at this point in the history
  • Loading branch information
roymondchen committed Dec 18, 2024
1 parent c29afba commit d48d40a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/editor/src/fields/DataSourceFieldSelect/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import { Coin } from '@element-plus/icons-vue';
import { DataSchema } from '@tmagic/core';
import { TMagicButton, tMagicMessage, TMagicTooltip } from '@tmagic/design';
import type { FieldProps, FormState } from '@tmagic/form';
import type { ContainerChangeEventData, FieldProps, FormState } from '@tmagic/form';
import { DATA_SOURCE_FIELDS_SELECT_VALUE_PREFIX } from '@tmagic/utils';
import MIcon from '@editor/components/Icon.vue';
Expand Down Expand Up @@ -129,17 +129,17 @@ const checkStrictly = computed(() => {
return value ?? props.config.value === 'key';
});
const onChangeHandler = (value: string[]) => {
const onChangeHandler = (value: string[], eventData?: ContainerChangeEventData) => {
if (!Array.isArray(value)) {
emit('change', value);
emit('change', value, eventData);
return;
}
const [dsId, ...keys] = value;
const dataSource = dataSources.value.find((ds) => ds.id === removeDataSourceFieldPrefix(dsId));
if (!dataSource) {
emit('change', value);
emit('change', value, eventData);
return;
}
Expand All @@ -160,10 +160,10 @@ const onChangeHandler = (value: string[]) => {
(field?.type &&
(field.type === 'any' || dataSourceFieldType.includes('any') || dataSourceFieldType.includes(field.type)))
) {
emit('change', value);
emit('change', value, eventData);
} else {
tMagicMessage.error(`请选择类型为${dataSourceFieldType.join('')}的字段`);
emit('change', [dsId]);
emit('change', [dsId], eventData);
}
};
</script>

0 comments on commit d48d40a

Please sign in to comment.