Browse Source

Merge pull request #459 in VISUAL/fineui from ~WINDY/fineui:master to master

* commit '038d87c9254d3f673b024bfff20df9e0a3f0e9c3':
  更新
  update
  更新
es6
Teller 7 years ago
parent
commit
adc5af5aef
  1. 1
      demo/js/case/combo/demo.search_text_value_combo.js
  2. 2
      demo/js/widget/multiselect/demo.multi_select_combo.js
  3. 62
      dist/_fineui.min.js
  4. 140
      dist/base.js
  5. 714
      dist/bundle.js
  6. 64
      dist/bundle.min.js
  7. 2
      dist/case.js
  8. 3
      dist/demo.js
  9. 714
      dist/fineui.js
  10. 63
      dist/fineui.min.js
  11. 556
      dist/widget.js
  12. 1
      src/base/formula/formulaeditor.js
  13. 10
      src/base/single/button/buttons/button.js
  14. 67
      src/base/table/table.cell.js
  15. 62
      src/base/table/table.header.cell.js
  16. 2
      src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js
  17. 65
      src/widget/previewtable/previewtable.cell.js
  18. 65
      src/widget/previewtable/previewtable.header.cell.js
  19. 426
      src/widget/previewtable/previewtable.js

1
demo/js/case/combo/demo.search_text_value_combo.js

