Browse Source

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

* commit 'f0d31af5dae5b8cf4f6dbaa1be5fd3c4c4477c39':
  udpate
  BI-29736 table clipboard branch 帮助类转移
es6
windy 6 years ago
parent
commit
007e7d7f95
  1. 25
      Gruntfile.js
  2. 62
      demo/js/base/table/demo.collection_table.js
  3. 57
      demo/js/base/table/demo.grid_table.js
  4. 57
      demo/js/base/table/demo.resizable_table.js
  5. 367
      demo/js/base/table/demo.table_view.js
  6. 160
      demo/js/case/table/demo.adaptive_table.js
  7. 149
      demo/js/case/table/demo.layer_tree_table.js
  8. 149
      demo/js/case/table/demo.tree_table.js
  9. 20
      demo/js/config/base.js
  10. 16
      demo/js/config/case.js
  11. 20
      demo/js/config/widget.js
  12. 2
      demo/js/face.js
  13. 54
      demo/js/widget/filemanager/demo.filemanager.js
  14. 215
      demo/js/widget/table/demo.page_table.js
  15. 233
      demo/js/widget/table/demo.preview_table.js
  16. 159
      demo/js/widget/table/demo.responsive_table.js
  17. 159
      demo/js/widget/table/demo.sequence_table.js
  18. 71
      dist/_fineui.min.js
  19. 284
      dist/base.css
  20. 4309
      dist/base.js
  21. 345
      dist/bundle.css
  22. 29016
      dist/bundle.js
  23. 2
      dist/bundle.min.css
  24. 71
      dist/bundle.min.js
  25. 14306
      dist/case.js
  26. 23
      dist/core.css
  27. 895
      dist/core.js
  28. 23
      dist/core_without_normalize.css
  29. 3115
      dist/demo.js
  30. 345
      dist/fineui.css
  31. 29016
      dist/fineui.js
  32. 2
      dist/fineui.min.css
  33. 71
      dist/fineui.min.js
  34. 895
      dist/utils.js
  35. 5
      dist/utils.min.js
  36. 38
      dist/widget.css
  37. 700
      dist/widget.js
  38. 1
      src/base/single/button/button.basic.js
  39. 155
      src/base/table/native.scrollbar.js
  40. 36
      src/base/table/table.cell.js
  41. 57
      src/base/table/table.collection.cell.js
  42. 558
      src/base/table/table.collection.js
  43. 191
      src/base/table/table.collection.quick.js
  44. 59
      src/base/table/table.grid.cell.js
  45. 488
      src/base/table/table.grid.js
  46. 223
      src/base/table/table.grid.quick.js
  47. 420
      src/base/table/table.grid.scrollbar.js
  48. 34
      src/base/table/table.header.cell.js
  49. 1618
      src/base/table/table.js
  50. 115
      src/base/table/table.resizable.cell.js
  51. 365
      src/base/table/table.resizable.js
  52. 1314
      src/case/clipboard/clipboard.js
  53. 50
      src/case/clipboard/index.js
  54. 78
      src/case/combo/editoriconcheckcombo/combo.editiconcheck.js
  55. 234
      src/case/table/table.adaptive.js
  56. 336
      src/case/table/table.dynamicsummarylayertree.js
  57. 360
      src/case/table/table.dynamicsummarytree.js
  58. 32
      src/case/table/table.layertree.cell.js
  59. 318
      src/case/table/table.layertree.js
  60. 47
      src/case/table/table.style.cell.js
  61. 326
      src/case/table/table.tree.js
  62. 470
      src/case/tree/branchrelation.js
  63. 60
      src/case/tree/expander/expander.branch.handstand.js
  64. 60
      src/case/tree/expander/expander.branch.js
  65. 55
      src/case/tree/tree.branch.handstand.js
  66. 55
      src/case/tree/tree.branch.js
  67. 130
      src/core/utils/base64.js
  68. 263
      src/core/utils/helper.scroll.js
  69. 145
      src/core/utils/integerBufferSet.js
  70. 240
      src/core/utils/md5.js
  71. 119
      src/core/utils/tableRowBuffer.js
  72. 10
      src/css/base/combo/combo.css
  73. 274
      src/css/base/table/table.css
  74. 23
      src/css/core/utils/common.css
  75. 11
      src/css/widget/exceltable/exceltable.css
  76. 27
      src/css/widget/previewtable/previewtable.css
  77. 4
      src/less/base/combo/combo.bubble.less
  78. 23
      src/less/base/table/table.collection.cell.less
  79. 9
      src/less/base/table/table.collection.quick.less
  80. 21
      src/less/base/table/table.grid.cell.less
  81. 146
      src/less/base/table/table.grid.scrollbar.less
  82. 111
      src/less/base/table/table.less
  83. 18
      src/less/base/table/table.resizable.cell.less
  84. 21
      src/less/base/table/table.resizable.less
  85. 5
      src/less/base/table/table.tree.less
  86. 23
      src/less/core/utils/common.less
  87. 6
      src/less/visual.less
  88. 4
      src/less/widget/exceltable/exceltable.cell.less
  89. 5
      src/less/widget/exceltable/exceltable.header.cell.less
  90. 15
      src/less/widget/exceltable/exceltable.less
  91. 6
      src/less/widget/previewtable/previewtable.cell.less
  92. 7
      src/less/widget/previewtable/previewtable.header.cell.less
  93. 20
      src/less/widget/previewtable/previewtable.less
  94. 16
      src/widget/dynamicdate/dynamicdate.combo.js
  95. 16
      src/widget/dynamicdatetime/dynamicdatetime.combo.js
  96. 35
      src/widget/previewtable/previewtable.cell.js
  97. 35
      src/widget/previewtable/previewtable.header.cell.js
  98. 223
      src/widget/previewtable/previewtable.js
  99. 366
      src/widget/responsivetable/responsivetable.js
  100. 3
      src/widget/year/combo.year.js
  101. Some files were not shown because too many files have changed in this diff Show More

25
Gruntfile.js

@ -39,7 +39,6 @@ module.exports = function (grunt) {
baseJs: {
src: [
"src/third/**/*.js",
"src/base/formula/config.js",
"src/base/pane.js",
"src/base/single/single.js",
"src/base/single/text.js",
@ -110,14 +109,8 @@ module.exports = function (grunt) {
dest: "dist/bundle.css"
},
fineuiMinJs: {
src: ["dist/_fineui.min.js", "src/base/formula/formulaeditor.js"],
dest: "dist/fineui.min.js"
},
fineuiJs: {
src: ["dist/polyfill.js", "dist/core.js", "dist/fix/fix.js", "src/third/**/*.js",
"src/base/formula/config.js",
"src/base/pane.js",
"src/base/single/single.js",
"src/base/single/text.js",
@ -221,23 +214,7 @@ module.exports = function (grunt) {
files: {
"dist/bundle.min.js": ["<%= concat.bundleJs.dest %>"],
"dist/utils.min.js": ["<%= concat.utilsJs.dest %>"],
"dist/_fineui.min.js": ["dist/polyfill.js", "dist/core.js", "dist/fix/fix.js", "src/third/**/*.js",
"src/base/formula/config.js",
"src/base/pane.js",
"src/base/single/single.js",
"src/base/single/text.js",
"src/base/single/button/button.basic.js",
"src/base/single/button/button.node.js",
"src/base/single/tip/tip.js",
"src/base/combination/group.button.js",
"src/base/combination/tree.button.js",
"src/base/combination/map.button.js",
"src/base/tree/treeview.js",
"src/base/tree/asynctree.js",
"src/base/tree/parttree.js",
"src/base/**/*.js",
"!src/base/formula/formulaeditor.js",
"dist/case.js", "dist/widget.js", "dist/fix/fix.compact.js", "dist/router.js", "ui/js/**/*.js", "!ui/js/fineui.i18n.js"]
"dist/fineui.min.js": ["<%= concat.fineuiJs.dest %>"]
}
}
},

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

@ -1,62 +0,0 @@
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
}]
});
}
});
BI.shortcut("demo.collection_table", Demo.Func);

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

@ -1,57 +0,0 @@
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
}]
});
}
});
BI.shortcut("demo.grid_table", Demo.Func);

57
demo/js/base/table/demo.resizable_table.js

@ -1,57 +0,0 @@
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
}]
});
}
});
BI.shortcut("demo.resizable_table", Demo.Func);

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

@ -1,367 +0,0 @@
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
}]
});
}
});
BI.shortcut("demo.table_view", Demo.Func);

160
demo/js/case/table/demo.adaptive_table.js

@ -1,160 +0,0 @@
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 header = [[{
text: "表头1"
}, {
text: "表头2"
}, {
text: "表头3"
}]];
var table = BI.createWidget({
type: "bi.adaptive_table",
el: {
type: "bi.resizable_table",
el: {
type: "bi.grid_table"
}
},
width: 600,
height: 400,
minColumnSize: [100, 100, 100],
columnSize: [100, 100, 100],
header: header,
items: items
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.grid",
columns: 1,
rows: 1,
items: [[{
el: table
}]]
},
left: 10,
right: 10,
top: 10,
bottom: 10
}]
});
}
});
BI.shortcut("demo.adaptive_table", Demo.Func);

149
demo/js/case/table/demo.layer_tree_table.js

@ -1,149 +0,0 @@
Demo.Func = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-func"
},
render: function () {
var items = [{
children: [{
text: "节点1",
children: [{
text: "子节点1",
children: [{
text: "叶节点1",
values: [{text: 11}, {text: 12}, {text: 11}, {text: 12}, {text: 11}, {text: 12}, {text: 112}]
}, {
text: "叶节点2",
values: [{text: 21}, {text: 22}, {text: 21}, {text: 22}, {text: 21}, {text: 22}, {text: 122}]
}],
values: [{text: 101}, {text: 102}, {text: 101}, {text: 102}, {text: 101}, {text: 102}, {text: 1102}]
}, {
text: "子节点2",
children: [{
text: "叶节点3",
values: [{text: 31}, {text: 32}, {text: 31}, {text: 32}, {text: 31}, {text: 32}, {text: 132}]
}, {
text: "叶节点4",
values: [{text: 41}, {text: 42}, {text: 41}, {text: 42}, {text: 41}, {text: 42}, {text: 142}]
}],
values: [{text: 201}, {text: 202}, {text: 201}, {text: 202}, {text: 201}, {text: 202}, {text: 1202}]
}, {
text: "子节点3",
children: [{
text: "叶节点5",
values: [{text: 51}, {text: 52}, {text: 51}, {text: 52}, {text: 51}, {text: 52}, {text: 152}]
}],
values: [{text: 301}, {text: 302}, {text: 301}, {text: 302}, {text: 301}, {text: 302}, {text: 1302}]
}],
values: [{text: 1001}, {text: 1002}, {text: 1001}, {text: 1002}, {text: 1001}, {text: 1002}, {text: 11002}]
}, {
text: "节点2",
values: [{text: 2001}, {text: 2002}, {text: 2001}, {text: 2002}, {text: 2001}, {text: 2002}, {text: 12002}]
}],
values: [{text: 12001}, {text: 12002}, {text: 12001}, {text: 12002}, {text: 12001}, {text: 12002}, {text: 112002}]
}];
var header = [{
text: "header1"
}, {
text: "header2"
}, {
text: "header3"
}, {
text: "金额",
tag: 1
}, {
text: "金额",
tag: 2
}, {
text: "金额",
tag: 3
}, {
text: "金额",
tag: 4
}, {
text: "金额",
tag: 5
}, {
text: "金额",
tag: 6
}, {
text: "金额",
tag: 7
}];
var crossHeader = [{
text: "cross1"
}, {
text: "cross2"
}];
var crossItems = [{
children: [{
text: "节点1",
children: [{
text: "子节点1"
}, {
text: "子节点2"
}],
values: [0]
}, {
text: "节点2",
children: [{
text: "子节点3"
}, {
text: "子节点4"
}],
values: [0]
}],
values: [0]
}];
var table = BI.createWidget({
type: "bi.layer_tree_table",
el: {
type: "bi.adaptive_table",
el: {
type: "bi.resizable_table",
el: {
type: "bi.collection_table",
mergeRule: function (col1, col2) {
return BI.isEqual(col1, col2);
}
}
}
},
width: 600,
height: 400,
isNeedFreeze: true,
isNeedMerge: true,
freezeCols: [0, 1, 2],
mergeCols: [0, 1, 2],
minColumnSize: [100, 100, 100, 100, 100, 100, 100, 100, 100, 100],
columnSize: [100, 100, 100, 100, 100, 100, 100, 100, 100, 100],
header: header,
items: items,
crossHeader: crossHeader,
crossItems: crossItems
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.grid",
columns: 1,
rows: 1,
items: [[{
el: table
}]]
},
left: 10,
right: 10,
top: 10,
bottom: 10
}]
});
}
});
BI.shortcut("demo.layer_tree_table", Demo.Func);

149
demo/js/case/table/demo.tree_table.js

@ -1,149 +0,0 @@
Demo.Func = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-func"
},
render: function () {
var items = [{
children: [{
text: "节点1",
children: [{
text: "子节点1",
children: [{
text: "叶节点1",
values: [{text: 11}, {text: 12}, {text: 11}, {text: 12}, {text: 11}, {text: 12}, {text: 112}]
}, {
text: "叶节点2",
values: [{text: 21}, {text: 22}, {text: 21}, {text: 22}, {text: 21}, {text: 22}, {text: 122}]
}],
values: [{text: 101}, {text: 102}, {text: 101}, {text: 102}, {text: 101}, {text: 102}, {text: 1102}]
}, {
text: "子节点2",
children: [{
text: "叶节点3",
values: [{text: 31}, {text: 32}, {text: 31}, {text: 32}, {text: 31}, {text: 32}, {text: 132}]
}, {
text: "叶节点4",
values: [{text: 41}, {text: 42}, {text: 41}, {text: 42}, {text: 41}, {text: 42}, {text: 142}]
}],
values: [{text: 201}, {text: 202}, {text: 201}, {text: 202}, {text: 201}, {text: 202}, {text: 1202}]
}, {
text: "子节点3",
children: [{
text: "叶节点5",
values: [{text: 51}, {text: 52}, {text: 51}, {text: 52}, {text: 51}, {text: 52}, {text: 152}]
}],
values: [{text: 301}, {text: 302}, {text: 301}, {text: 302}, {text: 301}, {text: 302}, {text: 1302}]
}],
values: [{text: 1001}, {text: 1002}, {text: 1001}, {text: 1002}, {text: 1001}, {text: 1002}, {text: 11002}]
}, {
text: "节点2",
values: [{text: 2001}, {text: 2002}, {text: 2001}, {text: 2002}, {text: 2001}, {text: 2002}, {text: 12002}]
}],
values: [{text: 12001}, {text: 12002}, {text: 12001}, {text: 12002}, {text: 12001}, {text: 12002}, {text: 112002}]
}];
var header = [{
text: "header1"
}, {
text: "header2"
}, {
text: "header3"
}, {
text: "金额",
tag: 1
}, {
text: "金额",
tag: 2
}, {
text: "金额",
tag: 3
}, {
text: "金额",
tag: 4
}, {
text: "金额",
tag: 5
}, {
text: "金额",
tag: 6
}, {
text: "金额",
tag: 7
}];
var crossHeader = [{
text: "cross1"
}, {
text: "cross2"
}];
var crossItems = [{
children: [{
text: "节点1",
children: [{
text: "子节点1"
}, {
text: "子节点2"
}],
values: [0]
}, {
text: "节点2",
children: [{
text: "子节点3"
}, {
text: "子节点4"
}],
values: [0]
}],
values: [0]
}];
var table = BI.createWidget({
type: "bi.tree_table",
el: {
type: "bi.adaptive_table",
el: {
type: "bi.resizable_table",
el: {
type: "bi.collection_table",
mergeRule: function (col1, col2) {
return BI.isEqual(col1, col2);
}
}
}
},
width: 600,
height: 400,
isNeedFreeze: true,
isNeedMerge: true,
freezeCols: [0, 1, 2],
mergeCols: [0, 1, 2],
minColumnSize: [100, 100, 100, 100, 100, 100, 100, 100, 100, 100],
columnSize: [100, 100, 100, 100, 100, 100, 100, 100, 100, 100],
header: header,
items: items,
crossHeader: crossHeader,
crossItems: crossItems
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.grid",
columns: 1,
rows: 1,
items: [[{
el: table
}]]
},
left: 10,
right: 10,
top: 10,
bottom: 10
}]
});
}
});
BI.shortcut("demo.tree_table", Demo.Func);

20
demo/js/config/base.js

@ -94,26 +94,6 @@ Demo.BASE_CONFIG = [{
pId: 203,
text: "bi.part_tree",
value: "demo.part_tree"
}, {
pId: 2,
id: 204,
text: "table"
}, {
pId: 204,
text: "bi.table_view",
value: "demo.table_view"
}, {
pId: 204,
text: "bi.grid_table",
value: "demo.grid_table"
}, {
pId: 204,
text: "bi.collection_table",
value: "demo.collection_table"
}, {
pId: 204,
text: "bi.resizable_table",
value: "demo.resizable_table"
}, {
pId: 2,
text: "bi.pager",

16
demo/js/config/case.js

@ -178,22 +178,6 @@ Demo.CASE_CONFIG = [{
pId: 307,
text: "bi.branch_relation",
value: "demo.branch_relation"
}, {
pId: 3,
id: 308,
text: "table"
}, {
pId: 308,
text: "bi.adaptive_table",
value: "demo.adaptive_table"
}, {
pId: 308,
text: "bi.tree_table",
value: "demo.tree_table"
}, {
pId: 308,
text: "bi.layer_tree_table",
value: "demo.layer_tree_table"
}, {
pId: 3,
id: 309,

20
demo/js/config/widget.js

@ -66,26 +66,6 @@ Demo.WIDGET_CONFIG = [{
pId: 403,
text: "bi.switch_tree",
value: "demo.switch_tree"
}, {
pId: 4,
id: 404,
text: "table"
}, {
pId: 404,
text: "bi.preview_table",
value: "demo.preview_table"
}, {
pId: 404,
text: "bi.responsive_table",
value: "demo.responsive_table"
}, {
pId: 404,
text: "bi.sequence_table",
value: "demo.sequence_table"
}, {
pId: 404,
text: "bi.page_table",
value: "demo.page_table"
}, {
pId: 4,
id: 405,

2
demo/js/face.js

@ -551,7 +551,7 @@ Demo.Face = BI.inherit(BI.Widget, {
column: 0,
row: 0,
el: {
type: "demo.preview"
type: "bi.layout"
}
}, {
column: 1,

54
demo/js/widget/filemanager/demo.filemanager.js

@ -1,54 +0,0 @@
/*
Created by dailer on 2017 / 7 / 21.
*/
Demo.FileManager = BI.inherit(BI.Widget, {
props: {
baseCls: ""
},
render: function () {
var items = [{
id: "1",
value: "1",
text: "根目录",
lastModify: 1454316355142
}, {
id: "11",
pId: "1",
value: "11",
text: "第一级子目录1",
lastModify: 1454316355142
}, {
id: "12",
pId: "1",
value: "12",
text: "第一级子目录2",
lastModify: 1454316355142
}, {
id: "111",
pId: "11",
value: "111",
text: "第二级子目录",
lastModify: 1454316355142
}, {
id: "121",
pId: "111",
buildUrl: "www.baidu.com",
value: "121",
text: "文件1",
lastModify: 1454316355142
}, {
id: "122",
pId: "111",
buildUrl: "www.baidu.com",
value: "122",
text: "文件2",
lastModify: 1454316355142
}];
return {
type: "bi.file_manager",
items: items
};
}
});
BI.shortcut("demo.file_manager", Demo.FileManager);

215
demo/js/widget/table/demo.page_table.js

@ -1,215 +0,0 @@
Demo.Func = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-func"
},
render: function () {
var items = [{
children: [{
type: "bi.page_table_cell",
text: "node1",
children: [{
type: "bi.page_table_cell",
text: "childnode1",
values: [{type: "bi.page_table_cell", text: 101}, {
type: "bi.page_table_cell",
text: 102
}, {type: "bi.page_table_cell", text: 101}, {
type: "bi.page_table_cell",
text: 102
}, {type: "bi.page_table_cell", text: 101}]
}, {
type: "bi.page_table_cell",
text: "childnode2",
values: [{type: "bi.page_table_cell", text: 201}, {
type: "bi.page_table_cell",
text: 202
}, {type: "bi.page_table_cell", text: 201}, {
type: "bi.page_table_cell",
text: 202
}, {type: "bi.page_table_cell", text: 201}]
}],
values: [{type: "bi.page_table_cell", text: 1001}, {
type: "bi.page_table_cell",
text: 1002
}, {type: "bi.page_table_cell", text: 1001}, {
type: "bi.page_table_cell",
text: 1002
}, {type: "bi.page_table_cell", text: 1001}]
}], values: [{type: "bi.page_table_cell", text: 12001}, {
type: "bi.page_table_cell",
text: 12002
}, {type: "bi.page_table_cell", text: 12001}, {
type: "bi.page_table_cell",
text: 12002
}, {type: "bi.page_table_cell", text: 12001}]
}];
var header = [{
type: "bi.page_table_cell",
text: "header1"
}, {
type: "bi.page_table_cell",
text: "header2"
}, {
type: "bi.page_table_cell",
text: "jine",
tag: 1
}, {
type: "bi.page_table_cell",
text: "jine",
tag: 2
}, {
type: "bi.page_table_cell",
text: "jine",
tag: 3
}, {
type: "bi.page_table_cell",
text: "金额汇总",
tag: 4
}, {
type: "bi.page_table_cell",
text: "金额汇总2",
tag: 5
}];
var crossHeader = [{
type: "bi.page_table_cell",
text: "cross1"
}, {
type: "bi.page_table_cell",
text: "cross2"
}];
var crossItems = [{
children: [{
type: "bi.page_table_cell",
text: "node1",
values: [1, 2, 3]
}, {
type: "bi.page_table_cell",
text: "node3",
values: [1, 2]
}]
// values: [1, 2]
}];
var table1 = BI.createWidget({
type: "bi.page_table",
el: {
type: "bi.sequence_table",
showSequence: true,
el: {
type: "bi.dynamic_summary_tree_table",
el: {
type: "bi.adaptive_table",
el: {
type: "bi.resizable_table",
el: {
type: "bi.collection_table"
}
}
}
},
sequence: {
type: "bi.sequence_table_dynamic_number"
}
},
summaryCellStyleGetter: function (isLast) {
return isLast ? {
backgroundColor: "#6495ED",
color: "#ffffff"
} : {
backgroundColor: "#B0C4DE",
color: "#ffffff"
};
},
sequenceCellStyleGetter: function (index) {
return {
backgroundColor: "#87CEEB",
color: "#ffffff"
};
},
headerCellStyleGetter: function () {
return {
backgroundColor: "#6495ED",
color: "#ffffff"
};
},
pager: {
horizontal: {
pages: false, // 总页数
curr: 1, // 初始化当前页, pages为数字时可用
hasPrev: function (page) {
return page > 1;
},
hasNext: function (page) {
return page < 3;
}
},
vertical: {
pages: false, // 总页数
curr: 1, // 初始化当前页, pages为数字时可用
hasPrev: function (page) {
return page > 1;
},
hasNext: function (page) {
return page < 3;
}
}
},
itemsCreator: function (op, populate) {
var vpage = op.vpage || "";
var hpage = op.hpage || "";
BI.each(header, function (i, h) {
h.text = h.text + "V" + vpage + "H" + hpage;
});
populate(items, header, crossItems, crossHeader);
},
width: 600,
height: 400,
columnSize: [100, 100, 100, 100, 100, 100, 100],
minColumnSize: [100, 100, 100, 100, 100, 100, 100],
isNeedMerge: true,
isNeedFreeze: true,
mergeCols: [0, 1],
mergeRule: function (col1, col2) {
if (col1 === col2) {
return true;
}
if (col1.tag && col2.tag) {
return col1.tag === col2.tag;
}
return col1 === col2;
},
freezeCols: [0, 1],
header: header,
items: items,
crossHeader: crossHeader,
crossItems: crossItems
});
table1.populate();
// table1.populate(items, header, crossItems, crossHeader);
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.grid",
columns: 1,
rows: 1,
items: [[{
el: table1
}]]
},
left: 10,
right: 10,
top: 10,
bottom: 10
}]
});
}
});
BI.shortcut("demo.page_table", Demo.Func);

233
demo/js/widget/table/demo.preview_table.js

@ -1,233 +0,0 @@
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 header = [[{
text: "表头1"
}, {
text: "表头2"
}, {
text: "表头3"
}]];
var table1 = BI.createWidget({
type: "bi.preview_table",
columnSize: ["", "", ""],
header: header,
items: items
});
var table2 = BI.createWidget({
type: "bi.preview_table",
header: header,
columnSize: [100, "", 50],
items: items
});
var table3 = BI.createWidget({
type: "bi.preview_table",
header: header,
columnSize: [0.2, 0.4, 0.4],
headerRowSize: 30,
items: items
});
var table4 = BI.createWidget({
type: "bi.preview_table",
header: header,
isNeedFreeze: true,
freezeCols: [0, 1],
columnSize: [0.2, "", 0.4],
items: items
});
var table5 = BI.createWidget({
type: "bi.preview_table",
header: header,
isNeedFreeze: true,
freezeCols: [0, 1],
columnSize: [200, 100, ""],
items: items
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.grid",
columns: 3,
rows: 2,
items: [[{
el: {
type: "bi.absolute",
items: [{
el: table1,
left: 5,
right: 5,
top: 5,
bottom: 5
}]
}
}, {
el: {
type: "bi.absolute",
items: [{
el: table2,
left: 5,
right: 5,
top: 5,
bottom: 5
}]
}
}, {
el: {
type: "bi.absolute",
items: [{
el: table3,
left: 5,
right: 5,
top: 5,
bottom: 5
}]
}
}], [{
el: {
type: "bi.absolute",
items: [{
el: table4,
left: 5,
right: 5,
top: 5,
bottom: 5
}]
}
}, {
el: {
type: "bi.absolute",
items: [{
el: table5,
left: 5,
right: 5,
top: 5,
bottom: 5
}]
}
}]]
},
left: 10,
right: 10,
top: 10,
bottom: 10
}]
});
}
});
BI.shortcut("demo.preview_table", Demo.Func);

159
demo/js/widget/table/demo.responsive_table.js

@ -1,159 +0,0 @@
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 header = [[{
text: "表头1"
}, {
text: "表头2"
}, {
text: "表头3"
}]];
var table1 = BI.createWidget({
type: "bi.responsive_table",
isNeedMerge: true,
isNeedFreeze: true,
mergeCols: [0, 1],
items: [],
header: []
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.tab",
showIndex: 1,
cardCreator: function (v) {
switch (v) {
case 1:
table1.attr("columnSize", ["", "", ""]);
table1.populate(items, header);
return table1;
}
}
},
left: 10,
right: 10,
top: 10,
bottom: 10
}]
});
}
});
BI.shortcut("demo.responsive_table", Demo.Func);

159
demo/js/widget/table/demo.sequence_table.js

@ -1,159 +0,0 @@
Demo.Func = BI.inherit(BI.Widget, {
props: {
baseCls: "demo-func"
},
render: function () {
var items = [{
children: [{
text: "节点1",
children: [{
text: "子节点1",
children: [{
text: "叶节点1",
values: [{text: 11}, {text: 12}, {text: 11}, {text: 12}, {text: 11}, {text: 12}, {text: 112}]
}, {
text: "叶节点2",
values: [{text: 21}, {text: 22}, {text: 21}, {text: 22}, {text: 21}, {text: 22}, {text: 122}]
}],
values: [{text: 101}, {text: 102}, {text: 101}, {text: 102}, {text: 101}, {text: 102}, {text: 1102}]
}, {
text: "子节点2",
children: [{
text: "叶节点3",
values: [{text: 31}, {text: 32}, {text: 31}, {text: 32}, {text: 31}, {text: 32}, {text: 132}]
}, {
text: "叶节点4",
values: [{text: 41}, {text: 42}, {text: 41}, {text: 42}, {text: 41}, {text: 42}, {text: 142}]
}],
values: [{text: 201}, {text: 202}, {text: 201}, {text: 202}, {text: 201}, {text: 202}, {text: 1202}]
}, {
text: "子节点3",
children: [{
text: "叶节点5",
values: [{text: 51}, {text: 52}, {text: 51}, {text: 52}, {text: 51}, {text: 52}, {text: 152}]
}],
values: [{text: 301}, {text: 302}, {text: 301}, {text: 302}, {text: 301}, {text: 302}, {text: 1302}]
}],
values: [{text: 1001}, {text: 1002}, {text: 1001}, {text: 1002}, {text: 1001}, {text: 1002}, {text: 11002}]
}, {
text: "节点2",
values: [{text: 2001}, {text: 2002}, {text: 2001}, {text: 2002}, {text: 2001}, {text: 2002}, {text: 12002}]
}],
values: [{text: 12001}, {text: 12002}, {text: 12001}, {text: 12002}, {text: 12001}, {text: 12002}, {text: 112002}]
}];
var header = [{
text: "header1"
}, {
text: "header2"
}, {
text: "header3"
}, {
text: "金额",
tag: 1
}, {
text: "金额",
tag: 2
}, {
text: "金额",
tag: 3
}, {
text: "金额",
tag: 4
}, {
text: "金额",
tag: 5
}, {
text: "金额",
tag: 6
}, {
text: "金额",
tag: 7
}];
var crossHeader = [{
text: "cross1"
}, {
text: "cross2"
}];
var crossItems = [{
children: [{
text: "节点1",
children: [{
text: "子节点1"
}, {
text: "子节点2"
}],
values: [0]
}, {
text: "节点2",
children: [{
text: "子节点3"
}, {
text: "子节点4"
}],
values: [0]
}],
values: [0]
}];
var table = BI.createWidget({
type: "bi.sequence_table",
el: {
type: "bi.tree_table",
el: {
type: "bi.adaptive_table",
el: {
type: "bi.resizable_table",
el: {
type: "bi.collection_table"
}
}
}
},
sequence: {
type: "bi.sequence_table_tree_number"
},
showSequence: true,
width: 600,
height: 400,
isNeedResize: true,
isNeedMerge: true,
mergeRule: function (row1, row2) {
return row1 === row2;
},
columnSize: [100, 100, 100, 100, 100, 100, 100, 100, 100, 100],
minColumnSize: [100, 100, 100, 100, 100, 100, 100, 100, 100, 100],
isNeedFreeze: true,
freezeCols: [0, 1, 2],
mergeCols: [0, 1, 2],
header: header,
items: items,
crossHeader: crossHeader,
crossItems: crossItems
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: {
type: "bi.grid",
columns: 1,
rows: 1,
items: [{
column: 0,
row: 0,
el: table
}]
},
left: 10,
right: 10,
top: 10,
bottom: 50
}]
});
}
});
BI.shortcut("demo.sequence_table", Demo.Func);

71
dist/_fineui.min.js vendored

File diff suppressed because one or more lines are too long

284
dist/base.css vendored

@ -393,7 +393,7 @@
position: absolute;
width: 6px;
height: 6px;
margin-left: 3px;
margin-left: 2px;
margin-top: -3px;
content: "";
transform: rotate(-45deg);
@ -408,7 +408,7 @@
position: absolute;
width: 6px;
height: 6px;
margin-left: 3px;
margin-left: 2px;
margin-top: 3px;
content: "";
transform: rotate(135deg);
@ -439,12 +439,12 @@
width: 6px;
height: 6px;
margin-left: 3px;
margin-top: 3px;
margin-top: 2px;
content: "";
transform: rotate(-135deg);
}
.bi-bubble-combo .bubble-combo-triangle-left:before,
.bi-bubble-combo.bubble-combo-triangle-right:before,
.bi-bubble-combo .bubble-combo-triangle-right:before,
.bi-bubble-combo .bubble-combo-triangle-top:before,
.bi-bubble-combo .bubble-combo-triangle-bottom:before {
background-color: #ffffff;
@ -452,7 +452,7 @@
border-right: 1px solid #f2f4f7;
}
.bi-theme-dark .bi-bubble-combo .bubble-combo-triangle-left:before,
.bi-theme-dark .bi-bubble-combo.bubble-combo-triangle-right:before,
.bi-theme-dark .bi-bubble-combo .bubble-combo-triangle-right:before,
.bi-theme-dark .bi-bubble-combo .bubble-combo-triangle-top:before,
.bi-theme-dark .bi-bubble-combo .bubble-combo-triangle-bottom:before {
background-color: #242640;
@ -1173,280 +1173,6 @@ body .bi-button.button-ignore.disabled.ghost .b-font:before,
background: #ff4949;
border: 1px solid #e85050;
}
.bi-collection-table-cell {
-webkit-box-sizing: border-box;
/*Safari3.2+*/
-moz-box-sizing: border-box;
/*Firefox3.5+*/
-ms-box-sizing: border-box;
/*IE8*/
box-sizing: border-box;
/*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/
}
.bi-collection-table-cell.first-row {
border-top: 1px solid #e8eaed;
}
.bi-collection-table-cell.first-col {
border-left: 1px solid #e8eaed;
}
.bi-theme-dark .bi-collection-table-cell.first-row {
border-top: 1px solid #3a3c53;
}
.bi-theme-dark .bi-collection-table-cell.first-col {
border-left: 1px solid #3a3c53;
}
.bi-quick-collection-table > div > .bi-collection {
overflow: hidden !important;
overflow-x: hidden !important;
overflow-y: hidden !important;
}
.bi-grid-table-cell {
-webkit-box-sizing: border-box;
/*Safari3.2+*/
-moz-box-sizing: border-box;
/*Firefox3.5+*/
-ms-box-sizing: border-box;
/*IE8*/
box-sizing: border-box;
/*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/
}
.bi-grid-table-cell.first-row {
border-top: 1px solid #e8eaed;
}
.bi-grid-table-cell.first-col {
border-left: 1px solid #e8eaed;
}
.bi-theme-dark .bi-grid-table-cell.first-row {
border-top: 1px solid #3a3c53;
}
.bi-theme-dark .bi-grid-table-cell.first-col {
border-left: 1px solid #3a3c53;
}
.scrollbar-layout-main {
box-sizing: border-box;
outline: none;
overflow: hidden;
position: absolute;
transition-duration: 250ms;
transition-timing-function: ease;
user-select: none;
background-color: rgba(135, 141, 159, 0.05);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d878d9f,endColorstr=#0d878d9f);
border-radius: 5px;
}
.bi-theme-dark .scrollbar-layout-main {
background-color: rgba(208, 212, 218, 0.05);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dd0d4da,endColorstr=#0dd0d4da);
}
.scrollbar-layout-main-vertical {
bottom: 0;
right: 0;
top: 0;
transition-property: background-color;
width: 10px;
}
.scrollbar-layout-main-vertical.public-scrollbar-main-active,
.scrollbar-layout-main-vertical:hover {
width: 10px;
}
.scrollbar-layout-main-horizontal {
bottom: 0;
height: 10px;
left: 0;
transition-property: background-color;
background-color: rgba(135, 141, 159, 0.05);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d878d9f,endColorstr=#0d878d9f);
}
.bi-theme-dark .scrollbar-layout-main-horizontal {
background-color: rgba(208, 212, 218, 0.05);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dd0d4da,endColorstr=#0dd0d4da);
}
/* Touching the scroll-track directly makes the scroll-track bolder */
.scrollbar-layout-main-horizontal.public-scrollbar-main-active,
.scrollbar-layout-main-horizontal:hover {
height: 10px;
}
.scrollbar-layout-face {
left: 0;
overflow: hidden;
position: absolute;
z-index: 1;
}
/**
* This selector renders the "nub" of the scrollface. The nub must
* be rendered as pseudo-element so that it won't receive any UI events then
* we can get the correct `event.offsetX` and `event.offsetY` from the
* scrollface element while dragging it.
*/
.scrollbar-layout-face:after {
border-radius: 6px;
content: '';
display: block;
position: absolute;
transition: background-color 250ms ease;
}
.scrollbar-layout-face-horizontal {
bottom: 0;
left: 0;
top: 0;
}
.scrollbar-layout-face-horizontal:after {
bottom: 2px;
left: 0;
top: 2px;
width: 100%;
}
.scrollbar-layout-face-vertical {
left: 0;
right: 0;
top: 0;
}
.scrollbar-layout-face-vertical:after {
height: 100%;
left: 2px;
right: 2px;
top: 0;
}
/**
* scrollbars.
*/
/* Touching the scroll-track directly makes the scroll-track bolder */
.public-scrollbar-face:after {
background-color: rgba(135, 141, 159, 0.3);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4d878d9f,endColorstr=#4d878d9f);
}
.bi-theme-dark .public-scrollbar-face:after {
background-color: rgba(208, 212, 218, 0.3);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4dd0d4da,endColorstr=#4dd0d4da);
}
.public-scrollbar-main:hover .public-scrollbar-face:after,
.public-scrollbar-main-active .public-scrollbar-face:after,
.public-scrollbar-face-active:after {
background-color: rgba(135, 141, 159, 0.7);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3878d9f,endColorstr=#b3878d9f);
}
.bi-theme-dark .public-scrollbar-main:hover .public-scrollbar-face:after,
.bi-theme-dark .public-scrollbar-main-active .public-scrollbar-face:after,
.bi-theme-dark .public-scrollbar-face-active:after {
background-color: rgba(208, 212, 218, 0.7);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3d0d4da,endColorstr=#b3d0d4da);
}
.horizontal-scrollbar {
bottom: 0;
position: absolute;
}
.bi-table > .first-col {
border-left: none;
}
.bi-table > .first-row {
border-top: none;
}
.bi-table > div > div > table {
border-bottom: 1px solid #e8eaed;
border-right: 1px solid #e8eaed;
}
.bi-table > div.top-left > div > div > table {
border-bottom: 1px solid #e8eaed;
border-right: 1px solid #e8eaed;
}
.bi-table > div.top-right > div > div > table {
border-bottom: 1px solid #e8eaed;
border-right: 1px solid #e8eaed;
}
.bi-table > div.bottom-left > div > div > table {
border-bottom: 1px solid #e8eaed;
border-right: 1px solid #e8eaed;
}
.bi-table > div.bottom-right > div > div > table {
border-right: 1px solid #e8eaed;
border-bottom: 1px solid #e8eaed;
}
.bi-table > div > div > table,
.bi-table > div > div > div > table {
min-width: 100%;
clear: both;
vertical-align: middle;
border-spacing: 0;
border-collapse: separate;
}
.bi-table > div > div > table,
.bi-table > div > div > div > table,
.bi-table > div > div > table > * > * > th,
.bi-table > div > div > div > table > * > * > th,
.bi-table > div > div > table > * > * > td,
.bi-table > div > div > div > table > * > * > td {
vertical-align: middle;
margin: 0;
padding: 0;
}
.bi-table > div > div > table > tbody > tr > td,
.bi-table > div > div > div > table > tbody > tr > td,
.bi-table > div > div > table > thead > tr > td,
.bi-table > div > div > div > table > thead > tr > td {
border-top: 1px solid #e8eaed;
border-left: 1px solid #e8eaed;
}
.bi-theme-dark .bi-table > div > div > table {
border-bottom: 1px solid #3a3c53;
border-right: 1px solid #3a3c53;
}
.bi-theme-dark .bi-table > div.top-left > div > div > table {
border-bottom: 1px solid #3a3c53;
border-right: 1px solid #3a3c53;
}
.bi-theme-dark .bi-table > div.top-right > div > div > table {
border-bottom: 1px solid #3a3c53;
border-right: 1px solid #3a3c53;
}
.bi-theme-dark .bi-table > div.bottom-left > div > div > table {
border-bottom: 1px solid #3a3c53;
border-right: 1px solid #3a3c53;
}
.bi-theme-dark .bi-table > div.bottom-right > div > div > table {
border-right: 1px solid #3a3c53;
border-bottom: 1px solid #3a3c53;
}
.bi-theme-dark .bi-table > div > div > table > tbody > tr > td,
.bi-theme-dark .bi-table > div > div > div > table > tbody > tr > td,
.bi-theme-dark .bi-table > div > div > table > thead > tr > td,
.bi-theme-dark .bi-table > div > div > div > table > thead > tr > td {
border-top: 1px solid #3a3c53;
border-left: 1px solid #3a3c53;
}
.bi-resizable-table-cell .resizable-table-cell-resizer-container {
cursor: ew-resize;
z-index: 1;
}
.bi-resizable-table-cell .resizable-table-cell-resizer-container:hover .resizable-table-cell-resizer-knob,
.bi-resizable-table-cell .resizable-table-cell-resizer-container.dragging .resizable-table-cell-resizer-knob {
background-color: #3685f2;
}
.bi-resizable-table-cell .resizable-table-cell-resizer-container.suitable .resizable-table-cell-resizer-knob {
background-color: #13cd66;
}
.bi-resizable-table .resizable-table-resizer {
cursor: ew-resize;
z-index: 1;
background-color: #3685f2;
}
.bi-resizable-table .resizable-table-resizer.suitable {
background-color: #13cd66;
}
.bi-resizable-table .resizable-table-region-resizer {
cursor: ew-resize;
z-index: 1;
}
.bi-resizable-table .resizable-table-region-resizer:hover .resizable-table-region-resizer-knob,
.bi-resizable-table .resizable-table-region-resizer.dragging .resizable-table-region-resizer-knob {
background-color: #3685f2;
}
.bi-branch-tree .bi-branch-tree-view {
min-width: 300px;
}

4309
dist/base.js vendored

File diff suppressed because it is too large Load Diff

345
dist/bundle.css vendored

@ -1221,6 +1221,29 @@ textarea {
.bi-list-item-select3.disabled.active {
background-color: #ffffff !important;
}
.bi-theme-dark .bi-list-item-select3:hover,
.bi-theme-dark .bi-list-item-select3.hover {
background-color: #191B2B;
}
.bi-theme-dark .bi-list-item-select3:active,
.bi-theme-dark .bi-list-item-select3.active {
color: #3685f2;
background-color: #191B2B;
}
.bi-theme-dark .bi-list-item-select3:active .bi-input,
.bi-theme-dark .bi-list-item-select3.active .bi-input {
color: #3685f2;
}
.bi-theme-dark .bi-list-item-select3:active .bi-textarea,
.bi-theme-dark .bi-list-item-select3.active .bi-textarea {
color: #3685f2;
}
.bi-theme-dark .bi-list-item-select3.disabled:hover,
.bi-theme-dark .bi-list-item-select3.disabled.hover,
.bi-theme-dark .bi-list-item-select3.disabled:active,
.bi-theme-dark .bi-list-item-select3.disabled.active {
background-color: #242640 !important;
}
.bi-theme-dark .bi-list-item-select:hover,
.bi-theme-dark .bi-list-item-select.hover {
color: #ffffff;
@ -2266,7 +2289,7 @@ textarea {
position: absolute;
width: 6px;
height: 6px;
margin-left: 3px;
margin-left: 2px;
margin-top: -3px;
content: "";
transform: rotate(-45deg);
@ -2281,7 +2304,7 @@ textarea {
position: absolute;
width: 6px;
height: 6px;
margin-left: 3px;
margin-left: 2px;
margin-top: 3px;
content: "";
transform: rotate(135deg);
@ -2312,12 +2335,12 @@ textarea {
width: 6px;
height: 6px;
margin-left: 3px;
margin-top: 3px;
margin-top: 2px;
content: "";
transform: rotate(-135deg);
}
.bi-bubble-combo .bubble-combo-triangle-left:before,
.bi-bubble-combo.bubble-combo-triangle-right:before,
.bi-bubble-combo .bubble-combo-triangle-right:before,
.bi-bubble-combo .bubble-combo-triangle-top:before,
.bi-bubble-combo .bubble-combo-triangle-bottom:before {
background-color: #ffffff;
@ -2325,7 +2348,7 @@ textarea {
border-right: 1px solid #f2f4f7;
}
.bi-theme-dark .bi-bubble-combo .bubble-combo-triangle-left:before,
.bi-theme-dark .bi-bubble-combo.bubble-combo-triangle-right:before,
.bi-theme-dark .bi-bubble-combo .bubble-combo-triangle-right:before,
.bi-theme-dark .bi-bubble-combo .bubble-combo-triangle-top:before,
.bi-theme-dark .bi-bubble-combo .bubble-combo-triangle-bottom:before {
background-color: #242640;
@ -3046,280 +3069,6 @@ body .bi-button.button-ignore.disabled.ghost .b-font:before,
background: #ff4949;
border: 1px solid #e85050;
}
.bi-collection-table-cell {
-webkit-box-sizing: border-box;
/*Safari3.2+*/
-moz-box-sizing: border-box;
/*Firefox3.5+*/
-ms-box-sizing: border-box;
/*IE8*/
box-sizing: border-box;
/*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/
}
.bi-collection-table-cell.first-row {
border-top: 1px solid #e8eaed;
}
.bi-collection-table-cell.first-col {
border-left: 1px solid #e8eaed;
}
.bi-theme-dark .bi-collection-table-cell.first-row {
border-top: 1px solid #3a3c53;
}
.bi-theme-dark .bi-collection-table-cell.first-col {
border-left: 1px solid #3a3c53;
}
.bi-quick-collection-table > div > .bi-collection {
overflow: hidden !important;
overflow-x: hidden !important;
overflow-y: hidden !important;
}
.bi-grid-table-cell {
-webkit-box-sizing: border-box;
/*Safari3.2+*/
-moz-box-sizing: border-box;
/*Firefox3.5+*/
-ms-box-sizing: border-box;
/*IE8*/
box-sizing: border-box;
/*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/
}
.bi-grid-table-cell.first-row {
border-top: 1px solid #e8eaed;
}
.bi-grid-table-cell.first-col {
border-left: 1px solid #e8eaed;
}
.bi-theme-dark .bi-grid-table-cell.first-row {
border-top: 1px solid #3a3c53;
}
.bi-theme-dark .bi-grid-table-cell.first-col {
border-left: 1px solid #3a3c53;
}
.scrollbar-layout-main {
box-sizing: border-box;
outline: none;
overflow: hidden;
position: absolute;
transition-duration: 250ms;
transition-timing-function: ease;
user-select: none;
background-color: rgba(135, 141, 159, 0.05);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d878d9f,endColorstr=#0d878d9f);
border-radius: 5px;
}
.bi-theme-dark .scrollbar-layout-main {
background-color: rgba(208, 212, 218, 0.05);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dd0d4da,endColorstr=#0dd0d4da);
}
.scrollbar-layout-main-vertical {
bottom: 0;
right: 0;
top: 0;
transition-property: background-color;
width: 10px;
}
.scrollbar-layout-main-vertical.public-scrollbar-main-active,
.scrollbar-layout-main-vertical:hover {
width: 10px;
}
.scrollbar-layout-main-horizontal {
bottom: 0;
height: 10px;
left: 0;
transition-property: background-color;
background-color: rgba(135, 141, 159, 0.05);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d878d9f,endColorstr=#0d878d9f);
}
.bi-theme-dark .scrollbar-layout-main-horizontal {
background-color: rgba(208, 212, 218, 0.05);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dd0d4da,endColorstr=#0dd0d4da);
}
/* Touching the scroll-track directly makes the scroll-track bolder */
.scrollbar-layout-main-horizontal.public-scrollbar-main-active,
.scrollbar-layout-main-horizontal:hover {
height: 10px;
}
.scrollbar-layout-face {
left: 0;
overflow: hidden;
position: absolute;
z-index: 1;
}
/**
* This selector renders the "nub" of the scrollface. The nub must
* be rendered as pseudo-element so that it won't receive any UI events then
* we can get the correct `event.offsetX` and `event.offsetY` from the
* scrollface element while dragging it.
*/
.scrollbar-layout-face:after {
border-radius: 6px;
content: '';
display: block;
position: absolute;
transition: background-color 250ms ease;
}
.scrollbar-layout-face-horizontal {
bottom: 0;
left: 0;
top: 0;
}
.scrollbar-layout-face-horizontal:after {
bottom: 2px;
left: 0;
top: 2px;
width: 100%;
}
.scrollbar-layout-face-vertical {
left: 0;
right: 0;
top: 0;
}
.scrollbar-layout-face-vertical:after {
height: 100%;
left: 2px;
right: 2px;
top: 0;
}
/**
* scrollbars.
*/
/* Touching the scroll-track directly makes the scroll-track bolder */
.public-scrollbar-face:after {
background-color: rgba(135, 141, 159, 0.3);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4d878d9f,endColorstr=#4d878d9f);
}
.bi-theme-dark .public-scrollbar-face:after {
background-color: rgba(208, 212, 218, 0.3);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4dd0d4da,endColorstr=#4dd0d4da);
}
.public-scrollbar-main:hover .public-scrollbar-face:after,
.public-scrollbar-main-active .public-scrollbar-face:after,
.public-scrollbar-face-active:after {
background-color: rgba(135, 141, 159, 0.7);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3878d9f,endColorstr=#b3878d9f);
}
.bi-theme-dark .public-scrollbar-main:hover .public-scrollbar-face:after,
.bi-theme-dark .public-scrollbar-main-active .public-scrollbar-face:after,
.bi-theme-dark .public-scrollbar-face-active:after {
background-color: rgba(208, 212, 218, 0.7);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3d0d4da,endColorstr=#b3d0d4da);
}
.horizontal-scrollbar {
bottom: 0;
position: absolute;
}
.bi-table > .first-col {
border-left: none;
}
.bi-table > .first-row {
border-top: none;
}
.bi-table > div > div > table {
border-bottom: 1px solid #e8eaed;
border-right: 1px solid #e8eaed;
}
.bi-table > div.top-left > div > div > table {
border-bottom: 1px solid #e8eaed;
border-right: 1px solid #e8eaed;
}
.bi-table > div.top-right > div > div > table {
border-bottom: 1px solid #e8eaed;
border-right: 1px solid #e8eaed;
}
.bi-table > div.bottom-left > div > div > table {
border-bottom: 1px solid #e8eaed;
border-right: 1px solid #e8eaed;
}
.bi-table > div.bottom-right > div > div > table {
border-right: 1px solid #e8eaed;
border-bottom: 1px solid #e8eaed;
}
.bi-table > div > div > table,
.bi-table > div > div > div > table {
min-width: 100%;
clear: both;
vertical-align: middle;
border-spacing: 0;
border-collapse: separate;
}
.bi-table > div > div > table,
.bi-table > div > div > div > table,
.bi-table > div > div > table > * > * > th,
.bi-table > div > div > div > table > * > * > th,
.bi-table > div > div > table > * > * > td,
.bi-table > div > div > div > table > * > * > td {
vertical-align: middle;
margin: 0;
padding: 0;
}
.bi-table > div > div > table > tbody > tr > td,
.bi-table > div > div > div > table > tbody > tr > td,
.bi-table > div > div > table > thead > tr > td,
.bi-table > div > div > div > table > thead > tr > td {
border-top: 1px solid #e8eaed;
border-left: 1px solid #e8eaed;
}
.bi-theme-dark .bi-table > div > div > table {
border-bottom: 1px solid #3a3c53;
border-right: 1px solid #3a3c53;
}
.bi-theme-dark .bi-table > div.top-left > div > div > table {
border-bottom: 1px solid #3a3c53;
border-right: 1px solid #3a3c53;
}
.bi-theme-dark .bi-table > div.top-right > div > div > table {
border-bottom: 1px solid #3a3c53;
border-right: 1px solid #3a3c53;
}
.bi-theme-dark .bi-table > div.bottom-left > div > div > table {
border-bottom: 1px solid #3a3c53;
border-right: 1px solid #3a3c53;
}
.bi-theme-dark .bi-table > div.bottom-right > div > div > table {
border-right: 1px solid #3a3c53;
border-bottom: 1px solid #3a3c53;
}
.bi-theme-dark .bi-table > div > div > table > tbody > tr > td,
.bi-theme-dark .bi-table > div > div > div > table > tbody > tr > td,
.bi-theme-dark .bi-table > div > div > table > thead > tr > td,
.bi-theme-dark .bi-table > div > div > div > table > thead > tr > td {
border-top: 1px solid #3a3c53;
border-left: 1px solid #3a3c53;
}
.bi-resizable-table-cell .resizable-table-cell-resizer-container {
cursor: ew-resize;
z-index: 1;
}
.bi-resizable-table-cell .resizable-table-cell-resizer-container:hover .resizable-table-cell-resizer-knob,
.bi-resizable-table-cell .resizable-table-cell-resizer-container.dragging .resizable-table-cell-resizer-knob {
background-color: #3685f2;
}
.bi-resizable-table-cell .resizable-table-cell-resizer-container.suitable .resizable-table-cell-resizer-knob {
background-color: #13cd66;
}
.bi-resizable-table .resizable-table-resizer {
cursor: ew-resize;
z-index: 1;
background-color: #3685f2;
}
.bi-resizable-table .resizable-table-resizer.suitable {
background-color: #13cd66;
}
.bi-resizable-table .resizable-table-region-resizer {
cursor: ew-resize;
z-index: 1;
}
.bi-resizable-table .resizable-table-region-resizer:hover .resizable-table-region-resizer-knob,
.bi-resizable-table .resizable-table-region-resizer.dragging .resizable-table-region-resizer-knob {
background-color: #3685f2;
}
.bi-branch-tree .bi-branch-tree-view {
min-width: 300px;
}
@ -3656,17 +3405,6 @@ ul.ztree.zTreeDragUL {
.bi-dynamic-date-combo .date-font {
font-size: 16px;
}
.bi-excel-table-header-cell {
font-weight: bold;
}
.bi-excel-table > div.bottom-right > div > div > table {
border-right: 1px solid #e8eaed;
}
.bi-theme-dark .bi-excel-table > div.bottom-right > div > div > table {
border-right: 1px solid #3a3c53;
}
.bi-interactive-arrangement .interactive-arrangement-dragtag-line {
z-index: 1000000000;
background-color: #faaa39;
@ -3821,33 +3559,6 @@ ul.ztree.zTreeDragUL {
.bi-number-interval.number-error .bi-input {
color: #ff4949 !important;
}
.bi-preview-table-cell {
min-height: 25px;
min-width: 80px;
}
.bi-preview-table-header-cell {
font-weight: bold;
min-height: 25px;
min-width: 80px;
}
.bi-preview-table {
-webkit-user-select: text;
-khtml-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
-o-user-select: text;
user-select: text;
}
.bi-preview-table > div > table > thead > tr.odd,
.bi-preview-table > div > div > div > table > thead > tr.odd {
background-color: #f7f8fa;
}
.bi-theme-dark .bi-preview-table > div > table > thead > tr.odd,
.bi-theme-dark .bi-preview-table > div > div > div > table > thead > tr.odd {
background-color: #191B2B;
}
.bi-quarter-trigger {
-webkit-border-radius: 2px;
-moz-border-radius: 2px;

29016
dist/bundle.js vendored

File diff suppressed because it is too large Load Diff

2
dist/bundle.min.css vendored

File diff suppressed because one or more lines are too long

71
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

14306
dist/case.js vendored

File diff suppressed because it is too large Load Diff

23
dist/core.css vendored

@ -1221,6 +1221,29 @@ textarea {
.bi-list-item-select3.disabled.active {
background-color: #ffffff !important;
}
.bi-theme-dark .bi-list-item-select3:hover,
.bi-theme-dark .bi-list-item-select3.hover {
background-color: #191B2B;
}
.bi-theme-dark .bi-list-item-select3:active,
.bi-theme-dark .bi-list-item-select3.active {
color: #3685f2;
background-color: #191B2B;
}
.bi-theme-dark .bi-list-item-select3:active .bi-input,
.bi-theme-dark .bi-list-item-select3.active .bi-input {
color: #3685f2;
}
.bi-theme-dark .bi-list-item-select3:active .bi-textarea,
.bi-theme-dark .bi-list-item-select3.active .bi-textarea {
color: #3685f2;
}
.bi-theme-dark .bi-list-item-select3.disabled:hover,
.bi-theme-dark .bi-list-item-select3.disabled.hover,
.bi-theme-dark .bi-list-item-select3.disabled:active,
.bi-theme-dark .bi-list-item-select3.disabled.active {
background-color: #242640 !important;
}
.bi-theme-dark .bi-list-item-select:hover,
.bi-theme-dark .bi-list-item-select.hover {
color: #ffffff;

895
dist/core.js vendored

@ -21918,135 +21918,6 @@ BI.Widget = BI.inherit(BI.OB, {
return BI.aspect;
})(window);
!(function () {
var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
// private method for UTF-8 encoding
var _utf8_encode = function (string) {
string = string.replace(/\r\n/g, "\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
} else if ((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
} else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
};
// private method for UTF-8 decoding
var _utf8_decode = function (utftext) {
var string = "";
var i = 0;
var c = 0, c3 = 0, c2 = 0;
while (i < utftext.length) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
} else if ((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i + 1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
} else {
c2 = utftext.charCodeAt(i + 1);
c3 = utftext.charCodeAt(i + 2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return string;
};
_.extend(BI, {
encode: function (input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = _utf8_encode(input);
while (i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
}
return output;
},
// public method for decoding
decode: function (input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length) {
enc1 = _keyStr.indexOf(input.charAt(i++));
enc2 = _keyStr.indexOf(input.charAt(i++));
enc3 = _keyStr.indexOf(input.charAt(i++));
enc4 = _keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {
output = output + String.fromCharCode(chr3);
}
}
output = _utf8_decode(output);
return output;
}
});
})();
BI.Cache = {
_prefix: "bi",
setUsername: function (username) {
@ -23095,414 +22966,6 @@ BI.ScalingCellSizeAndPositionManager.prototype = {
}
};
})();
(function () {
var clamp = function (min, value, max) {
if (value < min) {
return min;
}
if (value > max) {
return max;
}
return value;
};
var BUFFER_ROWS = 5;
var NO_ROWS_SCROLL_RESULT = {
index: 0,
offset: 0,
position: 0,
contentHeight: 0
};
BI.TableScrollHelper = function (rowCount,
defaultRowHeight,
viewportHeight,
rowHeightGetter) {
this._rowOffsets = BI.PrefixIntervalTree.uniform(rowCount, defaultRowHeight);
this._storedHeights = new Array(rowCount);
for (var i = 0; i < rowCount; ++i) {
this._storedHeights[i] = defaultRowHeight;
}
this._rowCount = rowCount;
this._position = 0;
this._contentHeight = rowCount * defaultRowHeight;
this._defaultRowHeight = defaultRowHeight;
this._rowHeightGetter = rowHeightGetter ?
rowHeightGetter : function () {
return defaultRowHeight;
};
this._viewportHeight = viewportHeight;
this._updateHeightsInViewport(0, 0);
};
BI.TableScrollHelper.prototype = {
constructor: BI.TableScrollHelper,
setRowHeightGetter: function (rowHeightGetter) {
this._rowHeightGetter = rowHeightGetter;
},
setViewportHeight: function (viewportHeight) {
this._viewportHeight = viewportHeight;
},
getContentHeight: function () {
return this._contentHeight;
},
_updateHeightsInViewport: function (firstRowIndex,
firstRowOffset) {
var top = firstRowOffset;
var index = firstRowIndex;
while (top <= this._viewportHeight && index < this._rowCount) {
this._updateRowHeight(index);
top += this._storedHeights[index];
index++;
}
},
_updateHeightsAboveViewport: function (firstRowIndex) {
var index = firstRowIndex - 1;
while (index >= 0 && index >= firstRowIndex - BUFFER_ROWS) {
var delta = this._updateRowHeight(index);
this._position += delta;
index--;
}
},
_updateRowHeight: function (rowIndex) {
if (rowIndex < 0 || rowIndex >= this._rowCount) {
return 0;
}
var newHeight = this._rowHeightGetter(rowIndex);
if (newHeight !== this._storedHeights[rowIndex]) {
var change = newHeight - this._storedHeights[rowIndex];
this._rowOffsets.set(rowIndex, newHeight);
this._storedHeights[rowIndex] = newHeight;
this._contentHeight += change;
return change;
}
return 0;
},
getRowPosition: function (rowIndex) {
this._updateRowHeight(rowIndex);
return this._rowOffsets.sumUntil(rowIndex);
},
scrollBy: function (delta) {
if (this._rowCount === 0) {
return NO_ROWS_SCROLL_RESULT;
}
var firstRow = this._rowOffsets.greatestLowerBound(this._position);
firstRow = clamp(firstRow, 0, Math.max(this._rowCount - 1, 0));
var firstRowPosition = this._rowOffsets.sumUntil(firstRow);
var rowIndex = firstRow;
var position = this._position;
var rowHeightChange = this._updateRowHeight(rowIndex);
if (firstRowPosition !== 0) {
position += rowHeightChange;
}
var visibleRowHeight = this._storedHeights[rowIndex] -
(position - firstRowPosition);
if (delta >= 0) {
while (delta > 0 && rowIndex < this._rowCount) {
if (delta < visibleRowHeight) {
position += delta;
delta = 0;
} else {
delta -= visibleRowHeight;
position += visibleRowHeight;
rowIndex++;
}
if (rowIndex < this._rowCount) {
this._updateRowHeight(rowIndex);
visibleRowHeight = this._storedHeights[rowIndex];
}
}
} else if (delta < 0) {
delta = -delta;
var invisibleRowHeight = this._storedHeights[rowIndex] - visibleRowHeight;
while (delta > 0 && rowIndex >= 0) {
if (delta < invisibleRowHeight) {
position -= delta;
delta = 0;
} else {
position -= invisibleRowHeight;
delta -= invisibleRowHeight;
rowIndex--;
}
if (rowIndex >= 0) {
var change = this._updateRowHeight(rowIndex);
invisibleRowHeight = this._storedHeights[rowIndex];
position += change;
}
}
}
var maxPosition = this._contentHeight - this._viewportHeight;
position = clamp(position, 0, maxPosition);
this._position = position;
var firstRowIndex = this._rowOffsets.greatestLowerBound(position);
firstRowIndex = clamp(firstRowIndex, 0, Math.max(this._rowCount - 1, 0));
firstRowPosition = this._rowOffsets.sumUntil(firstRowIndex);
var firstRowOffset = firstRowPosition - position;
this._updateHeightsInViewport(firstRowIndex, firstRowOffset);
this._updateHeightsAboveViewport(firstRowIndex);
return {
index: firstRowIndex,
offset: firstRowOffset,
position: this._position,
contentHeight: this._contentHeight
};
},
_getRowAtEndPosition: function (rowIndex) {
// We need to update enough rows above the selected one to be sure that when
// we scroll to selected position all rows between first shown and selected
// one have most recent heights computed and will not resize
this._updateRowHeight(rowIndex);
var currentRowIndex = rowIndex;
var top = this._storedHeights[currentRowIndex];
while (top < this._viewportHeight && currentRowIndex >= 0) {
currentRowIndex--;
if (currentRowIndex >= 0) {
this._updateRowHeight(currentRowIndex);
top += this._storedHeights[currentRowIndex];
}
}
var position = this._rowOffsets.sumTo(rowIndex) - this._viewportHeight;
if (position < 0) {
position = 0;
}
return position;
},
scrollTo: function (position) {
if (this._rowCount === 0) {
return NO_ROWS_SCROLL_RESULT;
}
if (position <= 0) {
// If position less than or equal to 0 first row should be fully visible
// on top
this._position = 0;
this._updateHeightsInViewport(0, 0);
return {
index: 0,
offset: 0,
position: this._position,
contentHeight: this._contentHeight
};
} else if (position >= this._contentHeight - this._viewportHeight) {
// If position is equal to or greater than max scroll value, we need
// to make sure to have bottom border of last row visible.
var rowIndex = this._rowCount - 1;
position = this._getRowAtEndPosition(rowIndex);
}
this._position = position;
var firstRowIndex = this._rowOffsets.greatestLowerBound(position);
firstRowIndex = clamp(firstRowIndex, 0, Math.max(this._rowCount - 1, 0));
var firstRowPosition = this._rowOffsets.sumUntil(firstRowIndex);
var firstRowOffset = firstRowPosition - position;
this._updateHeightsInViewport(firstRowIndex, firstRowOffset);
this._updateHeightsAboveViewport(firstRowIndex);
return {
index: firstRowIndex,
offset: firstRowOffset,
position: this._position,
contentHeight: this._contentHeight
};
},
/**
* Allows to scroll to selected row with specified offset. It always
* brings that row to top of viewport with that offset
*/
scrollToRow: function (rowIndex, offset) {
rowIndex = clamp(rowIndex, 0, Math.max(this._rowCount - 1, 0));
offset = clamp(offset, -this._storedHeights[rowIndex], 0);
var firstRow = this._rowOffsets.sumUntil(rowIndex);
return this.scrollTo(firstRow - offset);
},
/**
* Allows to scroll to selected row by bringing it to viewport with minimal
* scrolling. This that if row is fully visible, scroll will not be changed.
* If top border of row is above top of viewport it will be scrolled to be
* fully visible on the top of viewport. If the bottom border of row is
* below end of viewport, it will be scrolled up to be fully visible on the
* bottom of viewport.
*/
scrollRowIntoView: function (rowIndex) {
rowIndex = clamp(rowIndex, 0, Math.max(this._rowCount - 1, 0));
var rowBegin = this._rowOffsets.sumUntil(rowIndex);
var rowEnd = rowBegin + this._storedHeights[rowIndex];
if (rowBegin < this._position) {
return this.scrollTo(rowBegin);
} else if (this._position + this._viewportHeight < rowEnd) {
var position = this._getRowAtEndPosition(rowIndex);
return this.scrollTo(position);
}
return this.scrollTo(this._position);
}
};
})();
// Data structure that allows to store values and assign positions to them
// in a way to minimize changing positions of stored values when new ones are
// added or when some values are replaced. Stored elements are alwasy assigned
// a consecutive set of positoins startin from 0 up to count of elements less 1
// Following actions can be executed
// * get position assigned to given value (null if value is not stored)
// * create new entry for new value and get assigned position back
// * replace value that is furthest from specified value range with new value
// and get it's position back
// All operations take amortized log(n) time where n is number of elements in
// the set.
BI.IntegerBufferSet = function () {
this._valueToPositionMap = {};
this._size = 0;
this._smallValues = new BI.Heap(
[], // Initial data in the heap
this._smallerComparator
);
this._largeValues = new BI.Heap(
[], // Initial data in the heap
this._greaterComparator
);
};
BI.IntegerBufferSet.prototype = {
constructor: BI.IntegerBufferSet,
getSize: function () /* number*/ {
return this._size;
},
getValuePosition: function (/* number*/ value) /* ?number*/ {
if (this._valueToPositionMap[value] === undefined) {
return null;
}
return this._valueToPositionMap[value];
},
getNewPositionForValue: function (/* number*/ value) /* number*/ {
var newPosition = this._size;
this._size++;
this._pushToHeaps(newPosition, value);
this._valueToPositionMap[value] = newPosition;
return newPosition;
},
replaceFurthestValuePosition: function (/* number*/ lowValue,
/* number*/ highValue,
/* number*/ newValue) /* ?number*/ {
this._cleanHeaps();
if (this._smallValues.empty() || this._largeValues.empty()) {
// Threre are currently no values stored. We will have to create new
// position for this value.
return null;
}
var minValue = this._smallValues.peek().value;
var maxValue = this._largeValues.peek().value;
if (minValue >= lowValue && maxValue <= highValue) {
// All values currently stored are necessary, we can't reuse any of them.
return null;
}
var valueToReplace;
if (lowValue - minValue > maxValue - highValue) {
// minValue is further from provided range. We will reuse it's position.
valueToReplace = minValue;
this._smallValues.pop();
} else {
valueToReplace = maxValue;
this._largeValues.pop();
}
var position = this._valueToPositionMap[valueToReplace];
delete this._valueToPositionMap[valueToReplace];
this._valueToPositionMap[newValue] = position;
this._pushToHeaps(position, newValue);
return position;
},
_pushToHeaps: function (/* number*/ position, /* number*/ value) {
var element = {
position: position,
value: value
};
// We can reuse the same object in both heaps, because we don't mutate them
this._smallValues.push(element);
this._largeValues.push(element);
},
_cleanHeaps: function () {
// We not usually only remove object from one heap while moving value.
// Here we make sure that there is no stale data on top of heaps.
this._cleanHeap(this._smallValues);
this._cleanHeap(this._largeValues);
var minHeapSize =
Math.min(this._smallValues.size(), this._largeValues.size());
var maxHeapSize =
Math.max(this._smallValues.size(), this._largeValues.size());
if (maxHeapSize > 10 * minHeapSize) {
// There are many old values in one of heaps. We nned to get rid of them
// to not use too avoid memory leaks
this._recreateHeaps();
}
},
_recreateHeaps: function () {
var sourceHeap = this._smallValues.size() < this._largeValues.size() ?
this._smallValues :
this._largeValues;
var newSmallValues = new Heap(
[], // Initial data in the heap
this._smallerComparator
);
var newLargeValues = new Heap(
[], // Initial datat in the heap
this._greaterComparator
);
while (!sourceHeap.empty()) {
var element = sourceHeap.pop();
// Push all stil valid elements to new heaps
if (this._valueToPositionMap[element.value] !== undefined) {
newSmallValues.push(element);
newLargeValues.push(element);
}
}
this._smallValues = newSmallValues;
this._largeValues = newLargeValues;
},
_cleanHeap: function (/* object*/ heap) {
while (!heap.empty() &&
this._valueToPositionMap[heap.peek().value] === undefined) {
heap.pop();
}
},
_smallerComparator: function (/* object*/ lhs, /* object*/ rhs) /* boolean*/ {
return lhs.value < rhs.value;
},
_greaterComparator: function (/* object*/ lhs, /* object*/ rhs) /* boolean*/ {
return lhs.value > rhs.value;
}
};
!(function () {
BI.LinkHashMap = function () {
@ -23713,245 +23176,6 @@ BI.IntegerBufferSet.prototype = {
p.has = function (key) {
return this._keymap[key] != null;
};
})();
!(function () {
var MD5 = function (hexcase) {
this.hexcase = !hexcase ? 0 : 1;
/* hex output format. 0 - lowercase; 1 - uppercase */
this.b64pad = "";
/* base-64 pad character. "=" for strict RFC compliance */
this.chrsz = 8;
/* bits per input character. 8 - ASCII; 16 - Unicode */
};
/*
* These are the functions you'll usually want to call
* They take string arguments and return either hex or base-64 encoded strings
*/
MD5.prototype.hex_md5 = function (s) {
return this.binl2hex(this.core_md5(this.str2binl(s), s.length * this.chrsz));
};
MD5.prototype.hex_md5_salt = function (s) {
var md5ed = this.hex_md5(s);
var items1 = [];
var items2 = [];
for (var i = 0; i < md5ed.length; i++) {
if (i % 2 === 0) {
items1.push(md5ed.charAt(i));
} else {
items2.push(md5ed.charAt(i));
}
}
var result = ":" + items1.join("") + items2.join("");
return result;
};
MD5.prototype.b64_md5 = function (s) {
return this.binl2b64(this.core_md5(this.str2binl(s), s.length * this.chrsz));
};
MD5.prototype.hex_hmac_md5 = function (key, data) {
return this.binl2hex(this.core_hmac_md5(key, data));
};
MD5.prototype.b64_hmac_md5 = function (key, data) {
return this.binl2b64(this.core_hmac_md5(key, data));
};
/* Backwards compatibility - same as hex_md5() */
MD5.prototype.calcMD5 = function (s) {
return this.binl2hex(this.core_md5(this.str2binl(s), s.length * this.chrsz));
};
MD5.prototype.core_md5 = function (x, len) {
/* append padding */
x[len >> 5] |= 0x80 << ((len) % 32);
x[(((len + 64) >>> 9) << 4) + 14] = len;
var a = 1732584193;
var b = -271733879;
var c = -1732584194;
var d = 271733878;
for (var i = 0; i < x.length; i += 16) {
var olda = a;
var oldb = b;
var oldc = c;
var oldd = d;
a = this.md5_ff(a, b, c, d, x[i + 0], 7, -680876936);
d = this.md5_ff(d, a, b, c, x[i + 1], 12, -389564586);
c = this.md5_ff(c, d, a, b, x[i + 2], 17, 606105819);
b = this.md5_ff(b, c, d, a, x[i + 3], 22, -1044525330);
a = this.md5_ff(a, b, c, d, x[i + 4], 7, -176418897);
d = this.md5_ff(d, a, b, c, x[i + 5], 12, 1200080426);
c = this.md5_ff(c, d, a, b, x[i + 6], 17, -1473231341);
b = this.md5_ff(b, c, d, a, x[i + 7], 22, -45705983);
a = this.md5_ff(a, b, c, d, x[i + 8], 7, 1770035416);
d = this.md5_ff(d, a, b, c, x[i + 9], 12, -1958414417);
c = this.md5_ff(c, d, a, b, x[i + 10], 17, -42063);
b = this.md5_ff(b, c, d, a, x[i + 11], 22, -1990404162);
a = this.md5_ff(a, b, c, d, x[i + 12], 7, 1804603682);
d = this.md5_ff(d, a, b, c, x[i + 13], 12, -40341101);
c = this.md5_ff(c, d, a, b, x[i + 14], 17, -1502002290);
b = this.md5_ff(b, c, d, a, x[i + 15], 22, 1236535329);
a = this.md5_gg(a, b, c, d, x[i + 1], 5, -165796510);
d = this.md5_gg(d, a, b, c, x[i + 6], 9, -1069501632);
c = this.md5_gg(c, d, a, b, x[i + 11], 14, 643717713);
b = this.md5_gg(b, c, d, a, x[i + 0], 20, -373897302);
a = this.md5_gg(a, b, c, d, x[i + 5], 5, -701558691);
d = this.md5_gg(d, a, b, c, x[i + 10], 9, 38016083);
c = this.md5_gg(c, d, a, b, x[i + 15], 14, -660478335);
b = this.md5_gg(b, c, d, a, x[i + 4], 20, -405537848);
a = this.md5_gg(a, b, c, d, x[i + 9], 5, 568446438);
d = this.md5_gg(d, a, b, c, x[i + 14], 9, -1019803690);
c = this.md5_gg(c, d, a, b, x[i + 3], 14, -187363961);
b = this.md5_gg(b, c, d, a, x[i + 8], 20, 1163531501);
a = this.md5_gg(a, b, c, d, x[i + 13], 5, -1444681467);
d = this.md5_gg(d, a, b, c, x[i + 2], 9, -51403784);
c = this.md5_gg(c, d, a, b, x[i + 7], 14, 1735328473);
b = this.md5_gg(b, c, d, a, x[i + 12], 20, -1926607734);
a = this.md5_hh(a, b, c, d, x[i + 5], 4, -378558);
d = this.md5_hh(d, a, b, c, x[i + 8], 11, -2022574463);
c = this.md5_hh(c, d, a, b, x[i + 11], 16, 1839030562);
b = this.md5_hh(b, c, d, a, x[i + 14], 23, -35309556);
a = this.md5_hh(a, b, c, d, x[i + 1], 4, -1530992060);
d = this.md5_hh(d, a, b, c, x[i + 4], 11, 1272893353);
c = this.md5_hh(c, d, a, b, x[i + 7], 16, -155497632);
b = this.md5_hh(b, c, d, a, x[i + 10], 23, -1094730640);
a = this.md5_hh(a, b, c, d, x[i + 13], 4, 681279174);
d = this.md5_hh(d, a, b, c, x[i + 0], 11, -358537222);
c = this.md5_hh(c, d, a, b, x[i + 3], 16, -722521979);
b = this.md5_hh(b, c, d, a, x[i + 6], 23, 76029189);
a = this.md5_hh(a, b, c, d, x[i + 9], 4, -640364487);
d = this.md5_hh(d, a, b, c, x[i + 12], 11, -421815835);
c = this.md5_hh(c, d, a, b, x[i + 15], 16, 530742520);
b = this.md5_hh(b, c, d, a, x[i + 2], 23, -995338651);
a = this.md5_ii(a, b, c, d, x[i + 0], 6, -198630844);
d = this.md5_ii(d, a, b, c, x[i + 7], 10, 1126891415);
c = this.md5_ii(c, d, a, b, x[i + 14], 15, -1416354905);
b = this.md5_ii(b, c, d, a, x[i + 5], 21, -57434055);
a = this.md5_ii(a, b, c, d, x[i + 12], 6, 1700485571);
d = this.md5_ii(d, a, b, c, x[i + 3], 10, -1894986606);
c = this.md5_ii(c, d, a, b, x[i + 10], 15, -1051523);
b = this.md5_ii(b, c, d, a, x[i + 1], 21, -2054922799);
a = this.md5_ii(a, b, c, d, x[i + 8], 6, 1873313359);
d = this.md5_ii(d, a, b, c, x[i + 15], 10, -30611744);
c = this.md5_ii(c, d, a, b, x[i + 6], 15, -1560198380);
b = this.md5_ii(b, c, d, a, x[i + 13], 21, 1309151649);
a = this.md5_ii(a, b, c, d, x[i + 4], 6, -145523070);
d = this.md5_ii(d, a, b, c, x[i + 11], 10, -1120210379);
c = this.md5_ii(c, d, a, b, x[i + 2], 15, 718787259);
b = this.md5_ii(b, c, d, a, x[i + 9], 21, -343485551);
a = this.safe_add(a, olda);
b = this.safe_add(b, oldb);
c = this.safe_add(c, oldc);
d = this.safe_add(d, oldd);
}
return Array(a, b, c, d);
};
/*
* These functions implement the four basic operations the algorithm uses.
*/
MD5.prototype.md5_cmn = function (q, a, b, x, s, t) {
return this.safe_add(this.bit_rol(this.safe_add(this.safe_add(a, q), this.safe_add(x, t)), s), b);
};
MD5.prototype.md5_ff = function (a, b, c, d, x, s, t) {
return this.md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
};
MD5.prototype.md5_gg = function (a, b, c, d, x, s, t) {
return this.md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
};
MD5.prototype.md5_hh = function (a, b, c, d, x, s, t) {
return this.md5_cmn(b ^ c ^ d, a, b, x, s, t);
};
MD5.prototype.md5_ii = function (a, b, c, d, x, s, t) {
return this.md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
};
/*
* Calculate the HMAC-MD5, of a key and some data
*/
MD5.prototype.core_hmac_md5 = function (key, data) {
var bkey = this.str2binl(key);
if (bkey.length > 16) {bkey = this.core_md5(bkey, key.length * this.chrsz);}
var ipad = Array(16), opad = Array(16);
for (var i = 0; i < 16; i++) {
ipad[i] = bkey[i] ^ 0x36363636;
opad[i] = bkey[i] ^ 0x5C5C5C5C;
}
var hash = this.core_md5(ipad.concat(this.str2binl(data)), 512 + data.length * this.chrsz);
return this.core_md5(opad.concat(hash), 512 + 128);
};
/*
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
* to work around bugs in some JS interpreters.
*/
MD5.prototype.safe_add = function (x, y) {
var lsw = (x & 0xFFFF) + (y & 0xFFFF);
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xFFFF);
};
/*
* Bitwise rotate a 32-bit number to the left.
*/
MD5.prototype.bit_rol = function (num, cnt) {
return (num << cnt) | (num >>> (32 - cnt));
};
/*
* Convert a string to an array of little-endian words
* If chrsz is ASCII, characters >255 have their hi-byte silently ignored.
*/
MD5.prototype.str2binl = function (str) {
var bin = Array();
var mask = (1 << this.chrsz) - 1;
for (var i = 0; i < str.length * this.chrsz; i += this.chrsz) {bin[i >> 5] |= (str.charCodeAt(i / this.chrsz) & mask) << (i % 32);}
return bin;
};
/*
* Convert an array of little-endian words to a hex string.
*/
MD5.prototype.binl2hex = function (binarray) {
var hex_tab = this.hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
var str = "";
for (var i = 0; i < binarray.length * 4; i++) {
str += hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 + 4)) & 0xF)
+ hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8)) & 0xF);
}
return str;
};
/*
* Convert an array of little-endian words to a base-64 string
*/
MD5.prototype.binl2b64 = function (binarray) {
var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var str = "";
for (var i = 0; i < binarray.length * 4; i += 3) {
var triplet = (((binarray[i >> 2] >> 8 * (i % 4)) & 0xFF) << 16)
| (((binarray[i + 1 >> 2] >> 8 * ((i + 1) % 4)) & 0xFF) << 8)
| ((binarray[i + 2 >> 2] >> 8 * ((i + 2) % 4)) & 0xFF);
for (var j = 0; j < 4; j++) {
if (i * 8 + j * 6 > binarray.length * 32) {str += this.b64pad;} else {str += tab.charAt((triplet >> 6 * (3 - j)) & 0x3F);}
}
}
return str;
};
BI.MD5 = new MD5();
})();// 线段树
(function () {
var parent = function (node) {
@ -24305,125 +23529,6 @@ BI.IntegerBufferSet.prototype = {
}
};
})();
(function () {
var clamp = function (value, min, max) {
if (value < min) {
return min;
}
if (value > max) {
return max;
}
return value;
};
var MIN_BUFFER_ROWS = 6;
var MAX_BUFFER_ROWS = 10;
BI.TableRowBuffer = function (rowsCount,
defaultRowHeight,
viewportHeight,
rowHeightGetter) {
this._bufferSet = new BI.IntegerBufferSet();
this._defaultRowHeight = defaultRowHeight;
this._viewportRowsBegin = 0;
this._viewportRowsEnd = 0;
this._maxVisibleRowCount = Math.ceil(viewportHeight / defaultRowHeight) + 1;
// this._bufferRowsCount = Math.floor(this._maxVisibleRowCount / 2);
this._bufferRowsCount = clamp(
Math.floor(this._maxVisibleRowCount / 2),
MIN_BUFFER_ROWS,
MAX_BUFFER_ROWS
);
this._rowsCount = rowsCount;
this._rowHeightGetter = rowHeightGetter;
this._rows = [];
this._viewportHeight = viewportHeight;
};
BI.TableRowBuffer.prototype = {
constructor: BI.TableRowBuffer,
getRowsWithUpdatedBuffer: function () {
var remainingBufferRows = 2 * this._bufferRowsCount;
var bufferRowIndex =
Math.max(this._viewportRowsBegin - this._bufferRowsCount, 0);
while (bufferRowIndex < this._viewportRowsBegin) {
this._addRowToBuffer(
bufferRowIndex,
this._viewportRowsBegin,
this._viewportRowsEnd - 1
);
bufferRowIndex++;
remainingBufferRows--;
}
bufferRowIndex = this._viewportRowsEnd;
while (bufferRowIndex < this._rowsCount && remainingBufferRows > 0) {
this._addRowToBuffer(
bufferRowIndex,
this._viewportRowsBegin,
this._viewportRowsEnd - 1
);
bufferRowIndex++;
remainingBufferRows--;
}
return this._rows;
},
getRows: function (firstRowIndex,
firstRowOffset) {
var top = firstRowOffset;
var totalHeight = top;
var rowIndex = firstRowIndex;
var endIndex =
Math.min(firstRowIndex + this._maxVisibleRowCount, this._rowsCount);
this._viewportRowsBegin = firstRowIndex;
while (rowIndex < endIndex ||
(totalHeight < this._viewportHeight && rowIndex < this._rowsCount)) {
this._addRowToBuffer(
rowIndex,
firstRowIndex,
endIndex - 1
);
totalHeight += this._rowHeightGetter(rowIndex);
++rowIndex;
// Store index after the last viewport row as end, to be able to
// distinguish when there are no rows rendered in viewport
this._viewportRowsEnd = rowIndex;
}
return this._rows;
},
_addRowToBuffer: function (rowIndex,
firstViewportRowIndex,
lastViewportRowIndex) {
var rowPosition = this._bufferSet.getValuePosition(rowIndex);
var viewportRowsCount = lastViewportRowIndex - firstViewportRowIndex + 1;
var allowedRowsCount = viewportRowsCount + this._bufferRowsCount * 2;
if (rowPosition === null &&
this._bufferSet.getSize() >= allowedRowsCount) {
rowPosition =
this._bufferSet.replaceFurthestValuePosition(
firstViewportRowIndex,
lastViewportRowIndex,
rowIndex
);
}
if (rowPosition === null) {
// We can't reuse any of existing positions for this row. We have to
// create new position
rowPosition = this._bufferSet.getNewPositionForValue(rowIndex);
this._rows[rowPosition] = rowIndex;
} else {
// This row already is in the table with rowPosition position or it
// can replace row that is in that position
this._rows[rowPosition] = rowIndex;
}
}
};
})();
(function () {
BI.Tree = function () {
this.root = new BI.Node(BI.UUID());

23
dist/core_without_normalize.css vendored

@ -940,6 +940,29 @@ textarea {
.bi-list-item-select3.disabled.active {
background-color: #ffffff !important;
}
.bi-theme-dark .bi-list-item-select3:hover,
.bi-theme-dark .bi-list-item-select3.hover {
background-color: #191B2B;
}
.bi-theme-dark .bi-list-item-select3:active,
.bi-theme-dark .bi-list-item-select3.active {
color: #3685f2;
background-color: #191B2B;
}
.bi-theme-dark .bi-list-item-select3:active .bi-input,
.bi-theme-dark .bi-list-item-select3.active .bi-input {
color: #3685f2;
}
.bi-theme-dark .bi-list-item-select3:active .bi-textarea,
.bi-theme-dark .bi-list-item-select3.active .bi-textarea {
color: #3685f2;
}
.bi-theme-dark .bi-list-item-select3.disabled:hover,
.bi-theme-dark .bi-list-item-select3.disabled.hover,
.bi-theme-dark .bi-list-item-select3.disabled:active,
.bi-theme-dark .bi-list-item-select3.disabled.active {
background-color: #242640 !important;
}
.bi-theme-dark .bi-list-item-select:hover,
.bi-theme-dark .bi-list-item-select.hover {
color: #ffffff;

3115
dist/demo.js vendored

File diff suppressed because it is too large Load Diff

345
dist/fineui.css vendored

@ -1221,6 +1221,29 @@ textarea {
.bi-list-item-select3.disabled.active {
background-color: #ffffff !important;
}
.bi-theme-dark .bi-list-item-select3:hover,
.bi-theme-dark .bi-list-item-select3.hover {
background-color: #191B2B;
}
.bi-theme-dark .bi-list-item-select3:active,
.bi-theme-dark .bi-list-item-select3.active {
color: #3685f2;
background-color: #191B2B;
}
.bi-theme-dark .bi-list-item-select3:active .bi-input,
.bi-theme-dark .bi-list-item-select3.active .bi-input {
color: #3685f2;
}
.bi-theme-dark .bi-list-item-select3:active .bi-textarea,
.bi-theme-dark .bi-list-item-select3.active .bi-textarea {
color: #3685f2;
}
.bi-theme-dark .bi-list-item-select3.disabled:hover,
.bi-theme-dark .bi-list-item-select3.disabled.hover,
.bi-theme-dark .bi-list-item-select3.disabled:active,
.bi-theme-dark .bi-list-item-select3.disabled.active {
background-color: #242640 !important;
}
.bi-theme-dark .bi-list-item-select:hover,
.bi-theme-dark .bi-list-item-select.hover {
color: #ffffff;
@ -2266,7 +2289,7 @@ textarea {
position: absolute;
width: 6px;
height: 6px;
margin-left: 3px;
margin-left: 2px;
margin-top: -3px;
content: "";
transform: rotate(-45deg);
@ -2281,7 +2304,7 @@ textarea {
position: absolute;
width: 6px;
height: 6px;
margin-left: 3px;
margin-left: 2px;
margin-top: 3px;
content: "";
transform: rotate(135deg);
@ -2312,12 +2335,12 @@ textarea {
width: 6px;
height: 6px;
margin-left: 3px;
margin-top: 3px;
margin-top: 2px;
content: "";
transform: rotate(-135deg);
}
.bi-bubble-combo .bubble-combo-triangle-left:before,
.bi-bubble-combo.bubble-combo-triangle-right:before,
.bi-bubble-combo .bubble-combo-triangle-right:before,
.bi-bubble-combo .bubble-combo-triangle-top:before,
.bi-bubble-combo .bubble-combo-triangle-bottom:before {
background-color: #ffffff;
@ -2325,7 +2348,7 @@ textarea {
border-right: 1px solid #f2f4f7;
}
.bi-theme-dark .bi-bubble-combo .bubble-combo-triangle-left:before,
.bi-theme-dark .bi-bubble-combo.bubble-combo-triangle-right:before,
.bi-theme-dark .bi-bubble-combo .bubble-combo-triangle-right:before,
.bi-theme-dark .bi-bubble-combo .bubble-combo-triangle-top:before,
.bi-theme-dark .bi-bubble-combo .bubble-combo-triangle-bottom:before {
background-color: #242640;
@ -3046,280 +3069,6 @@ body .bi-button.button-ignore.disabled.ghost .b-font:before,
background: #ff4949;
border: 1px solid #e85050;
}
.bi-collection-table-cell {
-webkit-box-sizing: border-box;
/*Safari3.2+*/
-moz-box-sizing: border-box;
/*Firefox3.5+*/
-ms-box-sizing: border-box;
/*IE8*/
box-sizing: border-box;
/*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/
}
.bi-collection-table-cell.first-row {
border-top: 1px solid #e8eaed;
}
.bi-collection-table-cell.first-col {
border-left: 1px solid #e8eaed;
}
.bi-theme-dark .bi-collection-table-cell.first-row {
border-top: 1px solid #3a3c53;
}
.bi-theme-dark .bi-collection-table-cell.first-col {
border-left: 1px solid #3a3c53;
}
.bi-quick-collection-table > div > .bi-collection {
overflow: hidden !important;
overflow-x: hidden !important;
overflow-y: hidden !important;
}
.bi-grid-table-cell {
-webkit-box-sizing: border-box;
/*Safari3.2+*/
-moz-box-sizing: border-box;
/*Firefox3.5+*/
-ms-box-sizing: border-box;
/*IE8*/
box-sizing: border-box;
/*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/
}
.bi-grid-table-cell.first-row {
border-top: 1px solid #e8eaed;
}
.bi-grid-table-cell.first-col {
border-left: 1px solid #e8eaed;
}
.bi-theme-dark .bi-grid-table-cell.first-row {
border-top: 1px solid #3a3c53;
}
.bi-theme-dark .bi-grid-table-cell.first-col {
border-left: 1px solid #3a3c53;
}
.scrollbar-layout-main {
box-sizing: border-box;
outline: none;
overflow: hidden;
position: absolute;
transition-duration: 250ms;
transition-timing-function: ease;
user-select: none;
background-color: rgba(135, 141, 159, 0.05);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d878d9f,endColorstr=#0d878d9f);
border-radius: 5px;
}
.bi-theme-dark .scrollbar-layout-main {
background-color: rgba(208, 212, 218, 0.05);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dd0d4da,endColorstr=#0dd0d4da);
}
.scrollbar-layout-main-vertical {
bottom: 0;
right: 0;
top: 0;
transition-property: background-color;
width: 10px;
}
.scrollbar-layout-main-vertical.public-scrollbar-main-active,
.scrollbar-layout-main-vertical:hover {
width: 10px;
}
.scrollbar-layout-main-horizontal {
bottom: 0;
height: 10px;
left: 0;
transition-property: background-color;
background-color: rgba(135, 141, 159, 0.05);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d878d9f,endColorstr=#0d878d9f);
}
.bi-theme-dark .scrollbar-layout-main-horizontal {
background-color: rgba(208, 212, 218, 0.05);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dd0d4da,endColorstr=#0dd0d4da);
}
/* Touching the scroll-track directly makes the scroll-track bolder */
.scrollbar-layout-main-horizontal.public-scrollbar-main-active,
.scrollbar-layout-main-horizontal:hover {
height: 10px;
}
.scrollbar-layout-face {
left: 0;
overflow: hidden;
position: absolute;
z-index: 1;
}
/**
* This selector renders the "nub" of the scrollface. The nub must
* be rendered as pseudo-element so that it won't receive any UI events then
* we can get the correct `event.offsetX` and `event.offsetY` from the
* scrollface element while dragging it.
*/
.scrollbar-layout-face:after {
border-radius: 6px;
content: '';
display: block;
position: absolute;
transition: background-color 250ms ease;
}
.scrollbar-layout-face-horizontal {
bottom: 0;
left: 0;
top: 0;
}
.scrollbar-layout-face-horizontal:after {
bottom: 2px;
left: 0;
top: 2px;
width: 100%;
}
.scrollbar-layout-face-vertical {
left: 0;
right: 0;
top: 0;
}
.scrollbar-layout-face-vertical:after {
height: 100%;
left: 2px;
right: 2px;
top: 0;
}
/**
* scrollbars.
*/
/* Touching the scroll-track directly makes the scroll-track bolder */
.public-scrollbar-face:after {
background-color: rgba(135, 141, 159, 0.3);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4d878d9f,endColorstr=#4d878d9f);
}
.bi-theme-dark .public-scrollbar-face:after {
background-color: rgba(208, 212, 218, 0.3);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4dd0d4da,endColorstr=#4dd0d4da);
}
.public-scrollbar-main:hover .public-scrollbar-face:after,
.public-scrollbar-main-active .public-scrollbar-face:after,
.public-scrollbar-face-active:after {
background-color: rgba(135, 141, 159, 0.7);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3878d9f,endColorstr=#b3878d9f);
}
.bi-theme-dark .public-scrollbar-main:hover .public-scrollbar-face:after,
.bi-theme-dark .public-scrollbar-main-active .public-scrollbar-face:after,
.bi-theme-dark .public-scrollbar-face-active:after {
background-color: rgba(208, 212, 218, 0.7);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3d0d4da,endColorstr=#b3d0d4da);
}
.horizontal-scrollbar {
bottom: 0;
position: absolute;
}
.bi-table > .first-col {
border-left: none;
}
.bi-table > .first-row {
border-top: none;
}
.bi-table > div > div > table {
border-bottom: 1px solid #e8eaed;
border-right: 1px solid #e8eaed;
}
.bi-table > div.top-left > div > div > table {
border-bottom: 1px solid #e8eaed;
border-right: 1px solid #e8eaed;
}
.bi-table > div.top-right > div > div > table {
border-bottom: 1px solid #e8eaed;
border-right: 1px solid #e8eaed;
}
.bi-table > div.bottom-left > div > div > table {
border-bottom: 1px solid #e8eaed;
border-right: 1px solid #e8eaed;
}
.bi-table > div.bottom-right > div > div > table {
border-right: 1px solid #e8eaed;
border-bottom: 1px solid #e8eaed;
}
.bi-table > div > div > table,
.bi-table > div > div > div > table {
min-width: 100%;
clear: both;
vertical-align: middle;
border-spacing: 0;
border-collapse: separate;
}
.bi-table > div > div > table,
.bi-table > div > div > div > table,
.bi-table > div > div > table > * > * > th,
.bi-table > div > div > div > table > * > * > th,
.bi-table > div > div > table > * > * > td,
.bi-table > div > div > div > table > * > * > td {
vertical-align: middle;
margin: 0;
padding: 0;
}
.bi-table > div > div > table > tbody > tr > td,
.bi-table > div > div > div > table > tbody > tr > td,
.bi-table > div > div > table > thead > tr > td,
.bi-table > div > div > div > table > thead > tr > td {
border-top: 1px solid #e8eaed;
border-left: 1px solid #e8eaed;
}
.bi-theme-dark .bi-table > div > div > table {
border-bottom: 1px solid #3a3c53;
border-right: 1px solid #3a3c53;
}
.bi-theme-dark .bi-table > div.top-left > div > div > table {
border-bottom: 1px solid #3a3c53;
border-right: 1px solid #3a3c53;
}
.bi-theme-dark .bi-table > div.top-right > div > div > table {
border-bottom: 1px solid #3a3c53;
border-right: 1px solid #3a3c53;
}
.bi-theme-dark .bi-table > div.bottom-left > div > div > table {
border-bottom: 1px solid #3a3c53;
border-right: 1px solid #3a3c53;
}
.bi-theme-dark .bi-table > div.bottom-right > div > div > table {
border-right: 1px solid #3a3c53;
border-bottom: 1px solid #3a3c53;
}
.bi-theme-dark .bi-table > div > div > table > tbody > tr > td,
.bi-theme-dark .bi-table > div > div > div > table > tbody > tr > td,
.bi-theme-dark .bi-table > div > div > table > thead > tr > td,
.bi-theme-dark .bi-table > div > div > div > table > thead > tr > td {
border-top: 1px solid #3a3c53;
border-left: 1px solid #3a3c53;
}
.bi-resizable-table-cell .resizable-table-cell-resizer-container {
cursor: ew-resize;
z-index: 1;
}
.bi-resizable-table-cell .resizable-table-cell-resizer-container:hover .resizable-table-cell-resizer-knob,
.bi-resizable-table-cell .resizable-table-cell-resizer-container.dragging .resizable-table-cell-resizer-knob {
background-color: #3685f2;
}
.bi-resizable-table-cell .resizable-table-cell-resizer-container.suitable .resizable-table-cell-resizer-knob {
background-color: #13cd66;
}
.bi-resizable-table .resizable-table-resizer {
cursor: ew-resize;
z-index: 1;
background-color: #3685f2;
}
.bi-resizable-table .resizable-table-resizer.suitable {
background-color: #13cd66;
}
.bi-resizable-table .resizable-table-region-resizer {
cursor: ew-resize;
z-index: 1;
}
.bi-resizable-table .resizable-table-region-resizer:hover .resizable-table-region-resizer-knob,
.bi-resizable-table .resizable-table-region-resizer.dragging .resizable-table-region-resizer-knob {
background-color: #3685f2;
}
.bi-branch-tree .bi-branch-tree-view {
min-width: 300px;
}
@ -3656,17 +3405,6 @@ ul.ztree.zTreeDragUL {
.bi-dynamic-date-combo .date-font {
font-size: 16px;
}
.bi-excel-table-header-cell {
font-weight: bold;
}
.bi-excel-table > div.bottom-right > div > div > table {
border-right: 1px solid #e8eaed;
}
.bi-theme-dark .bi-excel-table > div.bottom-right > div > div > table {
border-right: 1px solid #3a3c53;
}
.bi-interactive-arrangement .interactive-arrangement-dragtag-line {
z-index: 1000000000;
background-color: #faaa39;
@ -3821,33 +3559,6 @@ ul.ztree.zTreeDragUL {
.bi-number-interval.number-error .bi-input {
color: #ff4949 !important;
}
.bi-preview-table-cell {
min-height: 25px;
min-width: 80px;
}
.bi-preview-table-header-cell {
font-weight: bold;
min-height: 25px;
min-width: 80px;
}
.bi-preview-table {
-webkit-user-select: text;
-khtml-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
-o-user-select: text;
user-select: text;
}
.bi-preview-table > div > table > thead > tr.odd,
.bi-preview-table > div > div > div > table > thead > tr.odd {
background-color: #f7f8fa;
}
.bi-theme-dark .bi-preview-table > div > table > thead > tr.odd,
.bi-theme-dark .bi-preview-table > div > div > div > table > thead > tr.odd {
background-color: #191B2B;
}
.bi-quarter-trigger {
-webkit-border-radius: 2px;
-moz-border-radius: 2px;

29016
dist/fineui.js vendored

File diff suppressed because it is too large Load Diff

2
dist/fineui.min.css vendored

File diff suppressed because one or more lines are too long

71
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

895
dist/utils.js vendored

@ -13701,135 +13701,6 @@ _.extend(BI.OB.prototype, {
return BI.aspect;
})(window);
!(function () {
var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
// private method for UTF-8 encoding
var _utf8_encode = function (string) {
string = string.replace(/\r\n/g, "\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
} else if ((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
} else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
};
// private method for UTF-8 decoding
var _utf8_decode = function (utftext) {
var string = "";
var i = 0;
var c = 0, c3 = 0, c2 = 0;
while (i < utftext.length) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
} else if ((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i + 1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
} else {
c2 = utftext.charCodeAt(i + 1);
c3 = utftext.charCodeAt(i + 2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return string;
};
_.extend(BI, {
encode: function (input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = _utf8_encode(input);
while (i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
}
return output;
},
// public method for decoding
decode: function (input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length) {
enc1 = _keyStr.indexOf(input.charAt(i++));
enc2 = _keyStr.indexOf(input.charAt(i++));
enc3 = _keyStr.indexOf(input.charAt(i++));
enc4 = _keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {
output = output + String.fromCharCode(chr3);
}
}
output = _utf8_decode(output);
return output;
}
});
})();
BI.Cache = {
_prefix: "bi",
setUsername: function (username) {
@ -14878,414 +14749,6 @@ BI.ScalingCellSizeAndPositionManager.prototype = {
}
};
})();
(function () {
var clamp = function (min, value, max) {
if (value < min) {
return min;
}
if (value > max) {
return max;
}
return value;
};
var BUFFER_ROWS = 5;
var NO_ROWS_SCROLL_RESULT = {
index: 0,
offset: 0,
position: 0,
contentHeight: 0
};
BI.TableScrollHelper = function (rowCount,
defaultRowHeight,
viewportHeight,
rowHeightGetter) {
this._rowOffsets = BI.PrefixIntervalTree.uniform(rowCount, defaultRowHeight);
this._storedHeights = new Array(rowCount);
for (var i = 0; i < rowCount; ++i) {
this._storedHeights[i] = defaultRowHeight;
}
this._rowCount = rowCount;
this._position = 0;
this._contentHeight = rowCount * defaultRowHeight;
this._defaultRowHeight = defaultRowHeight;
this._rowHeightGetter = rowHeightGetter ?
rowHeightGetter : function () {
return defaultRowHeight;
};
this._viewportHeight = viewportHeight;
this._updateHeightsInViewport(0, 0);
};
BI.TableScrollHelper.prototype = {
constructor: BI.TableScrollHelper,
setRowHeightGetter: function (rowHeightGetter) {
this._rowHeightGetter = rowHeightGetter;
},
setViewportHeight: function (viewportHeight) {
this._viewportHeight = viewportHeight;
},
getContentHeight: function () {
return this._contentHeight;
},
_updateHeightsInViewport: function (firstRowIndex,
firstRowOffset) {
var top = firstRowOffset;
var index = firstRowIndex;
while (top <= this._viewportHeight && index < this._rowCount) {
this._updateRowHeight(index);
top += this._storedHeights[index];
index++;
}
},
_updateHeightsAboveViewport: function (firstRowIndex) {
var index = firstRowIndex - 1;
while (index >= 0 && index >= firstRowIndex - BUFFER_ROWS) {
var delta = this._updateRowHeight(index);
this._position += delta;
index--;
}
},
_updateRowHeight: function (rowIndex) {
if (rowIndex < 0 || rowIndex >= this._rowCount) {
return 0;
}
var newHeight = this._rowHeightGetter(rowIndex);
if (newHeight !== this._storedHeights[rowIndex]) {
var change = newHeight - this._storedHeights[rowIndex];
this._rowOffsets.set(rowIndex, newHeight);
this._storedHeights[rowIndex] = newHeight;
this._contentHeight += change;
return change;
}
return 0;
},
getRowPosition: function (rowIndex) {
this._updateRowHeight(rowIndex);
return this._rowOffsets.sumUntil(rowIndex);
},
scrollBy: function (delta) {
if (this._rowCount === 0) {
return NO_ROWS_SCROLL_RESULT;
}
var firstRow = this._rowOffsets.greatestLowerBound(this._position);
firstRow = clamp(firstRow, 0, Math.max(this._rowCount - 1, 0));
var firstRowPosition = this._rowOffsets.sumUntil(firstRow);
var rowIndex = firstRow;
var position = this._position;
var rowHeightChange = this._updateRowHeight(rowIndex);
if (firstRowPosition !== 0) {
position += rowHeightChange;
}
var visibleRowHeight = this._storedHeights[rowIndex] -
(position - firstRowPosition);
if (delta >= 0) {
while (delta > 0 && rowIndex < this._rowCount) {
if (delta < visibleRowHeight) {
position += delta;
delta = 0;
} else {
delta -= visibleRowHeight;
position += visibleRowHeight;
rowIndex++;
}
if (rowIndex < this._rowCount) {
this._updateRowHeight(rowIndex);
visibleRowHeight = this._storedHeights[rowIndex];
}
}
} else if (delta < 0) {
delta = -delta;
var invisibleRowHeight = this._storedHeights[rowIndex] - visibleRowHeight;
while (delta > 0 && rowIndex >= 0) {
if (delta < invisibleRowHeight) {
position -= delta;
delta = 0;
} else {
position -= invisibleRowHeight;
delta -= invisibleRowHeight;
rowIndex--;
}
if (rowIndex >= 0) {
var change = this._updateRowHeight(rowIndex);
invisibleRowHeight = this._storedHeights[rowIndex];
position += change;
}
}
}
var maxPosition = this._contentHeight - this._viewportHeight;
position = clamp(position, 0, maxPosition);
this._position = position;
var firstRowIndex = this._rowOffsets.greatestLowerBound(position);
firstRowIndex = clamp(firstRowIndex, 0, Math.max(this._rowCount - 1, 0));
firstRowPosition = this._rowOffsets.sumUntil(firstRowIndex);
var firstRowOffset = firstRowPosition - position;
this._updateHeightsInViewport(firstRowIndex, firstRowOffset);
this._updateHeightsAboveViewport(firstRowIndex);
return {
index: firstRowIndex,
offset: firstRowOffset,
position: this._position,
contentHeight: this._contentHeight
};
},
_getRowAtEndPosition: function (rowIndex) {
// We need to update enough rows above the selected one to be sure that when
// we scroll to selected position all rows between first shown and selected
// one have most recent heights computed and will not resize
this._updateRowHeight(rowIndex);
var currentRowIndex = rowIndex;
var top = this._storedHeights[currentRowIndex];
while (top < this._viewportHeight && currentRowIndex >= 0) {
currentRowIndex--;
if (currentRowIndex >= 0) {
this._updateRowHeight(currentRowIndex);
top += this._storedHeights[currentRowIndex];
}
}
var position = this._rowOffsets.sumTo(rowIndex) - this._viewportHeight;
if (position < 0) {
position = 0;
}
return position;
},
scrollTo: function (position) {
if (this._rowCount === 0) {
return NO_ROWS_SCROLL_RESULT;
}
if (position <= 0) {
// If position less than or equal to 0 first row should be fully visible
// on top
this._position = 0;
this._updateHeightsInViewport(0, 0);
return {
index: 0,
offset: 0,
position: this._position,
contentHeight: this._contentHeight
};
} else if (position >= this._contentHeight - this._viewportHeight) {
// If position is equal to or greater than max scroll value, we need
// to make sure to have bottom border of last row visible.
var rowIndex = this._rowCount - 1;
position = this._getRowAtEndPosition(rowIndex);
}
this._position = position;
var firstRowIndex = this._rowOffsets.greatestLowerBound(position);
firstRowIndex = clamp(firstRowIndex, 0, Math.max(this._rowCount - 1, 0));
var firstRowPosition = this._rowOffsets.sumUntil(firstRowIndex);
var firstRowOffset = firstRowPosition - position;
this._updateHeightsInViewport(firstRowIndex, firstRowOffset);
this._updateHeightsAboveViewport(firstRowIndex);
return {
index: firstRowIndex,
offset: firstRowOffset,
position: this._position,
contentHeight: this._contentHeight
};
},
/**
* Allows to scroll to selected row with specified offset. It always
* brings that row to top of viewport with that offset
*/
scrollToRow: function (rowIndex, offset) {
rowIndex = clamp(rowIndex, 0, Math.max(this._rowCount - 1, 0));
offset = clamp(offset, -this._storedHeights[rowIndex], 0);
var firstRow = this._rowOffsets.sumUntil(rowIndex);
return this.scrollTo(firstRow - offset);
},
/**
* Allows to scroll to selected row by bringing it to viewport with minimal
* scrolling. This that if row is fully visible, scroll will not be changed.
* If top border of row is above top of viewport it will be scrolled to be
* fully visible on the top of viewport. If the bottom border of row is
* below end of viewport, it will be scrolled up to be fully visible on the
* bottom of viewport.
*/
scrollRowIntoView: function (rowIndex) {
rowIndex = clamp(rowIndex, 0, Math.max(this._rowCount - 1, 0));
var rowBegin = this._rowOffsets.sumUntil(rowIndex);
var rowEnd = rowBegin + this._storedHeights[rowIndex];
if (rowBegin < this._position) {
return this.scrollTo(rowBegin);
} else if (this._position + this._viewportHeight < rowEnd) {
var position = this._getRowAtEndPosition(rowIndex);
return this.scrollTo(position);
}
return this.scrollTo(this._position);
}
};
})();
// Data structure that allows to store values and assign positions to them
// in a way to minimize changing positions of stored values when new ones are
// added or when some values are replaced. Stored elements are alwasy assigned
// a consecutive set of positoins startin from 0 up to count of elements less 1
// Following actions can be executed
// * get position assigned to given value (null if value is not stored)
// * create new entry for new value and get assigned position back
// * replace value that is furthest from specified value range with new value
// and get it's position back
// All operations take amortized log(n) time where n is number of elements in
// the set.
BI.IntegerBufferSet = function () {
this._valueToPositionMap = {};
this._size = 0;
this._smallValues = new BI.Heap(
[], // Initial data in the heap
this._smallerComparator
);
this._largeValues = new BI.Heap(
[], // Initial data in the heap
this._greaterComparator
);
};
BI.IntegerBufferSet.prototype = {
constructor: BI.IntegerBufferSet,
getSize: function () /* number*/ {
return this._size;
},
getValuePosition: function (/* number*/ value) /* ?number*/ {
if (this._valueToPositionMap[value] === undefined) {
return null;
}
return this._valueToPositionMap[value];
},
getNewPositionForValue: function (/* number*/ value) /* number*/ {
var newPosition = this._size;
this._size++;
this._pushToHeaps(newPosition, value);
this._valueToPositionMap[value] = newPosition;
return newPosition;
},
replaceFurthestValuePosition: function (/* number*/ lowValue,
/* number*/ highValue,
/* number*/ newValue) /* ?number*/ {
this._cleanHeaps();
if (this._smallValues.empty() || this._largeValues.empty()) {
// Threre are currently no values stored. We will have to create new
// position for this value.
return null;
}
var minValue = this._smallValues.peek().value;
var maxValue = this._largeValues.peek().value;
if (minValue >= lowValue && maxValue <= highValue) {
// All values currently stored are necessary, we can't reuse any of them.
return null;
}
var valueToReplace;
if (lowValue - minValue > maxValue - highValue) {
// minValue is further from provided range. We will reuse it's position.
valueToReplace = minValue;
this._smallValues.pop();
} else {
valueToReplace = maxValue;
this._largeValues.pop();
}
var position = this._valueToPositionMap[valueToReplace];
delete this._valueToPositionMap[valueToReplace];
this._valueToPositionMap[newValue] = position;
this._pushToHeaps(position, newValue);
return position;
},
_pushToHeaps: function (/* number*/ position, /* number*/ value) {
var element = {
position: position,
value: value
};
// We can reuse the same object in both heaps, because we don't mutate them
this._smallValues.push(element);
this._largeValues.push(element);
},
_cleanHeaps: function () {
// We not usually only remove object from one heap while moving value.
// Here we make sure that there is no stale data on top of heaps.
this._cleanHeap(this._smallValues);
this._cleanHeap(this._largeValues);
var minHeapSize =
Math.min(this._smallValues.size(), this._largeValues.size());
var maxHeapSize =
Math.max(this._smallValues.size(), this._largeValues.size());
if (maxHeapSize > 10 * minHeapSize) {
// There are many old values in one of heaps. We nned to get rid of them
// to not use too avoid memory leaks
this._recreateHeaps();
}
},
_recreateHeaps: function () {
var sourceHeap = this._smallValues.size() < this._largeValues.size() ?
this._smallValues :
this._largeValues;
var newSmallValues = new Heap(
[], // Initial data in the heap
this._smallerComparator
);
var newLargeValues = new Heap(
[], // Initial datat in the heap
this._greaterComparator
);
while (!sourceHeap.empty()) {
var element = sourceHeap.pop();
// Push all stil valid elements to new heaps
if (this._valueToPositionMap[element.value] !== undefined) {
newSmallValues.push(element);
newLargeValues.push(element);
}
}
this._smallValues = newSmallValues;
this._largeValues = newLargeValues;
},
_cleanHeap: function (/* object*/ heap) {
while (!heap.empty() &&
this._valueToPositionMap[heap.peek().value] === undefined) {
heap.pop();
}
},
_smallerComparator: function (/* object*/ lhs, /* object*/ rhs) /* boolean*/ {
return lhs.value < rhs.value;
},
_greaterComparator: function (/* object*/ lhs, /* object*/ rhs) /* boolean*/ {
return lhs.value > rhs.value;
}
};
!(function () {
BI.LinkHashMap = function () {
@ -15496,245 +14959,6 @@ BI.IntegerBufferSet.prototype = {
p.has = function (key) {
return this._keymap[key] != null;
};
})();
!(function () {
var MD5 = function (hexcase) {
this.hexcase = !hexcase ? 0 : 1;
/* hex output format. 0 - lowercase; 1 - uppercase */
this.b64pad = "";
/* base-64 pad character. "=" for strict RFC compliance */
this.chrsz = 8;
/* bits per input character. 8 - ASCII; 16 - Unicode */
};
/*
* These are the functions you'll usually want to call
* They take string arguments and return either hex or base-64 encoded strings
*/
MD5.prototype.hex_md5 = function (s) {
return this.binl2hex(this.core_md5(this.str2binl(s), s.length * this.chrsz));
};
MD5.prototype.hex_md5_salt = function (s) {
var md5ed = this.hex_md5(s);
var items1 = [];
var items2 = [];
for (var i = 0; i < md5ed.length; i++) {
if (i % 2 === 0) {
items1.push(md5ed.charAt(i));
} else {
items2.push(md5ed.charAt(i));
}
}
var result = ":" + items1.join("") + items2.join("");
return result;
};
MD5.prototype.b64_md5 = function (s) {
return this.binl2b64(this.core_md5(this.str2binl(s), s.length * this.chrsz));
};
MD5.prototype.hex_hmac_md5 = function (key, data) {
return this.binl2hex(this.core_hmac_md5(key, data));
};
MD5.prototype.b64_hmac_md5 = function (key, data) {
return this.binl2b64(this.core_hmac_md5(key, data));
};
/* Backwards compatibility - same as hex_md5() */
MD5.prototype.calcMD5 = function (s) {
return this.binl2hex(this.core_md5(this.str2binl(s), s.length * this.chrsz));
};
MD5.prototype.core_md5 = function (x, len) {
/* append padding */
x[len >> 5] |= 0x80 << ((len) % 32);
x[(((len + 64) >>> 9) << 4) + 14] = len;
var a = 1732584193;
var b = -271733879;
var c = -1732584194;
var d = 271733878;
for (var i = 0; i < x.length; i += 16) {
var olda = a;
var oldb = b;
var oldc = c;
var oldd = d;
a = this.md5_ff(a, b, c, d, x[i + 0], 7, -680876936);
d = this.md5_ff(d, a, b, c, x[i + 1], 12, -389564586);
c = this.md5_ff(c, d, a, b, x[i + 2], 17, 606105819);
b = this.md5_ff(b, c, d, a, x[i + 3], 22, -1044525330);
a = this.md5_ff(a, b, c, d, x[i + 4], 7, -176418897);
d = this.md5_ff(d, a, b, c, x[i + 5], 12, 1200080426);
c = this.md5_ff(c, d, a, b, x[i + 6], 17, -1473231341);
b = this.md5_ff(b, c, d, a, x[i + 7], 22, -45705983);
a = this.md5_ff(a, b, c, d, x[i + 8], 7, 1770035416);
d = this.md5_ff(d, a, b, c, x[i + 9], 12, -1958414417);
c = this.md5_ff(c, d, a, b, x[i + 10], 17, -42063);
b = this.md5_ff(b, c, d, a, x[i + 11], 22, -1990404162);
a = this.md5_ff(a, b, c, d, x[i + 12], 7, 1804603682);
d = this.md5_ff(d, a, b, c, x[i + 13], 12, -40341101);
c = this.md5_ff(c, d, a, b, x[i + 14], 17, -1502002290);
b = this.md5_ff(b, c, d, a, x[i + 15], 22, 1236535329);
a = this.md5_gg(a, b, c, d, x[i + 1], 5, -165796510);
d = this.md5_gg(d, a, b, c, x[i + 6], 9, -1069501632);
c = this.md5_gg(c, d, a, b, x[i + 11], 14, 643717713);
b = this.md5_gg(b, c, d, a, x[i + 0], 20, -373897302);
a = this.md5_gg(a, b, c, d, x[i + 5], 5, -701558691);
d = this.md5_gg(d, a, b, c, x[i + 10], 9, 38016083);
c = this.md5_gg(c, d, a, b, x[i + 15], 14, -660478335);
b = this.md5_gg(b, c, d, a, x[i + 4], 20, -405537848);
a = this.md5_gg(a, b, c, d, x[i + 9], 5, 568446438);
d = this.md5_gg(d, a, b, c, x[i + 14], 9, -1019803690);
c = this.md5_gg(c, d, a, b, x[i + 3], 14, -187363961);
b = this.md5_gg(b, c, d, a, x[i + 8], 20, 1163531501);
a = this.md5_gg(a, b, c, d, x[i + 13], 5, -1444681467);
d = this.md5_gg(d, a, b, c, x[i + 2], 9, -51403784);
c = this.md5_gg(c, d, a, b, x[i + 7], 14, 1735328473);
b = this.md5_gg(b, c, d, a, x[i + 12], 20, -1926607734);
a = this.md5_hh(a, b, c, d, x[i + 5], 4, -378558);
d = this.md5_hh(d, a, b, c, x[i + 8], 11, -2022574463);
c = this.md5_hh(c, d, a, b, x[i + 11], 16, 1839030562);
b = this.md5_hh(b, c, d, a, x[i + 14], 23, -35309556);
a = this.md5_hh(a, b, c, d, x[i + 1], 4, -1530992060);
d = this.md5_hh(d, a, b, c, x[i + 4], 11, 1272893353);
c = this.md5_hh(c, d, a, b, x[i + 7], 16, -155497632);
b = this.md5_hh(b, c, d, a, x[i + 10], 23, -1094730640);
a = this.md5_hh(a, b, c, d, x[i + 13], 4, 681279174);
d = this.md5_hh(d, a, b, c, x[i + 0], 11, -358537222);
c = this.md5_hh(c, d, a, b, x[i + 3], 16, -722521979);
b = this.md5_hh(b, c, d, a, x[i + 6], 23, 76029189);
a = this.md5_hh(a, b, c, d, x[i + 9], 4, -640364487);
d = this.md5_hh(d, a, b, c, x[i + 12], 11, -421815835);
c = this.md5_hh(c, d, a, b, x[i + 15], 16, 530742520);
b = this.md5_hh(b, c, d, a, x[i + 2], 23, -995338651);
a = this.md5_ii(a, b, c, d, x[i + 0], 6, -198630844);
d = this.md5_ii(d, a, b, c, x[i + 7], 10, 1126891415);
c = this.md5_ii(c, d, a, b, x[i + 14], 15, -1416354905);
b = this.md5_ii(b, c, d, a, x[i + 5], 21, -57434055);
a = this.md5_ii(a, b, c, d, x[i + 12], 6, 1700485571);
d = this.md5_ii(d, a, b, c, x[i + 3], 10, -1894986606);
c = this.md5_ii(c, d, a, b, x[i + 10], 15, -1051523);
b = this.md5_ii(b, c, d, a, x[i + 1], 21, -2054922799);
a = this.md5_ii(a, b, c, d, x[i + 8], 6, 1873313359);
d = this.md5_ii(d, a, b, c, x[i + 15], 10, -30611744);
c = this.md5_ii(c, d, a, b, x[i + 6], 15, -1560198380);
b = this.md5_ii(b, c, d, a, x[i + 13], 21, 1309151649);
a = this.md5_ii(a, b, c, d, x[i + 4], 6, -145523070);
d = this.md5_ii(d, a, b, c, x[i + 11], 10, -1120210379);
c = this.md5_ii(c, d, a, b, x[i + 2], 15, 718787259);
b = this.md5_ii(b, c, d, a, x[i + 9], 21, -343485551);
a = this.safe_add(a, olda);
b = this.safe_add(b, oldb);
c = this.safe_add(c, oldc);
d = this.safe_add(d, oldd);
}
return Array(a, b, c, d);
};
/*
* These functions implement the four basic operations the algorithm uses.
*/
MD5.prototype.md5_cmn = function (q, a, b, x, s, t) {
return this.safe_add(this.bit_rol(this.safe_add(this.safe_add(a, q), this.safe_add(x, t)), s), b);
};
MD5.prototype.md5_ff = function (a, b, c, d, x, s, t) {
return this.md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
};
MD5.prototype.md5_gg = function (a, b, c, d, x, s, t) {
return this.md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
};
MD5.prototype.md5_hh = function (a, b, c, d, x, s, t) {
return this.md5_cmn(b ^ c ^ d, a, b, x, s, t);
};
MD5.prototype.md5_ii = function (a, b, c, d, x, s, t) {
return this.md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
};
/*
* Calculate the HMAC-MD5, of a key and some data
*/
MD5.prototype.core_hmac_md5 = function (key, data) {
var bkey = this.str2binl(key);
if (bkey.length > 16) {bkey = this.core_md5(bkey, key.length * this.chrsz);}
var ipad = Array(16), opad = Array(16);
for (var i = 0; i < 16; i++) {
ipad[i] = bkey[i] ^ 0x36363636;
opad[i] = bkey[i] ^ 0x5C5C5C5C;
}
var hash = this.core_md5(ipad.concat(this.str2binl(data)), 512 + data.length * this.chrsz);
return this.core_md5(opad.concat(hash), 512 + 128);
};
/*
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
* to work around bugs in some JS interpreters.
*/
MD5.prototype.safe_add = function (x, y) {
var lsw = (x & 0xFFFF) + (y & 0xFFFF);
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xFFFF);
};
/*
* Bitwise rotate a 32-bit number to the left.
*/
MD5.prototype.bit_rol = function (num, cnt) {
return (num << cnt) | (num >>> (32 - cnt));
};
/*
* Convert a string to an array of little-endian words
* If chrsz is ASCII, characters >255 have their hi-byte silently ignored.
*/
MD5.prototype.str2binl = function (str) {
var bin = Array();
var mask = (1 << this.chrsz) - 1;
for (var i = 0; i < str.length * this.chrsz; i += this.chrsz) {bin[i >> 5] |= (str.charCodeAt(i / this.chrsz) & mask) << (i % 32);}
return bin;
};
/*
* Convert an array of little-endian words to a hex string.
*/
MD5.prototype.binl2hex = function (binarray) {
var hex_tab = this.hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
var str = "";
for (var i = 0; i < binarray.length * 4; i++) {
str += hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 + 4)) & 0xF)
+ hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8)) & 0xF);
}
return str;
};
/*
* Convert an array of little-endian words to a base-64 string
*/
MD5.prototype.binl2b64 = function (binarray) {
var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var str = "";
for (var i = 0; i < binarray.length * 4; i += 3) {
var triplet = (((binarray[i >> 2] >> 8 * (i % 4)) & 0xFF) << 16)
| (((binarray[i + 1 >> 2] >> 8 * ((i + 1) % 4)) & 0xFF) << 8)
| ((binarray[i + 2 >> 2] >> 8 * ((i + 2) % 4)) & 0xFF);
for (var j = 0; j < 4; j++) {
if (i * 8 + j * 6 > binarray.length * 32) {str += this.b64pad;} else {str += tab.charAt((triplet >> 6 * (3 - j)) & 0x3F);}
}
}
return str;
};
BI.MD5 = new MD5();
})();// 线段树
(function () {
var parent = function (node) {
@ -16088,125 +15312,6 @@ BI.IntegerBufferSet.prototype = {
}
};
})();
(function () {
var clamp = function (value, min, max) {
if (value < min) {
return min;
}
if (value > max) {
return max;
}
return value;
};
var MIN_BUFFER_ROWS = 6;
var MAX_BUFFER_ROWS = 10;
BI.TableRowBuffer = function (rowsCount,
defaultRowHeight,
viewportHeight,
rowHeightGetter) {
this._bufferSet = new BI.IntegerBufferSet();
this._defaultRowHeight = defaultRowHeight;
this._viewportRowsBegin = 0;
this._viewportRowsEnd = 0;
this._maxVisibleRowCount = Math.ceil(viewportHeight / defaultRowHeight) + 1;
// this._bufferRowsCount = Math.floor(this._maxVisibleRowCount / 2);
this._bufferRowsCount = clamp(
Math.floor(this._maxVisibleRowCount / 2),
MIN_BUFFER_ROWS,
MAX_BUFFER_ROWS
);
this._rowsCount = rowsCount;
this._rowHeightGetter = rowHeightGetter;
this._rows = [];
this._viewportHeight = viewportHeight;
};
BI.TableRowBuffer.prototype = {
constructor: BI.TableRowBuffer,
getRowsWithUpdatedBuffer: function () {
var remainingBufferRows = 2 * this._bufferRowsCount;
var bufferRowIndex =
Math.max(this._viewportRowsBegin - this._bufferRowsCount, 0);
while (bufferRowIndex < this._viewportRowsBegin) {
this._addRowToBuffer(
bufferRowIndex,
this._viewportRowsBegin,
this._viewportRowsEnd - 1
);
bufferRowIndex++;
remainingBufferRows--;
}
bufferRowIndex = this._viewportRowsEnd;
while (bufferRowIndex < this._rowsCount && remainingBufferRows > 0) {
this._addRowToBuffer(
bufferRowIndex,
this._viewportRowsBegin,
this._viewportRowsEnd - 1
);
bufferRowIndex++;
remainingBufferRows--;
}
return this._rows;
},
getRows: function (firstRowIndex,
firstRowOffset) {
var top = firstRowOffset;
var totalHeight = top;
var rowIndex = firstRowIndex;
var endIndex =
Math.min(firstRowIndex + this._maxVisibleRowCount, this._rowsCount);
this._viewportRowsBegin = firstRowIndex;
while (rowIndex < endIndex ||
(totalHeight < this._viewportHeight && rowIndex < this._rowsCount)) {
this._addRowToBuffer(
rowIndex,
firstRowIndex,
endIndex - 1
);
totalHeight += this._rowHeightGetter(rowIndex);
++rowIndex;
// Store index after the last viewport row as end, to be able to
// distinguish when there are no rows rendered in viewport
this._viewportRowsEnd = rowIndex;
}
return this._rows;
},
_addRowToBuffer: function (rowIndex,
firstViewportRowIndex,
lastViewportRowIndex) {
var rowPosition = this._bufferSet.getValuePosition(rowIndex);
var viewportRowsCount = lastViewportRowIndex - firstViewportRowIndex + 1;
var allowedRowsCount = viewportRowsCount + this._bufferRowsCount * 2;
if (rowPosition === null &&
this._bufferSet.getSize() >= allowedRowsCount) {
rowPosition =
this._bufferSet.replaceFurthestValuePosition(
firstViewportRowIndex,
lastViewportRowIndex,
rowIndex
);
}
if (rowPosition === null) {
// We can't reuse any of existing positions for this row. We have to
// create new position
rowPosition = this._bufferSet.getNewPositionForValue(rowIndex);
this._rows[rowPosition] = rowIndex;
} else {
// This row already is in the table with rowPosition position or it
// can replace row that is in that position
this._rows[rowPosition] = rowIndex;
}
}
};
})();
(function () {
BI.Tree = function () {
this.root = new BI.Node(BI.UUID());

5
dist/utils.min.js vendored

File diff suppressed because one or more lines are too long

38
dist/widget.css vendored

@ -12,17 +12,6 @@
.bi-dynamic-date-combo .date-font {
font-size: 16px;
}
.bi-excel-table-header-cell {
font-weight: bold;
}
.bi-excel-table > div.bottom-right > div > div > table {
border-right: 1px solid #e8eaed;
}
.bi-theme-dark .bi-excel-table > div.bottom-right > div > div > table {
border-right: 1px solid #3a3c53;
}
.bi-interactive-arrangement .interactive-arrangement-dragtag-line {
z-index: 1000000000;
background-color: #faaa39;
@ -177,33 +166,6 @@
.bi-number-interval.number-error .bi-input {
color: #ff4949 !important;
}
.bi-preview-table-cell {
min-height: 25px;
min-width: 80px;
}
.bi-preview-table-header-cell {
font-weight: bold;
min-height: 25px;
min-width: 80px;
}
.bi-preview-table {
-webkit-user-select: text;
-khtml-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
-o-user-select: text;
user-select: text;
}
.bi-preview-table > div > table > thead > tr.odd,
.bi-preview-table > div > div > div > table > thead > tr.odd {
background-color: #f7f8fa;
}
.bi-theme-dark .bi-preview-table > div > table > thead > tr.odd,
.bi-theme-dark .bi-preview-table > div > div > div > table > thead > tr.odd {
background-color: #191B2B;
}
.bi-quarter-trigger {
-webkit-border-radius: 2px;
-moz-border-radius: 2px;

700
dist/widget.js vendored

@ -2852,7 +2852,7 @@ BI.extend(BI.DynamicDateCard, {
props: {
baseCls: "bi-dynamic-date-combo bi-border bi-focus-shadow",
height: 24
height: 22
},
@ -2867,13 +2867,13 @@ BI.extend(BI.DynamicDateCard, {
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font",
width: 24,
height: 24,
width: opts.height,
height: opts.height,
ref: function () {
self.changeIcon = this;
}
},
width: 24
width: opts.height
}, {
type: "bi.absolute",
items: [{
@ -2890,6 +2890,7 @@ BI.extend(BI.DynamicDateCard, {
type: "bi.dynamic_date_trigger",
min: this.constants.DATE_MIN_VALUE,
max: this.constants.DATE_MAX_VALUE,
height: opts.height,
value: opts.value,
ref: function () {
self.trigger = this;
@ -3034,8 +3035,8 @@ BI.extend(BI.DynamicDateCard, {
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-font",
width: 24,
height: 24,
width: opts.height,
height: opts.height,
listeners: [{
eventName: BI.IconButton.EVENT_CHANGE,
action: function () {
@ -3062,6 +3063,7 @@ BI.extend(BI.DynamicDateCard, {
},
_checkDynamicValue: function (v) {
var o = this.options;
var type = null;
if (BI.isNotNull(v)) {
type = v.type;
@ -3069,7 +3071,7 @@ BI.extend(BI.DynamicDateCard, {
switch (type) {
case BI.DynamicDateCombo.Dynamic:
this.changeIcon.setVisible(true);
this.comboWrapper.attr("items")[0].width = 24;
this.comboWrapper.attr("items")[0].width = o.height;
this.comboWrapper.resize();
break;
default:
@ -3738,7 +3740,7 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
props: {
baseCls: "bi-dynamic-date-combo bi-border bi-focus-shadow",
height: 24
height: 22
},
@ -3753,13 +3755,13 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font",
width: 24,
height: 24,
width: opts.height,
height: opts.height,
ref: function () {
self.changeIcon = this;
}
},
width: 24
width: opts.height
}, {
type: "bi.absolute",
items: [{
@ -3776,6 +3778,7 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
type: "bi.dynamic_date_time_trigger",
min: this.constants.DATE_MIN_VALUE,
max: this.constants.DATE_MAX_VALUE,
height: opts.height,
value: opts.value,
ref: function () {
self.trigger = this;
@ -3923,8 +3926,8 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-font",
width: 24,
height: 24,
width: opts.height,
height: opts.height,
listeners: [{
eventName: BI.IconButton.EVENT_CHANGE,
action: function () {
@ -3951,6 +3954,7 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
},
_checkDynamicValue: function (v) {
var o = this.options;
var type = null;
if (BI.isNotNull(v)) {
type = v.type;
@ -3958,7 +3962,7 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
switch (type) {
case BI.DynamicDateTimeCombo.Dynamic:
this.changeIcon.setVisible(true);
this.comboWrapper.attr("items")[0].width = 24;
this.comboWrapper.attr("items")[0].width = o.height;
this.comboWrapper.resize();
break;
default:
@ -13828,297 +13832,7 @@ BI.NumberInterval.EVENT_CHANGE = "EVENT_CHANGE";
BI.NumberInterval.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.NumberInterval.EVENT_VALID = "EVENT_VALID";
BI.NumberInterval.EVENT_ERROR = "EVENT_ERROR";
BI.shortcut("bi.number_interval", BI.NumberInterval);/**
* 预览表列
*
* 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);/**
BI.shortcut("bi.number_interval", BI.NumberInterval);/**
* 季度下拉框
*
* Created by GUY on 2015/8/28.
@ -14388,371 +14102,6 @@ BI.QuarterTrigger.EVENT_START = "EVENT_START";
BI.QuarterTrigger.EVENT_STOP = "EVENT_STOP";
BI.QuarterTrigger.EVENT_CONFIRM = "EVENT_CONFIRM";
BI.shortcut("bi.quarter_trigger", BI.QuarterTrigger);/**
* 自适应宽度的表格
*
* Created by GUY on 2016/2/3.
* @class BI.ResponisveTable
* @extends BI.Widget
*/
BI.ResponisveTable = BI.inherit(BI.Widget, {
_const: {
perColumnSize: 100
},
_defaultConfig: function () {
return BI.extend(BI.ResponisveTable.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-responsive-table",
isNeedFreeze: false, // 是否需要冻结单元格
freezeCols: [], // 冻结的列号,从0开始,isNeedFreeze为true时生效
logic: { // 冻结的页面布局逻辑
dynamic: false
},
isNeedMerge: false, // 是否需要合并单元格
mergeCols: [], // 合并的单元格列号
mergeRule: function (row1, row2) { // 合并规则, 默认相等时合并
return BI.isEqual(row1, row2);
},
columnSize: [],
headerRowSize: 25,
footerRowSize: 25,
rowSize: 25,
regionColumnSize: false,
header: [],
footer: false,
items: [], // 二维数组
// 交叉表头
crossHeader: [],
crossItems: []
});
},
_init: function () {
BI.ResponisveTable.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.table = BI.createWidget({
type: "bi.table_view",
element: this,
logic: o.logic,
isNeedFreeze: o.isNeedFreeze,
freezeCols: o.freezeCols,
isNeedMerge: o.isNeedMerge,
mergeCols: o.mergeCols,
mergeRule: o.mergeRule,
columnSize: o.columnSize,
headerRowSize: o.headerRowSize,
footerRowSize: o.footerRowSize,
rowSize: o.rowSize,
regionColumnSize: o.regionColumnSize,
header: o.header,
footer: o.footer,
items: o.items,
// 交叉表头
crossHeader: o.crossHeader,
crossItems: o.crossItems
});
this.table.on(BI.Table.EVENT_TABLE_AFTER_INIT, function () {
self._initRegionSize();
self.table.resize();
self._resizeHeader();
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_RESIZE, function () {
self._resizeRegion();
self._resizeHeader();
self.fireEvent(BI.Table.EVENT_TABLE_RESIZE, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_SCROLL, function () {
self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_BEFORE_REGION_RESIZE, function () {
self.fireEvent(BI.Table.EVENT_TABLE_BEFORE_REGION_RESIZE, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_REGION_RESIZE, function () {
// important:在冻结并自适应列宽的情况下要随时变更表头宽度
if (o.isNeedResize === true && self._isAdaptiveColumn()) {
self._resizeHeader();
}
self.fireEvent(BI.Table.EVENT_TABLE_REGION_RESIZE, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, function () {
self._resizeHeader();
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_BEFORE_COLUMN_RESIZE, function () {
self._resizeBody();
self.fireEvent(BI.Table.EVENT_TABLE_BEFORE_COLUMN_RESIZE, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_COLUMN_RESIZE, function () {
self.fireEvent(BI.Table.EVENT_TABLE_COLUMN_RESIZE, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, function () {
self._resizeRegion();
self._resizeHeader();
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, arguments);
});
},
_initRegionSize: function () {
var o = this.options;
if (o.isNeedFreeze === true) {
var regionColumnSize = this.table.getRegionColumnSize();
var maxWidth = this.table.element.width();
if (!regionColumnSize[0] || (regionColumnSize[0] === "fill") || regionColumnSize[0] > maxWidth || regionColumnSize[1] > maxWidth) {
var freezeCols = o.freezeCols;
if (freezeCols.length === 0) {
this.table.setRegionColumnSize([0, "fill"]);
} else if (freezeCols.length > 0 && freezeCols.length < o.columnSize.length) {
var size = maxWidth / 3;
if (freezeCols.length > o.columnSize.length / 2) {
size = maxWidth * 2 / 3;
}
this.table.setRegionColumnSize([size, "fill"]);
} else {
this.table.setRegionColumnSize(["fill", 0]);
}
}
}
},
_getBlockSize: function () {
var o = this.options;
var columnSize = this.table.getCalculateColumnSize();
if (o.isNeedFreeze === true) {
var columnSizeLeft = [], columnSizeRight = [];
BI.each(columnSize, function (i, size) {
if (o.freezeCols.contains(i)) {
columnSizeLeft.push(size);
} else {
columnSizeRight.push(size);
}
});
// 因为有边框,所以加上数组长度的参数调整
var sumLeft = BI.sum(columnSizeLeft) + columnSizeLeft.length,
sumRight = BI.sum(columnSizeRight) + columnSizeRight.length;
return {
sumLeft: sumLeft,
sumRight: sumRight,
left: columnSizeLeft,
right: columnSizeRight
};
}
return {
size: columnSize,
sum: BI.sum(columnSize) + columnSize.length
};
},
_isAdaptiveColumn: function (columnSize) {
return !(BI.last(columnSize || this.table.getColumnSize()) > 1.05);
},
_resizeHeader: function () {
var self = this, o = this.options;
if (o.isNeedFreeze === true) {
// 若是当前处于自适应调节阶段
if (this._isAdaptiveColumn()) {
var columnSize = this.table.getCalculateColumnSize();
this.table.setHeaderColumnSize(columnSize);
} else {
var regionColumnSize = this.table.getClientRegionColumnSize();
var block = this._getBlockSize();
var sumLeft = block.sumLeft, sumRight = block.sumRight;
var columnSizeLeft = block.left, columnSizeRight = block.right;
columnSizeLeft[columnSizeLeft.length - 1] += regionColumnSize[0] - sumLeft;
columnSizeRight[columnSizeRight.length - 1] += regionColumnSize[1] - sumRight;
var newLeft = BI.clone(columnSizeLeft), newRight = BI.clone(columnSizeRight);
newLeft[newLeft.length - 1] = "";
newRight[newRight.length - 1] = "";
this.table.setColumnSize(newLeft.concat(newRight));
block = self._getBlockSize();
if (columnSizeLeft[columnSizeLeft.length - 1] < block.left[block.left.length - 1]) {
columnSizeLeft[columnSizeLeft.length - 1] = block.left[block.left.length - 1];
}
if (columnSizeRight[columnSizeRight.length - 1] < block.right[block.right.length - 1]) {
columnSizeRight[columnSizeRight.length - 1] = block.right[block.right.length - 1];
}
self.table.setColumnSize(columnSizeLeft.concat(columnSizeRight));
}
} else {
if (!this._isAdaptiveColumn()) {
var regionColumnSize = this.table.getClientRegionColumnSize();
var block = this._getBlockSize();
var sum = block.sum;
var size = block.size;
size[size.length - 1] += regionColumnSize[0] - sum;
var newSize = BI.clone(size);
newSize[newSize.length - 1] = "";
this.table.setColumnSize(newSize);
block = this._getBlockSize();
if (size[size.length - 1] < block.size[block.size.length - 1]) {
size[size.length - 1] = block.size[block.size.length - 1];
}
this.table.setColumnSize(size);
}
}
},
_resizeBody: function () {
if (this._isAdaptiveColumn()) {
var columnSize = this.table.getCalculateColumnSize();
this.setColumnSize(columnSize);
}
},
_adjustRegion: function () {
var o = this.options;
var regionColumnSize = this.table.getCalculateRegionColumnSize();
if (o.isNeedFreeze === true && o.freezeCols.length > 0 && o.freezeCols.length < o.columnSize.length) {
var block = this._getBlockSize();
var sumLeft = block.sumLeft, sumRight = block.sumRight;
if (sumLeft < regionColumnSize[0] || regionColumnSize[0] >= (sumLeft + sumRight)) {
this.table.setRegionColumnSize([sumLeft, "fill"]);
}
this._resizeRegion();
}
},
_resizeRegion: function () {
var o = this.options;
var regionColumnSize = this.table.getCalculateRegionColumnSize();
if (o.isNeedFreeze === true && o.freezeCols.length > 0 && o.freezeCols.length < o.columnSize.length) {
var maxWidth = this.table.element.width();
if (regionColumnSize[0] < 15 || regionColumnSize[1] < 15) {
var freezeCols = o.freezeCols;
var size = maxWidth / 3;
if (freezeCols.length > o.columnSize.length / 2) {
size = maxWidth * 2 / 3;
}
this.table.setRegionColumnSize([size, "fill"]);
}
}
},
resize: function () {
this.table.resize();
this._resizeRegion();
this._resizeHeader();
},
setColumnSize: function (columnSize) {
this.table.setColumnSize(columnSize);
this._adjustRegion();
this._resizeHeader();
},
getColumnSize: function () {
return this.table.getColumnSize();
},
getCalculateColumnSize: function () {
return this.table.getCalculateColumnSize();
},
setHeaderColumnSize: function (columnSize) {
this.table.setHeaderColumnSize(columnSize);
this._adjustRegion();
this._resizeHeader();
},
setRegionColumnSize: function (columnSize) {
this.table.setRegionColumnSize(columnSize);
this._resizeHeader();
},
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) {
this.table.setVerticalScroll(scrollTop);
},
setLeftHorizontalScroll: function (scrollLeft) {
this.table.setLeftHorizontalScroll(scrollLeft);
},
setRightHorizontalScroll: function (scrollLeft) {
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();
},
attr: function () {
BI.ResponisveTable.superclass.attr.apply(this, arguments);
this.table.attr.apply(this.table, arguments);
},
populate: function (items) {
var self = this, o = this.options;
this.table.populate.apply(this.table, arguments);
if (o.isNeedFreeze === true) {
BI.nextTick(function () {
self._initRegionSize();
self.table.resize();
self._resizeHeader();
});
}
}
});
BI.shortcut("bi.responsive_table", BI.ResponisveTable);/**
*
* @class BI.SearchMultiTextValueCombo
* @extends BI.Single
@ -20025,7 +19374,7 @@ BI.shortcut("bi.static_year_card", BI.StaticYearCard);BI.DynamicYearCombo = BI.i
behaviors: {},
min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期
height: 24
height: 22
},
_init: function () {
@ -20036,6 +19385,7 @@ BI.shortcut("bi.static_year_card", BI.StaticYearCard);BI.DynamicYearCombo = BI.i
type: "bi.dynamic_year_trigger",
min: o.min,
max: o.max,
height: o.height,
value: o.value || ""
});
this.trigger.on(BI.DynamicYearTrigger.EVENT_FOCUS, function () {
@ -20758,7 +20108,7 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
behaviors: {},
min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期
height: 24
height: 22
},
_init: function () {
@ -20770,6 +20120,7 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
type: "bi.dynamic_year_month_trigger",
min: o.min,
max: o.max,
height: o.height,
value: o.value || ""
});
this.trigger.on(BI.DynamicYearMonthTrigger.EVENT_KEY_DOWN, function () {
@ -21786,7 +21137,7 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
behaviors: {},
min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期
height: 24
height: 22
},
_init: function () {
@ -21798,6 +21149,7 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
type: "bi.dynamic_year_quarter_trigger",
min: o.min,
max: o.max,
height: o.height,
value: o.value || ""
});
this.trigger.on(BI.DynamicYearQuarterTrigger.EVENT_KEY_DOWN, function () {
@ -22188,7 +21540,7 @@ BI.shortcut("bi.dynamic_year_quarter_popup", BI.DynamicYearQuarterPopup);BI.Dyna
el: {
type: "bi.text_button",
text: BI.i18nText("BI-Multi_Date_Quarter"),
width: o.height
width: o.height < 24 ? 24 : o.height
},
width: o.height}]
}]

1
src/base/single/button/button.basic.js

@ -238,7 +238,6 @@ BI.BasicButton = BI.inherit(BI.Single, {
},
popup: {
type: "bi.text_bubble_bar_popup_view",
cls: "popup-content",
text: getBubble(),
ref: function () {
popup = this;

155
src/base/table/native.scrollbar.js

@ -1,155 +0,0 @@
/**
*
* 原生表格滚动条为了IE8的兼容
*
* Created by GUY on 2016/1/12.
* @class BI.NativeTableScrollbar
* @extends BI.Widget
*/
BI.NativeTableScrollbar = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.NativeTableScrollbar.superclass._defaultConfig.apply(this, arguments), {
attributes: {
tabIndex: 0
},
contentSize: 0,
defaultPosition: 0,
position: 0,
size: 0
});
},
render: function () {
var self = this, o = this.options;
// 把滚动台size改掉
this.element.width(36);
var throttle = BI.throttle(function () {
self.fireEvent(BI.NativeTableScrollbar.EVENT_SCROLL, self.element.scrollTop());
}, 150, {leading: false});
this.element.scroll(function () {
throttle();
});
return {
type: "bi.default",
scrolly: true,
items: [{
type: "bi.layout",
width: 1,
ref: function (_ref) {
self.inner = _ref;
}
}]
};
},
mounted: function () {
this._populate();
},
_populate: function () {
var self = this, o = this.options;
if (o.size < 1 || o.contentSize <= o.size) {
this.setVisible(false);
return;
}
this.setVisible(true);
try {
this.element.scrollTop(o.position);
} catch (e) {
}
this.inner.element.height(o.contentSize);
},
setContentSize: function (contentSize) {
this.options.contentSize = contentSize;
},
setPosition: function (position) {
this.options.position = position;
},
setSize: function (size) {
this.setHeight(size);
this.options.size = size;
},
populate: function () {
this._populate();
}
});
BI.NativeTableScrollbar.EVENT_SCROLL = "EVENT_SCROLL";
BI.shortcut("bi.native_table_scrollbar", BI.NativeTableScrollbar);
BI.NativeTableHorizontalScrollbar = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.NativeTableHorizontalScrollbar.superclass._defaultConfig.apply(this, arguments), {
attributes: {
tabIndex: 0
},
contentSize: 0,
position: 0,
size: 0
});
},
render: function () {
var self = this, o = this.options;
// 把滚动台size改掉
this.element.height(36);
var throttle = BI.throttle(function () {
self.fireEvent(BI.NativeTableScrollbar.EVENT_SCROLL, self.element.scrollLeft());
}, 150, {leading: false});
this.element.scroll(function () {
throttle();
});
return {
type: "bi.default",
scrollx: true,
items: [{
type: "bi.layout",
height: 1,
ref: function (_ref) {
self.inner = _ref;
}
}]
};
},
setContentSize: function (contentSize) {
this.options.contentSize = contentSize;
},
setPosition: function (position) {
this.options.position = position;
},
setSize: function (size) {
this.setWidth(size);
this.options.size = size;
},
_populate: function () {
var self = this, o = this.options;
if (o.size < 1 || o.contentSize <= o.size) {
this.setVisible(false);
return;
}
this.setVisible(true);
try {
this.element.scrollLeft(o.position);
} catch (e) {
}
this.inner.element.width(o.contentSize);
},
populate: function () {
this._populate();
}
});
BI.NativeTableHorizontalScrollbar.EVENT_SCROLL = "EVENT_SCROLL";
BI.shortcut("bi.native_table_horizontal_scrollbar", BI.NativeTableHorizontalScrollbar);

36
src/base/table/table.cell.js

@ -1,36 +0,0 @@
/**
*
* 表格
*
* 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);

57
src/base/table/table.collection.cell.js

@ -1,57 +0,0 @@
/**
*
* 表格单元格
*
* Created by GUY on 2016/1/12.
* @class BI.CollectionTableCell
* @extends BI.Widget
*/
BI.CollectionTableCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.CollectionTableCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-collection-table-cell bi-border-right bi-border-bottom",
width: 0,
height: 0,
_left: 0,
_top: 0,
cell: {}
});
},
_init: function () {
BI.CollectionTableCell.superclass._init.apply(this, arguments);
var o = this.options;
this.cell = BI.createWidget(BI.extend({
type: "bi.label"
}, o.cell, {
cls: (o.cell.cls || "") + " collection-table-cell-wrapper",
width: o.width - (o._left === 0 ? 1 : 0) - 1,
height: o.height - (o._top === 0 ? 1 : 0) - 1
}));
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.cell,
left: 0,
right: 0,
top: 0,
bottom: 0
}]
});
},
setWidth: function (width) {
BI.CollectionTableCell.superclass.setWidth.apply(this, arguments);
var o = this.options;
this.cell.setWidth(o.width - (o._left === 0 ? 1 : 0) - 1);
},
setHeight: function (height) {
BI.CollectionTableCell.superclass.setHeight.apply(this, arguments);
var o = this.options;
this.cell.setHeight(o.height - (o._top === 0 ? 1 : 0) - 1);
}
});
BI.shortcut("bi.collection_table_cell", BI.CollectionTableCell);

558
src/base/table/table.collection.js

@ -1,558 +0,0 @@
/**
* CollectionTable
*
* Created by GUY on 2016/1/12.
* @class BI.CollectionTable
* @extends BI.Widget
*/
BI.CollectionTable = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.CollectionTable.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-collection-table",
headerRowSize: 25,
rowSize: 25,
columnSize: [],
isNeedFreeze: false,
freezeCols: [],
isNeedMerge: false,
mergeCols: [],
mergeRule: BI.emptyFn,
header: [],
items: [],
regionColumnSize: []
});
},
render: function () {
var self = this, o = this.options;
this._width = 0;
this._height = 0;
this._scrollBarSize = BI.DOM.getScrollWidth();
this.topLeftCollection = BI.createWidget({
type: "bi.collection_view",
cellSizeAndPositionGetter: function (index) {
return self.topLeftItems[index];
}
});
this.topLeftCollection.on(BI.CollectionView.EVENT_SCROLL, function (scroll) {
self.bottomLeftCollection.setScrollLeft(scroll.scrollLeft);
self._populateScrollbar();
self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments);
});
this.topRightCollection = BI.createWidget({
type: "bi.collection_view",
cellSizeAndPositionGetter: function (index) {
return self.topRightItems[index];
}
});
this.topRightCollection.on(BI.CollectionView.EVENT_SCROLL, function (scroll) {
self.bottomRightCollection.setScrollLeft(scroll.scrollLeft);
self._populateScrollbar();
self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments);
});
this.bottomLeftCollection = BI.createWidget({
type: "bi.collection_view",
cellSizeAndPositionGetter: function (index) {
return self.bottomLeftItems[index];
}
});
this.bottomLeftCollection.on(BI.CollectionView.EVENT_SCROLL, function (scroll) {
self.bottomRightCollection.setScrollTop(scroll.scrollTop);
self.topLeftCollection.setScrollLeft(scroll.scrollLeft);
self._populateScrollbar();
self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments);
});
this.bottomRightCollection = BI.createWidget({
type: "bi.collection_view",
cellSizeAndPositionGetter: function (index) {
return self.bottomRightItems[index];
}
});
this.bottomRightCollection.on(BI.CollectionView.EVENT_SCROLL, function (scroll) {
self.bottomLeftCollection.setScrollTop(scroll.scrollTop);
self.topRightCollection.setScrollLeft(scroll.scrollLeft);
self._populateScrollbar();
self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments);
});
this.topLeft = BI.createWidget({
type: "bi.vertical",
scrollable: false,
scrolly: false,
items: [this.topLeftCollection]
});
this.topRight = BI.createWidget({
type: "bi.vertical",
scrollable: false,
scrolly: false,
items: [this.topRightCollection]
});
this.bottomLeft = BI.createWidget({
type: "bi.vertical",
scrollable: false,
scrolly: false,
items: [this.bottomLeftCollection]
});
this.bottomRight = BI.createWidget({
type: "bi.vertical",
scrollable: false,
scrolly: false,
items: [this.bottomRightCollection]
});
this.contextLayout = BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.topLeft,
top: 0,
left: 0
}, {
el: this.topRight,
top: 0
}, {
el: this.bottomLeft,
left: 0
}, {
el: this.bottomRight
}]
});
this.topScrollbar = BI.createWidget({
type: "bi.grid_table_scrollbar",
width: BI.GridTableScrollbar.SIZE
});
this.topScrollbar.on(BI.GridTableScrollbar.EVENT_SCROLL, function (scrollTop) {
self.bottomLeftCollection.setScrollTop(scrollTop);
self.bottomRightCollection.setScrollTop(scrollTop);
self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments);
});
this.leftScrollbar = BI.createWidget({
type: "bi.grid_table_horizontal_scrollbar",
height: BI.GridTableScrollbar.SIZE
});
this.leftScrollbar.on(BI.GridTableScrollbar.EVENT_SCROLL, function (scrollLeft) {
self.topLeftCollection.setScrollLeft(scrollLeft);
self.bottomLeftCollection.setScrollLeft(scrollLeft);
self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments);
});
this.rightScrollbar = BI.createWidget({
type: "bi.grid_table_horizontal_scrollbar",
height: BI.GridTableScrollbar.SIZE
});
this.rightScrollbar.on(BI.GridTableScrollbar.EVENT_SCROLL, function (scrollLeft) {
self.topRightCollection.setScrollLeft(scrollLeft);
self.bottomRightCollection.setScrollLeft(scrollLeft);
self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments);
});
this.scrollBarLayout = BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.topScrollbar,
right: 0,
top: 0
}, {
el: this.leftScrollbar,
left: 0
}, {
el: this.rightScrollbar
}]
});
this._width = o.width - BI.GridTableScrollbar.SIZE;
this._height = o.height - BI.GridTableScrollbar.SIZE;
},
mounted: function () {
var o = this.options;
if (o.items.length > 0 || o.header.length > 0) {
this._digest();
this._populate();
}
},
_getFreezeColLength: function () {
var o = this.options;
return o.isNeedFreeze === true ? BI.clamp(o.freezeCols.length, 0, o.columnSize.length) : 0;
},
_getFreezeHeaderHeight: function () {
var o = this.options;
if (o.header.length * o.headerRowSize >= this._height) {
return 0;
}
return o.header.length * o.headerRowSize;
},
_getActualItems: function () {
var o = this.options;
if (o.header.length * o.headerRowSize >= this._height) {
return o.header.concat(o.items);
}
return o.items;
},
_populateScrollbar: function () {
var o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [];
BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
totalLeftColumnSize += size;
} else {
totalRightColumnSize += size;
}
totalColumnSize += size;
if (i === 0) {
summaryColumnSizeArray[i] = size;
} else {
summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size;
}
});
this.topScrollbar.setContentSize(this._getActualItems().length * o.rowSize);
this.topScrollbar.setSize(this._height - this._getFreezeHeaderHeight());
this.topScrollbar.setPosition(this.bottomRightCollection.getScrollTop());
this.topScrollbar.populate();
this.leftScrollbar.setContentSize(totalLeftColumnSize);
this.leftScrollbar.setSize(regionSize);
this.leftScrollbar.setPosition(this.bottomLeftCollection.getScrollLeft());
this.leftScrollbar.populate();
this.rightScrollbar.setContentSize(totalRightColumnSize);
this.rightScrollbar.setSize(this._width - regionSize);
this.rightScrollbar.setPosition(this.bottomRightCollection.getScrollLeft());
this.rightScrollbar.populate();
var items = this.scrollBarLayout.attr("items");
items[0].top = this._getFreezeHeaderHeight();
items[1].top = this._height;
items[2].top = this._height;
items[2].left = regionSize;
this.scrollBarLayout.attr("items", items);
this.scrollBarLayout.resize();
},
_populateTable: function () {
var self = this, o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [];
BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
totalLeftColumnSize += size;
} else {
totalRightColumnSize += size;
}
totalColumnSize += size;
if (i === 0) {
summaryColumnSizeArray[i] = size;
} else {
summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size;
}
});
var otlw = regionSize;
var otlh = this._getFreezeHeaderHeight();
var otrw = this._width - regionSize;
var otrh = this._getFreezeHeaderHeight();
var oblw = regionSize;
var oblh = this._height - otlh;
var obrw = this._width - regionSize;
var obrh = this._height - otrh;
var tlw = otlw + this._scrollBarSize;
var tlh = otlh + this._scrollBarSize;
var trw = otrw + this._scrollBarSize;
var trh = otrh + this._scrollBarSize;
var blw = oblw + this._scrollBarSize;
var blh = oblh + this._scrollBarSize;
var brw = obrw + this._scrollBarSize;
var brh = obrh + this._scrollBarSize;
var digest = function (el) {
el.element.css({
overflow: "scroll",
overflowX: "scroll",
overflowY: "scroll"
});
};
this.topLeft.setWidth(otlw);
this.topLeft.setHeight(otlh);
this.topRight.setWidth(otrw);
this.topRight.setHeight(otrh);
this.bottomLeft.setWidth(oblw);
this.bottomLeft.setHeight(oblh);
this.bottomRight.setWidth(obrw);
this.bottomRight.setHeight(obrh);
this.topLeftCollection.setWidth(tlw);
this.topLeftCollection.setHeight(tlh);
this.topRightCollection.setWidth(trw);
this.topRightCollection.setHeight(trh);
this.bottomLeftCollection.setWidth(blw);
this.bottomLeftCollection.setHeight(blh);
this.bottomRightCollection.setWidth(brw);
this.bottomRightCollection.setHeight(brh);
digest(this.topLeftCollection);
digest(this.topRightCollection);
digest(this.bottomLeftCollection);
digest(this.bottomRightCollection);
var items = this.contextLayout.attr("items");
items[1].left = regionSize;
items[2].top = this._getFreezeHeaderHeight();
items[3].left = regionSize;
items[3].top = this._getFreezeHeaderHeight();
this.contextLayout.attr("items", items);
this.contextLayout.resize();
var leftHeader = [], rightHeader = [], leftItems = [], rightItems = [];
var run = function (positions, items, rendered) {
BI.each(positions, function (i, item) {
var cell = {
type: "bi.collection_table_cell",
cell: items[item.row][item.col]
};
rendered.push(cell);
});
};
run(this.topLeftItems, o.header, leftHeader);
run(this.topRightItems, o.header, rightHeader);
run(this.bottomLeftItems, this._getActualItems(), leftItems);
run(this.bottomRightItems, this._getActualItems(), rightItems);
this.topLeftCollection._populate(leftHeader);
this.topRightCollection._populate(rightHeader);
this.bottomLeftCollection._populate(leftItems);
this.bottomRightCollection._populate(rightItems);
},
_digest: function () {
var o = this.options;
var freezeColLength = this._getFreezeColLength();
// 如果表头位置不够,取消表头冻结
if (this._getFreezeHeaderHeight() <= 0) {
this.topLeftItems = [];
this.topRightItems = [];
this.bottomLeftItems = this._serialize(this._getActualItems(), 0, freezeColLength, o.rowSize, o.columnSize, o.mergeCols, BI.range(o.header.length));
this.bottomRightItems = this._serialize(this._getActualItems(), freezeColLength, o.columnSize.length, o.rowSize, o.columnSize, o.mergeCols, BI.range(o.header.length));
} else {
this.topLeftItems = this._serialize(o.header, 0, freezeColLength, o.headerRowSize, o.columnSize, o.mergeCols);
this.topRightItems = this._serialize(o.header, freezeColLength, o.columnSize.length, o.headerRowSize, o.columnSize, true);
this.bottomLeftItems = this._serialize(o.items, 0, freezeColLength, o.rowSize, o.columnSize, o.mergeCols);
this.bottomRightItems = this._serialize(o.items, freezeColLength, o.columnSize.length, o.rowSize, o.columnSize, o.mergeCols);
}
},
_serialize: function (items, startCol, endCol, rowHeight, columnSize, mergeCols, mergeRows) {
mergeCols = mergeCols || [];
mergeRows = mergeRows || [];
var self = this, o = this.options;
var result = [], cache = {}, preCol = {}, preRow = {}, map = {};
var summaryColumnSize = [];
for (var i = startCol; i < endCol; i++) {
if (i === startCol) {
summaryColumnSize[i] = columnSize[i];
} else {
summaryColumnSize[i] = summaryColumnSize[i - 1] + columnSize[i];
}
}
var mergeRow = function (i, j) {
preCol[j]._height += rowHeight;
preCol[j].__mergeRows.push(i);
};
var mergeCol = function (i, j) {
preRow[i]._width += columnSize[j];
preRow[i].__mergeCols.push(j);
};
var createOneEl = function (r, c) {
var width = columnSize[c];
var height = rowHeight;
map[r][c]._row = r;
map[r][c]._col = c;
map[r][c]._width = width;
map[r][c]._height = height;
preCol[c] = map[r][c];
preCol[c].__mergeRows = [r];
preRow[r] = map[r][c];
preRow[r].__mergeCols = [c];
result.push({
x: summaryColumnSize[c] - columnSize[c],
y: +r * rowHeight,
item: map[r][c]
});
};
BI.each(items, function (i, cols) {
for (var j = startCol; j < endCol; j++) {
if (!cache[i]) {
cache[i] = {};
}
if (!map[i]) {
map[i] = {};
}
cache[i][j] = cols[j];
map[i][j] = {};
if (mergeCols === true || mergeCols.indexOf(j) > -1 || mergeRows === true || mergeRows.indexOf(i) > -1) {
if (i === 0 && j === startCol) {
createOneEl(0, startCol);
} else if (j === startCol && i > 0) {
var isNeedMergeRow = o.mergeRule(cache[i][j], cache[i - 1][j]);
if (isNeedMergeRow === true) {
mergeRow(i, j);
preRow[i] = preCol[j];
} else {
createOneEl(i, j);
}
} else if (i === 0 && j > startCol) {
var isNeedMergeCol = o.mergeRule(cache[i][j], cache[i][j - 1]);
if (isNeedMergeCol === true) {
mergeCol(i, j);
preCol[j] = preRow[i];
} else {
createOneEl(i, j);
}
} else {
var isNeedMergeRow = o.mergeRule(cache[i][j], cache[i - 1][j]);
var isNeedMergeCol = o.mergeRule(cache[i][j], cache[i][j - 1]);
if (isNeedMergeCol && isNeedMergeRow) {
continue;
// mergeRow(i, j);//优先合并列
}
if (isNeedMergeCol) {
mergeCol(i, j);
}
if (isNeedMergeRow) {
mergeRow(i, j);
}
if (!isNeedMergeCol && !isNeedMergeRow) {
createOneEl(i, j);
}
}
} else {
createOneEl(i, j);
}
}
});
return BI.map(result, function (i, item) {
return {
x: item.x,
y: item.y,
row: item.item._row,
col: item.item._col,
width: item.item._width,
height: item.item._height
};
});
},
_populate: function () {
if (this._width <= 0 || this._height <= 0) {
return;
}
if (this._isNeedDigest === true) {
this._digest();
}
this._isNeedDigest = false;
this._populateTable();
this._populateScrollbar();
},
getRegionSize: function () {
var o = this.options;
var regionSize = o.regionColumnSize[0] || 0;
if (o.isNeedFreeze === false || o.freezeCols.length === 0) {
return 0;
}
if (!regionSize) {
BI.each(o.freezeCols, function (i, col) {
regionSize += o.columnSize[col];
});
}
return regionSize;
},
setVerticalScroll: function (scrollTop) {
this.bottomLeftCollection.setScrollTop(scrollTop);
this.bottomRightCollection.setScrollTop(scrollTop);
},
setLeftHorizontalScroll: function (scrollLeft) {
this.topLeftCollection.setScrollLeft(scrollLeft);
this.bottomLeftCollection.setScrollLeft(scrollLeft);
},
setRightHorizontalScroll: function (scrollLeft) {
this.topRightCollection.setScrollLeft(scrollLeft);
this.bottomRightCollection.setScrollLeft(scrollLeft);
},
getVerticalScroll: function () {
return this.bottomRightCollection.getScrollTop();
},
getLeftHorizontalScroll: function () {
return this.bottomLeftCollection.getScrollLeft();
},
getRightHorizontalScroll: function () {
return this.bottomRightCollection.getScrollLeft();
},
setWidth: function (width) {
BI.CollectionTable.superclass.setWidth.apply(this, arguments);
this._width = this.options.width - BI.GridTableScrollbar.SIZE;
},
setHeight: function (height) {
BI.CollectionTable.superclass.setHeight.apply(this, arguments);
this._height = this.options.height - BI.GridTableScrollbar.SIZE;
},
setColumnSize: function (columnSize) {
this._isNeedDigest = true;
this.options.columnSize = columnSize;
},
setRegionColumnSize: function (regionColumnSize) {
this._isNeedDigest = true;
this.options.regionColumnSize = regionColumnSize;
},
getColumnSize: function () {
return this.options.columnSize;
},
getRegionColumnSize: function () {
return this.options.regionColumnSize;
},
populate: function (items, header) {
if (items && items !== this.options.items) {
this._isNeedDigest = true;
this.options.items = items;
this._restore();
}
if (header && header !== this.options.header) {
this._isNeedDigest = true;
this.options.header = header;
this._restore();
}
this._populate();
},
_restore: function () {
this.topLeftCollection.restore();
this.topRightCollection.restore();
this.bottomLeftCollection.restore();
this.bottomRightCollection.restore();
},
restore: function () {
this._restore();
}
});
BI.shortcut("bi.collection_table", BI.CollectionTable);

191
src/base/table/table.collection.quick.js

@ -1,191 +0,0 @@
/**
* QuickCollectionTable
*
* Created by GUY on 2016/1/12.
* @class BI.QuickCollectionTable
* @extends BI.CollectionTable
*/
BI.QuickCollectionTable = BI.inherit(BI.CollectionTable, {
_defaultConfig: function () {
return BI.extend(BI.QuickCollectionTable.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-quick-collection-table"
});
},
render: function () {
BI.QuickCollectionTable.superclass.render.apply(this, arguments);
var self = this, o = this.options;
this.topLeftCollection.setOverflowX(false);
this.topLeftCollection.setOverflowY(false);
this.topRightCollection.setOverflowX(false);
this.topRightCollection.setOverflowY(false);
this.bottomLeftCollection.setOverflowX(false);
this.bottomLeftCollection.setOverflowY(false);
this.bottomRightCollection.setOverflowX(false);
this.bottomRightCollection.setOverflowY(false);
},
mounted: function () {
BI.QuickCollectionTable.superclass.mounted.apply(this, arguments);
var self = this;
this._topLeftWheelHandler = new BI.WheelHandler(
BI.bind(this._onWheelLeft, this),
BI.bind(this._shouldHandleLeftX, this),
BI.bind(this._shouldHandleY, this)
);
this._topRightWheelHandler = new BI.WheelHandler(
BI.bind(this._onWheelRight, this),
BI.bind(this._shouldHandleRightX, this),
BI.bind(this._shouldHandleY, this)
);
this._bottomLeftWheelHandler = new BI.WheelHandler(
BI.bind(this._onWheelLeft, this),
BI.bind(this._shouldHandleLeftX, this),
BI.bind(this._shouldHandleY, this)
);
this._bottomRightWheelHandler = new BI.WheelHandler(
BI.bind(this._onWheelRight, this),
BI.bind(this._shouldHandleRightX, this),
BI.bind(this._shouldHandleY, this)
);
this.topLeftCollection.element.mousewheel(function (e) {
self._topLeftWheelHandler.onWheel(e.originalEvent);
});
this.topRightCollection.element.mousewheel(function (e) {
self._topRightWheelHandler.onWheel(e.originalEvent);
});
this.bottomLeftCollection.element.mousewheel(function (e) {
self._bottomLeftWheelHandler.onWheel(e.originalEvent);
});
this.bottomRightCollection.element.mousewheel(function (e) {
self._bottomRightWheelHandler.onWheel(e.originalEvent);
});
},
_shouldHandleLeftX: function (delta) {
if (delta > 0) {
return this.bottomLeftCollection.getScrollLeft() < this.bottomLeftCollection.getMaxScrollLeft();
}
return this.bottomLeftCollection.getScrollLeft() > 0;
},
_shouldHandleRightX: function (delta) {
if (delta > 0) {
return this.bottomRightCollection.getScrollLeft() < this.bottomRightCollection.getMaxScrollLeft();
}
return this.bottomRightCollection.getScrollLeft() > 0;
},
_shouldHandleY: function (delta) {
if (delta > 0) {
return this.bottomRightCollection.getScrollTop() < this.bottomRightCollection.getMaxScrollTop();
}
return this.bottomRightCollection.getScrollTop() > 0;
},
_onWheelLeft: function (deltaX, deltaY) {
var self = this;
var scrollTop = this.bottomLeftCollection.getScrollTop();
var scrollLeft = this.bottomLeftCollection.getScrollLeft();
scrollTop += deltaY;
scrollLeft += deltaX;
this.bottomLeftCollection.setScrollTop(scrollTop);
this.bottomRightCollection.setScrollTop(scrollTop);
this.topLeftCollection.setScrollLeft(scrollLeft);
this.bottomLeftCollection.setScrollLeft(scrollLeft);
self._populateScrollbar();
this.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments);
},
_onWheelRight: function (deltaX, deltaY) {
var self = this;
var scrollTop = this.bottomRightCollection.getScrollTop();
var scrollLeft = this.bottomRightCollection.getScrollLeft();
scrollTop += deltaY;
scrollLeft += deltaX;
this.bottomLeftCollection.setScrollTop(scrollTop);
this.bottomRightCollection.setScrollTop(scrollTop);
this.topRightCollection.setScrollLeft(scrollLeft);
this.bottomRightCollection.setScrollLeft(scrollLeft);
self._populateScrollbar();
this.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments);
},
_populateTable: function () {
var self = this, o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [];
BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
totalLeftColumnSize += size;
} else {
totalRightColumnSize += size;
}
totalColumnSize += size;
if (i === 0) {
summaryColumnSizeArray[i] = size;
} else {
summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size;
}
});
var otlw = regionSize;
var otlh = this._getFreezeHeaderHeight();
var otrw = this._width - regionSize;
var otrh = this._getFreezeHeaderHeight();
var oblw = regionSize;
var oblh = this._height - otlh;
var obrw = this._width - regionSize;
var obrh = this._height - otrh;
this.topLeft.setWidth(otlw);
this.topLeft.setHeight(otlh);
this.topRight.setWidth(otrw);
this.topRight.setHeight(otrh);
this.bottomLeft.setWidth(oblw);
this.bottomLeft.setHeight(oblh);
this.bottomRight.setWidth(obrw);
this.bottomRight.setHeight(obrh);
this.topLeftCollection.setWidth(otlw);
this.topLeftCollection.setHeight(otlh);
this.topRightCollection.setWidth(otrw);
this.topRightCollection.setHeight(otrh);
this.bottomLeftCollection.setWidth(oblw);
this.bottomLeftCollection.setHeight(oblh);
this.bottomRightCollection.setWidth(obrw);
this.bottomRightCollection.setHeight(obrh);
var items = this.contextLayout.attr("items");
items[1].left = regionSize;
items[2].top = this._getFreezeHeaderHeight();
items[3].left = regionSize;
items[3].top = this._getFreezeHeaderHeight();
this.contextLayout.attr("items", items);
this.contextLayout.resize();
var leftHeader = [], rightHeader = [], leftItems = [], rightItems = [];
var run = function (positions, items, rendered) {
BI.each(positions, function (i, item) {
var cell = {
type: "bi.collection_table_cell",
cell: items[item.row][item.col]
};
rendered.push(cell);
});
};
run(this.topLeftItems, o.header, leftHeader);
run(this.topRightItems, o.header, rightHeader);
run(this.bottomLeftItems, this._getActualItems(), leftItems);
run(this.bottomRightItems, this._getActualItems(), rightItems);
this.topLeftCollection.populate(leftHeader);
this.topRightCollection.populate(rightHeader);
this.bottomLeftCollection.populate(leftItems);
this.bottomRightCollection.populate(rightItems);
}
});
BI.shortcut("bi.quick_collection_table", BI.QuickCollectionTable);

59
src/base/table/table.grid.cell.js

@ -1,59 +0,0 @@
/**
*
* 表格单元格
*
* Created by GUY on 2016/1/12.
* @class BI.GridTableCell
* @extends BI.Widget
*/
BI.GridTableCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.GridTableCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-grid-table-cell bi-border-right bi-border-bottom",
width: 0,
height: 0,
_rowIndex: 0,
_columnIndex: 0,
_left: 0,
_top: 0,
cell: {}
});
},
_init: function () {
BI.GridTableCell.superclass._init.apply(this, arguments);
var o = this.options;
this.cell = BI.createWidget(BI.extend({
type: "bi.label"
}, o.cell, {
cls: (o.cell.cls || "") + "grid-table-cell-wrapper",
width: o.width - (o._columnIndex === 0 ? 1 : 0) - 1,
height: o.height - (o._rowIndex === 0 ? 1 : 0) - 1
}));
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.cell,
left: 0,
right: 0,
top: 0,
bottom: 0
}]
});
},
setWidth: function (width) {
BI.GridTableCell.superclass.setWidth.apply(this, arguments);
var o = this.options;
this.cell.setWidth(o.width - (o._columnIndex === 0 ? 1 : 0) - 1);
},
setHeight: function (height) {
BI.GridTableCell.superclass.setHeight.apply(this, arguments);
var o = this.options;
this.cell.setHeight(o.height - (o._rowIndex === 0 ? 1 : 0) - 1);
}
});
BI.shortcut("bi.grid_table_cell", BI.GridTableCell);

488
src/base/table/table.grid.js

@ -1,488 +0,0 @@
/**
* GridTable
*
* Created by GUY on 2016/1/12.
* @class BI.GridTable
* @extends BI.Widget
*/
BI.GridTable = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.GridTable.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-grid-table",
headerRowSize: 25,
rowSize: 25,
columnSize: [],
isNeedFreeze: false,
freezeCols: [],
header: [],
items: [],
regionColumnSize: []
});
},
render: function () {
var self = this, o = this.options;
this._width = 0;
this._height = 0;
this._scrollBarSize = BI.DOM.getScrollWidth();
var rowHeightGetter = function () {
return o.rowSize;
};
var columnLeftWidthGetter = function (index) {
return o.columnSize[index];
};
var columnRightWidthGetter = function (index) {
return o.columnSize[index + self._getFreezeColLength()];
};
this.topLeftGrid = BI.createWidget({
type: "bi.grid_view",
rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnLeftWidthGetter
});
this.topLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomLeftGrid.setScrollLeft(scroll.scrollLeft);
self._populateScrollbar();
self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments);
});
this.topRightGrid = BI.createWidget({
type: "bi.grid_view",
rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnRightWidthGetter
});
this.topRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomRightGrid.setScrollLeft(scroll.scrollLeft);
self._populateScrollbar();
self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments);
});
this.bottomLeftGrid = BI.createWidget({
type: "bi.grid_view",
rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnLeftWidthGetter
});
this.bottomLeftGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomRightGrid.setScrollTop(scroll.scrollTop);
self.topLeftGrid.setScrollLeft(scroll.scrollLeft);
self._populateScrollbar();
self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments);
});
this.bottomRightGrid = BI.createWidget({
type: "bi.grid_view",
rowHeightGetter: rowHeightGetter,
columnWidthGetter: columnRightWidthGetter
});
this.bottomRightGrid.on(BI.GridView.EVENT_SCROLL, function (scroll) {
self.bottomLeftGrid.setScrollTop(scroll.scrollTop);
self.topRightGrid.setScrollLeft(scroll.scrollLeft);
self._populateScrollbar();
self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments);
});
this.topLeft = BI.createWidget({
type: "bi.vertical",
scrollable: false,
scrolly: false,
items: [this.topLeftGrid]
});
this.topRight = BI.createWidget({
type: "bi.vertical",
scrollable: false,
scrolly: false,
items: [this.topRightGrid]
});
this.bottomLeft = BI.createWidget({
type: "bi.vertical",
scrollable: false,
scrolly: false,
items: [this.bottomLeftGrid]
});
this.bottomRight = BI.createWidget({
type: "bi.vertical",
scrollable: false,
scrolly: false,
items: [this.bottomRightGrid]
});
this.contextLayout = BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.topLeft,
top: 0,
left: 0
}, {
el: this.topRight,
top: 0
}, {
el: this.bottomLeft,
left: 0
}, {
el: this.bottomRight
}]
});
this.topScrollbar = BI.createWidget({
type: "bi.grid_table_scrollbar",
width: BI.GridTableScrollbar.SIZE
});
this.topScrollbar.on(BI.GridTableScrollbar.EVENT_SCROLL, function (scrollTop) {
self.bottomLeftGrid.setScrollTop(scrollTop);
self.bottomRightGrid.setScrollTop(scrollTop);
self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments);
});
this.leftScrollbar = BI.createWidget({
type: "bi.grid_table_horizontal_scrollbar",
height: BI.GridTableScrollbar.SIZE
});
this.leftScrollbar.on(BI.GridTableHorizontalScrollbar.EVENT_SCROLL, function (scrollLeft) {
self.topLeftGrid.setScrollLeft(scrollLeft);
self.bottomLeftGrid.setScrollLeft(scrollLeft);
self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments);
});
this.rightScrollbar = BI.createWidget({
type: "bi.grid_table_horizontal_scrollbar",
height: BI.GridTableScrollbar.SIZE
});
this.rightScrollbar.on(BI.GridTableHorizontalScrollbar.EVENT_SCROLL, function (scrollLeft) {
self.topRightGrid.setScrollLeft(scrollLeft);
self.bottomRightGrid.setScrollLeft(scrollLeft);
self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments);
});
this.scrollBarLayout = BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.topScrollbar,
right: 0,
top: 0
}, {
el: this.leftScrollbar,
left: 0
}, {
el: this.rightScrollbar
}]
});
this._width = o.width - BI.GridTableScrollbar.SIZE;
this._height = o.height - BI.GridTableScrollbar.SIZE;
this.header = this._getHeader();
this.items = this._getItems();
},
mounted: function () {
var o = this.options;
if (o.items.length > 0 || o.header.length > 0) {
this._populate();
}
},
_getFreezeColLength: function () {
var o = this.options;
return o.isNeedFreeze === true ? BI.clamp(o.freezeCols.length, 0, o.columnSize.length) : 0;
},
_getFreezeHeaderHeight: function () {
var o = this.options;
if (o.header.length * o.headerRowSize >= this._height) {
return 0;
}
return o.header.length * o.headerRowSize;
},
_getActualItems: function () {
var o = this.options;
if (o.header.length * o.headerRowSize >= this._height) {
return o.header.concat(o.items);
}
return o.items;
},
_populateScrollbar: function () {
var o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [];
BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
totalLeftColumnSize += size;
} else {
totalRightColumnSize += size;
}
totalColumnSize += size;
if (i === 0) {
summaryColumnSizeArray[i] = size;
} else {
summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size;
}
});
this.topScrollbar.setContentSize(this._getActualItems().length * o.rowSize);
this.topScrollbar.setSize(this._height - this._getFreezeHeaderHeight());
this.topScrollbar.setPosition(Math.min(this.bottomLeftGrid.getScrollTop(), this.bottomRightGrid.getScrollTop()));
this.topScrollbar.populate();
this.leftScrollbar.setContentSize(totalLeftColumnSize);
this.leftScrollbar.setSize(regionSize);
this.leftScrollbar.setPosition(this.bottomLeftGrid.getScrollLeft());
this.leftScrollbar.populate();
this.rightScrollbar.setContentSize(totalRightColumnSize);
this.rightScrollbar.setSize(this._width - regionSize);
this.rightScrollbar.setPosition(this.bottomRightGrid.getScrollLeft());
this.rightScrollbar.populate();
var items = this.scrollBarLayout.attr("items");
items[0].top = this._getFreezeHeaderHeight();
items[1].top = this._height;
items[2].top = this._height;
items[2].left = regionSize;
this.scrollBarLayout.attr("items", items);
this.scrollBarLayout.resize();
},
_getHeader: function () {
var o = this.options;
var freezeColLength = this._getFreezeColLength();
var leftHeader = [], rightHeader = [];
BI.each(o.header, function (i, cols) {
leftHeader[i] = [];
rightHeader[i] = [];
BI.each(cols, function (j, col) {
var cell = {
type: "bi.grid_table_cell",
cell: col
};
if (j < freezeColLength) {
leftHeader[i].push(cell);
} else {
rightHeader[i].push(cell);
}
});
});
return [leftHeader, rightHeader];
},
_getItems: function () {
var o = this.options;
var freezeColLength = this._getFreezeColLength();
var leftItems = [], rightItems = [];
BI.each(this._getActualItems(), function (i, cols) {
leftItems[i] = [];
rightItems[i] = [];
BI.each(cols, function (j, col) {
var cell = {
type: "bi.grid_table_cell",
cell: col
};
if (j < freezeColLength) {
leftItems[i].push(cell);
} else {
rightItems[i].push(cell);
}
});
});
return [leftItems, rightItems];
},
_populateTable: function () {
var self = this, o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [];
var freezeColLength = this._getFreezeColLength();
BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
totalLeftColumnSize += size;
} else {
totalRightColumnSize += size;
}
totalColumnSize += size;
if (i === 0) {
summaryColumnSizeArray[i] = size;
} else {
summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size;
}
});
var otlw = regionSize;
var otlh = this._getFreezeHeaderHeight();
var otrw = this._width - regionSize;
var otrh = this._getFreezeHeaderHeight();
var oblw = regionSize;
var oblh = this._height - otlh;
var obrw = this._width - regionSize;
var obrh = this._height - otrh;
var tlw = otlw + this._scrollBarSize;
var tlh = otlh + this._scrollBarSize;
var trw = otrw + this._scrollBarSize;
var trh = otrh + this._scrollBarSize;
var blw = oblw + this._scrollBarSize;
var blh = oblh + this._scrollBarSize;
var brw = obrw + this._scrollBarSize;
var brh = obrh + this._scrollBarSize;
var digest = function (el) {
el.element.css({
overflow: "scroll",
overflowX: "scroll",
overflowY: "scroll"
});
};
this.topLeft.setWidth(otlw);
this.topLeft.setHeight(otlh);
this.topRight.setWidth(otrw);
this.topRight.setHeight(otrh);
this.bottomLeft.setWidth(oblw);
this.bottomLeft.setHeight(oblh);
this.bottomRight.setWidth(obrw);
this.bottomRight.setHeight(obrh);
this.topLeftGrid.setWidth(tlw);
this.topLeftGrid.setHeight(tlh);
this.topRightGrid.setWidth(trw);
this.topRightGrid.setHeight(trh);
this.bottomLeftGrid.setWidth(blw);
this.bottomLeftGrid.setHeight(blh);
this.bottomRightGrid.setWidth(brw);
this.bottomRightGrid.setHeight(brh);
digest(this.topLeftGrid);
digest(this.topRightGrid);
digest(this.bottomLeftGrid);
digest(this.bottomRightGrid);
this.topLeftGrid.setEstimatedColumnSize(freezeColLength > 0 ? totalLeftColumnSize / freezeColLength : 0);
this.topLeftGrid.setEstimatedRowSize(o.headerRowSize);
this.topRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0);
this.topRightGrid.setEstimatedRowSize(o.headerRowSize);
this.bottomLeftGrid.setEstimatedColumnSize(freezeColLength > 0 ? totalLeftColumnSize / freezeColLength : 0);
this.bottomLeftGrid.setEstimatedRowSize(o.rowSize);
this.bottomRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0);
this.bottomRightGrid.setEstimatedRowSize(o.rowSize);
this.topLeftGrid.setColumnCount(freezeColLength);
this.topRightGrid.setColumnCount(o.columnSize.length - freezeColLength);
this.bottomLeftGrid.setColumnCount(freezeColLength);
this.bottomRightGrid.setColumnCount(o.columnSize.length - freezeColLength);
var items = this.contextLayout.attr("items");
items[1].left = regionSize;
items[2].top = this._getFreezeHeaderHeight();
items[3].left = regionSize;
items[3].top = this._getFreezeHeaderHeight();
this.contextLayout.attr("items", items);
this.contextLayout.resize();
this.topLeftGrid._populate(this.header[0]);
this.topRightGrid._populate(this.header[1]);
this.bottomLeftGrid._populate(this.items[0]);
this.bottomRightGrid._populate(this.items[1]);
},
_populate: function () {
if (this._width <= 0 || this._height <= 0) {
return;
}
this._populateTable();
this._populateScrollbar();
},
getRegionSize: function () {
var o = this.options;
var regionSize = o.regionColumnSize[0] || 0;
if (o.isNeedFreeze === false || o.freezeCols.length === 0) {
return 0;
}
if (!regionSize) {
BI.each(o.freezeCols, function (i, col) {
regionSize += o.columnSize[col];
});
}
return regionSize;
},
setVerticalScroll: function (scrollTop) {
this.bottomLeftGrid.setScrollTop(scrollTop);
this.bottomRightGrid.setScrollTop(scrollTop);
this._populateScrollbar();
},
setLeftHorizontalScroll: function (scrollLeft) {
this.topLeftGrid.setScrollLeft(scrollLeft);
this.bottomLeftGrid.setScrollLeft(scrollLeft);
this._populateScrollbar();
},
setRightHorizontalScroll: function (scrollLeft) {
this.topRightGrid.setScrollLeft(scrollLeft);
this.bottomRightGrid.setScrollLeft(scrollLeft);
this._populateScrollbar();
},
getVerticalScroll: function () {
return this.bottomRightGrid.getScrollTop();
},
getLeftHorizontalScroll: function () {
return this.bottomLeftGrid.getScrollLeft();
},
getRightHorizontalScroll: function () {
return this.bottomRightGrid.getScrollLeft();
},
setWidth: function (width) {
BI.GridTable.superclass.setWidth.apply(this, arguments);
this._width = this.options.width - BI.GridTableScrollbar.SIZE;
},
setHeight: function (height) {
BI.GridTable.superclass.setHeight.apply(this, arguments);
this._height = this.options.height - BI.GridTableScrollbar.SIZE;
},
setColumnSize: function (columnSize) {
this.options.columnSize = columnSize;
this._isNeedDigest = true;
},
setRegionColumnSize: function (regionColumnSize) {
this.options.regionColumnSize = regionColumnSize;
this._isNeedDigest = true;
},
getColumnSize: function () {
return this.options.columnSize;
},
getRegionColumnSize: function () {
return this.options.regionColumnSize;
},
populate: function (items, header) {
var headerChanged = this.options.header !== header;
var itemsChanged = this.options.items !== items;
if(header && headerChanged) {
this.options.header = header;
}
if(items && itemsChanged) {
this.options.items = items;
}
if (items && itemsChanged) {
this.items = this._getItems();
this._restore();
}
if (header && headerChanged) {
this.header = this._getHeader();
this._restore();
}
this._populate();
},
_restore: function () {
this.topLeftGrid.restore();
this.topRightGrid.restore();
this.bottomLeftGrid.restore();
this.bottomRightGrid.restore();
},
restore: function () {
this._restore();
}
});
BI.shortcut("bi.grid_table", BI.GridTable);

223
src/base/table/table.grid.quick.js

@ -1,223 +0,0 @@
/**
* QuickGridTable
*
* Created by GUY on 2016/1/12.
* @class BI.QuickGridTable
* @extends BI.GridTable
*/
BI.QuickGridTable = BI.inherit(BI.GridTable, {
_defaultConfig: function () {
return BI.extend(BI.QuickGridTable.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-quick-grid-table"
});
},
render: function () {
BI.QuickGridTable.superclass.render.apply(this, arguments);
var self = this, o = this.options;
this.topLeftGrid.setOverflowX(false);
this.topLeftGrid.setOverflowY(false);
this.topRightGrid.setOverflowX(false);
this.topRightGrid.setOverflowY(false);
this.bottomLeftGrid.setOverflowX(false);
this.bottomLeftGrid.setOverflowY(false);
this.bottomRightGrid.setOverflowX(false);
this.bottomRightGrid.setOverflowY(false);
},
mounted: function () {
BI.QuickGridTable.superclass.mounted.apply(this, arguments);
var self = this;
this._topLeftWheelHandler = new BI.WheelHandler(
BI.bind(this._onWheelLeft, this),
BI.bind(this._shouldHandleLeftX, this),
BI.bind(this._shouldHandleY, this)
);
this._topRightWheelHandler = new BI.WheelHandler(
BI.bind(this._onWheelRight, this),
BI.bind(this._shouldHandleRightX, this),
BI.bind(this._shouldHandleY, this)
);
this._bottomLeftWheelHandler = new BI.WheelHandler(
BI.bind(this._onWheelLeft, this),
BI.bind(this._shouldHandleLeftX, this),
BI.bind(this._shouldHandleY, this)
);
this._bottomRightWheelHandler = new BI.WheelHandler(
BI.bind(this._onWheelRight, this),
BI.bind(this._shouldHandleRightX, this),
BI.bind(this._shouldHandleY, this)
);
this.topLeftGrid.element.mousewheel(function (e) {
self._topLeftWheelHandler.onWheel(e.originalEvent);
});
this.topRightGrid.element.mousewheel(function (e) {
self._topRightWheelHandler.onWheel(e.originalEvent);
});
this.bottomLeftGrid.element.mousewheel(function (e) {
self._bottomLeftWheelHandler.onWheel(e.originalEvent);
});
this.bottomRightGrid.element.mousewheel(function (e) {
self._bottomRightWheelHandler.onWheel(e.originalEvent);
});
},
_shouldHandleLeftX: function (delta) {
if (delta > 0) {
return this.bottomLeftGrid.getScrollLeft() < this.bottomLeftGrid.getMaxScrollLeft();
}
return this.bottomLeftGrid.getScrollLeft() > 0;
},
_shouldHandleRightX: function (delta) {
if (delta > 0) {
return this.bottomRightGrid.getScrollLeft() < this.bottomRightGrid.getMaxScrollLeft();
}
return this.bottomRightGrid.getScrollLeft() > 0;
},
_shouldHandleY: function (delta) {
if (delta > 0) {
return this.bottomRightGrid.getScrollTop() < this.bottomRightGrid.getMaxScrollTop();
}
return this.bottomRightGrid.getScrollTop() > 0;
},
_onWheelLeft: function (deltaX, deltaY) {
var self = this;
var scrollTop = this.bottomLeftGrid.getScrollTop();
var scrollLeft = this.bottomLeftGrid.getScrollLeft();
scrollTop += deltaY;
scrollLeft += deltaX;
this.bottomLeftGrid.setScrollTop(scrollTop);
this.bottomRightGrid.setScrollTop(scrollTop);
this.topLeftGrid.setScrollLeft(scrollLeft);
this.bottomLeftGrid.setScrollLeft(scrollLeft);
self._populateScrollbar();
this.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments);
},
_onWheelRight: function (deltaX, deltaY) {
var self = this;
var scrollTop = this.bottomRightGrid.getScrollTop();
var scrollLeft = this.bottomRightGrid.getScrollLeft();
scrollTop += deltaY;
scrollLeft += deltaX;
this.bottomLeftGrid.setScrollTop(scrollTop);
this.bottomRightGrid.setScrollTop(scrollTop);
this.topRightGrid.setScrollLeft(scrollLeft);
this.bottomRightGrid.setScrollLeft(scrollLeft);
self._populateScrollbar();
this.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments);
},
_populateTable: function () {
var self = this, o = this.options;
var regionSize = this.getRegionSize(), totalLeftColumnSize = 0, totalRightColumnSize = 0, totalColumnSize = 0,
summaryColumnSizeArray = [];
var freezeColLength = this._getFreezeColLength();
BI.each(o.columnSize, function (i, size) {
if (o.isNeedFreeze === true && o.freezeCols.contains(i)) {
totalLeftColumnSize += size;
} else {
totalRightColumnSize += size;
}
totalColumnSize += size;
if (i === 0) {
summaryColumnSizeArray[i] = size;
} else {
summaryColumnSizeArray[i] = summaryColumnSizeArray[i - 1] + size;
}
});
var otlw = regionSize;
var otlh = this._getFreezeHeaderHeight();
var otrw = this._width - regionSize;
var otrh = this._getFreezeHeaderHeight();
var oblw = regionSize;
var oblh = this._height - otlh;
var obrw = this._width - regionSize;
var obrh = this._height - otrh;
this.topLeft.setWidth(otlw);
this.topLeft.setHeight(otlh);
this.topRight.setWidth(otrw);
this.topRight.setHeight(otrh);
this.bottomLeft.setWidth(oblw);
this.bottomLeft.setHeight(oblh);
this.bottomRight.setWidth(obrw);
this.bottomRight.setHeight(obrh);
this.topLeftGrid.setWidth(otlw);
this.topLeftGrid.setHeight(otlh);
this.topRightGrid.setWidth(otrw);
this.topRightGrid.setHeight(otrh);
this.bottomLeftGrid.setWidth(oblw);
this.bottomLeftGrid.setHeight(oblh);
this.bottomRightGrid.setWidth(obrw);
this.bottomRightGrid.setHeight(obrh);
this.topLeftGrid.setEstimatedColumnSize(freezeColLength > 0 ? totalLeftColumnSize / freezeColLength : 0);
this.topLeftGrid.setEstimatedRowSize(o.headerRowSize);
this.topRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0);
this.topRightGrid.setEstimatedRowSize(o.headerRowSize);
this.bottomLeftGrid.setEstimatedColumnSize(freezeColLength > 0 ? totalLeftColumnSize / freezeColLength : 0);
this.bottomLeftGrid.setEstimatedRowSize(o.rowSize);
this.bottomRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0);
this.bottomRightGrid.setEstimatedRowSize(o.rowSize);
this.topLeftGrid.setColumnCount(freezeColLength);
this.topRightGrid.setColumnCount(o.columnSize.length - freezeColLength);
this.bottomLeftGrid.setColumnCount(freezeColLength);
this.bottomRightGrid.setColumnCount(o.columnSize.length - freezeColLength);
var items = this.contextLayout.attr("items");
items[1].left = regionSize;
items[2].top = this._getFreezeHeaderHeight();
items[3].left = regionSize;
items[3].top = this._getFreezeHeaderHeight();
this.contextLayout.attr("items", items);
this.contextLayout.resize();
var leftHeader = [], rightHeader = [], leftItems = [], rightItems = [];
BI.each(o.header, function (i, cols) {
leftHeader[i] = [];
rightHeader[i] = [];
BI.each(cols, function (j, col) {
var cell = {
type: "bi.grid_table_cell",
cell: col
};
if (j < freezeColLength) {
leftHeader[i].push(cell);
} else {
rightHeader[i].push(cell);
}
});
});
BI.each(this._getActualItems(), function (i, cols) {
leftItems[i] = [];
rightItems[i] = [];
BI.each(cols, function (j, col) {
var cell = {
type: "bi.grid_table_cell",
cell: col
};
if (j < freezeColLength) {
leftItems[i].push(cell);
} else {
rightItems[i].push(cell);
}
});
});
this.topLeftGrid.populate(leftHeader);
this.topRightGrid.populate(rightHeader);
this.bottomLeftGrid.populate(leftItems);
this.bottomRightGrid.populate(rightItems);
}
});
BI.shortcut("bi.quick_grid_table", BI.QuickGridTable);

420
src/base/table/table.grid.scrollbar.js

@ -1,420 +0,0 @@
/**
*
* 表格滚动条
*
* Created by GUY on 2016/1/12.
* @class BI.GridTableScrollbar
* @extends BI.Widget
*/
BI.GridTableScrollbar = BI.inherit(BI.Widget, {
_const: {
FACE_MARGIN: 4,
FACE_MARGIN_2: 4 * 2,
FACE_SIZE_MIN: 30,
KEYBOARD_SCROLL_AMOUNT: 40
},
_defaultConfig: function () {
return BI.extend(BI.GridTableScrollbar.superclass._defaultConfig.apply(this, arguments), {
baseCls: "scrollbar-layout-main public-scrollbar-main",
attributes: {
tabIndex: 0
},
contentSize: 0,
defaultPosition: 0,
isOpaque: false,
orientation: "vertical",
position: 0,
size: 0
});
},
render: function () {
var self = this, o = this.options;
this.focused = false;
this.isDragging = false;
this.face = BI.createWidget({
type: "bi.layout",
cls: "scrollbar-layout-face public-scrollbar-face "
+ (this._isHorizontal() ? "scrollbar-layout-face-horizontal" : "scrollbar-layout-face-vertical")
});
this.contextLayout = BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.face,
left: 0,
top: 0
}]
});
},
mounted: function () {
var self = this, o = this.options;
var onWheel = o.orientation === "horizontal" ? this._onWheelX : this._onWheelY;
this._wheelHandler = new BI.WheelHandler(
BI.bind(onWheel, this),
BI.bind(this._shouldHandleX, this),
BI.bind(this._shouldHandleY, this)
);
this._mouseMoveTracker = new BI.MouseMoveTracker(
BI.bind(this._onMouseMove, this),
BI.bind(this._onMouseMoveEnd, this),
document
);
this.element.on("mousedown", BI.bind(this._onMouseDown, this));
this.element.on("mousewheel", function (e) {
self._wheelHandler.onWheel(e.originalEvent);
});
this.element.on("keydown", BI.bind(this._onKeyDown, this));
this.element.on("focus", function () {
self.focused = true;
self._populate();
});
this.element.on("blur", function () {
self.focused = false;
self._populate();
});
if (this._isHorizontal()) {
this.element.addClass("scrollbar-layout-main-horizontal");
} else {
this.element.addClass("scrollbar-layout-main-vertical");
}
this._populate();
},
_isHorizontal: function () {
return this.options.orientation === "horizontal";
},
_getScale: function () {
var o = this.options;
var scale = o.size / o.contentSize;
var faceSize = o.size * scale;
if (faceSize < this._const.FACE_SIZE_MIN) {
scale = (o.size - this._const.FACE_SIZE_MIN) / (o.contentSize - o.size);
}
return scale;
},
_getFaceSize: function () {
var o = this.options;
var scale = o.size / o.contentSize;
var faceSize = o.size * scale;
if (faceSize < this._const.FACE_SIZE_MIN) {
faceSize = this._const.FACE_SIZE_MIN;
}
return faceSize;
},
_shouldHandleX: function (delta) {
return this.options.orientation === "horizontal" ?
this._shouldHandleChange(delta) :
false;
},
_shouldHandleY: function (delta) {
return this.options.orientation !== "horizontal" ?
this._shouldHandleChange(delta) :
false;
},
_shouldHandleChange: function (delta) {
return this.options.position + delta !== this.options.position;
},
_onWheelY: function (deltaX, deltaY) {
this._onWheel(deltaY);
},
_onWheelX: function (deltaX, deltaY) {
this._onWheel(deltaX);
},
_onWheel: function (delta) {
var maxPosition = this.options.contentSize - this.options.size;
this.options.position += delta;
if (this.options.position < 0) {
this.options.position = 0;
} else if (this.options.position > maxPosition) {
this.options.position = maxPosition;
}
this._populate();
this.fireEvent(BI.GridTableScrollbar.EVENT_SCROLL, this.options.position);
},
_onMouseDown: function (e) {
if (e.target !== this.face.element[0]) {
var position = this._isHorizontal() ? e.offsetX : e.offsetY;
position /= this._getScale();
this.options.position = BI.clamp(position - (this._getFaceSize() * 0.5 / this._getScale()), 0, this.options.contentSize - this.options.size);
this._populate();
this.fireEvent(BI.GridTableScrollbar.EVENT_SCROLL, this.options.position);
} else {
this._mouseMoveTracker.captureMouseMoves(e);
}
try {
this.element[0].focus();
} catch (e) {
}
},
_onMouseMove: function (deltaX, deltaY) {
var delta = this._isHorizontal() ? deltaX : deltaY;
delta /= this._getScale();
this.options.position = BI.clamp(this.options.position + delta, 0, this.options.contentSize - this.options.size);
this.isDragging = this._mouseMoveTracker.isDragging();
this._populate();
this.fireEvent(BI.GridTableScrollbar.EVENT_SCROLL, this.options.position);
},
_onMouseMoveEnd: function (event) {
this._mouseMoveTracker.releaseMouseMoves();
if (this.isDragging === true) {
this.isDragging = false;
this._populate();
}
},
_onKeyDown: function (event) {
var Keys = {
BACKSPACE: 8,
TAB: 9,
RETURN: 13,
ALT: 18,
ESC: 27,
SPACE: 32,
PAGE_UP: 33,
PAGE_DOWN: 34,
END: 35,
HOME: 36,
LEFT: 37,
UP: 38,
RIGHT: 39,
DOWN: 40,
DELETE: 46,
COMMA: 188,
PERIOD: 190,
A: 65,
Z: 90,
ZERO: 48,
NUMPAD_0: 96,
NUMPAD_9: 105
};
var keyCode = event.keyCode;
if (keyCode === Keys.TAB) {
return;
}
var distance = 40;
var direction = 0;
if (this._isHorizontal()) {
switch (keyCode) {
case Keys.HOME:
direction = -1;
distance = this.options.contentSize;
break;
case Keys.LEFT:
direction = -1;
break;
case Keys.RIGHT:
direction = 1;
break;
default:
return;
}
}
if (!this._isHorizontal()) {
switch (keyCode) {
case Keys.SPACE:
if (event.shiftKey) {
direction = -1;
} else {
direction = 1;
}
break;
case Keys.HOME:
direction = -1;
distance = this.options.contentSize;
break;
case Keys.UP:
direction = -1;
break;
case Keys.DOWN:
direction = 1;
break;
case Keys.PAGE_UP:
direction = -1;
distance = this.options.size;
break;
case Keys.PAGE_DOWN:
direction = 1;
distance = this.options.size;
break;
default:
return;
}
}
this.options.position = BI.clamp(this.options.position + (distance * direction), 0, this.options.contentSize - this.options.size);
event.preventDefault();
this._populate();
this.fireEvent(BI.GridTableScrollbar.EVENT_SCROLL, this.options.position);
},
_populate: function () {
var self = this, o = this.options;
if (o.size < 1 || o.contentSize <= o.size) {
this.setVisible(false);
return;
}
this.setVisible(true);
var size = o.size;
var isHorizontal = this._isHorizontal();
var isActive = this.focused || this.isDragging;
var faceSize = this._getFaceSize();
var isOpaque = o.isOpaque;
this.element[isOpaque === true ? "addClass" : "removeClass"]("public-scrollbar-main-opaque");
this.element[isActive === true ? "addClass" : "removeClass"]("public-scrollbar-main-active");
this.face.element[isActive === true ? "addClass" : "removeClass"]("public-scrollbar-face-active");
var position = o.position * this._getScale() + this._const.FACE_MARGIN;
var items = this.contextLayout.attr("items");
if (isHorizontal) {
this.setWidth(size);
this.face.setWidth(faceSize - this._const.FACE_MARGIN_2);
items[0].left = position;
items[0].top = 0;
} else {
this.setHeight(size);
this.face.setHeight(faceSize - this._const.FACE_MARGIN_2);
items[0].left = 0;
items[0].top = position;
}
this.contextLayout.attr("items", items);
this.contextLayout.resize();
},
setContentSize: function (contentSize) {
this.options.contentSize = contentSize;
},
setPosition: function (position) {
this.options.position = position;
},
setSize: function (size) {
this.options.size = size;
},
populate: function () {
this._populate();
}
});
BI.GridTableScrollbar.SIZE = 10;
BI.GridTableScrollbar.EVENT_SCROLL = "EVENT_SCROLL";
BI.shortcut("bi.grid_table_scrollbar", BI.GridTableScrollbar);
BI.GridTableHorizontalScrollbar = BI.inherit(BI.Widget, {
_const: {
FACE_MARGIN: 4,
FACE_MARGIN_2: 4 * 2,
FACE_SIZE_MIN: 30,
KEYBOARD_SCROLL_AMOUNT: 40
},
_defaultConfig: function () {
return BI.extend(BI.GridTableHorizontalScrollbar.superclass._defaultConfig.apply(this, arguments), {
attributes: {
tabIndex: 0
},
contentSize: 0,
position: 0,
size: 0
});
},
_init: function () {
BI.GridTableHorizontalScrollbar.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.scrollbar = BI.createWidget({
type: "bi.grid_table_scrollbar",
orientation: "horizontal",
isOpaque: true,
position: o.position,
contentSize: o.contentSize,
size: o.size
});
this.scrollbar.on(BI.GridTableScrollbar.EVENT_SCROLL, function () {
self.fireEvent(BI.GridTableHorizontalScrollbar.EVENT_SCROLL, arguments);
});
BI.createWidget({
type: "bi.absolute",
cls: "horizontal-scrollbar",
element: this,
width: o.size,
height: BI.GridTableScrollbar.SIZE,
items: [{
el: {
type: "bi.absolute",
scrollable: false,
height: BI.GridTableScrollbar.SIZE,
items: [{
el: this.scrollbar,
left: 0,
top: 0
}]
},
top: 0,
left: 0,
right: 0
}]
});
},
setContentSize: function (contentSize) {
this.options.contentSize = contentSize;
this.scrollbar.setContentSize(contentSize);
},
setPosition: function (position) {
this.options.position = position;
this.scrollbar.setPosition(position);
},
setSize: function (size) {
this.setWidth(size);
this.options.size = size;
this.scrollbar.setSize(size);
},
populate: function () {
this.scrollbar.populate();
var o = this.options;
if (o.size < 1 || o.contentSize <= o.size) {
this.setVisible(false);
return;
}
this.setVisible(true);
}
});
BI.GridTableHorizontalScrollbar.EVENT_SCROLL = "EVENT_SCROLL";
BI.shortcut("bi.grid_table_horizontal_scrollbar", BI.GridTableHorizontalScrollbar);

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

@ -1,34 +0,0 @@
/**
*
* 表格
*
* 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);

1618
src/base/table/table.js

File diff suppressed because it is too large Load Diff

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

@ -1,115 +0,0 @@
/**
*
* 表格单元格
*
* Created by GUY on 2016/1/12.
* @class BI.ResizableTableCell
* @extends BI.Widget
*/
BI.ResizableTableCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.ResizableTableCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-resizable-table-cell",
cell: {},
minSize: 15,
// suitableSize,
maxSize: Number.MAX_VALUE,
start: BI.emptyFn,
resize: BI.emptyFn,
stop: BI.emptyFn
});
},
_init: function () {
BI.ResizableTableCell.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.cell = BI.createWidget(BI.extend({type: "bi.label"}, o.cell, {width: o.width, height: o.height}));
var startDrag = false;
var size = 0, offset = 0, defaultSize = o.width;
function optimizeSize (s) {
var optSize = BI.clamp(s, o.minSize, o.maxSize || Number.MAX_VALUE);
// if (o.suitableSize) {
// if (Math.abs(o.suitableSize - optSize) < 5) {
// optSize = o.suitableSize;
// self.handler.element.addClass("suitable");
// } else {
// self.handler.element.removeClass("suitable");
// }
// }
return optSize;
}
var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX, deltaY) {
if (mouseMoveTracker.isDragging()) {
startDrag = true;
offset += deltaX;
size = optimizeSize(defaultSize + offset);
self.handler.element.addClass("dragging");
o.resize(size);
}
}, function () {
if (startDrag === true) {
size = optimizeSize(size);
o.stop(size);
size = 0;
offset = 0;
defaultSize = o.width;
startDrag = false;
}
self.handler.element.removeClass("dragging");
self.handler.element.removeClass("suitable");
mouseMoveTracker.releaseMouseMoves();
}, document);
this.handler = BI.createWidget({
type: "bi.absolute",
cls: "resizable-table-cell-resizer-container",
width: 6,
items: [{
el: {
type: "bi.layout",
cls: "resizable-table-cell-resizer-knob",
width: 4
},
right: 0,
top: 0,
bottom: 0
}]
});
this.handler.element.on("mousedown", function (event) {
defaultSize = o.width;
optimizeSize(defaultSize);
mouseMoveTracker.captureMouseMoves(event);
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.cell,
left: 0,
right: 0,
top: 0,
bottom: 0
}, {
el: this.handler,
right: 0,
top: 0,
bottom: 0
}]
});
},
setWidth: function (width) {
BI.ResizableTableCell.superclass.setWidth.apply(this, arguments);
var o = this.options;
this.cell.setWidth(o.width);
},
setHeight: function (height) {
BI.ResizableTableCell.superclass.setHeight.apply(this, arguments);
var o = this.options;
this.cell.setHeight(o.height);
}
});
BI.shortcut("bi.resizable_table_cell", BI.ResizableTableCell);

365
src/base/table/table.resizable.js

@ -1,365 +0,0 @@
/**
*
* 可调整列宽的grid表格
*
* Created by GUY on 2016/1/12.
* @class BI.ResizableTable
* @extends BI.Widget
*/
BI.ResizableTable = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.ResizableTable.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-resizable-table",
el: {
type: "bi.grid_table"
},
isNeedFreeze: false,
isNeedResize: true,
isResizeAdapt: false,
headerRowSize: 25,
rowSize: 25,
isNeedMerge: true, // 是否需要合并单元格
mergeCols: [],
mergeRule: BI.emptyFn,
columnSize: [],
minColumnSize: [],
maxColumnSize: [],
freezeCols: [],
header: [],
items: [],
regionColumnSize: []
});
},
_init: function () {
BI.ResizableTable.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.resizer = BI.createWidget({
type: "bi.layout",
cls: "resizable-table-resizer",
invisible: true,
width: 2
});
this.regionResizerHandler = this._createResizerHandler();
this.table = BI.createWidget(o.el, {
type: "bi.grid_table",
element: this,
width: o.width,
height: o.height,
headerRowSize: o.headerRowSize,
rowSize: o.rowSize,
columnSize: o.columnSize,
isNeedFreeze: o.isNeedFreeze,
freezeCols: o.freezeCols,
isNeedMerge: o.isNeedMerge,
mergeCols: o.mergeCols,
mergeRule: BI.bind(this._mergeRule, this),
header: this._formatHeader(o.header),
items: o.items,
regionColumnSize: o.regionColumnSize
});
this.table.on(BI.Table.EVENT_TABLE_SCROLL, function () {
self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments);
});
BI.createWidget({
type: "bi.absolute",
element: this,
items: [{
el: this.regionResizerHandler,
left: 0,
top: 0,
bottom: 0
}, {
el: this.resizer,
left: 0,
top: 0
}]
});
this._populate();
},
_mergeRule: function (row1, row2) {
var o = this.options;
if (row1.type === "bi.resizable_table_cell") {
row1 = row1.cell;
}
if (row2.type === "bi.resizable_table_cell") {
row2 = row2.cell;
}
return o.mergeRule(row1, row2);
},
_createResizerHandler: function () {
var self = this, o = this.options;
var regionResizerHandler = BI.createWidget({
type: "bi.absolute",
cls: "resizable-table-region-resizer",
invisible: true,
width: 6,
items: [{
el: {
type: "bi.layout",
width: 2,
cls: "resizable-table-region-resizer-knob"
},
left: 2,
top: 0,
bottom: 0
}]
});
var size = 0, offset = 0, defaultSize = 0, start = false;
var mouseMoveTracker = new BI.MouseMoveTracker(function (deltaX, deltaY) {
if (mouseMoveTracker.isDragging()) {
start = true;
offset += deltaX;
size = BI.clamp(defaultSize + offset, 30, o.width - 40);
self.regionResizerHandler.element.addClass("dragging");
self._setRegionResizerHandlerPosition(size - 3, 0);
}
}, function () {
if (start === true) {
o.regionColumnSize[0] = BI.clamp(size, 30, o.width - 40);
self.table.setRegionColumnSize(o.regionColumnSize);
if (o.isResizeAdapt === true) {
var freezeColumnSize = self._getFreezeColumnSize();
o.columnSize[self._getFreezeColLength() - 1] += o.regionColumnSize[0] - freezeColumnSize;
self.table.setColumnSize(o.columnSize);
}
// self.table.populate();
self._populate();
self.regionResizerHandler.element.removeClass("dragging");
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE);
start = false;
}
mouseMoveTracker.releaseMouseMoves();
}, document);
regionResizerHandler.element.on("mousedown", function (event) {
defaultSize = size = self._getRegionSize();
offset = 0;
self._setResizerPosition(0, 0);
mouseMoveTracker.captureMouseMoves(event);
});
return regionResizerHandler;
},
_setResizerPosition: function (left, top) {
this.resizer.element.css({
left: left + "px",
top: top + "px"
});
},
_setRegionResizerHandlerPosition: function (left, top) {
this.regionResizerHandler.element.css({
left: left + "px",
top: top + "px"
});
},
_getRegionSize: function () {
var o = this.options;
var regionSize = o.regionColumnSize[0] || 0;
if (o.isNeedFreeze === false || o.freezeCols.length === 0) {
return 0;
}
if (!regionSize) {
BI.each(o.freezeCols, function (i, col) {
regionSize += o.columnSize[col];
});
}
return regionSize;
},
_getRegionRowSize: function () {
var o = this.options;
return [o.header.length * o.headerRowSize,
Math.min(o.height - o.header.length * o.headerRowSize, o.items.length * o.rowSize)];
},
_getFreezeColLength: function () {
var o = this.options;
return o.isNeedFreeze === true ? BI.clamp(o.freezeCols.length, 0, o.columnSize.length) : 0;
},
_getFreezeColumnSize: function () {
var columnSize = this.options.columnSize;
var sum = 0;
for (var i = 0, len = this._getFreezeColLength(); i < len; i++) {
sum += columnSize[i];
}
return sum;
},
_getResizerLeft: function (j) {
var left = 0;
var columnSize = this.options.columnSize;
var freezeColLength = this._getFreezeColLength();
for (var i = (j >= freezeColLength ? freezeColLength : 0); i < j; i++) {
left += columnSize[i] || 0;
}
if (j >= freezeColLength) {
left += this.table.getRegionSize();
left -= this.table.getRightHorizontalScroll();
} else {
left -= this.table.getLeftHorizontalScroll();
}
return left;
},
_formatHeader: function (header) {
var self = this, o = this.options;
var result = [];
var resize = function (j, size) {
self.resizer.setVisible(true);
var height = o.headerRowSize + self._getRegionRowSize()[1];
self.resizer.setHeight(height);
// TODO 不知道为什么加入这段代码会使得列宽调整出问题
// if (o.minColumnSize[j]) {
// if (size === o.minColumnSize[j]) {
// self.resizer.element.addClass("suitable");
// } else {
// self.resizer.element.removeClass("suitable");
// }
// }
self._setResizerPosition(self._getResizerLeft(j) + size, (o.header.length - 1) * o.headerRowSize);
};
var stop = function (j, size) {
self.resizer.setVisible(false);
var columnSize = o.columnSize.slice();
columnSize[j] = size;
o.columnSize = columnSize;
self.table.setColumnSize(columnSize);
// self.table.populate();
self._populate();
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE);
};
BI.each(header, function (i, cols) {
if (i === header.length - 1) {
result[i] = [];
BI.each(cols, function (j, col) {
if (j === self._getFreezeColLength() - 1 || j === cols.length - 1) {
result[i][j] = col;
} else {
result[i][j] = {
type: "bi.resizable_table_cell",
cell: col,
suitableSize: o.minColumnSize[j],
maxSize: o.maxColumnSize[j],
resize: BI.bind(resize, null, j),
stop: BI.bind(stop, null, j)
};
if (o.isNeedMerge) {
var r = i;
while (r > 0 && self._mergeRule(result[r][j], result[r - 1][j])) {
result[r - 1][j] = {
type: "bi.resizable_table_cell",
cell: result[r - 1][j],
suitableSize: o.minColumnSize[j],
maxSize: o.maxColumnSize[j],
resize: BI.bind(resize, null, j),
stop: BI.bind(stop, null, j)
};
r--;
}
}
}
});
} else {
result.push(cols);
}
});
return result;
},
_populate: function () {
var o = this.options;
var regionSize = this._getRegionSize();
if (regionSize > 0) {
this.regionResizerHandler.setVisible(true);
this._setRegionResizerHandlerPosition(regionSize - 3, 0);
} else {
this.regionResizerHandler.setVisible(false);
}
},
setWidth: function (width) {
BI.ResizableTable.superclass.setWidth.apply(this, arguments);
this.table.setWidth(width);
},
setHeight: function (height) {
BI.ResizableTable.superclass.setHeight.apply(this, arguments);
this.table.setHeight(height);
},
setVerticalScroll: function (scrollTop) {
this.table.setVerticalScroll(scrollTop);
},
setLeftHorizontalScroll: function (scrollLeft) {
this.table.setLeftHorizontalScroll(scrollLeft);
},
setRightHorizontalScroll: function (scrollLeft) {
this.table.setRightHorizontalScroll(scrollLeft);
},
setColumnSize: function (columnSize) {
this.options.columnSize = columnSize;
this.table.setColumnSize(columnSize);
},
getColumnSize: function () {
return this.table.getColumnSize();
},
setRegionColumnSize: function (columnSize) {
this.options.regionColumnSize = columnSize;
this.table.setRegionColumnSize(columnSize);
},
getRegionColumnSize: function () {
return this.table.getRegionColumnSize();
},
getVerticalScroll: function () {
return this.table.getVerticalScroll();
},
getLeftHorizontalScroll: function () {
return this.table.getLeftHorizontalScroll();
},
getRightHorizontalScroll: function () {
return this.table.getRightHorizontalScroll();
},
attr: function () {
BI.ResizableTable.superclass.attr.apply(this, arguments);
this.table.attr.apply(this.table, arguments);
},
restore: function () {
this.table.restore();
},
populate: function (items, header) {
if (items) {
this.options.items = items;
}
if (header) {
this.options.header = header;
if (this.options.isNeedResize) {
header = this._formatHeader(header);
}
}
this.table.populate(items, header);
this._populate();
}
});
BI.shortcut("bi.resizable_table", BI.ResizableTable);

1314
src/case/clipboard/clipboard.js

File diff suppressed because it is too large Load Diff

50
src/case/clipboard/index.js

@ -1,50 +0,0 @@
/**
* 复制
* Created by GUY on 2016/2/16.
* @class BI.ClipBoard
* @extends BI.BasicButton
*/
BI.ClipBoard = BI.inherit(BI.BasicButton, {
_defaultConfig: function () {
return BI.extend(BI.ClipBoard.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-clipboard",
el: {
type: "bi.layout"
},
copy: BI.emptyFn,
afterCopy: BI.emptyFn
});
},
_init: function () {
BI.ClipBoard.superclass._init.apply(this, arguments);
BI.createWidget(this.options.el, {
element: this
});
},
mounted: function () {
var self = this, o = this.options;
if (window.Clipboard) {
this.clipboard = new Clipboard(this.element[0], {
text: function () {
return BI.isFunction(o.copy) ? o.copy() : o.copy;
}
});
this.clipboard.on("success", o.afterCopy);
} else {
this.element.zclip({
path: BI.resourceURL + "/ZeroClipboard.swf",
copy: o.copy,
beforeCopy: o.beforeCopy,
afterCopy: o.afterCopy
});
}
},
destroyed: function () {
this.clipboard && this.clipboard.destroy();
}
});
BI.shortcut("bi.clipboard", BI.ClipBoard);

78
src/case/combo/editoriconcheckcombo/combo.editiconcheck.js

@ -0,0 +1,78 @@
/**
* Created by Young's on 2016/4/28.
*/
BI.EditorIconCheckCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.EditorIconCheckCombo.superclass._defaultConfig.apply(this, arguments), {
baseClass: "bi-check-editor-combo",
width: 100,
height: 24,
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE,
validationChecker: BI.emptyFn,
quitChecker: BI.emptyFn,
allowBlank: true,
watermark: "",
errorText: ""
});
},
_init: function () {
BI.EditorIconCheckCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.trigger = BI.createWidget({
type: "bi.editor_trigger",
items: o.items,
height: o.height,
validationChecker: o.validationChecker,
quitChecker: o.quitChecker,
allowBlank: o.allowBlank,
watermark: o.watermark,
errorText: o.errorText,
value: o.value
});
this.trigger.on(BI.EditorTrigger.EVENT_CHANGE, function () {
self.popup.setValue(this.getValue());
self.fireEvent(BI.EditorIconCheckCombo.EVENT_CHANGE);
});
this.popup = BI.createWidget({
type: "bi.text_value_check_combo_popup",
chooseType: o.chooseType,
items: o.items,
value: o.value
});
this.popup.on(BI.TextValueCheckComboPopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue());
self.editorIconCheckCombo.hideView();
self.fireEvent(BI.EditorIconCheckCombo.EVENT_CHANGE);
});
this.popup.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
this.editorIconCheckCombo = BI.createWidget({
type: "bi.combo",
container: o.container,
element: this,
adjustLength: 2,
el: this.trigger,
popup: {
el: this.popup,
maxHeight: 300
}
});
},
setValue: function (v) {
this.editorIconCheckCombo.setValue(v);
},
getValue: function () {
return this.trigger.getValue();
},
populate: function (items) {
this.options.items = items;
this.editorIconCheckCombo.populate(items);
}
});
BI.EditorIconCheckCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.editor_icon_check_combo", BI.EditorIconCheckCombo);

234
src/case/table/table.adaptive.js

@ -1,234 +0,0 @@
/**
* 自适应宽度的表格
*
* Created by GUY on 2016/2/3.
* @class BI.AdaptiveTable
* @extends BI.Widget
*/
BI.AdaptiveTable = BI.inherit(BI.Widget, {
_const: {
perColumnSize: 100
},
_defaultConfig: function () {
return BI.extend(BI.AdaptiveTable.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-adaptive-table",
el: {
type: "bi.resizable_table"
},
isNeedResize: true,
isNeedFreeze: false, // 是否需要冻结单元格
freezeCols: [], // 冻结的列号,从0开始,isNeedFreeze为true时生效
isNeedMerge: false, // 是否需要合并单元格
mergeCols: [], // 合并的单元格列号
mergeRule: BI.emptyFn,
columnSize: [],
minColumnSize: [],
maxColumnSize: [],
headerRowSize: 25,
rowSize: 25,
regionColumnSize: [],
header: [],
items: [], // 二维数组
// 交叉表头
crossHeader: [],
crossItems: []
});
},
_init: function () {
BI.AdaptiveTable.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var data = this._digest();
this.table = BI.createWidget(o.el, {
type: "bi.resizable_table",
element: this,
width: o.width,
height: o.height,
isNeedResize: o.isNeedResize,
isResizeAdapt: false,
isNeedFreeze: o.isNeedFreeze,
freezeCols: data.freezeCols,
isNeedMerge: o.isNeedMerge,
mergeCols: o.mergeCols,
mergeRule: o.mergeRule,
columnSize: data.columnSize,
headerRowSize: o.headerRowSize,
rowSize: o.rowSize,
regionColumnSize: data.regionColumnSize,
header: o.header,
items: o.items,
// 交叉表头
crossHeader: o.crossHeader,
crossItems: o.crossItems
});
this.table.on(BI.Table.EVENT_TABLE_SCROLL, function () {
self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, function () {
o.regionColumnSize = this.getRegionColumnSize();
self._populate();
self.table.populate();
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, function () {
o.columnSize = this.getColumnSize();
self._populate();
self.table.populate();
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, arguments);
});
},
_getFreezeColLength: function () {
var o = this.options;
return o.isNeedFreeze === true ? BI.clamp(o.freezeCols.length, 0, o.columnSize.length) : 0;
},
_digest: function () {
var o = this.options;
var columnSize = o.columnSize.slice();
var regionColumnSize = o.regionColumnSize.slice();
var freezeCols = o.freezeCols.slice();
var regionSize = o.regionColumnSize[0];
var freezeColLength = this._getFreezeColLength();
if (!regionSize || regionSize > o.width - 10 || regionSize < 10) {
var rs = BI.sum(columnSize, function (i, size) {
if (i < freezeColLength) {
return size;
}
return 0;
});
regionSize = BI.clamp(rs, 1 / 5 * o.width, 4 / 5 * o.width);
}
if (freezeColLength === 0) {
regionSize = 0;
}
if (freezeCols.length >= columnSize.length) {
freezeCols = [];
}
if (!BI.isNumber(columnSize[0])) {
columnSize = o.minColumnSize.slice();
}
var summaryFreezeColumnSize = 0, summaryColumnSize = 0;
BI.each(columnSize, function (i, size) {
if (i < freezeColLength) {
summaryFreezeColumnSize += size;
}
summaryColumnSize += size;
});
if (freezeColLength > 0) {
columnSize[freezeColLength - 1] = BI.clamp(regionSize - (summaryFreezeColumnSize - columnSize[freezeColLength - 1]),
o.minColumnSize[freezeColLength - 1] || 10, o.maxColumnSize[freezeColLength - 1] || Number.MAX_VALUE);
}
if (columnSize.length > 0) {
columnSize[columnSize.length - 1] = BI.clamp(o.width - BI.GridTableScrollbar.SIZE - regionSize - (summaryColumnSize - summaryFreezeColumnSize - columnSize[columnSize.length - 1]),
o.minColumnSize[columnSize.length - 1] || 10, o.maxColumnSize[columnSize.length - 1] || Number.MAX_VALUE);
}
regionColumnSize[0] = regionSize;
return {
freezeCols: freezeCols,
columnSize: columnSize,
regionColumnSize: regionColumnSize
};
},
_populate: function () {
var o = this.options;
var data = this._digest();
o.regionColumnSize = data.regionColumnSize;
o.columnSize = data.columnSize;
this.table.setColumnSize(data.columnSize);
this.table.setRegionColumnSize(data.regionColumnSize);
this.table.attr("freezeCols", data.freezeCols);
},
setWidth: function (width) {
BI.AdaptiveTable.superclass.setWidth.apply(this, arguments);
this.table.setWidth(width);
},
setHeight: function (height) {
BI.AdaptiveTable.superclass.setHeight.apply(this, arguments);
this.table.setHeight(height);
},
setColumnSize: function (columnSize) {
this.options.columnSize = columnSize;
},
getColumnSize: function () {
return this.table.getColumnSize();
},
setRegionColumnSize: function (regionColumnSize) {
this.options.regionColumnSize = regionColumnSize;
},
getRegionColumnSize: function () {
return this.table.getRegionColumnSize();
},
setVerticalScroll: function (scrollTop) {
this.table.setVerticalScroll(scrollTop);
},
setLeftHorizontalScroll: function (scrollLeft) {
this.table.setLeftHorizontalScroll(scrollLeft);
},
setRightHorizontalScroll: function (scrollLeft) {
this.table.setRightHorizontalScroll(scrollLeft);
},
getVerticalScroll: function () {
return this.table.getVerticalScroll();
},
getLeftHorizontalScroll: function () {
return this.table.getLeftHorizontalScroll();
},
getRightHorizontalScroll: function () {
return this.table.getRightHorizontalScroll();
},
attr: function (key, value) {
var v = BI.AdaptiveTable.superclass.attr.apply(this, arguments);
if (key === "freezeCols") {
return v;
}
return this.table.attr.apply(this.table, arguments);
},
restore: function () {
this.table.restore();
},
populate: function (items) {
var self = this, o = this.options;
this._populate();
this.table.populate.apply(this.table, arguments);
},
destroy: function () {
this.table.destroy();
BI.AdaptiveTable.superclass.destroy.apply(this, arguments);
}
});
BI.shortcut("bi.adaptive_table", BI.AdaptiveTable);

336
src/case/table/table.dynamicsummarylayertree.js

@ -1,336 +0,0 @@
/**
*
* 层级树状结构的表格
*
* Created by GUY on 2016/8/12.
* @class BI.DynamicSummaryLayerTreeTable
* @extends BI.Widget
*/
BI.DynamicSummaryLayerTreeTable = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.DynamicSummaryLayerTreeTable.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-dynamic-summary-layer-tree-table",
el: {
type: "bi.resizable_table"
},
isNeedResize: true, // 是否需要调整列宽
isResizeAdapt: true, // 是否需要在调整列宽或区域宽度的时候它们自适应变化
isNeedFreeze: false, // 是否需要冻结单元格
freezeCols: [], // 冻结的列号,从0开始,isNeedFreeze为tree时生效
isNeedMerge: true, // 是否需要合并单元格
mergeCols: [],
mergeRule: BI.emptyFn,
columnSize: [],
minColumnSize: [],
maxColumnSize: [],
headerRowSize: 25,
footerRowSize: 25,
rowSize: 25,
regionColumnSize: [],
// 行表头
rowHeaderCreator: null,
headerCellStyleGetter: BI.emptyFn,
summaryCellStyleGetter: BI.emptyFn,
sequenceCellStyleGetter: BI.emptyFn,
header: [],
footer: false,
items: [],
// 交叉表头
crossHeader: [],
crossItems: []
});
},
_getVDeep: function () {
return this.options.crossHeader.length;// 纵向深度
},
_getHDeep: function () {
var o = this.options;
return Math.max(o.mergeCols.length, o.freezeCols.length, BI.TableTree.maxDeep(o.items) - 1);
},
_createHeader: function (vDeep) {
var self = this, o = this.options;
var header = o.header || [], crossHeader = o.crossHeader || [];
var items = BI.TableTree.formatCrossItems(o.crossItems, vDeep, o.headerCellStyleGetter);
var result = [];
BI.each(items, function (row, node) {
var c = [crossHeader[row]];
result.push(c.concat(node || []));
});
var rowHeaderCreator = BI.isFunction(o.rowHeaderCreator) ? o.rowHeaderCreator() : o.rowHeaderCreator;
if (header && header.length > 0) {
var newHeader = this._formatColumns(header);
var deep = this._getHDeep();
if (deep <= 0) {
newHeader.unshift(rowHeaderCreator || {
type: "bi.table_style_cell",
text: BI.i18nText("BI-Row_Header"),
styleGetter: o.headerCellStyleGetter
});
} else {
newHeader[0] = rowHeaderCreator || {
type: "bi.table_style_cell",
text: BI.i18nText("BI-Row_Header"),
styleGetter: o.headerCellStyleGetter
};
}
result.push(newHeader);
}
return result;
},
_formatItems: function (nodes, header, deep) {
var self = this, o = this.options;
var result = [];
function track (node, layer) {
node.type || (node.type = "bi.layer_tree_table_cell");
node.layer = layer;
var next = [node];
next = next.concat(node.values || []);
if (next.length > 0) {
result.push(next);
}
if (BI.isNotEmptyArray(node.children)) {
BI.each(node.children, function (index, child) {
track(child, layer + 1);
});
}
}
BI.each(nodes, function (i, node) {
BI.each(node.children, function (j, c) {
track(c, 0);
});
if (BI.isArray(node.values)) {
var next = [{
type: "bi.table_style_cell",
text: BI.i18nText("BI-Summary_Values"),
styleGetter: function () {
return o.summaryCellStyleGetter(true);
}
}].concat(node.values);
result.push(next);
}
});
return BI.DynamicSummaryTreeTable.formatSummaryItems(result, header, o.crossItems, 1);
},
_formatColumns: function (columns, deep) {
if (BI.isNotEmptyArray(columns)) {
deep = deep || this._getHDeep();
return columns.slice(Math.max(0, deep - 1));
}
return columns;
},
_formatFreezeCols: function () {
if (this.options.freezeCols.length > 0) {
return [0];
}
return [];
},
_formatColumnSize: function (columnSize, deep) {
if (columnSize.length <= 0) {
return [];
}
var result = [0];
deep = deep || this._getHDeep();
BI.each(columnSize, function (i, size) {
if (i < deep) {
result[0] += size;
return;
}
result.push(size);
});
return result;
},
_recomputeColumnSize: function () {
var o = this.options;
o.regionColumnSize = this.table.getRegionColumnSize();
var columnSize = this.table.getColumnSize().slice();
if (o.freezeCols.length > 1) {
for (var i = 0; i < o.freezeCols.length - 1; i++) {
columnSize.splice(1, 0, 0);
}
}
o.columnSize = columnSize;
},
_digest: function () {
var o = this.options;
var deep = this._getHDeep();
var vDeep = this._getVDeep();
var header = this._createHeader(vDeep);
var data = this._formatItems(o.items, header, deep);
var columnSize = o.columnSize.slice();
var minColumnSize = o.minColumnSize.slice();
var maxColumnSize = o.maxColumnSize.slice();
BI.removeAt(columnSize, data.deletedCols);
BI.removeAt(minColumnSize, data.deletedCols);
BI.removeAt(maxColumnSize, data.deletedCols);
return {
header: data.header,
items: data.items,
columnSize: this._formatColumnSize(columnSize, deep),
minColumnSize: this._formatColumns(minColumnSize, deep),
maxColumnSize: this._formatColumns(maxColumnSize, deep),
freezeCols: this._formatFreezeCols()
};
},
_init: function () {
BI.DynamicSummaryLayerTreeTable.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var data = this._digest();
this.table = BI.createWidget(o.el, {
type: "bi.resizable_table",
element: this,
width: o.width,
height: o.height,
isNeedResize: o.isNeedResize,
isResizeAdapt: o.isResizeAdapt,
isNeedFreeze: o.isNeedFreeze,
freezeCols: data.freezeCols,
isNeedMerge: o.isNeedMerge,
mergeCols: [],
mergeRule: o.mergeRule,
columnSize: data.columnSize,
minColumnSize: data.minColumnSize,
maxColumnSize: data.maxColumnSize,
headerRowSize: o.headerRowSize,
rowSize: o.rowSize,
regionColumnSize: o.regionColumnSize,
header: data.header,
items: data.items
});
this.table.on(BI.Table.EVENT_TABLE_SCROLL, function () {
self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, function () {
self._recomputeColumnSize();
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, function () {
self._recomputeColumnSize();
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, arguments);
});
},
setWidth: function (width) {
BI.DynamicSummaryLayerTreeTable.superclass.setWidth.apply(this, arguments);
this.table.setWidth(width);
},
setHeight: function (height) {
BI.DynamicSummaryLayerTreeTable.superclass.setHeight.apply(this, arguments);
this.table.setHeight(height);
},
setColumnSize: function (columnSize) {
this.options.columnSize = columnSize;
},
getColumnSize: function () {
return this.options.columnSize;
},
setRegionColumnSize: function (columnSize) {
this.options.regionColumnSize = columnSize;
this.table.setRegionColumnSize(columnSize);
},
getRegionColumnSize: function () {
return this.table.getRegionColumnSize();
},
setVerticalScroll: function (scrollTop) {
this.table.setVerticalScroll(scrollTop);
},
setLeftHorizontalScroll: function (scrollLeft) {
this.table.setLeftHorizontalScroll(scrollLeft);
},
setRightHorizontalScroll: function (scrollLeft) {
this.table.setRightHorizontalScroll(scrollLeft);
},
getVerticalScroll: function () {
return this.table.getVerticalScroll();
},
getLeftHorizontalScroll: function () {
return this.table.getLeftHorizontalScroll();
},
getRightHorizontalScroll: function () {
return this.table.getRightHorizontalScroll();
},
attr: function (key, value) {
var self = this;
if (BI.isObject(key)) {
BI.each(key, function (k, v) {
self.attr(k, v);
});
return;
}
BI.DynamicSummaryLayerTreeTable.superclass.attr.apply(this, arguments);
switch (key) {
case "columnSize":
case "minColumnSize":
case "maxColumnSize":
case "freezeCols":
case "mergeCols":
return;
}
this.table.attr.apply(this.table, [key, value]);
},
restore: function () {
this.table.restore();
},
populate: function (items, header, crossItems, crossHeader) {
var o = this.options;
if (items) {
o.items = items;
}
if (header) {
o.header = header;
}
if (crossItems) {
o.crossItems = crossItems;
}
if (crossHeader) {
o.crossHeader = crossHeader;
}
var data = this._digest();
this.table.setColumnSize(data.columnSize);
this.table.attr("minColumnSize", data.minColumnSize);
this.table.attr("maxColumnSize", data.maxColumnSize);
this.table.attr("freezeCols", data.freezeCols);
this.table.populate(data.items, data.header);
},
destroy: function () {
this.table.destroy();
BI.DynamicSummaryLayerTreeTable.superclass.destroy.apply(this, arguments);
}
});
BI.shortcut("bi.dynamic_summary_layer_tree_table", BI.DynamicSummaryLayerTreeTable);

360
src/case/table/table.dynamicsummarytree.js

@ -1,360 +0,0 @@
/**
*
* 树状结构的表格
*
* Created by GUY on 2015/8/12.
* @class BI.DynamicSummaryTreeTable
* @extends BI.Widget
*/
BI.DynamicSummaryTreeTable = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.DynamicSummaryTreeTable.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-dynamic-summary-tree-table",
el: {
type: "bi.resizable_table"
},
isNeedResize: true, // 是否需要调整列宽
isResizeAdapt: true, // 是否需要在调整列宽或区域宽度的时候它们自适应变化
isNeedFreeze: false, // 是否需要冻结单元格
freezeCols: [], // 冻结的列号,从0开始,isNeedFreeze为tree时生效
isNeedMerge: true, // 是否需要合并单元格
mergeCols: [],
mergeRule: BI.emptyFn,
columnSize: [],
minColumnSize: [],
maxColumnSize: [],
headerRowSize: 25,
footerRowSize: 25,
rowSize: 25,
regionColumnSize: [],
headerCellStyleGetter: BI.emptyFn,
summaryCellStyleGetter: BI.emptyFn,
sequenceCellStyleGetter: BI.emptyFn,
header: [],
footer: false,
items: [],
// 交叉表头
crossHeader: [],
crossItems: []
});
},
_getVDeep: function () {
return this.options.crossHeader.length;// 纵向深度
},
_getHDeep: function () {
var o = this.options;
return Math.max(o.mergeCols.length, o.freezeCols.length, BI.TableTree.maxDeep(o.items) - 1);
},
_init: function () {
BI.DynamicSummaryTreeTable.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var data = this._digest();
this.table = BI.createWidget(o.el, {
type: "bi.resizable_table",
element: this,
width: o.width,
height: o.height,
isNeedResize: o.isNeedResize,
isResizeAdapt: o.isResizeAdapt,
isNeedFreeze: o.isNeedFreeze,
freezeCols: o.freezeCols,
isNeedMerge: o.isNeedMerge,
mergeCols: o.mergeCols,
mergeRule: o.mergeRule,
columnSize: o.columnSize,
minColumnSize: o.minColumnSize,
maxColumnSize: o.maxColumnSize,
headerRowSize: o.headerRowSize,
rowSize: o.rowSize,
regionColumnSize: o.regionColumnSize,
header: data.header,
items: data.items
});
this.table.on(BI.Table.EVENT_TABLE_SCROLL, function () {
self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, function () {
o.regionColumnSize = this.getRegionColumnSize();
var columnSize = this.getColumnSize();
var length = o.columnSize.length - columnSize.length;
o.columnSize = columnSize.slice();
o.columnSize = o.columnSize.concat(BI.makeArray(length, 0));
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, function () {
o.regionColumnSize = this.getRegionColumnSize();
var columnSize = this.getColumnSize();
var length = o.columnSize.length - columnSize.length;
o.columnSize = columnSize.slice();
o.columnSize = o.columnSize.concat(BI.makeArray(length, 0));
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, arguments);
});
},
_digest: function () {
var o = this.options;
var deep = this._getHDeep();
var vDeep = this._getVDeep();
var header = BI.TableTree.formatHeader(o.header, o.crossHeader, o.crossItems, deep, vDeep, o.headerCellStyleGetter);
var items = BI.DynamicSummaryTreeTable.formatHorizontalItems(o.items, deep, false, o.summaryCellStyleGetter);
var data = BI.DynamicSummaryTreeTable.formatSummaryItems(items, header, o.crossItems, deep);
var columnSize = o.columnSize.slice();
var minColumnSize = o.minColumnSize.slice();
var maxColumnSize = o.maxColumnSize.slice();
BI.removeAt(columnSize, data.deletedCols);
BI.removeAt(minColumnSize, data.deletedCols);
BI.removeAt(maxColumnSize, data.deletedCols);
return {
header: data.header,
items: data.items,
columnSize: columnSize,
minColumnSize: minColumnSize,
maxColumnSize: maxColumnSize
};
},
setWidth: function (width) {
BI.DynamicSummaryTreeTable.superclass.setWidth.apply(this, arguments);
this.table.setWidth(width);
},
setHeight: function (height) {
BI.DynamicSummaryTreeTable.superclass.setHeight.apply(this, arguments);
this.table.setHeight(height);
},
setColumnSize: function (columnSize) {
this.options.columnSize = columnSize;
},
getColumnSize: function () {
return this.options.columnSize;
},
setRegionColumnSize: function (columnSize) {
this.options.regionColumnSize = columnSize;
this.table.setRegionColumnSize(columnSize);
},
getRegionColumnSize: function () {
return this.table.getRegionColumnSize();
},
setVerticalScroll: function (scrollTop) {
this.table.setVerticalScroll(scrollTop);
},
setLeftHorizontalScroll: function (scrollLeft) {
this.table.setLeftHorizontalScroll(scrollLeft);
},
setRightHorizontalScroll: function (scrollLeft) {
this.table.setRightHorizontalScroll(scrollLeft);
},
getVerticalScroll: function () {
return this.table.getVerticalScroll();
},
getLeftHorizontalScroll: function () {
return this.table.getLeftHorizontalScroll();
},
getRightHorizontalScroll: function () {
return this.table.getRightHorizontalScroll();
},
attr: function (key) {
BI.DynamicSummaryTreeTable.superclass.attr.apply(this, arguments);
switch (key) {
case "minColumnSize":
case "maxColumnSize":
return;
}
this.table.attr.apply(this.table, arguments);
},
restore: function () {
this.table.restore();
},
populate: function (items, header, crossItems, crossHeader) {
var o = this.options;
if (items) {
o.items = items;
}
if (header) {
o.header = header;
}
if (crossItems) {
o.crossItems = crossItems;
}
if (crossHeader) {
o.crossHeader = crossHeader;
}
var data = this._digest();
this.table.setColumnSize(data.columnSize);
this.table.attr("minColumnSize", data.minColumnSize);
this.table.attr("maxColumnSize", data.maxColumnSize);
this.table.populate(data.items, data.header);
},
destroy: function () {
this.table.destroy();
BI.DynamicSummaryTreeTable.superclass.destroy.apply(this, arguments);
}
});
BI.extend(BI.DynamicSummaryTreeTable, {
formatHorizontalItems: function (nodes, deep, isCross, styleGetter) {
var result = [];
function track (store, node) {
var next;
if (BI.isArray(node.children)) {
BI.each(node.children, function (index, child) {
var next;
if (store != -1) {
next = store.slice();
next.push(node);
} else {
next = [];
}
track(next, child);
});
if (store != -1) {
next = store.slice();
next.push(node);
} else {
next = [];
}
if ((store == -1 || node.children.length > 1) && BI.isNotEmptyArray(node.values)) {
var summary = {
text: BI.i18nText("BI-Summary_Values"),
type: "bi.table_style_cell",
styleGetter: function () {
return styleGetter(store === -1);
}
};
for (var i = next.length; i < deep; i++) {
next.push(summary);
}
if (!isCross) {
next = next.concat(node.values);
}
if (next.length > 0) {
if (!isCross) {
result.push(next);
} else {
for (var k = 0, l = node.values.length; k < l; k++) {
result.push(next);
}
}
}
}
return;
}
if (store != -1) {
next = store.slice();
for (var i = next.length; i < deep; i++) {
next.push(node);
}
} else {
next = [];
}
if (!isCross && BI.isArray(node.values)) {
next = next.concat(node.values);
}
if (isCross && BI.isArray(node.values)) {
for (var i = 0, len = node.values.length; i < len - 1; i++) {
if (next.length > 0) {
result.push(next);
}
}
}
if (next.length > 0) {
result.push(next);
}
}
BI.each(nodes, function (i, node) {
track(-1, node);
});
// 填充空位
BI.each(result, function (i, line) {
var last = BI.last(line);
for (var j = line.length; j < deep; j++) {
line.push(last);
}
});
return result;
},
formatSummaryItems: function (items, header, crossItems, deep) {
// 求纵向需要去除的列
var cols = [];
var leaf = 0;
function track (node) {
if (BI.isArray(node.children)) {
BI.each(node.children, function (index, child) {
track(child);
});
if (BI.isNotEmptyArray(node.values)) {
if (node.children.length === 1) {
for (var i = 0; i < node.values.length; i++) {
cols.push(leaf + i + deep);
}
}
leaf += node.values.length;
}
return;
}
if (node.values && node.values.length > 1) {
leaf += node.values.length;
} else {
leaf++;
}
}
BI.each(crossItems, function (i, node) {
track(node);
});
if (cols.length > 0) {
var nHeader = [], nItems = [];
BI.each(header, function (i, node) {
var nNode = node.slice();
BI.removeAt(nNode, cols);
nHeader.push(nNode);
});
BI.each(items, function (i, node) {
var nNode = node.slice();
BI.removeAt(nNode, cols);
nItems.push(nNode);
});
header = nHeader;
items = nItems;
}
return {items: items, header: header, deletedCols: cols};
}
});
BI.shortcut("bi.dynamic_summary_tree_table", BI.DynamicSummaryTreeTable);

32
src/case/table/table.layertree.cell.js

@ -1,32 +0,0 @@
/**
* Created by GUY on 2016/5/7.
* @class BI.LayerTreeTableCell
* @extends BI.Single
*/
BI.LayerTreeTableCell = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.LayerTreeTableCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-layer-tree-table-cell",
layer: 0,
text: ""
});
},
_init: function () {
BI.LayerTreeTableCell.superclass._init.apply(this, arguments);
var o = this.options;
BI.createWidget({
type: "bi.label",
element: this.element,
textAlign: "left",
whiteSpace: "nowrap",
height: o.height,
text: o.text,
value: o.value,
lgap: 5 + 30 * o.layer,
rgap: 5
});
}
});
BI.shortcut("bi.layer_tree_table_cell", BI.LayerTreeTableCell);

318
src/case/table/table.layertree.js

@ -1,318 +0,0 @@
/**
*
* 层级树状结构的表格
*
* Created by GUY on 2016/5/7.
* @class BI.LayerTreeTable
* @extends BI.Widget
*/
BI.LayerTreeTable = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.LayerTreeTable.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-layer-tree-table",
el: {
type: "bi.resizable_table"
},
isNeedResize: false, // 是否需要调整列宽
isResizeAdapt: true, // 是否需要在调整列宽或区域宽度的时候它们自适应变化
isNeedFreeze: false, // 是否需要冻结单元格
freezeCols: [], // 冻结的列号,从0开始,isNeedFreeze为tree时生效
isNeedMerge: true, // 是否需要合并单元格
mergeCols: [],
mergeRule: BI.emptyFn,
columnSize: [],
minColumnSize: [],
maxColumnSize: [],
headerRowSize: 25,
rowSize: 25,
regionColumnSize: [],
rowHeaderCreator: null,
headerCellStyleGetter: BI.emptyFn,
summaryCellStyleGetter: BI.emptyFn,
sequenceCellStyleGetter: BI.emptyFn,
header: [],
items: [],
// 交叉表头
crossHeader: [],
crossItems: []
});
},
_getVDeep: function () {
return this.options.crossHeader.length;// 纵向深度
},
_getHDeep: function () {
var o = this.options;
return Math.max(o.mergeCols.length, o.freezeCols.length, BI.TableTree.maxDeep(o.items) - 1);
},
_createHeader: function (vDeep) {
var self = this, o = this.options;
var header = o.header || [], crossHeader = o.crossHeader || [];
var items = BI.TableTree.formatCrossItems(o.crossItems, vDeep, o.headerCellStyleGetter);
var result = [];
BI.each(items, function (row, node) {
var c = [crossHeader[row]];
result.push(c.concat(node || []));
});
if (header && header.length > 0) {
var newHeader = this._formatColumns(header);
var deep = this._getHDeep();
if (deep <= 0) {
newHeader.unshift(o.rowHeaderCreator || {
type: "bi.table_style_cell",
text: BI.i18nText("BI-Row_Header"),
styleGetter: o.headerCellStyleGetter
});
} else {
newHeader[0] = o.rowHeaderCreator || {
type: "bi.table_style_cell",
text: BI.i18nText("BI-Row_Header"),
styleGetter: o.headerCellStyleGetter
};
}
result.push(newHeader);
}
return result;
},
_formatItems: function (nodes) {
var self = this, o = this.options;
var result = [];
function track (node, layer) {
node.type || (node.type = "bi.layer_tree_table_cell");
node.layer = layer;
var next = [node];
next = next.concat(node.values || []);
if (next.length > 0) {
result.push(next);
}
if (BI.isNotEmptyArray(node.children)) {
BI.each(node.children, function (index, child) {
track(child, layer + 1);
});
}
}
BI.each(nodes, function (i, node) {
BI.each(node.children, function (j, c) {
track(c, 0);
});
if (BI.isArray(node.values)) {
var next = [{
type: "bi.table_style_cell", text: BI.i18nText("BI-Summary_Values"), styleGetter: function () {
return o.summaryCellStyleGetter(true);
}
}].concat(node.values);
result.push(next);
}
});
return result;
},
_formatColumns: function (columns, deep) {
if (BI.isNotEmptyArray(columns)) {
deep = deep || this._getHDeep();
return columns.slice(Math.max(0, deep - 1));
}
return columns;
},
_formatFreezeCols: function () {
if (this.options.freezeCols.length > 0) {
return [0];
}
return [];
},
_formatColumnSize: function (columnSize, deep) {
if (columnSize.length <= 0) {
return [];
}
var result = [0];
deep = deep || this._getHDeep();
BI.each(columnSize, function (i, size) {
if (i < deep) {
result[0] += size;
return;
}
result.push(size);
});
return result;
},
_digest: function () {
var o = this.options;
var deep = this._getHDeep();
var vDeep = this._getVDeep();
return {
header: this._createHeader(vDeep),
items: this._formatItems(o.items),
columnSize: this._formatColumnSize(o.columnSize, deep),
minColumnSize: this._formatColumns(o.minColumnSize, deep),
maxColumnSize: this._formatColumns(o.maxColumnSize, deep),
freezeCols: this._formatFreezeCols()
};
},
_init: function () {
BI.LayerTreeTable.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var data = this._digest();
this.table = BI.createWidget(o.el, {
type: "bi.resizable_table",
element: this,
width: o.width,
height: o.height,
isNeedResize: o.isNeedResize,
isResizeAdapt: o.isResizeAdapt,
isNeedFreeze: o.isNeedFreeze,
freezeCols: data.freezeCols,
isNeedMerge: o.isNeedMerge,
mergeCols: [],
mergeRule: o.mergeRule,
columnSize: data.columnSize,
minColumnSize: data.minColumnSize,
maxColumnSize: data.maxColumnSize,
headerRowSize: o.headerRowSize,
rowSize: o.rowSize,
regionColumnSize: o.regionColumnSize,
header: data.header,
items: data.items
});
this.table.on(BI.Table.EVENT_TABLE_SCROLL, function () {
self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, function () {
o.regionColumnSize = this.getRegionColumnSize();
o.columnSize = this.getColumnSize();
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, function () {
o.regionColumnSize = this.getRegionColumnSize();
o.columnSize = this.getColumnSize();
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, arguments);
});
},
setWidth: function (width) {
BI.LayerTreeTable.superclass.setWidth.apply(this, arguments);
this.table.setWidth(width);
},
setHeight: function (height) {
BI.LayerTreeTable.superclass.setHeight.apply(this, arguments);
this.table.setHeight(height);
},
setColumnSize: function (columnSize) {
this.options.columnSize = columnSize;
},
getColumnSize: function () {
var columnSize = this.table.getColumnSize();
var deep = this._getHDeep();
var pre = [];
if (deep > 0) {
pre = BI.makeArray(deep, columnSize[0] / deep);
}
return pre.concat(columnSize.slice(1));
},
setRegionColumnSize: function (columnSize) {
this.options.regionColumnSize = columnSize;
this.table.setRegionColumnSize(columnSize);
},
getRegionColumnSize: function () {
return this.table.getRegionColumnSize();
},
setVerticalScroll: function (scrollTop) {
this.table.setVerticalScroll(scrollTop);
},
setLeftHorizontalScroll: function (scrollLeft) {
this.table.setLeftHorizontalScroll(scrollLeft);
},
setRightHorizontalScroll: function (scrollLeft) {
this.table.setRightHorizontalScroll(scrollLeft);
},
getVerticalScroll: function () {
return this.table.getVerticalScroll();
},
getLeftHorizontalScroll: function () {
return this.table.getLeftHorizontalScroll();
},
getRightHorizontalScroll: function () {
return this.table.getRightHorizontalScroll();
},
attr: function (key, value) {
var self = this;
if (BI.isObject(key)) {
BI.each(key, function (k, v) {
self.attr(k, v);
});
return;
}
BI.LayerTreeTable.superclass.attr.apply(this, arguments);
switch (key) {
case "columnSize":
case "minColumnSize":
case "maxColumnSize":
case "freezeCols":
case "mergeCols":
return;
}
this.table.attr.apply(this.table, [key, value]);
},
restore: function () {
this.table.restore();
},
populate: function (items, header, crossItems, crossHeader) {
var o = this.options;
o.items = items || [];
if (header) {
o.header = header;
}
if (crossItems) {
o.crossItems = crossItems;
}
if (crossHeader) {
o.crossHeader = crossHeader;
}
var data = this._digest();
this.table.setColumnSize(data.columnSize);
this.table.attr("freezeCols", data.freezeCols);
this.table.attr("minColumnSize", data.minColumnSize);
this.table.attr("maxColumnSize", data.maxColumnSize);
this.table.populate(data.items, data.header);
},
destroy: function () {
this.table.destroy();
BI.LayerTreeTable.superclass.destroy.apply(this, arguments);
}
});
BI.shortcut("bi.layer_tree_table", BI.LayerTreeTable);

47
src/case/table/table.style.cell.js

@ -1,47 +0,0 @@
/**
*
* Created by GUY on 2016/5/26.
* @class BI.TableStyleCell
* @extends BI.Single
*/
BI.TableStyleCell = BI.inherit(BI.Single, {
_defaultConfig: function () {
return BI.extend(BI.TableStyleCell.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-table-style-cell",
styleGetter: BI.emptyFn
});
},
_init: function () {
BI.TableStyleCell.superclass._init.apply(this, arguments);
var o = this.options;
this.text = BI.createWidget({
type: "bi.label",
element: this,
height: o.height,
textAlign: "left",
forceCenter: true,
hgap: 5,
text: o.text
});
this._digestStyle();
},
_digestStyle: function () {
var o = this.options;
var style = o.styleGetter();
if (style) {
this.text.element.css(style);
}
},
setText: function (text) {
this.text.setText(text);
},
populate: function () {
this._digestStyle();
}
});
BI.shortcut("bi.table_style_cell", BI.TableStyleCell);

326
src/case/table/table.tree.js

@ -1,326 +0,0 @@
/**
*
* 树状结构的表格
*
* Created by GUY on 2015/9/22.
* @class BI.TableTree
* @extends BI.Widget
*/
BI.TableTree = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.TableTree.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-table-tree",
el: {
type: "bi.resizable_table"
},
isNeedResize: true, // 是否需要调整列宽
isResizeAdapt: true, // 是否需要在调整列宽或区域宽度的时候它们自适应变化
freezeCols: [], // 冻结的列号,从0开始,isNeedFreeze为tree时生效
isNeedMerge: true, // 是否需要合并单元格
mergeCols: [],
mergeRule: BI.emptyFn,
columnSize: [],
minColumnSize: [],
maxColumnSize: [],
headerRowSize: 25,
rowSize: 25,
regionColumnSize: [],
headerCellStyleGetter: BI.emptyFn,
summaryCellStyleGetter: BI.emptyFn,
sequenceCellStyleGetter: BI.emptyFn,
header: [],
items: [],
// 交叉表头
crossHeader: [],
crossItems: []
});
},
_getVDeep: function () {
return this.options.crossHeader.length;// 纵向深度
},
_getHDeep: function () {
var o = this.options;
return Math.max(o.mergeCols.length, o.freezeCols.length, BI.TableTree.maxDeep(o.items) - 1);
},
_init: function () {
BI.TableTree.superclass._init.apply(this, arguments);
var self = this, o = this.options;
var data = this._digest();
this.table = BI.createWidget(o.el, {
type: "bi.resizable_table",
element: this,
width: o.width,
height: o.height,
isNeedResize: o.isNeedResize,
isResizeAdapt: o.isResizeAdapt,
isNeedFreeze: o.isNeedFreeze,
freezeCols: o.freezeCols,
isNeedMerge: o.isNeedMerge,
mergeCols: o.mergeCols,
mergeRule: o.mergeRule,
columnSize: o.columnSize,
minColumnSize: o.minColumnSize,
maxColumnSize: o.maxColumnSize,
headerRowSize: o.headerRowSize,
rowSize: o.rowSize,
regionColumnSize: o.regionColumnSize,
header: data.header,
items: data.items
});
this.table.on(BI.Table.EVENT_TABLE_SCROLL, function () {
self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, function () {
o.regionColumnSize = this.getRegionColumnSize();
o.columnSize = this.getColumnSize();
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, function () {
o.regionColumnSize = this.getRegionColumnSize();
o.columnSize = this.getColumnSize();
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, arguments);
});
},
_digest: function () {
var self = this, o = this.options;
var deep = this._getHDeep();
var vDeep = this._getVDeep();
var header = BI.TableTree.formatHeader(o.header, o.crossHeader, o.crossItems, deep, vDeep, o.headerCellStyleGetter);
var items = BI.TableTree.formatItems(o.items, deep, false, o.summaryCellStyleGetter);
return {
header: header,
items: items
};
},
setWidth: function (width) {
BI.TableTree.superclass.setWidth.apply(this, arguments);
this.table.setWidth(width);
},
setHeight: function (height) {
BI.TableTree.superclass.setHeight.apply(this, arguments);
this.table.setHeight(height);
},
setColumnSize: function (columnSize) {
this.options.columnSize = columnSize;
this.table.setColumnSize(columnSize);
},
getColumnSize: function () {
return this.table.getColumnSize();
},
setRegionColumnSize: function (columnSize) {
this.options.regionColumnSize = columnSize;
this.table.setRegionColumnSize(columnSize);
},
getRegionColumnSize: function () {
return this.table.getRegionColumnSize();
},
setVerticalScroll: function (scrollTop) {
this.table.setVerticalScroll(scrollTop);
},
setLeftHorizontalScroll: function (scrollLeft) {
this.table.setLeftHorizontalScroll(scrollLeft);
},
setRightHorizontalScroll: function (scrollLeft) {
this.table.setRightHorizontalScroll(scrollLeft);
},
getVerticalScroll: function () {
return this.table.getVerticalScroll();
},
getLeftHorizontalScroll: function () {
return this.table.getLeftHorizontalScroll();
},
getRightHorizontalScroll: function () {
return this.table.getRightHorizontalScroll();
},
attr: function () {
BI.TableTree.superclass.attr.apply(this, arguments);
this.table.attr.apply(this.table, arguments);
},
restore: function () {
this.table.restore();
},
populate: function (items, header, crossItems, crossHeader) {
var o = this.options;
if (items) {
o.items = items || [];
}
if (header) {
o.header = header;
}
if (crossItems) {
o.crossItems = crossItems;
}
if (crossHeader) {
o.crossHeader = crossHeader;
}
var data = this._digest();
this.table.populate(data.items, data.header);
},
destroy: function () {
this.table.destroy();
BI.TableTree.superclass.destroy.apply(this, arguments);
}
});
BI.extend(BI.TableTree, {
formatHeader: function (header, crossHeader, crossItems, hDeep, vDeep, styleGetter) {
var items = BI.TableTree.formatCrossItems(crossItems, vDeep, styleGetter);
var result = [];
for (var i = 0; i < vDeep; i++) {
var c = [];
for (var j = 0; j < hDeep; j++) {
c.push(crossHeader[i]);
}
result.push(c.concat(items[i] || []));
}
if (header && header.length > 0) {
result.push(header);
}
return result;
},
formatItems: function (nodes, deep, isCross, styleGetter) {
var self = this;
var result = [];
function track (store, node) {
var next;
if (BI.isArray(node.children)) {
BI.each(node.children, function (index, child) {
var next;
if (store != -1) {
next = store.slice();
next.push(node);
} else {
next = [];
}
track(next, child);
});
if (store != -1) {
next = store.slice();
next.push(node);
} else {
next = [];
}
if (/** (store == -1 || node.children.length > 1) &&**/ BI.isNotEmptyArray(node.values)) {
var summary = {
text: BI.i18nText("BI-Summary_Values"),
type: "bi.table_style_cell",
styleGetter: function () {
return styleGetter(store === -1);
}
};
for (var i = next.length; i < deep; i++) {
next.push(summary);
}
if (!isCross) {
next = next.concat(node.values);
}
if (next.length > 0) {
if (!isCross) {
result.push(next);
} else {
for (var k = 0, l = node.values.length; k < l; k++) {
result.push(next);
}
}
}
}
return;
}
if (store != -1) {
next = store.slice();
for (var i = next.length; i < deep; i++) {
next.push(node);
}
} else {
next = [];
}
if (!isCross && BI.isArray(node.values)) {
next = next.concat(node.values);
}
if (isCross && BI.isArray(node.values)) {
for (var i = 0, len = node.values.length; i < len - 1; i++) {
if (next.length > 0) {
result.push(next);
}
}
}
if (next.length > 0) {
result.push(next);
}
}
BI.each(nodes, function (i, node) {
track(-1, node);
});
// 填充空位
BI.each(result, function (i, line) {
var last = BI.last(line);
for (var j = line.length; j < deep; j++) {
line.push(last);
}
});
return result;
},
formatCrossItems: function (nodes, deep, styleGetter) {
var items = BI.TableTree.formatItems(nodes, deep, true, styleGetter);
return BI.unzip(items);
},
maxDeep: function (nodes) {
function track (deep, node) {
var d = deep;
if (BI.isNotEmptyArray(node.children)) {
BI.each(node.children, function (index, child) {
d = Math.max(d, track(deep + 1, child));
});
}
return d;
}
var deep = 1;
if (BI.isObject(nodes)) {
BI.each(nodes, function (i, node) {
deep = Math.max(deep, track(1, node));
});
}
return deep;
}
});
BI.shortcut("bi.tree_table", BI.TableTree);

470
src/case/tree/branchrelation.js

@ -1,470 +0,0 @@
/**
* 表关联树
*
* Created by GUY on 2015/12/15.
* @class BI.BranchRelation
* @extends BI.Widget
*/
BI.BranchRelation = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.BranchRelation.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-branch-relation-tree",
items: [],
centerOffset: 0, // 重心偏移量
direction: BI.Direction.Bottom,
align: BI.VerticalAlign.Top
});
},
_init: function () {
BI.BranchRelation.superclass._init.apply(this, arguments);
this.populate(this.options.items);
},
// 树分层
_stratification: function () {
var levels = [];
this.tree.recursion(function (node, route) {
// node.isRoot = route.length <= 1;
node.leaf = node.isLeaf();
if (!levels[route.length - 1]) {
levels[route.length - 1] = [];
}
levels[route.length - 1].push(node);
});
return levels;
},
// 计算所有节点的叶子结点个数
_calculateLeaves: function () {
var count = 0;
function track (node) {
var c = 0;
if (node.isLeaf()) {
return 1;
}
BI.each(node.getChildren(), function (i, child) {
c += track(child);
});
node.set("leaves", c);
return c;
}
count = track(this.tree.getRoot());
return count;
},
// 树平移
_translate: function (levels) {
var adjust = [];
var maxLevel = levels.length;
BI.each(levels, function (i, nodes) {
if (!adjust[i]) {
adjust[i] = [];
}
BI.each(nodes, function (j, node) {
if (node.isLeaf() && i < maxLevel - 1) {
var newNode = new BI.Node(BI.UUID());
// newNode.isEmptyRoot = node.isRoot || node.isEmptyRoot;
newNode.isNew = true;
// 把node向下一层移
var tar = 0;
if (j > 0) {
var c = nodes[j - 1].getLastChild();
tar = levels[i + 1].indexOf(c) + 1;
}
levels[i + 1].splice(tar, 0, node);
// 新增一个临时树节点
var index = node.parent.getChildIndex(node.id);
node.parent.removeChildByIndex(index);
node.parent.addChild(newNode, index);
newNode.addChild(node);
adjust[i].push(newNode);
nodes[j] = newNode;
} else {
adjust[i].push(node);
}
});
});
return adjust;
},
// 树补白
_fill: function (levels) {
var adjust = [];
var maxLevel = levels.length;
BI.each(levels, function (i, nodes) {
if (!adjust[i]) {
adjust[i] = [];
}
BI.each(nodes, function (j, node) {
if (node.isLeaf() && i < maxLevel - 1) {
var newNode = new BI.Node(BI.UUID());
newNode.leaf = true;
newNode.width = node.width;
newNode.height = node.height;
newNode.isNew = true;
// 把node向下一层移
var tar = 0;
if (j > 0) {
var c = nodes[j - 1].getLastChild();
tar = levels[i + 1].indexOf(c) + 1;
}
levels[i + 1].splice(tar, 0, newNode);
// 新增一个临时树节点
node.addChild(newNode);
}
adjust[i].push(node);
});
});
return adjust;
},
// 树调整
_adjust: function (adjust) {
while (true) {
var isAllNeedAjust = false;
BI.backEach(adjust, function (i, nodes) {
BI.each(nodes, function (j, node) {
if (!node.isNew) {
var needAdjust = true;
BI.any(node.getChildren(), function (k, n) {
if (!n.isNew) {
needAdjust = false;
return true;
}
});
if (!node.isLeaf() && needAdjust === true) {
var allChilds = [];
BI.each(node.getChildren(), function (k, n) {
allChilds = allChilds.concat(n.getChildren());
});
node.removeAllChilds();
BI.each(allChilds, function (k, c) {
node.addChild(c);
});
var newNode = new BI.Node(BI.UUID());
// newNode.isEmptyRoot = node.isRoot || node.isEmptyRoot;
newNode.isNew = true;
var index = node.parent.getChildIndex(node.id);
node.parent.removeChildByIndex(index);
node.parent.addChild(newNode, index);
newNode.addChild(node);
isAllNeedAjust = true;
}
}
});
});
if (isAllNeedAjust === false) {
break;
} else {// 树重构
adjust = this._stratification();
}
}
return adjust;
},
_calculateWidth: function () {
var o = this.options;
var width = 0;
function track1 (node) {
var w = 0;
if (node.isLeaf()) {
return node.width;
}
BI.each(node.getChildren(), function (i, child) {
w += track1(child);
});
return w;
}
function track2 (node) {
var w = 0;
if (node.isLeaf()) {
return node.height;
}
BI.each(node.getChildren(), function (i, child) {
w += track2(child);
});
return w;
}
if (this._isVertical()) {
width = track1(this.tree.getRoot());
} else {
width = track2(this.tree.getRoot());
}
return width;
},
_isVertical: function () {
var o = this.options;
return o.direction === BI.Direction.Top || o.direction === BI.Direction.Bottom;
},
_calculateHeight: function () {
var o = this.options;
var height = 0;
function track1 (node) {
var h = 0;
BI.each(node.getChildren(), function (i, child) {
h = Math.max(h, track1(child));
});
return h + (node.height || 0);
}
function track2 (node) {
var h = 0;
BI.each(node.getChildren(), function (i, child) {
h = Math.max(h, track2(child));
});
return h + (node.width || 0);
}
if (this._isVertical()) {
height = track1(this.tree.getRoot());
} else {
height = track2(this.tree.getRoot());
}
return height;
},
_calculateXY: function (levels) {
var o = this.options;
var width = this._calculateWidth();
var height = this._calculateHeight();
var levelCount = levels.length;
var allLeavesCount = this._calculateLeaves();
// 计算坐标
var xy = {};
var levelHeight = height / levelCount;
BI.each(levels, function (i, nodes) {
// 计算权重
var weights = [];
BI.each(nodes, function (j, node) {
weights[j] = (node.get("leaves") || 1) / allLeavesCount;
});
BI.each(nodes, function (j, node) {
// 求前j个元素的权重
var weight = BI.sum(weights.slice(0, j));
// 求坐标
var x = weight * width + weights[j] * width / 2;
var y = i * levelHeight + levelHeight / 2;
xy[node.id] = {x: x, y: y};
});
});
return xy;
},
_stroke: function (levels, xy) {
var height = this._calculateHeight();
var levelCount = levels.length;
var levelHeight = height / levelCount;
var self = this, o = this.options;
switch (o.direction) {
case BI.Direction.Top:
BI.each(levels, function (i, nodes) {
BI.each(nodes, function (j, node) {
if (node.getChildrenLength() > 0 && !node.leaf) {
var path = "";
var start = xy[node.id];
var split = start.y + levelHeight / 2;
path += "M" + start.x + "," + (start.y + o.centerOffset) + "L" + start.x + "," + split;
var end = [];
BI.each(node.getChildren(), function (t, c) {
var e = end[t] = xy[c.id];
path += "M" + e.x + "," + (e.y + o.centerOffset) + "L" + e.x + "," + split;
});
if (end.length > 0) {
path += "M" + BI.first(end).x + "," + split + "L" + BI.last(end).x + "," + split;
}
self.svg.path(path).attr("stroke", "#d4dadd");
}
});
});
break;
case BI.Direction.Bottom:
BI.each(levels, function (i, nodes) {
BI.each(nodes, function (j, node) {
if (node.getChildrenLength() > 0 && !node.leaf) {
var path = "";
var start = xy[node.id];
var split = start.y - levelHeight / 2;
path += "M" + start.x + "," + (start.y - o.centerOffset) + "L" + start.x + "," + split;
var end = [];
BI.each(node.getChildren(), function (t, c) {
var e = end[t] = xy[c.id];
path += "M" + e.x + "," + (e.y - o.centerOffset) + "L" + e.x + "," + split;
});
if (end.length > 0) {
path += "M" + BI.first(end).x + "," + split + "L" + BI.last(end).x + "," + split;
}
self.svg.path(path).attr("stroke", "#d4dadd");
}
});
});
break;
case BI.Direction.Left:
BI.each(levels, function (i, nodes) {
BI.each(nodes, function (j, node) {
if (node.getChildrenLength() > 0 && !node.leaf) {
var path = "";
var start = xy[node.id];
var split = start.y + levelHeight / 2;
path += "M" + (start.y + o.centerOffset) + "," + start.x + "L" + split + "," + start.x;
var end = [];
BI.each(node.getChildren(), function (t, c) {
var e = end[t] = xy[c.id];
path += "M" + (e.y + o.centerOffset) + "," + e.x + "L" + split + "," + e.x;
});
if (end.length > 0) {
path += "M" + split + "," + BI.first(end).x + "L" + split + "," + BI.last(end).x;
}
self.svg.path(path).attr("stroke", "#d4dadd");
}
});
});
break;
case BI.Direction.Right:
BI.each(levels, function (i, nodes) {
BI.each(nodes, function (j, node) {
if (node.getChildrenLength() > 0 && !node.leaf) {
var path = "";
var start = xy[node.id];
var split = start.y - levelHeight / 2;
path += "M" + (start.y - o.centerOffset) + "," + start.x + "L" + split + "," + start.x;
var end = [];
BI.each(node.getChildren(), function (t, c) {
var e = end[t] = xy[c.id];
path += "M" + (e.y - o.centerOffset) + "," + e.x + "L" + split + "," + e.x;
});
if (end.length > 0) {
path += "M" + split + "," + BI.first(end).x + "L" + split + "," + BI.last(end).x;
}
self.svg.path(path).attr("stroke", "#d4dadd");
}
});
});
break;
}
},
_createBranches: function (levels) {
var self = this, o = this.options;
if (o.direction === BI.Direction.Bottom || o.direction === BI.Direction.Right) {
levels = levels.reverse();
}
var xy = this._calculateXY(levels);
// 画图
this._stroke(levels, xy);
},
_isNeedAdjust: function () {
var o = this.options;
return o.direction === BI.Direction.Top && o.align === BI.VerticalAlign.Bottom || o.direction === BI.Direction.Bottom && o.align === BI.VerticalAlign.Top
|| o.direction === BI.Direction.Left && o.align === BI.HorizontalAlign.Right || o.direction === BI.Direction.Right && o.align === BI.HorizontalAlign.Left;
},
setValue: function (value) {
},
getValue: function () {
},
populate: function (items) {
var self = this, o = this.options;
o.items = items || [];
this.empty();
items = BI.Tree.transformToTreeFormat(o.items);
this.tree = new BI.Tree();
this.tree.initTree(items);
this.svg = BI.createWidget({
type: "bi.svg"
});
// 树分层
var levels = this._stratification();
if (this._isNeedAdjust()) {
// 树平移
var adjust = this._translate(levels);
// 树调整
adjust = this._adjust(adjust);
this._createBranches(adjust);
} else {
var adjust = this._fill(levels);
this._createBranches(adjust);
}
var container = BI.createWidget({
type: "bi.layout",
width: this._isVertical() ? this._calculateWidth() : this._calculateHeight(),
height: this._isVertical() ? this._calculateHeight() : this._calculateWidth()
});
BI.createWidget({
type: "bi.absolute",
element: container,
items: [{
el: this.svg,
top: 0,
left: 0,
right: 0,
bottom: 0
}]
});
if (this._isVertical()) {
items = [{
type: "bi.handstand_branch_tree",
expander: {
direction: o.direction
},
el: {
layouts: [{
type: "bi.horizontal_adapt",
verticalAlign: o.align
}]
},
items: items
}];
} else {
items = [{
type: "bi.branch_tree",
expander: {
direction: o.direction
},
el: {
layouts: [{
type: "bi.vertical"
}, {
type: o.align === BI.HorizontalAlign.Left ? "bi.left" : "bi.right"
}]
},
items: items
}];
}
BI.createWidget({
type: "bi.adaptive",
element: container,
items: items
});
BI.createWidget({
type: "bi.center_adapt",
scrollable: true,
element: this,
items: [container]
});
}
});
BI.BranchRelation.EVENT_CHANGE = "BranchRelation.EVENT_CHANGE";
BI.shortcut("bi.branch_relation", BI.BranchRelation);

60
src/case/tree/expander/expander.branch.handstand.js

@ -1,60 +0,0 @@
/**
* 倒立的Branch
* @class BI.HandStandBranchExpander
* @extend BI.Widget
* create by young
*/
BI.HandStandBranchExpander = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.HandStandBranchExpander.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-handstand-branch-expander",
direction: BI.Direction.Top,
logic: {
dynamic: true
},
el: {type: "bi.label"},
popup: {}
});
},
_init: function () {
BI.HandStandBranchExpander.superclass._init.apply(this, arguments);
var o = this.options;
this._initExpander();
this._initBranchView();
BI.createWidget(BI.extend({
element: this
}, BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(o.direction), BI.extend({}, o.logic, {
items: BI.LogicFactory.createLogicItemsByDirection(o.direction, {
type: "bi.center_adapt",
items: [this.expander]
}, this.branchView)
}))));
},
_initExpander: function () {
var self = this, o = this.options;
this.expander = BI.createWidget(o.el);
this.expander.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
},
_initBranchView: function () {
var self = this, o = this.options;
this.branchView = BI.createWidget(o.popup, {});
this.branchView.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
},
populate: function (items) {
this.branchView.populate.apply(this.branchView, arguments);
},
getValue: function () {
return this.branchView.getValue();
}
});
BI.HandStandBranchExpander.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.handstand_branch_expander", BI.HandStandBranchExpander);

60
src/case/tree/expander/expander.branch.js

@ -1,60 +0,0 @@
/**
* @class BI.BranchExpander
* @extend BI.Widget
* create by young
*/
BI.BranchExpander = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.BranchExpander.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-branch-expander",
direction: BI.Direction.Left,
logic: {
dynamic: true
},
el: {},
popup: {}
});
},
_init: function () {
BI.BranchExpander.superclass._init.apply(this, arguments);
var o = this.options;
this._initExpander();
this._initBranchView();
BI.createWidget(BI.extend({
element: this
}, BI.LogicFactory.createLogic(BI.LogicFactory.createLogicTypeByDirection(o.direction), BI.extend({}, o.logic, {
items: BI.LogicFactory.createLogicItemsByDirection(o.direction, this.expander, this.branchView)
}))));
},
_initExpander: function () {
var self = this, o = this.options;
this.expander = BI.createWidget(o.el, {
type: "bi.label",
width: 30,
height: "100%"
});
this.expander.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
},
_initBranchView: function () {
var self = this, o = this.options;
this.branchView = BI.createWidget(o.popup, {});
this.branchView.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
},
populate: function (items) {
this.branchView.populate.apply(this.branchView, arguments);
},
getValue: function () {
return this.branchView.getValue();
}
});
BI.BranchExpander.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.branch_expander", BI.BranchExpander);

55
src/case/tree/tree.branch.handstand.js

@ -1,55 +0,0 @@
/**
* @class BI.HandStandBranchTree
* @extends BI.Widget
* create by young
* 横向分支的树
*/
BI.HandStandBranchTree = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.HandStandBranchTree.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-handstand-branch-tree",
expander: {},
el: {},
items: []
});
},
_init: function () {
BI.HandStandBranchTree.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.branchTree = BI.createWidget({
type: "bi.custom_tree",
element: this,
expander: BI.extend({
type: "bi.handstand_branch_expander",
el: {},
popup: {
type: "bi.custom_tree"
}
}, o.expander),
el: BI.extend({
type: "bi.button_tree",
chooseType: BI.ButtonGroup.CHOOSE_TYPE_MULTI,
layouts: [{
type: "bi.horizontal_adapt"
}]
}, o.el),
items: this.options.items
});
this.branchTree.on(BI.CustomTree.EVENT_CHANGE, function () {
self.fireEvent(BI.HandStandBranchTree.EVENT_CHANGE, arguments);
});
this.branchTree.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
},
populate: function () {
this.branchTree.populate.apply(this.branchTree, arguments);
},
getValue: function () {
return this.branchTree.getValue();
}
});
BI.HandStandBranchTree.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.handstand_branch_tree", BI.HandStandBranchTree);

55
src/case/tree/tree.branch.js

@ -1,55 +0,0 @@
/**
* @class BI.BranchTree
* @extends BI.Widget
* create by young
* 横向分支的树
*/
BI.BranchTree = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.BranchTree.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-branch-tree",
expander: {},
el: {},
items: []
});
},
_init: function () {
BI.BranchTree.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.branchTree = BI.createWidget({
type: "bi.custom_tree",
element: this,
expander: BI.extend({
type: "bi.branch_expander",
el: {},
popup: {
type: "bi.custom_tree"
}
}, o.expander),
el: BI.extend({
type: "bi.button_tree",
chooseType: BI.ButtonGroup.CHOOSE_TYPE_MULTI,
layouts: [{
type: "bi.vertical"
}]
}, o.el),
items: this.options.items
});
this.branchTree.on(BI.CustomTree.EVENT_CHANGE, function () {
self.fireEvent(BI.BranchTree.EVENT_CHANGE, arguments);
});
this.branchTree.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
});
},
populate: function () {
this.branchTree.populate.apply(this.branchTree, arguments);
},
getValue: function () {
return this.branchTree.getValue();
}
});
BI.BranchTree.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.branch_tree", BI.BranchTree);

130
src/core/utils/base64.js

@ -1,130 +0,0 @@
!(function () {
var _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
// private method for UTF-8 encoding
var _utf8_encode = function (string) {
string = string.replace(/\r\n/g, "\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
} else if ((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
} else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
};
// private method for UTF-8 decoding
var _utf8_decode = function (utftext) {
var string = "";
var i = 0;
var c = 0, c3 = 0, c2 = 0;
while (i < utftext.length) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
} else if ((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i + 1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
} else {
c2 = utftext.charCodeAt(i + 1);
c3 = utftext.charCodeAt(i + 2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return string;
};
_.extend(BI, {
encode: function (input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = _utf8_encode(input);
while (i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
output = output + _keyStr.charAt(enc1) + _keyStr.charAt(enc2) + _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
}
return output;
},
// public method for decoding
decode: function (input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length) {
enc1 = _keyStr.indexOf(input.charAt(i++));
enc2 = _keyStr.indexOf(input.charAt(i++));
enc3 = _keyStr.indexOf(input.charAt(i++));
enc4 = _keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {
output = output + String.fromCharCode(chr3);
}
}
output = _utf8_decode(output);
return output;
}
});
})();

263
src/core/utils/helper.scroll.js

@ -1,263 +0,0 @@
(function () {
var clamp = function (min, value, max) {
if (value < min) {
return min;
}
if (value > max) {
return max;
}
return value;
};
var BUFFER_ROWS = 5;
var NO_ROWS_SCROLL_RESULT = {
index: 0,
offset: 0,
position: 0,
contentHeight: 0
};
BI.TableScrollHelper = function (rowCount,
defaultRowHeight,
viewportHeight,
rowHeightGetter) {
this._rowOffsets = BI.PrefixIntervalTree.uniform(rowCount, defaultRowHeight);
this._storedHeights = new Array(rowCount);
for (var i = 0; i < rowCount; ++i) {
this._storedHeights[i] = defaultRowHeight;
}
this._rowCount = rowCount;
this._position = 0;
this._contentHeight = rowCount * defaultRowHeight;
this._defaultRowHeight = defaultRowHeight;
this._rowHeightGetter = rowHeightGetter ?
rowHeightGetter : function () {
return defaultRowHeight;
};
this._viewportHeight = viewportHeight;
this._updateHeightsInViewport(0, 0);
};
BI.TableScrollHelper.prototype = {
constructor: BI.TableScrollHelper,
setRowHeightGetter: function (rowHeightGetter) {
this._rowHeightGetter = rowHeightGetter;
},
setViewportHeight: function (viewportHeight) {
this._viewportHeight = viewportHeight;
},
getContentHeight: function () {
return this._contentHeight;
},
_updateHeightsInViewport: function (firstRowIndex,
firstRowOffset) {
var top = firstRowOffset;
var index = firstRowIndex;
while (top <= this._viewportHeight && index < this._rowCount) {
this._updateRowHeight(index);
top += this._storedHeights[index];
index++;
}
},
_updateHeightsAboveViewport: function (firstRowIndex) {
var index = firstRowIndex - 1;
while (index >= 0 && index >= firstRowIndex - BUFFER_ROWS) {
var delta = this._updateRowHeight(index);
this._position += delta;
index--;
}
},
_updateRowHeight: function (rowIndex) {
if (rowIndex < 0 || rowIndex >= this._rowCount) {
return 0;
}
var newHeight = this._rowHeightGetter(rowIndex);
if (newHeight !== this._storedHeights[rowIndex]) {
var change = newHeight - this._storedHeights[rowIndex];
this._rowOffsets.set(rowIndex, newHeight);
this._storedHeights[rowIndex] = newHeight;
this._contentHeight += change;
return change;
}
return 0;
},
getRowPosition: function (rowIndex) {
this._updateRowHeight(rowIndex);
return this._rowOffsets.sumUntil(rowIndex);
},
scrollBy: function (delta) {
if (this._rowCount === 0) {
return NO_ROWS_SCROLL_RESULT;
}
var firstRow = this._rowOffsets.greatestLowerBound(this._position);
firstRow = clamp(firstRow, 0, Math.max(this._rowCount - 1, 0));
var firstRowPosition = this._rowOffsets.sumUntil(firstRow);
var rowIndex = firstRow;
var position = this._position;
var rowHeightChange = this._updateRowHeight(rowIndex);
if (firstRowPosition !== 0) {
position += rowHeightChange;
}
var visibleRowHeight = this._storedHeights[rowIndex] -
(position - firstRowPosition);
if (delta >= 0) {
while (delta > 0 && rowIndex < this._rowCount) {
if (delta < visibleRowHeight) {
position += delta;
delta = 0;
} else {
delta -= visibleRowHeight;
position += visibleRowHeight;
rowIndex++;
}
if (rowIndex < this._rowCount) {
this._updateRowHeight(rowIndex);
visibleRowHeight = this._storedHeights[rowIndex];
}
}
} else if (delta < 0) {
delta = -delta;
var invisibleRowHeight = this._storedHeights[rowIndex] - visibleRowHeight;
while (delta > 0 && rowIndex >= 0) {
if (delta < invisibleRowHeight) {
position -= delta;
delta = 0;
} else {
position -= invisibleRowHeight;
delta -= invisibleRowHeight;
rowIndex--;
}
if (rowIndex >= 0) {
var change = this._updateRowHeight(rowIndex);
invisibleRowHeight = this._storedHeights[rowIndex];
position += change;
}
}
}
var maxPosition = this._contentHeight - this._viewportHeight;
position = clamp(position, 0, maxPosition);
this._position = position;
var firstRowIndex = this._rowOffsets.greatestLowerBound(position);
firstRowIndex = clamp(firstRowIndex, 0, Math.max(this._rowCount - 1, 0));
firstRowPosition = this._rowOffsets.sumUntil(firstRowIndex);
var firstRowOffset = firstRowPosition - position;
this._updateHeightsInViewport(firstRowIndex, firstRowOffset);
this._updateHeightsAboveViewport(firstRowIndex);
return {
index: firstRowIndex,
offset: firstRowOffset,
position: this._position,
contentHeight: this._contentHeight
};
},
_getRowAtEndPosition: function (rowIndex) {
// We need to update enough rows above the selected one to be sure that when
// we scroll to selected position all rows between first shown and selected
// one have most recent heights computed and will not resize
this._updateRowHeight(rowIndex);
var currentRowIndex = rowIndex;
var top = this._storedHeights[currentRowIndex];
while (top < this._viewportHeight && currentRowIndex >= 0) {
currentRowIndex--;
if (currentRowIndex >= 0) {
this._updateRowHeight(currentRowIndex);
top += this._storedHeights[currentRowIndex];
}
}
var position = this._rowOffsets.sumTo(rowIndex) - this._viewportHeight;
if (position < 0) {
position = 0;
}
return position;
},
scrollTo: function (position) {
if (this._rowCount === 0) {
return NO_ROWS_SCROLL_RESULT;
}
if (position <= 0) {
// If position less than or equal to 0 first row should be fully visible
// on top
this._position = 0;
this._updateHeightsInViewport(0, 0);
return {
index: 0,
offset: 0,
position: this._position,
contentHeight: this._contentHeight
};
} else if (position >= this._contentHeight - this._viewportHeight) {
// If position is equal to or greater than max scroll value, we need
// to make sure to have bottom border of last row visible.
var rowIndex = this._rowCount - 1;
position = this._getRowAtEndPosition(rowIndex);
}
this._position = position;
var firstRowIndex = this._rowOffsets.greatestLowerBound(position);
firstRowIndex = clamp(firstRowIndex, 0, Math.max(this._rowCount - 1, 0));
var firstRowPosition = this._rowOffsets.sumUntil(firstRowIndex);
var firstRowOffset = firstRowPosition - position;
this._updateHeightsInViewport(firstRowIndex, firstRowOffset);
this._updateHeightsAboveViewport(firstRowIndex);
return {
index: firstRowIndex,
offset: firstRowOffset,
position: this._position,
contentHeight: this._contentHeight
};
},
/**
* Allows to scroll to selected row with specified offset. It always
* brings that row to top of viewport with that offset
*/
scrollToRow: function (rowIndex, offset) {
rowIndex = clamp(rowIndex, 0, Math.max(this._rowCount - 1, 0));
offset = clamp(offset, -this._storedHeights[rowIndex], 0);
var firstRow = this._rowOffsets.sumUntil(rowIndex);
return this.scrollTo(firstRow - offset);
},
/**
* Allows to scroll to selected row by bringing it to viewport with minimal
* scrolling. This that if row is fully visible, scroll will not be changed.
* If top border of row is above top of viewport it will be scrolled to be
* fully visible on the top of viewport. If the bottom border of row is
* below end of viewport, it will be scrolled up to be fully visible on the
* bottom of viewport.
*/
scrollRowIntoView: function (rowIndex) {
rowIndex = clamp(rowIndex, 0, Math.max(this._rowCount - 1, 0));
var rowBegin = this._rowOffsets.sumUntil(rowIndex);
var rowEnd = rowBegin + this._storedHeights[rowIndex];
if (rowBegin < this._position) {
return this.scrollTo(rowBegin);
} else if (this._position + this._viewportHeight < rowEnd) {
var position = this._getRowAtEndPosition(rowIndex);
return this.scrollTo(position);
}
return this.scrollTo(this._position);
}
};
})();

145
src/core/utils/integerBufferSet.js

@ -1,145 +0,0 @@
// Data structure that allows to store values and assign positions to them
// in a way to minimize changing positions of stored values when new ones are
// added or when some values are replaced. Stored elements are alwasy assigned
// a consecutive set of positoins startin from 0 up to count of elements less 1
// Following actions can be executed
// * get position assigned to given value (null if value is not stored)
// * create new entry for new value and get assigned position back
// * replace value that is furthest from specified value range with new value
// and get it's position back
// All operations take amortized log(n) time where n is number of elements in
// the set.
BI.IntegerBufferSet = function () {
this._valueToPositionMap = {};
this._size = 0;
this._smallValues = new BI.Heap(
[], // Initial data in the heap
this._smallerComparator
);
this._largeValues = new BI.Heap(
[], // Initial data in the heap
this._greaterComparator
);
};
BI.IntegerBufferSet.prototype = {
constructor: BI.IntegerBufferSet,
getSize: function () /* number*/ {
return this._size;
},
getValuePosition: function (/* number*/ value) /* ?number*/ {
if (this._valueToPositionMap[value] === undefined) {
return null;
}
return this._valueToPositionMap[value];
},
getNewPositionForValue: function (/* number*/ value) /* number*/ {
var newPosition = this._size;
this._size++;
this._pushToHeaps(newPosition, value);
this._valueToPositionMap[value] = newPosition;
return newPosition;
},
replaceFurthestValuePosition: function (/* number*/ lowValue,
/* number*/ highValue,
/* number*/ newValue) /* ?number*/ {
this._cleanHeaps();
if (this._smallValues.empty() || this._largeValues.empty()) {
// Threre are currently no values stored. We will have to create new
// position for this value.
return null;
}
var minValue = this._smallValues.peek().value;
var maxValue = this._largeValues.peek().value;
if (minValue >= lowValue && maxValue <= highValue) {
// All values currently stored are necessary, we can't reuse any of them.
return null;
}
var valueToReplace;
if (lowValue - minValue > maxValue - highValue) {
// minValue is further from provided range. We will reuse it's position.
valueToReplace = minValue;
this._smallValues.pop();
} else {
valueToReplace = maxValue;
this._largeValues.pop();
}
var position = this._valueToPositionMap[valueToReplace];
delete this._valueToPositionMap[valueToReplace];
this._valueToPositionMap[newValue] = position;
this._pushToHeaps(position, newValue);
return position;
},
_pushToHeaps: function (/* number*/ position, /* number*/ value) {
var element = {
position: position,
value: value
};
// We can reuse the same object in both heaps, because we don't mutate them
this._smallValues.push(element);
this._largeValues.push(element);
},
_cleanHeaps: function () {
// We not usually only remove object from one heap while moving value.
// Here we make sure that there is no stale data on top of heaps.
this._cleanHeap(this._smallValues);
this._cleanHeap(this._largeValues);
var minHeapSize =
Math.min(this._smallValues.size(), this._largeValues.size());
var maxHeapSize =
Math.max(this._smallValues.size(), this._largeValues.size());
if (maxHeapSize > 10 * minHeapSize) {
// There are many old values in one of heaps. We nned to get rid of them
// to not use too avoid memory leaks
this._recreateHeaps();
}
},
_recreateHeaps: function () {
var sourceHeap = this._smallValues.size() < this._largeValues.size() ?
this._smallValues :
this._largeValues;
var newSmallValues = new Heap(
[], // Initial data in the heap
this._smallerComparator
);
var newLargeValues = new Heap(
[], // Initial datat in the heap
this._greaterComparator
);
while (!sourceHeap.empty()) {
var element = sourceHeap.pop();
// Push all stil valid elements to new heaps
if (this._valueToPositionMap[element.value] !== undefined) {
newSmallValues.push(element);
newLargeValues.push(element);
}
}
this._smallValues = newSmallValues;
this._largeValues = newLargeValues;
},
_cleanHeap: function (/* object*/ heap) {
while (!heap.empty() &&
this._valueToPositionMap[heap.peek().value] === undefined) {
heap.pop();
}
},
_smallerComparator: function (/* object*/ lhs, /* object*/ rhs) /* boolean*/ {
return lhs.value < rhs.value;
},
_greaterComparator: function (/* object*/ lhs, /* object*/ rhs) /* boolean*/ {
return lhs.value > rhs.value;
}
};

240
src/core/utils/md5.js

@ -1,240 +0,0 @@
!(function () {
var MD5 = function (hexcase) {
this.hexcase = !hexcase ? 0 : 1;
/* hex output format. 0 - lowercase; 1 - uppercase */
this.b64pad = "";
/* base-64 pad character. "=" for strict RFC compliance */
this.chrsz = 8;
/* bits per input character. 8 - ASCII; 16 - Unicode */
};
/*
* These are the functions you'll usually want to call
* They take string arguments and return either hex or base-64 encoded strings
*/
MD5.prototype.hex_md5 = function (s) {
return this.binl2hex(this.core_md5(this.str2binl(s), s.length * this.chrsz));
};
MD5.prototype.hex_md5_salt = function (s) {
var md5ed = this.hex_md5(s);
var items1 = [];
var items2 = [];
for (var i = 0; i < md5ed.length; i++) {
if (i % 2 === 0) {
items1.push(md5ed.charAt(i));
} else {
items2.push(md5ed.charAt(i));
}
}
var result = ":" + items1.join("") + items2.join("");
return result;
};
MD5.prototype.b64_md5 = function (s) {
return this.binl2b64(this.core_md5(this.str2binl(s), s.length * this.chrsz));
};
MD5.prototype.hex_hmac_md5 = function (key, data) {
return this.binl2hex(this.core_hmac_md5(key, data));
};
MD5.prototype.b64_hmac_md5 = function (key, data) {
return this.binl2b64(this.core_hmac_md5(key, data));
};
/* Backwards compatibility - same as hex_md5() */
MD5.prototype.calcMD5 = function (s) {
return this.binl2hex(this.core_md5(this.str2binl(s), s.length * this.chrsz));
};
MD5.prototype.core_md5 = function (x, len) {
/* append padding */
x[len >> 5] |= 0x80 << ((len) % 32);
x[(((len + 64) >>> 9) << 4) + 14] = len;
var a = 1732584193;
var b = -271733879;
var c = -1732584194;
var d = 271733878;
for (var i = 0; i < x.length; i += 16) {
var olda = a;
var oldb = b;
var oldc = c;
var oldd = d;
a = this.md5_ff(a, b, c, d, x[i + 0], 7, -680876936);
d = this.md5_ff(d, a, b, c, x[i + 1], 12, -389564586);
c = this.md5_ff(c, d, a, b, x[i + 2], 17, 606105819);
b = this.md5_ff(b, c, d, a, x[i + 3], 22, -1044525330);
a = this.md5_ff(a, b, c, d, x[i + 4], 7, -176418897);
d = this.md5_ff(d, a, b, c, x[i + 5], 12, 1200080426);
c = this.md5_ff(c, d, a, b, x[i + 6], 17, -1473231341);
b = this.md5_ff(b, c, d, a, x[i + 7], 22, -45705983);
a = this.md5_ff(a, b, c, d, x[i + 8], 7, 1770035416);
d = this.md5_ff(d, a, b, c, x[i + 9], 12, -1958414417);
c = this.md5_ff(c, d, a, b, x[i + 10], 17, -42063);
b = this.md5_ff(b, c, d, a, x[i + 11], 22, -1990404162);
a = this.md5_ff(a, b, c, d, x[i + 12], 7, 1804603682);
d = this.md5_ff(d, a, b, c, x[i + 13], 12, -40341101);
c = this.md5_ff(c, d, a, b, x[i + 14], 17, -1502002290);
b = this.md5_ff(b, c, d, a, x[i + 15], 22, 1236535329);
a = this.md5_gg(a, b, c, d, x[i + 1], 5, -165796510);
d = this.md5_gg(d, a, b, c, x[i + 6], 9, -1069501632);
c = this.md5_gg(c, d, a, b, x[i + 11], 14, 643717713);
b = this.md5_gg(b, c, d, a, x[i + 0], 20, -373897302);
a = this.md5_gg(a, b, c, d, x[i + 5], 5, -701558691);
d = this.md5_gg(d, a, b, c, x[i + 10], 9, 38016083);
c = this.md5_gg(c, d, a, b, x[i + 15], 14, -660478335);
b = this.md5_gg(b, c, d, a, x[i + 4], 20, -405537848);
a = this.md5_gg(a, b, c, d, x[i + 9], 5, 568446438);
d = this.md5_gg(d, a, b, c, x[i + 14], 9, -1019803690);
c = this.md5_gg(c, d, a, b, x[i + 3], 14, -187363961);
b = this.md5_gg(b, c, d, a, x[i + 8], 20, 1163531501);
a = this.md5_gg(a, b, c, d, x[i + 13], 5, -1444681467);
d = this.md5_gg(d, a, b, c, x[i + 2], 9, -51403784);
c = this.md5_gg(c, d, a, b, x[i + 7], 14, 1735328473);
b = this.md5_gg(b, c, d, a, x[i + 12], 20, -1926607734);
a = this.md5_hh(a, b, c, d, x[i + 5], 4, -378558);
d = this.md5_hh(d, a, b, c, x[i + 8], 11, -2022574463);
c = this.md5_hh(c, d, a, b, x[i + 11], 16, 1839030562);
b = this.md5_hh(b, c, d, a, x[i + 14], 23, -35309556);
a = this.md5_hh(a, b, c, d, x[i + 1], 4, -1530992060);
d = this.md5_hh(d, a, b, c, x[i + 4], 11, 1272893353);
c = this.md5_hh(c, d, a, b, x[i + 7], 16, -155497632);
b = this.md5_hh(b, c, d, a, x[i + 10], 23, -1094730640);
a = this.md5_hh(a, b, c, d, x[i + 13], 4, 681279174);
d = this.md5_hh(d, a, b, c, x[i + 0], 11, -358537222);
c = this.md5_hh(c, d, a, b, x[i + 3], 16, -722521979);
b = this.md5_hh(b, c, d, a, x[i + 6], 23, 76029189);
a = this.md5_hh(a, b, c, d, x[i + 9], 4, -640364487);
d = this.md5_hh(d, a, b, c, x[i + 12], 11, -421815835);
c = this.md5_hh(c, d, a, b, x[i + 15], 16, 530742520);
b = this.md5_hh(b, c, d, a, x[i + 2], 23, -995338651);
a = this.md5_ii(a, b, c, d, x[i + 0], 6, -198630844);
d = this.md5_ii(d, a, b, c, x[i + 7], 10, 1126891415);
c = this.md5_ii(c, d, a, b, x[i + 14], 15, -1416354905);
b = this.md5_ii(b, c, d, a, x[i + 5], 21, -57434055);
a = this.md5_ii(a, b, c, d, x[i + 12], 6, 1700485571);
d = this.md5_ii(d, a, b, c, x[i + 3], 10, -1894986606);
c = this.md5_ii(c, d, a, b, x[i + 10], 15, -1051523);
b = this.md5_ii(b, c, d, a, x[i + 1], 21, -2054922799);
a = this.md5_ii(a, b, c, d, x[i + 8], 6, 1873313359);
d = this.md5_ii(d, a, b, c, x[i + 15], 10, -30611744);
c = this.md5_ii(c, d, a, b, x[i + 6], 15, -1560198380);
b = this.md5_ii(b, c, d, a, x[i + 13], 21, 1309151649);
a = this.md5_ii(a, b, c, d, x[i + 4], 6, -145523070);
d = this.md5_ii(d, a, b, c, x[i + 11], 10, -1120210379);
c = this.md5_ii(c, d, a, b, x[i + 2], 15, 718787259);
b = this.md5_ii(b, c, d, a, x[i + 9], 21, -343485551);
a = this.safe_add(a, olda);
b = this.safe_add(b, oldb);
c = this.safe_add(c, oldc);
d = this.safe_add(d, oldd);
}
return Array(a, b, c, d);
};
/*
* These functions implement the four basic operations the algorithm uses.
*/
MD5.prototype.md5_cmn = function (q, a, b, x, s, t) {
return this.safe_add(this.bit_rol(this.safe_add(this.safe_add(a, q), this.safe_add(x, t)), s), b);
};
MD5.prototype.md5_ff = function (a, b, c, d, x, s, t) {
return this.md5_cmn((b & c) | ((~b) & d), a, b, x, s, t);
};
MD5.prototype.md5_gg = function (a, b, c, d, x, s, t) {
return this.md5_cmn((b & d) | (c & (~d)), a, b, x, s, t);
};
MD5.prototype.md5_hh = function (a, b, c, d, x, s, t) {
return this.md5_cmn(b ^ c ^ d, a, b, x, s, t);
};
MD5.prototype.md5_ii = function (a, b, c, d, x, s, t) {
return this.md5_cmn(c ^ (b | (~d)), a, b, x, s, t);
};
/*
* Calculate the HMAC-MD5, of a key and some data
*/
MD5.prototype.core_hmac_md5 = function (key, data) {
var bkey = this.str2binl(key);
if (bkey.length > 16) {bkey = this.core_md5(bkey, key.length * this.chrsz);}
var ipad = Array(16), opad = Array(16);
for (var i = 0; i < 16; i++) {
ipad[i] = bkey[i] ^ 0x36363636;
opad[i] = bkey[i] ^ 0x5C5C5C5C;
}
var hash = this.core_md5(ipad.concat(this.str2binl(data)), 512 + data.length * this.chrsz);
return this.core_md5(opad.concat(hash), 512 + 128);
};
/*
* Add integers, wrapping at 2^32. This uses 16-bit operations internally
* to work around bugs in some JS interpreters.
*/
MD5.prototype.safe_add = function (x, y) {
var lsw = (x & 0xFFFF) + (y & 0xFFFF);
var msw = (x >> 16) + (y >> 16) + (lsw >> 16);
return (msw << 16) | (lsw & 0xFFFF);
};
/*
* Bitwise rotate a 32-bit number to the left.
*/
MD5.prototype.bit_rol = function (num, cnt) {
return (num << cnt) | (num >>> (32 - cnt));
};
/*
* Convert a string to an array of little-endian words
* If chrsz is ASCII, characters >255 have their hi-byte silently ignored.
*/
MD5.prototype.str2binl = function (str) {
var bin = Array();
var mask = (1 << this.chrsz) - 1;
for (var i = 0; i < str.length * this.chrsz; i += this.chrsz) {bin[i >> 5] |= (str.charCodeAt(i / this.chrsz) & mask) << (i % 32);}
return bin;
};
/*
* Convert an array of little-endian words to a hex string.
*/
MD5.prototype.binl2hex = function (binarray) {
var hex_tab = this.hexcase ? "0123456789ABCDEF" : "0123456789abcdef";
var str = "";
for (var i = 0; i < binarray.length * 4; i++) {
str += hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8 + 4)) & 0xF)
+ hex_tab.charAt((binarray[i >> 2] >> ((i % 4) * 8)) & 0xF);
}
return str;
};
/*
* Convert an array of little-endian words to a base-64 string
*/
MD5.prototype.binl2b64 = function (binarray) {
var tab = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
var str = "";
for (var i = 0; i < binarray.length * 4; i += 3) {
var triplet = (((binarray[i >> 2] >> 8 * (i % 4)) & 0xFF) << 16)
| (((binarray[i + 1 >> 2] >> 8 * ((i + 1) % 4)) & 0xFF) << 8)
| ((binarray[i + 2 >> 2] >> 8 * ((i + 2) % 4)) & 0xFF);
for (var j = 0; j < 4; j++) {
if (i * 8 + j * 6 > binarray.length * 32) {str += this.b64pad;} else {str += tab.charAt((triplet >> 6 * (3 - j)) & 0x3F);}
}
}
return str;
};
BI.MD5 = new MD5();
})();

119
src/core/utils/tableRowBuffer.js

@ -1,119 +0,0 @@
(function () {
var clamp = function (value, min, max) {
if (value < min) {
return min;
}
if (value > max) {
return max;
}
return value;
};
var MIN_BUFFER_ROWS = 6;
var MAX_BUFFER_ROWS = 10;
BI.TableRowBuffer = function (rowsCount,
defaultRowHeight,
viewportHeight,
rowHeightGetter) {
this._bufferSet = new BI.IntegerBufferSet();
this._defaultRowHeight = defaultRowHeight;
this._viewportRowsBegin = 0;
this._viewportRowsEnd = 0;
this._maxVisibleRowCount = Math.ceil(viewportHeight / defaultRowHeight) + 1;
// this._bufferRowsCount = Math.floor(this._maxVisibleRowCount / 2);
this._bufferRowsCount = clamp(
Math.floor(this._maxVisibleRowCount / 2),
MIN_BUFFER_ROWS,
MAX_BUFFER_ROWS
);
this._rowsCount = rowsCount;
this._rowHeightGetter = rowHeightGetter;
this._rows = [];
this._viewportHeight = viewportHeight;
};
BI.TableRowBuffer.prototype = {
constructor: BI.TableRowBuffer,
getRowsWithUpdatedBuffer: function () {
var remainingBufferRows = 2 * this._bufferRowsCount;
var bufferRowIndex =
Math.max(this._viewportRowsBegin - this._bufferRowsCount, 0);
while (bufferRowIndex < this._viewportRowsBegin) {
this._addRowToBuffer(
bufferRowIndex,
this._viewportRowsBegin,
this._viewportRowsEnd - 1
);
bufferRowIndex++;
remainingBufferRows--;
}
bufferRowIndex = this._viewportRowsEnd;
while (bufferRowIndex < this._rowsCount && remainingBufferRows > 0) {
this._addRowToBuffer(
bufferRowIndex,
this._viewportRowsBegin,
this._viewportRowsEnd - 1
);
bufferRowIndex++;
remainingBufferRows--;
}
return this._rows;
},
getRows: function (firstRowIndex,
firstRowOffset) {
var top = firstRowOffset;
var totalHeight = top;
var rowIndex = firstRowIndex;
var endIndex =
Math.min(firstRowIndex + this._maxVisibleRowCount, this._rowsCount);
this._viewportRowsBegin = firstRowIndex;
while (rowIndex < endIndex ||
(totalHeight < this._viewportHeight && rowIndex < this._rowsCount)) {
this._addRowToBuffer(
rowIndex,
firstRowIndex,
endIndex - 1
);
totalHeight += this._rowHeightGetter(rowIndex);
++rowIndex;
// Store index after the last viewport row as end, to be able to
// distinguish when there are no rows rendered in viewport
this._viewportRowsEnd = rowIndex;
}
return this._rows;
},
_addRowToBuffer: function (rowIndex,
firstViewportRowIndex,
lastViewportRowIndex) {
var rowPosition = this._bufferSet.getValuePosition(rowIndex);
var viewportRowsCount = lastViewportRowIndex - firstViewportRowIndex + 1;
var allowedRowsCount = viewportRowsCount + this._bufferRowsCount * 2;
if (rowPosition === null &&
this._bufferSet.getSize() >= allowedRowsCount) {
rowPosition =
this._bufferSet.replaceFurthestValuePosition(
firstViewportRowIndex,
lastViewportRowIndex,
rowIndex
);
}
if (rowPosition === null) {
// We can't reuse any of existing positions for this row. We have to
// create new position
rowPosition = this._bufferSet.getNewPositionForValue(rowIndex);
this._rows[rowPosition] = rowIndex;
} else {
// This row already is in the table with rowPosition position or it
// can replace row that is in that position
this._rows[rowPosition] = rowIndex;
}
}
};
})();

10
src/css/base/combo/combo.css

@ -12,7 +12,7 @@
position: absolute;
width: 6px;
height: 6px;
margin-left: 3px;
margin-left: 2px;
margin-top: -3px;
content: "";
transform: rotate(-45deg);
@ -27,7 +27,7 @@
position: absolute;
width: 6px;
height: 6px;
margin-left: 3px;
margin-left: 2px;
margin-top: 3px;
content: "";
transform: rotate(135deg);
@ -58,12 +58,12 @@
width: 6px;
height: 6px;
margin-left: 3px;
margin-top: 3px;
margin-top: 2px;
content: "";
transform: rotate(-135deg);
}
.bi-bubble-combo .bubble-combo-triangle-left:before,
.bi-bubble-combo.bubble-combo-triangle-right:before,
.bi-bubble-combo .bubble-combo-triangle-right:before,
.bi-bubble-combo .bubble-combo-triangle-top:before,
.bi-bubble-combo .bubble-combo-triangle-bottom:before {
background-color: #ffffff;
@ -71,7 +71,7 @@
border-right: 1px solid #f2f4f7;
}
.bi-theme-dark .bi-bubble-combo .bubble-combo-triangle-left:before,
.bi-theme-dark .bi-bubble-combo.bubble-combo-triangle-right:before,
.bi-theme-dark .bi-bubble-combo .bubble-combo-triangle-right:before,
.bi-theme-dark .bi-bubble-combo .bubble-combo-triangle-top:before,
.bi-theme-dark .bi-bubble-combo .bubble-combo-triangle-bottom:before {
background-color: #242640;

274
src/css/base/table/table.css

@ -1,274 +0,0 @@
.bi-collection-table-cell {
-webkit-box-sizing: border-box;
/*Safari3.2+*/
-moz-box-sizing: border-box;
/*Firefox3.5+*/
-ms-box-sizing: border-box;
/*IE8*/
box-sizing: border-box;
/*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/
}
.bi-collection-table-cell.first-row {
border-top: 1px solid #e8eaed;
}
.bi-collection-table-cell.first-col {
border-left: 1px solid #e8eaed;
}
.bi-theme-dark .bi-collection-table-cell.first-row {
border-top: 1px solid #3a3c53;
}
.bi-theme-dark .bi-collection-table-cell.first-col {
border-left: 1px solid #3a3c53;
}
.bi-quick-collection-table > div > .bi-collection {
overflow: hidden !important;
overflow-x: hidden !important;
overflow-y: hidden !important;
}
.bi-grid-table-cell {
-webkit-box-sizing: border-box;
/*Safari3.2+*/
-moz-box-sizing: border-box;
/*Firefox3.5+*/
-ms-box-sizing: border-box;
/*IE8*/
box-sizing: border-box;
/*W3C标准(IE9+,Safari5.1+,Chrome10.0+,Opera10.6+都符合box-sizing的w3c标准语法)*/
}
.bi-grid-table-cell.first-row {
border-top: 1px solid #e8eaed;
}
.bi-grid-table-cell.first-col {
border-left: 1px solid #e8eaed;
}
.bi-theme-dark .bi-grid-table-cell.first-row {
border-top: 1px solid #3a3c53;
}
.bi-theme-dark .bi-grid-table-cell.first-col {
border-left: 1px solid #3a3c53;
}
.scrollbar-layout-main {
box-sizing: border-box;
outline: none;
overflow: hidden;
position: absolute;
transition-duration: 250ms;
transition-timing-function: ease;
user-select: none;
background-color: rgba(135, 141, 159, 0.05);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d878d9f,endColorstr=#0d878d9f);
border-radius: 5px;
}
.bi-theme-dark .scrollbar-layout-main {
background-color: rgba(208, 212, 218, 0.05);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dd0d4da,endColorstr=#0dd0d4da);
}
.scrollbar-layout-main-vertical {
bottom: 0;
right: 0;
top: 0;
transition-property: background-color;
width: 10px;
}
.scrollbar-layout-main-vertical.public-scrollbar-main-active,
.scrollbar-layout-main-vertical:hover {
width: 10px;
}
.scrollbar-layout-main-horizontal {
bottom: 0;
height: 10px;
left: 0;
transition-property: background-color;
background-color: rgba(135, 141, 159, 0.05);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0d878d9f,endColorstr=#0d878d9f);
}
.bi-theme-dark .scrollbar-layout-main-horizontal {
background-color: rgba(208, 212, 218, 0.05);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#0dd0d4da,endColorstr=#0dd0d4da);
}
/* Touching the scroll-track directly makes the scroll-track bolder */
.scrollbar-layout-main-horizontal.public-scrollbar-main-active,
.scrollbar-layout-main-horizontal:hover {
height: 10px;
}
.scrollbar-layout-face {
left: 0;
overflow: hidden;
position: absolute;
z-index: 1;
}
/**
* This selector renders the "nub" of the scrollface. The nub must
* be rendered as pseudo-element so that it won't receive any UI events then
* we can get the correct `event.offsetX` and `event.offsetY` from the
* scrollface element while dragging it.
*/
.scrollbar-layout-face:after {
border-radius: 6px;
content: '';
display: block;
position: absolute;
transition: background-color 250ms ease;
}
.scrollbar-layout-face-horizontal {
bottom: 0;
left: 0;
top: 0;
}
.scrollbar-layout-face-horizontal:after {
bottom: 2px;
left: 0;
top: 2px;
width: 100%;
}
.scrollbar-layout-face-vertical {
left: 0;
right: 0;
top: 0;
}
.scrollbar-layout-face-vertical:after {
height: 100%;
left: 2px;
right: 2px;
top: 0;
}
/**
* scrollbars.
*/
/* Touching the scroll-track directly makes the scroll-track bolder */
.public-scrollbar-face:after {
background-color: rgba(135, 141, 159, 0.3);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4d878d9f,endColorstr=#4d878d9f);
}
.bi-theme-dark .public-scrollbar-face:after {
background-color: rgba(208, 212, 218, 0.3);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#4dd0d4da,endColorstr=#4dd0d4da);
}
.public-scrollbar-main:hover .public-scrollbar-face:after,
.public-scrollbar-main-active .public-scrollbar-face:after,
.public-scrollbar-face-active:after {
background-color: rgba(135, 141, 159, 0.7);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3878d9f,endColorstr=#b3878d9f);
}
.bi-theme-dark .public-scrollbar-main:hover .public-scrollbar-face:after,
.bi-theme-dark .public-scrollbar-main-active .public-scrollbar-face:after,
.bi-theme-dark .public-scrollbar-face-active:after {
background-color: rgba(208, 212, 218, 0.7);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr=#b3d0d4da,endColorstr=#b3d0d4da);
}
.horizontal-scrollbar {
bottom: 0;
position: absolute;
}
.bi-table > .first-col {
border-left: none;
}
.bi-table > .first-row {
border-top: none;
}
.bi-table > div > div > table {
border-bottom: 1px solid #e8eaed;
border-right: 1px solid #e8eaed;
}
.bi-table > div.top-left > div > div > table {
border-bottom: 1px solid #e8eaed;
border-right: 1px solid #e8eaed;
}
.bi-table > div.top-right > div > div > table {
border-bottom: 1px solid #e8eaed;
border-right: 1px solid #e8eaed;
}
.bi-table > div.bottom-left > div > div > table {
border-bottom: 1px solid #e8eaed;
border-right: 1px solid #e8eaed;
}
.bi-table > div.bottom-right > div > div > table {
border-right: 1px solid #e8eaed;
border-bottom: 1px solid #e8eaed;
}
.bi-table > div > div > table,
.bi-table > div > div > div > table {
min-width: 100%;
clear: both;
vertical-align: middle;
border-spacing: 0;
border-collapse: separate;
}
.bi-table > div > div > table,
.bi-table > div > div > div > table,
.bi-table > div > div > table > * > * > th,
.bi-table > div > div > div > table > * > * > th,
.bi-table > div > div > table > * > * > td,
.bi-table > div > div > div > table > * > * > td {
vertical-align: middle;
margin: 0;
padding: 0;
}
.bi-table > div > div > table > tbody > tr > td,
.bi-table > div > div > div > table > tbody > tr > td,
.bi-table > div > div > table > thead > tr > td,
.bi-table > div > div > div > table > thead > tr > td {
border-top: 1px solid #e8eaed;
border-left: 1px solid #e8eaed;
}
.bi-theme-dark .bi-table > div > div > table {
border-bottom: 1px solid #3a3c53;
border-right: 1px solid #3a3c53;
}
.bi-theme-dark .bi-table > div.top-left > div > div > table {
border-bottom: 1px solid #3a3c53;
border-right: 1px solid #3a3c53;
}
.bi-theme-dark .bi-table > div.top-right > div > div > table {
border-bottom: 1px solid #3a3c53;
border-right: 1px solid #3a3c53;
}
.bi-theme-dark .bi-table > div.bottom-left > div > div > table {
border-bottom: 1px solid #3a3c53;
border-right: 1px solid #3a3c53;
}
.bi-theme-dark .bi-table > div.bottom-right > div > div > table {
border-right: 1px solid #3a3c53;
border-bottom: 1px solid #3a3c53;
}
.bi-theme-dark .bi-table > div > div > table > tbody > tr > td,
.bi-theme-dark .bi-table > div > div > div > table > tbody > tr > td,
.bi-theme-dark .bi-table > div > div > table > thead > tr > td,
.bi-theme-dark .bi-table > div > div > div > table > thead > tr > td {
border-top: 1px solid #3a3c53;
border-left: 1px solid #3a3c53;
}
.bi-resizable-table-cell .resizable-table-cell-resizer-container {
cursor: ew-resize;
z-index: 1;
}
.bi-resizable-table-cell .resizable-table-cell-resizer-container:hover .resizable-table-cell-resizer-knob,
.bi-resizable-table-cell .resizable-table-cell-resizer-container.dragging .resizable-table-cell-resizer-knob {
background-color: #3685f2;
}
.bi-resizable-table-cell .resizable-table-cell-resizer-container.suitable .resizable-table-cell-resizer-knob {
background-color: #13cd66;
}
.bi-resizable-table .resizable-table-resizer {
cursor: ew-resize;
z-index: 1;
background-color: #3685f2;
}
.bi-resizable-table .resizable-table-resizer.suitable {
background-color: #13cd66;
}
.bi-resizable-table .resizable-table-region-resizer {
cursor: ew-resize;
z-index: 1;
}
.bi-resizable-table .resizable-table-region-resizer:hover .resizable-table-region-resizer-knob,
.bi-resizable-table .resizable-table-region-resizer.dragging .resizable-table-region-resizer-knob {
background-color: #3685f2;
}

23
src/css/core/utils/common.css

@ -940,6 +940,29 @@ textarea {
.bi-list-item-select3.disabled.active {
background-color: #ffffff !important;
}
.bi-theme-dark .bi-list-item-select3:hover,
.bi-theme-dark .bi-list-item-select3.hover {
background-color: #191B2B;
}
.bi-theme-dark .bi-list-item-select3:active,
.bi-theme-dark .bi-list-item-select3.active {
color: #3685f2;
background-color: #191B2B;
}
.bi-theme-dark .bi-list-item-select3:active .bi-input,
.bi-theme-dark .bi-list-item-select3.active .bi-input {
color: #3685f2;
}
.bi-theme-dark .bi-list-item-select3:active .bi-textarea,
.bi-theme-dark .bi-list-item-select3.active .bi-textarea {
color: #3685f2;
}
.bi-theme-dark .bi-list-item-select3.disabled:hover,
.bi-theme-dark .bi-list-item-select3.disabled.hover,
.bi-theme-dark .bi-list-item-select3.disabled:active,
.bi-theme-dark .bi-list-item-select3.disabled.active {
background-color: #242640 !important;
}
.bi-theme-dark .bi-list-item-select:hover,
.bi-theme-dark .bi-list-item-select.hover {
color: #ffffff;

11
src/css/widget/exceltable/exceltable.css

@ -1,11 +0,0 @@
.bi-excel-table-header-cell {
font-weight: bold;
}
.bi-excel-table > div.bottom-right > div > div > table {
border-right: 1px solid #e8eaed;
}
.bi-theme-dark .bi-excel-table > div.bottom-right > div > div > table {
border-right: 1px solid #3a3c53;
}

27
src/css/widget/previewtable/previewtable.css

@ -1,27 +0,0 @@
.bi-preview-table-cell {
min-height: 25px;
min-width: 80px;
}
.bi-preview-table-header-cell {
font-weight: bold;
min-height: 25px;
min-width: 80px;
}
.bi-preview-table {
-webkit-user-select: text;
-khtml-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
-o-user-select: text;
user-select: text;
}
.bi-preview-table > div > table > thead > tr.odd,
.bi-preview-table > div > div > div > table > thead > tr.odd {
background-color: #f7f8fa;
}
.bi-theme-dark .bi-preview-table > div > table > thead > tr.odd,
.bi-theme-dark .bi-preview-table > div > div > div > table > thead > tr.odd {
background-color: #191B2B;
}

4
src/less/base/combo/combo.bubble.less

@ -21,7 +21,7 @@
z-index: 1;
.triangle-top();
}
& .bubble-combo-triangle-left, &.bubble-combo-triangle-right, & .bubble-combo-triangle-top, & .bubble-combo-triangle-bottom {
& .bubble-combo-triangle-left, & .bubble-combo-triangle-right, & .bubble-combo-triangle-top, & .bubble-combo-triangle-bottom {
&:before {
background-color: @color-bi-background-default;
border-bottom: 1px solid @border-color-light-line;
@ -32,7 +32,7 @@
.bi-theme-dark {
.bi-bubble-combo {
& .bubble-combo-triangle-left, &.bubble-combo-triangle-right, & .bubble-combo-triangle-top, & .bubble-combo-triangle-bottom {
& .bubble-combo-triangle-left, & .bubble-combo-triangle-right, & .bubble-combo-triangle-top, & .bubble-combo-triangle-bottom {
&:before {
background-color: @color-bi-background-default-theme-dark;
border-bottom: 1px solid @border-color-light-line-theme-dark;

23
src/less/base/table/table.collection.cell.less

@ -1,23 +0,0 @@
@import "../../index";
.bi-collection-table-cell {
.box-sizing(border-box);
&.first-row {
border-top: 1px solid @border-color-line;
}
&.first-col {
border-left: 1px solid @border-color-line;
}
}
//特殊样式
.bi-theme-dark {
.bi-collection-table-cell {
&.first-row {
border-top: 1px solid @border-color-line-theme-dark;
}
&.first-col {
border-left: 1px solid @border-color-line-theme-dark;
}
}
}

9
src/less/base/table/table.collection.quick.less

@ -1,9 +0,0 @@
@import "../../index";
.bi-quick-collection-table {
& > div > .bi-collection {
overflow: hidden !important;
overflow-x: hidden !important;
overflow-y: hidden !important;
}
}

21
src/less/base/table/table.grid.cell.less

@ -1,21 +0,0 @@
@import "../../index";
.bi-grid-table-cell {
.box-sizing(border-box);
&.first-row {
border-top: 1px solid @border-color-line;
}
&.first-col {
border-left: 1px solid @border-color-line;
}
}
.bi-theme-dark{
.bi-grid-table-cell{
&.first-row {
border-top: 1px solid @border-color-line-theme-dark;
}
&.first-col {
border-left: 1px solid @border-color-line-theme-dark;
}
}
}

146
src/less/base/table/table.grid.scrollbar.less

@ -1,146 +0,0 @@
@import "../../index";
.scrollbar-layout-main {
box-sizing: border-box;
outline: none;
overflow: hidden;
position: absolute;
transition-duration: 250ms;
transition-timing-function: ease;
user-select: none;
.background-color(@scroll-color, 5%);
border-radius: 5px;
}
.bi-theme-dark {
.scrollbar-layout-main {
.background-color(@scroll-color-theme-dark, 5%);
}
}
.scrollbar-layout-main-vertical {
bottom: 0;
right: 0;
top: 0;
transition-property: background-color;
width: 10px;
}
.scrollbar-layout-main-vertical.public-scrollbar-main-active,
.scrollbar-layout-main-vertical:hover {
width: 10px;
}
.scrollbar-layout-main-horizontal {
bottom: 0;
height: 10px;
left: 0;
transition-property: background-color;
.background-color(@scroll-color, 5%);
}
.bi-theme-dark {
.scrollbar-layout-main-horizontal {
.background-color(@scroll-color-theme-dark, 5%);
}
}
/* Touching the scroll-track directly makes the scroll-track bolder */
.scrollbar-layout-main-horizontal.public-scrollbar-main-active,
.scrollbar-layout-main-horizontal:hover {
height: 10px;
}
.scrollbar-layout-face {
left: 0;
overflow: hidden;
position: absolute;
z-index: 1;
}
/**
* This selector renders the "nub" of the scrollface. The nub must
* be rendered as pseudo-element so that it won't receive any UI events then
* we can get the correct `event.offsetX` and `event.offsetY` from the
* scrollface element while dragging it.
*/
.scrollbar-layout-face:after {
border-radius: 6px;
content: '';
display: block;
position: absolute;
transition: background-color 250ms ease;
}
.scrollbar-layout-face-horizontal {
bottom: 0;
left: 0;
top: 0;
}
.scrollbar-layout-face-horizontal:after {
bottom: 2px;
left: 0;
top: 2px;
width: 100%;
}
.scrollbar-layout-face-vertical {
left: 0;
right: 0;
top: 0;
}
.scrollbar-layout-face-vertical:after {
height: 100%;
left: 2px;
right: 2px;
top: 0;
}
/**
* scrollbars.
*/
/* Touching the scroll-track directly makes the scroll-track bolder */
.public-scrollbar-main.public-scrollbar-main-active,
.public-scrollbar-main:hover {
//background-color: rgba(255, 255, 255, 0.8);
}
.public-scrollbar-main-opaque,
.public-scrollbar-main-opaque.public-scrollbar-main-active,
.public-scrollbar-main-opaque:hover {
//background-color: #fff;
}
.public-scrollbar-face:after {
.background-color(@scroll-color, 30%);
}
.bi-theme-dark {
.public-scrollbar-face:after {
.background-color(@scroll-color-theme-dark, 30%);
}
}
.public-scrollbar-main:hover .public-scrollbar-face:after,
.public-scrollbar-main-active .public-scrollbar-face:after,
.public-scrollbar-face-active:after {
.background-color(@scroll-color, 70%);
}
.bi-theme-dark {
.public-scrollbar-main:hover .public-scrollbar-face:after,
.public-scrollbar-main-active .public-scrollbar-face:after,
.public-scrollbar-face-active:after {
.background-color(@scroll-color-theme-dark, 70%);
}
}
//horizontalScrollbar
.horizontal-scrollbar {
bottom: 0;
position: absolute;
}

111
src/less/base/table/table.less

@ -1,111 +0,0 @@
@import "../../index";
.bi-table {
> .center-element {
//border-top: 1px solid @color-bi-border-normal;
//border-left: 1px solid @color-bi-border-normal;
}
> .first-col {
border-left: none;
}
> .first-row {
border-top: none;
}
& > div > div > table {
border-bottom: 1px solid @border-color-line;
border-right: 1px solid @border-color-line;
}
& > div.top-left > div > div > table {
border-bottom: 1px solid @border-color-line;
border-right: 1px solid @border-color-line;
}
& > div.top-right > div > div > table {
border-bottom: 1px solid @border-color-line;
border-right: 1px solid @border-color-line;
}
& > div.bottom-left > div > div > table {
border-bottom: 1px solid @border-color-line;
border-right: 1px solid @border-color-line;
}
& > div.bottom-right > div > div > table {
border-right: 1px solid @border-color-line;
border-bottom: 1px solid @border-color-line;
}
& > div > div > table, & > div > div > div > table {
&, & > * > * > th, & > * > * > td {
vertical-align: middle;
margin: 0;
padding: 0;
}
min-width: 100%;
clear: both;
vertical-align: middle;
border-spacing: 0;
border-collapse: separate;
& > tbody > tr > td, & > thead > tr > td {
border-top: 1px solid @border-color-line;
border-left: 1px solid @color-bi-border-line;
}
& > tbody > tr.odd {
//background-color: #f9f9f9;
//&:hover {
// background-color: whitesmoke;
//}
}
& > tbody > tr.even {
//background-color: white;
//&:hover {
// background-color: whitesmoke;
//}
}
& > thead > tr.odd {
//background-color: #f9f9f9;
//&:hover {
// background-color: whitesmoke;
//}
}
& > thead > tr.even {
//background-color: white;
//&:hover {
// background-color: whitesmoke;
//}
}
}
}
.bi-theme-dark {
.bi-table {
& > div > div > table {
border-bottom: 1px solid @border-color-line-theme-dark;
border-right: 1px solid @border-color-line-theme-dark;
}
& > div.top-left > div > div > table {
border-bottom: 1px solid @border-color-line-theme-dark;
border-right: 1px solid @border-color-line-theme-dark;
}
& > div.top-right > div > div > table {
border-bottom: 1px solid @border-color-line-theme-dark;
border-right: 1px solid @border-color-line-theme-dark;
}
& > div.bottom-left > div > div > table {
border-bottom: 1px solid @border-color-line-theme-dark;
border-right: 1px solid @border-color-line-theme-dark;
}
& > div.bottom-right > div > div > table {
border-right: 1px solid @border-color-line-theme-dark;
border-bottom: 1px solid @border-color-line-theme-dark;
}
& > div > div > table, & > div > div > div > table {
& > tbody > tr > td, & > thead > tr > td {
border-top: 1px solid @border-color-line-theme-dark;
border-left: 1px solid @border-color-line-theme-dark;
}
}
}
}

18
src/less/base/table/table.resizable.cell.less

@ -1,18 +0,0 @@
@import "../../index";
.bi-resizable-table-cell {
& .resizable-table-cell-resizer-container {
cursor: ew-resize;
z-index: 1;
&:hover, &.dragging {
& .resizable-table-cell-resizer-knob {
background-color: @color-bi-background-highlight;
}
}
&.suitable{
& .resizable-table-cell-resizer-knob {
background-color: @color-bi-background-success;
}
}
}
}

21
src/less/base/table/table.resizable.less

@ -1,21 +0,0 @@
@import "../../index";
.bi-resizable-table {
& .resizable-table-resizer {
cursor: ew-resize;
z-index: 1;
background-color: @color-bi-background-highlight;
&.suitable {
background-color: @color-bi-background-success;
}
}
& .resizable-table-region-resizer {
cursor: ew-resize;
z-index: 1;
&:hover, &.dragging {
& .resizable-table-region-resizer-knob {
background-color: @color-bi-background-highlight;
}
}
}
}

5
src/less/base/table/table.tree.less

@ -1,5 +0,0 @@
@import "../../index";
.bi-table-tree{
}

23
src/less/core/utils/common.less

@ -922,6 +922,29 @@ textarea {
}
}
.bi-theme-dark {
.bi-list-item-select3 {
&:hover, &.hover {
background-color: @color-bi-background-normal-theme-dark;
}
&:active, &.active {
color: @color-bi-text-highlight;
& .bi-input {
color: @color-bi-text-highlight;
}
& .bi-textarea {
color: @color-bi-text-highlight;
}
background-color: @color-bi-background-normal-theme-dark;
}
&.disabled {
&:hover, &.hover, &:active, &.active {
background-color: @color-bi-background-default-theme-dark !important;
}
}
}
}
.bi-theme-dark {
.bi-list-item-select {
&:hover, &.hover {

6
src/less/visual.less

@ -195,7 +195,7 @@
width: 6px;
height: 6px;
margin-left: 3px;
margin-top: 3px;
margin-top: 2px;
content: "";
transform: rotate(-135deg);
}
@ -227,7 +227,7 @@
position: absolute;
width: 6px;
height: 6px;
margin-left: 3px;
margin-left: 2px;
margin-top: 3px;
content: "";
transform: rotate(135deg);
@ -243,7 +243,7 @@
position: absolute;
width: 6px;
height: 6px;
margin-left: 3px;
margin-left: 2px;
margin-top: -3px;
content: "";
transform: rotate(-45deg);

4
src/less/widget/exceltable/exceltable.cell.less

@ -1,4 +0,0 @@
@import "../../index";
.bi-excel-table-cell {
}

5
src/less/widget/exceltable/exceltable.header.cell.less

@ -1,5 +0,0 @@
@import "../../index";
.bi-excel-table-header-cell {
font-weight: bold;
}

15
src/less/widget/exceltable/exceltable.less

@ -1,15 +0,0 @@
@import "../../index";
.bi-excel-table {
& > div.bottom-right > div > div > table {
border-right: 1px solid @color-bi-border-line;
}
}
.bi-theme-dark {
.bi-excel-table {
& > div.bottom-right > div > div > table {
border-right: 1px solid @color-bi-border-line-theme-dark;
}
}
}

6
src/less/widget/previewtable/previewtable.cell.less

@ -1,6 +0,0 @@
@import "../../index";
.bi-preview-table-cell {
min-height: 25px;
min-width: 80px;
}

7
src/less/widget/previewtable/previewtable.header.cell.less

@ -1,7 +0,0 @@
@import "../../index";
.bi-preview-table-header-cell {
font-weight: bold;
min-height: 25px;
min-width: 80px;
}

20
src/less/widget/previewtable/previewtable.less

@ -1,20 +0,0 @@
@import "../../index";
.bi-preview-table {
.user-select-enable();
& > div > table, & > div > div > div > table {
& > thead > tr.odd {
background-color: @color-bi-background-normal;
}
}
}
.bi-theme-dark {
.bi-preview-table {
& > div > table, & > div > div > div > table {
& > thead > tr.odd {
background-color: @color-bi-background-normal-theme-dark;
}
}
}
}

16
src/widget/dynamicdate/dynamicdate.combo.js

@ -10,7 +10,7 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
props: {
baseCls: "bi-dynamic-date-combo bi-border bi-focus-shadow",
height: 24
height: 22
},
@ -25,13 +25,13 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font",
width: 24,
height: 24,
width: opts.height,
height: opts.height,
ref: function () {
self.changeIcon = this;
}
},
width: 24
width: opts.height
}, {
type: "bi.absolute",
items: [{
@ -48,6 +48,7 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
type: "bi.dynamic_date_trigger",
min: this.constants.DATE_MIN_VALUE,
max: this.constants.DATE_MAX_VALUE,
height: opts.height,
value: opts.value,
ref: function () {
self.trigger = this;
@ -192,8 +193,8 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-font",
width: 24,
height: 24,
width: opts.height,
height: opts.height,
listeners: [{
eventName: BI.IconButton.EVENT_CHANGE,
action: function () {
@ -220,6 +221,7 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
},
_checkDynamicValue: function (v) {
var o = this.options;
var type = null;
if (BI.isNotNull(v)) {
type = v.type;
@ -227,7 +229,7 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
switch (type) {
case BI.DynamicDateCombo.Dynamic:
this.changeIcon.setVisible(true);
this.comboWrapper.attr("items")[0].width = 24;
this.comboWrapper.attr("items")[0].width = o.height;
this.comboWrapper.resize();
break;
default:

16
src/widget/dynamicdatetime/dynamicdatetime.combo.js

@ -10,7 +10,7 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
props: {
baseCls: "bi-dynamic-date-combo bi-border bi-focus-shadow",
height: 24
height: 22
},
@ -25,13 +25,13 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font",
width: 24,
height: 24,
width: opts.height,
height: opts.height,
ref: function () {
self.changeIcon = this;
}
},
width: 24
width: opts.height
}, {
type: "bi.absolute",
items: [{
@ -48,6 +48,7 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
type: "bi.dynamic_date_time_trigger",
min: this.constants.DATE_MIN_VALUE,
max: this.constants.DATE_MAX_VALUE,
height: opts.height,
value: opts.value,
ref: function () {
self.trigger = this;
@ -195,8 +196,8 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-font",
width: 24,
height: 24,
width: opts.height,
height: opts.height,
listeners: [{
eventName: BI.IconButton.EVENT_CHANGE,
action: function () {
@ -223,6 +224,7 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
},
_checkDynamicValue: function (v) {
var o = this.options;
var type = null;
if (BI.isNotNull(v)) {
type = v.type;
@ -230,7 +232,7 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
switch (type) {
case BI.DynamicDateTimeCombo.Dynamic:
this.changeIcon.setVisible(true);
this.comboWrapper.attr("items")[0].width = 24;
this.comboWrapper.attr("items")[0].width = o.height;
this.comboWrapper.resize();
break;
default:

35
src/widget/previewtable/previewtable.cell.js

@ -1,35 +0,0 @@
/**
* 预览表列
*
* 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);

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

@ -1,35 +0,0 @@
/**
* 预览表
*
* 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);

223
src/widget/previewtable/previewtable.js

@ -1,223 +0,0 @@
/**
* 预览表
*
* 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);

366
src/widget/responsivetable/responsivetable.js

@ -1,366 +0,0 @@
/**
* 自适应宽度的表格
*
* Created by GUY on 2016/2/3.
* @class BI.ResponisveTable
* @extends BI.Widget
*/
BI.ResponisveTable = BI.inherit(BI.Widget, {
_const: {
perColumnSize: 100
},
_defaultConfig: function () {
return BI.extend(BI.ResponisveTable.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-responsive-table",
isNeedFreeze: false, // 是否需要冻结单元格
freezeCols: [], // 冻结的列号,从0开始,isNeedFreeze为true时生效
logic: { // 冻结的页面布局逻辑
dynamic: false
},
isNeedMerge: false, // 是否需要合并单元格
mergeCols: [], // 合并的单元格列号
mergeRule: function (row1, row2) { // 合并规则, 默认相等时合并
return BI.isEqual(row1, row2);
},
columnSize: [],
headerRowSize: 25,
footerRowSize: 25,
rowSize: 25,
regionColumnSize: false,
header: [],
footer: false,
items: [], // 二维数组
// 交叉表头
crossHeader: [],
crossItems: []
});
},
_init: function () {
BI.ResponisveTable.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.table = BI.createWidget({
type: "bi.table_view",
element: this,
logic: o.logic,
isNeedFreeze: o.isNeedFreeze,
freezeCols: o.freezeCols,
isNeedMerge: o.isNeedMerge,
mergeCols: o.mergeCols,
mergeRule: o.mergeRule,
columnSize: o.columnSize,
headerRowSize: o.headerRowSize,
footerRowSize: o.footerRowSize,
rowSize: o.rowSize,
regionColumnSize: o.regionColumnSize,
header: o.header,
footer: o.footer,
items: o.items,
// 交叉表头
crossHeader: o.crossHeader,
crossItems: o.crossItems
});
this.table.on(BI.Table.EVENT_TABLE_AFTER_INIT, function () {
self._initRegionSize();
self.table.resize();
self._resizeHeader();
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_INIT, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_RESIZE, function () {
self._resizeRegion();
self._resizeHeader();
self.fireEvent(BI.Table.EVENT_TABLE_RESIZE, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_SCROLL, function () {
self.fireEvent(BI.Table.EVENT_TABLE_SCROLL, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_BEFORE_REGION_RESIZE, function () {
self.fireEvent(BI.Table.EVENT_TABLE_BEFORE_REGION_RESIZE, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_REGION_RESIZE, function () {
// important:在冻结并自适应列宽的情况下要随时变更表头宽度
if (o.isNeedResize === true && self._isAdaptiveColumn()) {
self._resizeHeader();
}
self.fireEvent(BI.Table.EVENT_TABLE_REGION_RESIZE, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, function () {
self._resizeHeader();
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_REGION_RESIZE, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_BEFORE_COLUMN_RESIZE, function () {
self._resizeBody();
self.fireEvent(BI.Table.EVENT_TABLE_BEFORE_COLUMN_RESIZE, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_COLUMN_RESIZE, function () {
self.fireEvent(BI.Table.EVENT_TABLE_COLUMN_RESIZE, arguments);
});
this.table.on(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, function () {
self._resizeRegion();
self._resizeHeader();
self.fireEvent(BI.Table.EVENT_TABLE_AFTER_COLUMN_RESIZE, arguments);
});
},
_initRegionSize: function () {
var o = this.options;
if (o.isNeedFreeze === true) {
var regionColumnSize = this.table.getRegionColumnSize();
var maxWidth = this.table.element.width();
if (!regionColumnSize[0] || (regionColumnSize[0] === "fill") || regionColumnSize[0] > maxWidth || regionColumnSize[1] > maxWidth) {
var freezeCols = o.freezeCols;
if (freezeCols.length === 0) {
this.table.setRegionColumnSize([0, "fill"]);
} else if (freezeCols.length > 0 && freezeCols.length < o.columnSize.length) {
var size = maxWidth / 3;
if (freezeCols.length > o.columnSize.length / 2) {
size = maxWidth * 2 / 3;
}
this.table.setRegionColumnSize([size, "fill"]);
} else {
this.table.setRegionColumnSize(["fill", 0]);
}
}
}
},
_getBlockSize: function () {
var o = this.options;
var columnSize = this.table.getCalculateColumnSize();
if (o.isNeedFreeze === true) {
var columnSizeLeft = [], columnSizeRight = [];
BI.each(columnSize, function (i, size) {
if (o.freezeCols.contains(i)) {
columnSizeLeft.push(size);
} else {
columnSizeRight.push(size);
}
});
// 因为有边框,所以加上数组长度的参数调整
var sumLeft = BI.sum(columnSizeLeft) + columnSizeLeft.length,
sumRight = BI.sum(columnSizeRight) + columnSizeRight.length;
return {
sumLeft: sumLeft,
sumRight: sumRight,
left: columnSizeLeft,
right: columnSizeRight
};
}
return {
size: columnSize,
sum: BI.sum(columnSize) + columnSize.length
};
},
_isAdaptiveColumn: function (columnSize) {
return !(BI.last(columnSize || this.table.getColumnSize()) > 1.05);
},
_resizeHeader: function () {
var self = this, o = this.options;
if (o.isNeedFreeze === true) {
// 若是当前处于自适应调节阶段
if (this._isAdaptiveColumn()) {
var columnSize = this.table.getCalculateColumnSize();
this.table.setHeaderColumnSize(columnSize);
} else {
var regionColumnSize = this.table.getClientRegionColumnSize();
var block = this._getBlockSize();
var sumLeft = block.sumLeft, sumRight = block.sumRight;
var columnSizeLeft = block.left, columnSizeRight = block.right;
columnSizeLeft[columnSizeLeft.length - 1] += regionColumnSize[0] - sumLeft;
columnSizeRight[columnSizeRight.length - 1] += regionColumnSize[1] - sumRight;
var newLeft = BI.clone(columnSizeLeft), newRight = BI.clone(columnSizeRight);
newLeft[newLeft.length - 1] = "";
newRight[newRight.length - 1] = "";
this.table.setColumnSize(newLeft.concat(newRight));
block = self._getBlockSize();
if (columnSizeLeft[columnSizeLeft.length - 1] < block.left[block.left.length - 1]) {
columnSizeLeft[columnSizeLeft.length - 1] = block.left[block.left.length - 1];
}
if (columnSizeRight[columnSizeRight.length - 1] < block.right[block.right.length - 1]) {
columnSizeRight[columnSizeRight.length - 1] = block.right[block.right.length - 1];
}
self.table.setColumnSize(columnSizeLeft.concat(columnSizeRight));
}
} else {
if (!this._isAdaptiveColumn()) {
var regionColumnSize = this.table.getClientRegionColumnSize();
var block = this._getBlockSize();
var sum = block.sum;
var size = block.size;
size[size.length - 1] += regionColumnSize[0] - sum;
var newSize = BI.clone(size);
newSize[newSize.length - 1] = "";
this.table.setColumnSize(newSize);
block = this._getBlockSize();
if (size[size.length - 1] < block.size[block.size.length - 1]) {
size[size.length - 1] = block.size[block.size.length - 1];
}
this.table.setColumnSize(size);
}
}
},
_resizeBody: function () {
if (this._isAdaptiveColumn()) {
var columnSize = this.table.getCalculateColumnSize();
this.setColumnSize(columnSize);
}
},
_adjustRegion: function () {
var o = this.options;
var regionColumnSize = this.table.getCalculateRegionColumnSize();
if (o.isNeedFreeze === true && o.freezeCols.length > 0 && o.freezeCols.length < o.columnSize.length) {
var block = this._getBlockSize();
var sumLeft = block.sumLeft, sumRight = block.sumRight;
if (sumLeft < regionColumnSize[0] || regionColumnSize[0] >= (sumLeft + sumRight)) {
this.table.setRegionColumnSize([sumLeft, "fill"]);
}
this._resizeRegion();
}
},
_resizeRegion: function () {
var o = this.options;
var regionColumnSize = this.table.getCalculateRegionColumnSize();
if (o.isNeedFreeze === true && o.freezeCols.length > 0 && o.freezeCols.length < o.columnSize.length) {
var maxWidth = this.table.element.width();
if (regionColumnSize[0] < 15 || regionColumnSize[1] < 15) {
var freezeCols = o.freezeCols;
var size = maxWidth / 3;
if (freezeCols.length > o.columnSize.length / 2) {
size = maxWidth * 2 / 3;
}
this.table.setRegionColumnSize([size, "fill"]);
}
}
},
resize: function () {
this.table.resize();
this._resizeRegion();
this._resizeHeader();
},
setColumnSize: function (columnSize) {
this.table.setColumnSize(columnSize);
this._adjustRegion();
this._resizeHeader();
},
getColumnSize: function () {
return this.table.getColumnSize();
},
getCalculateColumnSize: function () {
return this.table.getCalculateColumnSize();
},
setHeaderColumnSize: function (columnSize) {
this.table.setHeaderColumnSize(columnSize);
this._adjustRegion();
this._resizeHeader();
},
setRegionColumnSize: function (columnSize) {
this.table.setRegionColumnSize(columnSize);
this._resizeHeader();
},
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) {
this.table.setVerticalScroll(scrollTop);
},
setLeftHorizontalScroll: function (scrollLeft) {
this.table.setLeftHorizontalScroll(scrollLeft);
},
setRightHorizontalScroll: function (scrollLeft) {
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();
},
attr: function () {
BI.ResponisveTable.superclass.attr.apply(this, arguments);
this.table.attr.apply(this.table, arguments);
},
populate: function (items) {
var self = this, o = this.options;
this.table.populate.apply(this.table, arguments);
if (o.isNeedFreeze === true) {
BI.nextTick(function () {
self._initRegionSize();
self.table.resize();
self._resizeHeader();
});
}
}
});
BI.shortcut("bi.responsive_table", BI.ResponisveTable);

3
src/widget/year/combo.year.js

@ -5,7 +5,7 @@ BI.DynamicYearCombo = BI.inherit(BI.Widget, {
behaviors: {},
min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期
height: 24
height: 22
},
_init: function () {
@ -16,6 +16,7 @@ BI.DynamicYearCombo = BI.inherit(BI.Widget, {
type: "bi.dynamic_year_trigger",
min: o.min,
max: o.max,
height: o.height,
value: o.value || ""
});
this.trigger.on(BI.DynamicYearTrigger.EVENT_FOCUS, function () {

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save