From b4fc3d7098324d5d1ae3b62d4f4b3bc183513359 Mon Sep 17 00:00:00 2001 From: chenzeyu Date: Fri, 8 Dec 2023 16:22:19 +0800 Subject: [PATCH 1/6] =?UTF-8?q?BI-133648=20fix=EF=BC=9A=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E6=8E=A7=E4=BB=B6=E5=8A=A0=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fineui/src/widget/datepane/datepane.js | 25 +++++++++++++---- .../widget/dynamicdate/dynamicdate.combo.js | 2 ++ .../widget/dynamicdate/dynamicdate.popup.js | 18 +++++++++++-- .../dynamicdatetime/dynamicdatetime.combo.js | 2 ++ .../dynamicdatetime/dynamicdatetime.popup.js | 19 +++++++++++-- .../src/widget/timeinterval/dateinterval.js | 2 ++ .../src/widget/timeinterval/timeinterval.js | 2 ++ packages/fineui/src/widget/year/combo.year.js | 2 ++ packages/fineui/src/widget/year/popup.year.js | 10 +++++-- .../src/widget/yearmonth/combo.yearmonth.js | 2 ++ .../src/widget/yearmonth/popup.yearmonth.js | 16 +++++++++-- .../yearmonthinterval/yearmonthinterval.js | 2 ++ .../widget/yearquarter/combo.yearquarter.js | 2 ++ .../widget/yearquarter/popup.yearquarter.js | 27 ++++++++++++++----- 14 files changed, 111 insertions(+), 20 deletions(-) diff --git a/packages/fineui/src/widget/datepane/datepane.js b/packages/fineui/src/widget/datepane/datepane.js index a408c3287..2a6f73ccd 100644 --- a/packages/fineui/src/widget/datepane/datepane.js +++ b/packages/fineui/src/widget/datepane/datepane.js @@ -30,6 +30,7 @@ export class DynamicDatePane extends Widget { minDate: "1900-01-01", maxDate: "2099-12-31", supportDynamic: true, + isShow: false, // 是否是预览状态 }; render() { @@ -195,7 +196,7 @@ export class DynamicDatePane extends Widget { } created() { - this.setValue(this.options.value); + this.setValue(this.options.value, true); } _checkValueValid(value) { @@ -226,15 +227,29 @@ export class DynamicDatePane extends Widget { } } - setValue(v) { + setValue(v, isCreated = false) { v = v || {}; const type = v.type || DynamicDateCombo.Static; const value = v.value || v; - this.switcher.setValue(type); - this.dateTab.setSelect(type); + + const { isShow } = this.options; + let date; + + // 如果是初始化且是预览状态 直接打开静态页面 + this.switcher.setValue(isShow && isCreated ? DynamicDateCombo.Static : type); + this.dateTab.setSelect(isShow && isCreated ? DynamicDateCombo.Static : type); switch (type) { case DynamicDateCombo.Dynamic: - this.dynamicPane.setValue(value); + if (isShow && isCreated) { + date = DynamicDateHelper.getCalculation(value); + this.ymd.setValue({ + year: date.getFullYear(), + month: date.getMonth() + 1, + day: date.getDate(), + }); + } else { + this.dynamicPane.setValue(value); + } break; case DynamicDateCombo.Static: default: diff --git a/packages/fineui/src/widget/dynamicdate/dynamicdate.combo.js b/packages/fineui/src/widget/dynamicdate/dynamicdate.combo.js index 684776f8c..02112a21b 100644 --- a/packages/fineui/src/widget/dynamicdate/dynamicdate.combo.js +++ b/packages/fineui/src/widget/dynamicdate/dynamicdate.combo.js @@ -53,6 +53,7 @@ export class DynamicDateCombo extends Single { }, isNeedAdjustHeight: false, isNeedAdjustWidth: false, + isShow: false, // 是否是预览状态 }; _init() { @@ -200,6 +201,7 @@ export class DynamicDateCombo extends Single { popup: { el: { type: DynamicDatePopup.xtype, + isShow: opts.isShow, width: opts.isNeedAdjustWidth ? opts.width : undefined, supportDynamic: opts.supportDynamic, behaviors: opts.behaviors, diff --git a/packages/fineui/src/widget/dynamicdate/dynamicdate.popup.js b/packages/fineui/src/widget/dynamicdate/dynamicdate.popup.js index 907303d1e..34b6b03e6 100644 --- a/packages/fineui/src/widget/dynamicdate/dynamicdate.popup.js +++ b/packages/fineui/src/widget/dynamicdate/dynamicdate.popup.js @@ -34,6 +34,7 @@ export class DynamicDatePopup extends Widget { baseCls: "bi-dynamic-date-popup", width: 272, supportDynamic: true, + isShow: false, // 是否是预览状态 }; static EVENT_CHANGE = "EVENT_CHANGE"; @@ -282,10 +283,23 @@ export class DynamicDatePopup extends Widget { v = v || {}; const type = v.type || DynamicDateCombo.Static; const value = v.value || v; - this.dateTab.setSelect(type); + const { isShow } = this.options; + let date; + + // 如果是预览状态 直接打开静态页面 + this.dateTab.setSelect(isShow ? DynamicDateCombo.Static : type); switch (type) { case DynamicDateCombo.Dynamic: - this.dynamicPane.setValue(value); + if (isShow) { + date = DynamicDateHelper.getCalculation(value); + this.ymd.setValue({ + year: date.getFullYear(), + month: date.getMonth() + 1, + day: date.getDate(), + }); + } else { + this.dynamicPane.setValue(value); + } this._setInnerValue(); break; case DynamicDateCombo.Static: diff --git a/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.combo.js b/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.combo.js index 0fc27ae09..d2b21b6f3 100644 --- a/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.combo.js +++ b/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.combo.js @@ -44,6 +44,7 @@ export class DynamicDateTimeCombo extends Single { }, isNeedAdjustHeight: false, isNeedAdjustWidth: false, + isShow: false, // 是否是预览状态 }; static EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; @@ -207,6 +208,7 @@ export class DynamicDateTimeCombo extends Single { popup: { el: { type: DynamicDateTimePopup.xtype, + isShow: opts.isShow, timeSelectTypes: opts.timeSelectTypes, width: opts.isNeedAdjustWidth ? opts.width : undefined, supportDynamic: opts.supportDynamic, diff --git a/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.popup.js b/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.popup.js index 33678a041..60a94ff8f 100644 --- a/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.popup.js +++ b/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.popup.js @@ -36,6 +36,7 @@ export class DynamicDateTimePopup extends Widget { baseCls: "bi-dynamic-date-time-popup", width: 272, supportDynamic: true, + isShow: false, // 是否是预览状态 }; static EVENT_CHANGE = "EVENT_CHANGE"; @@ -292,10 +293,24 @@ export class DynamicDateTimePopup extends Widget { v = v || {}; const type = v.type || DynamicDateCombo.Static; const value = v.value || v; - this.dateTab.setSelect(type); + const { isShow } = this.options; + let date; + + // 如果是预览状态 直接打开静态页面 + this.dateTab.setSelect(isShow ? DynamicDateCombo.Static : type); switch (type) { case DynamicDateCombo.Dynamic: - this.dynamicPane.setValue(value); + if (isShow) { + date = DynamicDateHelper.getCalculation(value); + this.ymd.setValue({ + year: date.getFullYear(), + month: date.getMonth() + 1, + day: date.getDate(), + }); + this.timeSelect.setValue(); + } else { + this.dynamicPane.setValue(value); + } this._setInnerValue(); break; case DynamicDateCombo.Static: diff --git a/packages/fineui/src/widget/timeinterval/dateinterval.js b/packages/fineui/src/widget/timeinterval/dateinterval.js index 76a7ff381..a48aa292f 100644 --- a/packages/fineui/src/widget/timeinterval/dateinterval.js +++ b/packages/fineui/src/widget/timeinterval/dateinterval.js @@ -23,6 +23,7 @@ export class DateInterval extends Single { lgap: 15, offset: 0, timeErrorCls: "time-error", + isShow: false, // 是否是预览状态 }; static EVENT_VALID = "EVENT_VALID"; @@ -78,6 +79,7 @@ export class DateInterval extends Single { const o = this.options; const combo = createWidget({ type: DynamicDateCombo.xtype, + isShow: o.isShow, supportDynamic: o.supportDynamic, minDate: o.minDate, maxDate: o.maxDate, diff --git a/packages/fineui/src/widget/timeinterval/timeinterval.js b/packages/fineui/src/widget/timeinterval/timeinterval.js index 47e6d0210..191205233 100644 --- a/packages/fineui/src/widget/timeinterval/timeinterval.js +++ b/packages/fineui/src/widget/timeinterval/timeinterval.js @@ -23,6 +23,7 @@ export class TimeInterval extends Single { lgap: 15, offset: 0, timeErrorCls: "time-error", + isShow: false, // 是否是预览状态 }; static EVENT_VALID = "EVENT_VALID"; @@ -76,6 +77,7 @@ export class TimeInterval extends Single { const o = this.options; const combo = createWidget({ type: DynamicDateTimeCombo.xtype, + isShow: o.isShow, timeSelectTypes: o.timeSelectTypes, simple: o.simple, supportDynamic: o.supportDynamic, diff --git a/packages/fineui/src/widget/year/combo.year.js b/packages/fineui/src/widget/year/combo.year.js index b1ce3612f..4ca476a28 100644 --- a/packages/fineui/src/widget/year/combo.year.js +++ b/packages/fineui/src/widget/year/combo.year.js @@ -27,6 +27,7 @@ export class DynamicYearCombo extends Widget { maxDate: "2099-12-31", // 最大日期 height: 24, supportDynamic: true, + isShow: false, // 是否是预览状态 }; _init() { @@ -95,6 +96,7 @@ export class DynamicYearCombo extends Widget { el: { type: DynamicYearPopup.xtype, supportDynamic: o.supportDynamic, + isShow: o.isShow, ref: _ref => { this.popup = _ref; }, diff --git a/packages/fineui/src/widget/year/popup.year.js b/packages/fineui/src/widget/year/popup.year.js index 5400407c0..cb274a8d8 100644 --- a/packages/fineui/src/widget/year/popup.year.js +++ b/packages/fineui/src/widget/year/popup.year.js @@ -30,6 +30,7 @@ export class DynamicYearPopup extends Widget { max: "2099-12-31", width: 180, supportDynamic: true, + isShow: false, // 是否是预览状态 }; constants = { tabHeight: 40, @@ -266,10 +267,15 @@ export class DynamicYearPopup extends Widget { v = v || {}; const type = v.type || DynamicDateCombo.Static; const value = v.value || v; - this.dateTab.setSelect(type); + const { isShow } = this.options; + + // 如果是预览状态 直接打开静态页面 + this.dateTab.setSelect(isShow ? DynamicDateCombo.Static : type); switch (type) { case DynamicDateCombo.Dynamic: - this.dynamicPane.setValue(value); + isShow + ? this.year.setValue({ year: DynamicDateHelper.getCalculation(value).getFullYear() }) + : this.dynamicPane.setValue(value); this._setInnerValue(); break; case DynamicDateCombo.Static: diff --git a/packages/fineui/src/widget/yearmonth/combo.yearmonth.js b/packages/fineui/src/widget/yearmonth/combo.yearmonth.js index 55e0c24da..e0871a7f7 100644 --- a/packages/fineui/src/widget/yearmonth/combo.yearmonth.js +++ b/packages/fineui/src/widget/yearmonth/combo.yearmonth.js @@ -38,6 +38,7 @@ export class DynamicYearMonthCombo extends Single { supportDynamic: true, isNeedAdjustHeight: false, isNeedAdjustWidth: false, + isShow: false, // 是否是预览状态 }; _init() { @@ -106,6 +107,7 @@ export class DynamicYearMonthCombo extends Single { type: DynamicYearMonthPopup.xtype, width: o.isNeedAdjustWidth ? o.width : undefined, supportDynamic: o.supportDynamic, + isShow: o.isShow, ref: _ref => { this.popup = _ref; }, diff --git a/packages/fineui/src/widget/yearmonth/popup.yearmonth.js b/packages/fineui/src/widget/yearmonth/popup.yearmonth.js index a269169b8..26885aa36 100644 --- a/packages/fineui/src/widget/yearmonth/popup.yearmonth.js +++ b/packages/fineui/src/widget/yearmonth/popup.yearmonth.js @@ -31,6 +31,7 @@ export class DynamicYearMonthPopup extends Widget { max: "2099-12-31", width: 180, supportDynamic: true, + isShow: false, // 是否是预览状态 }; static BUTTON_CLEAR_EVENT_CHANGE = "BUTTON_CLEAR_EVENT_CHANGE"; @@ -262,11 +263,22 @@ export class DynamicYearMonthPopup extends Widget { v = v || {}; const type = v.type || DynamicDateCombo.Static; const value = v.value || v; + const { isShow } = this.options; + let date; - this.dateTab.setSelect(type); + // 如果是预览状态 直接打开静态页面 + this.dateTab.setSelect(isShow ? DynamicDateCombo.Static : type); switch (type) { case DynamicDateCombo.Dynamic: - this.dynamicPane.setValue(value); + if (isShow) { + date = DynamicDateHelper.getCalculation(value); + this.year.setValue({ + year: date.getFullYear(), + month: date.getMonth() + 1, + }); + } else { + this.dynamicPane.setValue(value); + } this._setInnerValue(); break; case DynamicDateCombo.Static: diff --git a/packages/fineui/src/widget/yearmonthinterval/yearmonthinterval.js b/packages/fineui/src/widget/yearmonthinterval/yearmonthinterval.js index d5689f43b..440335153 100644 --- a/packages/fineui/src/widget/yearmonthinterval/yearmonthinterval.js +++ b/packages/fineui/src/widget/yearmonthinterval/yearmonthinterval.js @@ -34,6 +34,7 @@ export class YearMonthInterval extends Single { supportDynamic: true, height: 24, simple: false, + isShow: false, // 是否是预览状态 }; render() { @@ -71,6 +72,7 @@ export class YearMonthInterval extends Single { const o = this.options; const combo = createWidget({ type: DynamicYearMonthCombo.xtype, + isShow: o.isShow, simple: o.simple, supportDynamic: o.supportDynamic, height: o.height, diff --git a/packages/fineui/src/widget/yearquarter/combo.yearquarter.js b/packages/fineui/src/widget/yearquarter/combo.yearquarter.js index 8255bf054..81017faa0 100644 --- a/packages/fineui/src/widget/yearquarter/combo.yearquarter.js +++ b/packages/fineui/src/widget/yearquarter/combo.yearquarter.js @@ -33,6 +33,7 @@ export class DynamicYearQuarterCombo extends Widget { supportDynamic: true, isNeedAdjustHeight: false, isNeedAdjustWidth: false, + isShow: false, // 是否是预览状态 }; static EVENT_CONFIRM = "EVENT_CONFIRM"; @@ -109,6 +110,7 @@ export class DynamicYearQuarterCombo extends Widget { type: DynamicYearQuarterPopup.xtype, width: o.isNeedAdjustWidth ? o.width : undefined, supportDynamic: o.supportDynamic, + isShow: o.isShow, ref: _ref => { this.popup = _ref; }, diff --git a/packages/fineui/src/widget/yearquarter/popup.yearquarter.js b/packages/fineui/src/widget/yearquarter/popup.yearquarter.js index 5ac06d6a0..196074629 100644 --- a/packages/fineui/src/widget/yearquarter/popup.yearquarter.js +++ b/packages/fineui/src/widget/yearquarter/popup.yearquarter.js @@ -32,6 +32,7 @@ export class DynamicYearQuarterPopup extends Widget { max: "2099-12-31", width: 180, supportDynamic: true, + isShow: false, // 是否是预览状态 }; static BUTTON_CLEAR_EVENT_CHANGE = "BUTTON_CLEAR_EVENT_CHANGE"; @@ -41,7 +42,7 @@ export class DynamicYearQuarterPopup extends Widget { render() { this.storeValue = { type: DynamicYearQuarterCombo.Static }; - + return { type: VerticalLayout.xtype, items: [ @@ -157,7 +158,7 @@ export class DynamicYearQuarterPopup extends Widget { _checkTodayValid() { const o = this.options; const today = getDate(); - + return !!checkDateVoid( today.getFullYear(), today.getMonth() + 1, @@ -169,7 +170,7 @@ export class DynamicYearQuarterPopup extends Widget { _getTabJson() { const o = this.options; - + return { type: Tab.xtype, logic: { @@ -263,8 +264,8 @@ export class DynamicYearQuarterPopup extends Widget { default: if ( this.storeValue && - this.storeValue.type === - DynamicYearQuarterCombo.Dynamic + this.storeValue.type === + DynamicYearQuarterCombo.Dynamic ) { this.dynamicPane.setValue( this.storeValue.value @@ -304,10 +305,22 @@ export class DynamicYearQuarterPopup extends Widget { v = v || {}; const type = v.type || DynamicDateCombo.Static; const value = v.value || v; - this.dateTab.setSelect(type); + const { isShow } = this.options; + let date; + + // 如果是预览状态 直接打开静态页面 + this.dateTab.setSelect(isShow ? DynamicDateCombo.Static : type); switch (type) { case DynamicDateCombo.Dynamic: - this.dynamicPane.setValue(value); + if (isShow) { + date = DynamicDateHelper.getCalculation(value); + this.year.setValue({ + year: date.getFullYear(), + quarter: getQuarter(date), + }); + } else { + this.dynamicPane.setValue(value); + } this._setInnerValue(); break; case DynamicDateCombo.Static: From 69cbd372880fa72a8abdfdeb14228ae1b94fdffc Mon Sep 17 00:00:00 2001 From: chenzeyu Date: Mon, 11 Dec 2023 14:08:57 +0800 Subject: [PATCH 2/6] =?UTF-8?q?BI-133648=20feat=EF=BC=9A=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E6=8E=A7=E4=BB=B6=E5=8A=A0=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fineui/src/widget/datepane/datepane.js | 65 +++++++++++++------ .../widget/dynamicdate/dynamicdate.combo.js | 4 +- .../widget/dynamicdate/dynamicdate.popup.js | 8 +-- .../dynamicdatetime/dynamicdatetime.combo.js | 4 +- .../dynamicdatetime/dynamicdatetime.popup.js | 8 +-- .../src/widget/timeinterval/dateinterval.js | 4 +- .../src/widget/timeinterval/timeinterval.js | 4 +- packages/fineui/src/widget/year/combo.year.js | 4 +- packages/fineui/src/widget/year/popup.year.js | 8 +-- .../src/widget/yearmonth/combo.yearmonth.js | 4 +- .../src/widget/yearmonth/popup.yearmonth.js | 8 +-- .../yearmonthinterval/yearmonthinterval.js | 4 +- .../widget/yearquarter/combo.yearquarter.js | 4 +- .../widget/yearquarter/popup.yearquarter.js | 8 +-- 14 files changed, 81 insertions(+), 56 deletions(-) diff --git a/packages/fineui/src/widget/datepane/datepane.js b/packages/fineui/src/widget/datepane/datepane.js index 2a6f73ccd..e8f79ea3f 100644 --- a/packages/fineui/src/widget/datepane/datepane.js +++ b/packages/fineui/src/widget/datepane/datepane.js @@ -30,7 +30,7 @@ export class DynamicDatePane extends Widget { minDate: "1900-01-01", maxDate: "2099-12-31", supportDynamic: true, - isShow: false, // 是否是预览状态 + isPreview: false, // 是否是预览状态 }; render() { @@ -196,7 +196,7 @@ export class DynamicDatePane extends Widget { } created() { - this.setValue(this.options.value, true); + this._initValue(this.options.value); } _checkValueValid(value) { @@ -213,6 +213,45 @@ export class DynamicDatePane extends Widget { } } + _initValue(v) { + v = v || {}; + const type = v.type || DynamicDateCombo.Static; + const value = v.value || v; + + const { isPreview } = this.options; + let date; + + // 如果是初始化且是预览状态 直接打开静态页面 + this.switcher.setValue(isPreview ? DynamicDateCombo.Static : type); + this.dateTab.setSelect(isPreview ? DynamicDateCombo.Static : type); + switch (type) { + case DynamicDateCombo.Dynamic: + if (isPreview) { + date = DynamicDateHelper.getCalculation(value); + this.ymd.setValue({ + year: date.getFullYear(), + month: date.getMonth() + 1, + day: date.getDate(), + }); + } else { + this.dynamicPane.setValue(value); + } + break; + case DynamicDateCombo.Static: + default: + if (this._checkValueValid(value)) { + const date = getDate(); + this.ymd.setValue({ + year: date.getFullYear(), + month: date.getMonth() + 1, + }); + } else { + this.ymd.setValue(value); + } + break; + } + } + setMinDate(minDate) { if (this.options.minDate !== minDate) { this.options.minDate = minDate; @@ -227,29 +266,15 @@ export class DynamicDatePane extends Widget { } } - setValue(v, isCreated = false) { + setValue(v) { v = v || {}; const type = v.type || DynamicDateCombo.Static; const value = v.value || v; - - const { isShow } = this.options; - let date; - - // 如果是初始化且是预览状态 直接打开静态页面 - this.switcher.setValue(isShow && isCreated ? DynamicDateCombo.Static : type); - this.dateTab.setSelect(isShow && isCreated ? DynamicDateCombo.Static : type); + this.switcher.setValue(type); + this.dateTab.setSelect(type); switch (type) { case DynamicDateCombo.Dynamic: - if (isShow && isCreated) { - date = DynamicDateHelper.getCalculation(value); - this.ymd.setValue({ - year: date.getFullYear(), - month: date.getMonth() + 1, - day: date.getDate(), - }); - } else { - this.dynamicPane.setValue(value); - } + this.dynamicPane.setValue(value); break; case DynamicDateCombo.Static: default: diff --git a/packages/fineui/src/widget/dynamicdate/dynamicdate.combo.js b/packages/fineui/src/widget/dynamicdate/dynamicdate.combo.js index 02112a21b..3fa097e55 100644 --- a/packages/fineui/src/widget/dynamicdate/dynamicdate.combo.js +++ b/packages/fineui/src/widget/dynamicdate/dynamicdate.combo.js @@ -53,7 +53,7 @@ export class DynamicDateCombo extends Single { }, isNeedAdjustHeight: false, isNeedAdjustWidth: false, - isShow: false, // 是否是预览状态 + isPreview: false, // 是否是预览状态 }; _init() { @@ -201,7 +201,7 @@ export class DynamicDateCombo extends Single { popup: { el: { type: DynamicDatePopup.xtype, - isShow: opts.isShow, + isPreview: opts.isPreview, width: opts.isNeedAdjustWidth ? opts.width : undefined, supportDynamic: opts.supportDynamic, behaviors: opts.behaviors, diff --git a/packages/fineui/src/widget/dynamicdate/dynamicdate.popup.js b/packages/fineui/src/widget/dynamicdate/dynamicdate.popup.js index 34b6b03e6..c4eafa71e 100644 --- a/packages/fineui/src/widget/dynamicdate/dynamicdate.popup.js +++ b/packages/fineui/src/widget/dynamicdate/dynamicdate.popup.js @@ -34,7 +34,7 @@ export class DynamicDatePopup extends Widget { baseCls: "bi-dynamic-date-popup", width: 272, supportDynamic: true, - isShow: false, // 是否是预览状态 + isPreview: false, // 是否是预览状态 }; static EVENT_CHANGE = "EVENT_CHANGE"; @@ -283,14 +283,14 @@ export class DynamicDatePopup extends Widget { v = v || {}; const type = v.type || DynamicDateCombo.Static; const value = v.value || v; - const { isShow } = this.options; + const { isPreview } = this.options; let date; // 如果是预览状态 直接打开静态页面 - this.dateTab.setSelect(isShow ? DynamicDateCombo.Static : type); + this.dateTab.setSelect(isPreview ? DynamicDateCombo.Static : type); switch (type) { case DynamicDateCombo.Dynamic: - if (isShow) { + if (isPreview) { date = DynamicDateHelper.getCalculation(value); this.ymd.setValue({ year: date.getFullYear(), diff --git a/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.combo.js b/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.combo.js index d2b21b6f3..e65e12768 100644 --- a/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.combo.js +++ b/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.combo.js @@ -44,7 +44,7 @@ export class DynamicDateTimeCombo extends Single { }, isNeedAdjustHeight: false, isNeedAdjustWidth: false, - isShow: false, // 是否是预览状态 + isPreview: false, // 是否是预览状态 }; static EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; @@ -208,7 +208,7 @@ export class DynamicDateTimeCombo extends Single { popup: { el: { type: DynamicDateTimePopup.xtype, - isShow: opts.isShow, + isPreview: opts.isPreview, timeSelectTypes: opts.timeSelectTypes, width: opts.isNeedAdjustWidth ? opts.width : undefined, supportDynamic: opts.supportDynamic, diff --git a/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.popup.js b/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.popup.js index 60a94ff8f..e54ae49b8 100644 --- a/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.popup.js +++ b/packages/fineui/src/widget/dynamicdatetime/dynamicdatetime.popup.js @@ -36,7 +36,7 @@ export class DynamicDateTimePopup extends Widget { baseCls: "bi-dynamic-date-time-popup", width: 272, supportDynamic: true, - isShow: false, // 是否是预览状态 + isPreview: false, // 是否是预览状态 }; static EVENT_CHANGE = "EVENT_CHANGE"; @@ -293,14 +293,14 @@ export class DynamicDateTimePopup extends Widget { v = v || {}; const type = v.type || DynamicDateCombo.Static; const value = v.value || v; - const { isShow } = this.options; + const { isPreview } = this.options; let date; // 如果是预览状态 直接打开静态页面 - this.dateTab.setSelect(isShow ? DynamicDateCombo.Static : type); + this.dateTab.setSelect(isPreview ? DynamicDateCombo.Static : type); switch (type) { case DynamicDateCombo.Dynamic: - if (isShow) { + if (isPreview) { date = DynamicDateHelper.getCalculation(value); this.ymd.setValue({ year: date.getFullYear(), diff --git a/packages/fineui/src/widget/timeinterval/dateinterval.js b/packages/fineui/src/widget/timeinterval/dateinterval.js index a48aa292f..4c7f784da 100644 --- a/packages/fineui/src/widget/timeinterval/dateinterval.js +++ b/packages/fineui/src/widget/timeinterval/dateinterval.js @@ -23,7 +23,7 @@ export class DateInterval extends Single { lgap: 15, offset: 0, timeErrorCls: "time-error", - isShow: false, // 是否是预览状态 + isPreview: false, // 是否是预览状态 }; static EVENT_VALID = "EVENT_VALID"; @@ -79,7 +79,7 @@ export class DateInterval extends Single { const o = this.options; const combo = createWidget({ type: DynamicDateCombo.xtype, - isShow: o.isShow, + isPreview: o.isPreview, supportDynamic: o.supportDynamic, minDate: o.minDate, maxDate: o.maxDate, diff --git a/packages/fineui/src/widget/timeinterval/timeinterval.js b/packages/fineui/src/widget/timeinterval/timeinterval.js index 191205233..85deda173 100644 --- a/packages/fineui/src/widget/timeinterval/timeinterval.js +++ b/packages/fineui/src/widget/timeinterval/timeinterval.js @@ -23,7 +23,7 @@ export class TimeInterval extends Single { lgap: 15, offset: 0, timeErrorCls: "time-error", - isShow: false, // 是否是预览状态 + isPreview: false, // 是否是预览状态 }; static EVENT_VALID = "EVENT_VALID"; @@ -77,7 +77,7 @@ export class TimeInterval extends Single { const o = this.options; const combo = createWidget({ type: DynamicDateTimeCombo.xtype, - isShow: o.isShow, + isPreview: o.isPreview, timeSelectTypes: o.timeSelectTypes, simple: o.simple, supportDynamic: o.supportDynamic, diff --git a/packages/fineui/src/widget/year/combo.year.js b/packages/fineui/src/widget/year/combo.year.js index 4ca476a28..50056e22e 100644 --- a/packages/fineui/src/widget/year/combo.year.js +++ b/packages/fineui/src/widget/year/combo.year.js @@ -27,7 +27,7 @@ export class DynamicYearCombo extends Widget { maxDate: "2099-12-31", // 最大日期 height: 24, supportDynamic: true, - isShow: false, // 是否是预览状态 + isPreview: false, // 是否是预览状态 }; _init() { @@ -96,7 +96,7 @@ export class DynamicYearCombo extends Widget { el: { type: DynamicYearPopup.xtype, supportDynamic: o.supportDynamic, - isShow: o.isShow, + isPreview: o.isPreview, ref: _ref => { this.popup = _ref; }, diff --git a/packages/fineui/src/widget/year/popup.year.js b/packages/fineui/src/widget/year/popup.year.js index cb274a8d8..520e5978e 100644 --- a/packages/fineui/src/widget/year/popup.year.js +++ b/packages/fineui/src/widget/year/popup.year.js @@ -30,7 +30,7 @@ export class DynamicYearPopup extends Widget { max: "2099-12-31", width: 180, supportDynamic: true, - isShow: false, // 是否是预览状态 + isPreview: false, // 是否是预览状态 }; constants = { tabHeight: 40, @@ -267,13 +267,13 @@ export class DynamicYearPopup extends Widget { v = v || {}; const type = v.type || DynamicDateCombo.Static; const value = v.value || v; - const { isShow } = this.options; + const { isPreview } = this.options; // 如果是预览状态 直接打开静态页面 - this.dateTab.setSelect(isShow ? DynamicDateCombo.Static : type); + this.dateTab.setSelect(isPreview ? DynamicDateCombo.Static : type); switch (type) { case DynamicDateCombo.Dynamic: - isShow + isPreview ? this.year.setValue({ year: DynamicDateHelper.getCalculation(value).getFullYear() }) : this.dynamicPane.setValue(value); this._setInnerValue(); diff --git a/packages/fineui/src/widget/yearmonth/combo.yearmonth.js b/packages/fineui/src/widget/yearmonth/combo.yearmonth.js index e0871a7f7..79dfa5da8 100644 --- a/packages/fineui/src/widget/yearmonth/combo.yearmonth.js +++ b/packages/fineui/src/widget/yearmonth/combo.yearmonth.js @@ -38,7 +38,7 @@ export class DynamicYearMonthCombo extends Single { supportDynamic: true, isNeedAdjustHeight: false, isNeedAdjustWidth: false, - isShow: false, // 是否是预览状态 + isPreview: false, // 是否是预览状态 }; _init() { @@ -107,7 +107,7 @@ export class DynamicYearMonthCombo extends Single { type: DynamicYearMonthPopup.xtype, width: o.isNeedAdjustWidth ? o.width : undefined, supportDynamic: o.supportDynamic, - isShow: o.isShow, + isPreview: o.isPreview, ref: _ref => { this.popup = _ref; }, diff --git a/packages/fineui/src/widget/yearmonth/popup.yearmonth.js b/packages/fineui/src/widget/yearmonth/popup.yearmonth.js index 26885aa36..f81dae5f2 100644 --- a/packages/fineui/src/widget/yearmonth/popup.yearmonth.js +++ b/packages/fineui/src/widget/yearmonth/popup.yearmonth.js @@ -31,7 +31,7 @@ export class DynamicYearMonthPopup extends Widget { max: "2099-12-31", width: 180, supportDynamic: true, - isShow: false, // 是否是预览状态 + isPreview: false, // 是否是预览状态 }; static BUTTON_CLEAR_EVENT_CHANGE = "BUTTON_CLEAR_EVENT_CHANGE"; @@ -263,14 +263,14 @@ export class DynamicYearMonthPopup extends Widget { v = v || {}; const type = v.type || DynamicDateCombo.Static; const value = v.value || v; - const { isShow } = this.options; + const { isPreview } = this.options; let date; // 如果是预览状态 直接打开静态页面 - this.dateTab.setSelect(isShow ? DynamicDateCombo.Static : type); + this.dateTab.setSelect(isPreview ? DynamicDateCombo.Static : type); switch (type) { case DynamicDateCombo.Dynamic: - if (isShow) { + if (isPreview) { date = DynamicDateHelper.getCalculation(value); this.year.setValue({ year: date.getFullYear(), diff --git a/packages/fineui/src/widget/yearmonthinterval/yearmonthinterval.js b/packages/fineui/src/widget/yearmonthinterval/yearmonthinterval.js index 440335153..c6bc874bb 100644 --- a/packages/fineui/src/widget/yearmonthinterval/yearmonthinterval.js +++ b/packages/fineui/src/widget/yearmonthinterval/yearmonthinterval.js @@ -34,7 +34,7 @@ export class YearMonthInterval extends Single { supportDynamic: true, height: 24, simple: false, - isShow: false, // 是否是预览状态 + isPreview: false, // 是否是预览状态 }; render() { @@ -72,7 +72,7 @@ export class YearMonthInterval extends Single { const o = this.options; const combo = createWidget({ type: DynamicYearMonthCombo.xtype, - isShow: o.isShow, + isPreview: o.isPreview, simple: o.simple, supportDynamic: o.supportDynamic, height: o.height, diff --git a/packages/fineui/src/widget/yearquarter/combo.yearquarter.js b/packages/fineui/src/widget/yearquarter/combo.yearquarter.js index 81017faa0..c14100a38 100644 --- a/packages/fineui/src/widget/yearquarter/combo.yearquarter.js +++ b/packages/fineui/src/widget/yearquarter/combo.yearquarter.js @@ -33,7 +33,7 @@ export class DynamicYearQuarterCombo extends Widget { supportDynamic: true, isNeedAdjustHeight: false, isNeedAdjustWidth: false, - isShow: false, // 是否是预览状态 + isPreview: false, // 是否是预览状态 }; static EVENT_CONFIRM = "EVENT_CONFIRM"; @@ -110,7 +110,7 @@ export class DynamicYearQuarterCombo extends Widget { type: DynamicYearQuarterPopup.xtype, width: o.isNeedAdjustWidth ? o.width : undefined, supportDynamic: o.supportDynamic, - isShow: o.isShow, + isPreview: o.isPreview, ref: _ref => { this.popup = _ref; }, diff --git a/packages/fineui/src/widget/yearquarter/popup.yearquarter.js b/packages/fineui/src/widget/yearquarter/popup.yearquarter.js index 196074629..7e95378e9 100644 --- a/packages/fineui/src/widget/yearquarter/popup.yearquarter.js +++ b/packages/fineui/src/widget/yearquarter/popup.yearquarter.js @@ -32,7 +32,7 @@ export class DynamicYearQuarterPopup extends Widget { max: "2099-12-31", width: 180, supportDynamic: true, - isShow: false, // 是否是预览状态 + isPreview: false, // 是否是预览状态 }; static BUTTON_CLEAR_EVENT_CHANGE = "BUTTON_CLEAR_EVENT_CHANGE"; @@ -305,14 +305,14 @@ export class DynamicYearQuarterPopup extends Widget { v = v || {}; const type = v.type || DynamicDateCombo.Static; const value = v.value || v; - const { isShow } = this.options; + const { isPreview } = this.options; let date; // 如果是预览状态 直接打开静态页面 - this.dateTab.setSelect(isShow ? DynamicDateCombo.Static : type); + this.dateTab.setSelect(isPreview ? DynamicDateCombo.Static : type); switch (type) { case DynamicDateCombo.Dynamic: - if (isShow) { + if (isPreview) { date = DynamicDateHelper.getCalculation(value); this.year.setValue({ year: date.getFullYear(), From 0e8e943686002bfdc88957f11bea3ec2ea5a63b1 Mon Sep 17 00:00:00 2001 From: jian Date: Mon, 11 Dec 2023 16:16:44 +0800 Subject: [PATCH 3/6] =?UTF-8?q?KERNEL-16950=20fix:=20=E5=86=85=E5=AD=98?= =?UTF-8?q?=E6=B3=84=E9=9C=B2=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/src/fix/fix.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/fineui/src/fix/fix.js b/packages/fineui/src/fix/fix.js index 0572c66d6..c2f0ddd12 100644 --- a/packages/fineui/src/fix/fix.js +++ b/packages/fineui/src/fix/fix.js @@ -1380,10 +1380,13 @@ class Model { }); }); this._watchers && (this._watchers = []); + this._computedWatchers && (this._computedWatchers = []); this.destroyed && this.destroyed(); this.$$model = null; this.$$computed = null; this.$$state = null; + this.$$context = null; + this.model = null; this._destroyHandler && this._destroyHandler(); } } From 9fd1fd58fb59cd772813728d0dfb6957bf04177d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=BF=A0=E5=B1=8F=E5=B1=B1=E6=9C=80=E9=80=9F=E4=B8=8B?= =?UTF-8?q?=E5=B1=B1=E4=BC=A0=E8=AF=B4?= Date: Mon, 11 Dec 2023 17:56:03 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E6=97=A0JIRA=20=E7=BB=84=E4=BB=B6=E9=94=80?= =?UTF-8?q?=E6=AF=81=E7=9A=84=E6=97=B6=E5=80=99ref=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/src/core/4.widget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fineui/src/core/4.widget.js b/packages/fineui/src/core/4.widget.js index 826cc5f84..bc810570b 100644 --- a/packages/fineui/src/core/4.widget.js +++ b/packages/fineui/src/core/4.widget.js @@ -868,13 +868,13 @@ export class Widget extends OB { callLifeHook(this, "destroyed"); this.destroyed = null; this._isDestroyed = true; - // this._purgeRef(); // 清除ref的时机还是要仔细考虑一下 } _unMount() { this._assetMounted(); this.__destroy(); this.fireEvent(Events.UNMOUNT); + this._purgeRef(); this.purgeListeners(); } From 616fb22b795529ec04ebc2ce5595b6edcd830f15 Mon Sep 17 00:00:00 2001 From: chenzeyu Date: Mon, 11 Dec 2023 18:58:52 +0800 Subject: [PATCH 5/6] =?UTF-8?q?BI-133648=20feat=EF=BC=9A=E6=97=A5=E6=9C=9F?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E6=8E=A7=E4=BB=B6=E5=8A=A0=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E6=A8=A1=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../fineui/src/widget/datepane/datepane.js | 57 ++++++++----------- 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/packages/fineui/src/widget/datepane/datepane.js b/packages/fineui/src/widget/datepane/datepane.js index e8f79ea3f..8ba860c66 100644 --- a/packages/fineui/src/widget/datepane/datepane.js +++ b/packages/fineui/src/widget/datepane/datepane.js @@ -64,17 +64,11 @@ export class DynamicDatePane extends Widget { { eventName: ButtonGroup.EVENT_CHANGE, action: () => { - let date; const value = this.switcher.getValue()[0]; this.dateTab.setSelect(value); switch (value) { case DynamicDatePane.Static: - date = DynamicDateHelper.getCalculation(this.dynamicPane.getValue()); - this.ymd.setValue({ - year: date.getFullYear(), - month: date.getMonth() + 1, - day: date.getDate(), - }); + this._setStaticValueByDynamicValue(this.dynamicPane.getValue()); break; case DynamicDatePane.Dynamic: this.dynamicPane.setValue({ @@ -219,7 +213,6 @@ export class DynamicDatePane extends Widget { const value = v.value || v; const { isPreview } = this.options; - let date; // 如果是初始化且是预览状态 直接打开静态页面 this.switcher.setValue(isPreview ? DynamicDateCombo.Static : type); @@ -227,27 +220,14 @@ export class DynamicDatePane extends Widget { switch (type) { case DynamicDateCombo.Dynamic: if (isPreview) { - date = DynamicDateHelper.getCalculation(value); - this.ymd.setValue({ - year: date.getFullYear(), - month: date.getMonth() + 1, - day: date.getDate(), - }); + this._setStaticValueByDynamicValue(value); } else { this.dynamicPane.setValue(value); } break; case DynamicDateCombo.Static: default: - if (this._checkValueValid(value)) { - const date = getDate(); - this.ymd.setValue({ - year: date.getFullYear(), - month: date.getMonth() + 1, - }); - } else { - this.ymd.setValue(value); - } + this._setStaticValue(value); break; } } @@ -278,19 +258,32 @@ export class DynamicDatePane extends Widget { break; case DynamicDateCombo.Static: default: - if (this._checkValueValid(value)) { - const date = getDate(); - this.ymd.setValue({ - year: date.getFullYear(), - month: date.getMonth() + 1, - }); - } else { - this.ymd.setValue(value); - } + this._setStaticValue(value); break; } } + _setStaticValue(value) { + if (this._checkValueValid(value)) { + const date = getDate(); + this.ymd.setValue({ + year: date.getFullYear(), + month: date.getMonth() + 1, + }); + } else { + this.ymd.setValue(value); + } + } + + _setStaticValueByDynamicValue(value) { + const date = DynamicDateHelper.getCalculation(value); + this.ymd.setValue({ + year: date.getFullYear(), + month: date.getMonth() + 1, + day: date.getDate(), + }); + } + getValue() { const type = this.dateTab.getSelect(); From 567d9e7894c3e673656468b0b40659d4a8d309b6 Mon Sep 17 00:00:00 2001 From: jian Date: Mon, 11 Dec 2023 23:58:16 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E6=97=A0jia=E4=BB=BB=E5=8A=A1=20=E5=85=88?= =?UTF-8?q?=E5=9B=9E=E9=80=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/src/core/4.widget.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/fineui/src/core/4.widget.js b/packages/fineui/src/core/4.widget.js index bc810570b..c8fbe5d2f 100644 --- a/packages/fineui/src/core/4.widget.js +++ b/packages/fineui/src/core/4.widget.js @@ -874,7 +874,7 @@ export class Widget extends OB { this._assetMounted(); this.__destroy(); this.fireEvent(Events.UNMOUNT); - this._purgeRef(); + // this._purgeRef(); // 子组件unmount ref置为null了,父组件拿不到ref,导致报错 this.purgeListeners(); }