import { computed, defineComponent } from 'vue'; import { DefaultComponentProps } from '../_default'; import type { BCMSArrayPropMoveEventData } from '../../types'; import BCMSIcon from '../icon'; import { useTranslation } from '../../translations'; const component = defineComponent({ props: { ...DefaultComponentProps, arrayLength: { type: Number, default: 0, }, immovable: Boolean, itemPositionInArray: { type: Number, required: true, }, }, emits: { move: (_data: BCMSArrayPropMoveEventData) => { return true; }, remove: (_itemPosition: number) => { return true; }, }, setup(props, ctx) { const translations = computed(() => { return useTranslation(); }); return () => (
{translations.value.prop.wrapperArrayItem.itemIndex({ index: props.itemPositionInArray + 1, })}
{!props.immovable ? ( <> {props.itemPositionInArray > 0 ? ( ) : ( '' )} {props.itemPositionInArray < props.arrayLength - 1 ? ( ) : ( '' )} ) : ( '' )}
{ctx.slots.default ? ctx.slots.default() : ''}
); }, }); export default component;