a56ce7cf7f82889f33c994c68f0adff22bfe889b4147ac0c2518606d66475db16f2ec2612679a686f9c4119e5c926ae55c22d1a5d6cb9531a5d8cc76a717b5 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. 'use strict';
  2. Object.defineProperty(exports, '__esModule', { value: true });
  3. var vue = require('vue');
  4. var utils = require('../utils.js');
  5. var row = require('../components/row.js');
  6. function _isSlot(s) {
  7. return typeof s === "function" || Object.prototype.toString.call(s) === "[object Object]" && !vue.isVNode(s);
  8. }
  9. const RowRenderer = (props, {
  10. slots
  11. }) => {
  12. const {
  13. columns,
  14. columnsStyles,
  15. depthMap,
  16. expandColumnKey,
  17. expandedRowKeys,
  18. estimatedRowHeight,
  19. hasFixedColumns,
  20. rowData,
  21. rowIndex,
  22. style,
  23. isScrolling,
  24. rowProps,
  25. rowClass,
  26. rowKey,
  27. rowEventHandlers,
  28. ns,
  29. onRowHovered,
  30. onRowExpanded
  31. } = props;
  32. const rowKls = utils.tryCall(rowClass, {
  33. columns,
  34. rowData,
  35. rowIndex
  36. }, "");
  37. const additionalProps = utils.tryCall(rowProps, {
  38. columns,
  39. rowData,
  40. rowIndex
  41. });
  42. const _rowKey = rowData[rowKey];
  43. const depth = depthMap[_rowKey] || 0;
  44. const canExpand = Boolean(expandColumnKey);
  45. const isFixedRow = rowIndex < 0;
  46. const kls = [ns.e("row"), rowKls, {
  47. [ns.e(`row-depth-${depth}`)]: canExpand && rowIndex >= 0,
  48. [ns.is("expanded")]: canExpand && expandedRowKeys.includes(_rowKey),
  49. [ns.is("fixed")]: !depth && isFixedRow,
  50. [ns.is("customized")]: Boolean(slots.row)
  51. }];
  52. const onRowHover = hasFixedColumns ? onRowHovered : void 0;
  53. const _rowProps = {
  54. ...additionalProps,
  55. columns,
  56. columnsStyles,
  57. class: kls,
  58. depth,
  59. expandColumnKey,
  60. estimatedRowHeight: isFixedRow ? void 0 : estimatedRowHeight,
  61. isScrolling,
  62. rowIndex,
  63. rowData,
  64. rowKey: _rowKey,
  65. rowEventHandlers,
  66. style
  67. };
  68. const handlerMouseEnter = (e) => {
  69. onRowHover == null ? void 0 : onRowHover({
  70. hovered: true,
  71. rowKey: _rowKey,
  72. event: e,
  73. rowData,
  74. rowIndex
  75. });
  76. };
  77. const handlerMouseLeave = (e) => {
  78. onRowHover == null ? void 0 : onRowHover({
  79. hovered: false,
  80. rowKey: _rowKey,
  81. event: e,
  82. rowData,
  83. rowIndex
  84. });
  85. };
  86. return vue.createVNode(row["default"], vue.mergeProps(_rowProps, {
  87. "onRowExpand": onRowExpanded,
  88. "onMouseenter": handlerMouseEnter,
  89. "onMouseleave": handlerMouseLeave,
  90. "rowkey": _rowKey
  91. }), _isSlot(slots) ? slots : {
  92. default: () => [slots]
  93. });
  94. };
  95. var Row = RowRenderer;
  96. exports["default"] = Row;
  97. //# sourceMappingURL=row.js.map