Browse Source

BI-79568 multi_layer_down_list支持无限层级

es6
windy 4 years ago
parent
commit
e2101d6415
  1. 1
      changelog.md
  2. 73
      src/widget/multilayerdownlist/popup.downlist.js

1
changelog.md

@ -1,5 +1,6 @@
# 更新日志 # 更新日志
2.0(2020-12) 2.0(2020-12)
- multi_layer_down_list_combo支持无限层级
- 新增不带全选的同步复选下拉框 - 新增不带全选的同步复选下拉框
- 日期选择控件为年月选择器子组件新增POPUP弹出前事件 - 日期选择控件为年月选择器子组件新增POPUP弹出前事件
- 文件上传控件新增API(setMaxFileLength)以动态设置最大上传文件数量 - 文件上传控件新增API(setMaxFileLength)以动态设置最大上传文件数量

73
src/widget/multilayerdownlist/popup.downlist.js

@ -109,33 +109,7 @@ BI.MultiLayerDownListPopup = BI.inherit(BI.Pane, {
}, },
innerVGap: 5 innerVGap: 5
}; };
item.el.childValues = []; self._createChildren(item);
BI.each(item.children, function (i, child) {
child = child.el ? BI.extend(child.el, {children: child.children}) : child;
var fatherValue = BI.deepClone(item.el.value);
var childValue = BI.deepClone(child.value);
self.singleValues.push(child.value);
child.type = "bi.down_list_item";
child.extraCls = " child-down-list-item";
child.title = child.title || child.text;
child.textRgap = 10;
child.isNeedAdjustWidth = false;
child.logic = {
dynamic: true
};
child.father = fatherValue;
self.fatherValueMap[self._createChildValue(fatherValue, childValue)] = fatherValue;
self.childValueMap[self._createChildValue(fatherValue, childValue)] = childValue;
child.value = self._createChildValue(fatherValue, childValue);
item.el.childValues.push(child.value);
if (BI.isNotEmptyArray(child.children)) {
child.type = "bi.down_list_group_item";
self._createChildren(child);
child.height = self.constants.height;
child.iconCls2 = self.constants.nextIcon;
item.el.childValues = BI.concat(item.el.childValues, child.childValues);
}
});
} else { } else {
item.type = "bi.down_list_item"; item.type = "bi.down_list_item";
item.title = item.title || item.text; item.title = item.title || item.text;
@ -177,27 +151,46 @@ BI.MultiLayerDownListPopup = BI.inherit(BI.Pane, {
return result; return result;
}, },
_createChildren: function (child) { _createChildren: function (item) {
var self = this; var self = this;
child.childValues = []; this._formatEL(item).el.childValues = [];
BI.each(child.children, function (i, c) { BI.each(item.children, function (i, child) {
var fatherValue = BI.deepClone(child.value); child = child.el ? BI.extend(child.el, {children: child.children}) : child;
var childValue = BI.deepClone(c.value); var fatherValue = BI.deepClone(self._formatEL(item).el.value);
c.type = "bi.down_list_item"; var childValue = BI.deepClone(child.value);
c.title = c.title || c.text; self.singleValues.push(child.value);
c.textRgap = 10; child.type = "bi.down_list_item";
c.isNeedAdjustWidth = false; child.extraCls = " child-down-list-item";
c.logic = { child.title = child.title || child.text;
child.textRgap = 10;
child.isNeedAdjustWidth = false;
child.logic = {
dynamic: true dynamic: true
}; };
c.father = fatherValue; child.father = fatherValue;
self.fatherValueMap[self._createChildValue(fatherValue, childValue)] = fatherValue; self.fatherValueMap[self._createChildValue(fatherValue, childValue)] = fatherValue;
self.childValueMap[self._createChildValue(fatherValue, childValue)] = childValue; self.childValueMap[self._createChildValue(fatherValue, childValue)] = childValue;
c.value = self._createChildValue(fatherValue, childValue); child.value = self._createChildValue(fatherValue, childValue);
child.childValues.push(c.value); self._formatEL(item).el.childValues.push(child.value);
if (BI.isNotEmptyArray(child.children)) {
child.type = "bi.down_list_group_item";
child.iconCls2 = self.constants.nextIcon;
child.height = self.constants.height;
self._createChildren(child);
}
}); });
}, },
_formatEL: function(obj) {
if (obj && obj.el) {
return obj;
}
return {
el: obj
};
},
_isGroup: function (i) { _isGroup: function (i) {
return i.length > 1; return i.length > 1;
}, },

Loading…
Cancel
Save