@ -14,6 +14,7 @@ Demo.SearchTextValueCombo = BI.inherit(BI.Widget, {
ref: function () {
combo = this;
},
warningTitle: "111",
text: "默认值",
value: 14,
width: 300,

2
demo/js/widget/multiselect/demo.multi_select_combo.js

@ -9,7 +9,7 @@ Demo.MultiSelectCombo = BI.inherit(BI.Widget, {
_createMultiSelectCombo: function () {
var self = this;
var widget = BI.createWidget({
type: "bi.multi_select_insert_no_bar_combo",
type: "bi.multi_select_insert_combo",
itemsCreator: BI.bind(this._itemsCreator, this),
width: 200,
value: {

62
dist/_fineui.min.js vendored

File diff suppressed because one or more lines are too long

140
dist/base.js vendored

@ -14740,6 +14740,7 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
break;
}
});
return value;
});
return v.replaceAll("(\\$\\{.*?\\})\\s", "$1");
},
@ -16720,19 +16721,21 @@ BI.shortcut("bi.image_button", BI.ImageButton);(function ($) {
BI.Button.superclass._init.apply(this, arguments);
var o = this.options, self = this;
if (BI.isNumber(o.height) && !o.clear && !o.block) {
this.element.css({height: o.height + "px", lineHeight: o.height + "px"});
this.element.css({height: o.height + "px", lineHeight: (o.height - 2) + "px"});
} else {
this.element.css({lineHeight: o.height + "px"});
this.element.css({lineHeight: (o.height - 2) + "px"});
}
if (BI.isKey(o.iconCls)) {
this.icon = BI.createWidget({
type: "bi.icon",
width: 18
width: 18,
height: o.height - 2
});
this.text = BI.createWidget({
type: "bi.label",
text: o.text,
value: o.value
value: o.value,
height: o.height - 2
});
BI.createWidget({
type: "bi.horizontal_auto",
@ -30069,38 +30072,41 @@ BI.NativeTableHorizontalScrollbar = BI.inherit(BI.Widget, {
}
});
BI.NativeTableHorizontalScrollbar.EVENT_SCROLL = "EVENT_SCROLL";
BI.shortcut("bi.native_table_horizontal_scrollbar", BI.NativeTableHorizontalScrollbar);/**
*
* 表格
*
* Created by GUY on 2015/9/22.
* @class BI.TableCell
* @extends BI.Single
*/
BI.TableCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.TableCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-table-cell",
textAlign: "left",
text: ""
});
},
_init: function () {
BI.TableCell.superclass._init.apply(this, arguments);
BI.createWidget({
type: "bi.label",
element: this,
whiteSpace: "nowrap",
textAlign: this.options.textAlign,
height: this.options.height,
text: this.options.text,
value: this.options.value,
lgap: 5
});
}
});
BI.shortcut("bi.native_table_horizontal_scrollbar", BI.NativeTableHorizontalScrollbar);/**
*
* 表格
*
* Created by GUY on 2015/9/22.
* @class BI.TableCell
* @extends BI.Single
*/
BI.TableCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.TableCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-table-cell",
textAlign: "left",
text: ""
});
},
_init: function () {
BI.TableCell.superclass._init.apply(this, arguments);
var o = this.options;
BI.createWidget({
type: "bi.label",
element: this,
whiteSpace: o.whiteSpace || "nowrap",
textAlign: this.options.textAlign,
height: this.options.height,
text: this.options.text,
value: this.options.value,
lgap: o.lgap,
rgap: o.rgap,
hgap: o.hgap || 5
});
}
});
BI.shortcut("bi.table_cell", BI.TableCell);/**
*
* 表格单元格
@ -32084,35 +32090,39 @@ BI.GridTableHorizontalScrollbar = BI.inherit(BI.Widget, {
}
});
BI.GridTableHorizontalScrollbar.EVENT_SCROLL = "EVENT_SCROLL";
BI.shortcut("bi.grid_table_horizontal_scrollbar", BI.GridTableHorizontalScrollbar);/**
*
* 表格
*
* Created by GUY on 2015/9/22.
* @class BI.TableHeaderCell
* @extends BI.Single
*/
BI.TableHeaderCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.TableHeaderCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-table-header-cell",
text: ""
});
},
_init: function () {
BI.TableHeaderCell.superclass._init.apply(this, arguments);
BI.createWidget({
type: "bi.label",
element: this,
textAlign: "center",
height: this.options.height,
text: this.options.text,
value: this.options.value
});
}
});
BI.shortcut("bi.grid_table_horizontal_scrollbar", BI.GridTableHorizontalScrollbar);/**
*
* 表格
*
* Created by GUY on 2015/9/22.
* @class BI.TableHeaderCell
* @extends BI.Single
*/
BI.TableHeaderCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.TableHeaderCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-table-header-cell",
text: ""
});
},
_init: function () {
BI.TableHeaderCell.superclass._init.apply(this, arguments);
var o = this.options;
BI.createWidget({
type: "bi.label",
element: this,
textAlign: o.textAlign || "center",
height: this.options.height,
text: this.options.text,
value: this.options.value,
lgap: o.lgap,
rgap: o.rgap,
hgap: o.hgap || 5
});
}
});
BI.shortcut("bi.table_header_cell", BI.TableHeaderCell);/**
*
* 表格

714
dist/bundle.js vendored

@ -50510,6 +50510,7 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
break;
}
});
return value;
});
return v.replaceAll("(\\$\\{.*?\\})\\s", "$1");
},
@ -52490,19 +52491,21 @@ BI.shortcut("bi.image_button", BI.ImageButton);(function ($) {
BI.Button.superclass._init.apply(this, arguments);
var o = this.options, self = this;
if (BI.isNumber(o.height) && !o.clear && !o.block) {
this.element.css({height: o.height + "px", lineHeight: o.height + "px"});
this.element.css({height: o.height + "px", lineHeight: (o.height - 2) + "px"});
} else {
this.element.css({lineHeight: o.height + "px"});
this.element.css({lineHeight: (o.height - 2) + "px"});
}
if (BI.isKey(o.iconCls)) {
this.icon = BI.createWidget({
type: "bi.icon",
width: 18
width: 18,
height: o.height - 2
});
this.text = BI.createWidget({
type: "bi.label",
text: o.text,
value: o.value
value: o.value,
height: o.height - 2
});
BI.createWidget({
type: "bi.horizontal_auto",
@ -65839,38 +65842,41 @@ BI.NativeTableHorizontalScrollbar = BI.inherit(BI.Widget, {
}
});
BI.NativeTableHorizontalScrollbar.EVENT_SCROLL = "EVENT_SCROLL";
BI.shortcut("bi.native_table_horizontal_scrollbar", BI.NativeTableHorizontalScrollbar);/**
*
* 表格
*
* Created by GUY on 2015/9/22.
* @class BI.TableCell
* @extends BI.Single
*/
BI.TableCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.TableCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-table-cell",
textAlign: "left",
text: ""
});
},
_init: function () {
BI.TableCell.superclass._init.apply(this, arguments);
BI.createWidget({
type: "bi.label",
element: this,
whiteSpace: "nowrap",
textAlign: this.options.textAlign,
height: this.options.height,
text: this.options.text,
value: this.options.value,
lgap: 5
});
}
});
BI.shortcut("bi.native_table_horizontal_scrollbar", BI.NativeTableHorizontalScrollbar);/**
*
* 表格
*
* Created by GUY on 2015/9/22.
* @class BI.TableCell
* @extends BI.Single
*/
BI.TableCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.TableCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-table-cell",
textAlign: "left",
text: ""
});
},
_init: function () {
BI.TableCell.superclass._init.apply(this, arguments);
var o = this.options;
BI.createWidget({
type: "bi.label",
element: this,
whiteSpace: o.whiteSpace || "nowrap",
textAlign: this.options.textAlign,
height: this.options.height,
text: this.options.text,
value: this.options.value,
lgap: o.lgap,
rgap: o.rgap,
hgap: o.hgap || 5
});
}
});
BI.shortcut("bi.table_cell", BI.TableCell);/**
*
* 表格单元格
@ -67854,35 +67860,39 @@ BI.GridTableHorizontalScrollbar = BI.inherit(BI.Widget, {
}
});
BI.GridTableHorizontalScrollbar.EVENT_SCROLL = "EVENT_SCROLL";
BI.shortcut("bi.grid_table_horizontal_scrollbar", BI.GridTableHorizontalScrollbar);/**
*
* 表格
*
* Created by GUY on 2015/9/22.
* @class BI.TableHeaderCell
* @extends BI.Single
*/
BI.TableHeaderCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.TableHeaderCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-table-header-cell",
text: ""
});
},
_init: function () {
BI.TableHeaderCell.superclass._init.apply(this, arguments);
BI.createWidget({
type: "bi.label",
element: this,
textAlign: "center",
height: this.options.height,
text: this.options.text,
value: this.options.value
});
}
});
BI.shortcut("bi.grid_table_horizontal_scrollbar", BI.GridTableHorizontalScrollbar);/**
*
* 表格
*
* Created by GUY on 2015/9/22.
* @class BI.TableHeaderCell
* @extends BI.Single
*/
BI.TableHeaderCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.TableHeaderCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-table-header-cell",
text: ""
});
},
_init: function () {
BI.TableHeaderCell.superclass._init.apply(this, arguments);
var o = this.options;
BI.createWidget({
type: "bi.label",
element: this,
textAlign: o.textAlign || "center",
height: this.options.height,
text: this.options.text,
value: this.options.value,
lgap: o.lgap,
rgap: o.rgap,
hgap: o.hgap || 5
});
}
});
BI.shortcut("bi.table_header_cell", BI.TableHeaderCell);/**
*
* 表格
@ -78632,8 +78642,10 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, {
});
if (BI.isNull(result)) {
this.element.removeClass("combo-error").addClass("combo-error");
this.trigger.attr("tipType", "warning");
} else {
this.element.removeClass("combo-error");
this.trigger.attr("tipType", "success");
}
}
},
@ -103436,272 +103448,296 @@ BI.PageTable = BI.inherit(BI.Widget, {
BI.PageTable.superclass.destroy.apply(this, arguments);
}
});
BI.shortcut("bi.page_table", BI.PageTable);/**
* 预览表列
*
* Created by GUY on 2015/12/25.
* @class BI.PreviewTableCell
* @extends BI.Widget
*/
BI.PreviewTableCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.PreviewTableCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-preview-table-cell",
text: ""
});
},
_init: function () {
BI.PreviewTableCell.superclass._init.apply(this, arguments);
var self = this, o = this.options;
BI.createWidget({
type: "bi.label",
element: this,
textAlign: "left",
whiteSpace: "normal",
height: this.options.height,
text: this.options.text,
value: this.options.value
});
}
});
BI.shortcut("bi.preview_table_cell", BI.PreviewTableCell);/**
* 预览表
*
* Created by GUY on 2015/12/25.
* @class BI.PreviewTableHeaderCell
* @extends BI.Widget
*/
BI.PreviewTableHeaderCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.PreviewTableHeaderCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-preview-table-header-cell",
text: ""
});
},
_init: function () {
BI.PreviewTableHeaderCell.superclass._init.apply(this, arguments);
var self = this, o = this.options;
BI.createWidget({
type: "bi.label",
element: this,
textAlign: "left",
whiteSpace: "normal",
height: this.options.height,
text: this.options.text,
value: this.options.value
});
}
});
BI.shortcut("bi.preview_table_header_cell", BI.PreviewTableHeaderCell);/**
* 预览表
*
* Created by GUY on 2015/12/25.
* @class BI.PreviewTable
* @extends BI.Widget
*/
BI.PreviewTable = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.PreviewTable.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-preview-table",
isNeedFreeze: false,
freezeCols: [],
rowSize: null,
columnSize: [],
headerRowSize: 30,
header: [],
items: []
});
},
_init: function () {
BI.PreviewTable.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.table = BI.createWidget({
type: "bi.table_view",
element: this,
isNeedResize: false,
isResizeAdapt: false,
isNeedFreeze: o.isNeedFreeze,
freezeCols: o.freezeCols,
rowSize: o.rowSize,
columnSize: o.columnSize,
headerRowSize: o.headerRowSize,
header: BI.map(o.header, function (i, items) {
return BI.map(items, function (j, item) {
return BI.extend({
type: "bi.preview_table_header_cell"
}, item);
});
}),
items: BI.map(o.items, function (i, items) {
return BI.map(items, function (j, item) {
return BI.extend({
type: "bi.preview_table_cell"
}, item);
});
})
});
this.table.on(BI.Table.EVENT_TABLE_AFTER_INIT, function () {
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_RESIZE, function () {
self._adjustColumns();
});
this._adjustColumns();
},
// 是否有自适应调节的列,即列宽为""
_hasAdaptCol: function (columnSize) {
return BI.any(columnSize, function (i, size) {
return size === "";
});
},
_isPercentage: function (columnSize) {
return columnSize[0] <= 1;
},
_adjustColumns: function () {
var self = this, o = this.options;
if (o.isNeedFreeze === true) {
// 如果存在百分比的情况
if (this._isPercentage(o.columnSize)) {
if (this._hasAdaptCol(o.columnSize)) {
var findCols = [], remain = 0;
BI.each(o.columnSize, function (i, size) {
if (size === "") {
findCols.push(i);
} else {
remain += size;
}
});
remain = 1 - remain;
var average = remain / findCols.length;
BI.each(findCols, function (i, col) {
o.columnSize[col] = average;
});
}
var isRight = BI.first(o.freezeCols) !== 0;
var freezeSize = [], notFreezeSize = [];
BI.each(o.columnSize, function (i, size) {
if (o.freezeCols.contains(i)) {
freezeSize.push(size);
} else {
notFreezeSize.push(size);
}
});
var sumFreezeSize = BI.sum(freezeSize), sumNotFreezeSize = BI.sum(notFreezeSize);
BI.each(freezeSize, function (i, size) {
freezeSize[i] = size / sumFreezeSize;
});
BI.each(notFreezeSize, function (i, size) {
notFreezeSize[i] = size / sumNotFreezeSize;
});
this.table.setRegionColumnSize(isRight ? ["fill", sumFreezeSize] : [sumFreezeSize, "fill"]);
this.table.setColumnSize(isRight ? (notFreezeSize.concat(freezeSize)) : (freezeSize.concat(notFreezeSize)));
}
} else {
// 如果存在自适应宽度的列或者是百分比计算的列,需要将整个表宽设为100%
if (this._hasAdaptCol(o.columnSize) || this._isPercentage(o.columnSize)) {
this.table.setRegionColumnSize(["100%"]);
}
}
},
setColumnSize: function (columnSize) {
return this.table.setColumnSize(columnSize);
},
getColumnSize: function () {
return this.table.getColumnSize();
},
getCalculateColumnSize: function () {
return this.table.getCalculateColumnSize();
},
setHeaderColumnSize: function (columnSize) {
return this.table.setHeaderColumnSize(columnSize);
},
setRegionColumnSize: function (columnSize) {
return this.table.setRegionColumnSize(columnSize);
},
getRegionColumnSize: function () {
return this.table.getRegionColumnSize();
},
getCalculateRegionColumnSize: function () {
return this.table.getCalculateRegionColumnSize();
},
getCalculateRegionRowSize: function () {
return this.table.getCalculateRegionRowSize();
},
getClientRegionColumnSize: function () {
return this.table.getClientRegionColumnSize();
},
getScrollRegionColumnSize: function () {
return this.table.getScrollRegionColumnSize();
},
getScrollRegionRowSize: function () {
return this.table.getScrollRegionRowSize();
},
hasVerticalScroll: function () {
return this.table.hasVerticalScroll();
},
setVerticalScroll: function (scrollTop) {
return this.table.setVerticalScroll(scrollTop);
},
setLeftHorizontalScroll: function (scrollLeft) {
return this.table.setLeftHorizontalScroll(scrollLeft);
},
setRightHorizontalScroll: function (scrollLeft) {
return this.table.setRightHorizontalScroll(scrollLeft);
},
getVerticalScroll: function () {
return this.table.getVerticalScroll();
},
getLeftHorizontalScroll: function () {
return this.table.getLeftHorizontalScroll();
},
getRightHorizontalScroll: function () {
return this.table.getRightHorizontalScroll();
},
getColumns: function () {
return this.table.getColumns();
},
populate: function (items, header) {
this.table.populate(items, header);
this._adjustColumns();
}
});
BI.PreviewTable.EVENT_CHANGE = "PreviewTable.EVENT_CHANGE";
BI.shortcut("bi.page_table", BI.PageTable);/**
* 预览表列
*
* Created by GUY on 2015/12/25.
* @class BI.PreviewTableCell
* @extends BI.Widget
*/
BI.PreviewTableCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.PreviewTableCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-preview-table-cell",
text: ""
});
},
_init: function () {
BI.PreviewTableCell.superclass._init.apply(this, arguments);
var self = this, o = this.options;
BI.createWidget({
type: "bi.label",
element: this,
textAlign: o.textAlign || "left",
whiteSpace: o.whiteSpace || "normal",
height: this.options.height,
text: this.options.text,
value: this.options.value,
lgap: o.lgap,
rgap: o.rgap,
hgap: o.hgap || 5
});
}
});
BI.shortcut("bi.preview_table_cell", BI.PreviewTableCell);/**
* 预览表
*
* Created by GUY on 2015/12/25.
* @class BI.PreviewTableHeaderCell
* @extends BI.Widget
*/
BI.PreviewTableHeaderCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.PreviewTableHeaderCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-preview-table-header-cell",
text: ""
});
},
_init: function () {
BI.PreviewTableHeaderCell.superclass._init.apply(this, arguments);
var self = this, o = this.options;
BI.createWidget({
type: "bi.label",
element: this,
textAlign: o.textAlign || "left",
whiteSpace: o.whiteSpace || "normal",
height: this.options.height,
text: this.options.text,
value: this.options.value,
lgap: o.lgap,
rgap: o.rgap,
hgap: o.hgap || 5
});
}
});
BI.shortcut("bi.preview_table_header_cell", BI.PreviewTableHeaderCell);/**
* 预览表
*
* Created by GUY on 2015/12/25.
* @class BI.PreviewTable
* @extends BI.Widget
*/
BI.PreviewTable = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.PreviewTable.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-preview-table",
isNeedFreeze: false,
freezeCols: [],
rowSize: null,
columnSize: [],
headerRowSize: 30,
header: [],
items: []
});
},
_init: function () {
BI.PreviewTable.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.table = BI.createWidget({
type: "bi.table_view",
element: this,
isNeedResize: false,
isResizeAdapt: false,
isNeedFreeze: o.isNeedFreeze,
freezeCols: o.freezeCols,
rowSize: o.rowSize,
columnSize: o.columnSize,
headerRowSize: o.headerRowSize,
header: BI.map(o.header, function (i, items) {
return BI.map(items, function (j, item) {
return BI.extend({
type: "bi.preview_table_header_cell"
}, item);
});
}),
items: BI.map(o.items, function (i, items) {
return BI.map(items, function (j, item) {
return BI.extend({
type: "bi.preview_table_cell"
}, item);
});
})
});
this.table.on(BI.Table.EVENT_TABLE_AFTER_INIT, function () {
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_RESIZE, function () {
self._adjustColumns();
});
this._adjustColumns();
},
// 是否有自适应调节的列,即列宽为""
_hasAdaptCol: function (columnSize) {
return BI.any(columnSize, function (i, size) {
return size === "";
});
},
_isPercentage: function (columnSize) {
return columnSize[0] <= 1;
},
_adjustColumns: function () {
var self = this, o = this.options;
if (o.isNeedFreeze === true) {
// 如果存在百分比的情况
if (this._isPercentage(o.columnSize)) {
if (this._hasAdaptCol(o.columnSize)) {
var findCols = [], remain = 0;
BI.each(o.columnSize, function (i, size) {
if (size === "") {
findCols.push(i);
} else {
remain += size;
}
});
remain = 1 - remain;
var average = remain / findCols.length;
BI.each(findCols, function (i, col) {
o.columnSize[col] = average;
});
}
var isRight = BI.first(o.freezeCols) !== 0;
var freezeSize = [], notFreezeSize = [];
BI.each(o.columnSize, function (i, size) {
if (o.freezeCols.contains(i)) {
freezeSize.push(size);
} else {
notFreezeSize.push(size);
}
});
var sumFreezeSize = BI.sum(freezeSize), sumNotFreezeSize = BI.sum(notFreezeSize);
BI.each(freezeSize, function (i, size) {
freezeSize[i] = size / sumFreezeSize;
});
BI.each(notFreezeSize, function (i, size) {
notFreezeSize[i] = size / sumNotFreezeSize;
});
this.table.setRegionColumnSize(isRight ? ["fill", sumFreezeSize] : [sumFreezeSize, "fill"]);
this.table.setColumnSize(isRight ? (notFreezeSize.concat(freezeSize)) : (freezeSize.concat(notFreezeSize)));
}
} else {
// 如果存在自适应宽度的列或者是百分比计算的列,需要将整个表宽设为100%
if (this._hasAdaptCol(o.columnSize) || this._isPercentage(o.columnSize)) {
this.table.setRegionColumnSize(["100%"]);
}
}
},
setColumnSize: function (columnSize) {
return this.table.setColumnSize(columnSize);
},
getColumnSize: function () {
return this.table.getColumnSize();
},
getCalculateColumnSize: function () {
return this.table.getCalculateColumnSize();
},
setHeaderColumnSize: function (columnSize) {
return this.table.setHeaderColumnSize(columnSize);
},
setRegionColumnSize: function (columnSize) {
return this.table.setRegionColumnSize(columnSize);
},
getRegionColumnSize: function () {
return this.table.getRegionColumnSize();
},
getCalculateRegionColumnSize: function () {
return this.table.getCalculateRegionColumnSize();
},
getCalculateRegionRowSize: function () {
return this.table.getCalculateRegionRowSize();
},
getClientRegionColumnSize: function () {
return this.table.getClientRegionColumnSize();
},
getScrollRegionColumnSize: function () {
return this.table.getScrollRegionColumnSize();
},
getScrollRegionRowSize: function () {
return this.table.getScrollRegionRowSize();
},
hasVerticalScroll: function () {
return this.table.hasVerticalScroll();
},
setVerticalScroll: function (scrollTop) {
return this.table.setVerticalScroll(scrollTop);
},
setLeftHorizontalScroll: function (scrollLeft) {
return this.table.setLeftHorizontalScroll(scrollLeft);
},
setRightHorizontalScroll: function (scrollLeft) {
return this.table.setRightHorizontalScroll(scrollLeft);
},
getVerticalScroll: function () {
return this.table.getVerticalScroll();
},
getLeftHorizontalScroll: function () {
return this.table.getLeftHorizontalScroll();
},
getRightHorizontalScroll: function () {
return this.table.getRightHorizontalScroll();
},
getColumns: function () {
return this.table.getColumns();
},
populate: function (items, header) {
if (items) {
items = BI.map(items, function (i, items) {
return BI.map(items, function (j, item) {
return BI.extend({
type: "bi.preview_table_cell"
}, item);
});
});
}
if (header) {
header = BI.map(header, function (i, items) {
return BI.map(items, function (j, item) {
return BI.extend({
type: "bi.preview_table_header_cell"
}, item);
});
});
}
this.table.populate(items, header);
this._adjustColumns();
}
});
BI.PreviewTable.EVENT_CHANGE = "PreviewTable.EVENT_CHANGE";
BI.shortcut("bi.preview_table", BI.PreviewTable);/**
* 季度下拉框
*
@ -113847,13 +113883,15 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
return result;
};
var populate = BI.Loader.prototype.populate;
BI.Loader.prototype.populate = function () {
pushContext(this);
var result = populate.apply(this, arguments);
popContext();
return result;
};
_.each(["populate", "addItems", "prependItems"], function (name) {
var old = BI.Loader.prototype[name];
BI.Loader.prototype[name] = function () {
pushContext(this);
var result = old.apply(this, arguments);
popContext();
return result;
};
});
var _init = BI.Widget.prototype._init;
BI.Widget.prototype._init = function () {

64
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/case.js vendored

@ -6163,8 +6163,10 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, {
});
if (BI.isNull(result)) {
this.element.removeClass("combo-error").addClass("combo-error");
this.trigger.attr("tipType", "warning");
} else {
this.element.removeClass("combo-error");
this.trigger.attr("tipType", "success");
}
}
},

3
dist/demo.js vendored

@ -2068,6 +2068,7 @@ Demo.SearchTextValueCombo = BI.inherit(BI.Widget, {
ref: function () {
combo = this;
},
warningTitle: "111",
text: "默认值",
value: 14,
width: 300,
@ -12762,7 +12763,7 @@ Demo.MultiSelectCombo = BI.inherit(BI.Widget, {
_createMultiSelectCombo: function () {
var self = this;
var widget = BI.createWidget({
type: "bi.multi_select_insert_no_bar_combo",
type: "bi.multi_select_insert_combo",
itemsCreator: BI.bind(this._itemsCreator, this),
width: 200,
value: {

714
dist/fineui.js vendored

@ -50753,6 +50753,7 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
break;
}
});
return value;
});
return v.replaceAll("(\\$\\{.*?\\})\\s", "$1");
},
@ -52733,19 +52734,21 @@ BI.shortcut("bi.image_button", BI.ImageButton);(function ($) {
BI.Button.superclass._init.apply(this, arguments);
var o = this.options, self = this;
if (BI.isNumber(o.height) && !o.clear && !o.block) {
this.element.css({height: o.height + "px", lineHeight: o.height + "px"});
this.element.css({height: o.height + "px", lineHeight: (o.height - 2) + "px"});
} else {
this.element.css({lineHeight: o.height + "px"});
this.element.css({lineHeight: (o.height - 2) + "px"});
}
if (BI.isKey(o.iconCls)) {
this.icon = BI.createWidget({
type: "bi.icon",
width: 18
width: 18,
height: o.height - 2
});
this.text = BI.createWidget({
type: "bi.label",
text: o.text,
value: o.value
value: o.value,
height: o.height - 2
});
BI.createWidget({
type: "bi.horizontal_auto",
@ -66082,38 +66085,41 @@ BI.NativeTableHorizontalScrollbar = BI.inherit(BI.Widget, {
}
});
BI.NativeTableHorizontalScrollbar.EVENT_SCROLL = "EVENT_SCROLL";
BI.shortcut("bi.native_table_horizontal_scrollbar", BI.NativeTableHorizontalScrollbar);/**
*
* 表格
*
* Created by GUY on 2015/9/22.
* @class BI.TableCell
* @extends BI.Single
*/
BI.TableCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.TableCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-table-cell",
textAlign: "left",
text: ""
});
},
_init: function () {
BI.TableCell.superclass._init.apply(this, arguments);
BI.createWidget({
type: "bi.label",
element: this,
whiteSpace: "nowrap",
textAlign: this.options.textAlign,
height: this.options.height,
text: this.options.text,
value: this.options.value,
lgap: 5
});
}
});
BI.shortcut("bi.native_table_horizontal_scrollbar", BI.NativeTableHorizontalScrollbar);/**
*
* 表格
*
* Created by GUY on 2015/9/22.
* @class BI.TableCell
* @extends BI.Single
*/
BI.TableCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.TableCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-table-cell",
textAlign: "left",
text: ""
});
},
_init: function () {
BI.TableCell.superclass._init.apply(this, arguments);
var o = this.options;
BI.createWidget({
type: "bi.label",
element: this,
whiteSpace: o.whiteSpace || "nowrap",
textAlign: this.options.textAlign,
height: this.options.height,
text: this.options.text,
value: this.options.value,
lgap: o.lgap,
rgap: o.rgap,
hgap: o.hgap || 5
});
}
});
BI.shortcut("bi.table_cell", BI.TableCell);/**
*
* 表格单元格
@ -68097,35 +68103,39 @@ BI.GridTableHorizontalScrollbar = BI.inherit(BI.Widget, {
}
});
BI.GridTableHorizontalScrollbar.EVENT_SCROLL = "EVENT_SCROLL";
BI.shortcut("bi.grid_table_horizontal_scrollbar", BI.GridTableHorizontalScrollbar);/**
*
* 表格
*
* Created by GUY on 2015/9/22.
* @class BI.TableHeaderCell
* @extends BI.Single
*/
BI.TableHeaderCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.TableHeaderCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-table-header-cell",
text: ""
});
},
_init: function () {
BI.TableHeaderCell.superclass._init.apply(this, arguments);
BI.createWidget({
type: "bi.label",
element: this,
textAlign: "center",
height: this.options.height,
text: this.options.text,
value: this.options.value
});
}
});
BI.shortcut("bi.grid_table_horizontal_scrollbar", BI.GridTableHorizontalScrollbar);/**
*
* 表格
*
* Created by GUY on 2015/9/22.
* @class BI.TableHeaderCell
* @extends BI.Single
*/
BI.TableHeaderCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.TableHeaderCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-table-header-cell",
text: ""
});
},
_init: function () {
BI.TableHeaderCell.superclass._init.apply(this, arguments);
var o = this.options;
BI.createWidget({
type: "bi.label",
element: this,
textAlign: o.textAlign || "center",
height: this.options.height,
text: this.options.text,
value: this.options.value,
lgap: o.lgap,
rgap: o.rgap,
hgap: o.hgap || 5
});
}
});
BI.shortcut("bi.table_header_cell", BI.TableHeaderCell);/**
*
* 表格
@ -78875,8 +78885,10 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, {
});
if (BI.isNull(result)) {
this.element.removeClass("combo-error").addClass("combo-error");
this.trigger.attr("tipType", "warning");
} else {
this.element.removeClass("combo-error");
this.trigger.attr("tipType", "success");
}
}
},
@ -103679,272 +103691,296 @@ BI.PageTable = BI.inherit(BI.Widget, {
BI.PageTable.superclass.destroy.apply(this, arguments);
}
});
BI.shortcut("bi.page_table", BI.PageTable);/**
* 预览表列
*
* Created by GUY on 2015/12/25.
* @class BI.PreviewTableCell
* @extends BI.Widget
*/
BI.PreviewTableCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.PreviewTableCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-preview-table-cell",
text: ""
});
},
_init: function () {
BI.PreviewTableCell.superclass._init.apply(this, arguments);
var self = this, o = this.options;
BI.createWidget({
type: "bi.label",
element: this,
textAlign: "left",
whiteSpace: "normal",
height: this.options.height,
text: this.options.text,
value: this.options.value
});
}
});
BI.shortcut("bi.preview_table_cell", BI.PreviewTableCell);/**
* 预览表
*
* Created by GUY on 2015/12/25.
* @class BI.PreviewTableHeaderCell
* @extends BI.Widget
*/
BI.PreviewTableHeaderCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.PreviewTableHeaderCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-preview-table-header-cell",
text: ""
});
},
_init: function () {
BI.PreviewTableHeaderCell.superclass._init.apply(this, arguments);
var self = this, o = this.options;
BI.createWidget({
type: "bi.label",
element: this,
textAlign: "left",
whiteSpace: "normal",
height: this.options.height,
text: this.options.text,
value: this.options.value
});
}
});
BI.shortcut("bi.preview_table_header_cell", BI.PreviewTableHeaderCell);/**
* 预览表
*
* Created by GUY on 2015/12/25.
* @class BI.PreviewTable
* @extends BI.Widget
*/
BI.PreviewTable = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.PreviewTable.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-preview-table",
isNeedFreeze: false,
freezeCols: [],
rowSize: null,
columnSize: [],
headerRowSize: 30,
header: [],
items: []
});
},
_init: function () {
BI.PreviewTable.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.table = BI.createWidget({
type: "bi.table_view",
element: this,
isNeedResize: false,
isResizeAdapt: false,
isNeedFreeze: o.isNeedFreeze,
freezeCols: o.freezeCols,
rowSize: o.rowSize,
columnSize: o.columnSize,
headerRowSize: o.headerRowSize,
header: BI.map(o.header, function (i, items) {
return BI.map(items, function (j, item) {
return BI.extend({
type: "bi.preview_table_header_cell"
}, item);
});
}),
items: BI.map(o.items, function (i, items) {
return BI.map(items, function (j, item) {
return BI.extend({
type: "bi.preview_table_cell"
}, item);
});
})
});
this.table.on(BI.Table.EVENT_TABLE_AFTER_INIT, function () {
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_RESIZE, function () {
self._adjustColumns();
});
this._adjustColumns();
},
// 是否有自适应调节的列,即列宽为""
_hasAdaptCol: function (columnSize) {
return BI.any(columnSize, function (i, size) {
return size === "";
});
},
_isPercentage: function (columnSize) {
return columnSize[0] <= 1;
},
_adjustColumns: function () {
var self = this, o = this.options;
if (o.isNeedFreeze === true) {
// 如果存在百分比的情况
if (this._isPercentage(o.columnSize)) {
if (this._hasAdaptCol(o.columnSize)) {
var findCols = [], remain = 0;
BI.each(o.columnSize, function (i, size) {
if (size === "") {
findCols.push(i);
} else {
remain += size;
}
});
remain = 1 - remain;
var average = remain / findCols.length;
BI.each(findCols, function (i, col) {
o.columnSize[col] = average;
});
}
var isRight = BI.first(o.freezeCols) !== 0;
var freezeSize = [], notFreezeSize = [];
BI.each(o.columnSize, function (i, size) {
if (o.freezeCols.contains(i)) {
freezeSize.push(size);
} else {
notFreezeSize.push(size);
}
});
var sumFreezeSize = BI.sum(freezeSize), sumNotFreezeSize = BI.sum(notFreezeSize);
BI.each(freezeSize, function (i, size) {
freezeSize[i] = size / sumFreezeSize;
});
BI.each(notFreezeSize, function (i, size) {
notFreezeSize[i] = size / sumNotFreezeSize;
});
this.table.setRegionColumnSize(isRight ? ["fill", sumFreezeSize] : [sumFreezeSize, "fill"]);
this.table.setColumnSize(isRight ? (notFreezeSize.concat(freezeSize)) : (freezeSize.concat(notFreezeSize)));
}
} else {
// 如果存在自适应宽度的列或者是百分比计算的列,需要将整个表宽设为100%
if (this._hasAdaptCol(o.columnSize) || this._isPercentage(o.columnSize)) {
this.table.setRegionColumnSize(["100%"]);
}
}
},
setColumnSize: function (columnSize) {
return this.table.setColumnSize(columnSize);
},
getColumnSize: function () {
return this.table.getColumnSize();
},
getCalculateColumnSize: function () {
return this.table.getCalculateColumnSize();
},
setHeaderColumnSize: function (columnSize) {
return this.table.setHeaderColumnSize(columnSize);
},
setRegionColumnSize: function (columnSize) {
return this.table.setRegionColumnSize(columnSize);
},
getRegionColumnSize: function () {
return this.table.getRegionColumnSize();
},
getCalculateRegionColumnSize: function () {
return this.table.getCalculateRegionColumnSize();
},
getCalculateRegionRowSize: function () {
return this.table.getCalculateRegionRowSize();
},
getClientRegionColumnSize: function () {
return this.table.getClientRegionColumnSize();
},
getScrollRegionColumnSize: function () {
return this.table.getScrollRegionColumnSize();
},
getScrollRegionRowSize: function () {
return this.table.getScrollRegionRowSize();
},
hasVerticalScroll: function () {
return this.table.hasVerticalScroll();
},
setVerticalScroll: function (scrollTop) {
return this.table.setVerticalScroll(scrollTop);
},
setLeftHorizontalScroll: function (scrollLeft) {
return this.table.setLeftHorizontalScroll(scrollLeft);
},
setRightHorizontalScroll: function (scrollLeft) {
return this.table.setRightHorizontalScroll(scrollLeft);
},
getVerticalScroll: function () {
return this.table.getVerticalScroll();
},
getLeftHorizontalScroll: function () {
return this.table.getLeftHorizontalScroll();
},
getRightHorizontalScroll: function () {
return this.table.getRightHorizontalScroll();
},
getColumns: function () {
return this.table.getColumns();
},
populate: function (items, header) {
this.table.populate(items, header);
this._adjustColumns();
}
});
BI.PreviewTable.EVENT_CHANGE = "PreviewTable.EVENT_CHANGE";
BI.shortcut("bi.page_table", BI.PageTable);/**
* 预览表列
*
* Created by GUY on 2015/12/25.
* @class BI.PreviewTableCell
* @extends BI.Widget
*/
BI.PreviewTableCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.PreviewTableCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-preview-table-cell",
text: ""
});
},
_init: function () {
BI.PreviewTableCell.superclass._init.apply(this, arguments);
var self = this, o = this.options;
BI.createWidget({
type: "bi.label",
element: this,
textAlign: o.textAlign || "left",
whiteSpace: o.whiteSpace || "normal",
height: this.options.height,
text: this.options.text,
value: this.options.value,
lgap: o.lgap,
rgap: o.rgap,
hgap: o.hgap || 5
});
}
});
BI.shortcut("bi.preview_table_cell", BI.PreviewTableCell);/**
* 预览表
*
* Created by GUY on 2015/12/25.
* @class BI.PreviewTableHeaderCell
* @extends BI.Widget
*/
BI.PreviewTableHeaderCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.PreviewTableHeaderCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-preview-table-header-cell",
text: ""
});
},
_init: function () {
BI.PreviewTableHeaderCell.superclass._init.apply(this, arguments);
var self = this, o = this.options;
BI.createWidget({
type: "bi.label",
element: this,
textAlign: o.textAlign || "left",
whiteSpace: o.whiteSpace || "normal",
height: this.options.height,
text: this.options.text,
value: this.options.value,
lgap: o.lgap,
rgap: o.rgap,
hgap: o.hgap || 5
});
}
});
BI.shortcut("bi.preview_table_header_cell", BI.PreviewTableHeaderCell);/**
* 预览表
*
* Created by GUY on 2015/12/25.
* @class BI.PreviewTable
* @extends BI.Widget
*/
BI.PreviewTable = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.PreviewTable.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-preview-table",
isNeedFreeze: false,
freezeCols: [],
rowSize: null,
columnSize: [],
headerRowSize: 30,
header: [],
items: []
});
},
_init: function () {
BI.PreviewTable.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.table = BI.createWidget({
type: "bi.table_view",
element: this,
isNeedResize: false,
isResizeAdapt: false,
isNeedFreeze: o.isNeedFreeze,
freezeCols: o.freezeCols,
rowSize: o.rowSize,
columnSize: o.columnSize,
headerRowSize: o.headerRowSize,
header: BI.map(o.header, function (i, items) {
return BI.map(items, function (j, item) {
return BI.extend({
type: "bi.preview_table_header_cell"
}, item);
});
}),
items: BI.map(o.items, function (i, items) {
return BI.map(items, function (j, item) {
return BI.extend({
type: "bi.preview_table_cell"
}, item);
});
})
});
this.table.on(BI.Table.EVENT_TABLE_AFTER_INIT, function () {
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_RESIZE, function () {
self._adjustColumns();
});
this._adjustColumns();
},
// 是否有自适应调节的列,即列宽为""
_hasAdaptCol: function (columnSize) {
return BI.any(columnSize, function (i, size) {
return size === "";
});
},
_isPercentage: function (columnSize) {
return columnSize[0] <= 1;
},
_adjustColumns: function () {
var self = this, o = this.options;
if (o.isNeedFreeze === true) {
// 如果存在百分比的情况
if (this._isPercentage(o.columnSize)) {
if (this._hasAdaptCol(o.columnSize)) {
var findCols = [], remain = 0;
BI.each(o.columnSize, function (i, size) {
if (size === "") {
findCols.push(i);
} else {
remain += size;
}
});
remain = 1 - remain;
var average = remain / findCols.length;
BI.each(findCols, function (i, col) {
o.columnSize[col] = average;
});
}
var isRight = BI.first(o.freezeCols) !== 0;
var freezeSize = [], notFreezeSize = [];
BI.each(o.columnSize, function (i, size) {
if (o.freezeCols.contains(i)) {
freezeSize.push(size);
} else {
notFreezeSize.push(size);
}
});
var sumFreezeSize = BI.sum(freezeSize), sumNotFreezeSize = BI.sum(notFreezeSize);
BI.each(freezeSize, function (i, size) {
freezeSize[i] = size / sumFreezeSize;
});
BI.each(notFreezeSize, function (i, size) {
notFreezeSize[i] = size / sumNotFreezeSize;
});
this.table.setRegionColumnSize(isRight ? ["fill", sumFreezeSize] : [sumFreezeSize, "fill"]);
this.table.setColumnSize(isRight ? (notFreezeSize.concat(freezeSize)) : (freezeSize.concat(notFreezeSize)));
}
} else {
// 如果存在自适应宽度的列或者是百分比计算的列,需要将整个表宽设为100%
if (this._hasAdaptCol(o.columnSize) || this._isPercentage(o.columnSize)) {
this.table.setRegionColumnSize(["100%"]);
}
}
},
setColumnSize: function (columnSize) {
return this.table.setColumnSize(columnSize);
},
getColumnSize: function () {
return this.table.getColumnSize();
},
getCalculateColumnSize: function () {
return this.table.getCalculateColumnSize();
},
setHeaderColumnSize: function (columnSize) {
return this.table.setHeaderColumnSize(columnSize);
},
setRegionColumnSize: function (columnSize) {
return this.table.setRegionColumnSize(columnSize);
},
getRegionColumnSize: function () {
return this.table.getRegionColumnSize();
},
getCalculateRegionColumnSize: function () {
return this.table.getCalculateRegionColumnSize();
},
getCalculateRegionRowSize: function () {
return this.table.getCalculateRegionRowSize();
},
getClientRegionColumnSize: function () {
return this.table.getClientRegionColumnSize();
},
getScrollRegionColumnSize: function () {
return this.table.getScrollRegionColumnSize();
},
getScrollRegionRowSize: function () {
return this.table.getScrollRegionRowSize();
},
hasVerticalScroll: function () {
return this.table.hasVerticalScroll();
},
setVerticalScroll: function (scrollTop) {
return this.table.setVerticalScroll(scrollTop);
},
setLeftHorizontalScroll: function (scrollLeft) {
return this.table.setLeftHorizontalScroll(scrollLeft);
},
setRightHorizontalScroll: function (scrollLeft) {
return this.table.setRightHorizontalScroll(scrollLeft);
},
getVerticalScroll: function () {
return this.table.getVerticalScroll();
},
getLeftHorizontalScroll: function () {
return this.table.getLeftHorizontalScroll();
},
getRightHorizontalScroll: function () {
return this.table.getRightHorizontalScroll();
},
getColumns: function () {
return this.table.getColumns();
},
populate: function (items, header) {
if (items) {
items = BI.map(items, function (i, items) {
return BI.map(items, function (j, item) {
return BI.extend({
type: "bi.preview_table_cell"
}, item);
});
});
}
if (header) {
header = BI.map(header, function (i, items) {
return BI.map(items, function (j, item) {
return BI.extend({
type: "bi.preview_table_header_cell"
}, item);
});
});
}
this.table.populate(items, header);
this._adjustColumns();
}
});
BI.PreviewTable.EVENT_CHANGE = "PreviewTable.EVENT_CHANGE";
BI.shortcut("bi.preview_table", BI.PreviewTable);/**
* 季度下拉框
*
@ -114090,13 +114126,15 @@ BI.shortcut("bi.value_chooser_pane", BI.ValueChooserPane);;(function () {
return result;
};
var populate = BI.Loader.prototype.populate;
BI.Loader.prototype.populate = function () {
pushContext(this);
var result = populate.apply(this, arguments);
popContext();
return result;
};
_.each(["populate", "addItems", "prependItems"], function (name) {
var old = BI.Loader.prototype[name];
BI.Loader.prototype[name] = function () {
pushContext(this);
var result = old.apply(this, arguments);
popContext();
return result;
};
});
var _init = BI.Widget.prototype._init;
BI.Widget.prototype._init = function () {

63
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

556
dist/widget.js vendored

@ -15824,272 +15824,296 @@ BI.PageTable = BI.inherit(BI.Widget, {
BI.PageTable.superclass.destroy.apply(this, arguments);
}
});
BI.shortcut("bi.page_table", BI.PageTable);/**
* 预览表列
*
* Created by GUY on 2015/12/25.
* @class BI.PreviewTableCell
* @extends BI.Widget
*/
BI.PreviewTableCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.PreviewTableCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-preview-table-cell",
text: ""
});
},
_init: function () {
BI.PreviewTableCell.superclass._init.apply(this, arguments);
var self = this, o = this.options;
BI.createWidget({
type: "bi.label",
element: this,
textAlign: "left",
whiteSpace: "normal",
height: this.options.height,
text: this.options.text,
value: this.options.value
});
}
});
BI.shortcut("bi.preview_table_cell", BI.PreviewTableCell);/**
* 预览表
*
* Created by GUY on 2015/12/25.
* @class BI.PreviewTableHeaderCell
* @extends BI.Widget
*/
BI.PreviewTableHeaderCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.PreviewTableHeaderCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-preview-table-header-cell",
text: ""
});
},
_init: function () {
BI.PreviewTableHeaderCell.superclass._init.apply(this, arguments);
var self = this, o = this.options;
BI.createWidget({
type: "bi.label",
element: this,
textAlign: "left",
whiteSpace: "normal",
height: this.options.height,
text: this.options.text,
value: this.options.value
});
}
});
BI.shortcut("bi.preview_table_header_cell", BI.PreviewTableHeaderCell);/**
* 预览表
*
* Created by GUY on 2015/12/25.
* @class BI.PreviewTable
* @extends BI.Widget
*/
BI.PreviewTable = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.PreviewTable.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-preview-table",
isNeedFreeze: false,
freezeCols: [],
rowSize: null,
columnSize: [],
headerRowSize: 30,
header: [],
items: []
});
},
_init: function () {
BI.PreviewTable.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.table = BI.createWidget({
type: "bi.table_view",
element: this,
isNeedResize: false,
isResizeAdapt: false,
isNeedFreeze: o.isNeedFreeze,
freezeCols: o.freezeCols,
rowSize: o.rowSize,
columnSize: o.columnSize,
headerRowSize: o.headerRowSize,
header: BI.map(o.header, function (i, items) {
return BI.map(items, function (j, item) {
return BI.extend({
type: "bi.preview_table_header_cell"
}, item);
});
}),
items: BI.map(o.items, function (i, items) {
return BI.map(items, function (j, item) {
return BI.extend({
type: "bi.preview_table_cell"
}, item);
});
})
});
this.table.on(BI.Table.EVENT_TABLE_AFTER_INIT, function () {
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_RESIZE, function () {
self._adjustColumns();
});
this._adjustColumns();
},
// 是否有自适应调节的列,即列宽为""
_hasAdaptCol: function (columnSize) {
return BI.any(columnSize, function (i, size) {
return size === "";
});
},
_isPercentage: function (columnSize) {
return columnSize[0] <= 1;
},
_adjustColumns: function () {
var self = this, o = this.options;
if (o.isNeedFreeze === true) {
// 如果存在百分比的情况
if (this._isPercentage(o.columnSize)) {
if (this._hasAdaptCol(o.columnSize)) {
var findCols = [], remain = 0;
BI.each(o.columnSize, function (i, size) {
if (size === "") {
findCols.push(i);
} else {
remain += size;
}
});
remain = 1 - remain;
var average = remain / findCols.length;
BI.each(findCols, function (i, col) {
o.columnSize[col] = average;
});
}
var isRight = BI.first(o.freezeCols) !== 0;
var freezeSize = [], notFreezeSize = [];
BI.each(o.columnSize, function (i, size) {
if (o.freezeCols.contains(i)) {
freezeSize.push(size);
} else {
notFreezeSize.push(size);
}
});
var sumFreezeSize = BI.sum(freezeSize), sumNotFreezeSize = BI.sum(notFreezeSize);
BI.each(freezeSize, function (i, size) {
freezeSize[i] = size / sumFreezeSize;
});
BI.each(notFreezeSize, function (i, size) {
notFreezeSize[i] = size / sumNotFreezeSize;
});
this.table.setRegionColumnSize(isRight ? ["fill", sumFreezeSize] : [sumFreezeSize, "fill"]);
this.table.setColumnSize(isRight ? (notFreezeSize.concat(freezeSize)) : (freezeSize.concat(notFreezeSize)));
}
} else {
// 如果存在自适应宽度的列或者是百分比计算的列,需要将整个表宽设为100%
if (this._hasAdaptCol(o.columnSize) || this._isPercentage(o.columnSize)) {
this.table.setRegionColumnSize(["100%"]);
}
}
},
setColumnSize: function (columnSize) {
return this.table.setColumnSize(columnSize);
},
getColumnSize: function () {
return this.table.getColumnSize();
},
getCalculateColumnSize: function () {
return this.table.getCalculateColumnSize();
},
setHeaderColumnSize: function (columnSize) {
return this.table.setHeaderColumnSize(columnSize);
},
setRegionColumnSize: function (columnSize) {
return this.table.setRegionColumnSize(columnSize);
},
getRegionColumnSize: function () {
return this.table.getRegionColumnSize();
},
getCalculateRegionColumnSize: function () {
return this.table.getCalculateRegionColumnSize();
},
getCalculateRegionRowSize: function () {
return this.table.getCalculateRegionRowSize();
},
getClientRegionColumnSize: function () {
return this.table.getClientRegionColumnSize();
},
getScrollRegionColumnSize: function () {
return this.table.getScrollRegionColumnSize();
},
getScrollRegionRowSize: function () {
return this.table.getScrollRegionRowSize();
},
hasVerticalScroll: function () {
return this.table.hasVerticalScroll();
},
setVerticalScroll: function (scrollTop) {
return this.table.setVerticalScroll(scrollTop);
},
setLeftHorizontalScroll: function (scrollLeft) {
return this.table.setLeftHorizontalScroll(scrollLeft);
},
setRightHorizontalScroll: function (scrollLeft) {
return this.table.setRightHorizontalScroll(scrollLeft);
},
getVerticalScroll: function () {
return this.table.getVerticalScroll();
},
getLeftHorizontalScroll: function () {
return this.table.getLeftHorizontalScroll();
},
getRightHorizontalScroll: function () {
return this.table.getRightHorizontalScroll();
},
getColumns: function () {
return this.table.getColumns();
},
populate: function (items, header) {
this.table.populate(items, header);
this._adjustColumns();
}
});
BI.PreviewTable.EVENT_CHANGE = "PreviewTable.EVENT_CHANGE";
BI.shortcut("bi.page_table", BI.PageTable);/**
* 预览表列
*
* Created by GUY on 2015/12/25.
* @class BI.PreviewTableCell
* @extends BI.Widget
*/
BI.PreviewTableCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.PreviewTableCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-preview-table-cell",
text: ""
});
},
_init: function () {
BI.PreviewTableCell.superclass._init.apply(this, arguments);
var self = this, o = this.options;
BI.createWidget({
type: "bi.label",
element: this,
textAlign: o.textAlign || "left",
whiteSpace: o.whiteSpace || "normal",
height: this.options.height,
text: this.options.text,
value: this.options.value,
lgap: o.lgap,
rgap: o.rgap,
hgap: o.hgap || 5
});
}
});
BI.shortcut("bi.preview_table_cell", BI.PreviewTableCell);/**
* 预览表
*
* Created by GUY on 2015/12/25.
* @class BI.PreviewTableHeaderCell
* @extends BI.Widget
*/
BI.PreviewTableHeaderCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.PreviewTableHeaderCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-preview-table-header-cell",
text: ""
});
},
_init: function () {
BI.PreviewTableHeaderCell.superclass._init.apply(this, arguments);
var self = this, o = this.options;
BI.createWidget({
type: "bi.label",
element: this,
textAlign: o.textAlign || "left",
whiteSpace: o.whiteSpace || "normal",
height: this.options.height,
text: this.options.text,
value: this.options.value,
lgap: o.lgap,
rgap: o.rgap,
hgap: o.hgap || 5
});
}
});
BI.shortcut("bi.preview_table_header_cell", BI.PreviewTableHeaderCell);/**
* 预览表
*
* Created by GUY on 2015/12/25.
* @class BI.PreviewTable
* @extends BI.Widget
*/
BI.PreviewTable = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.PreviewTable.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-preview-table",
isNeedFreeze: false,
freezeCols: [],
rowSize: null,
columnSize: [],
headerRowSize: 30,
header: [],
items: []
});
},
_init: function () {
BI.PreviewTable.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.table = BI.createWidget({
type: "bi.table_view",
element: this,
isNeedResize: false,
isResizeAdapt: false,
isNeedFreeze: o.isNeedFreeze,
freezeCols: o.freezeCols,
rowSize: o.rowSize,
columnSize: o.columnSize,
headerRowSize: o.headerRowSize,
header: BI.map(o.header, function (i, items) {
return BI.map(items, function (j, item) {
return BI.extend({
type: "bi.preview_table_header_cell"
}, item);
});
}),
items: BI.map(o.items, function (i, items) {
return BI.map(items, function (j, item) {
return BI.extend({
type: "bi.preview_table_cell"
}, item);
});
})
});
this.table.on(BI.Table.EVENT_TABLE_AFTER_INIT, function () {
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_RESIZE, function () {
self._adjustColumns();
});
this._adjustColumns();
},
// 是否有自适应调节的列,即列宽为""
_hasAdaptCol: function (columnSize) {
return BI.any(columnSize, function (i, size) {
return size === "";
});
},
_isPercentage: function (columnSize) {
return columnSize[0] <= 1;
},
_adjustColumns: function () {
var self = this, o = this.options;
if (o.isNeedFreeze === true) {
// 如果存在百分比的情况
if (this._isPercentage(o.columnSize)) {
if (this._hasAdaptCol(o.columnSize)) {
var findCols = [], remain = 0;
BI.each(o.columnSize, function (i, size) {
if (size === "") {
findCols.push(i);
} else {
remain += size;
}
});
remain = 1 - remain;
var average = remain / findCols.length;
BI.each(findCols, function (i, col) {
o.columnSize[col] = average;
});
}
var isRight = BI.first(o.freezeCols) !== 0;
var freezeSize = [], notFreezeSize = [];
BI.each(o.columnSize, function (i, size) {
if (o.freezeCols.contains(i)) {
freezeSize.push(size);
} else {
notFreezeSize.push(size);
}
});
var sumFreezeSize = BI.sum(freezeSize), sumNotFreezeSize = BI.sum(notFreezeSize);
BI.each(freezeSize, function (i, size) {
freezeSize[i] = size / sumFreezeSize;
});
BI.each(notFreezeSize, function (i, size) {
notFreezeSize[i] = size / sumNotFreezeSize;
});
this.table.setRegionColumnSize(isRight ? ["fill", sumFreezeSize] : [sumFreezeSize, "fill"]);
this.table.setColumnSize(isRight ? (notFreezeSize.concat(freezeSize)) : (freezeSize.concat(notFreezeSize)));
}
} else {
// 如果存在自适应宽度的列或者是百分比计算的列,需要将整个表宽设为100%
if (this._hasAdaptCol(o.columnSize) || this._isPercentage(o.columnSize)) {
this.table.setRegionColumnSize(["100%"]);
}
}
},
setColumnSize: function (columnSize) {
return this.table.setColumnSize(columnSize);
},
getColumnSize: function () {
return this.table.getColumnSize();
},
getCalculateColumnSize: function () {
return this.table.getCalculateColumnSize();
},
setHeaderColumnSize: function (columnSize) {
return this.table.setHeaderColumnSize(columnSize);
},
setRegionColumnSize: function (columnSize) {
return this.table.setRegionColumnSize(columnSize);
},
getRegionColumnSize: function () {
return this.table.getRegionColumnSize();
},
getCalculateRegionColumnSize: function () {
return this.table.getCalculateRegionColumnSize();
},
getCalculateRegionRowSize: function () {
return this.table.getCalculateRegionRowSize();
},
getClientRegionColumnSize: function () {
return this.table.getClientRegionColumnSize();
},
getScrollRegionColumnSize: function () {
return this.table.getScrollRegionColumnSize();
},
getScrollRegionRowSize: function () {
return this.table.getScrollRegionRowSize();
},
hasVerticalScroll: function () {
return this.table.hasVerticalScroll();
},
setVerticalScroll: function (scrollTop) {
return this.table.setVerticalScroll(scrollTop);
},
setLeftHorizontalScroll: function (scrollLeft) {
return this.table.setLeftHorizontalScroll(scrollLeft);
},
setRightHorizontalScroll: function (scrollLeft) {
return this.table.setRightHorizontalScroll(scrollLeft);
},
getVerticalScroll: function () {
return this.table.getVerticalScroll();
},
getLeftHorizontalScroll: function () {
return this.table.getLeftHorizontalScroll();
},
getRightHorizontalScroll: function () {
return this.table.getRightHorizontalScroll();
},
getColumns: function () {
return this.table.getColumns();
},
populate: function (items, header) {
if (items) {
items = BI.map(items, function (i, items) {
return BI.map(items, function (j, item) {
return BI.extend({
type: "bi.preview_table_cell"
}, item);
});
});
}
if (header) {
header = BI.map(header, function (i, items) {
return BI.map(items, function (j, item) {
return BI.extend({
type: "bi.preview_table_header_cell"
}, item);
});
});
}
this.table.populate(items, header);
this._adjustColumns();
}
});
BI.PreviewTable.EVENT_CHANGE = "PreviewTable.EVENT_CHANGE";
BI.shortcut("bi.preview_table", BI.PreviewTable);/**
* 季度下拉框
*

1
src/base/formula/formulaeditor.js

@ -217,6 +217,7 @@ BI.FormulaEditor = BI.inherit(BI.Single, {
break;
}
});
return value;
});
return v.replaceAll("(\\$\\{.*?\\})\\s", "$1");
},

10
src/base/single/button/buttons/button.js

@ -42,19 +42,21 @@
BI.Button.superclass._init.apply(this, arguments);
var o = this.options, self = this;
if (BI.isNumber(o.height) && !o.clear && !o.block) {
this.element.css({height: o.height + "px", lineHeight: o.height + "px"});
this.element.css({height: o.height + "px", lineHeight: (o.height - 2) + "px"});
} else {
this.element.css({lineHeight: o.height + "px"});
this.element.css({lineHeight: (o.height - 2) + "px"});
}
if (BI.isKey(o.iconCls)) {
this.icon = BI.createWidget({
type: "bi.icon",
width: 18
width: 18,
height: o.height - 2
});
this.text = BI.createWidget({
type: "bi.label",
text: o.text,
value: o.value
value: o.value,
height: o.height - 2
});
BI.createWidget({
type: "bi.horizontal_auto",

67
src/base/table/table.cell.js

@ -1,33 +1,36 @@
/**
*
* 表格
*
* Created by GUY on 2015/9/22.
* @class BI.TableCell
* @extends BI.Single
*/
BI.TableCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.TableCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-table-cell",
textAlign: "left",
text: ""
});
},
_init: function () {
BI.TableCell.superclass._init.apply(this, arguments);
BI.createWidget({
type: "bi.label",
element: this,
whiteSpace: "nowrap",
textAlign: this.options.textAlign,
height: this.options.height,
text: this.options.text,
value: this.options.value,
lgap: 5
});
}
});
/**
*
* 表格
*
* Created by GUY on 2015/9/22.
* @class BI.TableCell
* @extends BI.Single
*/
BI.TableCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.TableCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-table-cell",
textAlign: "left",
text: ""
});
},
_init: function () {
BI.TableCell.superclass._init.apply(this, arguments);
var o = this.options;
BI.createWidget({
type: "bi.label",
element: this,
whiteSpace: o.whiteSpace || "nowrap",
textAlign: this.options.textAlign,
height: this.options.height,
text: this.options.text,
value: this.options.value,
lgap: o.lgap,
rgap: o.rgap,
hgap: o.hgap || 5
});
}
});
BI.shortcut("bi.table_cell", BI.TableCell);

