allow explicit height for Table.
This commit is contained in:
parent
d13774814d
commit
85f8d4f4b7
|
@ -7146,7 +7146,7 @@ function Table(options) {
|
||||||
|
|
||||||
// Regular tables do not get custom height (this would
|
// Regular tables do not get custom height (this would
|
||||||
// require extra padding). Maybe add in the future.
|
// require extra padding). Maybe add in the future.
|
||||||
delete options.height;
|
// delete options.height;
|
||||||
|
|
||||||
Box.call(this, options);
|
Box.call(this, options);
|
||||||
|
|
||||||
|
@ -7288,7 +7288,8 @@ Table.prototype.render = function() {
|
||||||
, yl = coords.yl
|
, yl = coords.yl
|
||||||
, rx
|
, rx
|
||||||
, ry
|
, ry
|
||||||
, i;
|
, i
|
||||||
|
, over;
|
||||||
|
|
||||||
var dattr = this.sattr(this.style)
|
var dattr = this.sattr(this.style)
|
||||||
, hattr = this.sattr(this.style.header)
|
, hattr = this.sattr(this.style.header)
|
||||||
|
@ -7382,13 +7383,15 @@ Table.prototype.render = function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw internal borders.
|
// Draw internal borders.
|
||||||
for (ry = 1; ry < self.rows.length * 2; ry++) {
|
height = this.position.height != null ? this.height : this.rows.length * 2;
|
||||||
|
for (ry = 1; ry < height; ry++) {
|
||||||
if (!lines[yi + ry]) break;
|
if (!lines[yi + ry]) break;
|
||||||
|
over = this.position.height != null && ry >= this.rows.length * 2;
|
||||||
rx = 0;
|
rx = 0;
|
||||||
self._maxes.slice(0, -1).forEach(function(max, i) {
|
self._maxes.slice(0, -1).forEach(function(max, i) {
|
||||||
rx += max;
|
rx += max;
|
||||||
if (!lines[yi + ry][xi + rx + 1]) return;
|
if (!lines[yi + ry][xi + rx + 1]) return;
|
||||||
if (ry % 2 !== 0) {
|
if (ry % 2 !== 0 || over) {
|
||||||
if (self.options.fillCellBorders) {
|
if (self.options.fillCellBorders) {
|
||||||
var lbg = (ry <= 2 ? hattr : cattr) & 0x1ff;
|
var lbg = (ry <= 2 ? hattr : cattr) & 0x1ff;
|
||||||
lines[yi + ry][xi + ++rx][0] = (battr & ~0x1ff) | lbg;
|
lines[yi + ry][xi + ++rx][0] = (battr & ~0x1ff) | lbg;
|
||||||
|
@ -7403,7 +7406,7 @@ Table.prototype.render = function() {
|
||||||
rx = 1;
|
rx = 1;
|
||||||
self._maxes.forEach(function(max, i) {
|
self._maxes.forEach(function(max, i) {
|
||||||
while (max--) {
|
while (max--) {
|
||||||
if (ry % 2 === 0) {
|
if (ry % 2 === 0 && !over) {
|
||||||
if (!lines[yi + ry]) break;
|
if (!lines[yi + ry]) break;
|
||||||
if (!lines[yi + ry][xi + rx + 1]) break;
|
if (!lines[yi + ry][xi + rx + 1]) break;
|
||||||
if (self.options.fillCellBorders) {
|
if (self.options.fillCellBorders) {
|
||||||
|
@ -7420,6 +7423,18 @@ Table.prototype.render = function() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Keep drawing if we have a higher height.
|
||||||
|
rx = 0;
|
||||||
|
if (over) {
|
||||||
|
ry = height - 1;
|
||||||
|
self._maxes.slice(0, -1).forEach(function(max, i) {
|
||||||
|
rx += max;
|
||||||
|
if (!lines[yi + ry][xi + rx + 1]) return;
|
||||||
|
lines[yi + ry][xi + ++rx][0] = battr;
|
||||||
|
lines[yi + ry][xi + rx][1] = '\u2534'; // '┴'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
return coords;
|
return coords;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue