|
|
@ -1,6 +1,6 @@
|
|
|
|
import Cell from './Cell';
|
|
|
|
import Cell from './Cell';
|
|
|
|
import { getOptionProps, getSlot, getClass, getStyle, getComponent } from '../_util/props-util';
|
|
|
|
import { getSlot, getClass, getStyle } from '../_util/props-util';
|
|
|
|
import { FunctionalComponent, VNode, inject } from 'vue';
|
|
|
|
import { FunctionalComponent, VNode, inject, ref } from 'vue';
|
|
|
|
import { descriptionsContext, DescriptionsContextProp } from './index';
|
|
|
|
import { descriptionsContext, DescriptionsContextProp } from './index';
|
|
|
|
|
|
|
|
|
|
|
|
interface CellConfig {
|
|
|
|
interface CellConfig {
|
|
|
@ -38,9 +38,8 @@ const Row: FunctionalComponent<RowProps> = props => {
|
|
|
|
span = 1,
|
|
|
|
span = 1,
|
|
|
|
labelStyle,
|
|
|
|
labelStyle,
|
|
|
|
contentStyle,
|
|
|
|
contentStyle,
|
|
|
|
} = getOptionProps(item);
|
|
|
|
label = (item.children as any)?.label?.(),
|
|
|
|
const label = getComponent(item, 'label');
|
|
|
|
} = item.props || {};
|
|
|
|
|
|
|
|
|
|
|
|
const children = getSlot(item);
|
|
|
|
const children = getSlot(item);
|
|
|
|
const className = getClass(item);
|
|
|
|
const className = getClass(item);
|
|
|
|
const style = getStyle(item);
|
|
|
|
const style = getStyle(item);
|
|
|
@ -52,8 +51,8 @@ const Row: FunctionalComponent<RowProps> = props => {
|
|
|
|
key={`${type}-${key || index}`}
|
|
|
|
key={`${type}-${key || index}`}
|
|
|
|
class={className}
|
|
|
|
class={className}
|
|
|
|
style={style}
|
|
|
|
style={style}
|
|
|
|
labelStyle={{ ...rootLabelStyle, ...labelStyle }}
|
|
|
|
labelStyle={{ ...rootLabelStyle.value, ...labelStyle }}
|
|
|
|
contentStyle={{ ...rootContentStyle, ...contentStyle }}
|
|
|
|
contentStyle={{ ...rootContentStyle.value, ...contentStyle }}
|
|
|
|
span={span}
|
|
|
|
span={span}
|
|
|
|
colon={colon}
|
|
|
|
colon={colon}
|
|
|
|
component={component}
|
|
|
|
component={component}
|
|
|
@ -69,7 +68,7 @@ const Row: FunctionalComponent<RowProps> = props => {
|
|
|
|
<Cell
|
|
|
|
<Cell
|
|
|
|
key={`label-${key || index}`}
|
|
|
|
key={`label-${key || index}`}
|
|
|
|
class={className}
|
|
|
|
class={className}
|
|
|
|
style={{ ...rootLabelStyle, ...style, ...labelStyle }}
|
|
|
|
style={{ ...rootLabelStyle.value, ...style, ...labelStyle }}
|
|
|
|
span={1}
|
|
|
|
span={1}
|
|
|
|
colon={colon}
|
|
|
|
colon={colon}
|
|
|
|
component={component[0]}
|
|
|
|
component={component[0]}
|
|
|
@ -80,7 +79,7 @@ const Row: FunctionalComponent<RowProps> = props => {
|
|
|
|
<Cell
|
|
|
|
<Cell
|
|
|
|
key={`content-${key || index}`}
|
|
|
|
key={`content-${key || index}`}
|
|
|
|
class={className}
|
|
|
|
class={className}
|
|
|
|
style={{ ...rootContentStyle, ...style, ...contentStyle }}
|
|
|
|
style={{ ...rootContentStyle.value, ...style, ...contentStyle }}
|
|
|
|
span={span * 2 - 1}
|
|
|
|
span={span * 2 - 1}
|
|
|
|
component={component[1]}
|
|
|
|
component={component[1]}
|
|
|
|
itemPrefixCls={itemPrefixCls}
|
|
|
|
itemPrefixCls={itemPrefixCls}
|
|
|
@ -93,8 +92,8 @@ const Row: FunctionalComponent<RowProps> = props => {
|
|
|
|
|
|
|
|
|
|
|
|
const { prefixCls, vertical, row, index, bordered } = props;
|
|
|
|
const { prefixCls, vertical, row, index, bordered } = props;
|
|
|
|
const { labelStyle, contentStyle } = inject(descriptionsContext, {
|
|
|
|
const { labelStyle, contentStyle } = inject(descriptionsContext, {
|
|
|
|
labelStyle: undefined,
|
|
|
|
labelStyle: ref({}),
|
|
|
|
contentStyle: undefined,
|
|
|
|
contentStyle: ref({}),
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if (vertical) {
|
|
|
|
if (vertical) {
|
|
|
|
return (
|
|
|
|
return (
|
|
|
@ -104,8 +103,8 @@ const Row: FunctionalComponent<RowProps> = props => {
|
|
|
|
component: 'th',
|
|
|
|
component: 'th',
|
|
|
|
type: 'label',
|
|
|
|
type: 'label',
|
|
|
|
showLabel: true,
|
|
|
|
showLabel: true,
|
|
|
|
labelStyle: labelStyle.value,
|
|
|
|
labelStyle,
|
|
|
|
contentStyle: contentStyle.value,
|
|
|
|
contentStyle,
|
|
|
|
})}
|
|
|
|
})}
|
|
|
|
</tr>
|
|
|
|
</tr>
|
|
|
|
<tr key={`content-${index}`} class={`${prefixCls}-row`}>
|
|
|
|
<tr key={`content-${index}`} class={`${prefixCls}-row`}>
|
|
|
@ -113,8 +112,8 @@ const Row: FunctionalComponent<RowProps> = props => {
|
|
|
|
component: 'td',
|
|
|
|
component: 'td',
|
|
|
|
type: 'content',
|
|
|
|
type: 'content',
|
|
|
|
showContent: true,
|
|
|
|
showContent: true,
|
|
|
|
labelStyle: labelStyle.value,
|
|
|
|
labelStyle,
|
|
|
|
contentStyle: contentStyle.value,
|
|
|
|
contentStyle,
|
|
|
|
})}
|
|
|
|
})}
|
|
|
|
</tr>
|
|
|
|
</tr>
|
|
|
|
</>
|
|
|
|
</>
|
|
|
@ -128,8 +127,8 @@ const Row: FunctionalComponent<RowProps> = props => {
|
|
|
|
type: 'item',
|
|
|
|
type: 'item',
|
|
|
|
showLabel: true,
|
|
|
|
showLabel: true,
|
|
|
|
showContent: true,
|
|
|
|
showContent: true,
|
|
|
|
labelStyle: labelStyle.value,
|
|
|
|
labelStyle,
|
|
|
|
contentStyle: contentStyle.value,
|
|
|
|
contentStyle,
|
|
|
|
})}
|
|
|
|
})}
|
|
|
|
</tr>
|
|
|
|
</tr>
|
|
|
|
);
|
|
|
|
);
|
|
|
|