Browse Source

整理

master
guy 8 years ago
parent
commit
826705f98a
  1. 0
      demo/js/base/button/demo.button.js
  2. 0
      demo/js/base/button/demo.icon_button.js
  3. 0
      demo/js/base/button/demo.image_button.js
  4. 0
      demo/js/base/button/demo.text_button.js
  5. 0
      demo/js/base/editor/demo.code_editor.js
  6. 0
      demo/js/base/editor/demo.editor.js
  7. 0
      demo/js/base/editor/demo.formula_editor.js
  8. 0
      demo/js/base/editor/demo.multifile_editor.js
  9. 0
      demo/js/base/editor/demo.textarea_editor.js
  10. 62
      demo/js/base/table/demo.collection_table.js
  11. 57
      demo/js/base/table/demo.grid_table.js
  12. 367
      demo/js/base/table/demo.table_view.js
  13. 0
      demo/js/base/tip/demo.bubble.js
  14. 0
      demo/js/base/tip/demo.title.js
  15. 0
      demo/js/base/tip/demo.toast.js
  16. 233
      demo/js/case/tree/demo.branch_tree.js
  17. 43
      demo/js/case/tree/demo.display_tree.js
  18. 103
      demo/js/case/tree/demo.handstand_branch_tree.js
  19. 87
      demo/js/case/tree/demo.level_tree.js
  20. 86
      demo/js/case/tree/demo.simple_tree.js
  21. 9
      demo/js/config/base.js
  22. 140
      demo/js/config/case.js
  23. 4
      demo/js/config/core.js
  24. 39
      demo/js/core/abstract/demo.collection_view.js
  25. 50
      demo/js/core/abstract/demo.grid_view.js
  26. 6
      dist/base.css
  27. 190
      dist/base.js
  28. 3
      dist/core.js
  29. 190
      src/base/table/table.js
  30. 3
      src/core/proto/array.js
  31. 6
      src/css/base/tree/display.tree.css
  32. 6
      src/less/base/tree/display.tree.less

0
demo/js/base/demo.button.js → demo/js/base/button/demo.button.js

0
demo/js/base/demo.icon_button.js → demo/js/base/button/demo.icon_button.js

0
demo/js/base/demo.image_button.js → demo/js/base/button/demo.image_button.js

0
demo/js/base/demo.text_button.js → demo/js/base/button/demo.text_button.js

0
demo/js/base/demo.code_editor.js → demo/js/base/editor/demo.code_editor.js

0
demo/js/base/demo.editor.js → demo/js/base/editor/demo.editor.js

0
demo/js/base/demo.formula_editor.js → demo/js/base/editor/demo.formula_editor.js

0
demo/js/base/demo.multifile_editor.js → demo/js/base/editor/demo.multifile_editor.js

0
demo/js/base/demo.textarea_editor.js → demo/js/base/editor/demo.textarea_editor.js

62
demo/js/base/table/demo.collection_table.js

@ -0,0 +1,62 @@
Demo.Func = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-func"
},
render: function () {
var items = [], header = [], columnSize = [];
var rowCount = 100, columnCount = 100;
for (var i = 0; i < 1; i++) {
header[i] = [];
for (var j = 0; j < columnCount; j++) {
header[i][j] = {
type: "bi.label",
text: "表头" + i + "-" + j
}
columnSize[j] = 100;
}
}
for (var i = 0; i < rowCount; i++) {
items[i] = [];
for (var j = 0; j < columnCount; j++) {
items[i][j] = {
type: "bi.label",
text: (i < 3 ? 0 : i) + "-" + j
}
}
}
var table = BI.createWidget({
type: "bi.resizable_table",
el: {
type: "bi.collection_table"
},
width: 600,
height: 500,
isResizeAdapt: true,
isNeedResize: true,
isNeedMerge: true,
mergeCols: [0, 1],
mergeRule: function (col1, col2) {
return BI.isEqual(col1, col2);
},
isNeedFreeze: true,
freezeCols: [0, 1],
columnSize: columnSize,
items: items,
header: header
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: table,
left: 10,
right: 10,
top: 10,
bottom: 10
}]
})
}
});
$.shortcut("demo.collection_table", Demo.Func);

57
demo/js/base/table/demo.grid_table.js

@ -0,0 +1,57 @@
Demo.Func = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-func"
},
render: function () {
var items = [], header = [], columnSize = [];
var rowCount = 100, columnCount = 100;
for (var i = 0; i < 1; i++) {
header[i] = [];
for (var j = 0; j < columnCount; j++) {
header[i][j] = {
type: "bi.label",
text: "表头" + i + "-" + j
}
columnSize[j] = 100;
}
}
for (var i = 0; i < rowCount; i++) {
items[i] = [];
for (var j = 0; j < columnCount; j++) {
items[i][j] = {
type: "bi.label",
text: (i < 3 ? 0 : i) + "-" + j
}
}
}
var table = BI.createWidget({
type: "bi.resizable_table",
el: {
type: "bi.grid_table",
},
width: 600,
height: 500,
isResizeAdapt: true,
isNeedResize: true,
isNeedFreeze: true,
freezeCols: [0, 1],
columnSize: columnSize,
items: items,
header: header
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: table,
left: 10,
right: 10,
top: 10,
bottom: 10
}]
})
}
});
$.shortcut("demo.grid_table", Demo.Func);

367
demo/js/base/table/demo.table_view.js

