guy 8 years ago
parent
commit
8b53b91118
  1. 40
      bi/base.js
  2. 40
      docs/base.js
  3. 6
      src/base/collection/collection.js
  4. 6
      src/base/grid/grid.js
  5. 5
      src/base/table/table.resizable.cell.js
  6. 23
      src/base/table/table.resizable.js

40
bi/base.js

@ -2684,10 +2684,10 @@ BI.CollectionView = BI.inherit(BI.Widget, {
this.renderedCells[index]._height = datum.height; this.renderedCells[index]._height = datum.height;
this.renderedCells[index].el.setHeight(datum.height); this.renderedCells[index].el.setHeight(datum.height);
} }
if (this.renderedCells[index].left !== datum.x) { if (this.renderedCells[index]._left !== datum.x) {
this.renderedCells[index].el.element.css("left", datum.x + "px"); this.renderedCells[index].el.element.css("left", datum.x + "px");
} }
if (this.renderedCells[index].top !== datum.y) { if (this.renderedCells[index]._top !== datum.y) {
this.renderedCells[index].el.element.css("top", datum.y + "px"); this.renderedCells[index].el.element.css("top", datum.y + "px");
} }
renderedCells.push(child = this.renderedCells[index]); renderedCells.push(child = this.renderedCells[index]);
@ -2705,6 +2705,8 @@ BI.CollectionView = BI.inherit(BI.Widget, {
el: child, el: child,
left: datum.x, left: datum.x,
top: datum.y, top: datum.y,
_left: datum.x,
_top: datum.y,
_width: datum.width, _width: datum.width,
_height: datum.height _height: datum.height
}); });
@ -14800,10 +14802,10 @@ BI.GridView = BI.inherit(BI.Widget, {
this.renderedCells[index]._height = rowDatum.size; this.renderedCells[index]._height = rowDatum.size;
this.renderedCells[index].el.setHeight(rowDatum.size); this.renderedCells[index].el.setHeight(rowDatum.size);
} }
if (this.renderedCells[index].left !== columnDatum.offset + horizontalOffsetAdjustment) { if (this.renderedCells[index]._left !== columnDatum.offset + horizontalOffsetAdjustment) {
this.renderedCells[index].el.element.css("left", (columnDatum.offset + horizontalOffsetAdjustment) + "px"); this.renderedCells[index].el.element.css("left", (columnDatum.offset + horizontalOffsetAdjustment) + "px");
} }
if (this.renderedCells[index].top !== rowDatum.offset + verticalOffsetAdjustment) { if (this.renderedCells[index]._top !== rowDatum.offset + verticalOffsetAdjustment) {
this.renderedCells[index].el.element.css("top", (rowDatum.offset + verticalOffsetAdjustment) + "px"); this.renderedCells[index].el.element.css("top", (rowDatum.offset + verticalOffsetAdjustment) + "px");
} }
renderedCells.push(child = this.renderedCells[index]); renderedCells.push(child = this.renderedCells[index]);
@ -14823,6 +14825,8 @@ BI.GridView = BI.inherit(BI.Widget, {
el: child, el: child,
left: columnDatum.offset + horizontalOffsetAdjustment, left: columnDatum.offset + horizontalOffsetAdjustment,
top: rowDatum.offset + verticalOffsetAdjustment, top: rowDatum.offset + verticalOffsetAdjustment,
_left: columnDatum.offset + horizontalOffsetAdjustment,
_top: rowDatum.offset + verticalOffsetAdjustment,
_width: columnDatum.size, _width: columnDatum.size,
_height: rowDatum.size _height: rowDatum.size
}); });
@ -32485,10 +32489,10 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, {
size = 0; size = 0;
offset = 0; offset = 0;
defaultSize = o.width; defaultSize = o.width;
self.handler.element.removeClass("dragging");
self.handler.element.removeClass("suitable");
startDrag = false; startDrag = false;
} }
self.handler.element.removeClass("dragging");
self.handler.element.removeClass("suitable");
mouseMoveTracker.releaseMouseMoves(); mouseMoveTracker.releaseMouseMoves();
}, document); }, document);
this.handler = BI.createWidget({ this.handler = BI.createWidget({
@ -32508,6 +32512,7 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, {
}); });
this.handler.element.on("mousedown", function (event) { this.handler.element.on("mousedown", function (event) {
defaultSize = o.width; defaultSize = o.width;
optimizeSize(defaultSize);
mouseMoveTracker.captureMouseMoves(event); mouseMoveTracker.captureMouseMoves(event);
}); });
BI.createWidget({ BI.createWidget({
@ -32758,13 +32763,14 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
self.resizer.setVisible(true); self.resizer.setVisible(true);
var height = o.headerRowSize + self._getRegionRowSize()[1]; var height = o.headerRowSize + self._getRegionRowSize()[1];
self.resizer.setHeight(height); self.resizer.setHeight(height);
if (o.minColumnSize[j]) { //TODO 不知道为什么加入这段代码会使得列宽调整出问题
if (size === o.minColumnSize[j]) { // if (o.minColumnSize[j]) {
self.resizer.element.addClass("suitable"); // if (size === o.minColumnSize[j]) {
} else { // self.resizer.element.addClass("suitable");
self.resizer.element.removeClass("suitable"); // } else {
} // self.resizer.element.removeClass("suitable");
} // }
// }
self._setResizerPosition(self._getResizerLeft(j) + size, (o.header.length - 1) * o.headerRowSize); self._setResizerPosition(self._getResizerLeft(j) + size, (o.header.length - 1) * o.headerRowSize);
}; };
var stop = function (j, size) { var stop = function (j, size) {
@ -32787,8 +32793,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
result[i][j] = { result[i][j] = {
type: "bi.resizable_table_cell", type: "bi.resizable_table_cell",
cell: col, cell: col,
suitableSize: o.minColumnSize[i], suitableSize: o.minColumnSize[j],
maxSize: o.maxColumnSize[i], maxSize: o.maxColumnSize[j],
resize: BI.bind(resize, null, j), resize: BI.bind(resize, null, j),
stop: BI.bind(stop, null, j) stop: BI.bind(stop, null, j)
}; };
@ -32798,8 +32804,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
result[r - 1][j] = { result[r - 1][j] = {
type: "bi.resizable_table_cell", type: "bi.resizable_table_cell",
cell: result[r - 1][j], cell: result[r - 1][j],
suitableSize: o.minColumnSize[i], suitableSize: o.minColumnSize[j],
maxSize: o.maxColumnSize[i], maxSize: o.maxColumnSize[j],
resize: BI.bind(resize, null, j), resize: BI.bind(resize, null, j),
stop: BI.bind(stop, null, j) stop: BI.bind(stop, null, j)
}; };

40
docs/base.js

@ -2684,10 +2684,10 @@ BI.CollectionView = BI.inherit(BI.Widget, {
this.renderedCells[index]._height = datum.height; this.renderedCells[index]._height = datum.height;
this.renderedCells[index].el.setHeight(datum.height); this.renderedCells[index].el.setHeight(datum.height);
} }
if (this.renderedCells[index].left !== datum.x) { if (this.renderedCells[index]._left !== datum.x) {
this.renderedCells[index].el.element.css("left", datum.x + "px"); this.renderedCells[index].el.element.css("left", datum.x + "px");
} }
if (this.renderedCells[index].top !== datum.y) { if (this.renderedCells[index]._top !== datum.y) {
this.renderedCells[index].el.element.css("top", datum.y + "px"); this.renderedCells[index].el.element.css("top", datum.y + "px");
} }
renderedCells.push(child = this.renderedCells[index]); renderedCells.push(child = this.renderedCells[index]);
@ -2705,6 +2705,8 @@ BI.CollectionView = BI.inherit(BI.Widget, {
el: child, el: child,
left: datum.x, left: datum.x,
top: datum.y, top: datum.y,
_left: datum.x,
_top: datum.y,
_width: datum.width, _width: datum.width,
_height: datum.height _height: datum.height
}); });
@ -14800,10 +14802,10 @@ BI.GridView = BI.inherit(BI.Widget, {
this.renderedCells[index]._height = rowDatum.size; this.renderedCells[index]._height = rowDatum.size;
this.renderedCells[index].el.setHeight(rowDatum.size); this.renderedCells[index].el.setHeight(rowDatum.size);
} }
if (this.renderedCells[index].left !== columnDatum.offset + horizontalOffsetAdjustment) { if (this.renderedCells[index]._left !== columnDatum.offset + horizontalOffsetAdjustment) {
this.renderedCells[index].el.element.css("left", (columnDatum.offset + horizontalOffsetAdjustment) + "px"); this.renderedCells[index].el.element.css("left", (columnDatum.offset + horizontalOffsetAdjustment) + "px");
} }
if (this.renderedCells[index].top !== rowDatum.offset + verticalOffsetAdjustment) { if (this.renderedCells[index]._top !== rowDatum.offset + verticalOffsetAdjustment) {
this.renderedCells[index].el.element.css("top", (rowDatum.offset + verticalOffsetAdjustment) + "px"); this.renderedCells[index].el.element.css("top", (rowDatum.offset + verticalOffsetAdjustment) + "px");
} }
renderedCells.push(child = this.renderedCells[index]); renderedCells.push(child = this.renderedCells[index]);
@ -14823,6 +14825,8 @@ BI.GridView = BI.inherit(BI.Widget, {
el: child, el: child,
left: columnDatum.offset + horizontalOffsetAdjustment, left: columnDatum.offset + horizontalOffsetAdjustment,
top: rowDatum.offset + verticalOffsetAdjustment, top: rowDatum.offset + verticalOffsetAdjustment,
_left: columnDatum.offset + horizontalOffsetAdjustment,
_top: rowDatum.offset + verticalOffsetAdjustment,
_width: columnDatum.size, _width: columnDatum.size,
_height: rowDatum.size _height: rowDatum.size
}); });
@ -32485,10 +32489,10 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, {
size = 0; size = 0;
offset = 0; offset = 0;
defaultSize = o.width; defaultSize = o.width;
self.handler.element.removeClass("dragging");
self.handler.element.removeClass("suitable");
startDrag = false; startDrag = false;
} }
self.handler.element.removeClass("dragging");
self.handler.element.removeClass("suitable");
mouseMoveTracker.releaseMouseMoves(); mouseMoveTracker.releaseMouseMoves();
}, document); }, document);
this.handler = BI.createWidget({ this.handler = BI.createWidget({
@ -32508,6 +32512,7 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, {
}); });
this.handler.element.on("mousedown", function (event) { this.handler.element.on("mousedown", function (event) {
defaultSize = o.width; defaultSize = o.width;
optimizeSize(defaultSize);
mouseMoveTracker.captureMouseMoves(event); mouseMoveTracker.captureMouseMoves(event);
}); });
BI.createWidget({ BI.createWidget({
@ -32758,13 +32763,14 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
self.resizer.setVisible(true); self.resizer.setVisible(true);
var height = o.headerRowSize + self._getRegionRowSize()[1]; var height = o.headerRowSize + self._getRegionRowSize()[1];
self.resizer.setHeight(height); self.resizer.setHeight(height);
if (o.minColumnSize[j]) { //TODO 不知道为什么加入这段代码会使得列宽调整出问题
if (size === o.minColumnSize[j]) { // if (o.minColumnSize[j]) {
self.resizer.element.addClass("suitable"); // if (size === o.minColumnSize[j]) {
} else { // self.resizer.element.addClass("suitable");
self.resizer.element.removeClass("suitable"); // } else {
} // self.resizer.element.removeClass("suitable");
} // }
// }
self._setResizerPosition(self._getResizerLeft(j) + size, (o.header.length - 1) * o.headerRowSize); self._setResizerPosition(self._getResizerLeft(j) + size, (o.header.length - 1) * o.headerRowSize);
}; };
var stop = function (j, size) { var stop = function (j, size) {
@ -32787,8 +32793,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
result[i][j] = { result[i][j] = {
type: "bi.resizable_table_cell", type: "bi.resizable_table_cell",
cell: col, cell: col,
suitableSize: o.minColumnSize[i], suitableSize: o.minColumnSize[j],
maxSize: o.maxColumnSize[i], maxSize: o.maxColumnSize[j],
resize: BI.bind(resize, null, j), resize: BI.bind(resize, null, j),
stop: BI.bind(stop, null, j) stop: BI.bind(stop, null, j)
}; };
@ -32798,8 +32804,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
result[r - 1][j] = { result[r - 1][j] = {
type: "bi.resizable_table_cell", type: "bi.resizable_table_cell",
cell: result[r - 1][j], cell: result[r - 1][j],
suitableSize: o.minColumnSize[i], suitableSize: o.minColumnSize[j],
maxSize: o.maxColumnSize[i], maxSize: o.maxColumnSize[j],
resize: BI.bind(resize, null, j), resize: BI.bind(resize, null, j),
stop: BI.bind(stop, null, j) stop: BI.bind(stop, null, j)
}; };

6
src/base/collection/collection.js

@ -166,10 +166,10 @@ BI.CollectionView = BI.inherit(BI.Widget, {
this.renderedCells[index]._height = datum.height; this.renderedCells[index]._height = datum.height;
this.renderedCells[index].el.setHeight(datum.height); this.renderedCells[index].el.setHeight(datum.height);
} }
if (this.renderedCells[index].left !== datum.x) { if (this.renderedCells[index]._left !== datum.x) {
this.renderedCells[index].el.element.css("left", datum.x + "px"); this.renderedCells[index].el.element.css("left", datum.x + "px");
} }
if (this.renderedCells[index].top !== datum.y) { if (this.renderedCells[index]._top !== datum.y) {
this.renderedCells[index].el.element.css("top", datum.y + "px"); this.renderedCells[index].el.element.css("top", datum.y + "px");
} }
renderedCells.push(child = this.renderedCells[index]); renderedCells.push(child = this.renderedCells[index]);
@ -187,6 +187,8 @@ BI.CollectionView = BI.inherit(BI.Widget, {
el: child, el: child,
left: datum.x, left: datum.x,
top: datum.y, top: datum.y,
_left: datum.x,
_top: datum.y,
_width: datum.width, _width: datum.width,
_height: datum.height _height: datum.height
}); });

6
src/base/grid/grid.js

@ -142,10 +142,10 @@ BI.GridView = BI.inherit(BI.Widget, {
this.renderedCells[index]._height = rowDatum.size; this.renderedCells[index]._height = rowDatum.size;
this.renderedCells[index].el.setHeight(rowDatum.size); this.renderedCells[index].el.setHeight(rowDatum.size);
} }
if (this.renderedCells[index].left !== columnDatum.offset + horizontalOffsetAdjustment) { if (this.renderedCells[index]._left !== columnDatum.offset + horizontalOffsetAdjustment) {
this.renderedCells[index].el.element.css("left", (columnDatum.offset + horizontalOffsetAdjustment) + "px"); this.renderedCells[index].el.element.css("left", (columnDatum.offset + horizontalOffsetAdjustment) + "px");
} }
if (this.renderedCells[index].top !== rowDatum.offset + verticalOffsetAdjustment) { if (this.renderedCells[index]._top !== rowDatum.offset + verticalOffsetAdjustment) {
this.renderedCells[index].el.element.css("top", (rowDatum.offset + verticalOffsetAdjustment) + "px"); this.renderedCells[index].el.element.css("top", (rowDatum.offset + verticalOffsetAdjustment) + "px");
} }
renderedCells.push(child = this.renderedCells[index]); renderedCells.push(child = this.renderedCells[index]);
@ -165,6 +165,8 @@ BI.GridView = BI.inherit(BI.Widget, {
el: child, el: child,
left: columnDatum.offset + horizontalOffsetAdjustment, left: columnDatum.offset + horizontalOffsetAdjustment,
top: rowDatum.offset + verticalOffsetAdjustment, top: rowDatum.offset + verticalOffsetAdjustment,
_left: columnDatum.offset + horizontalOffsetAdjustment,
_top: rowDatum.offset + verticalOffsetAdjustment,
_width: columnDatum.size, _width: columnDatum.size,
_height: rowDatum.size _height: rowDatum.size
}); });

5
src/base/table/table.resizable.cell.js

@ -56,10 +56,10 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, {
size = 0; size = 0;
offset = 0; offset = 0;
defaultSize = o.width; defaultSize = o.width;
self.handler.element.removeClass("dragging");
self.handler.element.removeClass("suitable");
startDrag = false; startDrag = false;
} }
self.handler.element.removeClass("dragging");
self.handler.element.removeClass("suitable");
mouseMoveTracker.releaseMouseMoves(); mouseMoveTracker.releaseMouseMoves();
}, document); }, document);
this.handler = BI.createWidget({ this.handler = BI.createWidget({
@ -79,6 +79,7 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, {
}); });
this.handler.element.on("mousedown", function (event) { this.handler.element.on("mousedown", function (event) {
defaultSize = o.width; defaultSize = o.width;
optimizeSize(defaultSize);
mouseMoveTracker.captureMouseMoves(event); mouseMoveTracker.captureMouseMoves(event);
}); });
BI.createWidget({ BI.createWidget({

23
src/base/table/table.resizable.js

@ -216,13 +216,14 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
self.resizer.setVisible(true); self.resizer.setVisible(true);
var height = o.headerRowSize + self._getRegionRowSize()[1]; var height = o.headerRowSize + self._getRegionRowSize()[1];
self.resizer.setHeight(height); self.resizer.setHeight(height);
if (o.minColumnSize[j]) { //TODO 不知道为什么加入这段代码会使得列宽调整出问题
if (size === o.minColumnSize[j]) { // if (o.minColumnSize[j]) {
self.resizer.element.addClass("suitable"); // if (size === o.minColumnSize[j]) {
} else { // self.resizer.element.addClass("suitable");
self.resizer.element.removeClass("suitable"); // } else {
} // self.resizer.element.removeClass("suitable");
} // }
// }
self._setResizerPosition(self._getResizerLeft(j) + size, (o.header.length - 1) * o.headerRowSize); self._setResizerPosition(self._getResizerLeft(j) + size, (o.header.length - 1) * o.headerRowSize);
}; };
var stop = function (j, size) { var stop = function (j, size) {
@ -245,8 +246,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
result[i][j] = { result[i][j] = {
type: "bi.resizable_table_cell", type: "bi.resizable_table_cell",
cell: col, cell: col,
suitableSize: o.minColumnSize[i], suitableSize: o.minColumnSize[j],
maxSize: o.maxColumnSize[i], maxSize: o.maxColumnSize[j],
resize: BI.bind(resize, null, j), resize: BI.bind(resize, null, j),
stop: BI.bind(stop, null, j) stop: BI.bind(stop, null, j)
}; };
@ -256,8 +257,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
result[r - 1][j] = { result[r - 1][j] = {
type: "bi.resizable_table_cell", type: "bi.resizable_table_cell",
cell: result[r - 1][j], cell: result[r - 1][j],
suitableSize: o.minColumnSize[i], suitableSize: o.minColumnSize[j],
maxSize: o.maxColumnSize[i], maxSize: o.maxColumnSize[j],
resize: BI.bind(resize, null, j), resize: BI.bind(resize, null, j),
stop: BI.bind(stop, null, j) stop: BI.bind(stop, null, j)
}; };

Loading…
Cancel
Save