Browse Source

REPORT-77246 fix: 根据review建议修改代码

research/test
Kitetop 2 years ago
parent
commit
f02eedd0b9
  1. 238
      src/widget/time/time.combo.js

238
src/widget/time/time.combo.js

@ -60,138 +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.horizontal_fill", el: {
cls: "bi-border bi-border-radius", type: "bi.combo",
columnSize: ["fill", this.constants.iconWidth], container: opts.container,
items: [{ toggle: false,
isNeedAdjustHeight: opts.isNeedAdjustHeight,
isNeedAdjustWidth: opts.isNeedAdjustWidth,
el: { el: {
type: "bi.combo", type: "bi.time_trigger",
container: opts.container, height: opts.height - 2,
toggle: false, allowEdit: opts.allowEdit,
isNeedAdjustHeight: opts.isNeedAdjustHeight, watermark: opts.watermark,
isNeedAdjustWidth: opts.isNeedAdjustWidth, format: opts.format,
el: { value: opts.value,
type: "bi.time_trigger", ref: function (_ref) {
height: opts.height - 2, self.trigger = _ref;
allowEdit: opts.allowEdit, },
watermark: opts.watermark, listeners: [{
format: opts.format, eventName: "EVENT_KEY_DOWN",
value: opts.value, action: function () {
ref: function (_ref) { if (self.combo.isViewVisible()) {
self.trigger = _ref; self.combo.hideView();
},
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 = {
}, { hour: date.getHours(),
el: { minute: date.getMinutes(),
type: "bi.icon_button", second: date.getSeconds()
cls: "bi-trigger-icon-button time-font", };
width: this.constants.iconWidth, self.fireEvent("EVENT_ERROR");
height: opts.height - 2, }
listeners: [{ }, {
eventName: BI.IconButton.EVENT_CHANGE, eventName: "EVENT_VALID",
action: function () {
self.fireEvent("EVENT_VALID");
}
}, {
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;
},
listeners: [{
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;
}
},
}] }]
}; };
}, },

Loading…
Cancel
Save