<template>
	<div>
		<div class="output-params">
			<div class="input-params">
				<div v-for="(param, index) in inputParams" :key="index" class="param-item">
					<svg-icon :size="24" class="param-icon" name="local-var" />
					<span class="param-name">{{ param.name }}</span>
				</div>
			</div>
			<!-- 显示文本内容预览 -->
			<div v-if="node.textParams && node.textParams.content" class="text-preview">
				<div class="text-content">
					{{ getPreviewText(node.textParams.content) }}
				</div>
			</div>
		</div>
	</div>
</template>

<script>
import common from './common.ts';
export default {
	name: 'TextNode',
	mixins: [common],
	methods: {
		// 获取预览文本，限制长度
		getPreviewText(content) {
			if (!content) return '未设置文本内容';
			const maxLength = 50;
			return content.length > maxLength ? content.substring(0, maxLength) + '...' : content;
		},
	},
};
</script>

<style scoped>
/* 添加样式 */
.output-params {
	padding: 8px 12px;
}

.param-item {
	display: flex;
	align-items: center;
	margin-bottom: 4px;
	padding: 3px 10px;
	font-size: 13px;
	color: #333;
	border-radius: 4px;
	font-size: 12px;
	background-color: rgb(242, 244, 247);
}

.param-icon {
	color: rgb(41 112 255);
	font-weight: bold;
}

.param-name {
	padding: 2px 5px;
	background-color: #fff;
	box-sizing: border-box;
	margin-right: 4px;
	font-size: 10px;
	font-weight: bold;
	border-radius: 4px;
}

.param-value {
	color: #666;
	font-weight: 500;
}

.text-preview {
	margin-top: 8px;
	padding: 6px 8px;
	background-color: #f8f9fa;
	border-radius: 4px;
	border-left: 3px solid #409eff;
}

.text-content {
	font-size: 12px;
	color: #666;
	line-height: 1.4;
	word-break: break-word;
}
</style> 