import {designComponent} 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 Toggle from "../../Toggle"; export const PlcToggle = designComponent({ name: 'plc-toggle', props: { ...createPlcPropOptions({ addEditPadding: true, }), trueValue: { default: 'Y' as any }, falseValue: { default: 'N' as any }, }, scopeSlots: PlcScopeSlotsOptions, emits: PlcEmitsOptions, setup({ props, slots, scopeSlots, event }) { return usePlc({ props, scopeSlots, slots, event, defaultScopeSlots: { summary: () => null, normal: ({ row, plc }) => !plc.props.field ? null : ( ), edit: ({ row, plc }) => !plc.props.field ? null : ( ), } }); }, });