readme. comments. temporary workaround for non-autoPadding list-table.

This commit is contained in:
Christopher Jeffrey 2015-03-31 00:37:32 -07:00
parent 8793be5562
commit b067845242
2 changed files with 28 additions and 18 deletions

View File

@ -1068,22 +1068,22 @@ A stylized table of text elements.
- inherits all from Box.
- __setRows/setData(rows)__ - set rows in table. array of arrays of strings.
```
table.setData([
[ 'Animals', 'Foods' ],
[ 'Elephant', 'Apple' ],
[ 'Bird', 'Orange' ]
]);
```
``` js
table.setData([
[ 'Animals', 'Foods' ],
[ 'Elephant', 'Apple' ],
[ 'Bird', 'Orange' ]
]);
```
#### ListTable (from Box)
#### ListTable (from List)
A stylized table of text elements with a list.
##### Options:
- inherits all from Box.
- inherits all from List.
- __rows/data__ - array of array of strings representing rows.
- __pad__ - spaces to attempt to pad on the sides of each cell. `2` by default:
one space on each side.
@ -1092,23 +1092,23 @@ A stylized table of text elements with a list.
##### Properties:
- inherits all from Box.
- inherits all from List.
##### Events:
- inherits all from Box.
- inherits all from List.
##### Methods:
- inherits all from Box.
- __setRows/setData(rows)__ - set rows in table. array of arrays of strings.
```
table.setData([
[ 'Animals', 'Foods' ],
[ 'Elephant', 'Apple' ],
[ 'Bird', 'Orange' ]
]);
```
``` js
table.setData([
[ 'Animals', 'Foods' ],
[ 'Elephant', 'Apple' ],
[ 'Bird', 'Orange' ]
]);
```
#### Terminal (from Box)

View File

@ -3272,6 +3272,15 @@ Element.prototype._getShrinkBox = function(xi, xl, yi, yl, get) {
xl = mxl;
if (!this.screen.autoPadding) {
xl += this.padding.left + this.padding.right;
// XXX Temporary workaround until we decide to make autoPadding default.
// See widget-listtable.js for an example of why this is necessary.
// XXX Maybe just to this for all this being that this would affect
// width shrunken normal shrunken lists as well.
// if (this._isList) {
if (this.type === 'list-table') {
xl -= this.padding.left + this.padding.right;
xl += this.iright;
}
} else {
//xl += this.padding.right;
xl += this.iright;
@ -4659,6 +4668,7 @@ List.prototype.appendItem = function(item) {
}
// if (this.shrink) {
// XXX NOTE: Maybe just do this on all shrinkage once autoPadding is default?
if (this.shrink && this.options.normalShrink) {
delete options.right;
options.width = 'shrink';