Browse Source

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

* commit '62679ef5f4c49ee2c6db547409de86582803abdf':
  update
  BI-56386 && REPORT-24409 fix: 同步复选树open属性问题与多音字连续搜索的问题
es6
windy 5 years ago
parent
commit
2e79d8d9d6
  1. 2
      changelog.md
  2. 11
      src/component/treevaluechooser/abstract.treevaluechooser.js
  3. 7
      src/core/func/function.js
  4. 14
      src/core/platform/web/jquery/fn.js
  5. 12
      src/core/utils/chinesePY.js

2
changelog.md

@ -1,5 +1,7 @@
# 更新日志 # 更新日志
2.0(2019-11) 2.0(2019-11)
- 修复了同步复选树设置节点默认open后, 叶子节点无法选中的问题
- 修复了连续多音字搜索可能导致结果异常或者标红异常的问题
- 新增BI.set(object, path, value)方法 - 新增BI.set(object, path, value)方法
- getSearchResult兼容了对null值的处理 - getSearchResult兼容了对null值的处理
- 增加了异步单选下拉树请求完数据后加载完节点后会自动调整宽高的逻辑 - 增加了异步单选下拉树请求完数据后加载完节点后会自动调整宽高的逻辑

11
src/component/treevaluechooser/abstract.treevaluechooser.js

@ -550,7 +550,16 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
}); });
BI.each(allNodes, function (idx, node) { BI.each(allNodes, function (idx, node) {
var valueMap = dealWithSelectedValue(node.parentValues, selectedValues); var valueMap = dealWithSelectedValue(node.parentValues, selectedValues);
var state = getCheckState(node.value, node.parentValues, valueMap, checkState); // REPORT-24409 fix: 设置节点全部展开,添加的节点没有给状态
var parentCheckState = {};
var find = BI.find(result, function (idx, pNode) {
return pNode.id === node.pId;
});
if (find) {
parentCheckState.checked = find.halfCheck ? false : find.checked;
parentCheckState.half = find.halfCheck;
}
var state = getCheckState(node.value, node.parentValues, valueMap, parentCheckState);
result.push({ result.push({
id: node.id, id: node.id,
pId: node.pId, pId: node.pId,

7
src/core/func/function.js

@ -67,7 +67,9 @@ _.extend(BI.Func, {
if (BI.isNull(text) || BI.isObject(text)) return; if (BI.isNull(text) || BI.isObject(text)) return;
py = BI.makeFirstPY(text); py = BI.makeFirstPY(text, {
splitChar: "\u200b"
});
text = BI.toUpperCase(text); text = BI.toUpperCase(text);
py = BI.toUpperCase(py); py = BI.toUpperCase(py);
var pidx; var pidx;
@ -77,7 +79,8 @@ _.extend(BI.Func, {
} else { } else {
isArray ? find.push(item) : (find[i] = item); isArray ? find.push(item) : (find[i] = item);
} }
} else if (pidx = py.indexOf(keyword), (pidx > -1 && Math.floor(pidx / text.length) === Math.floor((pidx + keyword.length - 1) / text.length))) { // BI-56386 这边两个pid / text.length是为了防止截取的首字符串不是完整的,但光这样做还不够,即时错位了,也不能说明就不符合条件
} else if (pidx = py.indexOf(keyword), (pidx > -1)) {
if (text === keyword || keyword.length === text.length) { if (text === keyword || keyword.length === text.length) {
isArray ? matched.push(item) : (matched[i] = item); isArray ? matched.push(item) : (matched[i] = item);
} else { } else {

14
src/core/platform/web/jquery/fn.js vendored

@ -79,7 +79,9 @@ if (BI.jQuery) {
keyword = keyword + ""; keyword = keyword + "";
keyword = BI.toUpperCase(keyword); keyword = BI.toUpperCase(keyword);
var textLeft = (text || "") + ""; var textLeft = (text || "") + "";
py = (py || BI.makeFirstPY(text)) + ""; py = (py || BI.makeFirstPY(text, {
splitChar: "\u200b"
})) + "";
if (py != null) { if (py != null) {
py = BI.toUpperCase(py); py = BI.toUpperCase(py);
} }
@ -92,7 +94,7 @@ if (BI.jQuery) {
if (py != null) { if (py != null) {
pidx = py.indexOf(keyword); pidx = py.indexOf(keyword);
if (pidx >= 0) { if (pidx >= 0) {
pidx = pidx % text.length; pidx = (pidx - Math.floor(pidx / (textLeft.length + 1))) % textLeft.length;
} }
} }
@ -106,13 +108,17 @@ if (BI.jQuery) {
if (py != null) { if (py != null) {
py = py.substr(tidx + keyword.length); py = py.substr(tidx + keyword.length);
} }
} 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) {
// BI-56386 这边两个pid / text.length是为了防止截取的首字符串不是完整的,但光这样做还不够,即时错位了,也不能说明就不符合条件
// 标红的text未encode // 标红的text未encode
this.append(BI.htmlEncode(textLeft.substr(0, pidx))); this.append(BI.htmlEncode(textLeft.substr(0, pidx)));
this.append(BI.$("<span>").addClass("bi-keyword-red-mark") this.append(BI.$("<span>").addClass("bi-keyword-red-mark")
.html(BI.htmlEncode(textLeft.substr(pidx, keyword.length)))); .html(BI.htmlEncode(textLeft.substr(pidx, keyword.length))));
if (py != null) { if (py != null) {
py = py.substr(pidx + keyword.length); // 每一组拼音都应该前进,而不是只是当前的
py = BI.map(py.split("\u200b"), function (idx, ps) {
return ps.slice(pidx + keyword.length);
}).join("\u200b");
} }
textLeft = textLeft.substr(pidx + keyword.length); textLeft = textLeft.substr(pidx + keyword.length);
} else { } else {

12
src/core/utils/chinesePY.js

File diff suppressed because one or more lines are too long
Loading…
Cancel
Save