index.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import _mergeJSXProps from "@vue/babel-helper-vue-jsx-merge-props";
  2. // Utils
  3. import { createNamespace } from '../utils';
  4. import { inherit } from '../utils/functional';
  5. import { BORDER_TOP } from '../utils/constant'; // Components
  6. import Cell from '../cell';
  7. import CellGroup from '../cell-group'; // Types
  8. var _createNamespace = createNamespace('panel'),
  9. createComponent = _createNamespace[0],
  10. bem = _createNamespace[1];
  11. function Panel(h, props, slots, ctx) {
  12. var Content = function Content() {
  13. return [slots.header ? slots.header() : h(Cell, {
  14. "attrs": {
  15. "icon": props.icon,
  16. "label": props.desc,
  17. "title": props.title,
  18. "value": props.status,
  19. "valueClass": bem('header-value')
  20. },
  21. "class": bem('header')
  22. }), h("div", {
  23. "class": bem('content')
  24. }, [slots.default && slots.default()]), slots.footer && h("div", {
  25. "class": [bem('footer'), BORDER_TOP]
  26. }, [slots.footer()])];
  27. };
  28. return h(CellGroup, _mergeJSXProps([{
  29. "class": bem(),
  30. "scopedSlots": {
  31. default: Content
  32. }
  33. }, inherit(ctx, true)]));
  34. }
  35. Panel.props = {
  36. icon: String,
  37. desc: String,
  38. title: String,
  39. status: String
  40. };
  41. export default createComponent(Panel);