From 857876a42e29330af296638bd84f98b7ea9bd4ca Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 5 Mar 2021 17:05:08 +0800 Subject: [PATCH 1/2] update --- src/base/collection/collection.js | 1 + src/base/combination/navigation.js | 4 ++-- src/base/combination/tab.js | 4 ++-- src/base/grid/grid.js | 1 + src/base/layer/layer.popover.js | 1 + src/base/list/listview.js | 1 + src/base/list/virtuallist.js | 1 + src/case/colorchooser/colorchooser.popup.hex.js | 3 ++- src/case/colorchooser/colorchooser.popup.js | 3 ++- src/case/colorchooser/farbtastic/farbtastic.js | 4 ++-- .../combo/searchtextvaluecombo/combo.searchtextvalue.js | 2 +- .../combo/searchtextvaluecombo/popup.searchtextvalue.js | 3 ++- src/core/widget.js | 8 ++++---- src/widget/datepane/datepane.js | 3 +-- src/widget/datetimepane/datetimepane.js | 2 +- src/widget/dynamicdate/dynamicdate.combo.js | 4 ++-- src/widget/dynamicdatetime/dynamicdatetime.combo.js | 4 ++-- src/widget/yearmonth/card.static.yearmonth.js | 2 +- 18 files changed, 29 insertions(+), 22 deletions(-) diff --git a/src/base/collection/collection.js b/src/base/collection/collection.js index ca4511282..3cb3b6721 100644 --- a/src/base/collection/collection.js +++ b/src/base/collection/collection.js @@ -61,6 +61,7 @@ BI.CollectionView = BI.inherit(BI.Widget, { } }, + // mounted之后绑定事件 mounted: function () { var o = this.options; if (o.scrollLeft !== 0 || o.scrollTop !== 0) { diff --git a/src/base/combination/navigation.js b/src/base/combination/navigation.js index 4419e0f3a..11b2e092d 100644 --- a/src/base/combination/navigation.js +++ b/src/base/combination/navigation.js @@ -52,7 +52,7 @@ BI.Navigation = BI.inherit(BI.Widget, { }); }, - mounted: function () { + created: function () { var o = this.options; if (o.showIndex !== false) { this.setSelect(o.showIndex); @@ -159,4 +159,4 @@ BI.Navigation = BI.inherit(BI.Widget, { }); BI.Navigation.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.navigation", BI.Navigation); \ No newline at end of file +BI.shortcut("bi.navigation", BI.Navigation); diff --git a/src/base/combination/tab.js b/src/base/combination/tab.js index cd8a0b657..637ee95f3 100644 --- a/src/base/combination/tab.js +++ b/src/base/combination/tab.js @@ -76,7 +76,7 @@ BI.Tab = BI.inherit(BI.Widget, { } }, - mounted: function () { + created: function () { var o = this.options; if (o.showIndex !== false) { this.setSelect(o.showIndex); @@ -150,4 +150,4 @@ BI.Tab = BI.inherit(BI.Widget, { }); BI.Tab.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.tab", BI.Tab); \ No newline at end of file +BI.shortcut("bi.tab", BI.Tab); diff --git a/src/base/grid/grid.js b/src/base/grid/grid.js index 4c682ce3b..b0a331a7f 100644 --- a/src/base/grid/grid.js +++ b/src/base/grid/grid.js @@ -63,6 +63,7 @@ BI.GridView = BI.inherit(BI.Widget, { } }, + // mounted之后绑定事件 mounted: function () { var o = this.options; if (o.scrollLeft !== 0 || o.scrollTop !== 0) { diff --git a/src/base/layer/layer.popover.js b/src/base/layer/layer.popover.js index a0cf234dd..28fd6d5be 100644 --- a/src/base/layer/layer.popover.js +++ b/src/base/layer/layer.popover.js @@ -152,6 +152,7 @@ BI.Popover = BI.inherit(BI.Widget, { }); }, + // mounted之后绑定事件 mounted: function () { var self = this; var o = this.options; this.dragger.element.mousedown(function (e) { diff --git a/src/base/list/listview.js b/src/base/list/listview.js index e85bfb885..2708e4823 100644 --- a/src/base/list/listview.js +++ b/src/base/list/listview.js @@ -38,6 +38,7 @@ BI.ListView = BI.inherit(BI.Widget, { }; }, + // mounted之后绑定事件 mounted: function () { var self = this, o = this.options; this._populate(); diff --git a/src/base/list/virtuallist.js b/src/base/list/virtuallist.js index 905c06ca5..28f2d54d3 100644 --- a/src/base/list/virtuallist.js +++ b/src/base/list/virtuallist.js @@ -47,6 +47,7 @@ BI.VirtualList = BI.inherit(BI.Widget, { }; }, + // mounted之后绑定事件 mounted: function () { var self = this, o = this.options; this._populate(); diff --git a/src/case/colorchooser/colorchooser.popup.hex.js b/src/case/colorchooser/colorchooser.popup.hex.js index 91175357b..9ecaba408 100644 --- a/src/case/colorchooser/colorchooser.popup.hex.js +++ b/src/case/colorchooser/colorchooser.popup.hex.js @@ -177,6 +177,7 @@ BI.HexColorChooserPopup = BI.inherit(BI.Widget, { }; }, + // 这里就实现的不好了,setValue里面有个editor,editor的setValue会检测错误然后出bubble提示 mounted: function () { var self = this; var o = this.options; @@ -249,4 +250,4 @@ BI.HexColorChooserPopup = BI.inherit(BI.Widget, { }); BI.HexColorChooserPopup.EVENT_VALUE_CHANGE = "EVENT_VALUE_CHANGE"; BI.HexColorChooserPopup.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.hex_color_chooser_popup", BI.HexColorChooserPopup); \ No newline at end of file +BI.shortcut("bi.hex_color_chooser_popup", BI.HexColorChooserPopup); diff --git a/src/case/colorchooser/colorchooser.popup.js b/src/case/colorchooser/colorchooser.popup.js index 52f0af038..c73fd91fc 100644 --- a/src/case/colorchooser/colorchooser.popup.js +++ b/src/case/colorchooser/colorchooser.popup.js @@ -161,6 +161,7 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, { }; }, + // 这里就实现的不好了,setValue里面有个editor,editor的setValue会检测错误然后出bubble提示 mounted: function () { var self = this; var o = this.options; @@ -233,4 +234,4 @@ BI.ColorChooserPopup = BI.inherit(BI.Widget, { }); BI.ColorChooserPopup.EVENT_VALUE_CHANGE = "EVENT_VALUE_CHANGE"; BI.ColorChooserPopup.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.color_chooser_popup", BI.ColorChooserPopup); \ No newline at end of file +BI.shortcut("bi.color_chooser_popup", BI.ColorChooserPopup); diff --git a/src/case/colorchooser/farbtastic/farbtastic.js b/src/case/colorchooser/farbtastic/farbtastic.js index cba596bc5..f8645d5d5 100644 --- a/src/case/colorchooser/farbtastic/farbtastic.js +++ b/src/case/colorchooser/farbtastic/farbtastic.js @@ -80,7 +80,7 @@ BI.Farbtastic = BI.inherit(BI.BasicButton, { }; }, - mounted: function () { + created: function () { var o = this.options; if (BI.isKey(o.value)) { this.setValue(o.value); @@ -277,4 +277,4 @@ BI.Farbtastic = BI.inherit(BI.BasicButton, { } }); BI.Farbtastic.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.farbtastic", BI.Farbtastic); \ No newline at end of file +BI.shortcut("bi.farbtastic", BI.Farbtastic); diff --git a/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js b/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js index aa4402ff5..b63e607e2 100644 --- a/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js +++ b/src/case/combo/searchtextvaluecombo/combo.searchtextvalue.js @@ -115,7 +115,7 @@ BI.SearchTextValueCombo = BI.inherit(BI.Widget, { }; }, - mounted: function () { + created: function () { var o = this.options; if(BI.isKey(o.value)) { this._checkError(o.value); diff --git a/src/case/combo/searchtextvaluecombo/popup.searchtextvalue.js b/src/case/combo/searchtextvaluecombo/popup.searchtextvalue.js index c1b3d224a..0118cf84f 100644 --- a/src/case/combo/searchtextvaluecombo/popup.searchtextvalue.js +++ b/src/case/combo/searchtextvaluecombo/popup.searchtextvalue.js @@ -45,6 +45,7 @@ BI.SearchTextValueComboPopup = BI.inherit(BI.Pane, { }; }, + // mounted之后做check mounted: function() { this.check(); }, @@ -69,4 +70,4 @@ BI.SearchTextValueComboPopup = BI.inherit(BI.Pane, { }); BI.SearchTextValueComboPopup.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.search_text_value_combo_popup", BI.SearchTextValueComboPopup); \ No newline at end of file +BI.shortcut("bi.search_text_value_combo_popup", BI.SearchTextValueComboPopup); diff --git a/src/core/widget.js b/src/core/widget.js index ad8ac20e2..a7017c403 100644 --- a/src/core/widget.js +++ b/src/core/widget.js @@ -254,10 +254,10 @@ } this._mountChildren && this._mountChildren(); if (layer === 0) { - // mounted放到下一个宏任务里执行 - setTimeout(function () { - self.__afterMount(lifeHook, predicate); - }, 0); + // mounted里面会执行scrollTo之类的方法,如果放宏任务里会闪 + // setTimeout(function () { + self.__afterMount(lifeHook, predicate); + // }, 0); } return true; }, diff --git a/src/widget/datepane/datepane.js b/src/widget/datepane/datepane.js index f470de0d9..d1178e91d 100644 --- a/src/widget/datepane/datepane.js +++ b/src/widget/datepane/datepane.js @@ -109,7 +109,7 @@ BI.DynamicDatePane = BI.inherit(BI.Widget, { }; }, - mounted: function () { + created: function () { this.setValue(this.options.value); }, @@ -141,7 +141,6 @@ BI.DynamicDatePane = BI.inherit(BI.Widget, { } }, - setValue: function (v) { v = v || {}; var type = v.type || BI.DynamicDateCombo.Static; diff --git a/src/widget/datetimepane/datetimepane.js b/src/widget/datetimepane/datetimepane.js index 61f3be8ac..d80617671 100644 --- a/src/widget/datetimepane/datetimepane.js +++ b/src/widget/datetimepane/datetimepane.js @@ -109,7 +109,7 @@ BI.DynamicDateTimePane = BI.inherit(BI.Widget, { }; }, - mounted: function () { + created: function () { this.setValue(this.options.value); }, diff --git a/src/widget/dynamicdate/dynamicdate.combo.js b/src/widget/dynamicdate/dynamicdate.combo.js index 8fedf8272..774e41712 100644 --- a/src/widget/dynamicdate/dynamicdate.combo.js +++ b/src/widget/dynamicdate/dynamicdate.combo.js @@ -238,7 +238,7 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, { }; }, - mounted: function () { + created: function () { this._checkDynamicValue(this.storeValue); }, @@ -321,4 +321,4 @@ BI.shortcut("bi.dynamic_date_combo", BI.DynamicDateCombo); BI.extend(BI.DynamicDateCombo, { Static: 1, Dynamic: 2 -}); \ No newline at end of file +}); diff --git a/src/widget/dynamicdatetime/dynamicdatetime.combo.js b/src/widget/dynamicdatetime/dynamicdatetime.combo.js index 13519a5d3..7764b2b96 100644 --- a/src/widget/dynamicdatetime/dynamicdatetime.combo.js +++ b/src/widget/dynamicdatetime/dynamicdatetime.combo.js @@ -246,7 +246,7 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, { }; }, - mounted: function () { + created: function () { this._checkDynamicValue(this.storeValue); }, @@ -329,4 +329,4 @@ BI.shortcut("bi.dynamic_date_time_combo", BI.DynamicDateTimeCombo); BI.extend(BI.DynamicDateTimeCombo, { Static: 1, Dynamic: 2 -}); \ No newline at end of file +}); diff --git a/src/widget/yearmonth/card.static.yearmonth.js b/src/widget/yearmonth/card.static.yearmonth.js index 26e8c29de..9e905d9ee 100644 --- a/src/widget/yearmonth/card.static.yearmonth.js +++ b/src/widget/yearmonth/card.static.yearmonth.js @@ -98,7 +98,7 @@ BI.StaticYearMonthCard = BI.inherit(BI.Widget, { }; }, - mounted: function() { + created: function() { this._checkMonthStatus(this.selectedYear); }, From e39fcb3bec5e97f205c581e5c0c641208f9280b3 Mon Sep 17 00:00:00 2001 From: guy Date: Fri, 5 Mar 2021 17:16:00 +0800 Subject: [PATCH 2/2] update --- src/case/colorchooser/farbtastic/farbtastic.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/case/colorchooser/farbtastic/farbtastic.js b/src/case/colorchooser/farbtastic/farbtastic.js index f8645d5d5..58eb563ca 100644 --- a/src/case/colorchooser/farbtastic/farbtastic.js +++ b/src/case/colorchooser/farbtastic/farbtastic.js @@ -179,8 +179,6 @@ BI.Farbtastic = BI.inherit(BI.BasicButton, { // Saturation/Luminance gradient this.colorWrapper.element.css("backgroundColor", this._pack(this._HSLToRGB([this.hsl[0], 1, 0.5]))); - - this.fireEvent(BI.Farbtastic.EVENT_CHANGE, this.getValue(), this); }, _absolutePosition: function (el) { @@ -257,6 +255,7 @@ BI.Farbtastic = BI.inherit(BI.BasicButton, { var lum = Math.max(0, Math.min(1, -(pos.y / this.constants.SQUARE) + .5)); this._setHSL([this.hsl[0], sat, lum]); } + this.fireEvent(BI.Farbtastic.EVENT_CHANGE, this.getValue(), this); }, doClick: function (event) {