|
|
|
@ -32403,6 +32403,9 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, {
|
|
|
|
|
return BI.extend(BI.ResizableTableCell.superclass._defaultConfig.apply(this, arguments), { |
|
|
|
|
baseCls: "bi-resizable-table-cell", |
|
|
|
|
cell: {}, |
|
|
|
|
minSize: 15, |
|
|
|
|
// suitableSize,
|
|
|
|
|
maxSize: Number.MAX_VALUE, |
|
|
|
|
start: BI.emptyFn, |
|
|
|
|
resize: BI.emptyFn, |
|
|
|
|
stop: BI.emptyFn |
|
|
|
@ -32416,22 +32419,37 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, {
|
|
|
|
|
|
|
|
|
|
var startDrag = false; |
|
|
|
|
var size = 0, offset = 0, defaultSize = o.width; |
|
|
|
|
|
|
|
|
|
function optimizeSize(size) { |
|
|
|
|
size = BI.clamp(size, o.minSize, o.maxSize || Number.MAX_VALUE); |
|
|
|
|
if (o.suitableSize) { |
|
|
|
|
if (Math.abs(o.suitableSize - size) < 5) { |
|
|
|
|
size = o.suitableSize; |
|
|
|
|
self.handler.element.addClass("suitable"); |
|
|
|
|
} else { |
|
|
|
|
self.handler.element.removeClass("suitable"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return size; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX, deltaY) { |
|
|
|
|
if (mouseMoveTracker.isDragging()) { |
|
|
|
|
startDrag = true; |
|
|
|
|
offset += deltaX; |
|
|
|
|
size = BI.clamp(defaultSize + offset, 15, Number.MAX_VALUE); |
|
|
|
|
size = optimizeSize(defaultSize + offset); |
|
|
|
|
self.handler.element.addClass("dragging"); |
|
|
|
|
o.resize(size); |
|
|
|
|
} |
|
|
|
|
}, function () { |
|
|
|
|
if (startDrag === true) { |
|
|
|
|
size = BI.clamp(size, 15, Number.MAX_VALUE); |
|
|
|
|
size = optimizeSize(size); |
|
|
|
|
o.stop(size); |
|
|
|
|
size = 0; |
|
|
|
|
offset = 0; |
|
|
|
|
defaultSize = o.width; |
|
|
|
|
self.handler.element.removeClass("dragging"); |
|
|
|
|
self.handler.element.removeClass("suitable"); |
|
|
|
|
startDrag = false; |
|
|
|
|
} |
|
|
|
|
mouseMoveTracker.releaseMouseMoves(); |
|
|
|
@ -32699,14 +32717,20 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
|
|
|
|
|
_formatHeader: function (header) { |
|
|
|
|
var self = this, o = this.options; |
|
|
|
|
var result = []; |
|
|
|
|
var resize = function (j, size) { |
|
|
|
|
var resize = function (j, i, size) { |
|
|
|
|
self.resizer.setVisible(true); |
|
|
|
|
var height = o.headerRowSize + self._getRegionRowSize()[1]; |
|
|
|
|
self.resizer.setHeight(height); |
|
|
|
|
|
|
|
|
|
if (o.minColumnSize[i]) { |
|
|
|
|
if (Math.abs(size - o.minColumnSize[i]) < 5) { |
|
|
|
|
self.resizer.element.addClass("suitable"); |
|
|
|
|
} else { |
|
|
|
|
self.resizer.element.removeClass("suitable"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
self._setResizerPosition(self._getResizerLeft(j) + size, (o.header.length - 1) * o.headerRowSize); |
|
|
|
|
}; |
|
|
|
|
var stop = function (j, size) { |
|
|
|
|
var stop = function (j, i, size) { |
|
|
|
|
self.resizer.setVisible(false); |
|
|
|
|
var columnSize = o.columnSize.slice(); |
|
|
|
|
columnSize[j] = size; |
|
|
|
@ -32726,8 +32750,10 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
|
|
|
|
|
result[i][j] = { |
|
|
|
|
type: "bi.resizable_table_cell", |
|
|
|
|
cell: col, |
|
|
|
|
resize: BI.bind(resize, null, j), |
|
|
|
|
stop: BI.bind(stop, null, j) |
|
|
|
|
suitableSize: o.minColumnSize[i], |
|
|
|
|
maxSize: o.maxColumnSize[i], |
|
|
|
|
resize: BI.bind(resize, null, j, i), |
|
|
|
|
stop: BI.bind(stop, null, j, i) |
|
|
|
|
}; |
|
|
|
|
if (o.isNeedMerge) { |
|
|
|
|
var r = i; |
|
|
|
@ -32735,8 +32761,10 @@ BI.ResizableTable = BI.inherit(BI.Widget, {
|
|
|
|
|
result[r - 1][j] = { |
|
|
|
|
type: "bi.resizable_table_cell", |
|
|
|
|
cell: result[r - 1][j], |
|
|
|
|
resize: BI.bind(resize, null, j), |
|
|
|
|
stop: BI.bind(stop, null, j) |
|
|
|
|
suitableSize: o.minColumnSize[i], |
|
|
|
|
maxSize: o.maxColumnSize[i], |
|
|
|
|
resize: BI.bind(resize, null, j, i), |
|
|
|
|
stop: BI.bind(stop, null, j, i) |
|
|
|
|
}; |
|
|
|
|
r--; |
|
|
|
|
} |
|
|
|
|