@ -0,0 +1,367 @@
Demo.Func = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-func"
},
render: function () {
var items = [[{
text: "第一行第一列"
}, {
text: "第一行第一列"
}, {
text: "第一行第一列"
}], [{
text: "第一行第一列"
}, {
text: "第一行第一列"
}, {
text: "第一行第一列"
}], [{
text: "第三行第一列"
}, {
text: "第三行第二列"
}, {
text: "第三行第三列"
}], [{
text: "第四行第一列"
}, {
text: "第四行第二列"
}, {
text: "第四行第三列"
}], [{
text: "第五行第一列"
}, {
text: "第五行第二列"
}, {
text: "第五行第三列"
}], [{
text: "第六行第一列"
}, {
text: "第六行第二列"
}, {
text: "第六行第三列"
}], [{
text: "第七行第一列"
}, {
text: "第七行第二列"
}, {
text: "第七行第三列"
}], [{
text: "第八行第一列"
}, {
text: "第八行第二列"
}, {
text: "第八行第三列"
}], [{
text: "第九行第一列"
}, {
text: "第九行第二列"
}, {
text: "第九行第三列"
}], [{
text: "第十行第一列"
}, {
text: "第十行第二列"
}, {
text: "第十行第三列"
}], [{
text: "第十一行第一列"
}, {
text: "第十一行第二列"
}, {
text: "第十一行第三列"
}], [{
text: "第十二行第一列"
}, {
text: "第十二行第二列"
}, {
text: "第十二行第三列"
}], [{
text: "第十三行第一列"
}, {
text: "第十三行第二列"
}, {
text: "第十三行第三列"
}], [{
text: "第十四行第一列"
}, {
text: "第十四行第二列"
}, {
text: "第十四行第三列"
}], [{
text: "第十五行第一列"
}, {
text: "第十五行第二列"
}, {
text: "第十五行第三列"
}], [{
text: "第十六行第一列"
}, {
text: "第十六行第二列"
}, {
text: "第十六行第三列"
}], [{
text: "第十七行第一列"
}, {
text: "第十七行第二列"
}, {
text: "第十七行第三列"
}], [{
text: "第十八行第一列"
}, {
text: "第十八行第二列"
}, {
text: "第十八行第三列"
}]];
var items2 = [[{
text: "第一行第一列"
}, {
text: "第一行第二列"
}, {
text: "第一行第三列"
}, {
text: "第一行第四列"
}, {
text: "第一行第五列"
}], [{
text: "第二行第一列"
}, {
text: "第二行第二列"
}, {
text: "第二行第三列"
}, {
text: "第二行第四列"
}, {
text: "第二行第五列"
}], [{
text: "第二行第一列"
}, {
text: "第二行第二列"
}, {
text: "第三行第三列"
}, {
text: "第三行第四列"
}, {
text: "第三行第五列"
}], [{
text: "第二行第一列"
}, {
text: "第四行第二列"
}, {
text: "第四行第三列"
}, {
text: "第四行第四列"
}, {
text: "第四行第五列"
}]
, [{
text: "第五行第一列"
}, {
text: "第五行第一列"
}, {
text: "第五行第三列"
}, {
text: "第五行第四列"
}, {
text: "第五行第五列"
}], [{
text: "第六行第一列"
}, {
text: "第六行第一列"
}, {
text: "第六行第三列"
}, {
text: "第六行第四列"
}, {
text: "第六行第五列"
}], [{
text: "第七行第一列"
}, {
text: "第七行第二列"
}, {
text: "第七行第三列"
}, {
text: "第七行第四列"
}, {
text: "第七行第五列"
}], [{
text: "第八行第一列"
}, {
text: "第八行第二列"
}, {
text: "第八行第三列"
}, {
text: "第八行第四列"
}, {
text: "第八行第五列"
}], [{
text: "第九行第一列"
}, {
text: "第九行第二列"
}, {
text: "第九行第三列"
}, {
text: "第九行第四列"
}, {
text: "第九行第五列"
}], [{
text: "第十行第一列"
}, {
text: "第十行第二列"
}, {
text: "第十行第三列"
}, {
text: "第十行第四列"
}, {
text: "第十行第五列"
}], [{
text: "第十一行第一列"
}, {
text: "第十一行第二列"
}, {
text: "第十一行第三列"
}, {
text: "第十一行第四列"
}, {
text: "第十一行第五列"
}], [{
text: "第十二行第一列"
}, {
text: "第十二行第二列"
}, {
text: "第十二行第三列"
}, {
text: "第十二行第四列"
}, {
text: "第十二行第五列"
}], [{
text: "第十三行第一列"
}, {
text: "第十三行第二列"
}, {
text: "第十三行第三列"
}, {
text: "第十三行第四列"
}, {
text: "第十三行第五列"
}], [{
text: "第十四行第一列"
}, {
text: "第十四行第二列"
}, {
text: "第十四行第三列"
}, {
text: "第十四行第四列"
}, {
text: "第十四行第五列"
}]];
var header = [[{
text: "表头1"
}, {
text: "表头2"
}, {
text: "表头3"
}]];
var header2 = [[{
text: "表头1"
}, {
text: "表头2"
}, {
text: "表头3"
}, {
text: "表头4"
}, {
text: "表头5"
}]];
var table1 = BI.createWidget({
type: "bi.table_view",
isNeedResize: true,
isNeedMerge: true,
mergeCols: [0, 1],
columnSize: [100, 200, 300],
items: items,
header: header
});
var table2 = BI.createWidget({
type: "bi.table_view",
isNeedMerge: true,
isNeedFreeze: true,
freezeCols: [0, 1],
mergeCols: [0, 1],
columnSize: [100, 200, 300, 400, 500],
items: items2,
header: header2
});
var table3 = BI.createWidget({
type: "bi.table_view",
isNeedMerge: true,
isNeedFreeze: true,
freezeCols: [4],
mergeCols: [0, 1],
columnSize: [100, 200, 300, 400, 100],
items: items2,
header: header2
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.grid",
columns: 2,
rows: 2,
items: [{
column: 0,
row: 0,
el: table1
}, {
column: 1,
row: 0,
el: table2
}, {
column: 0,
row: 1,
el: table3
}, {
column: 1,
row: 1,
el: {
type: "bi.vertical",
items: [{
type: "bi.button",
text: "第一个表setColumnSize([300, 200, 100])",
handler: function () {
table1.setColumnSize([300, 200, 100]);
}
}, {
type: "bi.button",
text: "第二个表setColumnSize([50, 100, 150, 200, 250])",
handler: function () {
table2.setColumnSize([50, 100, 150, 200, 250]);
}
}, {
type: "bi.button",
text: "第三个表setColumnSize([50, 100, 150, 200, 50])",
handler: function () {
table3.setColumnSize([50, 100, 150, 200, 50]);
}
}],
vgap: 10
}
}]
},
left: 10,
right: 10,
top: 10,
bottom: 10
}]
})
}
});
$.shortcut("demo.table_view", Demo.Func);

