| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121 | import _extends from "@babel/runtime/helpers/esm/extends";import _mergeJSXProps from "@vue/babel-helper-vue-jsx-merge-props";// Utilsimport { createNamespace, isDef } from '../utils';import { emit, inherit } from '../utils/functional';import { routeProps, functionalRoute } from '../utils/router';import { cellProps } from './shared'; // Componentsimport Icon from '../icon'; // Typesvar _createNamespace = createNamespace('cell'),    createComponent = _createNamespace[0],    bem = _createNamespace[1];function Cell(h, props, slots, ctx) {  var _props$clickable;  var icon = props.icon,      size = props.size,      title = props.title,      label = props.label,      value = props.value,      isLink = props.isLink;  var showTitle = slots.title || isDef(title);  function Label() {    var showLabel = slots.label || isDef(label);    if (showLabel) {      return h("div", {        "class": [bem('label'), props.labelClass]      }, [slots.label ? slots.label() : label]);    }  }  function Title() {    if (showTitle) {      return h("div", {        "class": [bem('title'), props.titleClass],        "style": props.titleStyle      }, [slots.title ? slots.title() : h("span", [title]), Label()]);    }  }  function Value() {    var showValue = slots.default || isDef(value);    if (showValue) {      return h("div", {        "class": [bem('value', {          alone: !showTitle        }), props.valueClass]      }, [slots.default ? slots.default() : h("span", [value])]);    }  }  function LeftIcon() {    if (slots.icon) {      return slots.icon();    }    if (icon) {      return h(Icon, {        "class": bem('left-icon'),        "attrs": {          "name": icon,          "classPrefix": props.iconPrefix        }      });    }  }  function RightIcon() {    var rightIconSlot = slots['right-icon'];    if (rightIconSlot) {      return rightIconSlot();    }    if (isLink) {      var arrowDirection = props.arrowDirection;      return h(Icon, {        "class": bem('right-icon'),        "attrs": {          "name": arrowDirection ? "arrow-" + arrowDirection : 'arrow'        }      });    }  }  function onClick(event) {    emit(ctx, 'click', event);    functionalRoute(ctx);  }  var clickable = (_props$clickable = props.clickable) != null ? _props$clickable : isLink;  var classes = {    clickable: clickable,    center: props.center,    required: props.required,    borderless: !props.border  };  if (size) {    classes[size] = size;  }  return h("div", _mergeJSXProps([{    "class": bem(classes),    "attrs": {      "role": clickable ? 'button' : null,      "tabindex": clickable ? 0 : null    },    "on": {      "click": onClick    }  }, inherit(ctx)]), [LeftIcon(), Title(), Value(), RightIcon(), slots.extra == null ? void 0 : slots.extra()]);}Cell.props = _extends({}, cellProps, routeProps);export default createComponent(Cell);
 |