|
|
@ -32403,6 +32403,9 @@ BI.ResizableTableCell = BI.inherit(BI.Widget, { |
|
|
|
return BI.extend(BI.ResizableTableCell.superclass._defaultConfig.apply(this, arguments), { |
|
|
|
return BI.extend(BI.ResizableTableCell.superclass._defaultConfig.apply(this, arguments), { |
|
|
|
baseCls: "bi-resizable-table-cell", |
|
|
|
baseCls: "bi-resizable-table-cell", |
|
|
|
cell: {}, |
|
|
|
cell: {}, |
|
|
|
|
|
|
|
minSize: 15, |
|
|
|
|
|
|
|
// suitableSize,
|
|
|
|
|
|
|
|
maxSize: Number.MAX_VALUE, |
|
|
|
start: BI.emptyFn, |
|
|
|
start: BI.emptyFn, |
|
|
|
resize: BI.emptyFn, |
|
|
|
resize: BI.emptyFn, |
|
|
|
stop: BI.emptyFn |
|
|
|
stop: BI.emptyFn |
|
|
@ -32416,22 +32419,37 @@ 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) { |
|
|
|
|
|
|
|
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) { |
|
|
|
var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX, deltaY) { |
|
|
|
if (mouseMoveTracker.isDragging()) { |
|
|
|
if (mouseMoveTracker.isDragging()) { |
|
|
|
startDrag = true; |
|
|
|
startDrag = true; |
|
|
|
offset += deltaX; |
|
|
|
offset += deltaX; |
|
|
|
size = BI.clamp(defaultSize + offset, 15, Number.MAX_VALUE); |
|
|
|
size = optimizeSize(defaultSize + offset); |
|
|
|
self.handler.element.addClass("dragging"); |
|
|
|
self.handler.element.addClass("dragging"); |
|
|
|
o.resize(size); |
|
|
|
o.resize(size); |
|
|
|
} |
|
|
|
} |
|
|
|
}, function () { |
|
|
|
}, function () { |
|
|
|
if (startDrag === true) { |
|
|
|
if (startDrag === true) { |
|
|
|
size = BI.clamp(size, 15, Number.MAX_VALUE); |
|
|
|
size = optimizeSize(size); |
|
|
|
o.stop(size); |
|
|
|
o.stop(size); |
|
|
|
size = 0; |
|
|
|
size = 0; |
|
|
|
offset = 0; |
|
|
|
offset = 0; |
|
|
|
defaultSize = o.width; |
|
|
|
defaultSize = o.width; |
|
|
|
self.handler.element.removeClass("dragging"); |
|
|
|
self.handler.element.removeClass("dragging"); |
|
|
|
|
|
|
|
self.handler.element.removeClass("suitable"); |
|
|
|
startDrag = false; |
|
|
|
startDrag = false; |
|
|
|
} |
|
|
|
} |
|
|
|
mouseMoveTracker.releaseMouseMoves(); |
|
|
|
mouseMoveTracker.releaseMouseMoves(); |
|
|
@ -32699,14 +32717,20 @@ 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, size) { |
|
|
|
var resize = function (j, i, 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 (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); |
|
|
|
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); |
|
|
|
self.resizer.setVisible(false); |
|
|
|
var columnSize = o.columnSize.slice(); |
|
|
|
var columnSize = o.columnSize.slice(); |
|
|
|
columnSize[j] = size; |
|
|
|
columnSize[j] = size; |
|
|
@ -32726,8 +32750,10 @@ 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, |
|
|
|
resize: BI.bind(resize, null, j), |
|
|
|
suitableSize: o.minColumnSize[i], |
|
|
|
stop: BI.bind(stop, null, j) |
|
|
|
maxSize: o.maxColumnSize[i], |
|
|
|
|
|
|
|
resize: BI.bind(resize, null, j, i), |
|
|
|
|
|
|
|
stop: BI.bind(stop, null, j, i) |
|
|
|
}; |
|
|
|
}; |
|
|
|
if (o.isNeedMerge) { |
|
|
|
if (o.isNeedMerge) { |
|
|
|
var r = i; |
|
|
|
var r = i; |
|
|
@ -32735,8 +32761,10 @@ 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], |
|
|
|
resize: BI.bind(resize, null, j), |
|
|
|
suitableSize: o.minColumnSize[i], |
|
|
|
stop: BI.bind(stop, null, j) |
|
|
|
maxSize: o.maxColumnSize[i], |
|
|
|
|
|
|
|
resize: BI.bind(resize, null, j, i), |
|
|
|
|
|
|
|
stop: BI.bind(stop, null, j, i) |
|
|
|
}; |
|
|
|
}; |
|
|
|
r--; |
|
|
|
r--; |
|
|
|
} |
|
|
|
} |
|
|
|