0
demo/js/base/demo.bubble.js → demo/js/base/tip/demo.bubble.js

0
demo/js/base/demo.title.js → demo/js/base/tip/demo.title.js

0
demo/js/base/demo.toast.js → demo/js/base/tip/demo.toast.js

233
demo/js/case/tree/demo.branch_tree.js

@ -0,0 +1,233 @@
Demo.Func = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-func"
},
_createBranchTree: function () {
var tree = BI.createWidget({
type: "bi.branch_tree",
items: [{
el: {
text: "且",
value: "且1",
cls: "layout-bg7"
},
children: [{
type: "bi.label",
height: 30,
textAlign: "left",
text: "这里是一段文字1",
value: "这里是一段文字1"
}, {
el: {
text: "或",
value: "或2",
cls: "layout-bg7"
},
children: [{
type: "bi.label",
height: 30,
textAlign: "left",
text: "这里是一段文字1435",
value: "这里是一段文字1435"
}, {
type: "bi.label",
height: 30,
textAlign: "left",
text: "这里是一段文字1xx",
value: "这里是一段文字1xx"
}, {
el: {
text: "且",
value: "且3",
cls: "layout-bg7"
},
children: [{
type: "bi.label",
height: 30,
textAlign: "left",
text: "可以理解为一个条件",
value: "可以理解为一个条件"
}, {
type: "bi.label",
height: 30,
textAlign: "left",
text: "可以理解为一个条件v",
value: "可以理解为一个条件v"
}]
}]
}, {
type: "bi.label",
height: 30,
textAlign: "left",
text: "这里是一段文字1xa",
value: "这里是一段文字1xa"
}]
}]
});
return tree;
},
_createBranchMapTree: function () {
var tree = BI.createWidget({
type: "bi.branch_tree",
el: {
type: "bi.button_group"
},
items: [{
text: "且",
value: "且1",
cls: "layout-bg7",
children: [{
type: "bi.label",
height: 30,
textAlign: "left",
text: "这里是一段文字1",
value: "这里是一段文字1"
}, {
text: "或",
value: "或2",
cls: "layout-bg7",
children: [{
type: "bi.label",
height: 30,
textAlign: "left",
text: "这里是一段文字1435",
value: "这里是一段文字1435"
}, {
type: "bi.label",
height: 30,
textAlign: "left",
text: "这里是一段文字1xx",
value: "这里是一段文字1xx"
}, {
text: "且",
value: "且3",
cls: "layout-bg7",
children: [{
type: "bi.label",
height: 30,
textAlign: "left",
text: "可以理解为一个条件",
value: "可以理解为一个条件"
}, {
type: "bi.label",
height: 30,
textAlign: "left",
text: "可以理解为一个条件v",
value: "可以理解为一个条件v"
}]
}]
}, {
type: "bi.label",
height: 30,
textAlign: "left",
text: "这里是一段文字1xa",
value: "这里是一段文字1xa"
}]
}]
});
return tree;
},
render: function () {
var tree = this._createBranchTree();
var mapTree = this._createBranchMapTree();
function getItems() {
return [{
text: "且",
value: "且",
cls: "layout-bg7",
children: [{
type: "bi.label",
height: 30,
textAlign: "left",
text: "这里是一段文字",
value: "这里是一段文字"
}, {
text: "或",
value: "或2",
cls: "layout-bg7",
children: [{
type: "bi.label",
height: 30,
textAlign: "left",
text: "这里是一段文字",
value: "这里是一段文字"
}, {
type: "bi.label",
height: 30,
textAlign: "left",
text: "这里是一段文字" + BI.UUID(),
value: "这里是一段文字" + BI.UUID()
}, {
text: "且",
value: "且3",
cls: "layout-bg7",
children: [{
type: "bi.label",
height: 30,
textAlign: "left",
text: "可以理解为一个条件",
value: "可以理解为一个条件"
}]
}]
}, {
type: "bi.label",
height: 30,
textAlign: "left",
text: "这里是一段文字1xa",
value: "这里是一段文字1xa"
}]
}];
}
BI.createWidget({
type: "bi.center",
element: this,
items: [{
type: "bi.vtape",
items: [{
el: tree
}, {
height: 30,
el: {
type: "bi.button",
height: 30,
text: "getValue",
handler: function () {
BI.Msg.alert("", tree.getValue());
}
}
}]
}, {
type: "bi.vtape",
items: [{
el: mapTree
}, {
height: 30,
el: {
type: "bi.button",
height: 30,
text: "populate",
handler: function () {
mapTree.populate(getItems());
}
}
}, {
height: 30,
el: {
type: "bi.button",
height: 30,
text: "getValue",
handler: function () {
BI.Msg.alert("", mapTree.getValue());
}
}
}]
}]
})
}
});
$.shortcut("demo.branch_tree", Demo.Func);

43
demo/js/case/tree/demo.display_tree.js

@ -0,0 +1,43 @@
Demo.Func = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-func"
},
render: function () {
var tree = BI.createWidget({
type: "bi.display_tree",
element: this
});
tree.initTree([{
id: 1,
text: "第一项",
open: true
}, {
id: 2,
text: "第二项"
}, {
id: 11,
pId: 1,
text: "子项1(共2个)",
open: true
}, {
id: 111,
pId: 11,
text: "子子项1"
}, {
id: 112,
pId: 11,
text: "子子项2"
}, {
id: 12,
pId: 1,
text: "子项2"
}, {
id: 13,
pId: 1,
text: "子项3"
}]);
}
});
$.shortcut("demo.display_tree", Demo.Func);

103
demo/js/case/tree/demo.handstand_branch_tree.js

