import {designComponent, onBeforeUnmount, PropType, useModel} from "@peryl/react-compose"; import {createPlcPropOptions, PlcEmitsOptions} from "../../plc/utils/plc.utils"; import {PlcScopeSlotsOptions} from "../../plc/utils/plc.scope-slots"; import {usePlc} from "../../plc/use/usePlc"; import {PlainObject} from "@peryl/utils/event"; import {Icon} from "../../../Icon"; import {injectPlainTable} from "../../table/Table"; export const PlcDraggier = designComponent({ name: 'plc-draggier', props: { modelValue: { type: Array as PropType }, ...createPlcPropOptions({ autoFixedLeft: true, order: -9999, width: 45, align: 'center', noPadding: true, hideInForm: true, noFilter: true, noSort: true, }), }, emits: { ...PlcEmitsOptions, onUpdateModelValue: (val?: PlainObject[]) => true, }, scopeSlots: PlcScopeSlotsOptions, setup({ props, slots, scopeSlots, event }) { /*双向绑定列表数据*/ const model = useModel(() => props.modelValue, event.emit.onUpdateModelValue); /*表格父组件*/ const table = injectPlainTable(); onBeforeUnmount( table.event.on.onUpdateData(val => {model.value = val as any;}) ); return usePlc({ props, slots, scopeSlots, event, defaultScopeSlots: { normal: (cellRenderScope) => (
table.tableDraggier.rowDraggier.handler.onMousedown(e, cellRenderScope.node)} >
), summary: () => null, } }); }, });