UNPKG

vxe-table-demonic

Version:

一个基于 vue 的 PC 端表单/表格组件,支持增删改查、虚拟列表、虚拟树、懒加载、快捷菜单、数据校验、树形结构、打印导出、表单渲染、数据分页、弹窗、自定义模板、渲染器、JSON 配置式...

71 lines (70 loc) 3.04 kB
var __assign = (this && this.__assign) || function () { __assign = Object.assign || function(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; import { h, resolveComponent } from 'vue'; import GlobalConfig from '../../v-x-e-table/src/conf'; import { VXETable } from '../../v-x-e-table'; import { getFuncText, isEnableConf } from '../../tools/utils'; import { getSlotVNs } from '../../tools/vn'; function renderPrefixIcon(titlePrefix) { return h('span', { class: 'vxe-form--item-title-prefix' }, [ h('i', { class: titlePrefix.icon || GlobalConfig.icon.FORM_PREFIX }) ]); } function renderSuffixIcon(titleSuffix) { return h('span', { class: 'vxe-form--item-title-suffix' }, [ h('i', { class: titleSuffix.icon || GlobalConfig.icon.FORM_SUFFIX }) ]); } export function renderTitle($xeform, item) { var data = $xeform.props.data; var computeTooltipOpts = $xeform.getComputeMaps().computeTooltipOpts; var slots = item.slots, field = item.field, itemRender = item.itemRender, titlePrefix = item.titlePrefix, titleSuffix = item.titleSuffix; var tooltipOpts = computeTooltipOpts.value; var compConf = isEnableConf(itemRender) ? VXETable.renderer.get(itemRender.name) : null; var params = { data: data, field: field, property: field, item: item, $form: $xeform, $grid: $xeform.xegrid }; var titleSlot = slots ? slots.title : null; var contVNs = []; var titVNs = []; if (titlePrefix) { titVNs.push((titlePrefix.content || titlePrefix.message) ? h(resolveComponent('vxe-tooltip'), __assign(__assign(__assign({}, tooltipOpts), titlePrefix), { content: getFuncText(titlePrefix.content || titlePrefix.message) }), { default: function () { return renderPrefixIcon(titlePrefix); } }) : renderPrefixIcon(titlePrefix)); } titVNs.push(h('span', { class: 'vxe-form--item-title-label' }, compConf && compConf.renderItemTitle ? getSlotVNs(compConf.renderItemTitle(itemRender, params)) : (titleSlot ? $xeform.callSlot(titleSlot, params) : getFuncText(item.title)))); contVNs.push(h('div', { class: 'vxe-form--item-title-content' }, titVNs)); var fixVNs = []; if (titleSuffix) { fixVNs.push((titleSuffix.content || titleSuffix.message) ? h(resolveComponent('vxe-tooltip'), __assign(__assign(__assign({}, tooltipOpts), titleSuffix), { content: getFuncText(titleSuffix.content || titleSuffix.message) }), { default: function () { return renderSuffixIcon(titleSuffix); } }) : renderSuffixIcon(titleSuffix)); } contVNs.push(h('div', { class: 'vxe-form--item-title-postfix' }, fixVNs)); return contVNs; }