@ -0,0 +1,103 @@
Demo.Func = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-func"
},
_createHandStandBranchTree: function () {
var tree = BI.createWidget({
type: "bi.handstand_branch_tree",
expander: {},
el: {
layouts: [{
type: "bi.horizontal_adapt",
verticalAlign: BI.VerticalAlign.Top
}]
},
items: [{
el: {
text: "且",
value: "且1",
cls: "layout-bg7"
},
children: [{
type: "bi.label",
height: 30,
textAlign: "left",
text: "这里是一段文字1",
value: "这里是一段文字1"
}, {
el: {
text: "或",
value: "或2",
cls: "layout-bg7"
},
children: [{
type: "bi.label",
height: 30,
textAlign: "left",
text: "这里是一段文字1435",
value: "这里是一段文字1435"
}, {
type: "bi.label",
height: 30,
textAlign: "left",
text: "这里是一段文字1xx",
value: "这里是一段文字1xx"
}, {
el: {
text: "且",
value: "且3",
cls: "layout-bg7"
},
children: [{
type: "bi.label",
height: 30,
textAlign: "left",
text: "可以理解为一个条件",
value: "可以理解为一个条件"
}, {
type: "bi.label",
height: 30,
textAlign: "left",
text: "可以理解为一个条件v",
value: "可以理解为一个条件v"
}]
}]
}, {
type: "bi.label",
height: 30,
textAlign: "left",
text: "这里是一段文字1xa",
value: "这里是一段文字1xa"
}]
}]
});
return tree;
},
render: function () {
var tree = this._createHandStandBranchTree();
BI.createWidget({
type: "bi.center",
element: this,
items: [{
type: "bi.vtape",
items: [{
el: tree
}, {
height: 30,
el: {
type: "bi.button",
height: 30,
text: "getValue",
handler: function () {
BI.Msg.alert("", tree.getValue());
}
}
}]
}]
})
}
});
$.shortcut("demo.handstand_branch_tree", Demo.Func);

87
demo/js/case/tree/demo.level_tree.js

@ -0,0 +1,87 @@
Demo.Func = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-func"
},
render: function () {
var tree = BI.createWidget({
type: "bi.level_tree",
chooseType: 0,
items: [{
id: 1,
text: "第一项",
value: 1,
isParent: true
}, {
id: 2,
text: "第二项",
value: 2,
isParent: true
}, {
id: 3,
text: "第三项",
value: 1,
isParent: true,
open: true
}, {
id: 4,
text: "第四项",
value: 1
}, {
id: 11,
pId: 1,
text: "子项1",
value: 11
}, {
id: 12,
pId: 1,
text: "子项2",
value: 12
}, {
id: 13,
pId: 1,
text: "子项3",
value: 13
}, {
id: 21,
pId: 2,
text: "子项1",
value: 21
}, {
id: 31,
pId: 3,
text: "子项1",
value: 31
}, {
id: 32,
pId: 3,
text: "子项2",
value: 32
}, {
id: 33,
pId: 3,
text: "子项3",
value: 33
}]
})
BI.createWidget({
type: "bi.vtape",
element: this,
items: [{
el: tree
}, {
height: 30,
el: {
type: "bi.button",
height: 30,
text: "getValue",
handler: function () {
BI.Msg.alert("", tree.getValue());
}
}
}]
})
}
});
$.shortcut("demo.level_tree", Demo.Func);

86
demo/js/case/tree/demo.simple_tree.js

@ -0,0 +1,86 @@
Demo.Func = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-func"
},
render: function () {
//value值一定要是字符串
var tree = BI.createWidget({
type: "bi.simple_tree",
items: []
});
tree.populate([{
id: 1,
text: "第一项",
value: "1"
}, {
id: 2,
text: "第二项",
value: "2"
}, {
id: 3,
text: "第三项",
value: "3",
open: true
}, {
id: 11,
pId: 1,
text: "子项1",
value: "11"
}, {
id: 12,
pId: 1,
text: "子项2",
value: "12"
}, {
id: 13,
pId: 1,
text: "子项3",
value: "13"
}, {
id: 31,
pId: 3,
text: "子项1",
value: "31"
}, {
id: 32,
pId: 3,
text: "子项2",
value: "32"
}, {
id: 33,
pId: 3,
text: "子项3",
value: "33"
}], "z");
BI.createWidget({
type: "bi.vtape",
element: this,
items: [{
el: tree
}, {
height: 30,
el: {
type: "bi.button",
height: 30,
text: "setValue(['31', '32', '33'])",
handler: function () {
tree.setValue(['31', '32', '33']);
}
}
}, {
height: 30,
el: {
type: "bi.button",
height: 30,
text: "getValue",
handler: function () {
BI.Msg.alert("", JSON.stringify(tree.getValue()));
}
}
}]
})
}
});
$.shortcut("demo.simple_tree", Demo.Func);

9
demo/js/config/base.js

