1 line
5.8 KiB
Plaintext
1 line
5.8 KiB
Plaintext
|
{"version":3,"file":"descriptions-cell.mjs","sources":["../../../../../../packages/components/descriptions/src/descriptions-cell.ts"],"sourcesContent":["import { defineComponent, h, inject } from 'vue'\nimport { addUnit } from '@element-plus/utils/util'\nimport { getNormalizedProps } from '@element-plus/utils/vnode'\nimport { elDescriptionsKey } from './token'\n\nimport type { VNode } from 'vue'\nimport type {\n IDescriptionsInject,\n IDescriptionsItemInject,\n} from './descriptions.type'\n\nexport default defineComponent({\n name: 'ElDescriptionsCell',\n props: {\n cell: {\n type: Object,\n },\n tag: {\n type: String,\n },\n type: {\n type: String,\n },\n },\n setup() {\n const descriptions = inject(elDescriptionsKey, {} as IDescriptionsInject)\n\n return {\n descriptions,\n }\n },\n render() {\n const item = getNormalizedProps(\n this.cell as VNode\n ) as IDescriptionsItemInject\n\n const { border, direction } = this.descriptions\n const isVertical = direction === 'vertical'\n const label = this.cell?.children?.label?.() || item.label\n const content = this.cell?.children?.default?.()\n const span = item.span\n const align = item.align ? `is-${item.align}` : ''\n const labelAlign = item.labelAlign ? `is-${item.labelAlign}` : '' || align\n const className = item.className\n const labelClassName = item.labelClassName\n const style = {\n width: addUnit(item.width),\n minWidth: addUnit(item.minWidth),\n }\n\n switch (this.type) {\n case 'label':\n return h(\n this.tag,\n {\n style,\n class: [\n 'el-descriptions__cell',\n 'el-descriptions__label',\n {\n 'is-bordered-label': border,\n 'is-vertical-label': isVertical,\n },\n labelAlign,\n labelClassName,\n ],\n colSpan: isVertical ? span : 1,\n },\n label\n )\n case 'content':\n return h(\n this.tag,\n {\n style,\n class: [\n 'el-descriptions__cell',\n 'el-descriptions__content',\n {\n 'is-bordered-content': border,\n 'is-vertical-content': isVertical,\n },\n align,\n className,\n ],\n colSpan: isVertical ? span : span * 2 - 1,\n },\n content\n )\n default:\n return h(\n 'td',\n {\n style,\n class: ['el-descriptions__cell', align],\n colSpan: span,\n },\n [\n h(\n 'span',\n {\n class: ['el-descriptions__label', labelClassName],\n },\n label\n ),\n h(\n 'span',\n {\n class: ['el-descriptions__content', className],\n },\n content\n ),\n ]\n )\n }\n },\n})\n"],"names":[],"mappings":";;;;;AAIA,uBAAe,eAAe,CAAC;AAC/B,EAAE,IAAI,EAAE,oBAAoB;AAC5B,EAAE,KAAK,EAAE;AACT,IAAI,IAAI,EAAE;AACV,MAAM,IAAI,EAAE,MAAM;AAClB,KAAK;AACL,IAAI,GAAG,EAAE;AACT,MAAM,IAAI,EAAE,MAAM;AAClB,KAAK;AACL,IAAI,IAAI,EAAE;AACV,MAAM,IAAI,EAAE,MAAM;AAClB,KAAK;AACL,GAAG;AACH,EAAE,KAAK,GAAG;AACV,IAAI,MAAM,YAAY,GAAG,MAAM,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC;AACvD,IAAI,OAAO;AACX,MAAM,YAAY;AAClB,KAAK,CAAC;AACN,GAAG;AACH,EAAE,MAAM,GAAG;AACX,IAAI,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC;AAC/B,IAAI,MAAM,IAAI,GAAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC/C,IAAI,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC;AACpD,IAAI,MAAM,UAAU,GAAG,SAAS,KAAK,UAAU,CAAC;AAChD,IAAI,MAAM,KAAK,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,QAAQ,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,KAAK,KAAK,IAAI,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,IAAI,CAAC,KAAK,
|