62
src/base/table/table.header.cell.js

@ -1,30 +1,34 @@
/**
*
* 表格
*
* Created by GUY on 2015/9/22.
* @class BI.TableHeaderCell
* @extends BI.Single
*/
BI.TableHeaderCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.TableHeaderCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-table-header-cell",
text: ""
});
},
_init: function () {
BI.TableHeaderCell.superclass._init.apply(this, arguments);
BI.createWidget({
type: "bi.label",
element: this,
textAlign: "center",
height: this.options.height,
text: this.options.text,
value: this.options.value
});
}
});
/**
*
* 表格
*
* Created by GUY on 2015/9/22.
* @class BI.TableHeaderCell
* @extends BI.Single
*/
BI.TableHeaderCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.TableHeaderCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-table-header-cell",
text: ""
});
},
_init: function () {
BI.TableHeaderCell.superclass._init.apply(this, arguments);
var o = this.options;
BI.createWidget({
type: "bi.label",
element: this,
textAlign: o.textAlign || "center",
height: this.options.height,
text: this.options.text,
value: this.options.value,
lgap: o.lgap,
rgap: o.rgap,
hgap: o.hgap || 5
});
}
});
BI.shortcut("bi.table_header_cell", BI.TableHeaderCell);

2
src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js

@ -125,8 +125,10 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, {
});
if (BI.isNull(result)) {
this.element.removeClass("combo-error").addClass("combo-error");
this.trigger.attr("tipType", "warning");
} else {
this.element.removeClass("combo-error");
this.trigger.attr("tipType", "success");
}
}
},

