Browse Source

Merge pull request #240 in ~GUY/fineui from ~WINDY/fineui:BI4.1 to BI4.1

* commit '13af803b279b4bcd713303a419ccf3f05edd0d16':
  quick_grid_table
  text html中字符处理
es6
windy 7 years ago
parent
commit
663b06483a
  1. 7
      bi/base.js
  2. 27
      bi/core.js
  3. 7
      dist/base.js
  4. 34
      dist/bundle.js
  5. 52
      dist/bundle.min.js
  6. 27
      dist/core.js
  7. 2
      src/base/single/text.js
  8. 5
      src/base/table/table.grid.quick.js
  9. 6
      src/core/func/dom.js
  10. 21
      src/core/func/function.js

7
bi/base.js

@ -581,7 +581,7 @@ BI.Text = BI.inherit(BI.Single, {
setText: function (text) { setText: function (text) {
BI.Text.superclass.setText.apply(this, arguments); BI.Text.superclass.setText.apply(this, arguments);
this.options.text = text; this.options.text = text;
this.text.element.html(( this[0] && this[0].ownerDocument || document ).createTextNode( (text + "").replaceAll(" ", " ") )); this.text.element.html(BI.Func.formatSpecialCharInHtml(text));
} }
}); });
@ -30511,6 +30511,11 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, {
this.bottomRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0); this.bottomRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0);
this.bottomRightGrid.setEstimatedRowSize(o.rowSize); 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"); var items = this.contextLayout.attr("items");
items[1].left = regionSize; items[1].left = regionSize;
items[2].top = this._getFreezeHeaderHeight(); items[2].top = this._getFreezeHeaderHeight();

27
bi/core.js

