From 342961136d7b984664ff324cbcae0deedc56e67d Mon Sep 17 00:00:00 2001 From: zsmj Date: Thu, 4 May 2023 11:03:57 +0800 Subject: [PATCH] =?UTF-8?q?BI-125770=20fix:=20=E3=80=906.0.10=E5=8F=91?= =?UTF-8?q?=E6=95=A3=E3=80=91=E6=9B=B4=E6=96=B0=E4=BB=BB=E5=8A=A1=E7=AE=A1?= =?UTF-8?q?=E7=90=86-=E5=BD=93=E5=89=8D=E8=BF=90=E8=A1=8C=E6=83=85?= =?UTF-8?q?=E5=86=B5=EF=BC=8C=E5=B1=95=E5=BC=80=E4=B8=8B=E6=8B=89=E5=B1=95?= =?UTF-8?q?=E5=BC=80=E6=90=9C=E7=B4=A2=E4=B8=8D=E8=83=BD=E5=B1=95=E5=BC=80?= =?UTF-8?q?=EF=BC=8C=E5=89=8D=E7=AB=AF=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dynamicdatetime/dynamicdatetime.combo.js | 126 ++++++++++-------- .../dynamicdatetime.trigger.js | 4 +- 2 files changed, 70 insertions(+), 60 deletions(-) diff --git a/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.combo.js b/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.combo.js index ee1a1ec9a..97f916acb 100644 --- a/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.combo.js +++ b/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.combo.js @@ -28,22 +28,32 @@ export class DynamicDateTimeCombo extends Single { popupWidth: 270, comboAdjustHeight: 1, border: 1, - iconWidth: 24, + iconWidth: 24 }; - props = { - baseCls: "bi-dynamic-date--time-combo", - height: 24, - minDate: "1900-01-01", - maxDate: "2099-12-31", - format: "", - allowEdit: true, - supportDynamic: true, - attributes: { - tabIndex: -1, - }, - isNeedAdjustHeight: false, - isNeedAdjustWidth: false, + props = () => { + const date = getDate(); + return { + baseCls: "bi-dynamic-date--time-combo", + height: 24, + minDate: "1900-01-01", + maxDate: "2099-12-31", + format: "", + allowEdit: true, + supportDynamic: true, + attributes: { + tabIndex: -1 + }, + isNeedAdjustHeight: false, + isNeedAdjustWidth: false, + value: { + type: DynamicDateTimeCombo.Static, + value: { + year: date.getFullYear(), + month: date.getMonth() + 1 + } + } + }; }; static EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; @@ -95,8 +105,8 @@ export class DynamicDateTimeCombo extends Single { height: toPix(opts.height, border), ref: _ref => { this.changeIcon = _ref; - }, - }, + } + } }, { type: DynamicDateTimeTrigger.xtype, @@ -120,7 +130,7 @@ export class DynamicDateTimeCombo extends Single { this.combo.hideView(); } this.fireEvent(DynamicDateTimeCombo.EVENT_KEY_DOWN, ...args); - }, + } }, { eventName: DynamicDateTimeTrigger.EVENT_STOP, @@ -128,13 +138,13 @@ export class DynamicDateTimeCombo extends Single { if (!this.combo.isViewVisible()) { this.combo.showView(); } - }, + } }, { eventName: DynamicDateTimeTrigger.EVENT_TRIGGER_CLICK, action: () => { this.combo.toggle(); - }, + } }, { eventName: DynamicDateTimeTrigger.EVENT_FOCUS, @@ -144,13 +154,13 @@ export class DynamicDateTimeCombo extends Single { this.combo.showView(); } this.fireEvent(DynamicDateTimeCombo.EVENT_FOCUS); - }, + } }, { eventName: DynamicDateTimeTrigger.EVENT_BLUR, action: () => { this.fireEvent(DynamicDateTimeCombo.EVENT_BLUR); - }, + } }, { eventName: DynamicDateTimeTrigger.EVENT_ERROR, @@ -159,12 +169,12 @@ export class DynamicDateTimeCombo extends Single { type: DynamicDateTimeCombo.Static, value: { year: date.getFullYear(), - month: date.getMonth() + 1, - }, + month: date.getMonth() + 1 + } }; this.combo.element.addClass("error"); this.fireEvent(DynamicDateTimeCombo.EVENT_ERROR); - }, + } }, { eventName: DynamicDateTimeTrigger.EVENT_VALID, @@ -172,13 +182,13 @@ export class DynamicDateTimeCombo extends Single { this.storeValue = this.trigger.getValue(); this.combo.element.removeClass("error"); this.fireEvent(DynamicDateTimeCombo.EVENT_VALID); - }, + } }, { eventName: DynamicDateTimeTrigger.EVENT_CHANGE, action: () => { this.fireEvent(DynamicDateTimeCombo.EVENT_CHANGE); - }, + } }, { eventName: DynamicDateTimeTrigger.EVENT_CONFIRM, @@ -197,11 +207,11 @@ export class DynamicDateTimeCombo extends Single { } this._checkDynamicValue(this.storeValue); this.fireEvent(DynamicDateTimeCombo.EVENT_CONFIRM); - }, + } } - ], + ] } - ], + ] }, adjustLength: this.constants.comboAdjustHeight, popup: { @@ -222,7 +232,7 @@ export class DynamicDateTimeCombo extends Single { this.setValue(); this.combo.hideView(); this.fireEvent(DynamicDateTimeCombo.EVENT_CONFIRM); - }, + } }, { eventName: DynamicDateTimePopup.BUTTON_lABEL_EVENT_CHANGE, @@ -236,12 +246,12 @@ export class DynamicDateTimeCombo extends Single { day: date.getDate(), hour: 0, minute: 0, - second: 0, - }, + second: 0 + } }); this.combo.hideView(); this.fireEvent(DynamicDateTimeCombo.EVENT_CONFIRM); - }, + } }, { eventName: DynamicDateTimePopup.BUTTON_OK_EVENT_CHANGE, @@ -252,7 +262,7 @@ export class DynamicDateTimeCombo extends Single { } this.combo.hideView(); this.fireEvent(DynamicDateTimeCombo.EVENT_CONFIRM); - }, + } }, { eventName: DynamicDateTimePopup.EVENT_CHANGE, @@ -260,16 +270,16 @@ export class DynamicDateTimeCombo extends Single { this.setValue(this.popup.getValue()); this.combo.hideView(); this.fireEvent(DynamicDateTimeCombo.EVENT_CONFIRM); - }, + } }, { eventName: DynamicDateTimePopup.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW, action: () => { this.fireEvent(DynamicDateTimeCombo.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); - }, + } } - ], - }, + ] + } }, listeners: [ { @@ -279,9 +289,9 @@ export class DynamicDateTimeCombo extends Single { this.popup.setMaxDate(opts.maxDate); this.popup.setValue(this.storeValue); this.fireEvent(DynamicDateTimeCombo.EVENT_BEFORE_POPUPVIEW); - }, + } } - ], + ] // // DEC-4250 和复选下拉一样,点击不收起 // hideChecker: function (e) { // return self.triggerBtn.element.find(e.target).length === 0; @@ -290,9 +300,9 @@ export class DynamicDateTimeCombo extends Single { top: 0, left: 0, right: 0, - bottom: 0, + bottom: 0 } - ], + ] }; } @@ -306,16 +316,16 @@ export class DynamicDateTimeCombo extends Single { type = v.type; } switch (type) { - case DynamicDateTimeCombo.Dynamic: - this.changeIcon.setVisible(true); - // this.comboWrapper.attr("items")[0].width = o.height - (this.options.simple ? 1 : 2); - // this.comboWrapper.resize(); - break; - default: - // this.comboWrapper.attr("items")[0].width = 0; - // this.comboWrapper.resize(); - this.changeIcon.setVisible(false); - break; + case DynamicDateTimeCombo.Dynamic: + this.changeIcon.setVisible(true); + // this.comboWrapper.attr("items")[0].width = o.height - (this.options.simple ? 1 : 2); + // this.comboWrapper.resize(); + break; + default: + // this.comboWrapper.attr("items")[0].width = 0; + // this.comboWrapper.resize(); + this.changeIcon.setVisible(false); + break; } } @@ -323,12 +333,12 @@ export class DynamicDateTimeCombo extends Single { const o = this.options; const value = v.value || {}; switch (v.type) { - case DynamicDateCombo.Dynamic: - return isNotEmptyObject(v.value); - case DynamicDateCombo.Static: - return !checkDateVoid(value.year, value.month, value.day, o.minDate, o.maxDate)[0]; - default: - return true; + case DynamicDateCombo.Dynamic: + return isNotEmptyObject(v.value); + case DynamicDateCombo.Static: + return !checkDateVoid(value.year, value.month, value.day, o.minDate, o.maxDate)[0]; + default: + return true; } } diff --git a/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.trigger.js b/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.trigger.js index c28ae707c..d0badcfe7 100644 --- a/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.trigger.js +++ b/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.trigger.js @@ -455,10 +455,10 @@ export class DynamicDateTimeTrigger extends Trigger { type = v.type || DynamicDateCombo.Static; value = v.value || v; } - const text = this._getText(value); - + switch (type) { case DynamicDateCombo.Dynamic: + const text = this._getText(value); date = DynamicDateHelper.getCalculation(value); this._setInnerValue(date, text); break;