65
src/widget/previewtable/previewtable.cell.js

@ -1,32 +1,35 @@
/**
* 预览表列
*
* Created by GUY on 2015/12/25.
* @class BI.PreviewTableCell
* @extends BI.Widget
*/
BI.PreviewTableCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.PreviewTableCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-preview-table-cell",
text: ""
});
},
_init: function () {
BI.PreviewTableCell.superclass._init.apply(this, arguments);
var self = this, o = this.options;
BI.createWidget({
type: "bi.label",
element: this,
textAlign: "left",
whiteSpace: "normal",
height: this.options.height,
text: this.options.text,
value: this.options.value
});
}
});
/**
* 预览表列
*
* Created by GUY on 2015/12/25.
* @class BI.PreviewTableCell
* @extends BI.Widget
*/
BI.PreviewTableCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.PreviewTableCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-preview-table-cell",
text: ""
});
},
_init: function () {
BI.PreviewTableCell.superclass._init.apply(this, arguments);
var self = this, o = this.options;
BI.createWidget({
type: "bi.label",
element: this,
textAlign: o.textAlign || "left",
whiteSpace: o.whiteSpace || "normal",
height: this.options.height,
text: this.options.text,
value: this.options.value,
lgap: o.lgap,
rgap: o.rgap,
hgap: o.hgap || 5
});
}
});
BI.shortcut("bi.preview_table_cell", BI.PreviewTableCell);

