From 3c1d3dc5a521a5db8250bdc6f782687e27759d3b Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Wed, 17 Jul 2019 15:27:18 +0800 Subject: [PATCH 1/3] =?UTF-8?q?BI-48176=20refactor:=20widget=E7=9A=84=5Fse?= =?UTF-8?q?tEnable=E5=92=8C=5FsetValid=E7=9A=84=E8=B0=83=E7=94=A8=E6=97=B6?= =?UTF-8?q?=E6=9C=BA=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/case/list/list.select.js | 4 ++-- src/core/widget.js | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/case/list/list.select.js b/src/case/list/list.select.js index 27a0227b0..7b2684f41 100644 --- a/src/case/list/list.select.js +++ b/src/case/list/list.select.js @@ -52,7 +52,7 @@ BI.SelectList = BI.inherit(BI.Widget, { callback.apply(self, arguments); if (op.times === 1) { self.toolbar.setVisible(items && items.length > 0); - self.toolbar.setEnable(items && items.length > 0); + self.toolbar.setEnable(!o.disabled && items && items.length > 0); } self._checkAllSelected(); }); @@ -160,7 +160,7 @@ BI.SelectList = BI.inherit(BI.Widget, { populate: function (items) { this.toolbar.setVisible(!BI.isEmptyArray(items)); - this.toolbar.setEnable(!BI.isEmptyArray(items)); + this.toolbar.setEnable(!this.options.disabled && !BI.isEmptyArray(items)); this.list.populate.apply(this.list, arguments); this._checkAllSelected(); }, diff --git a/src/core/widget.js b/src/core/widget.js index f6add3ff0..24c1e157e 100644 --- a/src/core/widget.js +++ b/src/core/widget.js @@ -185,16 +185,17 @@ * @private */ _mount: function (force, deep, lifeHook, predicate) { - var self = this; if (!force && (this._isMounted || !this.isVisible() || this.__asking === true || !(this._isRoot === true || (this._parent && this._parent._isMounted === true)))) { return false; } lifeHook !== false && this.beforeMount && this.beforeMount(); this._isMounted = true; this._mountChildren && this._mountChildren(); + if(BI.isNotNull(this._parent)) { + !this._parent.isEnabled() && this._setEnable(false); + !this._parent.isValid() && this._setValid(false); + } BI.each(this._children, function (i, widget) { - !self.isEnabled() && widget._setEnable(false); - !self.isValid() && widget._setValid(false); widget._mount && widget._mount(deep ? force : false, deep, lifeHook, predicate); }); lifeHook !== false && this.mounted && this.mounted(); From 444ae13539a50a8f1ec7b948474fc97cac2d9819 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Wed, 17 Jul 2019 15:43:32 +0800 Subject: [PATCH 2/3] update --- src/case/list/list.select.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/case/list/list.select.js b/src/case/list/list.select.js index 7b2684f41..75637edc6 100644 --- a/src/case/list/list.select.js +++ b/src/case/list/list.select.js @@ -52,7 +52,7 @@ BI.SelectList = BI.inherit(BI.Widget, { callback.apply(self, arguments); if (op.times === 1) { self.toolbar.setVisible(items && items.length > 0); - self.toolbar.setEnable(!o.disabled && items && items.length > 0); + self.toolbar.setEnable(self.isEnabled() && items && items.length > 0); } self._checkAllSelected(); }); @@ -160,7 +160,7 @@ BI.SelectList = BI.inherit(BI.Widget, { populate: function (items) { this.toolbar.setVisible(!BI.isEmptyArray(items)); - this.toolbar.setEnable(!this.options.disabled && !BI.isEmptyArray(items)); + this.toolbar.setEnable(this.isEnabled() && !BI.isEmptyArray(items)); this.list.populate.apply(this.list, arguments); this._checkAllSelected(); }, From 7a86ca5eb48e616d20298c31279999cba717908b Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Wed, 17 Jul 2019 15:58:16 +0800 Subject: [PATCH 3/3] update --- dist/base.js | 2 +- src/base/layer/layer.popover.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dist/base.js b/dist/base.js index ce3bcce94..184d15504 100644 --- a/dist/base.js +++ b/dist/base.js @@ -6337,7 +6337,7 @@ BI.shortcut("bi.popover", BI.Popover); BI.BarPopover = BI.inherit(BI.Popover, { _defaultConfig: function () { return BI.extend(BI.BarPopover.superclass._defaultConfig.apply(this, arguments), { - btns: [BI.i18nText(BI.i18nText("BI-Basic_Sure")), BI.i18nText(BI.i18nText("BI-Basic_Cancel"))] + btns: [BI.i18nText("BI-Basic_Sure"), BI.i18nText("BI-Basic_Cancel")] }); }, diff --git a/src/base/layer/layer.popover.js b/src/base/layer/layer.popover.js index a5816414c..35c895ffd 100644 --- a/src/base/layer/layer.popover.js +++ b/src/base/layer/layer.popover.js @@ -209,7 +209,7 @@ BI.shortcut("bi.popover", BI.Popover); BI.BarPopover = BI.inherit(BI.Popover, { _defaultConfig: function () { return BI.extend(BI.BarPopover.superclass._defaultConfig.apply(this, arguments), { - btns: [BI.i18nText(BI.i18nText("BI-Basic_Sure")), BI.i18nText(BI.i18nText("BI-Basic_Cancel"))] + btns: [BI.i18nText("BI-Basic_Sure"), BI.i18nText("BI-Basic_Cancel")] }); },