guy 2 years ago
parent
commit
73b66eeb77
  1. 6
      demo/js/widget/downlist/demo.downlist.js
  2. 2
      package.json
  3. 4
      src/component/treevaluechooser/abstract.treevaluechooser.js
  4. 45
      src/widget/downlist/combo.downlist.js

6
demo/js/widget/downlist/demo.downlist.js

@ -47,11 +47,9 @@ Demo.Downlist = BI.inherit(BI.Widget, {
width: 100, width: 100,
items: [ items: [
[{ [{
el: {
text: "column 1111", text: "column 1111",
iconCls1: "dot-e-font", iconCls1: "dot-e-font",
value: 12 value: 12,
},
children: [{ children: [{
text: "column 1.1", text: "column 1.1",
value: 21, value: 21,
@ -166,13 +164,11 @@ Demo.Downlist = BI.inherit(BI.Widget, {
}], }],
items: [ items: [
[{ [{
el: {
text: "选项一", text: "选项一",
value: 1, value: 1,
icon: { icon: {
type: "demo.downlist.icon", type: "demo.downlist.icon",
}, },
},
children: [{ children: [{
text: "选项一", text: "选项一",
value: 11, value: 11,

2
package.json

@ -1,6 +1,6 @@
{ {
"name": "fineui", "name": "fineui",
"version": "2.0.20220926101524", "version": "2.0.20220926194535",
"description": "fineui", "description": "fineui",
"main": "dist/fineui_without_conflict.min.js", "main": "dist/fineui_without_conflict.min.js",
"types": "dist/lib/index.d.ts", "types": "dist/lib/index.d.ts",

4
src/component/treevaluechooser/abstract.treevaluechooser.js

@ -547,7 +547,7 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
value: nodes[i].value, value: nodes[i].value,
text: nodes[i].text, text: nodes[i].text,
times: 1, times: 1,
isParent: nodes[i].getChildrenLength() > 0, isParent: nodes[i].isParent || nodes[i].getChildrenLength() > 0,
checked: state[0], checked: state[0],
half: state[1], half: state[1],
halfCheck: openState ? false : state[1], halfCheck: openState ? false : state[1],
@ -712,7 +712,7 @@ BI.AbstractTreeValueChooser = BI.inherit(BI.Widget, {
times: 1, times: 1,
isParent: false, isParent: false,
checked: true, checked: true,
halfCheck: false halfCheck: false,
}; };
}); });
}, },

45
src/widget/downlist/combo.downlist.js

@ -1,7 +1,35 @@
/** (function() {
function transformItems(items) {
if (!items) return items;
var result = BI.cloneDeep(items);
var isComplexItmes = BI.some(items, function (_, item) {
return BI.isArray(item);
});
// 传一维数组,帮转二维
if (!isComplexItmes) {
result = [result];
}
// 帮转 el
BI.each(result, function (_, arr) {
BI.each(arr, function (_, item) {
if (item.children && !item.el) {
item.el = {
text: item.text,
icon: item.icon,
cls: item.cls,
iconCls1: item.iconCls1,
value: item.value
};
}
});
});
return result;
}
/**
* Created by roy on 15/8/14. * Created by roy on 15/8/14.
*/ */
BI.DownListCombo = BI.inherit(BI.Widget, { BI.DownListCombo = BI.inherit(BI.Widget, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.DownListCombo.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.DownListCombo.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-down-list-combo", baseCls: "bi-down-list-combo",
@ -47,7 +75,7 @@ BI.DownListCombo = BI.inherit(BI.Widget, {
ref: function (ref) { ref: function (ref) {
self.popupView = ref; self.popupView = ref;
}, },
items: o.items, items: transformItems(o.items),
chooseType: o.chooseType, chooseType: o.chooseType,
value: o.value, value: o.value,
listeners: [{ listeners: [{
@ -102,9 +130,10 @@ BI.DownListCombo = BI.inherit(BI.Widget, {
adjustHeight: function () { adjustHeight: function () {
this.downlistcombo.adjustHeight(); this.downlistcombo.adjustHeight();
} }
}); });
BI.DownListCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.DownListCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.DownListCombo.EVENT_SON_VALUE_CHANGE = "EVENT_SON_VALUE_CHANGE"; BI.DownListCombo.EVENT_SON_VALUE_CHANGE = "EVENT_SON_VALUE_CHANGE";
BI.DownListCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; BI.DownListCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW";
BI.shortcut("bi.down_list_combo", BI.DownListCombo); BI.shortcut("bi.down_list_combo", BI.DownListCombo);
}());

Loading…
Cancel
Save