65
src/widget/previewtable/previewtable.header.cell.js

@ -1,32 +1,35 @@
/**
* 预览表
*
* Created by GUY on 2015/12/25.
* @class BI.PreviewTableHeaderCell
* @extends BI.Widget
*/
BI.PreviewTableHeaderCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.PreviewTableHeaderCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-preview-table-header-cell",
text: ""
});
},
_init: function () {
BI.PreviewTableHeaderCell.superclass._init.apply(this, arguments);
var self = this, o = this.options;
BI.createWidget({
type: "bi.label",
element: this,
textAlign: "left",
whiteSpace: "normal",
height: this.options.height,
text: this.options.text,
value: this.options.value
});
}
});
/**
* 预览表
*
* Created by GUY on 2015/12/25.
* @class BI.PreviewTableHeaderCell
* @extends BI.Widget
*/
BI.PreviewTableHeaderCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.PreviewTableHeaderCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-preview-table-header-cell",
text: ""
});
},
_init: function () {
BI.PreviewTableHeaderCell.superclass._init.apply(this, arguments);
var self = this, o = this.options;
BI.createWidget({
type: "bi.label",
element: this,
textAlign: o.textAlign || "left",
whiteSpace: o.whiteSpace || "normal",
height: this.options.height,
text: this.options.text,
value: this.options.value,
lgap: o.lgap,
rgap: o.rgap,
hgap: o.hgap || 5
});
}
});
BI.shortcut("bi.preview_table_header_cell", BI.PreviewTableHeaderCell);

