guy 8 years ago
parent
commit
ee6c040ef0
  1. 26
      bi/base.js
  2. 26
      docs/base.js
  3. 10
      src/base/table/table.resizable.cell.js
  4. 16
      src/base/table/table.resizable.js

26
bi/base.js

@ -32420,17 +32420,17 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, {
var startDrag = false; var startDrag = false;
var size = 0, offset = 0, defaultSize = o.width; var size = 0, offset = 0, defaultSize = o.width;
function optimizeSize(size) { function optimizeSize(s) {
size = BI.clamp(size, o.minSize, o.maxSize || Number.MAX_VALUE); var optSize = BI.clamp(s, o.minSize, o.maxSize || Number.MAX_VALUE);
if (o.suitableSize) { if (o.suitableSize) {
if (Math.abs(o.suitableSize - size) < 5) { if (Math.abs(o.suitableSize - optSize) < 5) {
size = o.suitableSize; optSize = o.suitableSize;
self.handler.element.addClass("suitable"); self.handler.element.addClass("suitable");
} else { } else {
self.handler.element.removeClass("suitable"); self.handler.element.removeClass("suitable");
} }
} }
return size; return optSize;
} }
var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX, deltaY) { var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX, deltaY) {
@ -32717,12 +32717,12 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
_formatHeader: function (header) { _formatHeader: function (header) {
var self = this, o = this.options; var self = this, o = this.options;
var result = []; var result = [];
var resize = function (j, i, size) { var resize = function (j, size) {
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[i]) { if (o.minColumnSize[j]) {
if (size === o.minColumnSize[i]) { if (size === o.minColumnSize[j]) {
self.resizer.element.addClass("suitable"); self.resizer.element.addClass("suitable");
} else { } else {
self.resizer.element.removeClass("suitable"); self.resizer.element.removeClass("suitable");
@ -32730,7 +32730,7 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
} }
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, i, size) { var stop = function (j, size) {
self.resizer.setVisible(false); self.resizer.setVisible(false);
var columnSize = o.columnSize.slice(); var columnSize = o.columnSize.slice();
columnSize[j] = size; columnSize[j] = size;
@ -32752,8 +32752,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
cell: col, cell: col,
suitableSize: o.minColumnSize[i], suitableSize: o.minColumnSize[i],
maxSize: o.maxColumnSize[i], maxSize: o.maxColumnSize[i],
resize: BI.bind(resize, null, j, i), resize: BI.bind(resize, null, j),
stop: BI.bind(stop, null, j, i) stop: BI.bind(stop, null, j)
}; };
if (o.isNeedMerge) { if (o.isNeedMerge) {
var r = i; var r = i;
@ -32763,8 +32763,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
cell: result[r - 1][j], cell: result[r - 1][j],
suitableSize: o.minColumnSize[i], suitableSize: o.minColumnSize[i],
maxSize: o.maxColumnSize[i], maxSize: o.maxColumnSize[i],
resize: BI.bind(resize, null, j, i), resize: BI.bind(resize, null, j),
stop: BI.bind(stop, null, j, i) stop: BI.bind(stop, null, j)
}; };
r--; r--;
} }

26
docs/base.js

@ -32420,17 +32420,17 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, {
var startDrag = false; var startDrag = false;
var size = 0, offset = 0, defaultSize = o.width; var size = 0, offset = 0, defaultSize = o.width;
function optimizeSize(size) { function optimizeSize(s) {
size = BI.clamp(size, o.minSize, o.maxSize || Number.MAX_VALUE); var optSize = BI.clamp(s, o.minSize, o.maxSize || Number.MAX_VALUE);
if (o.suitableSize) { if (o.suitableSize) {
if (Math.abs(o.suitableSize - size) < 5) { if (Math.abs(o.suitableSize - optSize) < 5) {
size = o.suitableSize; optSize = o.suitableSize;
self.handler.element.addClass("suitable"); self.handler.element.addClass("suitable");
} else { } else {
self.handler.element.removeClass("suitable"); self.handler.element.removeClass("suitable");
} }
} }
return size; return optSize;
} }
var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX, deltaY) { var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX, deltaY) {
@ -32717,12 +32717,12 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
_formatHeader: function (header) { _formatHeader: function (header) {
var self = this, o = this.options; var self = this, o = this.options;
var result = []; var result = [];
var resize = function (j, i, size) { var resize = function (j, size) {
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[i]) { if (o.minColumnSize[j]) {
if (size === o.minColumnSize[i]) { if (size === o.minColumnSize[j]) {
self.resizer.element.addClass("suitable"); self.resizer.element.addClass("suitable");
} else { } else {
self.resizer.element.removeClass("suitable"); self.resizer.element.removeClass("suitable");
@ -32730,7 +32730,7 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
} }
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, i, size) { var stop = function (j, size) {
self.resizer.setVisible(false); self.resizer.setVisible(false);
var columnSize = o.columnSize.slice(); var columnSize = o.columnSize.slice();
columnSize[j] = size; columnSize[j] = size;
@ -32752,8 +32752,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
cell: col, cell: col,
suitableSize: o.minColumnSize[i], suitableSize: o.minColumnSize[i],
maxSize: o.maxColumnSize[i], maxSize: o.maxColumnSize[i],
resize: BI.bind(resize, null, j, i), resize: BI.bind(resize, null, j),
stop: BI.bind(stop, null, j, i) stop: BI.bind(stop, null, j)
}; };
if (o.isNeedMerge) { if (o.isNeedMerge) {
var r = i; var r = i;
@ -32763,8 +32763,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
cell: result[r - 1][j], cell: result[r - 1][j],
suitableSize: o.minColumnSize[i], suitableSize: o.minColumnSize[i],
maxSize: o.maxColumnSize[i], maxSize: o.maxColumnSize[i],
resize: BI.bind(resize, null, j, i), resize: BI.bind(resize, null, j),
stop: BI.bind(stop, null, j, i) stop: BI.bind(stop, null, j)
}; };
r--; r--;
} }

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

@ -28,17 +28,17 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, {
var startDrag = false; var startDrag = false;
var size = 0, offset = 0, defaultSize = o.width; var size = 0, offset = 0, defaultSize = o.width;
function optimizeSize(size) { function optimizeSize(s) {
size = BI.clamp(size, o.minSize, o.maxSize || Number.MAX_VALUE); var optSize = BI.clamp(s, o.minSize, o.maxSize || Number.MAX_VALUE);
if (o.suitableSize) { if (o.suitableSize) {
if (Math.abs(o.suitableSize - size) < 5) { if (Math.abs(o.suitableSize - optSize) < 5) {
size = o.suitableSize; optSize = o.suitableSize;
self.handler.element.addClass("suitable"); self.handler.element.addClass("suitable");
} else { } else {
self.handler.element.removeClass("suitable"); self.handler.element.removeClass("suitable");
} }
} }
return size; return optSize;
} }
var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX, deltaY) { var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX, deltaY) {

16
src/base/table/table.resizable.js

@ -212,12 +212,12 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
_formatHeader: function (header) { _formatHeader: function (header) {
var self = this, o = this.options; var self = this, o = this.options;
var result = []; var result = [];
var resize = function (j, i, size) { var resize = function (j, size) {
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[i]) { if (o.minColumnSize[j]) {
if (size === o.minColumnSize[i]) { if (size === o.minColumnSize[j]) {
self.resizer.element.addClass("suitable"); self.resizer.element.addClass("suitable");
} else { } else {
self.resizer.element.removeClass("suitable"); self.resizer.element.removeClass("suitable");
@ -225,7 +225,7 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
} }
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, i, size) { var stop = function (j, size) {
self.resizer.setVisible(false); self.resizer.setVisible(false);
var columnSize = o.columnSize.slice(); var columnSize = o.columnSize.slice();
columnSize[j] = size; columnSize[j] = size;
@ -247,8 +247,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
cell: col, cell: col,
suitableSize: o.minColumnSize[i], suitableSize: o.minColumnSize[i],
maxSize: o.maxColumnSize[i], maxSize: o.maxColumnSize[i],
resize: BI.bind(resize, null, j, i), resize: BI.bind(resize, null, j),
stop: BI.bind(stop, null, j, i) stop: BI.bind(stop, null, j)
}; };
if (o.isNeedMerge) { if (o.isNeedMerge) {
var r = i; var r = i;
@ -258,8 +258,8 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
cell: result[r - 1][j], cell: result[r - 1][j],
suitableSize: o.minColumnSize[i], suitableSize: o.minColumnSize[i],
maxSize: o.maxColumnSize[i], maxSize: o.maxColumnSize[i],
resize: BI.bind(resize, null, j, i), resize: BI.bind(resize, null, j),
stop: BI.bind(stop, null, j, i) stop: BI.bind(stop, null, j)
}; };
r--; r--;
} }

Loading…
Cancel
Save