Browse Source

icon_combo修改

es6
windy 7 years ago
parent
commit
1ca816251f
  1. 2
      demo/js/case/combo/demo.icon_combo.js
  2. 4
      dist/base.js
  3. 53
      dist/bundle.js
  4. 49
      dist/case.js
  5. 2
      dist/demo.js
  6. 53
      dist/fineui.js
  7. 4
      src/base/combination/combo.js
  8. 7
      src/case/combo/iconcombo/combo.icon.js
  9. 3
      src/case/combo/iconcombo/popup.iconcombo.js
  10. 39
      src/case/combo/iconcombo/trigger.iconcombo.js

2
demo/js/case/combo/demo.icon_combo.js

@ -19,7 +19,7 @@ Demo.IconCombo = BI.inherit(BI.Widget, {
ref: function (_ref) { ref: function (_ref) {
self.refs = _ref; self.refs = _ref;
}, },
iconCls: "search-font", value: "第二项",
items: [{ items: [{
value: "第一项", value: "第一项",
iconCls: "close-font" iconCls: "close-font"

4
dist/base.js vendored

@ -3179,7 +3179,9 @@ BI.Combo = BI.inherit(BI.Widget, {
// return; // return;
// } // }
// BI-10290 公式combo双击公式内容会收起 // BI-10290 公式combo双击公式内容会收起
if (this.element.find(e.target).length > 0 || e.target.className === "CodeMirror-cursor" || $(e.target).closest(".CodeMirror-hints").length > 0) {// BI-9887 CodeMirror的公式弹框需要特殊处理下 if (this.element.find(e.target).length > 0
|| (this.popupView && this.popupView.element.find(e.target).length > 0)
|| e.target.className === "CodeMirror-cursor" || $(e.target).closest(".CodeMirror-hints").length > 0) {// BI-9887 CodeMirror的公式弹框需要特殊处理下
return; return;
} }
var isHide = this.options.hideChecker.apply(this, [e]); var isHide = this.options.hideChecker.apply(this, [e]);

53
dist/bundle.js vendored

@ -29052,7 +29052,9 @@ BI.Combo = BI.inherit(BI.Widget, {
// return; // return;
// } // }
// BI-10290 公式combo双击公式内容会收起 // BI-10290 公式combo双击公式内容会收起
if (this.element.find(e.target).length > 0 || e.target.className === "CodeMirror-cursor" || $(e.target).closest(".CodeMirror-hints").length > 0) {// BI-9887 CodeMirror的公式弹框需要特殊处理下 if (this.element.find(e.target).length > 0
|| (this.popupView && this.popupView.element.find(e.target).length > 0)
|| e.target.className === "CodeMirror-cursor" || $(e.target).closest(".CodeMirror-hints").length > 0) {// BI-9887 CodeMirror的公式弹框需要特殊处理下
return; return;
} }
var isHide = this.options.hideChecker.apply(this, [e]); var isHide = this.options.hideChecker.apply(this, [e]);
@ -67494,7 +67496,6 @@ BI.IconCombo = BI.inherit(BI.Widget, {
baseCls: "bi-icon-combo", baseCls: "bi-icon-combo",
width: 24, width: 24,
height: 24, height: 24,
iconCls: "",
el: {}, el: {},
popup: {}, popup: {},
minWidth: 100, minWidth: 100,
@ -67520,12 +67521,14 @@ BI.IconCombo = BI.inherit(BI.Widget, {
width: o.width, width: o.width,
height: o.height, height: o.height,
iconWidth: o.iconWidth, iconWidth: o.iconWidth,
iconHeight: o.iconHeight iconHeight: o.iconHeight,
value: o.value
}); });
this.popup = BI.createWidget(o.popup, { this.popup = BI.createWidget(o.popup, {
type: "bi.icon_combo_popup", type: "bi.icon_combo_popup",
chooseType: o.chooseType, chooseType: o.chooseType,
items: o.items items: o.items,
value: o.value
}); });
this.popup.on(BI.IconComboPopup.EVENT_CHANGE, function () { this.popup.on(BI.IconComboPopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue()); self.setValue(self.popup.getValue());
@ -67603,7 +67606,8 @@ BI.IconComboPopup = BI.inherit(BI.Pane, {
chooseType: o.chooseType, chooseType: o.chooseType,
layouts: [{ layouts: [{
type: "bi.vertical" type: "bi.vertical"
}] }],
value: o.value
}); });
this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) { this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {
@ -67654,28 +67658,35 @@ BI.IconComboTrigger = BI.inherit(BI.Trigger, {
iconCls: "", iconCls: "",
width: 25, width: 25,
height: 25, height: 25,
isShowDown: true isShowDown: true,
value: ""
}); });
}, },
_init: function () { _init: function () {
BI.IconComboTrigger.superclass._init.apply(this, arguments); BI.IconComboTrigger.superclass._init.apply(this, arguments);
var o = this.options, self = this; var o = this.options, self = this;
var iconCls = "";
if(BI.isKey(o.value)){
iconCls = this._digest(o.value, o.items);
}
this.button = BI.createWidget(o.el, { this.button = BI.createWidget(o.el, {
type: "bi.icon_change_button", type: "bi.icon_change_button",
cls: "icon-combo-trigger-icon " + o.iconCls, cls: "icon-combo-trigger-icon " + iconCls,
disableSelected: true, disableSelected: true,
width: o.width, width: o.width,
height: o.height, height: o.height,
iconWidth: o.iconWidth, iconWidth: o.iconWidth,
iconHeight: o.iconHeight iconHeight: o.iconHeight,
selected: BI.isNotEmptyString(iconCls)
}); });
this.down = BI.createWidget({ this.down = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
disableSelected: true, disableSelected: true,
cls: "icon-combo-down-icon trigger-triangle-font", cls: "icon-combo-down-icon trigger-triangle-font",
width: 12, width: 12,
height: 8 height: 8,
selected: BI.isNotEmptyString(iconCls)
}); });
this.down.setVisible(o.isShowDown); this.down.setVisible(o.isShowDown);
BI.createWidget({ BI.createWidget({
@ -67693,9 +67704,18 @@ BI.IconComboTrigger = BI.inherit(BI.Trigger, {
bottom: 0 bottom: 0
}] }]
}); });
if (BI.isKey(o.value)) { },
this.setValue(o.value);
} _digest: function (v, items) {
var iconCls = "";
v = BI.isArray(v) ? v[0] : v;
BI.any(items, function (i, item) {
if (v === item.value) {
iconCls = item.iconCls;
return true;
}
});
return iconCls;
}, },
populate: function (items) { populate: function (items) {
@ -67709,14 +67729,9 @@ BI.IconComboTrigger = BI.inherit(BI.Trigger, {
setValue: function (v) { setValue: function (v) {
BI.IconComboTrigger.superclass.setValue.apply(this, arguments); BI.IconComboTrigger.superclass.setValue.apply(this, arguments);
var o = this.options; var o = this.options;
var iconCls = ""; var iconCls = this._digest(v, this.options.items);
v = BI.isArray(v) ? v[0] : v; v = BI.isArray(v) ? v[0] : v;
if (BI.any(this.options.items, function (i, item) { if (BI.isNotEmptyString(iconCls)) {
if (v === item.value) {
iconCls = item.iconCls;
return true;
}
})) {
this.button.setIcon(iconCls); this.button.setIcon(iconCls);
this.button.setSelected(true); this.button.setSelected(true);
this.down.setSelected(true); this.down.setSelected(true);

49
dist/case.js vendored

@ -5214,7 +5214,6 @@ BI.IconCombo = BI.inherit(BI.Widget, {
baseCls: "bi-icon-combo", baseCls: "bi-icon-combo",
width: 24, width: 24,
height: 24, height: 24,
iconCls: "",
el: {}, el: {},
popup: {}, popup: {},
minWidth: 100, minWidth: 100,
@ -5240,12 +5239,14 @@ BI.IconCombo = BI.inherit(BI.Widget, {
width: o.width, width: o.width,
height: o.height, height: o.height,
iconWidth: o.iconWidth, iconWidth: o.iconWidth,
iconHeight: o.iconHeight iconHeight: o.iconHeight,
value: o.value
}); });
this.popup = BI.createWidget(o.popup, { this.popup = BI.createWidget(o.popup, {
type: "bi.icon_combo_popup", type: "bi.icon_combo_popup",
chooseType: o.chooseType, chooseType: o.chooseType,
items: o.items items: o.items,
value: o.value
}); });
this.popup.on(BI.IconComboPopup.EVENT_CHANGE, function () { this.popup.on(BI.IconComboPopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue()); self.setValue(self.popup.getValue());
@ -5323,7 +5324,8 @@ BI.IconComboPopup = BI.inherit(BI.Pane, {
chooseType: o.chooseType, chooseType: o.chooseType,
layouts: [{ layouts: [{
type: "bi.vertical" type: "bi.vertical"
}] }],
value: o.value
}); });
this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) { this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {
@ -5374,28 +5376,35 @@ BI.IconComboTrigger = BI.inherit(BI.Trigger, {
iconCls: "", iconCls: "",
width: 25, width: 25,
height: 25, height: 25,
isShowDown: true isShowDown: true,
value: ""
}); });
}, },
_init: function () { _init: function () {
BI.IconComboTrigger.superclass._init.apply(this, arguments); BI.IconComboTrigger.superclass._init.apply(this, arguments);
var o = this.options, self = this; var o = this.options, self = this;
var iconCls = "";
if(BI.isKey(o.value)){
iconCls = this._digest(o.value, o.items);
}
this.button = BI.createWidget(o.el, { this.button = BI.createWidget(o.el, {
type: "bi.icon_change_button", type: "bi.icon_change_button",
cls: "icon-combo-trigger-icon " + o.iconCls, cls: "icon-combo-trigger-icon " + iconCls,
disableSelected: true, disableSelected: true,
width: o.width, width: o.width,
height: o.height, height: o.height,
iconWidth: o.iconWidth, iconWidth: o.iconWidth,
iconHeight: o.iconHeight iconHeight: o.iconHeight,
selected: BI.isNotEmptyString(iconCls)
}); });
this.down = BI.createWidget({ this.down = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
disableSelected: true, disableSelected: true,
cls: "icon-combo-down-icon trigger-triangle-font", cls: "icon-combo-down-icon trigger-triangle-font",
width: 12, width: 12,
height: 8 height: 8,
selected: BI.isNotEmptyString(iconCls)
}); });
this.down.setVisible(o.isShowDown); this.down.setVisible(o.isShowDown);
BI.createWidget({ BI.createWidget({
@ -5413,9 +5422,18 @@ BI.IconComboTrigger = BI.inherit(BI.Trigger, {
bottom: 0 bottom: 0
}] }]
}); });
if (BI.isKey(o.value)) { },
this.setValue(o.value);
} _digest: function (v, items) {
var iconCls = "";
v = BI.isArray(v) ? v[0] : v;
BI.any(items, function (i, item) {
if (v === item.value) {
iconCls = item.iconCls;
return true;
}
});
return iconCls;
}, },
populate: function (items) { populate: function (items) {
@ -5429,14 +5447,9 @@ BI.IconComboTrigger = BI.inherit(BI.Trigger, {
setValue: function (v) { setValue: function (v) {
BI.IconComboTrigger.superclass.setValue.apply(this, arguments); BI.IconComboTrigger.superclass.setValue.apply(this, arguments);
var o = this.options; var o = this.options;
var iconCls = ""; var iconCls = this._digest(v, this.options.items);
v = BI.isArray(v) ? v[0] : v; v = BI.isArray(v) ? v[0] : v;
if (BI.any(this.options.items, function (i, item) { if (BI.isNotEmptyString(iconCls)) {
if (v === item.value) {
iconCls = item.iconCls;
return true;
}
})) {
this.button.setIcon(iconCls); this.button.setIcon(iconCls);
this.button.setSelected(true); this.button.setSelected(true);
this.down.setSelected(true); this.down.setSelected(true);

2
dist/demo.js vendored

@ -1801,7 +1801,7 @@ Demo.IconCombo = BI.inherit(BI.Widget, {
ref: function (_ref) { ref: function (_ref) {
self.refs = _ref; self.refs = _ref;
}, },
iconCls: "search-font", value: "第二项",
items: [{ items: [{
value: "第一项", value: "第一项",
iconCls: "close-font" iconCls: "close-font"

53
dist/fineui.js vendored

@ -30746,7 +30746,9 @@ BI.Combo = BI.inherit(BI.Widget, {
// return; // return;
// } // }
// BI-10290 公式combo双击公式内容会收起 // BI-10290 公式combo双击公式内容会收起
if (this.element.find(e.target).length > 0 || e.target.className === "CodeMirror-cursor" || $(e.target).closest(".CodeMirror-hints").length > 0) {// BI-9887 CodeMirror的公式弹框需要特殊处理下 if (this.element.find(e.target).length > 0
|| (this.popupView && this.popupView.element.find(e.target).length > 0)
|| e.target.className === "CodeMirror-cursor" || $(e.target).closest(".CodeMirror-hints").length > 0) {// BI-9887 CodeMirror的公式弹框需要特殊处理下
return; return;
} }
var isHide = this.options.hideChecker.apply(this, [e]); var isHide = this.options.hideChecker.apply(this, [e]);
@ -69188,7 +69190,6 @@ BI.IconCombo = BI.inherit(BI.Widget, {
baseCls: "bi-icon-combo", baseCls: "bi-icon-combo",
width: 24, width: 24,
height: 24, height: 24,
iconCls: "",
el: {}, el: {},
popup: {}, popup: {},
minWidth: 100, minWidth: 100,
@ -69214,12 +69215,14 @@ BI.IconCombo = BI.inherit(BI.Widget, {
width: o.width, width: o.width,
height: o.height, height: o.height,
iconWidth: o.iconWidth, iconWidth: o.iconWidth,
iconHeight: o.iconHeight iconHeight: o.iconHeight,
value: o.value
}); });
this.popup = BI.createWidget(o.popup, { this.popup = BI.createWidget(o.popup, {
type: "bi.icon_combo_popup", type: "bi.icon_combo_popup",
chooseType: o.chooseType, chooseType: o.chooseType,
items: o.items items: o.items,
value: o.value
}); });
this.popup.on(BI.IconComboPopup.EVENT_CHANGE, function () { this.popup.on(BI.IconComboPopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue()); self.setValue(self.popup.getValue());
@ -69297,7 +69300,8 @@ BI.IconComboPopup = BI.inherit(BI.Pane, {
chooseType: o.chooseType, chooseType: o.chooseType,
layouts: [{ layouts: [{
type: "bi.vertical" type: "bi.vertical"
}] }],
value: o.value
}); });
this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) { this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {
@ -69348,28 +69352,35 @@ BI.IconComboTrigger = BI.inherit(BI.Trigger, {
iconCls: "", iconCls: "",
width: 25, width: 25,
height: 25, height: 25,
isShowDown: true isShowDown: true,
value: ""
}); });
}, },
_init: function () { _init: function () {
BI.IconComboTrigger.superclass._init.apply(this, arguments); BI.IconComboTrigger.superclass._init.apply(this, arguments);
var o = this.options, self = this; var o = this.options, self = this;
var iconCls = "";
if(BI.isKey(o.value)){
iconCls = this._digest(o.value, o.items);
}
this.button = BI.createWidget(o.el, { this.button = BI.createWidget(o.el, {
type: "bi.icon_change_button", type: "bi.icon_change_button",
cls: "icon-combo-trigger-icon " + o.iconCls, cls: "icon-combo-trigger-icon " + iconCls,
disableSelected: true, disableSelected: true,
width: o.width, width: o.width,
height: o.height, height: o.height,
iconWidth: o.iconWidth, iconWidth: o.iconWidth,
iconHeight: o.iconHeight iconHeight: o.iconHeight,
selected: BI.isNotEmptyString(iconCls)
}); });
this.down = BI.createWidget({ this.down = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
disableSelected: true, disableSelected: true,
cls: "icon-combo-down-icon trigger-triangle-font", cls: "icon-combo-down-icon trigger-triangle-font",
width: 12, width: 12,
height: 8 height: 8,
selected: BI.isNotEmptyString(iconCls)
}); });
this.down.setVisible(o.isShowDown); this.down.setVisible(o.isShowDown);
BI.createWidget({ BI.createWidget({
@ -69387,9 +69398,18 @@ BI.IconComboTrigger = BI.inherit(BI.Trigger, {
bottom: 0 bottom: 0
}] }]
}); });
if (BI.isKey(o.value)) { },
this.setValue(o.value);
} _digest: function (v, items) {
var iconCls = "";
v = BI.isArray(v) ? v[0] : v;
BI.any(items, function (i, item) {
if (v === item.value) {
iconCls = item.iconCls;
return true;
}
});
return iconCls;
}, },
populate: function (items) { populate: function (items) {
@ -69403,14 +69423,9 @@ BI.IconComboTrigger = BI.inherit(BI.Trigger, {
setValue: function (v) { setValue: function (v) {
BI.IconComboTrigger.superclass.setValue.apply(this, arguments); BI.IconComboTrigger.superclass.setValue.apply(this, arguments);
var o = this.options; var o = this.options;
var iconCls = ""; var iconCls = this._digest(v, this.options.items);
v = BI.isArray(v) ? v[0] : v; v = BI.isArray(v) ? v[0] : v;
if (BI.any(this.options.items, function (i, item) { if (BI.isNotEmptyString(iconCls)) {
if (v === item.value) {
iconCls = item.iconCls;
return true;
}
})) {
this.button.setIcon(iconCls); this.button.setIcon(iconCls);
this.button.setSelected(true); this.button.setSelected(true);
this.down.setSelected(true); this.down.setSelected(true);

4
src/base/combination/combo.js

@ -255,7 +255,9 @@ BI.Combo = BI.inherit(BI.Widget, {
// return; // return;
// } // }
// BI-10290 公式combo双击公式内容会收起 // BI-10290 公式combo双击公式内容会收起
if (this.element.find(e.target).length > 0 || e.target.className === "CodeMirror-cursor" || $(e.target).closest(".CodeMirror-hints").length > 0) {// BI-9887 CodeMirror的公式弹框需要特殊处理下 if (this.element.find(e.target).length > 0
|| (this.popupView && this.popupView.element.find(e.target).length > 0)
|| e.target.className === "CodeMirror-cursor" || $(e.target).closest(".CodeMirror-hints").length > 0) {// BI-9887 CodeMirror的公式弹框需要特殊处理下
return; return;
} }
var isHide = this.options.hideChecker.apply(this, [e]); var isHide = this.options.hideChecker.apply(this, [e]);

7
src/case/combo/iconcombo/combo.icon.js

@ -10,7 +10,6 @@ BI.IconCombo = BI.inherit(BI.Widget, {
baseCls: "bi-icon-combo", baseCls: "bi-icon-combo",
width: 24, width: 24,
height: 24, height: 24,
iconCls: "",
el: {}, el: {},
popup: {}, popup: {},
minWidth: 100, minWidth: 100,
@ -36,12 +35,14 @@ BI.IconCombo = BI.inherit(BI.Widget, {
width: o.width, width: o.width,
height: o.height, height: o.height,
iconWidth: o.iconWidth, iconWidth: o.iconWidth,
iconHeight: o.iconHeight iconHeight: o.iconHeight,
value: o.value
}); });
this.popup = BI.createWidget(o.popup, { this.popup = BI.createWidget(o.popup, {
type: "bi.icon_combo_popup", type: "bi.icon_combo_popup",
chooseType: o.chooseType, chooseType: o.chooseType,
items: o.items items: o.items,
value: o.value
}); });
this.popup.on(BI.IconComboPopup.EVENT_CHANGE, function () { this.popup.on(BI.IconComboPopup.EVENT_CHANGE, function () {
self.setValue(self.popup.getValue()); self.setValue(self.popup.getValue());

3
src/case/combo/iconcombo/popup.iconcombo.js

@ -24,7 +24,8 @@ BI.IconComboPopup = BI.inherit(BI.Pane, {
chooseType: o.chooseType, chooseType: o.chooseType,
layouts: [{ layouts: [{
type: "bi.vertical" type: "bi.vertical"
}] }],
value: o.value
}); });
this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) { this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {

39
src/case/combo/iconcombo/trigger.iconcombo.js

@ -13,28 +13,35 @@ BI.IconComboTrigger = BI.inherit(BI.Trigger, {
iconCls: "", iconCls: "",
width: 25, width: 25,
height: 25, height: 25,
isShowDown: true isShowDown: true,
value: ""
}); });
}, },
_init: function () { _init: function () {
BI.IconComboTrigger.superclass._init.apply(this, arguments); BI.IconComboTrigger.superclass._init.apply(this, arguments);
var o = this.options, self = this; var o = this.options, self = this;
var iconCls = "";
if(BI.isKey(o.value)){
iconCls = this._digest(o.value, o.items);
}
this.button = BI.createWidget(o.el, { this.button = BI.createWidget(o.el, {
type: "bi.icon_change_button", type: "bi.icon_change_button",
cls: "icon-combo-trigger-icon " + o.iconCls, cls: "icon-combo-trigger-icon " + iconCls,
disableSelected: true, disableSelected: true,
width: o.width, width: o.width,
height: o.height, height: o.height,
iconWidth: o.iconWidth, iconWidth: o.iconWidth,
iconHeight: o.iconHeight iconHeight: o.iconHeight,
selected: BI.isNotEmptyString(iconCls)
}); });
this.down = BI.createWidget({ this.down = BI.createWidget({
type: "bi.icon_button", type: "bi.icon_button",
disableSelected: true, disableSelected: true,
cls: "icon-combo-down-icon trigger-triangle-font", cls: "icon-combo-down-icon trigger-triangle-font",
width: 12, width: 12,
height: 8 height: 8,
selected: BI.isNotEmptyString(iconCls)
}); });
this.down.setVisible(o.isShowDown); this.down.setVisible(o.isShowDown);
BI.createWidget({ BI.createWidget({
@ -52,9 +59,18 @@ BI.IconComboTrigger = BI.inherit(BI.Trigger, {
bottom: 0 bottom: 0
}] }]
}); });
if (BI.isKey(o.value)) { },
this.setValue(o.value);
} _digest: function (v, items) {
var iconCls = "";
v = BI.isArray(v) ? v[0] : v;
BI.any(items, function (i, item) {
if (v === item.value) {
iconCls = item.iconCls;
return true;
}
});
return iconCls;
}, },
populate: function (items) { populate: function (items) {
@ -68,14 +84,9 @@ BI.IconComboTrigger = BI.inherit(BI.Trigger, {
setValue: function (v) { setValue: function (v) {
BI.IconComboTrigger.superclass.setValue.apply(this, arguments); BI.IconComboTrigger.superclass.setValue.apply(this, arguments);
var o = this.options; var o = this.options;
var iconCls = ""; var iconCls = this._digest(v, this.options.items);
v = BI.isArray(v) ? v[0] : v; v = BI.isArray(v) ? v[0] : v;
if (BI.any(this.options.items, function (i, item) { if (BI.isNotEmptyString(iconCls)) {
if (v === item.value) {
iconCls = item.iconCls;
return true;
}
})) {
this.button.setIcon(iconCls); this.button.setIcon(iconCls);
this.button.setSelected(true); this.button.setSelected(true);
this.down.setSelected(true); this.down.setSelected(true);

Loading…
Cancel
Save