Browse Source

Pull request #2929: REPORT-75687 & KERNEL-11647

Merge in VISUAL/fineui from ~DAILER/fineui:master to master

* commit '4360c7dba924cb4bca4a67805696fd3bab62e408':
  无JIRA toast容错
  KERNEL-12098 feat: radio和checkbox item代码规范化
  KERNEL-11911 feat: label默认tooltip适配, 气泡不需要tooltip
  REPORT-75687 & KERNEL-11647 fix: 依然把triggerIcon放到trigger外面
es6
Dailer 2 years ago
parent
commit
f630a17ad8
  1. 6
      src/base/foundation/message.js
  2. 6
      src/case/button/item.multiselect.js
  3. 11
      src/case/button/item.singleselect.radio.js
  4. 1
      src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js
  5. 4
      src/case/combo/searchtextvaluecombo/trigger.searchtextvalue.js
  6. 2
      src/core/controller/controller.bubbles.js
  7. 2
      src/core/controller/controller.tooltips.js
  8. 5
      src/less/widget/multitree/multi.tree.combo.less
  9. 22
      src/widget/multiselect/multiselect.combo.js
  10. 3
      src/widget/multiselect/multiselect.loader.js
  11. 20
      src/widget/multiselect/multiselect.trigger.js
  12. 3
      src/widget/multiselect/search/multiselect.search.loader.js
  13. 23
      src/widget/multitree/multi.tree.combo.js
  14. 23
      src/widget/multitree/multi.tree.insert.combo.js
  15. 23
      src/widget/multitree/multi.tree.list.combo.js

6
src/base/foundation/message.js

