guy 8 years ago
parent
commit
16bb938ad8
  1. 24
      bi/base.js
  2. 6
      bi/core.js
  3. 83
      bi/widget.js
  4. 4
      demo/js/component/demo.treevaluechooser.js
  5. 24
      docs/base.js
  6. 6
      docs/core.js
  7. 4
      docs/demo.js
  8. 83
      docs/widget.js
  9. 2
      src/base/pane.js
  10. 2
      src/base/single/text.js
  11. 20
      src/base/tree/treeview.js
  12. 6
      src/core/func/dom.js
  13. 2
      src/widget/downlist/combo.downlist.js
  14. 37
      src/widget/sequencetable/listnumber.sequencetable.js
  15. 44
      src/widget/sequencetable/treenumber.sequencetable.js

24
bi/base.js

@ -279,7 +279,7 @@ BI.Pane = BI.inherit(BI.Widget, {
loaded: function () {
var self = this, o = this.options;
BI.Layers.remove(self.getName());
BI.Maskers.remove(self.getName());
this._loading && this._loading.destroy();
this._loading && (this._loading = null);
o.onLoaded();
@ -577,7 +577,7 @@ BI.Text = BI.inherit(BI.Single, {
setText: function (text) {
BI.Text.superclass.setText.apply(this, arguments);
this.options.text = text;
this.text.element.html(BI.escape(text).replaceAll(" ", " "));
this.text.element.text((text + "").replaceAll(" ", " "));
}
});
@ -1793,14 +1793,15 @@ BI.TreeView = BI.inherit(BI.Pane, {
//处理节点
_dealWidthNodes: function (nodes) {
var self = this, o = this.options;
//处理标红
if (BI.isKey(o.paras.keyword)) {
var keyword = o.paras.keyword;
var ns = BI.Tree.arrayFormat(nodes);
BI.each(ns, function (i, n) {
n.text = $("<div>").__textKeywordMarked__(n.text, keyword, n.py).html();
});
}
var ns = BI.Tree.arrayFormat(nodes);
BI.each(ns, function (i, n) {
//处理标红
if (BI.isKey(o.paras.keyword)) {
n.text = $("<div>").__textKeywordMarked__(n.text, o.paras.keyword, n.py).html();
} else {
n.text = (n.text + "").replaceAll(" ", " ");
}
});
return nodes;
},
@ -1886,7 +1887,8 @@ BI.TreeView = BI.inherit(BI.Pane, {
},
view: {
showIcon: false,
expandSpeed: ""
expandSpeed: "",
nameIsHTML: true
},
callback: {}
};

6
bi/core.js

@ -16452,7 +16452,7 @@ BI.extend(jQuery.fn, {
*/
__textKeywordMarked__: function (text, keyword, py) {
if (!BI.isKey(keyword)) {
return this.text(text);
return this.text((text + "").replaceAll(" ", " "));
}
keyword = keyword + "";
keyword = BI.toUpperCase(keyword);
@ -16475,7 +16475,7 @@ BI.extend(jQuery.fn, {
if (tidx >= 0) {
this.append(textLeft.substr(0, tidx));
this.append($("<span>").addClass("bi-keyword-red-mark")
.text(textLeft.substr(tidx, keyword.length)));
.text(textLeft.substr(tidx, keyword.length).replaceAll(" ", " ")));
textLeft = textLeft.substr(tidx + keyword.length);
if (py != null) {
@ -16484,7 +16484,7 @@ BI.extend(jQuery.fn, {
} else if (pidx != null && pidx >= 0 && Math.floor(pidx / text.length) === Math.floor((pidx + keyword.length - 1) / text.length)) {
this.append(textLeft.substr(0, pidx));
this.append($("<span>").addClass("bi-keyword-red-mark")
.text(textLeft.substr(pidx, keyword.length)));
.text(textLeft.substr(pidx, keyword.length).replaceAll(" ", " ")));
if (py != null) {
py = py.substr(pidx + keyword.length);
}

83
bi/widget.js

@ -35,12 +35,6 @@ BI.SequenceTableTreeNumber = BI.inherit(BI.Widget, {
this.renderedCells = [];
this.renderedKeys = [];
this.header = BI.createWidget(o.sequenceHeaderCreator || {
type: "bi.table_style_cell",
cls: "sequence-table-title-cell bi-border",
styleGetter: o.headerCellStyleGetter,
text: BI.i18nText("BI-Number_Index")
});
this.container = BI.createWidget({
type: "bi.absolute",
width: 60,
@ -54,13 +48,20 @@ BI.SequenceTableTreeNumber = BI.inherit(BI.Widget, {
items: [this.container]
});
this.headerContainer = BI.createWidget({
type: "bi.absolute",
cls: "bi-border",
width: 58,
scrollable: false
});
this.layout = BI.createWidget({
type: "bi.vtape",
element: this,
items: [{
el: this.header,
height: this._getHeaderHeight()
}, {
el: this.headerContainer,
height: this._getHeaderHeight() - 2
}, {el: {type: "bi.layout"}, height: 2}, {
el: this.scrollContainer
}]
});
@ -168,7 +169,7 @@ BI.SequenceTableTreeNumber = BI.inherit(BI.Widget, {
_layout: function () {
var self = this, o = this.options;
var headerHeight = this._getHeaderHeight();
var headerHeight = this._getHeaderHeight() - 2;
var items = this.layout.attr("items");
if (o.isNeedFreeze === false) {
items[0].height = 0;
@ -217,6 +218,26 @@ BI.SequenceTableTreeNumber = BI.inherit(BI.Widget, {
return Math.max(0, cnt * this.options.rowSize - (this.options.height - this._getHeaderHeight()) + BI.DOM.getScrollWidth());
},
_createHeader: function () {
var o = this.options;
BI.createWidget({
type: "bi.absolute",
element: this.headerContainer,
items: [{
el: o.sequenceHeaderCreator || {
type: "bi.table_style_cell",
cls: "sequence-table-title-cell",
styleGetter: o.headerCellStyleGetter,
text: BI.i18nText("BI-Number_Index")
},
left: 0,
top: 0,
right: 0,
bottom: 0
}]
});
},
_calculateChildrenToRender: function () {
var self = this, o = this.options;
@ -322,7 +343,8 @@ BI.SequenceTableTreeNumber = BI.inherit(BI.Widget, {
task.apply(self);
});
this.tasks = [];
this.header.populate();
this.headerContainer.empty();
this._createHeader();
this._layout();
this._calculateChildrenToRender();
},
@ -5595,7 +5617,7 @@ BI.DownListCombo = BI.inherit(BI.Widget, {
popup: {
el: this.popupview,
stopPropagation: true,
maxHeight: 400
maxHeight: 1000
}
});
@ -15746,12 +15768,6 @@ BI.SequenceTableListNumber = BI.inherit(BI.Widget, {
this.renderedCells = [];
this.renderedKeys = [];
this.header = BI.createWidget(o.sequenceHeaderCreator || {
type: "bi.table_style_cell",
cls: "sequence-table-title-cell bi-border",
styleGetter: o.headerCellStyleGetter,
text: BI.i18nText("BI-Number_Index")
});
this.container = BI.createWidget({
type: "bi.absolute",
width: 60,
@ -15765,12 +15781,19 @@ BI.SequenceTableListNumber = BI.inherit(BI.Widget, {
items: [this.container]
});
this.headerContainer = BI.createWidget({
type: "bi.absolute",
cls: "bi-border",
width: 58,
scrollable: false
});
this.layout = BI.createWidget({
type: "bi.vtape",
element: this,
items: [{
el: this.header,
height: o.headerRowSize * o.header.length
el: this.headerContainer,
height: o.headerRowSize * o.header.length - 2
}, {
el: this.scrollContainer
}]
@ -15793,6 +15816,26 @@ BI.SequenceTableListNumber = BI.inherit(BI.Widget, {
this.scrollContainer.element.scrollTop(o.scrollTop);
},
_createHeader: function () {
var o = this.options;
BI.createWidget({
type: "bi.absolute",
element: this.headerContainer,
items: [{
el: o.sequenceHeaderCreator || {
type: "bi.table_style_cell",
cls: "sequence-table-title-cell",
styleGetter: o.headerCellStyleGetter,
text: BI.i18nText("BI-Number_Index")
},
left: 0,
top: 0,
right: 0,
bottom: 0
}]
});
},
_calculateChildrenToRender: function () {
var self = this, o = this.options;
var scrollTop = BI.clamp(o.scrollTop, 0, o.rowSize * o.items.length - (o.height - o.header.length * o.headerRowSize) + BI.DOM.getScrollWidth());

4
demo/js/component/demo.treevaluechooser.js

@ -7,8 +7,8 @@ Demo.TreeValueChooser = BI.inherit(BI.Widget, {
var tree = [];
for (var i = 0; i < 21; i++) {
tree.push({
value: i + "",
text: i + "",
value: " " + i + "",
text: " " + i + "",
id: i + "",
pId: null
});

24
docs/base.js

@ -279,7 +279,7 @@ BI.Pane = BI.inherit(BI.Widget, {
loaded: function () {
var self = this, o = this.options;
BI.Layers.remove(self.getName());
BI.Maskers.remove(self.getName());
this._loading && this._loading.destroy();
this._loading && (this._loading = null);
o.onLoaded();
@ -577,7 +577,7 @@ BI.Text = BI.inherit(BI.Single, {
setText: function (text) {
BI.Text.superclass.setText.apply(this, arguments);
this.options.text = text;
this.text.element.html(BI.escape(text).replaceAll(" ", "&nbsp;"));
this.text.element.text((text + "").replaceAll(" ", " "));
}
});
@ -1793,14 +1793,15 @@ BI.TreeView = BI.inherit(BI.Pane, {
//处理节点
_dealWidthNodes: function (nodes) {
var self = this, o = this.options;
//处理标红
if (BI.isKey(o.paras.keyword)) {
var keyword = o.paras.keyword;
var ns = BI.Tree.arrayFormat(nodes);
BI.each(ns, function (i, n) {
n.text = $("<div>").__textKeywordMarked__(n.text, keyword, n.py).html();
});
}
var ns = BI.Tree.arrayFormat(nodes);
BI.each(ns, function (i, n) {
//处理标红
if (BI.isKey(o.paras.keyword)) {
n.text = $("<div>").__textKeywordMarked__(n.text, o.paras.keyword, n.py).html();
} else {
n.text = (n.text + "").replaceAll(" ", " ");
}
});
return nodes;
},
@ -1886,7 +1887,8 @@ BI.TreeView = BI.inherit(BI.Pane, {
},
view: {
showIcon: false,
expandSpeed: ""
expandSpeed: "",
nameIsHTML: true
},
callback: {}
};

6
docs/core.js

@ -21978,7 +21978,7 @@ BI.extend(jQuery.fn, {
*/
__textKeywordMarked__: function (text, keyword, py) {
if (!BI.isKey(keyword)) {
return this.text(text);
return this.text((text + "").replaceAll(" ", " "));
}
keyword = keyword + "";
keyword = BI.toUpperCase(keyword);
@ -22001,7 +22001,7 @@ BI.extend(jQuery.fn, {
if (tidx >= 0) {
this.append(textLeft.substr(0, tidx));
this.append($("<span>").addClass("bi-keyword-red-mark")
.text(textLeft.substr(tidx, keyword.length)));
.text(textLeft.substr(tidx, keyword.length).replaceAll(" ", " ")));
textLeft = textLeft.substr(tidx + keyword.length);
if (py != null) {
@ -22010,7 +22010,7 @@ BI.extend(jQuery.fn, {
} else if (pidx != null && pidx >= 0 && Math.floor(pidx / text.length) === Math.floor((pidx + keyword.length - 1) / text.length)) {
this.append(textLeft.substr(0, pidx));
this.append($("<span>").addClass("bi-keyword-red-mark")
.text(textLeft.substr(pidx, keyword.length)));
.text(textLeft.substr(pidx, keyword.length).replaceAll(" ", " ")));
if (py != null) {
py = py.substr(pidx + keyword.length);
}

4
docs/demo.js

@ -2436,8 +2436,8 @@ BI.shortcut("demo.center", Demo.Center);Demo.TreeValueChooser = BI.inherit(BI.Wi
var tree = [];
for (var i = 0; i < 21; i++) {
tree.push({
value: i + "",
text: i + "",
value: " " + i + "",
text: " " + i + "",
id: i + "",
pId: null
});

83
docs/widget.js

@ -35,12 +35,6 @@ BI.SequenceTableTreeNumber = BI.inherit(BI.Widget, {
this.renderedCells = [];
this.renderedKeys = [];
this.header = BI.createWidget(o.sequenceHeaderCreator || {
type: "bi.table_style_cell",
cls: "sequence-table-title-cell bi-border",
styleGetter: o.headerCellStyleGetter,
text: BI.i18nText("BI-Number_Index")
});
this.container = BI.createWidget({
type: "bi.absolute",
width: 60,
@ -54,13 +48,20 @@ BI.SequenceTableTreeNumber = BI.inherit(BI.Widget, {
items: [this.container]
});
this.headerContainer = BI.createWidget({
type: "bi.absolute",
cls: "bi-border",
width: 58,
scrollable: false
});
this.layout = BI.createWidget({
type: "bi.vtape",
element: this,
items: [{
el: this.header,
height: this._getHeaderHeight()
}, {
el: this.headerContainer,
height: this._getHeaderHeight() - 2
}, {el: {type: "bi.layout"}, height: 2}, {
el: this.scrollContainer
}]
});
@ -168,7 +169,7 @@ BI.SequenceTableTreeNumber = BI.inherit(BI.Widget, {
_layout: function () {
var self = this, o = this.options;
var headerHeight = this._getHeaderHeight();
var headerHeight = this._getHeaderHeight() - 2;
var items = this.layout.attr("items");
if (o.isNeedFreeze === false) {
items[0].height = 0;
@ -217,6 +218,26 @@ BI.SequenceTableTreeNumber = BI.inherit(BI.Widget, {
return Math.max(0, cnt * this.options.rowSize - (this.options.height - this._getHeaderHeight()) + BI.DOM.getScrollWidth());
},
_createHeader: function () {
var o = this.options;
BI.createWidget({
type: "bi.absolute",
element: this.headerContainer,
items: [{
el: o.sequenceHeaderCreator || {
type: "bi.table_style_cell",
cls: "sequence-table-title-cell",
styleGetter: o.headerCellStyleGetter,
text: BI.i18nText("BI-Number_Index")
},
left: 0,
top: 0,
right: 0,
bottom: 0
}]
});
},
_calculateChildrenToRender: function () {
var self = this, o = this.options;
@ -322,7 +343,8 @@ BI.SequenceTableTreeNumber = BI.inherit(BI.Widget, {
task.apply(self);
});
this.tasks = [];
this.header.populate();
this.headerContainer.empty();
this._createHeader();
this._layout();
this._calculateChildrenToRender();
},
@ -5595,7 +5617,7 @@ BI.DownListCombo = BI.inherit(BI.Widget, {
popup: {
el: this.popupview,
stopPropagation: true,
maxHeight: 400
maxHeight: 1000
}
});
@ -15746,12 +15768,6 @@ BI.SequenceTableListNumber = BI.inherit(BI.Widget, {
this.renderedCells = [];
this.renderedKeys = [];
this.header = BI.createWidget(o.sequenceHeaderCreator || {
type: "bi.table_style_cell",
cls: "sequence-table-title-cell bi-border",
styleGetter: o.headerCellStyleGetter,
text: BI.i18nText("BI-Number_Index")
});
this.container = BI.createWidget({
type: "bi.absolute",
width: 60,
@ -15765,12 +15781,19 @@ BI.SequenceTableListNumber = BI.inherit(BI.Widget, {
items: [this.container]
});
this.headerContainer = BI.createWidget({
type: "bi.absolute",
cls: "bi-border",
width: 58,
scrollable: false
});
this.layout = BI.createWidget({
type: "bi.vtape",
element: this,
items: [{
el: this.header,
height: o.headerRowSize * o.header.length
el: this.headerContainer,
height: o.headerRowSize * o.header.length - 2
}, {
el: this.scrollContainer
}]
@ -15793,6 +15816,26 @@ BI.SequenceTableListNumber = BI.inherit(BI.Widget, {
this.scrollContainer.element.scrollTop(o.scrollTop);
},
_createHeader: function () {
var o = this.options;
BI.createWidget({
type: "bi.absolute",
element: this.headerContainer,
items: [{
el: o.sequenceHeaderCreator || {
type: "bi.table_style_cell",
cls: "sequence-table-title-cell",
styleGetter: o.headerCellStyleGetter,
text: BI.i18nText("BI-Number_Index")
},
left: 0,
top: 0,
right: 0,
bottom: 0
}]
});
},
_calculateChildrenToRender: function () {
var self = this, o = this.options;
var scrollTop = BI.clamp(o.scrollTop, 0, o.rowSize * o.items.length - (o.height - o.header.length * o.headerRowSize) + BI.DOM.getScrollWidth());

2
src/base/pane.js

@ -78,7 +78,7 @@ BI.Pane = BI.inherit(BI.Widget, {
loaded: function () {
var self = this, o = this.options;
BI.Layers.remove(self.getName());
BI.Maskers.remove(self.getName());
this._loading && this._loading.destroy();
this._loading && (this._loading = null);
o.onLoaded();

2
src/base/single/text.js

@ -110,7 +110,7 @@ BI.Text = BI.inherit(BI.Single, {
setText: function (text) {
BI.Text.superclass.setText.apply(this, arguments);
this.options.text = text;
this.text.element.html(BI.escape(text).replaceAll(" ", "&nbsp;"));
this.text.element.text((text + "").replaceAll(" ", " "));
}
});

20
src/base/tree/treeview.js

@ -306,14 +306,15 @@ BI.TreeView = BI.inherit(BI.Pane, {
//处理节点
_dealWidthNodes: function (nodes) {
var self = this, o = this.options;
//处理标红
if (BI.isKey(o.paras.keyword)) {
var keyword = o.paras.keyword;
var ns = BI.Tree.arrayFormat(nodes);
BI.each(ns, function (i, n) {
n.text = $("<div>").__textKeywordMarked__(n.text, keyword, n.py).html();
});
}
var ns = BI.Tree.arrayFormat(nodes);
BI.each(ns, function (i, n) {
//处理标红
if (BI.isKey(o.paras.keyword)) {
n.text = $("<div>").__textKeywordMarked__(n.text, o.paras.keyword, n.py).html();
} else {
n.text = (n.text + "").replaceAll(" ", " ");
}
});
return nodes;
},
@ -399,7 +400,8 @@ BI.TreeView = BI.inherit(BI.Pane, {
},
view: {
showIcon: false,
expandSpeed: ""
expandSpeed: "",
nameIsHTML: true
},
callback: {}
};

6
src/core/func/dom.js

@ -20,7 +20,7 @@ BI.extend(jQuery.fn, {
*/
__textKeywordMarked__: function (text, keyword, py) {
if (!BI.isKey(keyword)) {
return this.text(text);
return this.text((text + "").replaceAll(" ", " "));
}
keyword = keyword + "";
keyword = BI.toUpperCase(keyword);
@ -43,7 +43,7 @@ BI.extend(jQuery.fn, {
if (tidx >= 0) {
this.append(textLeft.substr(0, tidx));
this.append($("<span>").addClass("bi-keyword-red-mark")
.text(textLeft.substr(tidx, keyword.length)));
.text(textLeft.substr(tidx, keyword.length).replaceAll(" ", " ")));
textLeft = textLeft.substr(tidx + keyword.length);
if (py != null) {
@ -52,7 +52,7 @@ BI.extend(jQuery.fn, {
} else if (pidx != null && pidx >= 0 && Math.floor(pidx / text.length) === Math.floor((pidx + keyword.length - 1) / text.length)) {
this.append(textLeft.substr(0, pidx));
this.append($("<span>").addClass("bi-keyword-red-mark")
.text(textLeft.substr(pidx, keyword.length)));
.text(textLeft.substr(pidx, keyword.length).replaceAll(" ", " ")));
if (py != null) {
py = py.substr(pidx + keyword.length);
}

2
src/widget/downlist/combo.downlist.js

@ -47,7 +47,7 @@ BI.DownListCombo = BI.inherit(BI.Widget, {
popup: {
el: this.popupview,
stopPropagation: true,
maxHeight: 400
maxHeight: 1000
}
});

37
src/widget/sequencetable/listnumber.sequencetable.js

@ -35,12 +35,6 @@ BI.SequenceTableListNumber = BI.inherit(BI.Widget, {
this.renderedCells = [];
this.renderedKeys = [];
this.header = BI.createWidget(o.sequenceHeaderCreator || {
type: "bi.table_style_cell",
cls: "sequence-table-title-cell bi-border",
styleGetter: o.headerCellStyleGetter,
text: BI.i18nText("BI-Number_Index")
});
this.container = BI.createWidget({
type: "bi.absolute",
width: 60,
@ -54,12 +48,19 @@ BI.SequenceTableListNumber = BI.inherit(BI.Widget, {
items: [this.container]
});
this.headerContainer = BI.createWidget({
type: "bi.absolute",
cls: "bi-border",
width: 58,
scrollable: false
});
this.layout = BI.createWidget({
type: "bi.vtape",
element: this,
items: [{
el: this.header,
height: o.headerRowSize * o.header.length
el: this.headerContainer,
height: o.headerRowSize * o.header.length - 2
}, {
el: this.scrollContainer
}]
@ -82,6 +83,26 @@ BI.SequenceTableListNumber = BI.inherit(BI.Widget, {
this.scrollContainer.element.scrollTop(o.scrollTop);
},
_createHeader: function () {
var o = this.options;
BI.createWidget({
type: "bi.absolute",
element: this.headerContainer,
items: [{
el: o.sequenceHeaderCreator || {
type: "bi.table_style_cell",
cls: "sequence-table-title-cell",
styleGetter: o.headerCellStyleGetter,
text: BI.i18nText("BI-Number_Index")
},
left: 0,
top: 0,
right: 0,
bottom: 0
}]
});
},
_calculateChildrenToRender: function () {
var self = this, o = this.options;
var scrollTop = BI.clamp(o.scrollTop, 0, o.rowSize * o.items.length - (o.height - o.header.length * o.headerRowSize) + BI.DOM.getScrollWidth());

44
src/widget/sequencetable/treenumber.sequencetable.js

@ -35,12 +35,6 @@ BI.SequenceTableTreeNumber = BI.inherit(BI.Widget, {
this.renderedCells = [];
this.renderedKeys = [];
this.header = BI.createWidget(o.sequenceHeaderCreator || {
type: "bi.table_style_cell",
cls: "sequence-table-title-cell bi-border",
styleGetter: o.headerCellStyleGetter,
text: BI.i18nText("BI-Number_Index")
});
this.container = BI.createWidget({
type: "bi.absolute",
width: 60,
@ -54,13 +48,20 @@ BI.SequenceTableTreeNumber = BI.inherit(BI.Widget, {
items: [this.container]
});
this.headerContainer = BI.createWidget({
type: "bi.absolute",
cls: "bi-border",
width: 58,
scrollable: false
});
this.layout = BI.createWidget({
type: "bi.vtape",
element: this,
items: [{
el: this.header,
height: this._getHeaderHeight()
}, {
el: this.headerContainer,
height: this._getHeaderHeight() - 2
}, {el: {type: "bi.layout"}, height: 2}, {
el: this.scrollContainer
}]
});
@ -168,7 +169,7 @@ BI.SequenceTableTreeNumber = BI.inherit(BI.Widget, {
_layout: function () {
var self = this, o = this.options;
var headerHeight = this._getHeaderHeight();
var headerHeight = this._getHeaderHeight() - 2;
var items = this.layout.attr("items");
if (o.isNeedFreeze === false) {
items[0].height = 0;
@ -217,6 +218,26 @@ BI.SequenceTableTreeNumber = BI.inherit(BI.Widget, {
return Math.max(0, cnt * this.options.rowSize - (this.options.height - this._getHeaderHeight()) + BI.DOM.getScrollWidth());
},
_createHeader: function () {
var o = this.options;
BI.createWidget({
type: "bi.absolute",
element: this.headerContainer,
items: [{
el: o.sequenceHeaderCreator || {
type: "bi.table_style_cell",
cls: "sequence-table-title-cell",
styleGetter: o.headerCellStyleGetter,
text: BI.i18nText("BI-Number_Index")
},
left: 0,
top: 0,
right: 0,
bottom: 0
}]
});
},
_calculateChildrenToRender: function () {
var self = this, o = this.options;
@ -322,7 +343,8 @@ BI.SequenceTableTreeNumber = BI.inherit(BI.Widget, {
task.apply(self);
});
this.tasks = [];
this.header.populate();
this.headerContainer.empty();
this._createHeader();
this._layout();
this._calculateChildrenToRender();
},

Loading…
Cancel
Save