diff --git a/Gruntfile.js b/Gruntfile.js index bcdd9cec7..5ed7422b3 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -310,7 +310,12 @@ module.exports = function (grunt) { grunt.loadNpmTasks("grunt-contrib-cssmin"); grunt.loadNpmTasks("grunt-contrib-connect"); - grunt.registerTask("default", ["less", "concat", "connect", "watch"]); + var defaultTask = ["less", "concat", "connect", "watch"]; + grunt.registerTask("default", defaultTask); + grunt.registerTask("compile", function () { + grunt.config.set("connect.options.open", false); + grunt.task.run(defaultTask); + }); grunt.registerTask("min", ["less", "concat", "uglify", "cssmin"]); grunt.registerTask("build", ["less", "concat", "uglify", "cssmin", "uglify", "concat"]); -}; \ No newline at end of file +}; diff --git a/dist/base.js b/dist/base.js index 515306702..cfcbb4cf7 100644 --- a/dist/base.js +++ b/dist/base.js @@ -1498,7 +1498,7 @@ BI.ButtonTree = BI.inherit(BI.ButtonGroup, { var v = []; BI.each(this.buttons, function (i, item) { if (item.isEnabled() && !BI.isFunction(item.setSelected)) { - v = BI.concat(v, item.getValue()); + v = BI.union(v, item.getValue()); return; } if (item.isEnabled() && item.isSelected && item.isSelected()) { diff --git a/dist/bundle.js b/dist/bundle.js index c9d652739..0ad30d09a 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -37303,7 +37303,7 @@ BI.ButtonTree = BI.inherit(BI.ButtonGroup, { var v = []; BI.each(this.buttons, function (i, item) { if (item.isEnabled() && !BI.isFunction(item.setSelected)) { - v = BI.concat(v, item.getValue()); + v = BI.union(v, item.getValue()); return; } if (item.isEnabled() && item.isSelected && item.isSelected()) { @@ -111219,35 +111219,11 @@ BI.shortcut("bi.dynamic_year_month_trigger", BI.DynamicYearMonthTrigger);BI.Year }); combo.on(BI.DynamicYearMonthCombo.EVENT_VALID, function () { - BI.Bubbles.hide("error"); - var smallDate = self.left.getKey(), bigDate = self.right.getKey(); - if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) { - self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text")); - self.element.addClass(self.constants.timeErrorCls); - BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, { - offsetStyle: "center" - }); - self.fireEvent(BI.YearMonthInterval.EVENT_ERROR); - } else { - self._clearTitle(); - self.element.removeClass(self.constants.timeErrorCls); - } + self._checkValid(); }); combo.on(BI.DynamicYearMonthCombo.EVENT_FOCUS, function () { - BI.Bubbles.hide("error"); - var smallDate = self.left.getKey(), bigDate = self.right.getKey(); - if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) { - self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text")); - self.element.addClass(self.constants.timeErrorCls); - BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, { - offsetStyle: "center" - }); - self.fireEvent(BI.YearMonthInterval.EVENT_ERROR); - } else { - self._clearTitle(); - self.element.removeClass(self.constants.timeErrorCls); - } + self._checkValid(); }); combo.on(BI.DynamicYearMonthCombo.EVENT_BEFORE_POPUPVIEW, function () { @@ -111285,8 +111261,17 @@ BI.shortcut("bi.dynamic_year_month_trigger", BI.DynamicYearMonthTrigger);BI.Year // 判格式合法 _check: function (smallDate, bigDate) { var smallObj = smallDate.match(/\d+/g), bigObj = bigDate.match(/\d+/g); - var smallDate4Check = (smallObj[0] || "") + "-" + (smallObj[1] || 1); - var bigDate4Check = (bigObj[0] || "") + "-" + (bigObj[1] || 1); + + var smallDate4Check = ""; + if (BI.isNotNull(smallObj)) { + smallDate4Check = (smallObj[0] || "") + "-" + (smallObj[1] || 1); + } + + var bigDate4Check = ""; + if (BI.isNotNull(bigObj)) { + bigDate4Check = (bigObj[0] || "") + "-" + (bigObj[1] || 1); + } + return this._dateCheck(smallDate4Check) && BI.checkDateLegal(smallDate) && this._checkVoid({ year: smallObj[0], month: smallObj[1], @@ -111309,10 +111294,29 @@ BI.shortcut("bi.dynamic_year_month_trigger", BI.DynamicYearMonthTrigger);BI.Year _clearTitle: function () { this.setTitle(""); }, + _checkValid: function () { + var self = this; + + BI.Bubbles.hide("error"); + var smallDate = self.left.getKey(), bigDate = self.right.getKey(); + if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) { + self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text")); + self.element.addClass(self.constants.timeErrorCls); + BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, { + offsetStyle: "center" + }); + self.fireEvent(BI.YearMonthInterval.EVENT_ERROR); + } else { + self._clearTitle(); + self.element.removeClass(self.constants.timeErrorCls); + } + }, setValue: function (date) { date = date || {}; this.left.setValue(date.start); this.right.setValue(date.end); + + this._checkValid(); }, getValue: function () { return {start: this.left.getValue(), end: this.right.getValue()}; diff --git a/dist/fineui.js b/dist/fineui.js index bfce1ccf7..cb9a3182f 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -37552,7 +37552,7 @@ BI.ButtonTree = BI.inherit(BI.ButtonGroup, { var v = []; BI.each(this.buttons, function (i, item) { if (item.isEnabled() && !BI.isFunction(item.setSelected)) { - v = BI.concat(v, item.getValue()); + v = BI.union(v, item.getValue()); return; } if (item.isEnabled() && item.isSelected && item.isSelected()) { @@ -111468,35 +111468,11 @@ BI.shortcut("bi.dynamic_year_month_trigger", BI.DynamicYearMonthTrigger);BI.Year }); combo.on(BI.DynamicYearMonthCombo.EVENT_VALID, function () { - BI.Bubbles.hide("error"); - var smallDate = self.left.getKey(), bigDate = self.right.getKey(); - if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) { - self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text")); - self.element.addClass(self.constants.timeErrorCls); - BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, { - offsetStyle: "center" - }); - self.fireEvent(BI.YearMonthInterval.EVENT_ERROR); - } else { - self._clearTitle(); - self.element.removeClass(self.constants.timeErrorCls); - } + self._checkValid(); }); combo.on(BI.DynamicYearMonthCombo.EVENT_FOCUS, function () { - BI.Bubbles.hide("error"); - var smallDate = self.left.getKey(), bigDate = self.right.getKey(); - if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) { - self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text")); - self.element.addClass(self.constants.timeErrorCls); - BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, { - offsetStyle: "center" - }); - self.fireEvent(BI.YearMonthInterval.EVENT_ERROR); - } else { - self._clearTitle(); - self.element.removeClass(self.constants.timeErrorCls); - } + self._checkValid(); }); combo.on(BI.DynamicYearMonthCombo.EVENT_BEFORE_POPUPVIEW, function () { @@ -111534,8 +111510,17 @@ BI.shortcut("bi.dynamic_year_month_trigger", BI.DynamicYearMonthTrigger);BI.Year // 判格式合法 _check: function (smallDate, bigDate) { var smallObj = smallDate.match(/\d+/g), bigObj = bigDate.match(/\d+/g); - var smallDate4Check = (smallObj[0] || "") + "-" + (smallObj[1] || 1); - var bigDate4Check = (bigObj[0] || "") + "-" + (bigObj[1] || 1); + + var smallDate4Check = ""; + if (BI.isNotNull(smallObj)) { + smallDate4Check = (smallObj[0] || "") + "-" + (smallObj[1] || 1); + } + + var bigDate4Check = ""; + if (BI.isNotNull(bigObj)) { + bigDate4Check = (bigObj[0] || "") + "-" + (bigObj[1] || 1); + } + return this._dateCheck(smallDate4Check) && BI.checkDateLegal(smallDate) && this._checkVoid({ year: smallObj[0], month: smallObj[1], @@ -111558,10 +111543,29 @@ BI.shortcut("bi.dynamic_year_month_trigger", BI.DynamicYearMonthTrigger);BI.Year _clearTitle: function () { this.setTitle(""); }, + _checkValid: function () { + var self = this; + + BI.Bubbles.hide("error"); + var smallDate = self.left.getKey(), bigDate = self.right.getKey(); + if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) { + self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text")); + self.element.addClass(self.constants.timeErrorCls); + BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, { + offsetStyle: "center" + }); + self.fireEvent(BI.YearMonthInterval.EVENT_ERROR); + } else { + self._clearTitle(); + self.element.removeClass(self.constants.timeErrorCls); + } + }, setValue: function (date) { date = date || {}; this.left.setValue(date.start); this.right.setValue(date.end); + + this._checkValid(); }, getValue: function () { return {start: this.left.getValue(), end: this.right.getValue()}; diff --git a/dist/widget.js b/dist/widget.js index cc7afc14a..20035973d 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -23472,35 +23472,11 @@ BI.shortcut("bi.dynamic_year_month_trigger", BI.DynamicYearMonthTrigger);BI.Year }); combo.on(BI.DynamicYearMonthCombo.EVENT_VALID, function () { - BI.Bubbles.hide("error"); - var smallDate = self.left.getKey(), bigDate = self.right.getKey(); - if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) { - self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text")); - self.element.addClass(self.constants.timeErrorCls); - BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, { - offsetStyle: "center" - }); - self.fireEvent(BI.YearMonthInterval.EVENT_ERROR); - } else { - self._clearTitle(); - self.element.removeClass(self.constants.timeErrorCls); - } + self._checkValid(); }); combo.on(BI.DynamicYearMonthCombo.EVENT_FOCUS, function () { - BI.Bubbles.hide("error"); - var smallDate = self.left.getKey(), bigDate = self.right.getKey(); - if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) { - self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text")); - self.element.addClass(self.constants.timeErrorCls); - BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, { - offsetStyle: "center" - }); - self.fireEvent(BI.YearMonthInterval.EVENT_ERROR); - } else { - self._clearTitle(); - self.element.removeClass(self.constants.timeErrorCls); - } + self._checkValid(); }); combo.on(BI.DynamicYearMonthCombo.EVENT_BEFORE_POPUPVIEW, function () { @@ -23538,8 +23514,17 @@ BI.shortcut("bi.dynamic_year_month_trigger", BI.DynamicYearMonthTrigger);BI.Year // 判格式合法 _check: function (smallDate, bigDate) { var smallObj = smallDate.match(/\d+/g), bigObj = bigDate.match(/\d+/g); - var smallDate4Check = (smallObj[0] || "") + "-" + (smallObj[1] || 1); - var bigDate4Check = (bigObj[0] || "") + "-" + (bigObj[1] || 1); + + var smallDate4Check = ""; + if (BI.isNotNull(smallObj)) { + smallDate4Check = (smallObj[0] || "") + "-" + (smallObj[1] || 1); + } + + var bigDate4Check = ""; + if (BI.isNotNull(bigObj)) { + bigDate4Check = (bigObj[0] || "") + "-" + (bigObj[1] || 1); + } + return this._dateCheck(smallDate4Check) && BI.checkDateLegal(smallDate) && this._checkVoid({ year: smallObj[0], month: smallObj[1], @@ -23562,10 +23547,29 @@ BI.shortcut("bi.dynamic_year_month_trigger", BI.DynamicYearMonthTrigger);BI.Year _clearTitle: function () { this.setTitle(""); }, + _checkValid: function () { + var self = this; + + BI.Bubbles.hide("error"); + var smallDate = self.left.getKey(), bigDate = self.right.getKey(); + if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) { + self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text")); + self.element.addClass(self.constants.timeErrorCls); + BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, { + offsetStyle: "center" + }); + self.fireEvent(BI.YearMonthInterval.EVENT_ERROR); + } else { + self._clearTitle(); + self.element.removeClass(self.constants.timeErrorCls); + } + }, setValue: function (date) { date = date || {}; this.left.setValue(date.start); this.right.setValue(date.end); + + this._checkValid(); }, getValue: function () { return {start: this.left.getValue(), end: this.right.getValue()}; diff --git a/package.json b/package.json index cd32dd89a..951dee150 100644 --- a/package.json +++ b/package.json @@ -20,7 +20,8 @@ "grunt": "grunt", "start": "node server.js", "uglify": "grunt min", - "build": "grunt build" + "build": "grunt build", + "compile": "grunt compile" }, "repository": { "type": "git", diff --git a/src/base/combination/tree.button.js b/src/base/combination/tree.button.js index 0235ebf25..6c529e147 100644 --- a/src/base/combination/tree.button.js +++ b/src/base/combination/tree.button.js @@ -78,7 +78,7 @@ BI.ButtonTree = BI.inherit(BI.ButtonGroup, { var v = []; BI.each(this.buttons, function (i, item) { if (item.isEnabled() && !BI.isFunction(item.setSelected)) { - v = BI.concat(v, item.getValue()); + v = BI.union(v, item.getValue()); return; } if (item.isEnabled() && item.isSelected && item.isSelected()) { diff --git a/src/widget/yearmonthinterval/yearmonthinterval.js b/src/widget/yearmonthinterval/yearmonthinterval.js index d7e0e8d59..7b07904a0 100644 --- a/src/widget/yearmonthinterval/yearmonthinterval.js +++ b/src/widget/yearmonthinterval/yearmonthinterval.js @@ -81,35 +81,11 @@ BI.YearMonthInterval = BI.inherit(BI.Single, { }); combo.on(BI.DynamicYearMonthCombo.EVENT_VALID, function () { - BI.Bubbles.hide("error"); - var smallDate = self.left.getKey(), bigDate = self.right.getKey(); - if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) { - self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text")); - self.element.addClass(self.constants.timeErrorCls); - BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, { - offsetStyle: "center" - }); - self.fireEvent(BI.YearMonthInterval.EVENT_ERROR); - } else { - self._clearTitle(); - self.element.removeClass(self.constants.timeErrorCls); - } + self._checkValid(); }); combo.on(BI.DynamicYearMonthCombo.EVENT_FOCUS, function () { - BI.Bubbles.hide("error"); - var smallDate = self.left.getKey(), bigDate = self.right.getKey(); - if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) { - self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text")); - self.element.addClass(self.constants.timeErrorCls); - BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, { - offsetStyle: "center" - }); - self.fireEvent(BI.YearMonthInterval.EVENT_ERROR); - } else { - self._clearTitle(); - self.element.removeClass(self.constants.timeErrorCls); - } + self._checkValid(); }); combo.on(BI.DynamicYearMonthCombo.EVENT_BEFORE_POPUPVIEW, function () { @@ -147,8 +123,17 @@ BI.YearMonthInterval = BI.inherit(BI.Single, { // 判格式合法 _check: function (smallDate, bigDate) { var smallObj = smallDate.match(/\d+/g), bigObj = bigDate.match(/\d+/g); - var smallDate4Check = (smallObj[0] || "") + "-" + (smallObj[1] || 1); - var bigDate4Check = (bigObj[0] || "") + "-" + (bigObj[1] || 1); + + var smallDate4Check = ""; + if (BI.isNotNull(smallObj)) { + smallDate4Check = (smallObj[0] || "") + "-" + (smallObj[1] || 1); + } + + var bigDate4Check = ""; + if (BI.isNotNull(bigObj)) { + bigDate4Check = (bigObj[0] || "") + "-" + (bigObj[1] || 1); + } + return this._dateCheck(smallDate4Check) && BI.checkDateLegal(smallDate) && this._checkVoid({ year: smallObj[0], month: smallObj[1], @@ -171,10 +156,29 @@ BI.YearMonthInterval = BI.inherit(BI.Single, { _clearTitle: function () { this.setTitle(""); }, + _checkValid: function () { + var self = this; + + BI.Bubbles.hide("error"); + var smallDate = self.left.getKey(), bigDate = self.right.getKey(); + if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) { + self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text")); + self.element.addClass(self.constants.timeErrorCls); + BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, { + offsetStyle: "center" + }); + self.fireEvent(BI.YearMonthInterval.EVENT_ERROR); + } else { + self._clearTitle(); + self.element.removeClass(self.constants.timeErrorCls); + } + }, setValue: function (date) { date = date || {}; this.left.setValue(date.start); this.right.setValue(date.end); + + this._checkValid(); }, getValue: function () { return {start: this.left.getValue(), end: this.right.getValue()};