426
src/widget/previewtable/previewtable.js

@ -1,205 +1,223 @@
/**
* 预览表
*
* Created by GUY on 2015/12/25.
* @class BI.PreviewTable
* @extends BI.Widget
*/
BI.PreviewTable = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.PreviewTable.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-preview-table",
isNeedFreeze: false,
freezeCols: [],
rowSize: null,
columnSize: [],
headerRowSize: 30,
header: [],
items: []
});
},
_init: function () {
BI.PreviewTable.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.table = BI.createWidget({
type: "bi.table_view",
element: this,
isNeedResize: false,
isResizeAdapt: false,
isNeedFreeze: o.isNeedFreeze,
freezeCols: o.freezeCols,
rowSize: o.rowSize,
columnSize: o.columnSize,
headerRowSize: o.headerRowSize,
header: BI.map(o.header, function (i, items) {
return BI.map(items, function (j, item) {
return BI.extend({
type: "bi.preview_table_header_cell"
}, item);
});
}),
items: BI.map(o.items, function (i, items) {
return BI.map(items, function (j, item) {
return BI.extend({
type: "bi.preview_table_cell"
}, item);
});
})
});
this.table.on(BI.Table.EVENT_TABLE_AFTER_INIT, function () {
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_RESIZE, function () {
self._adjustColumns();
});
this._adjustColumns();
},
// 是否有自适应调节的列,即列宽为""
_hasAdaptCol: function (columnSize) {
return BI.any(columnSize, function (i, size) {
return size === "";
});
},
_isPercentage: function (columnSize) {
return columnSize[0] <= 1;
},
_adjustColumns: function () {
var self = this, o = this.options;
if (o.isNeedFreeze === true) {
// 如果存在百分比的情况
if (this._isPercentage(o.columnSize)) {
if (this._hasAdaptCol(o.columnSize)) {
var findCols = [], remain = 0;
BI.each(o.columnSize, function (i, size) {
if (size === "") {
findCols.push(i);
} else {
remain += size;
}
});
remain = 1 - remain;
var average = remain / findCols.length;
BI.each(findCols, function (i, col) {
o.columnSize[col] = average;
});
}
var isRight = BI.first(o.freezeCols) !== 0;
var freezeSize = [], notFreezeSize = [];
BI.each(o.columnSize, function (i, size) {
if (o.freezeCols.contains(i)) {
freezeSize.push(size);
} else {
notFreezeSize.push(size);
}
});
var sumFreezeSize = BI.sum(freezeSize), sumNotFreezeSize = BI.sum(notFreezeSize);
BI.each(freezeSize, function (i, size) {
freezeSize[i] = size / sumFreezeSize;
});
BI.each(notFreezeSize, function (i, size) {
notFreezeSize[i] = size / sumNotFreezeSize;
});
this.table.setRegionColumnSize(isRight ? ["fill", sumFreezeSize] : [sumFreezeSize, "fill"]);
this.table.setColumnSize(isRight ? (notFreezeSize.concat(freezeSize)) : (freezeSize.concat(notFreezeSize)));
}
} else {
// 如果存在自适应宽度的列或者是百分比计算的列,需要将整个表宽设为100%
if (this._hasAdaptCol(o.columnSize) || this._isPercentage(o.columnSize)) {
this.table.setRegionColumnSize(["100%"]);
}
}
},
setColumnSize: function (columnSize) {
return this.table.setColumnSize(columnSize);
},
getColumnSize: function () {
return this.table.getColumnSize();
},
getCalculateColumnSize: function () {
return this.table.getCalculateColumnSize();
},
setHeaderColumnSize: function (columnSize) {
return this.table.setHeaderColumnSize(columnSize);
},
setRegionColumnSize: function (columnSize) {
return this.table.setRegionColumnSize(columnSize);
},
getRegionColumnSize: function () {
return this.table.getRegionColumnSize();
},
getCalculateRegionColumnSize: function () {
return this.table.getCalculateRegionColumnSize();
},
getCalculateRegionRowSize: function () {
return this.table.getCalculateRegionRowSize();
},
getClientRegionColumnSize: function () {
return this.table.getClientRegionColumnSize();
},
getScrollRegionColumnSize: function () {
return this.table.getScrollRegionColumnSize();
},
getScrollRegionRowSize: function () {
return this.table.getScrollRegionRowSize();
},
hasVerticalScroll: function () {
return this.table.hasVerticalScroll();
},
setVerticalScroll: function (scrollTop) {
return this.table.setVerticalScroll(scrollTop);
},
setLeftHorizontalScroll: function (scrollLeft) {
return this.table.setLeftHorizontalScroll(scrollLeft);
},
setRightHorizontalScroll: function (scrollLeft) {
return this.table.setRightHorizontalScroll(scrollLeft);
},
getVerticalScroll: function () {
return this.table.getVerticalScroll();
},
getLeftHorizontalScroll: function () {
return this.table.getLeftHorizontalScroll();
},
getRightHorizontalScroll: function () {
return this.table.getRightHorizontalScroll();
},
getColumns: function () {
return this.table.getColumns();
},
populate: function (items, header) {
this.table.populate(items, header);
this._adjustColumns();
}
});
BI.PreviewTable.EVENT_CHANGE = "PreviewTable.EVENT_CHANGE";
/**
* 预览表
*
* Created by GUY on 2015/12/25.
* @class BI.PreviewTable
* @extends BI.Widget
*/
BI.PreviewTable = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.PreviewTable.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-preview-table",
isNeedFreeze: false,
freezeCols: [],
rowSize: null,
columnSize: [],
headerRowSize: 30,
header: [],
items: []
});
},
_init: function () {
BI.PreviewTable.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.table = BI.createWidget({
type: "bi.table_view",
element: this,
isNeedResize: false,
isResizeAdapt: false,
isNeedFreeze: o.isNeedFreeze,
freezeCols: o.freezeCols,
rowSize: o.rowSize,
columnSize: o.columnSize,
headerRowSize: o.headerRowSize,
header: BI.map(o.header, function (i, items) {
return BI.map(items, function (j, item) {
return BI.extend({
type: "bi.preview_table_header_cell"
}, item);
});
}),
items: BI.map(o.items, function (i, items) {
return BI.map(items, function (j, item) {
return BI.extend({
type: "bi.preview_table_cell"
}, item);
});
})
});
this.table.on(BI.Table.EVENT_TABLE_AFTER_INIT, function () {
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_RESIZE, function () {
self._adjustColumns();
});
this._adjustColumns();
},
// 是否有自适应调节的列,即列宽为""
_hasAdaptCol: function (columnSize) {
return BI.any(columnSize, function (i, size) {
return size === "";
});
},
_isPercentage: function (columnSize) {
return columnSize[0] <= 1;
},
_adjustColumns: function () {
var self = this, o = this.options;
if (o.isNeedFreeze === true) {
// 如果存在百分比的情况
if (this._isPercentage(o.columnSize)) {
if (this._hasAdaptCol(o.columnSize)) {
var findCols = [], remain = 0;
BI.each(o.columnSize, function (i, size) {
if (size === "") {
findCols.push(i);
} else {
remain += size;
}
});
remain = 1 - remain;
var average = remain / findCols.length;
BI.each(findCols, function (i, col) {
o.columnSize[col] = average;
});
}
var isRight = BI.first(o.freezeCols) !== 0;
var freezeSize = [], notFreezeSize = [];
BI.each(o.columnSize, function (i, size) {
if (o.freezeCols.contains(i)) {
freezeSize.push(size);
} else {
notFreezeSize.push(size);
}
});
var sumFreezeSize = BI.sum(freezeSize), sumNotFreezeSize = BI.sum(notFreezeSize);
BI.each(freezeSize, function (i, size) {
freezeSize[i] = size / sumFreezeSize;
});
BI.each(notFreezeSize, function (i, size) {
notFreezeSize[i] = size / sumNotFreezeSize;
});
this.table.setRegionColumnSize(isRight ? ["fill", sumFreezeSize] : [sumFreezeSize, "fill"]);
this.table.setColumnSize(isRight ? (notFreezeSize.concat(freezeSize)) : (freezeSize.concat(notFreezeSize)));
}
} else {
// 如果存在自适应宽度的列或者是百分比计算的列,需要将整个表宽设为100%
if (this._hasAdaptCol(o.columnSize) || this._isPercentage(o.columnSize)) {
this.table.setRegionColumnSize(["100%"]);
}
}
},
setColumnSize: function (columnSize) {
return this.table.setColumnSize(columnSize);
},
getColumnSize: function () {
return this.table.getColumnSize();
},
getCalculateColumnSize: function () {
return this.table.getCalculateColumnSize();
},
setHeaderColumnSize: function (columnSize) {
return this.table.setHeaderColumnSize(columnSize);
},
setRegionColumnSize: function (columnSize) {
return this.table.setRegionColumnSize(columnSize);
},
getRegionColumnSize: function () {
return this.table.getRegionColumnSize();
},
getCalculateRegionColumnSize: function () {
return this.table.getCalculateRegionColumnSize();
},
getCalculateRegionRowSize: function () {
return this.table.getCalculateRegionRowSize();
},
getClientRegionColumnSize: function () {
return this.table.getClientRegionColumnSize();
},
getScrollRegionColumnSize: function () {
return this.table.getScrollRegionColumnSize();
},
getScrollRegionRowSize: function () {
return this.table.getScrollRegionRowSize();
},
hasVerticalScroll: function () {
return this.table.hasVerticalScroll();
},
setVerticalScroll: function (scrollTop) {
return this.table.setVerticalScroll(scrollTop);
},
setLeftHorizontalScroll: function (scrollLeft) {
return this.table.setLeftHorizontalScroll(scrollLeft);
},
setRightHorizontalScroll: function (scrollLeft) {
return this.table.setRightHorizontalScroll(scrollLeft);
},
getVerticalScroll: function () {
return this.table.getVerticalScroll();
},
getLeftHorizontalScroll: function () {
return this.table.getLeftHorizontalScroll();
},
getRightHorizontalScroll: function () {
return this.table.getRightHorizontalScroll();
},
getColumns: function () {
return this.table.getColumns();
},
populate: function (items, header) {
if (items) {
items = BI.map(items, function (i, items) {
return BI.map(items, function (j, item) {
return BI.extend({
type: "bi.preview_table_cell"
}, item);
});
});
}
if (header) {
header = BI.map(header, function (i, items) {
return BI.map(items, function (j, item) {
return BI.extend({
type: "bi.preview_table_header_cell"
}, item);
});
});
}
this.table.populate(items, header);
this._adjustColumns();
}
});
BI.PreviewTable.EVENT_CHANGE = "PreviewTable.EVENT_CHANGE";
BI.shortcut("bi.preview_table", BI.PreviewTable);
Loading…
Cancel
Save