fixUtil.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.getCellFixedInfo = getCellFixedInfo;
  6. function getCellFixedInfo(colStart, colEnd, columns, stickyOffsets, direction) {
  7. const startColumn = columns[colStart] || {};
  8. const endColumn = columns[colEnd] || {};
  9. let fixLeft;
  10. let fixRight;
  11. if (startColumn.fixed === 'left') {
  12. fixLeft = stickyOffsets.left[colStart];
  13. } else if (endColumn.fixed === 'right') {
  14. fixRight = stickyOffsets.right[colEnd];
  15. }
  16. let lastFixLeft = false;
  17. let firstFixRight = false;
  18. let lastFixRight = false;
  19. let firstFixLeft = false;
  20. const nextColumn = columns[colEnd + 1];
  21. const prevColumn = columns[colStart - 1];
  22. if (direction === 'rtl') {
  23. if (fixLeft !== undefined) {
  24. const prevFixLeft = prevColumn && prevColumn.fixed === 'left';
  25. firstFixLeft = !prevFixLeft;
  26. } else if (fixRight !== undefined) {
  27. const nextFixRight = nextColumn && nextColumn.fixed === 'right';
  28. lastFixRight = !nextFixRight;
  29. }
  30. } else if (fixLeft !== undefined) {
  31. const nextFixLeft = nextColumn && nextColumn.fixed === 'left';
  32. lastFixLeft = !nextFixLeft;
  33. } else if (fixRight !== undefined) {
  34. const prevFixRight = prevColumn && prevColumn.fixed === 'right';
  35. firstFixRight = !prevFixRight;
  36. }
  37. return {
  38. fixLeft,
  39. fixRight,
  40. lastFixLeft,
  41. firstFixRight,
  42. lastFixRight,
  43. firstFixLeft,
  44. isSticky: stickyOffsets.isSticky
  45. };
  46. }