import { use, isDef } from '../utils';
import { cellProps } from './shared';
import { emit, inherit } from '../utils/functional';
import { routeProps, functionalRoute } from '../mixins/router';
import Icon from '../icon';
const [sfc, bem] = use('cell');
function Cell(h, props, slots, ctx) {
const { icon, size, title, label, value, isLink, arrowDirection } = props;
const showTitle = slots.title || isDef(title);
const showValue = slots.default || isDef(value);
const Title = showTitle && (
{slots.title ? slots.title() :
{title}}
{label &&
{label}
}
);
const Value = showValue && (
{slots.default ? slots.default() : {value}}
);
const LeftIcon = slots.icon
? slots.icon()
: icon && ;
const RightIcon = slots['right-icon']
? slots['right-icon']()
: isLink && (
);
const onClick = event => {
emit(ctx, 'click', event);
functionalRoute(ctx);
};
return (
{LeftIcon}
{Title}
{Value}
{RightIcon}
{slots.extra && slots.extra()}
);
}
Cell.props = {
...cellProps,
...routeProps,
size: String,
clickable: Boolean,
arrowDirection: String
};
export default sfc(Cell);