From f001f4d9a133a3a35f28801b90ea160ced941f79 Mon Sep 17 00:00:00 2001 From: Kitetop Date: Fri, 19 Aug 2022 14:21:00 +0800 Subject: [PATCH] =?UTF-8?q?REPORT-78579=20fix:=20=E8=B0=83=E6=95=B4bi.time?= =?UTF-8?q?=5Fcombo=E7=BB=84=E4=BB=B6=E7=BB=93=E6=9E=84=EF=BC=8C=E4=BF=9D?= =?UTF-8?q?=E6=8C=81=E7=BB=93=E6=9E=84=E7=BB=9F=E4=B8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/widget/time/time.combo.js | 196 ++++++++++++++++++---------------- 1 file changed, 101 insertions(+), 95 deletions(-) diff --git a/src/widget/time/time.combo.js b/src/widget/time/time.combo.js index e3aa83713..866bb513a 100644 --- a/src/widget/time/time.combo.js +++ b/src/widget/time/time.combo.js @@ -60,96 +60,117 @@ } }; return { - type: "bi.horizontal_fill", - cls: "bi-border bi-border-radius", - columnSize: ["fill", this.constants.iconWidth], - height: opts.height - 2, - width: opts.width - 2, + type: "bi.absolute", items: [{ el: { type: "bi.combo", + cls: "bi-border bi-border-radius", container: opts.container, toggle: false, isNeedAdjustHeight: opts.isNeedAdjustHeight, isNeedAdjustWidth: opts.isNeedAdjustWidth, el: { - type: "bi.time_trigger", + type: "bi.horizontal_fill", + columnSize: ["fill", this.constants.iconWidth], height: opts.height - 2, - allowEdit: opts.allowEdit, - watermark: opts.watermark, - format: opts.format, - value: opts.value, - ref: function (_ref) { - self.trigger = _ref; - }, - listeners: [{ - eventName: "EVENT_KEY_DOWN", - action: function () { - if (self.combo.isViewVisible()) { - self.combo.hideView(); + items: [{ + type: "bi.time_trigger", + height: opts.height - 2, + allowEdit: opts.allowEdit, + watermark: opts.watermark, + format: opts.format, + value: opts.value, + ref: function (_ref) { + 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); } - self.fireEvent(BI.TimeCombo.EVENT_KEY_DOWN, arguments); - } - }, { - eventName: "EVENT_STOP", - action: function () { - if (!self.combo.isViewVisible()) { - self.combo.showView(); + }, { + 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(); + }, { + eventName: "EVENT_FOCUS", + action: function () { + self.storeTriggerValue = self.trigger.getKey(); + if (!self.combo.isViewVisible()) { + self.combo.showView(); + } + self.fireEvent("EVENT_FOCUS"); } - 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"); - } - }, { - eventName: "EVENT_CHANGE", - action: function () { - self.fireEvent("EVENT_CHANGE"); - } - }, { - eventName: "EVENT_CONFIRM", - action: function () { - if (self.combo.isViewVisible()) { - return; + }, { + 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"); } - 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(); + }, { + eventName: "EVENT_CHANGE", + action: function () { + self.fireEvent("EVENT_CHANGE"); } - self.fireEvent("EVENT_CONFIRM"); - } - }] + }, { + eventName: "EVENT_CONFIRM", + action: function () { + if (self.combo.isViewVisible()) { + return; + } + 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"); + } + }] + }, { + 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; + } + }, + }], }, adjustLength: this.constants.comboAdjustHeight, popup: { @@ -171,25 +192,10 @@ 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; - } - }, + top: 0, + left: 0, + right: 0, + bottom: 0 }] }; },