@ -22,7 +22,7 @@ BI.Msg = function () {
// BI.Msg.prompt(title, message, value, callback, min_width); // BI.Msg.prompt(title, message, value, callback, min_width);
}, },
toast: function (message, options, context) { toast: function (message, options, context) {
BI.isString(options) && (options = { level: options }) BI.isString(options) && (options = { level: options });
options = options || {}; options = options || {};
context = context || BI.Widget._renderEngine.createElement("body"); context = context || BI.Widget._renderEngine.createElement("body");
var level = options.level || "common"; var level = options.level || "common";
@ -67,11 +67,11 @@ BI.Msg = function () {
autoClose && BI.delay(function () { autoClose && BI.delay(function () {
toast.element.removeClass("bi-message-enter").addClass("bi-message-leave"); toast.element.removeClass("bi-message-enter").addClass("bi-message-leave");
toast.destroy(); toast.destroy?.();
}, 5000); }, 5000);
return function () { return function () {
toast.element.removeClass("bi-message-enter").addClass("bi-message-leave"); toast.element.removeClass("bi-message-enter").addClass("bi-message-leave");
toast.destroy(); toast.destroy?.();
}; };
}, },
_show: function (hasCancel, title, message, callback) { _show: function (hasCancel, title, message, callback) {

6
src/case/button/item.multiselect.js

@ -20,11 +20,6 @@ BI.MultiSelectItem = BI.inherit(BI.BasicButton, {
this.checkbox = BI.createWidget({ this.checkbox = BI.createWidget({
type: "bi.checkbox" type: "bi.checkbox"
}); });
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) {
if (type === BI.Events.CLICK) {
self.setSelected(self.isSelected());
}
});
return { return {
type: "bi.vertical_adapt", type: "bi.vertical_adapt",
columnSize: [o.iconWrapperWidth || o.height, "fill"], columnSize: [o.iconWrapperWidth || o.height, "fill"],
@ -74,7 +69,6 @@ BI.MultiSelectItem = BI.inherit(BI.BasicButton, {
doClick: function () { doClick: function () {
BI.MultiSelectItem.superclass.doClick.apply(this, arguments); BI.MultiSelectItem.superclass.doClick.apply(this, arguments);
this.checkbox.setSelected(this.isSelected());
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(BI.MultiSelectItem.EVENT_CHANGE, this.getValue(), this); this.fireEvent(BI.MultiSelectItem.EVENT_CHANGE, this.getValue(), this);
} }

11
src/case/button/item.singleselect.radio.js

@ -28,16 +28,6 @@ BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, {
ref: function (_ref) { ref: function (_ref) {
self.radio = _ref; self.radio = _ref;
}, },
listeners: [
{
eventName: BI.Controller.EVENT_CHANGE,
action: function (type) {
if (type === BI.Events.CLICK) {
self.setSelected(self.isSelected());
}
}
}
],
}] }]
}, { }, {
el: { el: {
@ -82,7 +72,6 @@ BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, {
doClick: function () { doClick: function () {
BI.SingleSelectRadioItem.superclass.doClick.apply(this, arguments); BI.SingleSelectRadioItem.superclass.doClick.apply(this, arguments);
this.radio.setSelected(this.isSelected());
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(BI.SingleSelectRadioItem.EVENT_CHANGE, this.isSelected(), this); this.fireEvent(BI.SingleSelectRadioItem.EVENT_CHANGE, this.isSelected(), this);
} }

1
src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js

@ -33,7 +33,6 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, {
adjustLength: 2, adjustLength: 2,
height: height, height: height,
width: width, width: width,
toggle: false,
ref: function () { ref: function () {
self.combo = this; self.combo = this;
}, },

4
src/case/combo/searchtextvaluecombo/trigger.searchtextvalue.js

@ -24,10 +24,6 @@ BI.SearchTextValueTrigger = BI.inherit(BI.Trigger, {
}, },
width: o.height, width: o.height,
height: o.height, height: o.height,
stopPropagation: true,
handler: function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, BI.Events.TOGGLE);
}
}; };
var stateText = this._digest(o.value, o.items) || o.text; var stateText = this._digest(o.value, o.items) || o.text;

2
src/core/controller/controller.bubbles.js

@ -30,7 +30,7 @@ BI.BubblesController = BI.inherit(BI.Controller, {
if (!this.storeBubbles[name]) { if (!this.storeBubbles[name]) {
this.storeBubbles[name] = BI.createWidget({ this.storeBubbles[name] = BI.createWidget({
type: "bi.label", type: "bi.text",
cls: "bi-bubble" + " bubble-" + level, cls: "bi-bubble" + " bubble-" + level,
text: text, text: text,
hgap: 5, hgap: 5,

2
src/core/controller/controller.tooltips.js

@ -38,7 +38,7 @@ BI.TooltipsController = BI.inherit(BI.Controller, {
}); });
this.showingTips = {}; this.showingTips = {};
if (!this.has(name)) { if (!this.has(name)) {
this.create(name, tooltipOpt, opt.container || "body"); this.create(name, tooltipOpt, document.fullscreenElement ? context : (opt.container || "body"));
} }
if (!opt.belowMouse) { if (!opt.belowMouse) {
var offset = context.element.offset(); var offset = context.element.offset();

5
src/less/widget/multitree/multi.tree.combo.less

@ -1,9 +1,11 @@
@import "../../index.less"; @import "../../index.less";
@val: transform .3s ease; @val: transform .3s ease;
.bi-multi-tree-combo{ .bi-multi-tree-combo, .bi-multi-tree-insert-combo, .bi-multi-tree-list-combo {
& .multi-select-trigger-icon-button { & .multi-select-trigger-icon-button {
font-size: @font-size-16; font-size: @font-size-16;
} }
// 此combo的trigger_button是absolute上去的,与bi-combo在同一层级,独立写一下 // 此combo的trigger_button是absolute上去的,与bi-combo在同一层级,独立写一下
& .bi-combo.bi-combo-popup + .bi-trigger-icon-button { & .bi-combo.bi-combo-popup + .bi-trigger-icon-button {
& .x-icon { & .x-icon {
@ -11,6 +13,7 @@
.transition(@val); .transition(@val);
} }
} }
& .bi-combo + .bi-trigger-icon-button { & .bi-combo + .bi-trigger-icon-button {
& .x-icon { & .x-icon {
.rotate(0deg); .rotate(0deg);

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 self.numberCounter.element.find(e.target).length === 0; return triggerBtn.element.find(e.target).length === 0 && self.numberCounter.element.find(e.target).length === 0;
}, },
}); });
@ -198,6 +198,21 @@ 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: {
@ -248,6 +263,11 @@ 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",

3
src/widget/multiselect/multiselect.loader.js

@ -110,12 +110,13 @@ BI.MultiSelectLoader = BI.inherit(BI.Widget, {
}, },
_createItems: function (items) { _createItems: function (items) {
var allSelected = this.isAllSelected();
return BI.createItems(items, { return BI.createItems(items, {
type: "bi.multi_select_item", type: "bi.multi_select_item",
logic: this.options.logic, logic: this.options.logic,
cls: "bi-list-item-active", cls: "bi-list-item-active",
height: this.options.itemHeight || BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, height: this.options.itemHeight || BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
selected: this.isAllSelected(), selected: allSelected,
iconWrapperWidth: 36 iconWrapperWidth: 36
}); });
}, },

20
src/widget/multiselect/multiselect.trigger.js

@ -78,22 +78,10 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, {
items: [ items: [
{ {
el: this.searcher, el: this.searcher,
width: "fill" width: "fill",
}, { rgap: 24
el: this.wrapNumberCounter,
width: 0
}, {
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
}]
}); });
!o.allowEdit && BI.createWidget({ !o.allowEdit && BI.createWidget({
@ -123,7 +111,7 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, {
* 重新调整numberCounter的空白占位符 * 重新调整numberCounter的空白占位符
*/ */
refreshPlaceHolderWidth: function (width) { refreshPlaceHolderWidth: function (width) {
this.wrapper.attr("items")[1].width = width; this.wrapper.attr("items")[0].rgap = 24 + width;
this.wrapper.resize(); this.wrapper.resize();
}, },

3
src/widget/multiselect/search/multiselect.search.loader.js

@ -91,13 +91,14 @@ BI.MultiSelectSearchLoader = BI.inherit(BI.Widget, {
}, },
_createItems: function (items) { _createItems: function (items) {
var allSelected = this.isAllSelected();
return BI.createItems(items, { return BI.createItems(items, {
type: "bi.multi_select_item", type: "bi.multi_select_item",
logic: { logic: {
dynamic: false dynamic: false
}, },
height: this.options.itemHeight || BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, height: this.options.itemHeight || BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
selected: this.isAllSelected(), selected: allSelected,
cls: "bi-list-item-active", cls: "bi-list-item-active",
iconWrapperWidth: 36 iconWrapperWidth: 36
}); });

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

@ -107,7 +107,8 @@ 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 self.numberCounter.element.find(e.target).length === 0; return triggerBtn.element.find(e.target).length === 0 &&
self.numberCounter.element.find(e.target).length === 0;
} }
}); });
@ -211,6 +212,21 @@ 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: {
@ -273,6 +289,11 @@ 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,7 +123,8 @@ 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 self.numberCounter.element.find(e.target).length === 0; return triggerBtn.element.find(e.target).length === 0 &&
self.numberCounter.element.find(e.target).length === 0;
} }
}); });
@ -222,6 +223,21 @@ 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: {
@ -284,6 +300,11 @@ 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,7 +141,8 @@ 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 self.numberCounter.element.find(e.target).length === 0; return triggerBtn.element.find(e.target).length === 0 &&
self.numberCounter.element.find(e.target).length === 0;
} }
}); });
@ -240,6 +241,21 @@ 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: {
@ -302,6 +318,11 @@ 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