Browse Source

Merge pull request #2965 in VISUAL/fineui from DEC/fineui:feature/x to master

* commit '6a01ac62206950f8dad1f09048fa365388664578':
  REPORT-77246 fix: 根据review建议修改代码
  REPORT-77246 fix: 修复bi.time_combo组件内容和图标重叠的问题
es6
Aeolus.Zhang 2 years ago
parent
commit
8d71811d87
  1. 245
      src/widget/time/time.combo.js

245
src/widget/time/time.combo.js

@ -60,143 +60,136 @@
} }
}; };
return { return {
type: "bi.htape", type: "bi.horizontal_fill",
cls: "bi-border bi-border-radius",
columnSize: ["fill", this.constants.iconWidth],
height: opts.height - 2,
width: opts.width - 2,
items: [{ items: [{
type: "bi.absolute", el: {
items: [{ type: "bi.combo",
container: opts.container,
toggle: false,
isNeedAdjustHeight: opts.isNeedAdjustHeight,
isNeedAdjustWidth: opts.isNeedAdjustWidth,
el: { el: {
type: "bi.combo", type: "bi.time_trigger",
cls: "bi-border bi-border-radius", height: opts.height - 2,
container: opts.container, allowEdit: opts.allowEdit,
toggle: false, watermark: opts.watermark,
isNeedAdjustHeight: opts.isNeedAdjustHeight, format: opts.format,
isNeedAdjustWidth: opts.isNeedAdjustWidth, value: opts.value,
el: { ref: function (_ref) {
type: "bi.time_trigger", self.trigger = _ref;
height: opts.height - 2, },
allowEdit: opts.allowEdit, listeners: [{
watermark: opts.watermark, eventName: "EVENT_KEY_DOWN",
format: opts.format, action: function () {
value: opts.value, if (self.combo.isViewVisible()) {
ref: function (_ref) { self.combo.hideView();
self.trigger = _ref;
},
listeners: [{
eventName: "EVENT_KEY_DOWN",
action: function () {
if (self.combo.isViewVisible()) {
self.combo.hideView();
}
self.fireEvent(BI.TimeCombo.EVENT_KEY_DOWN, arguments);
}
}, {
eventName: "EVENT_STOP",
action: function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
}
}, {
eventName: "EVENT_FOCUS",
action: function () {
self.storeTriggerValue = self.trigger.getKey();
if (!self.combo.isViewVisible()) {
self.combo.showView();
}
self.fireEvent("EVENT_FOCUS");
}
}, {
eventName: "EVENT_BLUR",
action: function () {
self.fireEvent("EVENT_BLUR");
}
}, {
eventName: "EVENT_ERROR",
action: function () {
var date = BI.getDate();
self.storeValue = {
hour: date.getHours(),
minute: date.getMinutes(),
second: date.getSeconds()
};
self.fireEvent("EVENT_ERROR");
}
}, {
eventName: "EVENT_VALID",
action: function () {
self.fireEvent("EVENT_VALID");
} }
}, { self.fireEvent(BI.TimeCombo.EVENT_KEY_DOWN, arguments);
eventName: "EVENT_CHANGE", }
action: function () { }, {
self.fireEvent("EVENT_CHANGE"); eventName: "EVENT_STOP",
action: function () {
if (!self.combo.isViewVisible()) {
self.combo.showView();
} }
}, { }
eventName: "EVENT_CONFIRM", }, {
action: function () { eventName: "EVENT_FOCUS",
if (self.combo.isViewVisible()) { action: function () {
return; self.storeTriggerValue = self.trigger.getKey();
} if (!self.combo.isViewVisible()) {
var dateStore = self.storeTriggerValue; self.combo.showView();
var dateObj = self.trigger.getKey();
if (BI.isNotEmptyString(dateObj) && !BI.isEqual(dateObj, dateStore)) {
self.storeValue = self.trigger.getValue();
self.setValue(self.trigger.getValue());
} else if (BI.isEmptyString(dateObj)) {
self.storeValue = null;
self.trigger.setValue();
}
self.fireEvent("EVENT_CONFIRM");
} }
}] self.fireEvent("EVENT_FOCUS");
}, }
adjustLength: this.constants.comboAdjustHeight, }, {
popup: { eventName: "EVENT_BLUR",
el: popup,
width: opts.isNeedAdjustWidth ? opts.width : this.constants.popupWidth,
stopPropagation: false
},
hideChecker: function (e) {
return self.triggerBtn.element.find(e.target).length === 0;
},
listeners: [{
eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW,
action: function () { action: function () {
self.popup.setValue(self.storeValue); self.fireEvent("EVENT_BLUR");
self.fireEvent(BI.TimeCombo.EVENT_BEFORE_POPUPVIEW);
} }
}], }, {
ref: function (_ref) { eventName: "EVENT_ERROR",
self.combo = _ref; action: function () {
} var date = BI.getDate();
}, self.storeValue = {
top: 0, hour: date.getHours(),
left: 0, minute: date.getMinutes(),
right: 0, second: date.getSeconds()
bottom: 0 };
}, { self.fireEvent("EVENT_ERROR");
el: { }
type: "bi.icon_button", }, {
cls: "bi-trigger-icon-button time-font icon-size-16", eventName: "EVENT_VALID",
width: this.constants.iconWidth, action: function () {
height: opts.height, self.fireEvent("EVENT_VALID");
listeners: [{ }
eventName: BI.IconButton.EVENT_CHANGE, }, {
eventName: "EVENT_CHANGE",
action: function () {
self.fireEvent("EVENT_CHANGE");
}
}, {
eventName: "EVENT_CONFIRM",
action: function () { action: function () {
if (self.combo.isViewVisible()) { if (self.combo.isViewVisible()) {
// self.combo.hideView(); return;
} else {
self.combo.showView();
} }
var dateStore = self.storeTriggerValue;
var dateObj = self.trigger.getKey();
if (BI.isNotEmptyString(dateObj) && !BI.isEqual(dateObj, dateStore)) {
self.storeValue = self.trigger.getValue();
self.setValue(self.trigger.getValue());
} else if (BI.isEmptyString(dateObj)) {
self.storeValue = null;
self.trigger.setValue();
}
self.fireEvent("EVENT_CONFIRM");
} }
}], }]
ref: function (_ref) { },
self.triggerBtn = _ref; adjustLength: this.constants.comboAdjustHeight,
} popup: {
el: popup,
width: opts.isNeedAdjustWidth ? opts.width : this.constants.popupWidth,
stopPropagation: false
},
hideChecker: function (e) {
return self.triggerBtn.element.find(e.target).length === 0;
}, },
top: 0, listeners: [{
right: 0 eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW,
}] action: function () {
self.popup.setValue(self.storeValue);
self.fireEvent(BI.TimeCombo.EVENT_BEFORE_POPUPVIEW);
}
}],
ref: function (_ref) {
self.combo = _ref;
}
},
}, {
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button time-font",
width: this.constants.iconWidth,
listeners: [{
eventName: BI.IconButton.EVENT_CHANGE,
action: function () {
if (self.combo.isViewVisible()) {
// self.combo.hideView();
} else {
self.combo.showView();
}
}
}],
ref: function (_ref) {
self.triggerBtn = _ref;
}
},
}] }]
}; };
}, },
@ -228,7 +221,7 @@
focus: function () { focus: function () {
this.trigger.focus(); this.trigger.focus();
}, },
blur: function () { blur: function () {
this.trigger.blur(); this.trigger.blur();
}, },

Loading…
Cancel
Save