diff --git a/changelog.md b/changelog.md index 554d388df5..a4910b1451 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,6 @@ # 更新日志 2.0(2020-12) +- 日期选择控件为年月选择器子组件新增POPUP弹出前事件 - 文件上传控件新增API(setMaxFileLength)以动态设置最大上传文件数量 - 复选下拉树显示查看已选效果改成和复选下拉列表一致 - Pane系列提供small和big两种大小的加载动画 diff --git a/src/widget/date/calendar/combo.year.date.js b/src/widget/date/calendar/combo.year.date.js index 1d7f59bada..348949da9b 100644 --- a/src/widget/date/calendar/combo.year.date.js +++ b/src/widget/date/calendar/combo.year.date.js @@ -58,6 +58,7 @@ BI.YearDateCombo = BI.inherit(BI.Trigger, { // BI-22551 popup未初始化传入的behavior无效 this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { self.doBehavior(); + self.fireEvent(BI.YearDateCombo.EVENT_BEFORE_POPUPVIEW); }); }, @@ -79,4 +80,5 @@ BI.YearDateCombo = BI.inherit(BI.Trigger, { } }); BI.YearDateCombo.EVENT_CHANGE = "EVENT_CHANGE"; +BI.YearDateCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; BI.shortcut("bi.year_date_combo", BI.YearDateCombo); diff --git a/src/widget/date/calendar/picker.date.js b/src/widget/date/calendar/picker.date.js index b1d015bb9f..f351443ef7 100644 --- a/src/widget/date/calendar/picker.date.js +++ b/src/widget/date/calendar/picker.date.js @@ -80,6 +80,9 @@ BI.DatePicker = BI.inherit(BI.Widget, { }); self.fireEvent(BI.DatePicker.EVENT_CHANGE); }); + this.year.on(BI.YearDateCombo.EVENT_BEFORE_POPUPVIEW, function () { + self.fireEvent(BI.DatePicker.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); + }); this.month = BI.createWidget({ type: "bi.month_date_combo", behaviors: o.behaviors, @@ -92,6 +95,9 @@ BI.DatePicker = BI.inherit(BI.Widget, { }); self.fireEvent(BI.DatePicker.EVENT_CHANGE); }); + this.month.on(BI.YearDateCombo.EVENT_BEFORE_POPUPVIEW, function () { + self.fireEvent(BI.DatePicker.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); + }); BI.createWidget({ type: "bi.htape", @@ -218,4 +224,5 @@ BI.DatePicker = BI.inherit(BI.Widget, { }, }); BI.DatePicker.EVENT_CHANGE = "EVENT_CHANGE"; +BI.DatePicker.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW"; BI.shortcut("bi.date_picker", BI.DatePicker); diff --git a/src/widget/date/calendar/picker.year.js b/src/widget/date/calendar/picker.year.js index 389ee51cb5..1a179d6503 100644 --- a/src/widget/date/calendar/picker.year.js +++ b/src/widget/date/calendar/picker.year.js @@ -57,6 +57,9 @@ BI.YearPicker = BI.inherit(BI.Widget, { self.setValue(self.year.getValue()); self.fireEvent(BI.YearPicker.EVENT_CHANGE); }); + this.year.on(BI.YearDateCombo.EVENT_BEFORE_POPUPVIEW, function () { + self.fireEvent(BI.YearPicker.EVENT_BEFORE_POPUPVIEW); + }); BI.createWidget({ type: "bi.htape", @@ -126,4 +129,5 @@ BI.YearPicker = BI.inherit(BI.Widget, { } }); BI.YearPicker.EVENT_CHANGE = "EVENT_CHANGE"; +BI.YearPicker.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; BI.shortcut("bi.year_picker", BI.YearPicker); diff --git a/src/widget/date/calendar/popup.calendar.date.js b/src/widget/date/calendar/popup.calendar.date.js index e76c4faece..2bbd04f7cc 100644 --- a/src/widget/date/calendar/popup.calendar.date.js +++ b/src/widget/date/calendar/popup.calendar.date.js @@ -76,6 +76,10 @@ BI.DateCalendarPopup = BI.inherit(BI.Widget, { self.calendar.setSelect(BI.Calendar.getPageByDateJSON(self.selectedTime)); }); + this.datePicker.on(BI.DatePicker.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW, function () { + self.fireEvent(BI.DateCalendarPopup.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); + }); + this.calendar.on(BI.Navigation.EVENT_CHANGE, function () { self.selectedTime = self.calendar.getValue(); self.setValue(self.selectedTime); @@ -144,4 +148,5 @@ BI.DateCalendarPopup = BI.inherit(BI.Widget, { } }); BI.DateCalendarPopup.EVENT_CHANGE = "EVENT_CHANGE"; +BI.DateCalendarPopup.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW"; BI.shortcut("bi.date_calendar_popup", BI.DateCalendarPopup); \ No newline at end of file diff --git a/src/widget/datepane/card.static.datepane.js b/src/widget/datepane/card.static.datepane.js index 2697a0d24f..1b4a59afaf 100644 --- a/src/widget/datepane/card.static.datepane.js +++ b/src/widget/datepane/card.static.datepane.js @@ -46,6 +46,9 @@ BI.StaticDatePaneCard = BI.inherit(BI.Widget, { self.calendar.setValue(self.selectedTime); day !== 0 && self.fireEvent(BI.DateCalendarPopup.EVENT_CHANGE); }); + this.datePicker.on(BI.DatePicker.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW, function () { + self.fireEvent(BI.StaticDatePaneCard.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); + }); this.calendar = BI.createWidget({ direction: "custom", @@ -148,4 +151,5 @@ BI.StaticDatePaneCard = BI.inherit(BI.Widget, { } }); +BI.StaticDatePaneCard.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW" BI.shortcut("bi.static_date_pane_card", BI.StaticDatePaneCard); \ No newline at end of file diff --git a/src/widget/datepane/datepane.js b/src/widget/datepane/datepane.js index be70600cf1..ffe4772aa8 100644 --- a/src/widget/datepane/datepane.js +++ b/src/widget/datepane/datepane.js @@ -69,6 +69,11 @@ BI.DynamicDatePane = BI.inherit(BI.Widget, { action: function () { self.fireEvent(BI.DynamicDatePane.EVENT_CHANGE); } + }, { + eventName: "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW", + action: function () { + self.fireEvent(BI.DynamicDatePane.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); + } }], ref: function () { self.ymd = this; @@ -148,6 +153,7 @@ BI.DynamicDatePane = BI.inherit(BI.Widget, { }); BI.DynamicDatePane.EVENT_CHANGE = "EVENT_CHANGE"; +BI.DynamicDatePane.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW"; BI.shortcut("bi.dynamic_date_pane", BI.DynamicDatePane); diff --git a/src/widget/datetimepane/card.static.datetimepane.js b/src/widget/datetimepane/card.static.datetimepane.js index f17fe91041..67579bbc7f 100644 --- a/src/widget/datetimepane/card.static.datetimepane.js +++ b/src/widget/datetimepane/card.static.datetimepane.js @@ -44,6 +44,10 @@ BI.StaticDateTimePaneCard = BI.inherit(BI.Widget, { day !== 0 && self.fireEvent(BI.DateCalendarPopup.EVENT_CHANGE); }); + this.datePicker.on(BI.DatePicker.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW, function () { + self.fireEvent(BI.StaticDateTimePaneCard.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); + }); + this.calendar = BI.createWidget({ direction: "custom", // logic: { @@ -167,4 +171,5 @@ BI.StaticDateTimePaneCard = BI.inherit(BI.Widget, { } }); +BI.StaticDateTimePaneCard.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW"; BI.shortcut("bi.static_date_time_pane_card", BI.StaticDateTimePaneCard); \ No newline at end of file diff --git a/src/widget/datetimepane/datetimepane.js b/src/widget/datetimepane/datetimepane.js index 71276d9156..21477d72c8 100644 --- a/src/widget/datetimepane/datetimepane.js +++ b/src/widget/datetimepane/datetimepane.js @@ -68,6 +68,11 @@ BI.DynamicDateTimePane = BI.inherit(BI.Widget, { action: function () { self.fireEvent("EVENT_CHANGE"); } + }, { + eventName: "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW", + action: function () { + self.fireEvent("EVENT_BEFORE_YEAR_MONTH_POPUPVIEW"); + } }], ref: function () { self.ymd = this; diff --git a/src/widget/dynamicdate/dynamicdate.combo.js b/src/widget/dynamicdate/dynamicdate.combo.js index 91adead65d..b9e9fdf8c9 100644 --- a/src/widget/dynamicdate/dynamicdate.combo.js +++ b/src/widget/dynamicdate/dynamicdate.combo.js @@ -179,6 +179,11 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, { self.combo.hideView(); self.fireEvent(BI.DynamicDateCombo.EVENT_CONFIRM); } + }, { + eventName: BI.DynamicDatePopup.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW, + action: function () { + self.fireEvent(BI.DynamicDateCombo.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); + } }] }, stopPropagation: false @@ -307,6 +312,7 @@ BI.DynamicDateCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.DynamicDateCombo.EVENT_VALID = "EVENT_VALID"; BI.DynamicDateCombo.EVENT_ERROR = "EVENT_ERROR"; BI.DynamicDateCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; +BI.DynamicDateCombo.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW"; BI.shortcut("bi.dynamic_date_combo", BI.DynamicDateCombo); diff --git a/src/widget/dynamicdate/dynamicdate.popup.js b/src/widget/dynamicdate/dynamicdate.popup.js index 73abd0b1af..9d84e7742b 100644 --- a/src/widget/dynamicdate/dynamicdate.popup.js +++ b/src/widget/dynamicdate/dynamicdate.popup.js @@ -117,6 +117,11 @@ BI.DynamicDatePopup = BI.inherit(BI.Widget, { action: function () { self.fireEvent(BI.DynamicDatePopup.EVENT_CHANGE); } + }, { + eventName: BI.DateCalendarPopup.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW, + action: function () { + self.fireEvent(BI.DynamicDatePopup.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); + } }], ref: function () { self.ymd = this; @@ -228,4 +233,5 @@ BI.DynamicDatePopup.EVENT_CHANGE = "EVENT_CHANGE"; BI.DynamicDatePopup.BUTTON_OK_EVENT_CHANGE = "BUTTON_OK_EVENT_CHANGE"; BI.DynamicDatePopup.BUTTON_lABEL_EVENT_CHANGE = "BUTTON_lABEL_EVENT_CHANGE"; BI.DynamicDatePopup.BUTTON_CLEAR_EVENT_CHANGE = "BUTTON_CLEAR_EVENT_CHANGE"; +BI.DynamicDatePopup.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW"; BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup); \ No newline at end of file diff --git a/src/widget/dynamicdatetime/dynamicdatetime.combo.js b/src/widget/dynamicdatetime/dynamicdatetime.combo.js index 50f7c9207f..dfda4ff8af 100644 --- a/src/widget/dynamicdatetime/dynamicdatetime.combo.js +++ b/src/widget/dynamicdatetime/dynamicdatetime.combo.js @@ -187,6 +187,11 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, { self.combo.hideView(); self.fireEvent(BI.DynamicDateTimeCombo.EVENT_CONFIRM); } + }, { + eventName: BI.DynamicDateTimePopup.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW, + action: function () { + self.fireEvent(BI.DynamicDateTimeCombo.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); + } }] }, stopPropagation: false @@ -315,6 +320,7 @@ BI.DynamicDateTimeCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.DynamicDateTimeCombo.EVENT_VALID = "EVENT_VALID"; BI.DynamicDateTimeCombo.EVENT_ERROR = "EVENT_ERROR"; BI.DynamicDateTimeCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; +BI.DynamicDateTimeCombo.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW"; BI.shortcut("bi.dynamic_date_time_combo", BI.DynamicDateTimeCombo); diff --git a/src/widget/dynamicdatetime/dynamicdatetime.popup.js b/src/widget/dynamicdatetime/dynamicdatetime.popup.js index f98c579596..0e3c6d79da 100644 --- a/src/widget/dynamicdatetime/dynamicdatetime.popup.js +++ b/src/widget/dynamicdatetime/dynamicdatetime.popup.js @@ -116,7 +116,13 @@ BI.DynamicDateTimePopup = BI.inherit(BI.Widget, { max: self.options.max, ref: function () { self.ymd = this; - } + }, + listeners: [{ + eventName: BI.DateCalendarPopup.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW, + action: function () { + self.fireEvent(BI.DynamicDateTimePopup.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); + } + }], }, { el: { type: "bi.dynamic_date_time_select", @@ -242,4 +248,5 @@ BI.DynamicDateTimePopup.EVENT_CHANGE = "EVENT_CHANGE"; BI.DynamicDateTimePopup.BUTTON_OK_EVENT_CHANGE = "BUTTON_OK_EVENT_CHANGE"; BI.DynamicDateTimePopup.BUTTON_lABEL_EVENT_CHANGE = "BUTTON_lABEL_EVENT_CHANGE"; BI.DynamicDateTimePopup.BUTTON_CLEAR_EVENT_CHANGE = "BUTTON_CLEAR_EVENT_CHANGE"; +BI.DynamicDateTimePopup.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW"; BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup); \ No newline at end of file