52 lines
1.8 KiB
JavaScript
52 lines
1.8 KiB
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.getCellFixedInfo = getCellFixedInfo;
|
|
function getCellFixedInfo(colStart, colEnd, columns, stickyOffsets, direction) {
|
|
var startColumn = columns[colStart] || {};
|
|
var endColumn = columns[colEnd] || {};
|
|
var fixLeft;
|
|
var fixRight;
|
|
if (startColumn.fixed === 'left') {
|
|
fixLeft = stickyOffsets.left[direction === 'rtl' ? colEnd : colStart];
|
|
} else if (endColumn.fixed === 'right') {
|
|
fixRight = stickyOffsets.right[direction === 'rtl' ? colStart : colEnd];
|
|
}
|
|
var lastFixLeft = false;
|
|
var firstFixRight = false;
|
|
var lastFixRight = false;
|
|
var firstFixLeft = false;
|
|
var nextColumn = columns[colEnd + 1];
|
|
var prevColumn = columns[colStart - 1];
|
|
|
|
// need show shadow only when canLastFix is true
|
|
var canLastFix = nextColumn && !nextColumn.fixed || prevColumn && !prevColumn.fixed || columns.every(function (col) {
|
|
return col.fixed === 'left';
|
|
});
|
|
if (direction === 'rtl') {
|
|
if (fixLeft !== undefined) {
|
|
var prevFixLeft = prevColumn && prevColumn.fixed === 'left';
|
|
firstFixLeft = !prevFixLeft && canLastFix;
|
|
} else if (fixRight !== undefined) {
|
|
var nextFixRight = nextColumn && nextColumn.fixed === 'right';
|
|
lastFixRight = !nextFixRight && canLastFix;
|
|
}
|
|
} else if (fixLeft !== undefined) {
|
|
var nextFixLeft = nextColumn && nextColumn.fixed === 'left';
|
|
lastFixLeft = !nextFixLeft && canLastFix;
|
|
} else if (fixRight !== undefined) {
|
|
var prevFixRight = prevColumn && prevColumn.fixed === 'right';
|
|
firstFixRight = !prevFixRight && canLastFix;
|
|
}
|
|
return {
|
|
fixLeft: fixLeft,
|
|
fixRight: fixRight,
|
|
lastFixLeft: lastFixLeft,
|
|
firstFixRight: firstFixRight,
|
|
lastFixRight: lastFixRight,
|
|
firstFixLeft: firstFixLeft,
|
|
isSticky: stickyOffsets.isSticky
|
|
};
|
|
} |