From 18b6904c52ecd0e513d55d8879a9b0f3a34b0edb Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 5 Apr 2017 20:59:07 +0800 Subject: [PATCH] add --- bi/base.js | 16 +++++++++------- bi/case.js | 7 +++---- bi/widget.js | 20 ++++++++++++++++++-- dist/base.js | 16 +++++++++------- dist/case.js | 7 +++---- dist/widget.js | 20 ++++++++++++++++++-- src/base/combination/navigation.js | 10 +++------- src/base/table/table.grid.scrollbar.js | 6 ++++++ src/case/pager/pager.all.count.js | 6 ++---- src/case/pager/pager.direction.js | 1 + src/widget/pagetable/pagetable.js | 20 ++++++++++++++++++-- 11 files changed, 90 insertions(+), 39 deletions(-) diff --git a/bi/base.js b/bi/base.js index efae354a2..bd50dc576 100644 --- a/bi/base.js +++ b/bi/base.js @@ -3898,12 +3898,8 @@ BI.Navigation = BI.inherit(BI.Widget, { dynamic: false }, single: false, - defaultShowIndex: 0, - tab: { - type: "bi.button_group", - items: [], - layouts: [] - }, + defaultShowIndex: false, + tab: false, cardCreator: function (v) { return BI.createWidget(); }, @@ -3941,7 +3937,7 @@ BI.Navigation = BI.inherit(BI.Widget, { }, afterCardCreated: BI.bind(this.afterCardCreated, this), afterCardShow: BI.bind(this.afterCardShow, this) - }) + }); }, mounted: function () { @@ -30084,6 +30080,12 @@ BI.GridTableHorizontalScrollbar = BI.inherit(BI.Widget, { populate: function () { this.scrollbar.populate(); + var o = this.options; + if (o.size < 1 || o.contentSize <= o.size) { + this.setVisible(false); + return; + } + this.setVisible(true); } }); BI.GridTableHorizontalScrollbar.EVENT_SCROLL = "EVENT_SCROLL"; diff --git a/bi/case.js b/bi/case.js index 86cab3357..a17d8e33d 100644 --- a/bi/case.js +++ b/bi/case.js @@ -8614,6 +8614,8 @@ BI.AllCountPager = BI.inherit(BI.Widget, { }) }, + alwaysShowPager: true, + setAllPages: function (v) { this.allPages.setText("/" + v); this.allPages.setTitle(v); @@ -8648,10 +8650,6 @@ BI.AllCountPager = BI.inherit(BI.Widget, { this.pager.setVisible(b); }, - getAliasWidth: function () { - return this.options.width - 100; - }, - populate: function () { this.pager.populate(); } @@ -8908,6 +8906,7 @@ BI.DirectionPager = BI.inherit(BI.Widget, { this.setVPagerVisible(true); vShow = true; } + this.setVisible(hShow || vShow); var num = [74, 111, -9, 28]; var items = this.layout.attr("items"); diff --git a/bi/widget.js b/bi/widget.js index f3289fdcd..52b58fb3b 100644 --- a/bi/widget.js +++ b/bi/widget.js @@ -12846,7 +12846,7 @@ BI.PageTable = BI.inherit(BI.Widget, { this.table = BI.createWidget(o.el, { type: "bi.sequence_table", width: o.width, - height: o.height - 30, + height: o.height && o.height - 30, isNeedResize: true, isResizeAdapt: false, @@ -12970,7 +12970,23 @@ BI.PageTable = BI.inherit(BI.Widget, { setHeight: function (height) { BI.PageTable.superclass.setHeight.apply(this, arguments); - this.table.setHeight(height - 30); + var showPager = false; + if (this.pager.alwaysShowPager) { + showPager = true; + } else if (this.pager.hasHNext && this.pager.hasHNext()) { + showPager = true; + } else if (this.pager.hasHPrev && this.pager.hasHPrev()) { + showPager = true; + } else if (this.pager.hasVNext && this.pager.hasVNext()) { + showPager = true; + } else if (this.pager.hasVPrev && this.pager.hasVPrev()) { + showPager = true; + } else if (this.pager.hasNext && this.pager.hasNext()) { + showPager = true; + } else if (this.pager.hasPrev && this.pager.hasPrev()) { + showPager = true; + } + this.table.setHeight(height - (showPager ? 30 : 0)); }, setColumnSize: function (columnSize) { diff --git a/dist/base.js b/dist/base.js index efae354a2..bd50dc576 100644 --- a/dist/base.js +++ b/dist/base.js @@ -3898,12 +3898,8 @@ BI.Navigation = BI.inherit(BI.Widget, { dynamic: false }, single: false, - defaultShowIndex: 0, - tab: { - type: "bi.button_group", - items: [], - layouts: [] - }, + defaultShowIndex: false, + tab: false, cardCreator: function (v) { return BI.createWidget(); }, @@ -3941,7 +3937,7 @@ BI.Navigation = BI.inherit(BI.Widget, { }, afterCardCreated: BI.bind(this.afterCardCreated, this), afterCardShow: BI.bind(this.afterCardShow, this) - }) + }); }, mounted: function () { @@ -30084,6 +30080,12 @@ BI.GridTableHorizontalScrollbar = BI.inherit(BI.Widget, { populate: function () { this.scrollbar.populate(); + var o = this.options; + if (o.size < 1 || o.contentSize <= o.size) { + this.setVisible(false); + return; + } + this.setVisible(true); } }); BI.GridTableHorizontalScrollbar.EVENT_SCROLL = "EVENT_SCROLL"; diff --git a/dist/case.js b/dist/case.js index 86cab3357..a17d8e33d 100644 --- a/dist/case.js +++ b/dist/case.js @@ -8614,6 +8614,8 @@ BI.AllCountPager = BI.inherit(BI.Widget, { }) }, + alwaysShowPager: true, + setAllPages: function (v) { this.allPages.setText("/" + v); this.allPages.setTitle(v); @@ -8648,10 +8650,6 @@ BI.AllCountPager = BI.inherit(BI.Widget, { this.pager.setVisible(b); }, - getAliasWidth: function () { - return this.options.width - 100; - }, - populate: function () { this.pager.populate(); } @@ -8908,6 +8906,7 @@ BI.DirectionPager = BI.inherit(BI.Widget, { this.setVPagerVisible(true); vShow = true; } + this.setVisible(hShow || vShow); var num = [74, 111, -9, 28]; var items = this.layout.attr("items"); diff --git a/dist/widget.js b/dist/widget.js index f3289fdcd..52b58fb3b 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -12846,7 +12846,7 @@ BI.PageTable = BI.inherit(BI.Widget, { this.table = BI.createWidget(o.el, { type: "bi.sequence_table", width: o.width, - height: o.height - 30, + height: o.height && o.height - 30, isNeedResize: true, isResizeAdapt: false, @@ -12970,7 +12970,23 @@ BI.PageTable = BI.inherit(BI.Widget, { setHeight: function (height) { BI.PageTable.superclass.setHeight.apply(this, arguments); - this.table.setHeight(height - 30); + var showPager = false; + if (this.pager.alwaysShowPager) { + showPager = true; + } else if (this.pager.hasHNext && this.pager.hasHNext()) { + showPager = true; + } else if (this.pager.hasHPrev && this.pager.hasHPrev()) { + showPager = true; + } else if (this.pager.hasVNext && this.pager.hasVNext()) { + showPager = true; + } else if (this.pager.hasVPrev && this.pager.hasVPrev()) { + showPager = true; + } else if (this.pager.hasNext && this.pager.hasNext()) { + showPager = true; + } else if (this.pager.hasPrev && this.pager.hasPrev()) { + showPager = true; + } + this.table.setHeight(height - (showPager ? 30 : 0)); }, setColumnSize: function (columnSize) { diff --git a/src/base/combination/navigation.js b/src/base/combination/navigation.js index 7f4cbf3eb..1ce7d4342 100644 --- a/src/base/combination/navigation.js +++ b/src/base/combination/navigation.js @@ -10,12 +10,8 @@ BI.Navigation = BI.inherit(BI.Widget, { dynamic: false }, single: false, - defaultShowIndex: 0, - tab: { - type: "bi.button_group", - items: [], - layouts: [] - }, + defaultShowIndex: false, + tab: false, cardCreator: function (v) { return BI.createWidget(); }, @@ -53,7 +49,7 @@ BI.Navigation = BI.inherit(BI.Widget, { }, afterCardCreated: BI.bind(this.afterCardCreated, this), afterCardShow: BI.bind(this.afterCardShow, this) - }) + }); }, mounted: function () { diff --git a/src/base/table/table.grid.scrollbar.js b/src/base/table/table.grid.scrollbar.js index 32f9e71fe..6faf27cc0 100644 --- a/src/base/table/table.grid.scrollbar.js +++ b/src/base/table/table.grid.scrollbar.js @@ -404,6 +404,12 @@ BI.GridTableHorizontalScrollbar = BI.inherit(BI.Widget, { populate: function () { this.scrollbar.populate(); + var o = this.options; + if (o.size < 1 || o.contentSize <= o.size) { + this.setVisible(false); + return; + } + this.setVisible(true); } }); BI.GridTableHorizontalScrollbar.EVENT_SCROLL = "EVENT_SCROLL"; diff --git a/src/case/pager/pager.all.count.js b/src/case/pager/pager.all.count.js index 432428f32..fee63982f 100644 --- a/src/case/pager/pager.all.count.js +++ b/src/case/pager/pager.all.count.js @@ -119,6 +119,8 @@ BI.AllCountPager = BI.inherit(BI.Widget, { }) }, + alwaysShowPager: true, + setAllPages: function (v) { this.allPages.setText("/" + v); this.allPages.setTitle(v); @@ -153,10 +155,6 @@ BI.AllCountPager = BI.inherit(BI.Widget, { this.pager.setVisible(b); }, - getAliasWidth: function () { - return this.options.width - 100; - }, - populate: function () { this.pager.populate(); } diff --git a/src/case/pager/pager.direction.js b/src/case/pager/pager.direction.js index 3ae115dd4..c946cf7f3 100644 --- a/src/case/pager/pager.direction.js +++ b/src/case/pager/pager.direction.js @@ -249,6 +249,7 @@ BI.DirectionPager = BI.inherit(BI.Widget, { this.setVPagerVisible(true); vShow = true; } + this.setVisible(hShow || vShow); var num = [74, 111, -9, 28]; var items = this.layout.attr("items"); diff --git a/src/widget/pagetable/pagetable.js b/src/widget/pagetable/pagetable.js index 03d884bae..a2f671eaa 100644 --- a/src/widget/pagetable/pagetable.js +++ b/src/widget/pagetable/pagetable.js @@ -78,7 +78,7 @@ BI.PageTable = BI.inherit(BI.Widget, { this.table = BI.createWidget(o.el, { type: "bi.sequence_table", width: o.width, - height: o.height - 30, + height: o.height && o.height - 30, isNeedResize: true, isResizeAdapt: false, @@ -202,7 +202,23 @@ BI.PageTable = BI.inherit(BI.Widget, { setHeight: function (height) { BI.PageTable.superclass.setHeight.apply(this, arguments); - this.table.setHeight(height - 30); + var showPager = false; + if (this.pager.alwaysShowPager) { + showPager = true; + } else if (this.pager.hasHNext && this.pager.hasHNext()) { + showPager = true; + } else if (this.pager.hasHPrev && this.pager.hasHPrev()) { + showPager = true; + } else if (this.pager.hasVNext && this.pager.hasVNext()) { + showPager = true; + } else if (this.pager.hasVPrev && this.pager.hasVPrev()) { + showPager = true; + } else if (this.pager.hasNext && this.pager.hasNext()) { + showPager = true; + } else if (this.pager.hasPrev && this.pager.hasPrev()) { + showPager = true; + } + this.table.setHeight(height - (showPager ? 30 : 0)); }, setColumnSize: function (columnSize) {