Browse Source

KERNEL-11647 feat: 下拉框trigger按钮交互行为的统一

es6
zsmj 3 years ago
parent
commit
92a71257d3
  1. 3
      src/base/combination/combo.js
  2. 1
      src/case/combo/bubblecombo/combo.bubble.js
  3. 6
      src/core/constant/events.js
  4. 22
      src/widget/multiselect/multiselect.combo.js
  5. 23
      src/widget/multiselect/multiselect.combo.nobar.js
  6. 10
      src/widget/multiselect/multiselect.trigger.js
  7. 23
      src/widget/multitree/multi.tree.combo.js
  8. 23
      src/widget/multitree/multi.tree.insert.combo.js
  9. 23
      src/widget/multitree/multi.tree.list.combo.js

3
src/base/combination/combo.js

@ -55,6 +55,9 @@
}); });
this.combo.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) { this.combo.on(BI.Controller.EVENT_CHANGE, function (type, value, obj) {
if (self.isEnabled() && self.isValid()) { if (self.isEnabled() && self.isValid()) {
if (type === BI.Events.TOGGLE) {
self._toggle();
}
if (type === BI.Events.EXPAND) { if (type === BI.Events.EXPAND) {
self._popupView(); self._popupView();
} }

1
src/case/combo/bubblecombo/combo.bubble.js

@ -52,6 +52,7 @@ BI.BubbleCombo = BI.inherit(BI.Widget, {
hideChecker: o.hideChecker, hideChecker: o.hideChecker,
offsetStyle: o.offsetStyle, offsetStyle: o.offsetStyle,
showArrow: true, showArrow: true,
comboClass: o.comboClass,
el: o.el, el: o.el,
popup: () => BI.extend({ popup: () => BI.extend({
type: "bi.bubble_popup_view", type: "bi.bubble_popup_view",

6
src/core/constant/events.js

@ -143,6 +143,12 @@ _.extend(BI, {
*/ */
COLLAPSE: "_COLLAPSE", COLLAPSE: "_COLLAPSE",
/**
* @static
* @property 下拉菜单切换展开收起事件
*/
TOGGLE: "_TOGGLE",
/** /**
* @static * @static
* @property 回调事件 * @property 回调事件

22
src/widget/multiselect/multiselect.combo.js

@ -173,7 +173,7 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
}, },
value: o.value, value: o.value,
hideChecker: function (e) { hideChecker: function (e) {
return triggerBtn.element.find(e.target).length === 0 && self.numberCounter.element.find(e.target).length === 0; return self.numberCounter.element.find(e.target).length === 0;
}, },
}); });
@ -198,21 +198,6 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
} }
}); });
var triggerBtn = BI.createWidget({
type: "bi.trigger_icon_button",
width: o.height,
height: o.height,
cls: "multi-select-trigger-icon-button",
});
triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () {
self.numberCounter.hideView();
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
});
this.numberCounter = BI.createWidget({ this.numberCounter = BI.createWidget({
type: "bi.multi_select_check_selected_switcher", type: "bi.multi_select_check_selected_switcher",
masker: { masker: {
@ -263,11 +248,6 @@ BI.MultiSelectCombo = BI.inherit(BI.Single, {
right: 0, right: 0,
top: 0, top: 0,
bottom: 0, bottom: 0,
}, {
el: triggerBtn,
right: 0,
top: 0,
bottom: 0,
}, { }, {
el: { el: {
type: "bi.vertical_adapt", type: "bi.vertical_adapt",

23
src/widget/multiselect/multiselect.combo.nobar.js

@ -174,8 +174,7 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
value: o.value value: o.value
}, },
hideChecker: function (e) { hideChecker: function (e) {
return triggerBtn.element.find(e.target).length === 0 && return self.numberCounter.element.find(e.target).length === 0;
self.numberCounter.element.find(e.target).length === 0;
} }
}); });
@ -200,21 +199,6 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
} }
}); });
var triggerBtn = BI.createWidget({
type: "bi.trigger_icon_button",
width: o.height,
height: o.height,
cls: "multi-select-trigger-icon-button"
});
triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () {
self.numberCounter.hideView();
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
});
this.numberCounter = BI.createWidget({ this.numberCounter = BI.createWidget({
type: "bi.multi_select_check_selected_switcher", type: "bi.multi_select_check_selected_switcher",
masker: { masker: {
@ -268,11 +252,6 @@ BI.MultiSelectNoBarCombo = BI.inherit(BI.Single, {
right: 0, right: 0,
top: 0, top: 0,
bottom: 0 bottom: 0
}, {
el: triggerBtn,
right: 0,
top: 0,
bottom: 0
}, { }, {
el: { el: {
type: "bi.vertical_adapt", type: "bi.vertical_adapt",

10
src/widget/multiselect/multiselect.trigger.js

@ -83,7 +83,15 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, {
el: this.wrapNumberCounter, el: this.wrapNumberCounter,
width: 0 width: 0
}, { }, {
el: BI.createWidget(), el: {
type: "bi.trigger_icon_button",
height: o.height,
stopPropagation: true,
cls: "multi-select-trigger-icon-button",
handler: function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.TOGGLE);
}
},
width: 24 width: 24
}] }]
}); });

23
src/widget/multitree/multi.tree.combo.js

@ -107,8 +107,7 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
isNeedAdjustWidth: o.isNeedAdjustWidth, isNeedAdjustWidth: o.isNeedAdjustWidth,
value: { value: o.value || {} }, value: { value: o.value || {} },
hideChecker: function (e) { hideChecker: function (e) {
return triggerBtn.element.find(e.target).length === 0 && return self.numberCounter.element.find(e.target).length === 0;
self.numberCounter.element.find(e.target).length === 0;
} }
}); });
@ -212,21 +211,6 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
change = false; change = false;
}); });
var triggerBtn = BI.createWidget({
type: "bi.trigger_icon_button",
width: o.height,
height: o.height,
cls: "multi-select-trigger-icon-button"
});
triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () {
self.numberCounter.hideView();
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
});
this.numberCounter = BI.createWidget({ this.numberCounter = BI.createWidget({
type: "bi.multi_select_check_selected_switcher", type: "bi.multi_select_check_selected_switcher",
el: { el: {
@ -289,11 +273,6 @@ BI.MultiTreeCombo = BI.inherit(BI.Single, {
right: 0, right: 0,
top: 0, top: 0,
bottom: 0 bottom: 0
}, {
el: triggerBtn,
right: 0,
top: 0,
bottom: 0
}, { }, {
el: { el: {
type: "bi.vertical_adapt", type: "bi.vertical_adapt",

23
src/widget/multitree/multi.tree.insert.combo.js

@ -123,8 +123,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
isNeedAdjustWidth: o.isNeedAdjustWidth, isNeedAdjustWidth: o.isNeedAdjustWidth,
value: { value: o.value || {} }, value: { value: o.value || {} },
hideChecker: function (e) { hideChecker: function (e) {
return triggerBtn.element.find(e.target).length === 0 && return self.numberCounter.element.find(e.target).length === 0;
self.numberCounter.element.find(e.target).length === 0;
} }
}); });
@ -223,21 +222,6 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
change = false; change = false;
}); });
var triggerBtn = BI.createWidget({
type: "bi.trigger_icon_button",
width: o.height,
height: o.height,
cls: "multi-select-trigger-icon-button"
});
triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () {
self.numberCounter.hideView();
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
});
this.numberCounter = BI.createWidget({ this.numberCounter = BI.createWidget({
type: "bi.multi_select_check_selected_switcher", type: "bi.multi_select_check_selected_switcher",
el: { el: {
@ -300,11 +284,6 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
right: 0, right: 0,
top: 0, top: 0,
bottom: 0 bottom: 0
}, {
el: triggerBtn,
right: 0,
top: 0,
bottom: 0
}, { }, {
el: { el: {
type: "bi.vertical_adapt", type: "bi.vertical_adapt",

23
src/widget/multitree/multi.tree.list.combo.js

@ -141,8 +141,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
isNeedAdjustWidth: o.isNeedAdjustWidth, isNeedAdjustWidth: o.isNeedAdjustWidth,
value: { value: o.value || {} }, value: { value: o.value || {} },
hideChecker: function (e) { hideChecker: function (e) {
return triggerBtn.element.find(e.target).length === 0 && return self.numberCounter.element.find(e.target).length === 0;
self.numberCounter.element.find(e.target).length === 0;
} }
}); });
@ -241,21 +240,6 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
change = false; change = false;
}); });
var triggerBtn = BI.createWidget({
type: "bi.trigger_icon_button",
width: o.height,
height: o.height,
cls: "multi-select-trigger-icon-button"
});
triggerBtn.on(BI.TriggerIconButton.EVENT_CHANGE, function () {
self.numberCounter.hideView();
if (self.combo.isViewVisible()) {
self.combo.hideView();
} else {
self.combo.showView();
}
});
this.numberCounter = BI.createWidget({ this.numberCounter = BI.createWidget({
type: "bi.multi_select_check_selected_switcher", type: "bi.multi_select_check_selected_switcher",
el: { el: {
@ -318,11 +302,6 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
right: 0, right: 0,
top: 0, top: 0,
bottom: 0 bottom: 0
}, {
el: triggerBtn,
right: 0,
top: 0,
bottom: 0
}, { }, {
el: { el: {
type: "bi.vertical_adapt", type: "bi.vertical_adapt",

Loading…
Cancel
Save