@ -1,6 +1,7 @@
Demo.BASE_CONFIG = [{
id: 2,
text: "基础控件",
open: true
}, {
pId: 2,
text: "bi.label",
@ -91,12 +92,12 @@ Demo.BASE_CONFIG = [{
value: "demo.table_view"
}, {
pId: 204,
text: "bi.table_grid",
value: "demo.table_grid"
text: "bi.grid_table",
value: "demo.grid_table"
}, {
pId: 204,
text: "bi.table_collection",
value: "demo.table_collection"
text: "bi.collection_table",
value: "demo.collection_table"
}, {
pId: 2,
text: "bi.canvas",

140
demo/js/config/case.js

@ -30,6 +30,30 @@ Demo.CASE_CONFIG = [{
pId: 302,
text: "bi.bubble_combo",
value: "demo.bubble_combo"
}, {
pId: 3,
id: 303,
text: "tree"
}, {
pId: 303,
text: "bi.branch_tree",
value: "demo.branch_tree"
}, {
pId: 303,
text: "bi.handstand_branch_tree",
value: "demo.handstand_branch_tree"
}, {
pId: 303,
text: "bi.display_tree",
value: "demo.display_tree"
}, {
pId: 303,
text: "bi.simple_tree",
value: "demo.simple_tree"
}, {
pId: 303,
text: "bi.level_tree",
value: "demo.level_tree"
}, {
pId: 3,
text: "bi.calendar",
@ -46,72 +70,50 @@ Demo.CASE_CONFIG = [{
pId: 3,
text: "bi.color_chooser",
value: "demo.color_chooser"
}, {
pId: 3,
text: "各种checkbox",
value: "demo.checkboxes"
}, {
pId: 3,
text: "各种tip",
value: "demo.tips"
}, {
pId: 3,
text: "bi.branch_expander",
value: "demo.branch_expander"
}, {
pId: 3,
text: "bi.float_box",
value: "demo.float_box"
}, {
pId: 3,
text: "bi.float_box",
value: "demo.float_box"
}, {
pId: 3,
text: "bi.segment",
value: "demo.segment"
}, {
pId: 3,
id: 12,
text: "各种表格"
}, {
pId: 3,
id: 13,
text: "各种tree"
}, {
pId: 3,
text: "各种trigger",
value: "demo.triggers"
}, {
pId: 12,
text: "bi.adaptive_table",
value: "demo.adaptive_table"
}, {
pId: 12,
text: "bi.table_tree",
value: "demo.table_tree"
}, {
pId: 12,
text: "bi.layer_tree_table",
value: "demo.layer_tree_table"
}, {
pId: 13,
text: "bi.branch_tree",
value: "demo.branch_tree"
}, {
pId: 13,
text: "bi.display_tree",
value: "demo.display_tree"
}, {
pId: 13,
text: "bi.level_tree",
value: "demo.level_tree"
}, {
pId: 13,
text: "bi.simple_tree",
value: "demo.simple_tree"
}, {
pId: 13,
text: "bi.handstand_branch_tree",
value: "demo.handstand_branch_tree"
}];
},
{
pId: 3,
text: "各种checkbox",
value: "demo.checkboxes"
}, {
pId: 3,
text: "各种tip",
value: "demo.tips"
}, {
pId: 3,
text: "bi.float_box",
value: "demo.float_box"
}, {
pId: 3,
text: "bi.float_box",
value: "demo.float_box"
}, {
pId: 3,
text: "bi.segment",
value: "demo.segment"
}, {
pId: 3,
id: 12,
text: "各种表格"
}, {
pId: 3,
id: 13,
text: "各种tree"
}, {
pId: 3,
text: "各种trigger",
value: "demo.triggers"
}, {
pId: 12,
text: "bi.adaptive_table",
value: "demo.adaptive_table"
}, {
pId: 12,
text: "bi.table_tree",
value: "demo.table_tree"
}, {
pId: 12,
text: "bi.layer_tree_table",
value: "demo.layer_tree_table"
}];

4
demo/js/config/core.js

@ -159,8 +159,8 @@ Demo.CORE_CONFIG = [{
value: "demo.grid_view"
}, {
pId: 102,
text: "bi.collection",
value: "demo.collection"
text: "bi.collection_view",
value: "demo.collection_view"
}, {
pId: 1,
text: "widget",

39
demo/js/core/abstract/demo.collection_view.js

@ -0,0 +1,39 @@
Demo.Func = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-func"
},
render: function () {
var items = [];
var cellCount = 100;
for (var i = 0; i < cellCount; i++) {
items[i] = {
type: "bi.label",
text: i
};
}
var grid = BI.createWidget({
type: "bi.collection_view",
items: items,
cellSizeAndPositionGetter: function (index) {
return {
x: index % 10 * 50,
y: Math.floor(index / 10) * 50,
width: 50,
height: 50
}
}
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: grid,
left: 10,
right: 10,
top: 10,
bottom: 10
}]
})
}
});
$.shortcut("demo.collection_view", Demo.Func);

50
demo/js/core/abstract/demo.grid_view.js

@ -0,0 +1,50 @@
Demo.Func = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-func"
},
render: function () {
var items = [];
var rowCount = 10000, columnCount = 100;
for (var i = 0; i < rowCount; i++) {
items[i] = [];
for (var j = 0; j < columnCount; j++) {
items[i][j] = {
type: "bi.label",
text: i + "-" + j
}
}
}
var grid = BI.createWidget({
type: "bi.grid_view",
items: items,
scrollTop: 100,
rowHeightGetter: function () {
return 30;
},
columnWidthGetter: function () {
return 100;
}
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.grid",
columns: 1,
rows: 1,
items: [{
column: 0,
row: 0,
el: grid
}]
},
left: 10,
right: 10,
top: 10,
bottom: 10
}]
})
}
});
$.shortcut("demo.grid_view", Demo.Func);

6
dist/base.css vendored

