From 84ce0bce7d76d3416153741ab571c4c17e4d80ac Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Tue, 9 May 2017 09:52:04 +0800 Subject: [PATCH 1/3] =?UTF-8?q?buttongroup=E7=9A=84removeAt=E6=96=B9?= =?UTF-8?q?=E6=B3=95=E5=86=99=E9=94=99=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bi/base.js | 2 +- bi/case.js | 6 ++++++ docs/base.js | 2 +- docs/case.js | 6 ++++++ src/base/combination/group.button.js | 2 +- src/case/layer/pane.list.js | 6 ++++++ 6 files changed, 21 insertions(+), 3 deletions(-) diff --git a/bi/base.js b/bi/base.js index 534178084..c0a8257c4 100644 --- a/bi/base.js +++ b/bi/base.js @@ -1135,7 +1135,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, { }, removeItemAt: function (indexes) { - BI.remove(this.buttons, indexes); + BI.removeAt(this.buttons, indexes); this.layouts.removeItemAt(indexes); }, diff --git a/bi/case.js b/bi/case.js index ecfa47fc6..a6378aabe 100644 --- a/bi/case.js +++ b/bi/case.js @@ -7181,6 +7181,12 @@ BI.ListPane = BI.inherit(BI.Pane, { this.check(); }, + removeItems: function (items) { + BI.remove(this.options.items, items); + this.button_group.removeItems.apply(this.button_group, arguments); + this.check(); + }, + populate: function (items) { var self = this, o = this.options; if (arguments.length === 0 && (BI.isFunction(this.button_group.attr("itemsCreator")))) {//接管loader的populate方法 diff --git a/docs/base.js b/docs/base.js index 534178084..c0a8257c4 100644 --- a/docs/base.js +++ b/docs/base.js @@ -1135,7 +1135,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, { }, removeItemAt: function (indexes) { - BI.remove(this.buttons, indexes); + BI.removeAt(this.buttons, indexes); this.layouts.removeItemAt(indexes); }, diff --git a/docs/case.js b/docs/case.js index ecfa47fc6..a6378aabe 100644 --- a/docs/case.js +++ b/docs/case.js @@ -7181,6 +7181,12 @@ BI.ListPane = BI.inherit(BI.Pane, { this.check(); }, + removeItems: function (items) { + BI.remove(this.options.items, items); + this.button_group.removeItems.apply(this.button_group, arguments); + this.check(); + }, + populate: function (items) { var self = this, o = this.options; if (arguments.length === 0 && (BI.isFunction(this.button_group.attr("itemsCreator")))) {//接管loader的populate方法 diff --git a/src/base/combination/group.button.js b/src/base/combination/group.button.js index d303feeeb..2da4ee7fd 100644 --- a/src/base/combination/group.button.js +++ b/src/base/combination/group.button.js @@ -158,7 +158,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, { }, removeItemAt: function (indexes) { - BI.remove(this.buttons, indexes); + BI.removeAt(this.buttons, indexes); this.layouts.removeItemAt(indexes); }, diff --git a/src/case/layer/pane.list.js b/src/case/layer/pane.list.js index b7faf2758..d225bd87e 100644 --- a/src/case/layer/pane.list.js +++ b/src/case/layer/pane.list.js @@ -101,6 +101,12 @@ BI.ListPane = BI.inherit(BI.Pane, { this.check(); }, + removeItems: function (items) { + BI.remove(this.options.items, items); + this.button_group.removeItems.apply(this.button_group, arguments); + this.check(); + }, + populate: function (items) { var self = this, o = this.options; if (arguments.length === 0 && (BI.isFunction(this.button_group.attr("itemsCreator")))) {//接管loader的populate方法 From 3c0b9fc1bde100f04b11aa7842d9100e04f0784c Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Tue, 9 May 2017 10:07:50 +0800 Subject: [PATCH 2/3] update --- bi/case.js | 7 ++++--- docs/case.js | 7 ++++--- src/case/layer/pane.list.js | 7 ++++--- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/bi/case.js b/bi/case.js index a6378aabe..3c9e1d261 100644 --- a/bi/case.js +++ b/bi/case.js @@ -7181,9 +7181,10 @@ BI.ListPane = BI.inherit(BI.Pane, { this.check(); }, - removeItems: function (items) { - BI.remove(this.options.items, items); - this.button_group.removeItems.apply(this.button_group, arguments); + removeItemAt: function (indexes) { + indexes = indexes || []; + BI.removeAt(this.options.items, indexes); + this.button_group.removeItemAt.apply(this.button_group, arguments); this.check(); }, diff --git a/docs/case.js b/docs/case.js index a6378aabe..3c9e1d261 100644 --- a/docs/case.js +++ b/docs/case.js @@ -7181,9 +7181,10 @@ BI.ListPane = BI.inherit(BI.Pane, { this.check(); }, - removeItems: function (items) { - BI.remove(this.options.items, items); - this.button_group.removeItems.apply(this.button_group, arguments); + removeItemAt: function (indexes) { + indexes = indexes || []; + BI.removeAt(this.options.items, indexes); + this.button_group.removeItemAt.apply(this.button_group, arguments); this.check(); }, diff --git a/src/case/layer/pane.list.js b/src/case/layer/pane.list.js index d225bd87e..fcedfc8b3 100644 --- a/src/case/layer/pane.list.js +++ b/src/case/layer/pane.list.js @@ -101,9 +101,10 @@ BI.ListPane = BI.inherit(BI.Pane, { this.check(); }, - removeItems: function (items) { - BI.remove(this.options.items, items); - this.button_group.removeItems.apply(this.button_group, arguments); + removeItemAt: function (indexes) { + indexes = indexes || []; + BI.removeAt(this.options.items, indexes); + this.button_group.removeItemAt.apply(this.button_group, arguments); this.check(); }, From 7b1679a30d61cefef27dca0f33904fd3b66f9c59 Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Tue, 9 May 2017 11:19:57 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9C=88=E4=BB=BD=E5=81=8F=E7=A7=BB?= =?UTF-8?q?=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bi/core.js | 14 ++++++++++++++ docs/core.js | 14 ++++++++++++++ src/core/proto/date.js | 14 ++++++++++++++ 3 files changed, 42 insertions(+) diff --git a/bi/core.js b/bi/core.js index d9254f202..d36ff77a3 100644 --- a/bi/core.js +++ b/bi/core.js @@ -6354,6 +6354,20 @@ Date.prototype.getQuarterStartMonth = function () { } return quarterStartMonth; }; + +//指定日期n个月之前或之后的日期 +Date.prototype.getOffsetMonth = function (n) { + var dt = new Date(this.getTime()); + var day = dt.getDate(); + var monthDay = new Date(dt.getFullYear(), dt.getMonth() + parseInt(n), 1).getMonthDays(); + if(day > monthDay){ + day = monthDay; + } + dt.setDate(day); + dt.setMonth(dt.getMonth() + parseInt(n)); + return dt; +}; + //获得本季度的起始日期 Date.prototype.getQuarterStartDate = function () { return new Date(this.getFullYear(), this.getQuarterStartMonth(), 1); diff --git a/docs/core.js b/docs/core.js index ca61c1ec3..dcd1f9474 100644 --- a/docs/core.js +++ b/docs/core.js @@ -23834,6 +23834,20 @@ Date.prototype.getQuarterStartMonth = function () { } return quarterStartMonth; }; + +//指定日期n个月之前或之后的日期 +Date.prototype.getOffsetMonth = function (n) { + var dt = new Date(this.getTime()); + var day = dt.getDate(); + var monthDay = new Date(dt.getFullYear(), dt.getMonth() + parseInt(n), 1).getMonthDays(); + if(day > monthDay){ + day = monthDay; + } + dt.setDate(day); + dt.setMonth(dt.getMonth() + parseInt(n)); + return dt; +}; + //获得本季度的起始日期 Date.prototype.getQuarterStartDate = function () { return new Date(this.getFullYear(), this.getQuarterStartMonth(), 1); diff --git a/src/core/proto/date.js b/src/core/proto/date.js index 1ae8b5959..e3146708b 100644 --- a/src/core/proto/date.js +++ b/src/core/proto/date.js @@ -182,6 +182,20 @@ Date.prototype.getQuarterStartMonth = function () { } return quarterStartMonth; }; + +//指定日期n个月之前或之后的日期 +Date.prototype.getOffsetMonth = function (n) { + var dt = new Date(this.getTime()); + var day = dt.getDate(); + var monthDay = new Date(dt.getFullYear(), dt.getMonth() + parseInt(n), 1).getMonthDays(); + if(day > monthDay){ + day = monthDay; + } + dt.setDate(day); + dt.setMonth(dt.getMonth() + parseInt(n)); + return dt; +}; + //获得本季度的起始日期 Date.prototype.getQuarterStartDate = function () { return new Date(this.getFullYear(), this.getQuarterStartMonth(), 1);