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 i18n from "../../i18n"; export const PlcIndex = designComponent({ name: 'plc-index', props: { ...createPlcPropOptions({ autoFixedLeft: true, order: -9995, width: 45, align: 'center', noPadding: true, hideInForm: true, noFilter: true, noSort: true, }), summaryText: { type: String, default: () => i18n.$it('base.edit.summary').d('合计') }, start: { type: Number, default: 0 }, }, scopeSlots: PlcScopeSlotsOptions, emits: PlcEmitsOptions, setup({ props, slots, scopeSlots, event }) { return usePlc({ props, scopeSlots, event, slots, defaultScopeSlots: { head: () => '#', normal: ({ node }) => props.start + node.state.index + 1, summary: () => {props.summaryText}, } }); }, });