diff --git a/packages/editor/src/fields/DisplayConds.vue b/packages/editor/src/fields/DisplayConds.vue index 970aeb56..7a83f116 100644 --- a/packages/editor/src/fields/DisplayConds.vue +++ b/packages/editor/src/fields/DisplayConds.vue @@ -8,6 +8,7 @@ :last-values="lastValues" :prop="prop" :size="size" + @change="changeHandler" > @@ -22,6 +23,7 @@ import { type GroupListConfig, MGroupList, } from '@tmagic/form'; +import type { DisplayCond } from '@tmagic/schema'; import type { Services } from '@editor/type'; import { getCascaderOptionsFromFields } from '@editor/utils'; @@ -30,6 +32,10 @@ defineOptions({ name: 'm-fields-display-conds', }); +const emit = defineEmits<{ + change: [value: DisplayCond[]]; +}>(); + const props = withDefaults( defineProps< FieldProps<{ @@ -93,12 +99,12 @@ const config = computed(() => ({ type: 'cond-op-select', parentFields: parentFields.value, label: '条件', - width: 100, + width: 160, name: 'op', }, { label: '值', - width: 100, + width: 160, items: [ { name: 'value', @@ -142,4 +148,8 @@ const config = computed(() => ({ }, ], })); + +const changeHandler = (v: DisplayCond[]) => { + emit('change', v); +}; diff --git a/packages/editor/src/type.ts b/packages/editor/src/type.ts index 6a7c443e..35176a6e 100644 --- a/packages/editor/src/type.ts +++ b/packages/editor/src/type.ts @@ -774,7 +774,7 @@ export type PropsFormValueFunction = (data: { editorService: EditorService }) => export type PartSortableOptions = Omit; export interface PageBarSortOptions extends PartSortableOptions { /** 在onUpdate之后调用 */ - afterUpdate?: (event: SortableEvent, sortable: Sortable) => void; + afterUpdate?: (event: SortableEvent, sortable: Sortable) => void | Promise; /** 在onStart之前调用 */ - beforeStart?: (event: SortableEvent, sortable: Sortable) => void; + beforeStart?: (event: SortableEvent, sortable: Sortable) => void | Promise; }