@ -2190,13 +2190,13 @@ ul.ztree.zTreeDragUL {
color: #808080;
}
.bi-display-tree .ztree li span.button.switch.center_open {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-3.png");
background-image: url("icon/tree-vertical-line-3.png");
}
.bi-display-tree .ztree li span.button.switch.roots_open {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-2.png");
background-image: url("icon/tree-vertical-line-2.png");
}
.bi-display-tree .ztree li span.button.switch.bottom_open {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-4.png");
background-image: url("icon/tree-vertical-line-4.png");
}
.bi-display-tree .ztree li a,
.bi-display-tree .ztree li span {

190
dist/base.js vendored

@ -30238,9 +30238,6 @@ BI.Table = BI.inherit(BI.Widget, {
dynamic: false
},
isNeedResize: false,//是否需要调整列宽
isResizeAdapt: true,//是否需要在调整列宽或区域宽度的时候它们自适应变化
isNeedFreeze: false,//是否需要冻结单元格
freezeCols: [], //冻结的列号,从0开始,isNeedFreeze为true时生效
@ -30518,111 +30515,6 @@ BI.Table = BI.inherit(BI.Widget, {
return o.columnSize[col] > 1 ? o.columnSize[col] + 1 : o.columnSize[col];
});
if (o.isNeedResize) {
var resizer;
var createResizer = function (size, position) {
var rowSize = self.getCalculateRegionRowSize();
resizer = BI.createWidget({
type: "bi.layout",
cls: "bi-resizer",
width: size.width,
height: rowSize[0] + rowSize[1]
});
BI.createWidget({
type: "bi.absolute",
element: "body",
items: [{
el: resizer,
left: position.left,
top: position.top - rowSize[0]
}]
});
};
var resizeResizer = function (size, position) {
var rowSize = self.getCalculateRegionRowSize();
var columnSize = self.getCalculateRegionColumnSize();
var height = rowSize[0] + rowSize[1];
var sumSize = columnSize[0] + columnSize[1];
if (size.width > sumSize / 5 * 4) {
size.width = sumSize / 5 * 4;
}
if (size.width < 10) {
size.width = 10;
}
resizer.element.css({
"left": position.left + "px",
"width": size.width + "px",
"height": height + "px"
});
};
var stopResizer = function () {
resizer && resizer.destroy();
resizer = null;
};
var handle;
if (o.freezeCols.length > 0 && o.freezeCols.length < o.columnSize.length) {
if (isRight) {
var options = {
handles: "w",
minWidth: 15,
helper: "clone",
start: function (event, ui) {
createResizer(ui.size, ui.position);
self.fireEvent(BI.Table.EVENT_TABLE_BEFORE_REGION_RESIZE);
},
resize: function (e, ui) {
resizeResizer(ui.size, ui.position);
self.fireEvent(BI.Table.EVENT_TABLE_REGION_RESIZE);
e.stopPropagation();
//return false;
},
stop: function (e, ui) {
stopResizer();
if (o.isResizeAdapt) {
var increment = ui.size.width - (BI.sum(self.columnRight) + self.columnRight.length);
o.columnSize[self.columnLeft.length] += increment;
} else {
self.setRegionColumnSize(["fill", ui.size.width]);
}
self._resize();
ui.element.css("left", "");
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE);
}
};
self.bottomRight.element.resizable(options);
handle = $(".ui-resizable-handle", this.bottomRight.element).css("top", -1 * headerHeight);
} else {
var options = {
handles: "e",
minWidth: 15,
helper: "clone",
start: function (event, ui) {
createResizer(ui.size, ui.position);
self.fireEvent(BI.Table.EVENT_TABLE_BEFORE_REGION_RESIZE);
},
resize: function (e, ui) {
resizeResizer(ui.size, ui.position);
self.fireEvent(BI.Table.EVENT_TABLE_REGION_RESIZE);
e.stopPropagation();
//return false;
},
stop: function (e, ui) {
stopResizer();
if (o.isResizeAdapt) {
var increment = ui.size.width - (BI.sum(self.columnLeft) + self.columnLeft.length);
o.columnSize[self.columnLeft.length - 1] += increment;
} else {
self.setRegionColumnSize([ui.size.width, "fill"]);
}
self._resize();
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE);
}
};
self.bottomLeft.element.resizable(options);
handle = $(".ui-resizable-handle", this.bottomLeft.element).css("top", -1 * headerHeight);
}
}
}
this._resize = function () {
if (self.scrollBottomLeft.element.is(":visible")) {
self.scrollBottomLeft.element.css({"overflow-x": "auto"});
@ -30650,10 +30542,6 @@ BI.Table = BI.inherit(BI.Widget, {
self.scrollTopLeft.element[0].scrollLeft = self.scrollBottomLeft.element[0].scrollLeft;
self.scrollTopRight.element[0].scrollLeft = self.scrollBottomRight.element[0].scrollLeft;
self.scrollBottomLeft.element[0].scrollTop = self.scrollBottomRight.element[0].scrollTop;
//调整拖拽handle的高度
if (o.isNeedResize) {
handle && handle.css("height", self.bottomLeft.element.height() + headerHeight);
}
}
};
@ -31121,70 +31009,6 @@ BI.Table = BI.inherit(BI.Widget, {
start || (start = 0);
var frag = this._createCells(items, columnSize, BI.range(o.columnSize.length), TDs, Ws, start, o.headerRowSize || o.rowSize);
if (o.isNeedResize === true) {
var tds = TDs[BI.size(TDs) - 1];
BI.each(tds, function (j, td) {
j = j | 0;
var resizer;
var getHeight = function (size, position) {
var rowSize = self.getCalculateRegionRowSize();
if (o.isNeedFreeze === true) {
var tableHeight = self.bottomRightContainer.element.outerHeight();
return size.height + Math.min(rowSize[1], tableHeight);
} else {
var tableHeight = self.tableContainer.element.outerHeight();
var offset = self.tableContainer.element.offset();
var offsetTop = position.top - offset.top;
var height = tableHeight - offsetTop;
height = Math.min(height, rowSize[0] - offsetTop);
return height;
}
};
if (j < BI.size(tds) - 1) {
td.resizable({
handles: "e",
minWidth: 15,
helper: "clone",
start: function (event, ui) {
var height = getHeight(ui.size, ui.position);
resizer = BI.createWidget({
type: "bi.layout",
cls: "bi-resizer",
width: ui.size.width,
height: height
});
BI.createWidget({
type: "bi.absolute",
element: "body",
items: [{
el: resizer,
left: ui.position.left,
top: ui.position.top
}]
});
self.fireEvent(BI.Table.EVENT_TABLE_BEFORE_COLUMN_RESIZE);
},
resize: function (e, ui) {
var height = getHeight(ui.size, ui.position);
resizer.element.css({"width": ui.size.width + "px", "height": height + "px"});
//o.columnSize[start + j] = ui.size.width;
//self.setColumnSize(o.columnSize);
self.fireEvent(BI.Table.EVENT_TABLE_COLUMN_RESIZE);
e.stopPropagation();
//return false;
},
stop: function (e, ui) {
resizer.destroy();
resizer = null;
o.columnSize[start + j] = ui.size.width - 1;
self.setColumnSize(o.columnSize);
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE);
}
})
}
})
}
return frag;
},
@ -31576,13 +31400,6 @@ BI.Table = BI.inherit(BI.Widget, {
this.bottomRightContainer.element.width(isRight ? lw : rw);
this.scrollTopLeft.element[0].scrollLeft = this.scrollBottomLeft.element[0].scrollLeft;
this.scrollTopRight.element[0].scrollLeft = this.scrollBottomRight.element[0].scrollLeft;
if (o.isNeedResize && o.isResizeAdapt) {
var leftWidth = BI.sum(o.freezeCols, function (i, col) {
return o.columnSize[col] > 1 ? o.columnSize[col] + 1 : o.columnSize[col];
});
this.partitions.attr("columnSize", isRight ? ['fill', leftWidth] : [leftWidth, 'fill']);
this.partitions.resize();
}
} else {
BI.each(this.colgroupTds, function (i, colgroup) {
var width = colgroup.attr("width") | 0;
@ -32044,13 +31861,6 @@ BI.Table = BI.inherit(BI.Widget, {
this.topRightContainer.element.width(isRight ? lw : rw);
this.scrollTopLeft.element[0].scrollLeft = this.scrollBottomLeft.element[0].scrollLeft;
this.scrollTopRight.element[0].scrollLeft = this.scrollBottomRight.element[0].scrollLeft;
if (o.isNeedResize && o.isResizeAdapt) {
var leftWidth = BI.sum(o.freezeCols, function (i, col) {
return columnSize[col] > 1 ? columnSize[col] + 1 : columnSize[col];
});
this.partitions.attr("columnSize", isRight ? ['fill', leftWidth] : [leftWidth, 'fill']);
this.partitions.resize();
}
} else {
BI.each(this.colgroupTds, function (i, colgroup) {
var width = colgroup.attr("width") | 0;

3
dist/core.js vendored

@ -23083,6 +23083,9 @@ BI.HorizontalFillLayoutLogic = BI.inherit(BI.Logic, {
* @class Array
*/
$.extend(Array.prototype, {
contains: function (o) {
return this.indexOf(o) > -1;
},
/**
* 检查指定的值是否在数组中
* @param {Object} o 要检查的值

190
src/base/table/table.js

@ -17,9 +17,6 @@ BI.Table = BI.inherit(BI.Widget, {
dynamic: false
},
isNeedResize: false,//是否需要调整列宽
isResizeAdapt: true,//是否需要在调整列宽或区域宽度的时候它们自适应变化
isNeedFreeze: false,//是否需要冻结单元格
freezeCols: [], //冻结的列号,从0开始,isNeedFreeze为true时生效
@ -297,111 +294,6 @@ BI.Table = BI.inherit(BI.Widget, {
return o.columnSize[col] > 1 ? o.columnSize[col] + 1 : o.columnSize[col];
});
if (o.isNeedResize) {
var resizer;
var createResizer = function (size, position) {
var rowSize = self.getCalculateRegionRowSize();
resizer = BI.createWidget({
type: "bi.layout",
cls: "bi-resizer",
width: size.width,
height: rowSize[0] + rowSize[1]
});
BI.createWidget({
type: "bi.absolute",
element: "body",
items: [{
el: resizer,
left: position.left,
top: position.top - rowSize[0]
}]
});
};
var resizeResizer = function (size, position) {
var rowSize = self.getCalculateRegionRowSize();
var columnSize = self.getCalculateRegionColumnSize();
var height = rowSize[0] + rowSize[1];
var sumSize = columnSize[0] + columnSize[1];
if (size.width > sumSize / 5 * 4) {
size.width = sumSize / 5 * 4;
}
if (size.width < 10) {
size.width = 10;
}
resizer.element.css({
"left": position.left + "px",
"width": size.width + "px",
"height": height + "px"
});
};
var stopResizer = function () {
resizer && resizer.destroy();
resizer = null;
};
var handle;
if (o.freezeCols.length > 0 && o.freezeCols.length < o.columnSize.length) {
if (isRight) {
var options = {
handles: "w",
minWidth: 15,
helper: "clone",
start: function (event, ui) {
createResizer(ui.size, ui.position);
self.fireEvent(BI.Table.EVENT_TABLE_BEFORE_REGION_RESIZE);
},
resize: function (e, ui) {
resizeResizer(ui.size, ui.position);
self.fireEvent(BI.Table.EVENT_TABLE_REGION_RESIZE);
e.stopPropagation();
//return false;
},
stop: function (e, ui) {
stopResizer();
if (o.isResizeAdapt) {
var increment = ui.size.width - (BI.sum(self.columnRight) + self.columnRight.length);
o.columnSize[self.columnLeft.length] += increment;
} else {
self.setRegionColumnSize(["fill", ui.size.width]);
}
self._resize();
ui.element.css("left", "");
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE);
}
};
self.bottomRight.element.resizable(options);
handle = $(".ui-resizable-handle", this.bottomRight.element).css("top", -1 * headerHeight);
} else {
var options = {
handles: "e",
minWidth: 15,
helper: "clone",
start: function (event, ui) {
createResizer(ui.size, ui.position);
self.fireEvent(BI.Table.EVENT_TABLE_BEFORE_REGION_RESIZE);
},
resize: function (e, ui) {
resizeResizer(ui.size, ui.position);
self.fireEvent(BI.Table.EVENT_TABLE_REGION_RESIZE);
e.stopPropagation();
//return false;
},
stop: function (e, ui) {
stopResizer();
if (o.isResizeAdapt) {
var increment = ui.size.width - (BI.sum(self.columnLeft) + self.columnLeft.length);
o.columnSize[self.columnLeft.length - 1] += increment;
} else {
self.setRegionColumnSize([ui.size.width, "fill"]);
}
self._resize();
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE);
}
};
self.bottomLeft.element.resizable(options);
handle = $(".ui-resizable-handle", this.bottomLeft.element).css("top", -1 * headerHeight);
}
}
}
this._resize = function () {
if (self.scrollBottomLeft.element.is(":visible")) {
self.scrollBottomLeft.element.css({"overflow-x": "auto"});
@ -429,10 +321,6 @@ BI.Table = BI.inherit(BI.Widget, {
self.scrollTopLeft.element[0].scrollLeft = self.scrollBottomLeft.element[0].scrollLeft;
self.scrollTopRight.element[0].scrollLeft = self.scrollBottomRight.element[0].scrollLeft;
self.scrollBottomLeft.element[0].scrollTop = self.scrollBottomRight.element[0].scrollTop;
//调整拖拽handle的高度
if (o.isNeedResize) {
handle && handle.css("height", self.bottomLeft.element.height() + headerHeight);
}
}
};
@ -900,70 +788,6 @@ BI.Table = BI.inherit(BI.Widget, {
start || (start = 0);
var frag = this._createCells(items, columnSize, BI.range(o.columnSize.length), TDs, Ws, start, o.headerRowSize || o.rowSize);
if (o.isNeedResize === true) {
var tds = TDs[BI.size(TDs) - 1];
BI.each(tds, function (j, td) {
j = j | 0;
var resizer;
var getHeight = function (size, position) {
var rowSize = self.getCalculateRegionRowSize();
if (o.isNeedFreeze === true) {
var tableHeight = self.bottomRightContainer.element.outerHeight();
return size.height + Math.min(rowSize[1], tableHeight);
} else {
var tableHeight = self.tableContainer.element.outerHeight();
var offset = self.tableContainer.element.offset();
var offsetTop = position.top - offset.top;
var height = tableHeight - offsetTop;
height = Math.min(height, rowSize[0] - offsetTop);
return height;
}
};
if (j < BI.size(tds) - 1) {
td.resizable({
handles: "e",
minWidth: 15,
helper: "clone",
start: function (event, ui) {
var height = getHeight(ui.size, ui.position);
resizer = BI.createWidget({
type: "bi.layout",
cls: "bi-resizer",
width: ui.size.width,
height: height
});
BI.createWidget({
type: "bi.absolute",
element: "body",
items: [{
el: resizer,
left: ui.position.left,
top: ui.position.top
}]
});
self.fireEvent(BI.Table.EVENT_TABLE_BEFORE_COLUMN_RESIZE);
},
resize: function (e, ui) {
var height = getHeight(ui.size, ui.position);
resizer.element.css({"width": ui.size.width + "px", "height": height + "px"});
//o.columnSize[start + j] = ui.size.width;
//self.setColumnSize(o.columnSize);
self.fireEvent(BI.Table.EVENT_TABLE_COLUMN_RESIZE);
e.stopPropagation();
//return false;
},
stop: function (e, ui) {
resizer.destroy();
resizer = null;
o.columnSize[start + j] = ui.size.width - 1;
self.setColumnSize(o.columnSize);
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE);
}
})
}
})
}
return frag;
},
@ -1355,13 +1179,6 @@ BI.Table = BI.inherit(BI.Widget, {
this.bottomRightContainer.element.width(isRight ? lw : rw);
this.scrollTopLeft.element[0].scrollLeft = this.scrollBottomLeft.element[0].scrollLeft;
this.scrollTopRight.element[0].scrollLeft = this.scrollBottomRight.element[0].scrollLeft;
if (o.isNeedResize && o.isResizeAdapt) {
var leftWidth = BI.sum(o.freezeCols, function (i, col) {
return o.columnSize[col] > 1 ? o.columnSize[col] + 1 : o.columnSize[col];
});
this.partitions.attr("columnSize", isRight ? ['fill', leftWidth] : [leftWidth, 'fill']);
this.partitions.resize();
}
} else {
BI.each(this.colgroupTds, function (i, colgroup) {
var width = colgroup.attr("width") | 0;
@ -1823,13 +1640,6 @@ BI.Table = BI.inherit(BI.Widget, {
this.topRightContainer.element.width(isRight ? lw : rw);
this.scrollTopLeft.element[0].scrollLeft = this.scrollBottomLeft.element[0].scrollLeft;
this.scrollTopRight.element[0].scrollLeft = this.scrollBottomRight.element[0].scrollLeft;
if (o.isNeedResize && o.isResizeAdapt) {
var leftWidth = BI.sum(o.freezeCols, function (i, col) {
return columnSize[col] > 1 ? columnSize[col] + 1 : columnSize[col];
});
this.partitions.attr("columnSize", isRight ? ['fill', leftWidth] : [leftWidth, 'fill']);
this.partitions.resize();
}
} else {
BI.each(this.colgroupTds, function (i, colgroup) {
var width = colgroup.attr("width") | 0;

3
src/core/proto/array.js

@ -3,6 +3,9 @@
* @class Array
*/
$.extend(Array.prototype, {
contains: function (o) {
return this.indexOf(o) > -1;
},
/**
* 检查指定的值是否在数组中
* @param {Object} o 要检查的值

6
src/css/base/tree/display.tree.css

@ -5,13 +5,13 @@
color: #808080;
}
.bi-display-tree .ztree li span.button.switch.center_open {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-3.png");
background-image: url("icon/tree-vertical-line-3.png");
}
.bi-display-tree .ztree li span.button.switch.roots_open {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-2.png");
background-image: url("icon/tree-vertical-line-2.png");
}
.bi-display-tree .ztree li span.button.switch.bottom_open {
background-image: url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-4.png");
background-image: url("icon/tree-vertical-line-4.png");
}
.bi-display-tree .ztree li a,
.bi-display-tree .ztree li span {

6
src/less/base/tree/display.tree.less

@ -5,15 +5,15 @@
color: @color-bi-text-gray;
}
& .ztree li span.button.switch.center_open{
background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-3.png");
background-image:url("icon/tree-vertical-line-3.png");
}
& .ztree li span.button.switch.roots_open{
background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-2.png");
background-image:url("icon/tree-vertical-line-2.png");
}
& .ztree li span.button.switch.bottom_open{
background-image:url("${servletURL}?op=resource&resource=/com/fr/bi/web/images/icon/tree-vertical-line-4.png");
background-image:url("icon/tree-vertical-line-4.png");
}
& .ztree li a, & .ztree li span{
cursor: default !important;

Loading…
Cancel
Save