@ -19278,7 +19278,7 @@ BI.extend(jQuery.fn, {
*/ */
__textKeywordMarked__: function (text, keyword, py) { __textKeywordMarked__: function (text, keyword, py) {
if (!BI.isKey(keyword) || (text + "").length > 100) { if (!BI.isKey(keyword) || (text + "").length > 100) {
return this.html(( this[0] && this[0].ownerDocument || document ).createTextNode((text + "").replaceAll(" ", " "))); return this.html(BI.Func.formatSpecialCharInHtml(text));
} }
keyword = keyword + ""; keyword = keyword + "";
keyword = BI.toUpperCase(keyword); keyword = BI.toUpperCase(keyword);
@ -19301,7 +19301,7 @@ BI.extend(jQuery.fn, {
if (tidx >= 0) { if (tidx >= 0) {
this.append(textLeft.substr(0, tidx)); this.append(textLeft.substr(0, tidx));
this.append($("<span>").addClass("bi-keyword-red-mark") this.append($("<span>").addClass("bi-keyword-red-mark")
.html(( this[0] && this[0].ownerDocument || document ).createTextNode(textLeft.substr(tidx, keyword.length).replaceAll(" ", "&nbsp;")))); .html(BI.Func.formatSpecialCharInHtml(textLeft.substr(tidx, keyword.length))));
textLeft = textLeft.substr(tidx + keyword.length); textLeft = textLeft.substr(tidx + keyword.length);
if (py != null) { if (py != null) {
@ -19310,7 +19310,7 @@ BI.extend(jQuery.fn, {
} else if (pidx != null && pidx >= 0 && Math.floor(pidx / text.length) === Math.floor((pidx + keyword.length - 1) / text.length)) { } 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(textLeft.substr(0, pidx));
this.append($("<span>").addClass("bi-keyword-red-mark") this.append($("<span>").addClass("bi-keyword-red-mark")
.html(( this[0] && this[0].ownerDocument || document ).createTextNode(textLeft.substr(pidx, keyword.length).replaceAll(" ", "&nbsp;")))); .html(BI.Func.formatSpecialCharInHtml(textLeft.substr(pidx, keyword.length))));
if (py != null) { if (py != null) {
py = py.substr(pidx + keyword.length); py = py.substr(pidx + keyword.length);
} }
@ -19915,6 +19915,27 @@ BI.extend(BI.Func, {
matched: matched, matched: matched,
finded: finded finded: finded
} }
},
/**
* 将字符串中的尖括号等字符encode成html能解析的形式
* @param str
*/
formatSpecialCharInHtml: function (str) {
return (str + "").replaceAll("\\s|<=?|>=?", function (str) {
switch (str) {
case "<":
return "&lt;";
case "<=":
return "&le;";
case ">":
return "&gt;";
case ">=":
return "&ge;";
default:
return "&nbsp;";
}
});
} }
}); });

7
dist/base.js vendored

@ -581,7 +581,7 @@ BI.Text = BI.inherit(BI.Single, {
setText: function (text) { setText: function (text) {
BI.Text.superclass.setText.apply(this, arguments); BI.Text.superclass.setText.apply(this, arguments);
this.options.text = text; this.options.text = text;
this.text.element.html(( this[0] && this[0].ownerDocument || document ).createTextNode( (text + "").replaceAll(" ", "&nbsp;") )); this.text.element.html(BI.Func.formatSpecialCharInHtml(text));
} }
}); });
@ -30511,6 +30511,11 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, {
this.bottomRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0); this.bottomRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0);
this.bottomRightGrid.setEstimatedRowSize(o.rowSize); 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"); var items = this.contextLayout.attr("items");
items[1].left = regionSize; items[1].left = regionSize;
items[2].top = this._getFreezeHeaderHeight(); items[2].top = this._getFreezeHeaderHeight();

34
dist/bundle.js vendored

@ -19278,7 +19278,7 @@ BI.extend(jQuery.fn, {
*/ */
__textKeywordMarked__: function (text, keyword, py) { __textKeywordMarked__: function (text, keyword, py) {
if (!BI.isKey(keyword) || (text + "").length > 100) { if (!BI.isKey(keyword) || (text + "").length > 100) {
return this.html(( this[0] && this[0].ownerDocument || document ).createTextNode((text + "").replaceAll(" ", "&nbsp;"))); return this.html(BI.Func.formatSpecialCharInHtml(text));
} }
keyword = keyword + ""; keyword = keyword + "";
keyword = BI.toUpperCase(keyword); keyword = BI.toUpperCase(keyword);
@ -19301,7 +19301,7 @@ BI.extend(jQuery.fn, {
if (tidx >= 0) { if (tidx >= 0) {
this.append(textLeft.substr(0, tidx)); this.append(textLeft.substr(0, tidx));
this.append($("<span>").addClass("bi-keyword-red-mark") this.append($("<span>").addClass("bi-keyword-red-mark")
.html(( this[0] && this[0].ownerDocument || document ).createTextNode(textLeft.substr(tidx, keyword.length).replaceAll(" ", "&nbsp;")))); .html(BI.Func.formatSpecialCharInHtml(textLeft.substr(tidx, keyword.length))));
textLeft = textLeft.substr(tidx + keyword.length); textLeft = textLeft.substr(tidx + keyword.length);
if (py != null) { if (py != null) {
@ -19310,7 +19310,7 @@ BI.extend(jQuery.fn, {
} else if (pidx != null && pidx >= 0 && Math.floor(pidx / text.length) === Math.floor((pidx + keyword.length - 1) / text.length)) { } 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(textLeft.substr(0, pidx));
this.append($("<span>").addClass("bi-keyword-red-mark") this.append($("<span>").addClass("bi-keyword-red-mark")
.html(( this[0] && this[0].ownerDocument || document ).createTextNode(textLeft.substr(pidx, keyword.length).replaceAll(" ", "&nbsp;")))); .html(BI.Func.formatSpecialCharInHtml(textLeft.substr(pidx, keyword.length))));
if (py != null) { if (py != null) {
py = py.substr(pidx + keyword.length); py = py.substr(pidx + keyword.length);
} }
@ -19915,6 +19915,27 @@ BI.extend(BI.Func, {
matched: matched, matched: matched,
finded: finded finded: finded
} }
},
/**
* 将字符串中的尖括号等字符encode成html能解析的形式
* @param str
*/
formatSpecialCharInHtml: function (str) {
return (str + "").replaceAll("\\s|<=?|>=?", function (str) {
switch (str) {
case "<":
return "&lt;";
case "<=":
return "&le;";
case ">":
return "&gt;";
case ">=":
return "&ge;";
default:
return "&nbsp;";
}
});
} }
}); });
@ -26428,7 +26449,7 @@ BI.Text = BI.inherit(BI.Single, {
setText: function (text) { setText: function (text) {
BI.Text.superclass.setText.apply(this, arguments); BI.Text.superclass.setText.apply(this, arguments);
this.options.text = text; this.options.text = text;
this.text.element.html(( this[0] && this[0].ownerDocument || document ).createTextNode( (text + "").replaceAll(" ", "&nbsp;") )); this.text.element.html(BI.Func.formatSpecialCharInHtml(text));
} }
}); });
@ -56358,6 +56379,11 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, {
this.bottomRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0); this.bottomRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0);
this.bottomRightGrid.setEstimatedRowSize(o.rowSize); 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"); var items = this.contextLayout.attr("items");
items[1].left = regionSize; items[1].left = regionSize;
items[2].top = this._getFreezeHeaderHeight(); items[2].top = this._getFreezeHeaderHeight();

52
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

27
dist/core.js vendored

@ -19278,7 +19278,7 @@ BI.extend(jQuery.fn, {
*/ */
__textKeywordMarked__: function (text, keyword, py) { __textKeywordMarked__: function (text, keyword, py) {
if (!BI.isKey(keyword) || (text + "").length > 100) { if (!BI.isKey(keyword) || (text + "").length > 100) {
return this.html(( this[0] && this[0].ownerDocument || document ).createTextNode((text + "").replaceAll(" ", "&nbsp;"))); return this.html(BI.Func.formatSpecialCharInHtml(text));
} }
keyword = keyword + ""; keyword = keyword + "";
keyword = BI.toUpperCase(keyword); keyword = BI.toUpperCase(keyword);
@ -19301,7 +19301,7 @@ BI.extend(jQuery.fn, {
if (tidx >= 0) { if (tidx >= 0) {
this.append(textLeft.substr(0, tidx)); this.append(textLeft.substr(0, tidx));
this.append($("<span>").addClass("bi-keyword-red-mark") this.append($("<span>").addClass("bi-keyword-red-mark")
.html(( this[0] && this[0].ownerDocument || document ).createTextNode(textLeft.substr(tidx, keyword.length).replaceAll(" ", "&nbsp;")))); .html(BI.Func.formatSpecialCharInHtml(textLeft.substr(tidx, keyword.length))));
textLeft = textLeft.substr(tidx + keyword.length); textLeft = textLeft.substr(tidx + keyword.length);
if (py != null) { if (py != null) {
@ -19310,7 +19310,7 @@ BI.extend(jQuery.fn, {
} else if (pidx != null && pidx >= 0 && Math.floor(pidx / text.length) === Math.floor((pidx + keyword.length - 1) / text.length)) { } 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(textLeft.substr(0, pidx));
this.append($("<span>").addClass("bi-keyword-red-mark") this.append($("<span>").addClass("bi-keyword-red-mark")
.html(( this[0] && this[0].ownerDocument || document ).createTextNode(textLeft.substr(pidx, keyword.length).replaceAll(" ", "&nbsp;")))); .html(BI.Func.formatSpecialCharInHtml(textLeft.substr(pidx, keyword.length))));
if (py != null) { if (py != null) {
py = py.substr(pidx + keyword.length); py = py.substr(pidx + keyword.length);
} }
@ -19915,6 +19915,27 @@ BI.extend(BI.Func, {
matched: matched, matched: matched,
finded: finded finded: finded
} }
},
/**
* 将字符串中的尖括号等字符encode成html能解析的形式
* @param str
*/
formatSpecialCharInHtml: function (str) {
return (str + "").replaceAll("\\s|<=?|>=?", function (str) {
switch (str) {
case "<":
return "&lt;";
case "<=":
return "&le;";
case ">":
return "&gt;";
case ">=":
return "&ge;";
default:
return "&nbsp;";
}
});
} }
}); });

2
src/base/single/text.js

@ -114,7 +114,7 @@ BI.Text = BI.inherit(BI.Single, {
setText: function (text) { setText: function (text) {
BI.Text.superclass.setText.apply(this, arguments); BI.Text.superclass.setText.apply(this, arguments);
this.options.text = text; this.options.text = text;
this.text.element.html(( this[0] && this[0].ownerDocument || document ).createTextNode( (text + "").replaceAll(" ", "&nbsp;") )); this.text.element.html(BI.Func.formatSpecialCharInHtml(text));
} }
}); });

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

@ -169,6 +169,11 @@ BI.QuickGridTable = BI.inherit(BI.GridTable, {
this.bottomRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0); this.bottomRightGrid.setEstimatedColumnSize((o.columnSize.length - freezeColLength) > 0 ? (totalRightColumnSize / (o.columnSize.length - freezeColLength)) : 0);
this.bottomRightGrid.setEstimatedRowSize(o.rowSize); 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"); var items = this.contextLayout.attr("items");
items[1].left = regionSize; items[1].left = regionSize;
items[2].top = this._getFreezeHeaderHeight(); items[2].top = this._getFreezeHeaderHeight();

6
src/core/func/dom.js

@ -20,7 +20,7 @@ BI.extend(jQuery.fn, {
*/ */
__textKeywordMarked__: function (text, keyword, py) { __textKeywordMarked__: function (text, keyword, py) {
if (!BI.isKey(keyword) || (text + "").length > 100) { if (!BI.isKey(keyword) || (text + "").length > 100) {
return this.html(( this[0] && this[0].ownerDocument || document ).createTextNode((text + "").replaceAll(" ", "&nbsp;"))); return this.html(BI.Func.formatSpecialCharInHtml(text));
} }
keyword = keyword + ""; keyword = keyword + "";
keyword = BI.toUpperCase(keyword); keyword = BI.toUpperCase(keyword);
@ -43,7 +43,7 @@ BI.extend(jQuery.fn, {
if (tidx >= 0) { if (tidx >= 0) {
this.append(textLeft.substr(0, tidx)); this.append(textLeft.substr(0, tidx));
this.append($("<span>").addClass("bi-keyword-red-mark") this.append($("<span>").addClass("bi-keyword-red-mark")
.html(( this[0] && this[0].ownerDocument || document ).createTextNode(textLeft.substr(tidx, keyword.length).replaceAll(" ", "&nbsp;")))); .html(BI.Func.formatSpecialCharInHtml(textLeft.substr(tidx, keyword.length))));
textLeft = textLeft.substr(tidx + keyword.length); textLeft = textLeft.substr(tidx + keyword.length);
if (py != null) { 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)) { } 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(textLeft.substr(0, pidx));
this.append($("<span>").addClass("bi-keyword-red-mark") this.append($("<span>").addClass("bi-keyword-red-mark")
.html(( this[0] && this[0].ownerDocument || document ).createTextNode(textLeft.substr(pidx, keyword.length).replaceAll(" ", "&nbsp;")))); .html(BI.Func.formatSpecialCharInHtml(textLeft.substr(pidx, keyword.length))));
if (py != null) { if (py != null) {
py = py.substr(pidx + keyword.length); py = py.substr(pidx + keyword.length);
} }

21
src/core/func/function.js

@ -68,6 +68,27 @@ BI.extend(BI.Func, {
matched: matched, matched: matched,
finded: finded finded: finded
} }
},
/**
* 将字符串中的尖括号等字符encode成html能解析的形式
* @param str
*/
formatSpecialCharInHtml: function (str) {
return (str + "").replaceAll("\\s|<=?|>=?", function (str) {
switch (str) {
case "<":
return "&lt;";
case "<=":
return "&le;";
case ">":
return "&gt;";
case ">=":
return "&ge;";
default:
return "&nbsp;";
}
});
} }
}); });

Loading…
Cancel
Save