From 7e19cd2263f104bda77a1f1b15ce9251b112b1cc Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Mon, 22 Jan 2018 11:36:38 +0800 Subject: [PATCH] =?UTF-8?q?widget=E4=B8=AD=E7=9A=84=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?=E6=94=AF=E6=8C=81value?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/js/widget/date/demo.datepane.js | 2 +- demo/js/widget/date/demo.multidate_combo.js | 7 +- demo/js/widget/downlist/demo.downlist.js | 292 +++++---------- demo/js/widget/month/demo.month.js | 3 +- .../numberinterval/demo.number_interval.js | 7 +- demo/js/widget/quarter/demo.quarter.js | 3 +- .../widget/timeinterval/demo.time_interval.js | 11 + demo/js/widget/year/demo.year.js | 3 +- .../widget/yearmonth/demo.year_month_combo.js | 6 +- .../yearquarter/demo.year_quarter_combo.js | 6 +- dist/bundle.js | 95 +++-- dist/case.js | 15 +- dist/demo.js | 340 +++++++----------- dist/fineui.js | 112 +++--- dist/widget.js | 80 +++-- .../icontextvaluecombo/combo.icontextvalue.js | 5 +- .../combo.textvaluecheck.js | 5 +- .../combo/textvaluecombo/combo.textvalue.js | 5 +- src/widget/date/trigger.date.js | 1 + src/widget/datepane/datepane.js | 1 + src/widget/month/combo.month.js | 6 +- src/widget/month/popup.month.js | 3 +- src/widget/month/trigger.month.js | 1 + src/widget/multidate/multidate.combo.js | 10 +- src/widget/multidate/multidate.popup.js | 1 + src/widget/numberinterval/numberinterval.js | 2 + src/widget/quarter/combo.quarter.js | 6 +- src/widget/quarter/popup.quarter.js | 5 +- src/widget/quarter/trigger.quarter.js | 1 + src/widget/timeinterval/timeinterval.js | 12 +- src/widget/year/combo.year.js | 6 +- src/widget/year/popup.year.js | 6 +- src/widget/year/trigger.year.js | 3 +- src/widget/yearmonth/combo.yearmonth.js | 8 +- src/widget/yearquarter/combo.yearquarter.js | 8 +- 35 files changed, 515 insertions(+), 562 deletions(-) diff --git a/demo/js/widget/date/demo.datepane.js b/demo/js/widget/date/demo.datepane.js index 43ade66b0..6b3bf2f1c 100644 --- a/demo/js/widget/date/demo.datepane.js +++ b/demo/js/widget/date/demo.datepane.js @@ -17,7 +17,7 @@ Demo.DatePane = BI.inherit(BI.Widget, { type: "bi.date_pane", selectedTime: { year: 2017, - month: 12, + month: 11, day: 11 }, ref: function (_ref) { diff --git a/demo/js/widget/date/demo.multidate_combo.js b/demo/js/widget/date/demo.multidate_combo.js index ed4e7f7f7..a8d555b00 100644 --- a/demo/js/widget/date/demo.multidate_combo.js +++ b/demo/js/widget/date/demo.multidate_combo.js @@ -20,7 +20,12 @@ Demo.Date = BI.inherit(BI.Widget, { ref: function () { self.datecombo = this; }, - width: 300 + width: 300, + value: { + year: 2018, + month: 1, + day: 23 + } }, { type: "bi.button", text: "getVlaue", diff --git a/demo/js/widget/downlist/demo.downlist.js b/demo/js/widget/downlist/demo.downlist.js index 6456db463..c1136aa05 100644 --- a/demo/js/widget/downlist/demo.downlist.js +++ b/demo/js/widget/downlist/demo.downlist.js @@ -26,119 +26,6 @@ BICst.CONF.GROUP.NUMBER.WEEKDAY = 21; BICst.CONF.GROUP.NUMBER.RENAME = 22; BICst.CONF.GROUP.NUMBER.DELETE = 23; -// 数值字段汇总设置 -var items = [[{ - text: BI.i18nText("BI-Basic_Qiu_Sum"), - value: BICst.CONF.GROUP.NUMBER.SUM, - cls: "dot-ha-font" -}, { - text: BI.i18nText("BI-Basic_Qiu_Avg"), - value: BICst.CONF.GROUP.NUMBER.AVG, - cls: "dot-ha-font" -}, { - text: BI.i18nText("BI-Basic_Qiu_Median"), - value: BICst.CONF.GROUP.NUMBER.MEDIAN, - cls: "dot-ha-font" -}, { - text: BI.i18nText("BI-Basic_Qiu_Max"), - value: BICst.CONF.GROUP.NUMBER.MAX, - cls: "dot-ha-font" -}, { - text: BI.i18nText("BI-Basic_Qiu_Min"), - value: BICst.CONF.GROUP.NUMBER.MIN, - cls: "dot-ha-font" -}, { - text: BI.i18nText("BI-Basic_Qiu_Standard_Deviation"), - value: BICst.CONF.GROUP.NUMBER.STANDARD_DEVIATION, - cls: "dot-ha-font" -}, { - text: BI.i18nText("BI-Basic_Qiu_Variance"), - value: BICst.CONF.GROUP.NUMBER.VARIANCE, - cls: "dot-ha-font" -}, { - text: BI.i18nText("BI-Basic_No_Repeat_Count"), - value: BICst.CONF.GROUP.NUMBER.COUNT, - cls: "dot-ha-font" -}, { - text: BI.i18nText("BI-Basic_Record_Count"), - value: BICst.CONF.GROUP.NUMBER.RECORD_COUNT, - cls: "dot-ha-font" -}], [{ - text: BI.i18nText("BI-Basic_None"), - value: BICst.CONF.GROUP.NUMBER.NONE, - cls: "dot-ha-font" -}, { - el: { - text: BI.i18nText("BI-Basic_Qiu_Same_Period"), - value: BICst.CONF.GROUP.NUMBER.PERIOD, - cls: "dot-ha-font" - }, - children: [{ - text: BI.i18nText("BI-Basic_Multi_Date_Year"), - value: BICst.CONF.GROUP.NUMBER.YEAR, - cls: "dot-ha-font" - }, { - text: BI.i18nText("BI-Basic_Quarter"), - value: BICst.CONF.GROUP.NUMBER.QUARTER, - cls: "dot-ha-font" - }, { - text: BI.i18nText("BI-Basic_Multi_Date_Month"), - value: BICst.CONF.GROUP.NUMBER.MONTH, - cls: "dot-ha-font" - }, { - text: BI.i18nText("BI-Basic_Multi_Date_Week"), - value: BICst.CONF.GROUP.NUMBER.WEEK, - cls: "dot-ha-font" - }, { - text: BI.i18nText("BI-Basic_Week_XingQi"), - value: BICst.CONF.GROUP.NUMBER.WEEKDAY, - cls: "dot-ha-font" - }] -}, { - text: BI.i18nText("BI-Basic_Qiu_Same_Ring"), - value: BICst.CONF.GROUP.NUMBER.RING, - cls: "dot-ha-font" -}, { - el: { - text: BI.i18nText("BI-Basic_Qiu_Same_Period_Rate"), - value: BICst.CONF.GROUP.NUMBER.PERIOD_RATE, - cls: "dot-ha-font" - }, - children: [{ - text: BI.i18nText("BI-Basic_Multi_Date_Year"), - value: BICst.CONF.GROUP.NUMBER.YEAR, - cls: "dot-ha-font" - }, { - text: BI.i18nText("BI-Basic_Quarter"), - value: BICst.CONF.GROUP.NUMBER.QUARTER, - cls: "dot-ha-font" - }, { - text: BI.i18nText("BI-Basic_Multi_Date_Month"), - value: BICst.CONF.GROUP.NUMBER.MONTH, - cls: "dot-ha-font" - }, { - text: BI.i18nText("BI-Basic_Multi_Date_Week"), - value: BICst.CONF.GROUP.NUMBER.WEEK, - cls: "dot-ha-font" - }, { - text: BI.i18nText("BI-Basic_Week_XingQi"), - value: BICst.CONF.GROUP.NUMBER.WEEKDAY, - cls: "dot-ha-font" - }] -}, { - text: BI.i18nText("BI-Basic_Qiu_Same_Ring_Rate"), - value: BICst.CONF.GROUP.NUMBER.RING_RATE, - cls: "dot-ha-font" -}], [{ - text: BI.i18nText("BI-Basic_Rename"), - value: BICst.CONF.GROUP.NUMBER.RENAME, - cls: "widget-combo-rename-edit-font" -}], [{ - text: BI.i18nText("BI-Basic_Remove"), - value: BICst.CONF.GROUP.NUMBER.DELETE, - cls: "delete-h-font" -}]]; - Demo.Downlist = BI.inherit(BI.Widget, { props: { baseCls: "demo-downlist" @@ -167,98 +54,97 @@ Demo.Downlist = BI.inherit(BI.Widget, { self.downlist = _ref; }, cls: "layout-bg3", - //value: [{"childValue":22,"value":11},{"value":18},{"value":20}], + value: [{"childValue":22,"value":11},{"value":18},{"value":20}], height: 30, width: 100, - items: items - // items: [ - // [{ - // el: { - // text: "column 1111", - // iconCls1: "check-mark-e-font", - // value: 11 - // }, - // children: [{ - // text: "column 1.1", - // value: 21, - // cls: "dot-e-font" - // }, { - // text: "column 1.222222222222222222222222222222222222", - // cls: "dot-e-font", - // value: 22 - // }] - // }], - // [{ - // el: { - // type: "bi.icon_text_icon_item", - // text: "column 2", - // iconCls1: "chart-type-e-font", - // cls: "dot-e-font", - // value: 12 - // }, - // disabled: true, - // children: [{ - // type: "bi.icon_text_item", - // cls: "dot-e-font", - // height: 25, - // text: "column 2.1", - // value: 11 - // }, { - // text: "column 2.2", - // value: 12, - // cls: "dot-e-font" - // }] - // }], - // [{ - // text: "column 8", - // value: 18, - // cls: "dot-e-font" - // }, - // { - // - // text: "column 9", - // cls: "dot-e-font", - // value: 19 - // } - // ], - // [{ - // text: "column 10", - // value: 20, - // cls: "dot-e-font" - // }, - // { - // - // text: "column 11", - // cls: "dot-e-font", - // value: 21 - // }, - // { - // - // text: "column 12", - // cls: "dot-e-font", - // value: 22 - // }, - // { - // - // text: "column 13", - // cls: "dot-e-font", - // value: 23 - // }, - // { - // - // text: "column 14", - // cls: "dot-e-font", - // value: 24 - // }, - // { - // - // text: "column 15", - // cls: "dot-e-font", - // value: 23 - // } - // ] - // - // ] + items: [ + [{ + el: { + text: "column 1111", + iconCls1: "check-mark-e-font", + value: 11 + }, + children: [{ + text: "column 1.1", + value: 21, + cls: "dot-e-font" + }, { + text: "column 1.222222222222222222222222222222222222", + cls: "dot-e-font", + value: 22 + }] + }], + [{ + el: { + type: "bi.icon_text_icon_item", + text: "column 2", + iconCls1: "chart-type-e-font", + cls: "dot-e-font", + value: 12 + }, + disabled: true, + children: [{ + type: "bi.icon_text_item", + cls: "dot-e-font", + height: 25, + text: "column 2.1", + value: 11 + }, { + text: "column 2.2", + value: 12, + cls: "dot-e-font" + }] + }], + [{ + text: "column 8", + value: 18, + cls: "dot-e-font" + }, + { + + text: "column 9", + cls: "dot-e-font", + value: 19 + } + ], + [{ + text: "column 10", + value: 20, + cls: "dot-e-font" + }, + { + + text: "column 11", + cls: "dot-e-font", + value: 21 + }, + { + + text: "column 12", + cls: "dot-e-font", + value: 22 + }, + { + + text: "column 13", + cls: "dot-e-font", + value: 23 + }, + { + + text: "column 14", + cls: "dot-e-font", + value: 24 + }, + { + + text: "column 15", + cls: "dot-e-font", + value: 23 + } + ] + + ] }, { type: "bi.label", text: "显示选择值", diff --git a/demo/js/widget/month/demo.month.js b/demo/js/widget/month/demo.month.js index aef277be5..0ab9551a0 100644 --- a/demo/js/widget/month/demo.month.js +++ b/demo/js/widget/month/demo.month.js @@ -14,7 +14,8 @@ Demo.Month = BI.inherit(BI.Widget, { width: 300, ref: function () { self.monthcombo = this; - } + }, + value: 11 }, { type: "bi.button", text: "getValue", diff --git a/demo/js/widget/numberinterval/demo.number_interval.js b/demo/js/widget/numberinterval/demo.number_interval.js index 23fd6fc39..379092d68 100644 --- a/demo/js/widget/numberinterval/demo.number_interval.js +++ b/demo/js/widget/numberinterval/demo.number_interval.js @@ -26,7 +26,12 @@ Demo.NumericalInterval = BI.inherit(BI.Widget, { ref: function (_ref) { self.numerical = _ref; }, - width: 500 + width: 500, + value: { + max: 300, + closeMax: true, + closeMin: false + } }, { type: "bi.label", ref: function (_ref) { diff --git a/demo/js/widget/quarter/demo.quarter.js b/demo/js/widget/quarter/demo.quarter.js index d4cc05ff4..49d02fe63 100644 --- a/demo/js/widget/quarter/demo.quarter.js +++ b/demo/js/widget/quarter/demo.quarter.js @@ -14,7 +14,8 @@ Demo.Quarter = BI.inherit(BI.Widget, { width: 300, ref: function () { self.quartercombo = this; - } + }, + value: 3 }, { type: "bi.button", text: "getValue", diff --git a/demo/js/widget/timeinterval/demo.time_interval.js b/demo/js/widget/timeinterval/demo.time_interval.js index 901843bcc..0d8b6927b 100644 --- a/demo/js/widget/timeinterval/demo.time_interval.js +++ b/demo/js/widget/timeinterval/demo.time_interval.js @@ -16,6 +16,17 @@ Demo.TimeInterval = BI.inherit(BI.Widget, { ref: function (_ref) { self.interval = _ref; }, + value: { + start: { + type: 1, + value: 2 + }, + end: { + year: 2018, + month: 0, + day: 12 + } + }, width: 300 }, { type: "bi.button", diff --git a/demo/js/widget/year/demo.year.js b/demo/js/widget/year/demo.year.js index f83d5611b..bdc2366da 100644 --- a/demo/js/widget/year/demo.year.js +++ b/demo/js/widget/year/demo.year.js @@ -14,7 +14,8 @@ Demo.Year = BI.inherit(BI.Widget, { width: 300, ref: function () { self.yearcombo = this; - } + }, + value: 2017 }, { type: "bi.button", text: "getValue", diff --git a/demo/js/widget/yearmonth/demo.year_month_combo.js b/demo/js/widget/yearmonth/demo.year_month_combo.js index 37c856f3c..f7b84e237 100644 --- a/demo/js/widget/yearmonth/demo.year_month_combo.js +++ b/demo/js/widget/yearmonth/demo.year_month_combo.js @@ -15,7 +15,11 @@ Demo.YearMonthCombo = BI.inherit(BI.Widget, { ref: function (_ref) { self.widget = _ref; }, - width: 300 + width: 300, + value:{ + year: 2018, + month: 0 + } }, { type: "bi.button", text: "getValue", diff --git a/demo/js/widget/yearquarter/demo.year_quarter_combo.js b/demo/js/widget/yearquarter/demo.year_quarter_combo.js index dcf1d6cd1..e03ec3c10 100644 --- a/demo/js/widget/yearquarter/demo.year_quarter_combo.js +++ b/demo/js/widget/yearquarter/demo.year_quarter_combo.js @@ -16,7 +16,11 @@ Demo.YearQuarterCombo = BI.inherit(BI.Widget, { self.widget = _ref; }, yearBehaviors: {}, - quarterBehaviors: {} + quarterBehaviors: {}, + value: { + year: 2018, + quarter: 1 + } }, { type: "bi.button", text: "getValue", diff --git a/dist/bundle.js b/dist/bundle.js index 1a46a97dc..b5e65039c 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -67811,15 +67811,14 @@ BI.IconTextValueCombo = BI.inherit(BI.Widget, { return BI.extend(BI.IconTextValueCombo.superclass._defaultConfig.apply(this, arguments), { baseClass: "bi-icon-text-value-combo", height: 30, - value: "", - el: {} + value: "" }); }, _init: function () { BI.IconTextValueCombo.superclass._init.apply(this, arguments); var self = this, o = this.options; - this.trigger = BI.createWidget(o.el, { + this.trigger = BI.createWidget({ type: "bi.select_icon_text_trigger", items: o.items, height: o.height, @@ -68009,15 +68008,14 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, { width: 100, height: 24, chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, - value: "", - el: {} + value: "" }); }, _init: function () { BI.TextValueCheckCombo.superclass._init.apply(this, arguments); var self = this, o = this.options; - this.trigger = BI.createWidget(o.el, { + this.trigger = BI.createWidget({ type: "bi.select_text_trigger", items: o.items, height: o.height, @@ -68215,15 +68213,14 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { height: 30, chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, text: "", - value: "", - el: {} + value: "" }); }, _init: function () { BI.TextValueCombo.superclass._init.apply(this, arguments); var self = this, o = this.options; - this.trigger = BI.createWidget(o.el, { + this.trigger = BI.createWidget({ type: "bi.select_text_trigger", items: o.items, height: o.height, @@ -78837,6 +78834,7 @@ BI.shortcut("bi.date_combo", BI.DateCombo);BI.DateTrigger = BI.inherit(BI.Trigge el: this.editor }] }); + this.setValue(o.value); }, _dateCheck: function (date) { return Date.parseDateTime(date, "%Y-%x-%d").print("%Y-%x-%d") == date || Date.parseDateTime(date, "%Y-%X-%d").print("%Y-%X-%d") == date || Date.parseDateTime(date, "%Y-%x-%e").print("%Y-%x-%e") == date || Date.parseDateTime(date, "%Y-%X-%e").print("%Y-%X-%e") == date; @@ -79113,6 +79111,7 @@ BI.DatePaneWidget = BI.inherit(BI.Widget, { self.setValue(self.selectedTime); self.fireEvent(BI.DateCalendarPopup.EVENT_CHANGE); }); + this.setValue(o.selectedTime); }, @@ -82850,7 +82849,8 @@ BI.MonthCombo = BI.inherit(BI.Widget, { var self = this, o = this.options; this.trigger = BI.createWidget({ - type: "bi.month_trigger" + type: "bi.month_trigger", + value: o.value }); this.trigger.on(BI.MonthTrigger.EVENT_CONFIRM, function (v) { @@ -82878,7 +82878,8 @@ BI.MonthCombo = BI.inherit(BI.Widget, { this.popup = BI.createWidget({ type: "bi.month_popup", - behaviors: o.behaviors + behaviors: o.behaviors, + value: o.value }); this.popup.on(BI.MonthPopup.EVENT_CHANGE, function () { self.setValue(self.popup.getValue()); @@ -82976,7 +82977,8 @@ BI.MonthPopup = BI.inherit(BI.Widget, { type: "bi.center_adapt", vgap: 1, hgap: 2 - }] + }], + value: o.value }); this.month.on(BI.Controller.EVENT_CHANGE, function (type) { @@ -83081,6 +83083,7 @@ BI.MonthTrigger = BI.inherit(BI.Trigger, { } ] }); + this.setValue(o.value); }, setValue: function (v) { if(BI.isNotNull(v)) { @@ -83281,11 +83284,12 @@ BI.MultiDateCombo = BI.inherit(BI.Single, { var self = this, opts = this.options; this.storeTriggerValue = ""; var date = Date.getDate(); - this.storeValue = null; + this.storeValue = opts.value; this.trigger = BI.createWidget({ type: "bi.date_trigger", min: this.constants.DATE_MIN_VALUE, - max: this.constants.DATE_MAX_VALUE + max: this.constants.DATE_MAX_VALUE, + value: opts.value }); this.trigger.on(BI.DateTrigger.EVENT_KEY_DOWN, function () { if (self.combo.isViewVisible()) { @@ -83339,7 +83343,8 @@ BI.MultiDateCombo = BI.inherit(BI.Single, { this.popup = BI.createWidget({ type: "bi.multidate_popup", min: this.constants.DATE_MIN_VALUE, - max: this.constants.DATE_MAX_VALUE + max: this.constants.DATE_MAX_VALUE, + value: opts.value }); this.popup.on(BI.MultiDatePopup.BUTTON_CLEAR_EVENT_CHANGE, function () { self.setValue(); @@ -83433,6 +83438,8 @@ BI.MultiDateCombo = BI.inherit(BI.Single, { self.comboWrapper = _ref; } }); + + this._checkDynamicValue(opts.value); }, _checkDynamicValue: function (v) { @@ -83830,6 +83837,7 @@ BI.MultiDatePopup = BI.inherit(BI.Widget, { height: 30 }] }); + this.setValue(opts.value); }, _setInnerValue: function (obj) { if (this.dateTab.getSelect() === BI.MultiDateCombo.MULTI_DATE_YMD_CARD) { @@ -89602,6 +89610,8 @@ BI.NumberInterval = BI.inherit(BI.Single, { self._setComboValueChangedEvent(self.smallCombo); self._setEditorValueChangedEvent(self.bigEditor); self._setEditorValueChangedEvent(self.smallEditor); + + this.setValue(o.value); }, _checkValidation: function () { @@ -91094,7 +91104,8 @@ BI.QuarterCombo = BI.inherit(BI.Widget, { var self = this, o = this.options; this.storeValue = ""; this.trigger = BI.createWidget({ - type: "bi.quarter_trigger" + type: "bi.quarter_trigger", + value: o.value }); this.trigger.on(BI.QuarterTrigger.EVENT_FOCUS, function () { @@ -91121,7 +91132,8 @@ BI.QuarterCombo = BI.inherit(BI.Widget, { }); this.popup = BI.createWidget({ type: "bi.quarter_popup", - behaviors: o.behaviors + behaviors: o.behaviors, + value: o.value }); this.popup.on(BI.QuarterPopup.EVENT_CHANGE, function () { @@ -91179,7 +91191,7 @@ BI.QuarterPopup = BI.inherit(BI.Widget, { var self = this, o = this.options; var items = [{ - text: Date._QN[01], + text: Date._QN[1], value: 1 }, { text: Date._QN[2], @@ -91210,7 +91222,8 @@ BI.QuarterPopup = BI.inherit(BI.Widget, { items: BI.createItems(items, {}), layouts: [{ type: "bi.vertical" - }] + }], + value: o.value }); this.quarter.on(BI.Controller.EVENT_CHANGE, function (type) { @@ -91317,6 +91330,7 @@ BI.QuarterTrigger = BI.inherit(BI.Trigger, { } ] }); + this.setValue(o.value); }, setValue: function (v) { @@ -97048,11 +97062,12 @@ BI.TimeInterval = BI.inherit(BI.Single, { }); }, _init: function () { - var self = this; + var self = this, o = this.options; BI.TimeInterval.superclass._init.apply(this, arguments); - this.left = this._createCombo(); - this.right = this._createCombo(); + o.value = o.value || {}; + this.left = this._createCombo(o.value.start); + this.right = this._createCombo(o.value.end); this.label = BI.createWidget({ type: "bi.label", height: this.constants.height, @@ -97093,10 +97108,11 @@ BI.TimeInterval = BI.inherit(BI.Single, { }); }, - _createCombo: function () { + _createCombo: function (v) { var self = this; var combo = BI.createWidget({ - type: "bi.multidate_combo" + type: "bi.multidate_combo", + value: v }); combo.on(BI.MultiDateCombo.EVENT_ERROR, function () { self._clearTitle(); @@ -97240,7 +97256,8 @@ BI.YearCombo = BI.inherit(BI.Widget, { this.trigger = BI.createWidget({ type: "bi.year_trigger", min: o.min, - max: o.max + max: o.max, + value: o.value || "" }); this.trigger.on(BI.YearTrigger.EVENT_FOCUS, function () { self.storeValue = this.getKey(); @@ -97292,7 +97309,8 @@ BI.YearCombo = BI.inherit(BI.Widget, { behaviors: o.behaviors, min: o.min, max: o.max - } + }, + value: o.value || "" } }); this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { @@ -97355,7 +97373,7 @@ BI.YearPopup = BI.inherit(BI.Widget, { _init: function () { BI.YearPopup.superclass._init.apply(this, arguments); - var self = this; + var self = this, o = this.options; this.selectedYear = this._year = Date.getDate().getFullYear(); @@ -97402,6 +97420,10 @@ BI.YearPopup = BI.inherit(BI.Widget, { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.YearPopup.EVENT_CHANGE, self.selectedYear); }); + + if(BI.isKey(o.value)){ + this.setValue(o.value); + } }, getValue: function () { @@ -97462,7 +97484,8 @@ BI.YearTrigger = BI.inherit(BI.Trigger, { hgap: c.hgap, vgap: c.vgap, allowBlank: true, - errorText: c.errorText + errorText: c.errorText, + value: o.value }); this.editor.on(BI.SignEditor.EVENT_FOCUS, function () { self.fireEvent(BI.YearTrigger.EVENT_FOCUS); @@ -97546,14 +97569,18 @@ BI.YearMonthCombo = BI.inherit(BI.Widget, { BI.YearMonthCombo.superclass._init.apply(this, arguments); var self = this, o = this.options; + o.value = o.value || {}; + this.year = BI.createWidget({ type: "bi.year_combo", - behaviors: o.yearBehaviors + behaviors: o.yearBehaviors, + value: o.value.year }); this.month = BI.createWidget({ type: "bi.month_combo", - behaviors: o.monthBehaviors + behaviors: o.monthBehaviors, + value: o.value.month }); this.year.on(BI.YearCombo.EVENT_CONFIRM, function () { @@ -97613,14 +97640,18 @@ BI.YearQuarterCombo = BI.inherit(BI.Widget, { BI.YearQuarterCombo.superclass._init.apply(this, arguments); var self = this, o = this.options; + o.value = o.value || {}; + this.year = BI.createWidget({ type: "bi.year_combo", - behaviors: o.yearBehaviors + behaviors: o.yearBehaviors, + value: o.value.year }); this.quarter = BI.createWidget({ type: "bi.quarter_combo", - behaviors: o.quarterBehaviors + behaviors: o.quarterBehaviors, + value: o.value.quarter }); this.year.on(BI.YearCombo.EVENT_CONFIRM, function () { diff --git a/dist/case.js b/dist/case.js index bb963ea92..24619c83c 100644 --- a/dist/case.js +++ b/dist/case.js @@ -5474,15 +5474,14 @@ BI.IconTextValueCombo = BI.inherit(BI.Widget, { return BI.extend(BI.IconTextValueCombo.superclass._defaultConfig.apply(this, arguments), { baseClass: "bi-icon-text-value-combo", height: 30, - value: "", - el: {} + value: "" }); }, _init: function () { BI.IconTextValueCombo.superclass._init.apply(this, arguments); var self = this, o = this.options; - this.trigger = BI.createWidget(o.el, { + this.trigger = BI.createWidget({ type: "bi.select_icon_text_trigger", items: o.items, height: o.height, @@ -5672,15 +5671,14 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, { width: 100, height: 24, chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, - value: "", - el: {} + value: "" }); }, _init: function () { BI.TextValueCheckCombo.superclass._init.apply(this, arguments); var self = this, o = this.options; - this.trigger = BI.createWidget(o.el, { + this.trigger = BI.createWidget({ type: "bi.select_text_trigger", items: o.items, height: o.height, @@ -5878,15 +5876,14 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { height: 30, chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, text: "", - value: "", - el: {} + value: "" }); }, _init: function () { BI.TextValueCombo.superclass._init.apply(this, arguments); var self = this, o = this.options; - this.trigger = BI.createWidget(o.el, { + this.trigger = BI.createWidget({ type: "bi.select_text_trigger", items: o.items, height: o.height, diff --git a/dist/demo.js b/dist/demo.js index 90aa9fe4c..048b8d012 100644 --- a/dist/demo.js +++ b/dist/demo.js @@ -12232,7 +12232,7 @@ BI.shortcut("demo.tips", Demo.Tips);Demo.DatePane = BI.inherit(BI.Widget, { type: "bi.date_pane", selectedTime: { year: 2017, - month: 12, + month: 11, day: 11 }, ref: function (_ref) { @@ -12289,7 +12289,12 @@ Demo.Date = BI.inherit(BI.Widget, { ref: function () { self.datecombo = this; }, - width: 300 + width: 300, + value: { + year: 2018, + month: 1, + day: 23 + } }, { type: "bi.button", text: "getVlaue", @@ -12381,119 +12386,6 @@ BICst.CONF.GROUP.NUMBER.WEEKDAY = 21; BICst.CONF.GROUP.NUMBER.RENAME = 22; BICst.CONF.GROUP.NUMBER.DELETE = 23; -// 数值字段汇总设置 -var items = [[{ - text: BI.i18nText("BI-Basic_Qiu_Sum"), - value: BICst.CONF.GROUP.NUMBER.SUM, - cls: "dot-ha-font" -}, { - text: BI.i18nText("BI-Basic_Qiu_Avg"), - value: BICst.CONF.GROUP.NUMBER.AVG, - cls: "dot-ha-font" -}, { - text: BI.i18nText("BI-Basic_Qiu_Median"), - value: BICst.CONF.GROUP.NUMBER.MEDIAN, - cls: "dot-ha-font" -}, { - text: BI.i18nText("BI-Basic_Qiu_Max"), - value: BICst.CONF.GROUP.NUMBER.MAX, - cls: "dot-ha-font" -}, { - text: BI.i18nText("BI-Basic_Qiu_Min"), - value: BICst.CONF.GROUP.NUMBER.MIN, - cls: "dot-ha-font" -}, { - text: BI.i18nText("BI-Basic_Qiu_Standard_Deviation"), - value: BICst.CONF.GROUP.NUMBER.STANDARD_DEVIATION, - cls: "dot-ha-font" -}, { - text: BI.i18nText("BI-Basic_Qiu_Variance"), - value: BICst.CONF.GROUP.NUMBER.VARIANCE, - cls: "dot-ha-font" -}, { - text: BI.i18nText("BI-Basic_No_Repeat_Count"), - value: BICst.CONF.GROUP.NUMBER.COUNT, - cls: "dot-ha-font" -}, { - text: BI.i18nText("BI-Basic_Record_Count"), - value: BICst.CONF.GROUP.NUMBER.RECORD_COUNT, - cls: "dot-ha-font" -}], [{ - text: BI.i18nText("BI-Basic_None"), - value: BICst.CONF.GROUP.NUMBER.NONE, - cls: "dot-ha-font" -}, { - el: { - text: BI.i18nText("BI-Basic_Qiu_Same_Period"), - value: BICst.CONF.GROUP.NUMBER.PERIOD, - cls: "dot-ha-font" - }, - children: [{ - text: BI.i18nText("BI-Basic_Multi_Date_Year"), - value: BICst.CONF.GROUP.NUMBER.YEAR, - cls: "dot-ha-font" - }, { - text: BI.i18nText("BI-Basic_Quarter"), - value: BICst.CONF.GROUP.NUMBER.QUARTER, - cls: "dot-ha-font" - }, { - text: BI.i18nText("BI-Basic_Multi_Date_Month"), - value: BICst.CONF.GROUP.NUMBER.MONTH, - cls: "dot-ha-font" - }, { - text: BI.i18nText("BI-Basic_Multi_Date_Week"), - value: BICst.CONF.GROUP.NUMBER.WEEK, - cls: "dot-ha-font" - }, { - text: BI.i18nText("BI-Basic_Week_XingQi"), - value: BICst.CONF.GROUP.NUMBER.WEEKDAY, - cls: "dot-ha-font" - }] -}, { - text: BI.i18nText("BI-Basic_Qiu_Same_Ring"), - value: BICst.CONF.GROUP.NUMBER.RING, - cls: "dot-ha-font" -}, { - el: { - text: BI.i18nText("BI-Basic_Qiu_Same_Period_Rate"), - value: BICst.CONF.GROUP.NUMBER.PERIOD_RATE, - cls: "dot-ha-font" - }, - children: [{ - text: BI.i18nText("BI-Basic_Multi_Date_Year"), - value: BICst.CONF.GROUP.NUMBER.YEAR, - cls: "dot-ha-font" - }, { - text: BI.i18nText("BI-Basic_Quarter"), - value: BICst.CONF.GROUP.NUMBER.QUARTER, - cls: "dot-ha-font" - }, { - text: BI.i18nText("BI-Basic_Multi_Date_Month"), - value: BICst.CONF.GROUP.NUMBER.MONTH, - cls: "dot-ha-font" - }, { - text: BI.i18nText("BI-Basic_Multi_Date_Week"), - value: BICst.CONF.GROUP.NUMBER.WEEK, - cls: "dot-ha-font" - }, { - text: BI.i18nText("BI-Basic_Week_XingQi"), - value: BICst.CONF.GROUP.NUMBER.WEEKDAY, - cls: "dot-ha-font" - }] -}, { - text: BI.i18nText("BI-Basic_Qiu_Same_Ring_Rate"), - value: BICst.CONF.GROUP.NUMBER.RING_RATE, - cls: "dot-ha-font" -}], [{ - text: BI.i18nText("BI-Basic_Rename"), - value: BICst.CONF.GROUP.NUMBER.RENAME, - cls: "widget-combo-rename-edit-font" -}], [{ - text: BI.i18nText("BI-Basic_Remove"), - value: BICst.CONF.GROUP.NUMBER.DELETE, - cls: "delete-h-font" -}]]; - Demo.Downlist = BI.inherit(BI.Widget, { props: { baseCls: "demo-downlist" @@ -12522,98 +12414,97 @@ Demo.Downlist = BI.inherit(BI.Widget, { self.downlist = _ref; }, cls: "layout-bg3", - //value: [{"childValue":22,"value":11},{"value":18},{"value":20}], + value: [{"childValue":22,"value":11},{"value":18},{"value":20}], height: 30, width: 100, - items: items - // items: [ - // [{ - // el: { - // text: "column 1111", - // iconCls1: "check-mark-e-font", - // value: 11 - // }, - // children: [{ - // text: "column 1.1", - // value: 21, - // cls: "dot-e-font" - // }, { - // text: "column 1.222222222222222222222222222222222222", - // cls: "dot-e-font", - // value: 22 - // }] - // }], - // [{ - // el: { - // type: "bi.icon_text_icon_item", - // text: "column 2", - // iconCls1: "chart-type-e-font", - // cls: "dot-e-font", - // value: 12 - // }, - // disabled: true, - // children: [{ - // type: "bi.icon_text_item", - // cls: "dot-e-font", - // height: 25, - // text: "column 2.1", - // value: 11 - // }, { - // text: "column 2.2", - // value: 12, - // cls: "dot-e-font" - // }] - // }], - // [{ - // text: "column 8", - // value: 18, - // cls: "dot-e-font" - // }, - // { - // - // text: "column 9", - // cls: "dot-e-font", - // value: 19 - // } - // ], - // [{ - // text: "column 10", - // value: 20, - // cls: "dot-e-font" - // }, - // { - // - // text: "column 11", - // cls: "dot-e-font", - // value: 21 - // }, - // { - // - // text: "column 12", - // cls: "dot-e-font", - // value: 22 - // }, - // { - // - // text: "column 13", - // cls: "dot-e-font", - // value: 23 - // }, - // { - // - // text: "column 14", - // cls: "dot-e-font", - // value: 24 - // }, - // { - // - // text: "column 15", - // cls: "dot-e-font", - // value: 23 - // } - // ] - // - // ] + items: [ + [{ + el: { + text: "column 1111", + iconCls1: "check-mark-e-font", + value: 11 + }, + children: [{ + text: "column 1.1", + value: 21, + cls: "dot-e-font" + }, { + text: "column 1.222222222222222222222222222222222222", + cls: "dot-e-font", + value: 22 + }] + }], + [{ + el: { + type: "bi.icon_text_icon_item", + text: "column 2", + iconCls1: "chart-type-e-font", + cls: "dot-e-font", + value: 12 + }, + disabled: true, + children: [{ + type: "bi.icon_text_item", + cls: "dot-e-font", + height: 25, + text: "column 2.1", + value: 11 + }, { + text: "column 2.2", + value: 12, + cls: "dot-e-font" + }] + }], + [{ + text: "column 8", + value: 18, + cls: "dot-e-font" + }, + { + + text: "column 9", + cls: "dot-e-font", + value: 19 + } + ], + [{ + text: "column 10", + value: 20, + cls: "dot-e-font" + }, + { + + text: "column 11", + cls: "dot-e-font", + value: 21 + }, + { + + text: "column 12", + cls: "dot-e-font", + value: 22 + }, + { + + text: "column 13", + cls: "dot-e-font", + value: 23 + }, + { + + text: "column 14", + cls: "dot-e-font", + value: 24 + }, + { + + text: "column 15", + cls: "dot-e-font", + value: 23 + } + ] + + ] }, { type: "bi.label", text: "显示选择值", @@ -12752,7 +12643,8 @@ Demo.Month = BI.inherit(BI.Widget, { width: 300, ref: function () { self.monthcombo = this; - } + }, + value: 11 }, { type: "bi.button", text: "getValue", @@ -12979,7 +12871,12 @@ Demo.NumericalInterval = BI.inherit(BI.Widget, { ref: function (_ref) { self.numerical = _ref; }, - width: 500 + width: 500, + value: { + max: 300, + closeMax: true, + closeMin: false + } }, { type: "bi.label", ref: function (_ref) { @@ -13260,7 +13157,8 @@ Demo.Quarter = BI.inherit(BI.Widget, { width: 300, ref: function () { self.quartercombo = this; - } + }, + value: 3 }, { type: "bi.button", text: "getValue", @@ -14518,6 +14416,17 @@ Demo.TimeInterval = BI.inherit(BI.Widget, { ref: function (_ref) { self.interval = _ref; }, + value: { + start: { + type: 1, + value: 2 + }, + end: { + year: 2018, + month: 0, + day: 12 + } + }, width: 300 }, { type: "bi.button", @@ -14788,7 +14697,8 @@ Demo.Year = BI.inherit(BI.Widget, { width: 300, ref: function () { self.yearcombo = this; - } + }, + value: 2017 }, { type: "bi.button", text: "getValue", @@ -14826,7 +14736,11 @@ Demo.YearMonthCombo = BI.inherit(BI.Widget, { ref: function (_ref) { self.widget = _ref; }, - width: 300 + width: 300, + value:{ + year: 2018, + month: 0 + } }, { type: "bi.button", text: "getValue", @@ -14868,7 +14782,11 @@ Demo.YearQuarterCombo = BI.inherit(BI.Widget, { self.widget = _ref; }, yearBehaviors: {}, - quarterBehaviors: {} + quarterBehaviors: {}, + value: { + year: 2018, + quarter: 1 + } }, { type: "bi.button", text: "getValue", diff --git a/dist/fineui.js b/dist/fineui.js index 1cd66e7cc..7fb26ed53 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -27351,11 +27351,11 @@ Data.Source = BISource = { } this._parent = Model.target; var state = _.isFunction(this.state) ? this.state() : this.state; - var computed = _.isFunction(this.computed) ? this.computed() : this.computed; - var context = _.isFunction(this.context) ? this.context() : this.context; - var childContext = _.isFunction(this.childContext) ? this.childContext() : this.childContext; - var watch$$1 = _.isFunction(this.watch) ? this.watch() : this.watch; - var actions = _.isFunction(this.actions) ? this.actions() : this.actions; + var computed = this.computed; + var context = this.context; + var childContext = this.childContext; + var watch$$1 = this.watch; + var actions = this.actions; var keys = _.keys(this.$$model).concat(_.keys(state)).concat(_.keys(computed)).concat(context || []); defineProps(this, keys); childContext && defineContext(this, childContext); @@ -27392,13 +27392,6 @@ Data.Source = BISource = { return Model; }(); - Model.prototype.state = {}; - Model.prototype.computed = {}; - Model.prototype.context = []; - Model.prototype.childContext = []; - Model.prototype.watch = {}; - Model.prototype.actions = {}; - function toJSON(model) { var result = void 0; if (_.isArray(model)) { @@ -69540,15 +69533,14 @@ BI.IconTextValueCombo = BI.inherit(BI.Widget, { return BI.extend(BI.IconTextValueCombo.superclass._defaultConfig.apply(this, arguments), { baseClass: "bi-icon-text-value-combo", height: 30, - value: "", - el: {} + value: "" }); }, _init: function () { BI.IconTextValueCombo.superclass._init.apply(this, arguments); var self = this, o = this.options; - this.trigger = BI.createWidget(o.el, { + this.trigger = BI.createWidget({ type: "bi.select_icon_text_trigger", items: o.items, height: o.height, @@ -69738,15 +69730,14 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, { width: 100, height: 24, chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, - value: "", - el: {} + value: "" }); }, _init: function () { BI.TextValueCheckCombo.superclass._init.apply(this, arguments); var self = this, o = this.options; - this.trigger = BI.createWidget(o.el, { + this.trigger = BI.createWidget({ type: "bi.select_text_trigger", items: o.items, height: o.height, @@ -69944,15 +69935,14 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { height: 30, chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, text: "", - value: "", - el: {} + value: "" }); }, _init: function () { BI.TextValueCombo.superclass._init.apply(this, arguments); var self = this, o = this.options; - this.trigger = BI.createWidget(o.el, { + this.trigger = BI.createWidget({ type: "bi.select_text_trigger", items: o.items, height: o.height, @@ -80566,6 +80556,7 @@ BI.shortcut("bi.date_combo", BI.DateCombo);BI.DateTrigger = BI.inherit(BI.Trigge el: this.editor }] }); + this.setValue(o.value); }, _dateCheck: function (date) { return Date.parseDateTime(date, "%Y-%x-%d").print("%Y-%x-%d") == date || Date.parseDateTime(date, "%Y-%X-%d").print("%Y-%X-%d") == date || Date.parseDateTime(date, "%Y-%x-%e").print("%Y-%x-%e") == date || Date.parseDateTime(date, "%Y-%X-%e").print("%Y-%X-%e") == date; @@ -80842,6 +80833,7 @@ BI.DatePaneWidget = BI.inherit(BI.Widget, { self.setValue(self.selectedTime); self.fireEvent(BI.DateCalendarPopup.EVENT_CHANGE); }); + this.setValue(o.selectedTime); }, @@ -84579,7 +84571,8 @@ BI.MonthCombo = BI.inherit(BI.Widget, { var self = this, o = this.options; this.trigger = BI.createWidget({ - type: "bi.month_trigger" + type: "bi.month_trigger", + value: o.value }); this.trigger.on(BI.MonthTrigger.EVENT_CONFIRM, function (v) { @@ -84607,7 +84600,8 @@ BI.MonthCombo = BI.inherit(BI.Widget, { this.popup = BI.createWidget({ type: "bi.month_popup", - behaviors: o.behaviors + behaviors: o.behaviors, + value: o.value }); this.popup.on(BI.MonthPopup.EVENT_CHANGE, function () { self.setValue(self.popup.getValue()); @@ -84705,7 +84699,8 @@ BI.MonthPopup = BI.inherit(BI.Widget, { type: "bi.center_adapt", vgap: 1, hgap: 2 - }] + }], + value: o.value }); this.month.on(BI.Controller.EVENT_CHANGE, function (type) { @@ -84810,6 +84805,7 @@ BI.MonthTrigger = BI.inherit(BI.Trigger, { } ] }); + this.setValue(o.value); }, setValue: function (v) { if(BI.isNotNull(v)) { @@ -85010,11 +85006,12 @@ BI.MultiDateCombo = BI.inherit(BI.Single, { var self = this, opts = this.options; this.storeTriggerValue = ""; var date = Date.getDate(); - this.storeValue = null; + this.storeValue = opts.value; this.trigger = BI.createWidget({ type: "bi.date_trigger", min: this.constants.DATE_MIN_VALUE, - max: this.constants.DATE_MAX_VALUE + max: this.constants.DATE_MAX_VALUE, + value: opts.value }); this.trigger.on(BI.DateTrigger.EVENT_KEY_DOWN, function () { if (self.combo.isViewVisible()) { @@ -85068,7 +85065,8 @@ BI.MultiDateCombo = BI.inherit(BI.Single, { this.popup = BI.createWidget({ type: "bi.multidate_popup", min: this.constants.DATE_MIN_VALUE, - max: this.constants.DATE_MAX_VALUE + max: this.constants.DATE_MAX_VALUE, + value: opts.value }); this.popup.on(BI.MultiDatePopup.BUTTON_CLEAR_EVENT_CHANGE, function () { self.setValue(); @@ -85162,6 +85160,8 @@ BI.MultiDateCombo = BI.inherit(BI.Single, { self.comboWrapper = _ref; } }); + + this._checkDynamicValue(opts.value); }, _checkDynamicValue: function (v) { @@ -85559,6 +85559,7 @@ BI.MultiDatePopup = BI.inherit(BI.Widget, { height: 30 }] }); + this.setValue(opts.value); }, _setInnerValue: function (obj) { if (this.dateTab.getSelect() === BI.MultiDateCombo.MULTI_DATE_YMD_CARD) { @@ -91331,6 +91332,8 @@ BI.NumberInterval = BI.inherit(BI.Single, { self._setComboValueChangedEvent(self.smallCombo); self._setEditorValueChangedEvent(self.bigEditor); self._setEditorValueChangedEvent(self.smallEditor); + + this.setValue(o.value); }, _checkValidation: function () { @@ -92823,7 +92826,8 @@ BI.QuarterCombo = BI.inherit(BI.Widget, { var self = this, o = this.options; this.storeValue = ""; this.trigger = BI.createWidget({ - type: "bi.quarter_trigger" + type: "bi.quarter_trigger", + value: o.value }); this.trigger.on(BI.QuarterTrigger.EVENT_FOCUS, function () { @@ -92850,7 +92854,8 @@ BI.QuarterCombo = BI.inherit(BI.Widget, { }); this.popup = BI.createWidget({ type: "bi.quarter_popup", - behaviors: o.behaviors + behaviors: o.behaviors, + value: o.value }); this.popup.on(BI.QuarterPopup.EVENT_CHANGE, function () { @@ -92908,7 +92913,7 @@ BI.QuarterPopup = BI.inherit(BI.Widget, { var self = this, o = this.options; var items = [{ - text: Date._QN[01], + text: Date._QN[1], value: 1 }, { text: Date._QN[2], @@ -92939,7 +92944,8 @@ BI.QuarterPopup = BI.inherit(BI.Widget, { items: BI.createItems(items, {}), layouts: [{ type: "bi.vertical" - }] + }], + value: o.value }); this.quarter.on(BI.Controller.EVENT_CHANGE, function (type) { @@ -93046,6 +93052,7 @@ BI.QuarterTrigger = BI.inherit(BI.Trigger, { } ] }); + this.setValue(o.value); }, setValue: function (v) { @@ -98777,11 +98784,12 @@ BI.TimeInterval = BI.inherit(BI.Single, { }); }, _init: function () { - var self = this; + var self = this, o = this.options; BI.TimeInterval.superclass._init.apply(this, arguments); - this.left = this._createCombo(); - this.right = this._createCombo(); + o.value = o.value || {}; + this.left = this._createCombo(o.value.start); + this.right = this._createCombo(o.value.end); this.label = BI.createWidget({ type: "bi.label", height: this.constants.height, @@ -98822,10 +98830,11 @@ BI.TimeInterval = BI.inherit(BI.Single, { }); }, - _createCombo: function () { + _createCombo: function (v) { var self = this; var combo = BI.createWidget({ - type: "bi.multidate_combo" + type: "bi.multidate_combo", + value: v }); combo.on(BI.MultiDateCombo.EVENT_ERROR, function () { self._clearTitle(); @@ -98969,7 +98978,8 @@ BI.YearCombo = BI.inherit(BI.Widget, { this.trigger = BI.createWidget({ type: "bi.year_trigger", min: o.min, - max: o.max + max: o.max, + value: o.value || "" }); this.trigger.on(BI.YearTrigger.EVENT_FOCUS, function () { self.storeValue = this.getKey(); @@ -99021,7 +99031,8 @@ BI.YearCombo = BI.inherit(BI.Widget, { behaviors: o.behaviors, min: o.min, max: o.max - } + }, + value: o.value || "" } }); this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { @@ -99084,7 +99095,7 @@ BI.YearPopup = BI.inherit(BI.Widget, { _init: function () { BI.YearPopup.superclass._init.apply(this, arguments); - var self = this; + var self = this, o = this.options; this.selectedYear = this._year = Date.getDate().getFullYear(); @@ -99131,6 +99142,10 @@ BI.YearPopup = BI.inherit(BI.Widget, { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.YearPopup.EVENT_CHANGE, self.selectedYear); }); + + if(BI.isKey(o.value)){ + this.setValue(o.value); + } }, getValue: function () { @@ -99191,7 +99206,8 @@ BI.YearTrigger = BI.inherit(BI.Trigger, { hgap: c.hgap, vgap: c.vgap, allowBlank: true, - errorText: c.errorText + errorText: c.errorText, + value: o.value }); this.editor.on(BI.SignEditor.EVENT_FOCUS, function () { self.fireEvent(BI.YearTrigger.EVENT_FOCUS); @@ -99275,14 +99291,18 @@ BI.YearMonthCombo = BI.inherit(BI.Widget, { BI.YearMonthCombo.superclass._init.apply(this, arguments); var self = this, o = this.options; + o.value = o.value || {}; + this.year = BI.createWidget({ type: "bi.year_combo", - behaviors: o.yearBehaviors + behaviors: o.yearBehaviors, + value: o.value.year }); this.month = BI.createWidget({ type: "bi.month_combo", - behaviors: o.monthBehaviors + behaviors: o.monthBehaviors, + value: o.value.month }); this.year.on(BI.YearCombo.EVENT_CONFIRM, function () { @@ -99342,14 +99362,18 @@ BI.YearQuarterCombo = BI.inherit(BI.Widget, { BI.YearQuarterCombo.superclass._init.apply(this, arguments); var self = this, o = this.options; + o.value = o.value || {}; + this.year = BI.createWidget({ type: "bi.year_combo", - behaviors: o.yearBehaviors + behaviors: o.yearBehaviors, + value: o.value.year }); this.quarter = BI.createWidget({ type: "bi.quarter_combo", - behaviors: o.quarterBehaviors + behaviors: o.quarterBehaviors, + value: o.value.quarter }); this.year.on(BI.YearCombo.EVENT_CONFIRM, function () { diff --git a/dist/widget.js b/dist/widget.js index e487d1479..f2df6eb8f 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -2399,6 +2399,7 @@ BI.shortcut("bi.date_combo", BI.DateCombo);BI.DateTrigger = BI.inherit(BI.Trigge el: this.editor }] }); + this.setValue(o.value); }, _dateCheck: function (date) { return Date.parseDateTime(date, "%Y-%x-%d").print("%Y-%x-%d") == date || Date.parseDateTime(date, "%Y-%X-%d").print("%Y-%X-%d") == date || Date.parseDateTime(date, "%Y-%x-%e").print("%Y-%x-%e") == date || Date.parseDateTime(date, "%Y-%X-%e").print("%Y-%X-%e") == date; @@ -2675,6 +2676,7 @@ BI.DatePaneWidget = BI.inherit(BI.Widget, { self.setValue(self.selectedTime); self.fireEvent(BI.DateCalendarPopup.EVENT_CHANGE); }); + this.setValue(o.selectedTime); }, @@ -6412,7 +6414,8 @@ BI.MonthCombo = BI.inherit(BI.Widget, { var self = this, o = this.options; this.trigger = BI.createWidget({ - type: "bi.month_trigger" + type: "bi.month_trigger", + value: o.value }); this.trigger.on(BI.MonthTrigger.EVENT_CONFIRM, function (v) { @@ -6440,7 +6443,8 @@ BI.MonthCombo = BI.inherit(BI.Widget, { this.popup = BI.createWidget({ type: "bi.month_popup", - behaviors: o.behaviors + behaviors: o.behaviors, + value: o.value }); this.popup.on(BI.MonthPopup.EVENT_CHANGE, function () { self.setValue(self.popup.getValue()); @@ -6538,7 +6542,8 @@ BI.MonthPopup = BI.inherit(BI.Widget, { type: "bi.center_adapt", vgap: 1, hgap: 2 - }] + }], + value: o.value }); this.month.on(BI.Controller.EVENT_CHANGE, function (type) { @@ -6643,6 +6648,7 @@ BI.MonthTrigger = BI.inherit(BI.Trigger, { } ] }); + this.setValue(o.value); }, setValue: function (v) { if(BI.isNotNull(v)) { @@ -6843,11 +6849,12 @@ BI.MultiDateCombo = BI.inherit(BI.Single, { var self = this, opts = this.options; this.storeTriggerValue = ""; var date = Date.getDate(); - this.storeValue = null; + this.storeValue = opts.value; this.trigger = BI.createWidget({ type: "bi.date_trigger", min: this.constants.DATE_MIN_VALUE, - max: this.constants.DATE_MAX_VALUE + max: this.constants.DATE_MAX_VALUE, + value: opts.value }); this.trigger.on(BI.DateTrigger.EVENT_KEY_DOWN, function () { if (self.combo.isViewVisible()) { @@ -6901,7 +6908,8 @@ BI.MultiDateCombo = BI.inherit(BI.Single, { this.popup = BI.createWidget({ type: "bi.multidate_popup", min: this.constants.DATE_MIN_VALUE, - max: this.constants.DATE_MAX_VALUE + max: this.constants.DATE_MAX_VALUE, + value: opts.value }); this.popup.on(BI.MultiDatePopup.BUTTON_CLEAR_EVENT_CHANGE, function () { self.setValue(); @@ -6995,6 +7003,8 @@ BI.MultiDateCombo = BI.inherit(BI.Single, { self.comboWrapper = _ref; } }); + + this._checkDynamicValue(opts.value); }, _checkDynamicValue: function (v) { @@ -7392,6 +7402,7 @@ BI.MultiDatePopup = BI.inherit(BI.Widget, { height: 30 }] }); + this.setValue(opts.value); }, _setInnerValue: function (obj) { if (this.dateTab.getSelect() === BI.MultiDateCombo.MULTI_DATE_YMD_CARD) { @@ -13164,6 +13175,8 @@ BI.NumberInterval = BI.inherit(BI.Single, { self._setComboValueChangedEvent(self.smallCombo); self._setEditorValueChangedEvent(self.bigEditor); self._setEditorValueChangedEvent(self.smallEditor); + + this.setValue(o.value); }, _checkValidation: function () { @@ -14656,7 +14669,8 @@ BI.QuarterCombo = BI.inherit(BI.Widget, { var self = this, o = this.options; this.storeValue = ""; this.trigger = BI.createWidget({ - type: "bi.quarter_trigger" + type: "bi.quarter_trigger", + value: o.value }); this.trigger.on(BI.QuarterTrigger.EVENT_FOCUS, function () { @@ -14683,7 +14697,8 @@ BI.QuarterCombo = BI.inherit(BI.Widget, { }); this.popup = BI.createWidget({ type: "bi.quarter_popup", - behaviors: o.behaviors + behaviors: o.behaviors, + value: o.value }); this.popup.on(BI.QuarterPopup.EVENT_CHANGE, function () { @@ -14741,7 +14756,7 @@ BI.QuarterPopup = BI.inherit(BI.Widget, { var self = this, o = this.options; var items = [{ - text: Date._QN[01], + text: Date._QN[1], value: 1 }, { text: Date._QN[2], @@ -14772,7 +14787,8 @@ BI.QuarterPopup = BI.inherit(BI.Widget, { items: BI.createItems(items, {}), layouts: [{ type: "bi.vertical" - }] + }], + value: o.value }); this.quarter.on(BI.Controller.EVENT_CHANGE, function (type) { @@ -14879,6 +14895,7 @@ BI.QuarterTrigger = BI.inherit(BI.Trigger, { } ] }); + this.setValue(o.value); }, setValue: function (v) { @@ -20610,11 +20627,12 @@ BI.TimeInterval = BI.inherit(BI.Single, { }); }, _init: function () { - var self = this; + var self = this, o = this.options; BI.TimeInterval.superclass._init.apply(this, arguments); - this.left = this._createCombo(); - this.right = this._createCombo(); + o.value = o.value || {}; + this.left = this._createCombo(o.value.start); + this.right = this._createCombo(o.value.end); this.label = BI.createWidget({ type: "bi.label", height: this.constants.height, @@ -20655,10 +20673,11 @@ BI.TimeInterval = BI.inherit(BI.Single, { }); }, - _createCombo: function () { + _createCombo: function (v) { var self = this; var combo = BI.createWidget({ - type: "bi.multidate_combo" + type: "bi.multidate_combo", + value: v }); combo.on(BI.MultiDateCombo.EVENT_ERROR, function () { self._clearTitle(); @@ -20802,7 +20821,8 @@ BI.YearCombo = BI.inherit(BI.Widget, { this.trigger = BI.createWidget({ type: "bi.year_trigger", min: o.min, - max: o.max + max: o.max, + value: o.value || "" }); this.trigger.on(BI.YearTrigger.EVENT_FOCUS, function () { self.storeValue = this.getKey(); @@ -20854,7 +20874,8 @@ BI.YearCombo = BI.inherit(BI.Widget, { behaviors: o.behaviors, min: o.min, max: o.max - } + }, + value: o.value || "" } }); this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { @@ -20917,7 +20938,7 @@ BI.YearPopup = BI.inherit(BI.Widget, { _init: function () { BI.YearPopup.superclass._init.apply(this, arguments); - var self = this; + var self = this, o = this.options; this.selectedYear = this._year = Date.getDate().getFullYear(); @@ -20964,6 +20985,10 @@ BI.YearPopup = BI.inherit(BI.Widget, { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.YearPopup.EVENT_CHANGE, self.selectedYear); }); + + if(BI.isKey(o.value)){ + this.setValue(o.value); + } }, getValue: function () { @@ -21024,7 +21049,8 @@ BI.YearTrigger = BI.inherit(BI.Trigger, { hgap: c.hgap, vgap: c.vgap, allowBlank: true, - errorText: c.errorText + errorText: c.errorText, + value: o.value }); this.editor.on(BI.SignEditor.EVENT_FOCUS, function () { self.fireEvent(BI.YearTrigger.EVENT_FOCUS); @@ -21108,14 +21134,18 @@ BI.YearMonthCombo = BI.inherit(BI.Widget, { BI.YearMonthCombo.superclass._init.apply(this, arguments); var self = this, o = this.options; + o.value = o.value || {}; + this.year = BI.createWidget({ type: "bi.year_combo", - behaviors: o.yearBehaviors + behaviors: o.yearBehaviors, + value: o.value.year }); this.month = BI.createWidget({ type: "bi.month_combo", - behaviors: o.monthBehaviors + behaviors: o.monthBehaviors, + value: o.value.month }); this.year.on(BI.YearCombo.EVENT_CONFIRM, function () { @@ -21175,14 +21205,18 @@ BI.YearQuarterCombo = BI.inherit(BI.Widget, { BI.YearQuarterCombo.superclass._init.apply(this, arguments); var self = this, o = this.options; + o.value = o.value || {}; + this.year = BI.createWidget({ type: "bi.year_combo", - behaviors: o.yearBehaviors + behaviors: o.yearBehaviors, + value: o.value.year }); this.quarter = BI.createWidget({ type: "bi.quarter_combo", - behaviors: o.quarterBehaviors + behaviors: o.quarterBehaviors, + value: o.value.quarter }); this.year.on(BI.YearCombo.EVENT_CONFIRM, function () { diff --git a/src/case/combo/icontextvaluecombo/combo.icontextvalue.js b/src/case/combo/icontextvaluecombo/combo.icontextvalue.js index 2b317ed38..a38dcf356 100644 --- a/src/case/combo/icontextvaluecombo/combo.icontextvalue.js +++ b/src/case/combo/icontextvaluecombo/combo.icontextvalue.js @@ -7,15 +7,14 @@ BI.IconTextValueCombo = BI.inherit(BI.Widget, { return BI.extend(BI.IconTextValueCombo.superclass._defaultConfig.apply(this, arguments), { baseClass: "bi-icon-text-value-combo", height: 30, - value: "", - el: {} + value: "" }); }, _init: function () { BI.IconTextValueCombo.superclass._init.apply(this, arguments); var self = this, o = this.options; - this.trigger = BI.createWidget(o.el, { + this.trigger = BI.createWidget({ type: "bi.select_icon_text_trigger", items: o.items, height: o.height, diff --git a/src/case/combo/textvaluecheckcombo/combo.textvaluecheck.js b/src/case/combo/textvaluecheckcombo/combo.textvaluecheck.js index 737f09401..be1434eaa 100644 --- a/src/case/combo/textvaluecheckcombo/combo.textvaluecheck.js +++ b/src/case/combo/textvaluecheckcombo/combo.textvaluecheck.js @@ -10,15 +10,14 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, { width: 100, height: 24, chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, - value: "", - el: {} + value: "" }); }, _init: function () { BI.TextValueCheckCombo.superclass._init.apply(this, arguments); var self = this, o = this.options; - this.trigger = BI.createWidget(o.el, { + this.trigger = BI.createWidget({ type: "bi.select_text_trigger", items: o.items, height: o.height, diff --git a/src/case/combo/textvaluecombo/combo.textvalue.js b/src/case/combo/textvaluecombo/combo.textvalue.js index 812a7fda6..7405f8d5f 100644 --- a/src/case/combo/textvaluecombo/combo.textvalue.js +++ b/src/case/combo/textvaluecombo/combo.textvalue.js @@ -11,15 +11,14 @@ BI.TextValueCombo = BI.inherit(BI.Widget, { height: 30, chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, text: "", - value: "", - el: {} + value: "" }); }, _init: function () { BI.TextValueCombo.superclass._init.apply(this, arguments); var self = this, o = this.options; - this.trigger = BI.createWidget(o.el, { + this.trigger = BI.createWidget({ type: "bi.select_text_trigger", items: o.items, height: o.height, diff --git a/src/widget/date/trigger.date.js b/src/widget/date/trigger.date.js index f9f2bd2d9..91232a90b 100644 --- a/src/widget/date/trigger.date.js +++ b/src/widget/date/trigger.date.js @@ -98,6 +98,7 @@ BI.DateTrigger = BI.inherit(BI.Trigger, { el: this.editor }] }); + this.setValue(o.value); }, _dateCheck: function (date) { return Date.parseDateTime(date, "%Y-%x-%d").print("%Y-%x-%d") == date || Date.parseDateTime(date, "%Y-%X-%d").print("%Y-%X-%d") == date || Date.parseDateTime(date, "%Y-%x-%e").print("%Y-%x-%e") == date || Date.parseDateTime(date, "%Y-%X-%e").print("%Y-%X-%e") == date; diff --git a/src/widget/datepane/datepane.js b/src/widget/datepane/datepane.js index c936d9dd1..b73d96f9c 100644 --- a/src/widget/datepane/datepane.js +++ b/src/widget/datepane/datepane.js @@ -59,6 +59,7 @@ BI.DatePaneWidget = BI.inherit(BI.Widget, { self.setValue(self.selectedTime); self.fireEvent(BI.DateCalendarPopup.EVENT_CHANGE); }); + this.setValue(o.selectedTime); }, diff --git a/src/widget/month/combo.month.js b/src/widget/month/combo.month.js index b284360d8..9c2a9aa79 100644 --- a/src/widget/month/combo.month.js +++ b/src/widget/month/combo.month.js @@ -18,7 +18,8 @@ BI.MonthCombo = BI.inherit(BI.Widget, { var self = this, o = this.options; this.trigger = BI.createWidget({ - type: "bi.month_trigger" + type: "bi.month_trigger", + value: o.value }); this.trigger.on(BI.MonthTrigger.EVENT_CONFIRM, function (v) { @@ -46,7 +47,8 @@ BI.MonthCombo = BI.inherit(BI.Widget, { this.popup = BI.createWidget({ type: "bi.month_popup", - behaviors: o.behaviors + behaviors: o.behaviors, + value: o.value }); this.popup.on(BI.MonthPopup.EVENT_CHANGE, function () { self.setValue(self.popup.getValue()); diff --git a/src/widget/month/popup.month.js b/src/widget/month/popup.month.js index 6374c4a88..8811b65f8 100644 --- a/src/widget/month/popup.month.js +++ b/src/widget/month/popup.month.js @@ -60,7 +60,8 @@ BI.MonthPopup = BI.inherit(BI.Widget, { type: "bi.center_adapt", vgap: 1, hgap: 2 - }] + }], + value: o.value }); this.month.on(BI.Controller.EVENT_CHANGE, function (type) { diff --git a/src/widget/month/trigger.month.js b/src/widget/month/trigger.month.js index 5f6c1992e..4176fcb45 100644 --- a/src/widget/month/trigger.month.js +++ b/src/widget/month/trigger.month.js @@ -83,6 +83,7 @@ BI.MonthTrigger = BI.inherit(BI.Trigger, { } ] }); + this.setValue(o.value); }, setValue: function (v) { if(BI.isNotNull(v)) { diff --git a/src/widget/multidate/multidate.combo.js b/src/widget/multidate/multidate.combo.js index 0288856b6..6e8625368 100644 --- a/src/widget/multidate/multidate.combo.js +++ b/src/widget/multidate/multidate.combo.js @@ -23,11 +23,12 @@ BI.MultiDateCombo = BI.inherit(BI.Single, { var self = this, opts = this.options; this.storeTriggerValue = ""; var date = Date.getDate(); - this.storeValue = null; + this.storeValue = opts.value; this.trigger = BI.createWidget({ type: "bi.date_trigger", min: this.constants.DATE_MIN_VALUE, - max: this.constants.DATE_MAX_VALUE + max: this.constants.DATE_MAX_VALUE, + value: opts.value }); this.trigger.on(BI.DateTrigger.EVENT_KEY_DOWN, function () { if (self.combo.isViewVisible()) { @@ -81,7 +82,8 @@ BI.MultiDateCombo = BI.inherit(BI.Single, { this.popup = BI.createWidget({ type: "bi.multidate_popup", min: this.constants.DATE_MIN_VALUE, - max: this.constants.DATE_MAX_VALUE + max: this.constants.DATE_MAX_VALUE, + value: opts.value }); this.popup.on(BI.MultiDatePopup.BUTTON_CLEAR_EVENT_CHANGE, function () { self.setValue(); @@ -175,6 +177,8 @@ BI.MultiDateCombo = BI.inherit(BI.Single, { self.comboWrapper = _ref; } }); + + this._checkDynamicValue(opts.value); }, _checkDynamicValue: function (v) { diff --git a/src/widget/multidate/multidate.popup.js b/src/widget/multidate/multidate.popup.js index d4d8e5015..307fc48bf 100644 --- a/src/widget/multidate/multidate.popup.js +++ b/src/widget/multidate/multidate.popup.js @@ -202,6 +202,7 @@ BI.MultiDatePopup = BI.inherit(BI.Widget, { height: 30 }] }); + this.setValue(opts.value); }, _setInnerValue: function (obj) { if (this.dateTab.getSelect() === BI.MultiDateCombo.MULTI_DATE_YMD_CARD) { diff --git a/src/widget/numberinterval/numberinterval.js b/src/widget/numberinterval/numberinterval.js index 16a126e58..efcafe608 100644 --- a/src/widget/numberinterval/numberinterval.js +++ b/src/widget/numberinterval/numberinterval.js @@ -236,6 +236,8 @@ BI.NumberInterval = BI.inherit(BI.Single, { self._setComboValueChangedEvent(self.smallCombo); self._setEditorValueChangedEvent(self.bigEditor); self._setEditorValueChangedEvent(self.smallEditor); + + this.setValue(o.value); }, _checkValidation: function () { diff --git a/src/widget/quarter/combo.quarter.js b/src/widget/quarter/combo.quarter.js index 93194ea5e..aa2b64215 100644 --- a/src/widget/quarter/combo.quarter.js +++ b/src/widget/quarter/combo.quarter.js @@ -18,7 +18,8 @@ BI.QuarterCombo = BI.inherit(BI.Widget, { var self = this, o = this.options; this.storeValue = ""; this.trigger = BI.createWidget({ - type: "bi.quarter_trigger" + type: "bi.quarter_trigger", + value: o.value }); this.trigger.on(BI.QuarterTrigger.EVENT_FOCUS, function () { @@ -45,7 +46,8 @@ BI.QuarterCombo = BI.inherit(BI.Widget, { }); this.popup = BI.createWidget({ type: "bi.quarter_popup", - behaviors: o.behaviors + behaviors: o.behaviors, + value: o.value }); this.popup.on(BI.QuarterPopup.EVENT_CHANGE, function () { diff --git a/src/widget/quarter/popup.quarter.js b/src/widget/quarter/popup.quarter.js index 6babfe41b..4a680cefb 100644 --- a/src/widget/quarter/popup.quarter.js +++ b/src/widget/quarter/popup.quarter.js @@ -19,7 +19,7 @@ BI.QuarterPopup = BI.inherit(BI.Widget, { var self = this, o = this.options; var items = [{ - text: Date._QN[01], + text: Date._QN[1], value: 1 }, { text: Date._QN[2], @@ -50,7 +50,8 @@ BI.QuarterPopup = BI.inherit(BI.Widget, { items: BI.createItems(items, {}), layouts: [{ type: "bi.vertical" - }] + }], + value: o.value }); this.quarter.on(BI.Controller.EVENT_CHANGE, function (type) { diff --git a/src/widget/quarter/trigger.quarter.js b/src/widget/quarter/trigger.quarter.js index d1f66375b..3c6ac3b86 100644 --- a/src/widget/quarter/trigger.quarter.js +++ b/src/widget/quarter/trigger.quarter.js @@ -85,6 +85,7 @@ BI.QuarterTrigger = BI.inherit(BI.Trigger, { } ] }); + this.setValue(o.value); }, setValue: function (v) { diff --git a/src/widget/timeinterval/timeinterval.js b/src/widget/timeinterval/timeinterval.js index 514efbd23..d81260aed 100644 --- a/src/widget/timeinterval/timeinterval.js +++ b/src/widget/timeinterval/timeinterval.js @@ -18,11 +18,12 @@ BI.TimeInterval = BI.inherit(BI.Single, { }); }, _init: function () { - var self = this; + var self = this, o = this.options; BI.TimeInterval.superclass._init.apply(this, arguments); - this.left = this._createCombo(); - this.right = this._createCombo(); + o.value = o.value || {}; + this.left = this._createCombo(o.value.start); + this.right = this._createCombo(o.value.end); this.label = BI.createWidget({ type: "bi.label", height: this.constants.height, @@ -63,10 +64,11 @@ BI.TimeInterval = BI.inherit(BI.Single, { }); }, - _createCombo: function () { + _createCombo: function (v) { var self = this; var combo = BI.createWidget({ - type: "bi.multidate_combo" + type: "bi.multidate_combo", + value: v }); combo.on(BI.MultiDateCombo.EVENT_ERROR, function () { self._clearTitle(); diff --git a/src/widget/year/combo.year.js b/src/widget/year/combo.year.js index 4cbb21fb9..6de16ae16 100644 --- a/src/widget/year/combo.year.js +++ b/src/widget/year/combo.year.js @@ -22,7 +22,8 @@ BI.YearCombo = BI.inherit(BI.Widget, { this.trigger = BI.createWidget({ type: "bi.year_trigger", min: o.min, - max: o.max + max: o.max, + value: o.value || "" }); this.trigger.on(BI.YearTrigger.EVENT_FOCUS, function () { self.storeValue = this.getKey(); @@ -74,7 +75,8 @@ BI.YearCombo = BI.inherit(BI.Widget, { behaviors: o.behaviors, min: o.min, max: o.max - } + }, + value: o.value || "" } }); this.combo.on(BI.Combo.EVENT_BEFORE_POPUPVIEW, function () { diff --git a/src/widget/year/popup.year.js b/src/widget/year/popup.year.js index cc2e7b45e..4da3509a9 100644 --- a/src/widget/year/popup.year.js +++ b/src/widget/year/popup.year.js @@ -35,7 +35,7 @@ BI.YearPopup = BI.inherit(BI.Widget, { _init: function () { BI.YearPopup.superclass._init.apply(this, arguments); - var self = this; + var self = this, o = this.options; this.selectedYear = this._year = Date.getDate().getFullYear(); @@ -82,6 +82,10 @@ BI.YearPopup = BI.inherit(BI.Widget, { self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.YearPopup.EVENT_CHANGE, self.selectedYear); }); + + if(BI.isKey(o.value)){ + this.setValue(o.value); + } }, getValue: function () { diff --git a/src/widget/year/trigger.year.js b/src/widget/year/trigger.year.js index 3fd21fe05..d95d45ff1 100644 --- a/src/widget/year/trigger.year.js +++ b/src/widget/year/trigger.year.js @@ -37,7 +37,8 @@ BI.YearTrigger = BI.inherit(BI.Trigger, { hgap: c.hgap, vgap: c.vgap, allowBlank: true, - errorText: c.errorText + errorText: c.errorText, + value: o.value }); this.editor.on(BI.SignEditor.EVENT_FOCUS, function () { self.fireEvent(BI.YearTrigger.EVENT_FOCUS); diff --git a/src/widget/yearmonth/combo.yearmonth.js b/src/widget/yearmonth/combo.yearmonth.js index ff1ba3b32..38410e0ac 100644 --- a/src/widget/yearmonth/combo.yearmonth.js +++ b/src/widget/yearmonth/combo.yearmonth.js @@ -17,14 +17,18 @@ BI.YearMonthCombo = BI.inherit(BI.Widget, { BI.YearMonthCombo.superclass._init.apply(this, arguments); var self = this, o = this.options; + o.value = o.value || {}; + this.year = BI.createWidget({ type: "bi.year_combo", - behaviors: o.yearBehaviors + behaviors: o.yearBehaviors, + value: o.value.year }); this.month = BI.createWidget({ type: "bi.month_combo", - behaviors: o.monthBehaviors + behaviors: o.monthBehaviors, + value: o.value.month }); this.year.on(BI.YearCombo.EVENT_CONFIRM, function () { diff --git a/src/widget/yearquarter/combo.yearquarter.js b/src/widget/yearquarter/combo.yearquarter.js index a23f63c21..fae8db001 100644 --- a/src/widget/yearquarter/combo.yearquarter.js +++ b/src/widget/yearquarter/combo.yearquarter.js @@ -17,14 +17,18 @@ BI.YearQuarterCombo = BI.inherit(BI.Widget, { BI.YearQuarterCombo.superclass._init.apply(this, arguments); var self = this, o = this.options; + o.value = o.value || {}; + this.year = BI.createWidget({ type: "bi.year_combo", - behaviors: o.yearBehaviors + behaviors: o.yearBehaviors, + value: o.value.year }); this.quarter = BI.createWidget({ type: "bi.quarter_combo", - behaviors: o.quarterBehaviors + behaviors: o.quarterBehaviors, + value: o.value.quarter }); this.year.on(BI.YearCombo.EVENT_CONFIRM, function () {