diff --git a/dist/2.0/fineui.ie.js b/dist/2.0/fineui.ie.js index 66ebe5e51..637b26551 100644 --- a/dist/2.0/fineui.ie.js +++ b/dist/2.0/fineui.ie.js @@ -32414,7 +32414,9 @@ $.extend($.Event.prototype, { py = BI.toUpperCase(py); } this.empty(); - while (true) { + // BI-48487 性能: makeFirstPY出来的py中包含多音字是必要的,但虽然此方法中做了限制。但是对于一个长度为60,包含14个多音字的字符串 + // 获取的的py长度将达到1966080, 远超过text的长度,到后面都是在做"".substring的无用功,所以此循环应保证py和textLeft长度不为0 + while (py.length > 0 && textLeft.length > 0) { var tidx = BI.toUpperCase(textLeft).indexOf(keyword); var pidx = null; if (py != null) { @@ -47272,7 +47274,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { type: "bi.text_button", cls: "bi-water-mark cursor-default", textAlign: "left", - height: 20, + whiteSpace: "normal", text: o.watermark, invalid: o.invalid, disabled: o.disabled @@ -57022,73 +57024,7 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, { } }); BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);/** - * @class BI.SmallTextValueCheckCombo - * @extend BI.Widget - * combo : text + icon, popup : check + text - */ -BI.SmallTextValueCheckCombo = BI.inherit(BI.Widget, { - _defaultConfig: function () { - return BI.extend(BI.SmallTextValueCheckCombo.superclass._defaultConfig.apply(this, arguments), { - width: 100, - height: 24, - chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, - text: "" - }); - }, - - _init: function () { - BI.SmallTextValueCheckCombo.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.trigger = BI.createWidget({ - type: "bi.small_select_text_trigger", - items: o.items, - height: o.height, - text: o.text, - value: o.value - }); - this.popup = BI.createWidget({ - type: "bi.text_value_check_combo_popup", - chooseType: o.chooseType, - items: o.items, - value: o.value - }); - this.popup.on(BI.TextValueCheckComboPopup.EVENT_CHANGE, function () { - self.setValue(self.popup.getValue()); - self.SmallTextIconCheckCombo.hideView(); - self.fireEvent(BI.SmallTextValueCheckCombo.EVENT_CHANGE); - }); - this.popup.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); - this.SmallTextIconCheckCombo = BI.createWidget({ - type: "bi.combo", - container: o.container, - element: this, - adjustLength: 2, - el: this.trigger, - popup: { - el: this.popup, - maxHeight: 300 - } - }); - }, - - setValue: function (v) { - this.SmallTextIconCheckCombo.setValue(v); - }, - - getValue: function () { - return this.popup.getValue(); - }, - - populate: function (items) { - this.options.items = items; - this.SmallTextIconCheckCombo.populate(items); - } -}); -BI.SmallTextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.small_text_value_check_combo", BI.SmallTextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, { +BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, { _defaultConfig: function () { return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-text-icon-popup", @@ -58307,7 +58243,7 @@ BI.StateEditor = BI.inherit(BI.Widget, { }); this.text = BI.createWidget({ type: "bi.text_button", - cls: "state-editor-infinite-text tip-text-style", + cls: "bi-water-mark tip-text-style", textAlign: "left", height: o.height, text: o.text, @@ -58504,31 +58440,31 @@ BI.StateEditor = BI.inherit(BI.Widget, { if (BI.isNumber(v)) { if (v === BI.Selection.All) { this.text.setText(BI.i18nText("BI-Select_All")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else if (v === BI.Selection.Multi) { this.text.setText(BI.i18nText("BI-Select_Part")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } return; } if (BI.isString(v)) { this.text.setText(v); - this.text.element.removeClass("state-editor-infinite-text"); + v === o.text ? this.text.element.addClass("bi-water-mark") : this.text.element.removeClass("bi-water-mark"); return; } if (BI.isArray(v)) { if (BI.isEmpty(v)) { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } else if (v.length === 1) { this.text.setText(v[0]); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else { this.text.setText(BI.i18nText("BI-Select_Part")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } } }, @@ -58606,7 +58542,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { }); this.text = BI.createWidget({ type: "bi.text_button", - cls: "state-editor-infinite-text", + cls: "bi-water-mark", textAlign: "left", text: o.text, height: o.height, @@ -58788,26 +58724,26 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { if (BI.isNumber(v)) { if (v === BI.Selection.All) { this.text.setText(BI.i18nText("BI-Already_Selected")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else if (v === BI.Selection.Multi) { this.text.setText(BI.i18nText("BI-Already_Selected")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } return; } if (!BI.isArray(v) || v.length === 1) { this.text.setText(v); this.text.setTitle(v); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else if (BI.isEmpty(v)) { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } else { this.text.setText(BI.i18nText("BI-Already_Selected")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } } }); @@ -61568,7 +61504,8 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { baseCls: (conf.baseCls || "") + " bi-text-trigger", height: 24, iconHeight: null, - iconWidth: null + iconWidth: null, + textCls: "" }); }, @@ -61577,7 +61514,7 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options, c = this._const; this.text = BI.createWidget({ type: "bi.label", - cls: "select-text-label", + cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""), textAlign: "left", height: o.height, text: o.text @@ -61642,6 +61579,12 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { } }, + setTextCls: function(cls) { + var o = this.options; + this.text.element.removeClass(o.textCls).addClass(cls); + o.textCls = cls; + }, + setText: function (text) { this.text.setText(text); } @@ -61670,6 +61613,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, { type: "bi.icon_text_trigger", element: this, text: obj.text, + textCls: obj.textCls, iconCls: obj.iconCls, height: o.height, iconHeight: o.iconHeight, @@ -61696,11 +61640,13 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, { if (BI.isNotNull(result)) { return { text: result.text, + textCls: "", iconCls: result.iconCls }; } else { return { text: o.text, + textCls: "bi-water-mark", iconCls: o.iconCls }; } @@ -61710,6 +61656,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, { var obj = this._digist(vals, this.options.items); this.trigger.setText(obj.text); this.trigger.setIcon(obj.iconCls); + this.trigger.setTextCls(obj.textCls); }, populate: function (items) { @@ -61732,7 +61679,8 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-text-trigger", - height: 24 + height: 24, + textCls: "" }); }, @@ -61741,7 +61689,7 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options, c = this._const; this.text = BI.createWidget({ type: "bi.label", - cls: "select-text-label", + cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""), textAlign: "left", height: o.height, text: o.text, @@ -61772,6 +61720,12 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { }); }, + setTextCls: function(cls) { + var o = this.options; + this.text.element.removeClass(o.textCls).addClass(cls); + o.textCls = cls; + }, + setText: function (text) { this.text.setText(text); }, @@ -61801,12 +61755,14 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { this.options.height -= 2; BI.SelectTextTrigger.superclass._init.apply(this, arguments); var self = this, o = this.options; + var obj = this._digest(o.text, o.items); this.trigger = BI.createWidget({ type: "bi.text_trigger", element: this, height: o.height, readonly: o.readonly, - text: this._digest(o.value, o.items), + text: obj.text, + textCls: obj.textCls, tipType: o.tipType, warningTitle: o.warningTitle }); @@ -61824,14 +61780,22 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { }); if (result.length > 0) { - return result.join(","); + return { + textCls: "", + text: result.join(",") + } } else { - return BI.isFunction(o.text) ? o.text() : o.text; + return { + textCls: "bi-water-mark", + text: BI.isFunction(o.text) ? o.text() : o.text + } } }, setValue: function (vals) { - this.trigger.setText(this._digest(vals, this.options.items)); + var formatValue = this._digest(vals, this.options.items); + this.trigger.setTextCls(formatValue.textCls); + this.trigger.setText(formatValue.text); }, setTipType: function (v) { @@ -85018,6 +84982,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear }, _createMonths: function () { + var self = this; // 纵向排列月 var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12]; var items = []; @@ -85039,7 +85004,10 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear height: 23, width: 38, value: td, - text: td + text: td, + ref: function (_ref) { + self.monthMap[j === 0 ? i : i + 6] = _ref; + } }; }); }); @@ -85047,10 +85015,13 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear render: function () { var self = this, o = this.options; + this.monthMap = {}; return { type: "bi.vertical", items: [{ type: "bi.year_picker", + min: o.min, + max: o.max, ref: function () { self.yearPicker = this; }, @@ -85060,6 +85031,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear eventName: BI.YearPicker.EVENT_CHANGE, action: function () { var value = this.getValue(); + self._checkMonthStatus(value); self.setValue({ year: value, month: self.selectedMonth @@ -85099,6 +85071,23 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear }; }, + mounted: function() { + this._checkMonthStatus(this.selectedYear); + }, + + _checkMonthStatus: function (year) { + var o = this.options; + var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"), maxDate = BI.parseDateTime(o.max, "%Y-%X-%d"); + var minYear = minDate.getFullYear(), maxYear = maxDate.getFullYear(); + var minMonth = 0; var maxMonth = 11; + minYear === year && (minMonth = minDate.getMonth()); + maxYear === year && (maxMonth = maxDate.getMonth()); + var yearInvalid = year < minYear || year > maxYear; + BI.each(this.monthMap, function (month, obj) { + var monthInvalid = month < minMonth || month > maxMonth; + obj.setEnable(!yearInvalid && !monthInvalid); + }); + }, getValue: function () { return { @@ -85133,8 +85122,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { props: { baseCls: "bi-year-month-combo bi-border bi-focus-shadow", behaviors: {}, - min: "1900-01-01", // 最小日期 - max: "2099-12-31", // 最大日期 + minDate: "1900-01-01", // 最小日期 + maxDate: "2099-12-31", // 最大日期 height: 22 }, @@ -85145,8 +85134,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { this.storeTriggerValue = ""; this.trigger = BI.createWidget({ type: "bi.dynamic_year_month_trigger", - min: o.min, - max: o.max, + min: o.minDate, + max: o.maxDate, height: o.height, value: o.value || "" }); @@ -85230,8 +85219,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { } }], behaviors: o.behaviors, - min: o.min, - max: o.max + min: o.minDate, + max: o.maxDate }, value: o.value || "" } @@ -85585,12 +85574,13 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY _createEditor: function (isYear) { var self = this, o = this.options, c = this._const; + var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"); var editor = BI.createWidget({ type: "bi.sign_editor", height: o.height, validationChecker: function (v) { if(isYear) { - return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, 1, 1, o.min, o.max)[0]); + return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, v === minDate.getFullYear() ? minDate.getMonth() + 1 : 1, 1, o.min, o.max)[0]); } return v === "" || ((BI.isPositiveInteger(v) && v >= 1 && v <= 12) && !BI.checkDateVoid(BI.getDate().getFullYear(), v, 1, o.min, o.max)[0]); }, diff --git a/dist/2.0/fineui.js b/dist/2.0/fineui.js index f1b910b43..578970220 100644 --- a/dist/2.0/fineui.js +++ b/dist/2.0/fineui.js @@ -32414,7 +32414,9 @@ $.extend($.Event.prototype, { py = BI.toUpperCase(py); } this.empty(); - while (true) { + // BI-48487 性能: makeFirstPY出来的py中包含多音字是必要的,但虽然此方法中做了限制。但是对于一个长度为60,包含14个多音字的字符串 + // 获取的的py长度将达到1966080, 远超过text的长度,到后面都是在做"".substring的无用功,所以此循环应保证py和textLeft长度不为0 + while (py.length > 0 && textLeft.length > 0) { var tidx = BI.toUpperCase(textLeft).indexOf(keyword); var pidx = null; if (py != null) { @@ -47676,7 +47678,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { type: "bi.text_button", cls: "bi-water-mark cursor-default", textAlign: "left", - height: 20, + whiteSpace: "normal", text: o.watermark, invalid: o.invalid, disabled: o.disabled @@ -57426,73 +57428,7 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, { } }); BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);/** - * @class BI.SmallTextValueCheckCombo - * @extend BI.Widget - * combo : text + icon, popup : check + text - */ -BI.SmallTextValueCheckCombo = BI.inherit(BI.Widget, { - _defaultConfig: function () { - return BI.extend(BI.SmallTextValueCheckCombo.superclass._defaultConfig.apply(this, arguments), { - width: 100, - height: 24, - chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, - text: "" - }); - }, - - _init: function () { - BI.SmallTextValueCheckCombo.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.trigger = BI.createWidget({ - type: "bi.small_select_text_trigger", - items: o.items, - height: o.height, - text: o.text, - value: o.value - }); - this.popup = BI.createWidget({ - type: "bi.text_value_check_combo_popup", - chooseType: o.chooseType, - items: o.items, - value: o.value - }); - this.popup.on(BI.TextValueCheckComboPopup.EVENT_CHANGE, function () { - self.setValue(self.popup.getValue()); - self.SmallTextIconCheckCombo.hideView(); - self.fireEvent(BI.SmallTextValueCheckCombo.EVENT_CHANGE); - }); - this.popup.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); - this.SmallTextIconCheckCombo = BI.createWidget({ - type: "bi.combo", - container: o.container, - element: this, - adjustLength: 2, - el: this.trigger, - popup: { - el: this.popup, - maxHeight: 300 - } - }); - }, - - setValue: function (v) { - this.SmallTextIconCheckCombo.setValue(v); - }, - - getValue: function () { - return this.popup.getValue(); - }, - - populate: function (items) { - this.options.items = items; - this.SmallTextIconCheckCombo.populate(items); - } -}); -BI.SmallTextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.small_text_value_check_combo", BI.SmallTextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, { +BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, { _defaultConfig: function () { return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-text-icon-popup", @@ -58711,7 +58647,7 @@ BI.StateEditor = BI.inherit(BI.Widget, { }); this.text = BI.createWidget({ type: "bi.text_button", - cls: "state-editor-infinite-text tip-text-style", + cls: "bi-water-mark tip-text-style", textAlign: "left", height: o.height, text: o.text, @@ -58908,31 +58844,31 @@ BI.StateEditor = BI.inherit(BI.Widget, { if (BI.isNumber(v)) { if (v === BI.Selection.All) { this.text.setText(BI.i18nText("BI-Select_All")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else if (v === BI.Selection.Multi) { this.text.setText(BI.i18nText("BI-Select_Part")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } return; } if (BI.isString(v)) { this.text.setText(v); - this.text.element.removeClass("state-editor-infinite-text"); + v === o.text ? this.text.element.addClass("bi-water-mark") : this.text.element.removeClass("bi-water-mark"); return; } if (BI.isArray(v)) { if (BI.isEmpty(v)) { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } else if (v.length === 1) { this.text.setText(v[0]); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else { this.text.setText(BI.i18nText("BI-Select_Part")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } } }, @@ -59010,7 +58946,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { }); this.text = BI.createWidget({ type: "bi.text_button", - cls: "state-editor-infinite-text", + cls: "bi-water-mark", textAlign: "left", text: o.text, height: o.height, @@ -59192,26 +59128,26 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { if (BI.isNumber(v)) { if (v === BI.Selection.All) { this.text.setText(BI.i18nText("BI-Already_Selected")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else if (v === BI.Selection.Multi) { this.text.setText(BI.i18nText("BI-Already_Selected")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } return; } if (!BI.isArray(v) || v.length === 1) { this.text.setText(v); this.text.setTitle(v); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else if (BI.isEmpty(v)) { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } else { this.text.setText(BI.i18nText("BI-Already_Selected")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } } }); @@ -61972,7 +61908,8 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { baseCls: (conf.baseCls || "") + " bi-text-trigger", height: 24, iconHeight: null, - iconWidth: null + iconWidth: null, + textCls: "" }); }, @@ -61981,7 +61918,7 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options, c = this._const; this.text = BI.createWidget({ type: "bi.label", - cls: "select-text-label", + cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""), textAlign: "left", height: o.height, text: o.text @@ -62046,6 +61983,12 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { } }, + setTextCls: function(cls) { + var o = this.options; + this.text.element.removeClass(o.textCls).addClass(cls); + o.textCls = cls; + }, + setText: function (text) { this.text.setText(text); } @@ -62074,6 +62017,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, { type: "bi.icon_text_trigger", element: this, text: obj.text, + textCls: obj.textCls, iconCls: obj.iconCls, height: o.height, iconHeight: o.iconHeight, @@ -62100,11 +62044,13 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, { if (BI.isNotNull(result)) { return { text: result.text, + textCls: "", iconCls: result.iconCls }; } else { return { text: o.text, + textCls: "bi-water-mark", iconCls: o.iconCls }; } @@ -62114,6 +62060,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, { var obj = this._digist(vals, this.options.items); this.trigger.setText(obj.text); this.trigger.setIcon(obj.iconCls); + this.trigger.setTextCls(obj.textCls); }, populate: function (items) { @@ -62136,7 +62083,8 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-text-trigger", - height: 24 + height: 24, + textCls: "" }); }, @@ -62145,7 +62093,7 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options, c = this._const; this.text = BI.createWidget({ type: "bi.label", - cls: "select-text-label", + cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""), textAlign: "left", height: o.height, text: o.text, @@ -62176,6 +62124,12 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { }); }, + setTextCls: function(cls) { + var o = this.options; + this.text.element.removeClass(o.textCls).addClass(cls); + o.textCls = cls; + }, + setText: function (text) { this.text.setText(text); }, @@ -62205,12 +62159,14 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { this.options.height -= 2; BI.SelectTextTrigger.superclass._init.apply(this, arguments); var self = this, o = this.options; + var obj = this._digest(o.text, o.items); this.trigger = BI.createWidget({ type: "bi.text_trigger", element: this, height: o.height, readonly: o.readonly, - text: this._digest(o.value, o.items), + text: obj.text, + textCls: obj.textCls, tipType: o.tipType, warningTitle: o.warningTitle }); @@ -62228,14 +62184,22 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { }); if (result.length > 0) { - return result.join(","); + return { + textCls: "", + text: result.join(",") + } } else { - return BI.isFunction(o.text) ? o.text() : o.text; + return { + textCls: "bi-water-mark", + text: BI.isFunction(o.text) ? o.text() : o.text + } } }, setValue: function (vals) { - this.trigger.setText(this._digest(vals, this.options.items)); + var formatValue = this._digest(vals, this.options.items); + this.trigger.setTextCls(formatValue.textCls); + this.trigger.setText(formatValue.text); }, setTipType: function (v) { @@ -85422,6 +85386,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear }, _createMonths: function () { + var self = this; // 纵向排列月 var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12]; var items = []; @@ -85443,7 +85408,10 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear height: 23, width: 38, value: td, - text: td + text: td, + ref: function (_ref) { + self.monthMap[j === 0 ? i : i + 6] = _ref; + } }; }); }); @@ -85451,10 +85419,13 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear render: function () { var self = this, o = this.options; + this.monthMap = {}; return { type: "bi.vertical", items: [{ type: "bi.year_picker", + min: o.min, + max: o.max, ref: function () { self.yearPicker = this; }, @@ -85464,6 +85435,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear eventName: BI.YearPicker.EVENT_CHANGE, action: function () { var value = this.getValue(); + self._checkMonthStatus(value); self.setValue({ year: value, month: self.selectedMonth @@ -85503,6 +85475,23 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear }; }, + mounted: function() { + this._checkMonthStatus(this.selectedYear); + }, + + _checkMonthStatus: function (year) { + var o = this.options; + var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"), maxDate = BI.parseDateTime(o.max, "%Y-%X-%d"); + var minYear = minDate.getFullYear(), maxYear = maxDate.getFullYear(); + var minMonth = 0; var maxMonth = 11; + minYear === year && (minMonth = minDate.getMonth()); + maxYear === year && (maxMonth = maxDate.getMonth()); + var yearInvalid = year < minYear || year > maxYear; + BI.each(this.monthMap, function (month, obj) { + var monthInvalid = month < minMonth || month > maxMonth; + obj.setEnable(!yearInvalid && !monthInvalid); + }); + }, getValue: function () { return { @@ -85537,8 +85526,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { props: { baseCls: "bi-year-month-combo bi-border bi-focus-shadow", behaviors: {}, - min: "1900-01-01", // 最小日期 - max: "2099-12-31", // 最大日期 + minDate: "1900-01-01", // 最小日期 + maxDate: "2099-12-31", // 最大日期 height: 22 }, @@ -85549,8 +85538,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { this.storeTriggerValue = ""; this.trigger = BI.createWidget({ type: "bi.dynamic_year_month_trigger", - min: o.min, - max: o.max, + min: o.minDate, + max: o.maxDate, height: o.height, value: o.value || "" }); @@ -85634,8 +85623,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { } }], behaviors: o.behaviors, - min: o.min, - max: o.max + min: o.minDate, + max: o.maxDate }, value: o.value || "" } @@ -85989,12 +85978,13 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY _createEditor: function (isYear) { var self = this, o = this.options, c = this._const; + var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"); var editor = BI.createWidget({ type: "bi.sign_editor", height: o.height, validationChecker: function (v) { if(isYear) { - return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, 1, 1, o.min, o.max)[0]); + return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, v === minDate.getFullYear() ? minDate.getMonth() + 1 : 1, 1, o.min, o.max)[0]); } return v === "" || ((BI.isPositiveInteger(v) && v >= 1 && v <= 12) && !BI.checkDateVoid(BI.getDate().getFullYear(), v, 1, o.min, o.max)[0]); }, diff --git a/dist/base.js b/dist/base.js index 6a93ee117..ee6761a36 100644 --- a/dist/base.js +++ b/dist/base.js @@ -9412,7 +9412,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { type: "bi.text_button", cls: "bi-water-mark cursor-default", textAlign: "left", - height: 20, + whiteSpace: "normal", text: o.watermark, invalid: o.invalid, disabled: o.disabled diff --git a/dist/bundle.ie.js b/dist/bundle.ie.js index 66ebe5e51..637b26551 100644 --- a/dist/bundle.ie.js +++ b/dist/bundle.ie.js @@ -32414,7 +32414,9 @@ $.extend($.Event.prototype, { py = BI.toUpperCase(py); } this.empty(); - while (true) { + // BI-48487 性能: makeFirstPY出来的py中包含多音字是必要的,但虽然此方法中做了限制。但是对于一个长度为60,包含14个多音字的字符串 + // 获取的的py长度将达到1966080, 远超过text的长度,到后面都是在做"".substring的无用功,所以此循环应保证py和textLeft长度不为0 + while (py.length > 0 && textLeft.length > 0) { var tidx = BI.toUpperCase(textLeft).indexOf(keyword); var pidx = null; if (py != null) { @@ -47272,7 +47274,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { type: "bi.text_button", cls: "bi-water-mark cursor-default", textAlign: "left", - height: 20, + whiteSpace: "normal", text: o.watermark, invalid: o.invalid, disabled: o.disabled @@ -57022,73 +57024,7 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, { } }); BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);/** - * @class BI.SmallTextValueCheckCombo - * @extend BI.Widget - * combo : text + icon, popup : check + text - */ -BI.SmallTextValueCheckCombo = BI.inherit(BI.Widget, { - _defaultConfig: function () { - return BI.extend(BI.SmallTextValueCheckCombo.superclass._defaultConfig.apply(this, arguments), { - width: 100, - height: 24, - chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, - text: "" - }); - }, - - _init: function () { - BI.SmallTextValueCheckCombo.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.trigger = BI.createWidget({ - type: "bi.small_select_text_trigger", - items: o.items, - height: o.height, - text: o.text, - value: o.value - }); - this.popup = BI.createWidget({ - type: "bi.text_value_check_combo_popup", - chooseType: o.chooseType, - items: o.items, - value: o.value - }); - this.popup.on(BI.TextValueCheckComboPopup.EVENT_CHANGE, function () { - self.setValue(self.popup.getValue()); - self.SmallTextIconCheckCombo.hideView(); - self.fireEvent(BI.SmallTextValueCheckCombo.EVENT_CHANGE); - }); - this.popup.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); - this.SmallTextIconCheckCombo = BI.createWidget({ - type: "bi.combo", - container: o.container, - element: this, - adjustLength: 2, - el: this.trigger, - popup: { - el: this.popup, - maxHeight: 300 - } - }); - }, - - setValue: function (v) { - this.SmallTextIconCheckCombo.setValue(v); - }, - - getValue: function () { - return this.popup.getValue(); - }, - - populate: function (items) { - this.options.items = items; - this.SmallTextIconCheckCombo.populate(items); - } -}); -BI.SmallTextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.small_text_value_check_combo", BI.SmallTextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, { +BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, { _defaultConfig: function () { return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-text-icon-popup", @@ -58307,7 +58243,7 @@ BI.StateEditor = BI.inherit(BI.Widget, { }); this.text = BI.createWidget({ type: "bi.text_button", - cls: "state-editor-infinite-text tip-text-style", + cls: "bi-water-mark tip-text-style", textAlign: "left", height: o.height, text: o.text, @@ -58504,31 +58440,31 @@ BI.StateEditor = BI.inherit(BI.Widget, { if (BI.isNumber(v)) { if (v === BI.Selection.All) { this.text.setText(BI.i18nText("BI-Select_All")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else if (v === BI.Selection.Multi) { this.text.setText(BI.i18nText("BI-Select_Part")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } return; } if (BI.isString(v)) { this.text.setText(v); - this.text.element.removeClass("state-editor-infinite-text"); + v === o.text ? this.text.element.addClass("bi-water-mark") : this.text.element.removeClass("bi-water-mark"); return; } if (BI.isArray(v)) { if (BI.isEmpty(v)) { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } else if (v.length === 1) { this.text.setText(v[0]); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else { this.text.setText(BI.i18nText("BI-Select_Part")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } } }, @@ -58606,7 +58542,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { }); this.text = BI.createWidget({ type: "bi.text_button", - cls: "state-editor-infinite-text", + cls: "bi-water-mark", textAlign: "left", text: o.text, height: o.height, @@ -58788,26 +58724,26 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { if (BI.isNumber(v)) { if (v === BI.Selection.All) { this.text.setText(BI.i18nText("BI-Already_Selected")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else if (v === BI.Selection.Multi) { this.text.setText(BI.i18nText("BI-Already_Selected")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } return; } if (!BI.isArray(v) || v.length === 1) { this.text.setText(v); this.text.setTitle(v); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else if (BI.isEmpty(v)) { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } else { this.text.setText(BI.i18nText("BI-Already_Selected")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } } }); @@ -61568,7 +61504,8 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { baseCls: (conf.baseCls || "") + " bi-text-trigger", height: 24, iconHeight: null, - iconWidth: null + iconWidth: null, + textCls: "" }); }, @@ -61577,7 +61514,7 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options, c = this._const; this.text = BI.createWidget({ type: "bi.label", - cls: "select-text-label", + cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""), textAlign: "left", height: o.height, text: o.text @@ -61642,6 +61579,12 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { } }, + setTextCls: function(cls) { + var o = this.options; + this.text.element.removeClass(o.textCls).addClass(cls); + o.textCls = cls; + }, + setText: function (text) { this.text.setText(text); } @@ -61670,6 +61613,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, { type: "bi.icon_text_trigger", element: this, text: obj.text, + textCls: obj.textCls, iconCls: obj.iconCls, height: o.height, iconHeight: o.iconHeight, @@ -61696,11 +61640,13 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, { if (BI.isNotNull(result)) { return { text: result.text, + textCls: "", iconCls: result.iconCls }; } else { return { text: o.text, + textCls: "bi-water-mark", iconCls: o.iconCls }; } @@ -61710,6 +61656,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, { var obj = this._digist(vals, this.options.items); this.trigger.setText(obj.text); this.trigger.setIcon(obj.iconCls); + this.trigger.setTextCls(obj.textCls); }, populate: function (items) { @@ -61732,7 +61679,8 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-text-trigger", - height: 24 + height: 24, + textCls: "" }); }, @@ -61741,7 +61689,7 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options, c = this._const; this.text = BI.createWidget({ type: "bi.label", - cls: "select-text-label", + cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""), textAlign: "left", height: o.height, text: o.text, @@ -61772,6 +61720,12 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { }); }, + setTextCls: function(cls) { + var o = this.options; + this.text.element.removeClass(o.textCls).addClass(cls); + o.textCls = cls; + }, + setText: function (text) { this.text.setText(text); }, @@ -61801,12 +61755,14 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { this.options.height -= 2; BI.SelectTextTrigger.superclass._init.apply(this, arguments); var self = this, o = this.options; + var obj = this._digest(o.text, o.items); this.trigger = BI.createWidget({ type: "bi.text_trigger", element: this, height: o.height, readonly: o.readonly, - text: this._digest(o.value, o.items), + text: obj.text, + textCls: obj.textCls, tipType: o.tipType, warningTitle: o.warningTitle }); @@ -61824,14 +61780,22 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { }); if (result.length > 0) { - return result.join(","); + return { + textCls: "", + text: result.join(",") + } } else { - return BI.isFunction(o.text) ? o.text() : o.text; + return { + textCls: "bi-water-mark", + text: BI.isFunction(o.text) ? o.text() : o.text + } } }, setValue: function (vals) { - this.trigger.setText(this._digest(vals, this.options.items)); + var formatValue = this._digest(vals, this.options.items); + this.trigger.setTextCls(formatValue.textCls); + this.trigger.setText(formatValue.text); }, setTipType: function (v) { @@ -85018,6 +84982,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear }, _createMonths: function () { + var self = this; // 纵向排列月 var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12]; var items = []; @@ -85039,7 +85004,10 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear height: 23, width: 38, value: td, - text: td + text: td, + ref: function (_ref) { + self.monthMap[j === 0 ? i : i + 6] = _ref; + } }; }); }); @@ -85047,10 +85015,13 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear render: function () { var self = this, o = this.options; + this.monthMap = {}; return { type: "bi.vertical", items: [{ type: "bi.year_picker", + min: o.min, + max: o.max, ref: function () { self.yearPicker = this; }, @@ -85060,6 +85031,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear eventName: BI.YearPicker.EVENT_CHANGE, action: function () { var value = this.getValue(); + self._checkMonthStatus(value); self.setValue({ year: value, month: self.selectedMonth @@ -85099,6 +85071,23 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear }; }, + mounted: function() { + this._checkMonthStatus(this.selectedYear); + }, + + _checkMonthStatus: function (year) { + var o = this.options; + var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"), maxDate = BI.parseDateTime(o.max, "%Y-%X-%d"); + var minYear = minDate.getFullYear(), maxYear = maxDate.getFullYear(); + var minMonth = 0; var maxMonth = 11; + minYear === year && (minMonth = minDate.getMonth()); + maxYear === year && (maxMonth = maxDate.getMonth()); + var yearInvalid = year < minYear || year > maxYear; + BI.each(this.monthMap, function (month, obj) { + var monthInvalid = month < minMonth || month > maxMonth; + obj.setEnable(!yearInvalid && !monthInvalid); + }); + }, getValue: function () { return { @@ -85133,8 +85122,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { props: { baseCls: "bi-year-month-combo bi-border bi-focus-shadow", behaviors: {}, - min: "1900-01-01", // 最小日期 - max: "2099-12-31", // 最大日期 + minDate: "1900-01-01", // 最小日期 + maxDate: "2099-12-31", // 最大日期 height: 22 }, @@ -85145,8 +85134,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { this.storeTriggerValue = ""; this.trigger = BI.createWidget({ type: "bi.dynamic_year_month_trigger", - min: o.min, - max: o.max, + min: o.minDate, + max: o.maxDate, height: o.height, value: o.value || "" }); @@ -85230,8 +85219,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { } }], behaviors: o.behaviors, - min: o.min, - max: o.max + min: o.minDate, + max: o.maxDate }, value: o.value || "" } @@ -85585,12 +85574,13 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY _createEditor: function (isYear) { var self = this, o = this.options, c = this._const; + var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"); var editor = BI.createWidget({ type: "bi.sign_editor", height: o.height, validationChecker: function (v) { if(isYear) { - return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, 1, 1, o.min, o.max)[0]); + return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, v === minDate.getFullYear() ? minDate.getMonth() + 1 : 1, 1, o.min, o.max)[0]); } return v === "" || ((BI.isPositiveInteger(v) && v >= 1 && v <= 12) && !BI.checkDateVoid(BI.getDate().getFullYear(), v, 1, o.min, o.max)[0]); }, diff --git a/dist/bundle.js b/dist/bundle.js index f1b910b43..578970220 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -32414,7 +32414,9 @@ $.extend($.Event.prototype, { py = BI.toUpperCase(py); } this.empty(); - while (true) { + // BI-48487 性能: makeFirstPY出来的py中包含多音字是必要的,但虽然此方法中做了限制。但是对于一个长度为60,包含14个多音字的字符串 + // 获取的的py长度将达到1966080, 远超过text的长度,到后面都是在做"".substring的无用功,所以此循环应保证py和textLeft长度不为0 + while (py.length > 0 && textLeft.length > 0) { var tidx = BI.toUpperCase(textLeft).indexOf(keyword); var pidx = null; if (py != null) { @@ -47676,7 +47678,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { type: "bi.text_button", cls: "bi-water-mark cursor-default", textAlign: "left", - height: 20, + whiteSpace: "normal", text: o.watermark, invalid: o.invalid, disabled: o.disabled @@ -57426,73 +57428,7 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, { } }); BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);/** - * @class BI.SmallTextValueCheckCombo - * @extend BI.Widget - * combo : text + icon, popup : check + text - */ -BI.SmallTextValueCheckCombo = BI.inherit(BI.Widget, { - _defaultConfig: function () { - return BI.extend(BI.SmallTextValueCheckCombo.superclass._defaultConfig.apply(this, arguments), { - width: 100, - height: 24, - chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, - text: "" - }); - }, - - _init: function () { - BI.SmallTextValueCheckCombo.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.trigger = BI.createWidget({ - type: "bi.small_select_text_trigger", - items: o.items, - height: o.height, - text: o.text, - value: o.value - }); - this.popup = BI.createWidget({ - type: "bi.text_value_check_combo_popup", - chooseType: o.chooseType, - items: o.items, - value: o.value - }); - this.popup.on(BI.TextValueCheckComboPopup.EVENT_CHANGE, function () { - self.setValue(self.popup.getValue()); - self.SmallTextIconCheckCombo.hideView(); - self.fireEvent(BI.SmallTextValueCheckCombo.EVENT_CHANGE); - }); - this.popup.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); - this.SmallTextIconCheckCombo = BI.createWidget({ - type: "bi.combo", - container: o.container, - element: this, - adjustLength: 2, - el: this.trigger, - popup: { - el: this.popup, - maxHeight: 300 - } - }); - }, - - setValue: function (v) { - this.SmallTextIconCheckCombo.setValue(v); - }, - - getValue: function () { - return this.popup.getValue(); - }, - - populate: function (items) { - this.options.items = items; - this.SmallTextIconCheckCombo.populate(items); - } -}); -BI.SmallTextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.small_text_value_check_combo", BI.SmallTextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, { +BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, { _defaultConfig: function () { return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-text-icon-popup", @@ -58711,7 +58647,7 @@ BI.StateEditor = BI.inherit(BI.Widget, { }); this.text = BI.createWidget({ type: "bi.text_button", - cls: "state-editor-infinite-text tip-text-style", + cls: "bi-water-mark tip-text-style", textAlign: "left", height: o.height, text: o.text, @@ -58908,31 +58844,31 @@ BI.StateEditor = BI.inherit(BI.Widget, { if (BI.isNumber(v)) { if (v === BI.Selection.All) { this.text.setText(BI.i18nText("BI-Select_All")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else if (v === BI.Selection.Multi) { this.text.setText(BI.i18nText("BI-Select_Part")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } return; } if (BI.isString(v)) { this.text.setText(v); - this.text.element.removeClass("state-editor-infinite-text"); + v === o.text ? this.text.element.addClass("bi-water-mark") : this.text.element.removeClass("bi-water-mark"); return; } if (BI.isArray(v)) { if (BI.isEmpty(v)) { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } else if (v.length === 1) { this.text.setText(v[0]); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else { this.text.setText(BI.i18nText("BI-Select_Part")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } } }, @@ -59010,7 +58946,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { }); this.text = BI.createWidget({ type: "bi.text_button", - cls: "state-editor-infinite-text", + cls: "bi-water-mark", textAlign: "left", text: o.text, height: o.height, @@ -59192,26 +59128,26 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { if (BI.isNumber(v)) { if (v === BI.Selection.All) { this.text.setText(BI.i18nText("BI-Already_Selected")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else if (v === BI.Selection.Multi) { this.text.setText(BI.i18nText("BI-Already_Selected")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } return; } if (!BI.isArray(v) || v.length === 1) { this.text.setText(v); this.text.setTitle(v); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else if (BI.isEmpty(v)) { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } else { this.text.setText(BI.i18nText("BI-Already_Selected")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } } }); @@ -61972,7 +61908,8 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { baseCls: (conf.baseCls || "") + " bi-text-trigger", height: 24, iconHeight: null, - iconWidth: null + iconWidth: null, + textCls: "" }); }, @@ -61981,7 +61918,7 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options, c = this._const; this.text = BI.createWidget({ type: "bi.label", - cls: "select-text-label", + cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""), textAlign: "left", height: o.height, text: o.text @@ -62046,6 +61983,12 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { } }, + setTextCls: function(cls) { + var o = this.options; + this.text.element.removeClass(o.textCls).addClass(cls); + o.textCls = cls; + }, + setText: function (text) { this.text.setText(text); } @@ -62074,6 +62017,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, { type: "bi.icon_text_trigger", element: this, text: obj.text, + textCls: obj.textCls, iconCls: obj.iconCls, height: o.height, iconHeight: o.iconHeight, @@ -62100,11 +62044,13 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, { if (BI.isNotNull(result)) { return { text: result.text, + textCls: "", iconCls: result.iconCls }; } else { return { text: o.text, + textCls: "bi-water-mark", iconCls: o.iconCls }; } @@ -62114,6 +62060,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, { var obj = this._digist(vals, this.options.items); this.trigger.setText(obj.text); this.trigger.setIcon(obj.iconCls); + this.trigger.setTextCls(obj.textCls); }, populate: function (items) { @@ -62136,7 +62083,8 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-text-trigger", - height: 24 + height: 24, + textCls: "" }); }, @@ -62145,7 +62093,7 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options, c = this._const; this.text = BI.createWidget({ type: "bi.label", - cls: "select-text-label", + cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""), textAlign: "left", height: o.height, text: o.text, @@ -62176,6 +62124,12 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { }); }, + setTextCls: function(cls) { + var o = this.options; + this.text.element.removeClass(o.textCls).addClass(cls); + o.textCls = cls; + }, + setText: function (text) { this.text.setText(text); }, @@ -62205,12 +62159,14 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { this.options.height -= 2; BI.SelectTextTrigger.superclass._init.apply(this, arguments); var self = this, o = this.options; + var obj = this._digest(o.text, o.items); this.trigger = BI.createWidget({ type: "bi.text_trigger", element: this, height: o.height, readonly: o.readonly, - text: this._digest(o.value, o.items), + text: obj.text, + textCls: obj.textCls, tipType: o.tipType, warningTitle: o.warningTitle }); @@ -62228,14 +62184,22 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { }); if (result.length > 0) { - return result.join(","); + return { + textCls: "", + text: result.join(",") + } } else { - return BI.isFunction(o.text) ? o.text() : o.text; + return { + textCls: "bi-water-mark", + text: BI.isFunction(o.text) ? o.text() : o.text + } } }, setValue: function (vals) { - this.trigger.setText(this._digest(vals, this.options.items)); + var formatValue = this._digest(vals, this.options.items); + this.trigger.setTextCls(formatValue.textCls); + this.trigger.setText(formatValue.text); }, setTipType: function (v) { @@ -85422,6 +85386,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear }, _createMonths: function () { + var self = this; // 纵向排列月 var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12]; var items = []; @@ -85443,7 +85408,10 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear height: 23, width: 38, value: td, - text: td + text: td, + ref: function (_ref) { + self.monthMap[j === 0 ? i : i + 6] = _ref; + } }; }); }); @@ -85451,10 +85419,13 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear render: function () { var self = this, o = this.options; + this.monthMap = {}; return { type: "bi.vertical", items: [{ type: "bi.year_picker", + min: o.min, + max: o.max, ref: function () { self.yearPicker = this; }, @@ -85464,6 +85435,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear eventName: BI.YearPicker.EVENT_CHANGE, action: function () { var value = this.getValue(); + self._checkMonthStatus(value); self.setValue({ year: value, month: self.selectedMonth @@ -85503,6 +85475,23 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear }; }, + mounted: function() { + this._checkMonthStatus(this.selectedYear); + }, + + _checkMonthStatus: function (year) { + var o = this.options; + var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"), maxDate = BI.parseDateTime(o.max, "%Y-%X-%d"); + var minYear = minDate.getFullYear(), maxYear = maxDate.getFullYear(); + var minMonth = 0; var maxMonth = 11; + minYear === year && (minMonth = minDate.getMonth()); + maxYear === year && (maxMonth = maxDate.getMonth()); + var yearInvalid = year < minYear || year > maxYear; + BI.each(this.monthMap, function (month, obj) { + var monthInvalid = month < minMonth || month > maxMonth; + obj.setEnable(!yearInvalid && !monthInvalid); + }); + }, getValue: function () { return { @@ -85537,8 +85526,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { props: { baseCls: "bi-year-month-combo bi-border bi-focus-shadow", behaviors: {}, - min: "1900-01-01", // 最小日期 - max: "2099-12-31", // 最大日期 + minDate: "1900-01-01", // 最小日期 + maxDate: "2099-12-31", // 最大日期 height: 22 }, @@ -85549,8 +85538,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { this.storeTriggerValue = ""; this.trigger = BI.createWidget({ type: "bi.dynamic_year_month_trigger", - min: o.min, - max: o.max, + min: o.minDate, + max: o.maxDate, height: o.height, value: o.value || "" }); @@ -85634,8 +85623,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { } }], behaviors: o.behaviors, - min: o.min, - max: o.max + min: o.minDate, + max: o.maxDate }, value: o.value || "" } @@ -85989,12 +85978,13 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY _createEditor: function (isYear) { var self = this, o = this.options, c = this._const; + var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"); var editor = BI.createWidget({ type: "bi.sign_editor", height: o.height, validationChecker: function (v) { if(isYear) { - return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, 1, 1, o.min, o.max)[0]); + return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, v === minDate.getFullYear() ? minDate.getMonth() + 1 : 1, 1, o.min, o.max)[0]); } return v === "" || ((BI.isPositiveInteger(v) && v >= 1 && v <= 12) && !BI.checkDateVoid(BI.getDate().getFullYear(), v, 1, o.min, o.max)[0]); }, diff --git a/dist/case.js b/dist/case.js index 7538932a5..79200c8b2 100644 --- a/dist/case.js +++ b/dist/case.js @@ -5004,73 +5004,7 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, { } }); BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);/** - * @class BI.SmallTextValueCheckCombo - * @extend BI.Widget - * combo : text + icon, popup : check + text - */ -BI.SmallTextValueCheckCombo = BI.inherit(BI.Widget, { - _defaultConfig: function () { - return BI.extend(BI.SmallTextValueCheckCombo.superclass._defaultConfig.apply(this, arguments), { - width: 100, - height: 24, - chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, - text: "" - }); - }, - - _init: function () { - BI.SmallTextValueCheckCombo.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.trigger = BI.createWidget({ - type: "bi.small_select_text_trigger", - items: o.items, - height: o.height, - text: o.text, - value: o.value - }); - this.popup = BI.createWidget({ - type: "bi.text_value_check_combo_popup", - chooseType: o.chooseType, - items: o.items, - value: o.value - }); - this.popup.on(BI.TextValueCheckComboPopup.EVENT_CHANGE, function () { - self.setValue(self.popup.getValue()); - self.SmallTextIconCheckCombo.hideView(); - self.fireEvent(BI.SmallTextValueCheckCombo.EVENT_CHANGE); - }); - this.popup.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); - this.SmallTextIconCheckCombo = BI.createWidget({ - type: "bi.combo", - container: o.container, - element: this, - adjustLength: 2, - el: this.trigger, - popup: { - el: this.popup, - maxHeight: 300 - } - }); - }, - - setValue: function (v) { - this.SmallTextIconCheckCombo.setValue(v); - }, - - getValue: function () { - return this.popup.getValue(); - }, - - populate: function (items) { - this.options.items = items; - this.SmallTextIconCheckCombo.populate(items); - } -}); -BI.SmallTextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.small_text_value_check_combo", BI.SmallTextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, { +BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, { _defaultConfig: function () { return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-text-icon-popup", @@ -6289,7 +6223,7 @@ BI.StateEditor = BI.inherit(BI.Widget, { }); this.text = BI.createWidget({ type: "bi.text_button", - cls: "state-editor-infinite-text tip-text-style", + cls: "bi-water-mark tip-text-style", textAlign: "left", height: o.height, text: o.text, @@ -6486,31 +6420,31 @@ BI.StateEditor = BI.inherit(BI.Widget, { if (BI.isNumber(v)) { if (v === BI.Selection.All) { this.text.setText(BI.i18nText("BI-Select_All")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else if (v === BI.Selection.Multi) { this.text.setText(BI.i18nText("BI-Select_Part")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } return; } if (BI.isString(v)) { this.text.setText(v); - this.text.element.removeClass("state-editor-infinite-text"); + v === o.text ? this.text.element.addClass("bi-water-mark") : this.text.element.removeClass("bi-water-mark"); return; } if (BI.isArray(v)) { if (BI.isEmpty(v)) { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } else if (v.length === 1) { this.text.setText(v[0]); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else { this.text.setText(BI.i18nText("BI-Select_Part")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } } }, @@ -6588,7 +6522,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { }); this.text = BI.createWidget({ type: "bi.text_button", - cls: "state-editor-infinite-text", + cls: "bi-water-mark", textAlign: "left", text: o.text, height: o.height, @@ -6770,26 +6704,26 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { if (BI.isNumber(v)) { if (v === BI.Selection.All) { this.text.setText(BI.i18nText("BI-Already_Selected")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else if (v === BI.Selection.Multi) { this.text.setText(BI.i18nText("BI-Already_Selected")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } return; } if (!BI.isArray(v) || v.length === 1) { this.text.setText(v); this.text.setTitle(v); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else if (BI.isEmpty(v)) { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } else { this.text.setText(BI.i18nText("BI-Already_Selected")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } } }); @@ -9550,7 +9484,8 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { baseCls: (conf.baseCls || "") + " bi-text-trigger", height: 24, iconHeight: null, - iconWidth: null + iconWidth: null, + textCls: "" }); }, @@ -9559,7 +9494,7 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options, c = this._const; this.text = BI.createWidget({ type: "bi.label", - cls: "select-text-label", + cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""), textAlign: "left", height: o.height, text: o.text @@ -9624,6 +9559,12 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { } }, + setTextCls: function(cls) { + var o = this.options; + this.text.element.removeClass(o.textCls).addClass(cls); + o.textCls = cls; + }, + setText: function (text) { this.text.setText(text); } @@ -9652,6 +9593,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, { type: "bi.icon_text_trigger", element: this, text: obj.text, + textCls: obj.textCls, iconCls: obj.iconCls, height: o.height, iconHeight: o.iconHeight, @@ -9678,11 +9620,13 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, { if (BI.isNotNull(result)) { return { text: result.text, + textCls: "", iconCls: result.iconCls }; } else { return { text: o.text, + textCls: "bi-water-mark", iconCls: o.iconCls }; } @@ -9692,6 +9636,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, { var obj = this._digist(vals, this.options.items); this.trigger.setText(obj.text); this.trigger.setIcon(obj.iconCls); + this.trigger.setTextCls(obj.textCls); }, populate: function (items) { @@ -9714,7 +9659,8 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-text-trigger", - height: 24 + height: 24, + textCls: "" }); }, @@ -9723,7 +9669,7 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options, c = this._const; this.text = BI.createWidget({ type: "bi.label", - cls: "select-text-label", + cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""), textAlign: "left", height: o.height, text: o.text, @@ -9754,6 +9700,12 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { }); }, + setTextCls: function(cls) { + var o = this.options; + this.text.element.removeClass(o.textCls).addClass(cls); + o.textCls = cls; + }, + setText: function (text) { this.text.setText(text); }, @@ -9783,12 +9735,14 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { this.options.height -= 2; BI.SelectTextTrigger.superclass._init.apply(this, arguments); var self = this, o = this.options; + var obj = this._digest(o.text, o.items); this.trigger = BI.createWidget({ type: "bi.text_trigger", element: this, height: o.height, readonly: o.readonly, - text: this._digest(o.value, o.items), + text: obj.text, + textCls: obj.textCls, tipType: o.tipType, warningTitle: o.warningTitle }); @@ -9806,14 +9760,22 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { }); if (result.length > 0) { - return result.join(","); + return { + textCls: "", + text: result.join(",") + } } else { - return BI.isFunction(o.text) ? o.text() : o.text; + return { + textCls: "bi-water-mark", + text: BI.isFunction(o.text) ? o.text() : o.text + } } }, setValue: function (vals) { - this.trigger.setText(this._digest(vals, this.options.items)); + var formatValue = this._digest(vals, this.options.items); + this.trigger.setTextCls(formatValue.textCls); + this.trigger.setText(formatValue.text); }, setTipType: function (v) { diff --git a/dist/core.js b/dist/core.js index 86c1c9b1f..af515fc70 100644 --- a/dist/core.js +++ b/dist/core.js @@ -32414,7 +32414,9 @@ $.extend($.Event.prototype, { py = BI.toUpperCase(py); } this.empty(); - while (true) { + // BI-48487 性能: makeFirstPY出来的py中包含多音字是必要的,但虽然此方法中做了限制。但是对于一个长度为60,包含14个多音字的字符串 + // 获取的的py长度将达到1966080, 远超过text的长度,到后面都是在做"".substring的无用功,所以此循环应保证py和textLeft长度不为0 + while (py.length > 0 && textLeft.length > 0) { var tidx = BI.toUpperCase(textLeft).indexOf(keyword); var pidx = null; if (py != null) { diff --git a/dist/fineui.ie.js b/dist/fineui.ie.js index 3fe57fb75..c70d42081 100644 --- a/dist/fineui.ie.js +++ b/dist/fineui.ie.js @@ -32659,7 +32659,9 @@ $.extend($.Event.prototype, { py = BI.toUpperCase(py); } this.empty(); - while (true) { + // BI-48487 性能: makeFirstPY出来的py中包含多音字是必要的,但虽然此方法中做了限制。但是对于一个长度为60,包含14个多音字的字符串 + // 获取的的py长度将达到1966080, 远超过text的长度,到后面都是在做"".substring的无用功,所以此循环应保证py和textLeft长度不为0 + while (py.length > 0 && textLeft.length > 0) { var tidx = BI.toUpperCase(textLeft).indexOf(keyword); var pidx = null; if (py != null) { @@ -47517,7 +47519,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { type: "bi.text_button", cls: "bi-water-mark cursor-default", textAlign: "left", - height: 20, + whiteSpace: "normal", text: o.watermark, invalid: o.invalid, disabled: o.disabled @@ -57267,73 +57269,7 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, { } }); BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);/** - * @class BI.SmallTextValueCheckCombo - * @extend BI.Widget - * combo : text + icon, popup : check + text - */ -BI.SmallTextValueCheckCombo = BI.inherit(BI.Widget, { - _defaultConfig: function () { - return BI.extend(BI.SmallTextValueCheckCombo.superclass._defaultConfig.apply(this, arguments), { - width: 100, - height: 24, - chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, - text: "" - }); - }, - - _init: function () { - BI.SmallTextValueCheckCombo.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.trigger = BI.createWidget({ - type: "bi.small_select_text_trigger", - items: o.items, - height: o.height, - text: o.text, - value: o.value - }); - this.popup = BI.createWidget({ - type: "bi.text_value_check_combo_popup", - chooseType: o.chooseType, - items: o.items, - value: o.value - }); - this.popup.on(BI.TextValueCheckComboPopup.EVENT_CHANGE, function () { - self.setValue(self.popup.getValue()); - self.SmallTextIconCheckCombo.hideView(); - self.fireEvent(BI.SmallTextValueCheckCombo.EVENT_CHANGE); - }); - this.popup.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); - this.SmallTextIconCheckCombo = BI.createWidget({ - type: "bi.combo", - container: o.container, - element: this, - adjustLength: 2, - el: this.trigger, - popup: { - el: this.popup, - maxHeight: 300 - } - }); - }, - - setValue: function (v) { - this.SmallTextIconCheckCombo.setValue(v); - }, - - getValue: function () { - return this.popup.getValue(); - }, - - populate: function (items) { - this.options.items = items; - this.SmallTextIconCheckCombo.populate(items); - } -}); -BI.SmallTextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.small_text_value_check_combo", BI.SmallTextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, { +BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, { _defaultConfig: function () { return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-text-icon-popup", @@ -58552,7 +58488,7 @@ BI.StateEditor = BI.inherit(BI.Widget, { }); this.text = BI.createWidget({ type: "bi.text_button", - cls: "state-editor-infinite-text tip-text-style", + cls: "bi-water-mark tip-text-style", textAlign: "left", height: o.height, text: o.text, @@ -58749,31 +58685,31 @@ BI.StateEditor = BI.inherit(BI.Widget, { if (BI.isNumber(v)) { if (v === BI.Selection.All) { this.text.setText(BI.i18nText("BI-Select_All")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else if (v === BI.Selection.Multi) { this.text.setText(BI.i18nText("BI-Select_Part")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } return; } if (BI.isString(v)) { this.text.setText(v); - this.text.element.removeClass("state-editor-infinite-text"); + v === o.text ? this.text.element.addClass("bi-water-mark") : this.text.element.removeClass("bi-water-mark"); return; } if (BI.isArray(v)) { if (BI.isEmpty(v)) { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } else if (v.length === 1) { this.text.setText(v[0]); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else { this.text.setText(BI.i18nText("BI-Select_Part")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } } }, @@ -58851,7 +58787,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { }); this.text = BI.createWidget({ type: "bi.text_button", - cls: "state-editor-infinite-text", + cls: "bi-water-mark", textAlign: "left", text: o.text, height: o.height, @@ -59033,26 +58969,26 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { if (BI.isNumber(v)) { if (v === BI.Selection.All) { this.text.setText(BI.i18nText("BI-Already_Selected")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else if (v === BI.Selection.Multi) { this.text.setText(BI.i18nText("BI-Already_Selected")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } return; } if (!BI.isArray(v) || v.length === 1) { this.text.setText(v); this.text.setTitle(v); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else if (BI.isEmpty(v)) { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } else { this.text.setText(BI.i18nText("BI-Already_Selected")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } } }); @@ -61813,7 +61749,8 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { baseCls: (conf.baseCls || "") + " bi-text-trigger", height: 24, iconHeight: null, - iconWidth: null + iconWidth: null, + textCls: "" }); }, @@ -61822,7 +61759,7 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options, c = this._const; this.text = BI.createWidget({ type: "bi.label", - cls: "select-text-label", + cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""), textAlign: "left", height: o.height, text: o.text @@ -61887,6 +61824,12 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { } }, + setTextCls: function(cls) { + var o = this.options; + this.text.element.removeClass(o.textCls).addClass(cls); + o.textCls = cls; + }, + setText: function (text) { this.text.setText(text); } @@ -61915,6 +61858,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, { type: "bi.icon_text_trigger", element: this, text: obj.text, + textCls: obj.textCls, iconCls: obj.iconCls, height: o.height, iconHeight: o.iconHeight, @@ -61941,11 +61885,13 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, { if (BI.isNotNull(result)) { return { text: result.text, + textCls: "", iconCls: result.iconCls }; } else { return { text: o.text, + textCls: "bi-water-mark", iconCls: o.iconCls }; } @@ -61955,6 +61901,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, { var obj = this._digist(vals, this.options.items); this.trigger.setText(obj.text); this.trigger.setIcon(obj.iconCls); + this.trigger.setTextCls(obj.textCls); }, populate: function (items) { @@ -61977,7 +61924,8 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-text-trigger", - height: 24 + height: 24, + textCls: "" }); }, @@ -61986,7 +61934,7 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options, c = this._const; this.text = BI.createWidget({ type: "bi.label", - cls: "select-text-label", + cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""), textAlign: "left", height: o.height, text: o.text, @@ -62017,6 +61965,12 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { }); }, + setTextCls: function(cls) { + var o = this.options; + this.text.element.removeClass(o.textCls).addClass(cls); + o.textCls = cls; + }, + setText: function (text) { this.text.setText(text); }, @@ -62046,12 +62000,14 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { this.options.height -= 2; BI.SelectTextTrigger.superclass._init.apply(this, arguments); var self = this, o = this.options; + var obj = this._digest(o.text, o.items); this.trigger = BI.createWidget({ type: "bi.text_trigger", element: this, height: o.height, readonly: o.readonly, - text: this._digest(o.value, o.items), + text: obj.text, + textCls: obj.textCls, tipType: o.tipType, warningTitle: o.warningTitle }); @@ -62069,14 +62025,22 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { }); if (result.length > 0) { - return result.join(","); + return { + textCls: "", + text: result.join(",") + } } else { - return BI.isFunction(o.text) ? o.text() : o.text; + return { + textCls: "bi-water-mark", + text: BI.isFunction(o.text) ? o.text() : o.text + } } }, setValue: function (vals) { - this.trigger.setText(this._digest(vals, this.options.items)); + var formatValue = this._digest(vals, this.options.items); + this.trigger.setTextCls(formatValue.textCls); + this.trigger.setText(formatValue.text); }, setTipType: function (v) { @@ -85263,6 +85227,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear }, _createMonths: function () { + var self = this; // 纵向排列月 var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12]; var items = []; @@ -85284,7 +85249,10 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear height: 23, width: 38, value: td, - text: td + text: td, + ref: function (_ref) { + self.monthMap[j === 0 ? i : i + 6] = _ref; + } }; }); }); @@ -85292,10 +85260,13 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear render: function () { var self = this, o = this.options; + this.monthMap = {}; return { type: "bi.vertical", items: [{ type: "bi.year_picker", + min: o.min, + max: o.max, ref: function () { self.yearPicker = this; }, @@ -85305,6 +85276,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear eventName: BI.YearPicker.EVENT_CHANGE, action: function () { var value = this.getValue(); + self._checkMonthStatus(value); self.setValue({ year: value, month: self.selectedMonth @@ -85344,6 +85316,23 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear }; }, + mounted: function() { + this._checkMonthStatus(this.selectedYear); + }, + + _checkMonthStatus: function (year) { + var o = this.options; + var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"), maxDate = BI.parseDateTime(o.max, "%Y-%X-%d"); + var minYear = minDate.getFullYear(), maxYear = maxDate.getFullYear(); + var minMonth = 0; var maxMonth = 11; + minYear === year && (minMonth = minDate.getMonth()); + maxYear === year && (maxMonth = maxDate.getMonth()); + var yearInvalid = year < minYear || year > maxYear; + BI.each(this.monthMap, function (month, obj) { + var monthInvalid = month < minMonth || month > maxMonth; + obj.setEnable(!yearInvalid && !monthInvalid); + }); + }, getValue: function () { return { @@ -85378,8 +85367,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { props: { baseCls: "bi-year-month-combo bi-border bi-focus-shadow", behaviors: {}, - min: "1900-01-01", // 最小日期 - max: "2099-12-31", // 最大日期 + minDate: "1900-01-01", // 最小日期 + maxDate: "2099-12-31", // 最大日期 height: 22 }, @@ -85390,8 +85379,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { this.storeTriggerValue = ""; this.trigger = BI.createWidget({ type: "bi.dynamic_year_month_trigger", - min: o.min, - max: o.max, + min: o.minDate, + max: o.maxDate, height: o.height, value: o.value || "" }); @@ -85475,8 +85464,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { } }], behaviors: o.behaviors, - min: o.min, - max: o.max + min: o.minDate, + max: o.maxDate }, value: o.value || "" } @@ -85830,12 +85819,13 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY _createEditor: function (isYear) { var self = this, o = this.options, c = this._const; + var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"); var editor = BI.createWidget({ type: "bi.sign_editor", height: o.height, validationChecker: function (v) { if(isYear) { - return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, 1, 1, o.min, o.max)[0]); + return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, v === minDate.getFullYear() ? minDate.getMonth() + 1 : 1, 1, o.min, o.max)[0]); } return v === "" || ((BI.isPositiveInteger(v) && v >= 1 && v <= 12) && !BI.checkDateVoid(BI.getDate().getFullYear(), v, 1, o.min, o.max)[0]); }, diff --git a/dist/fineui.js b/dist/fineui.js index 820aac8bb..0b22e6ea6 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -32659,7 +32659,9 @@ $.extend($.Event.prototype, { py = BI.toUpperCase(py); } this.empty(); - while (true) { + // BI-48487 性能: makeFirstPY出来的py中包含多音字是必要的,但虽然此方法中做了限制。但是对于一个长度为60,包含14个多音字的字符串 + // 获取的的py长度将达到1966080, 远超过text的长度,到后面都是在做"".substring的无用功,所以此循环应保证py和textLeft长度不为0 + while (py.length > 0 && textLeft.length > 0) { var tidx = BI.toUpperCase(textLeft).indexOf(keyword); var pidx = null; if (py != null) { @@ -47921,7 +47923,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { type: "bi.text_button", cls: "bi-water-mark cursor-default", textAlign: "left", - height: 20, + whiteSpace: "normal", text: o.watermark, invalid: o.invalid, disabled: o.disabled @@ -57671,73 +57673,7 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, { } }); BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);/** - * @class BI.SmallTextValueCheckCombo - * @extend BI.Widget - * combo : text + icon, popup : check + text - */ -BI.SmallTextValueCheckCombo = BI.inherit(BI.Widget, { - _defaultConfig: function () { - return BI.extend(BI.SmallTextValueCheckCombo.superclass._defaultConfig.apply(this, arguments), { - width: 100, - height: 24, - chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, - text: "" - }); - }, - - _init: function () { - BI.SmallTextValueCheckCombo.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.trigger = BI.createWidget({ - type: "bi.small_select_text_trigger", - items: o.items, - height: o.height, - text: o.text, - value: o.value - }); - this.popup = BI.createWidget({ - type: "bi.text_value_check_combo_popup", - chooseType: o.chooseType, - items: o.items, - value: o.value - }); - this.popup.on(BI.TextValueCheckComboPopup.EVENT_CHANGE, function () { - self.setValue(self.popup.getValue()); - self.SmallTextIconCheckCombo.hideView(); - self.fireEvent(BI.SmallTextValueCheckCombo.EVENT_CHANGE); - }); - this.popup.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); - this.SmallTextIconCheckCombo = BI.createWidget({ - type: "bi.combo", - container: o.container, - element: this, - adjustLength: 2, - el: this.trigger, - popup: { - el: this.popup, - maxHeight: 300 - } - }); - }, - - setValue: function (v) { - this.SmallTextIconCheckCombo.setValue(v); - }, - - getValue: function () { - return this.popup.getValue(); - }, - - populate: function (items) { - this.options.items = items; - this.SmallTextIconCheckCombo.populate(items); - } -}); -BI.SmallTextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.small_text_value_check_combo", BI.SmallTextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, { +BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, { _defaultConfig: function () { return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-text-icon-popup", @@ -58956,7 +58892,7 @@ BI.StateEditor = BI.inherit(BI.Widget, { }); this.text = BI.createWidget({ type: "bi.text_button", - cls: "state-editor-infinite-text tip-text-style", + cls: "bi-water-mark tip-text-style", textAlign: "left", height: o.height, text: o.text, @@ -59153,31 +59089,31 @@ BI.StateEditor = BI.inherit(BI.Widget, { if (BI.isNumber(v)) { if (v === BI.Selection.All) { this.text.setText(BI.i18nText("BI-Select_All")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else if (v === BI.Selection.Multi) { this.text.setText(BI.i18nText("BI-Select_Part")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } return; } if (BI.isString(v)) { this.text.setText(v); - this.text.element.removeClass("state-editor-infinite-text"); + v === o.text ? this.text.element.addClass("bi-water-mark") : this.text.element.removeClass("bi-water-mark"); return; } if (BI.isArray(v)) { if (BI.isEmpty(v)) { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } else if (v.length === 1) { this.text.setText(v[0]); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else { this.text.setText(BI.i18nText("BI-Select_Part")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } } }, @@ -59255,7 +59191,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { }); this.text = BI.createWidget({ type: "bi.text_button", - cls: "state-editor-infinite-text", + cls: "bi-water-mark", textAlign: "left", text: o.text, height: o.height, @@ -59437,26 +59373,26 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { if (BI.isNumber(v)) { if (v === BI.Selection.All) { this.text.setText(BI.i18nText("BI-Already_Selected")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else if (v === BI.Selection.Multi) { this.text.setText(BI.i18nText("BI-Already_Selected")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } return; } if (!BI.isArray(v) || v.length === 1) { this.text.setText(v); this.text.setTitle(v); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else if (BI.isEmpty(v)) { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } else { this.text.setText(BI.i18nText("BI-Already_Selected")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } } }); @@ -62217,7 +62153,8 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { baseCls: (conf.baseCls || "") + " bi-text-trigger", height: 24, iconHeight: null, - iconWidth: null + iconWidth: null, + textCls: "" }); }, @@ -62226,7 +62163,7 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options, c = this._const; this.text = BI.createWidget({ type: "bi.label", - cls: "select-text-label", + cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""), textAlign: "left", height: o.height, text: o.text @@ -62291,6 +62228,12 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { } }, + setTextCls: function(cls) { + var o = this.options; + this.text.element.removeClass(o.textCls).addClass(cls); + o.textCls = cls; + }, + setText: function (text) { this.text.setText(text); } @@ -62319,6 +62262,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, { type: "bi.icon_text_trigger", element: this, text: obj.text, + textCls: obj.textCls, iconCls: obj.iconCls, height: o.height, iconHeight: o.iconHeight, @@ -62345,11 +62289,13 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, { if (BI.isNotNull(result)) { return { text: result.text, + textCls: "", iconCls: result.iconCls }; } else { return { text: o.text, + textCls: "bi-water-mark", iconCls: o.iconCls }; } @@ -62359,6 +62305,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, { var obj = this._digist(vals, this.options.items); this.trigger.setText(obj.text); this.trigger.setIcon(obj.iconCls); + this.trigger.setTextCls(obj.textCls); }, populate: function (items) { @@ -62381,7 +62328,8 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-text-trigger", - height: 24 + height: 24, + textCls: "" }); }, @@ -62390,7 +62338,7 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options, c = this._const; this.text = BI.createWidget({ type: "bi.label", - cls: "select-text-label", + cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""), textAlign: "left", height: o.height, text: o.text, @@ -62421,6 +62369,12 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { }); }, + setTextCls: function(cls) { + var o = this.options; + this.text.element.removeClass(o.textCls).addClass(cls); + o.textCls = cls; + }, + setText: function (text) { this.text.setText(text); }, @@ -62450,12 +62404,14 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { this.options.height -= 2; BI.SelectTextTrigger.superclass._init.apply(this, arguments); var self = this, o = this.options; + var obj = this._digest(o.text, o.items); this.trigger = BI.createWidget({ type: "bi.text_trigger", element: this, height: o.height, readonly: o.readonly, - text: this._digest(o.value, o.items), + text: obj.text, + textCls: obj.textCls, tipType: o.tipType, warningTitle: o.warningTitle }); @@ -62473,14 +62429,22 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { }); if (result.length > 0) { - return result.join(","); + return { + textCls: "", + text: result.join(",") + } } else { - return BI.isFunction(o.text) ? o.text() : o.text; + return { + textCls: "bi-water-mark", + text: BI.isFunction(o.text) ? o.text() : o.text + } } }, setValue: function (vals) { - this.trigger.setText(this._digest(vals, this.options.items)); + var formatValue = this._digest(vals, this.options.items); + this.trigger.setTextCls(formatValue.textCls); + this.trigger.setText(formatValue.text); }, setTipType: function (v) { @@ -85667,6 +85631,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear }, _createMonths: function () { + var self = this; // 纵向排列月 var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12]; var items = []; @@ -85688,7 +85653,10 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear height: 23, width: 38, value: td, - text: td + text: td, + ref: function (_ref) { + self.monthMap[j === 0 ? i : i + 6] = _ref; + } }; }); }); @@ -85696,10 +85664,13 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear render: function () { var self = this, o = this.options; + this.monthMap = {}; return { type: "bi.vertical", items: [{ type: "bi.year_picker", + min: o.min, + max: o.max, ref: function () { self.yearPicker = this; }, @@ -85709,6 +85680,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear eventName: BI.YearPicker.EVENT_CHANGE, action: function () { var value = this.getValue(); + self._checkMonthStatus(value); self.setValue({ year: value, month: self.selectedMonth @@ -85748,6 +85720,23 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear }; }, + mounted: function() { + this._checkMonthStatus(this.selectedYear); + }, + + _checkMonthStatus: function (year) { + var o = this.options; + var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"), maxDate = BI.parseDateTime(o.max, "%Y-%X-%d"); + var minYear = minDate.getFullYear(), maxYear = maxDate.getFullYear(); + var minMonth = 0; var maxMonth = 11; + minYear === year && (minMonth = minDate.getMonth()); + maxYear === year && (maxMonth = maxDate.getMonth()); + var yearInvalid = year < minYear || year > maxYear; + BI.each(this.monthMap, function (month, obj) { + var monthInvalid = month < minMonth || month > maxMonth; + obj.setEnable(!yearInvalid && !monthInvalid); + }); + }, getValue: function () { return { @@ -85782,8 +85771,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { props: { baseCls: "bi-year-month-combo bi-border bi-focus-shadow", behaviors: {}, - min: "1900-01-01", // 最小日期 - max: "2099-12-31", // 最大日期 + minDate: "1900-01-01", // 最小日期 + maxDate: "2099-12-31", // 最大日期 height: 22 }, @@ -85794,8 +85783,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { this.storeTriggerValue = ""; this.trigger = BI.createWidget({ type: "bi.dynamic_year_month_trigger", - min: o.min, - max: o.max, + min: o.minDate, + max: o.maxDate, height: o.height, value: o.value || "" }); @@ -85879,8 +85868,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { } }], behaviors: o.behaviors, - min: o.min, - max: o.max + min: o.minDate, + max: o.maxDate }, value: o.value || "" } @@ -86234,12 +86223,13 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY _createEditor: function (isYear) { var self = this, o = this.options, c = this._const; + var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"); var editor = BI.createWidget({ type: "bi.sign_editor", height: o.height, validationChecker: function (v) { if(isYear) { - return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, 1, 1, o.min, o.max)[0]); + return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, v === minDate.getFullYear() ? minDate.getMonth() + 1 : 1, 1, o.min, o.max)[0]); } return v === "" || ((BI.isPositiveInteger(v) && v >= 1 && v <= 12) && !BI.checkDateVoid(BI.getDate().getFullYear(), v, 1, o.min, o.max)[0]); }, diff --git a/dist/fineui_without_jquery_polyfill.js b/dist/fineui_without_jquery_polyfill.js index 94e5d63bd..1a2bb4e89 100644 --- a/dist/fineui_without_jquery_polyfill.js +++ b/dist/fineui_without_jquery_polyfill.js @@ -28756,6 +28756,48 @@ describe("TextTest", function () { expect(text.element.children(".bi-keyword-red-mark").length).to.equal(0); text.destroy(); }); + + /** + * test_author_windy + */ + it("setValue", function () { + var text = BI.Test.createWidget({ + type: "bi.text", + text: "我是要标红的A", + keyword: "A" + }); + text.unRedMark(); + expect(text.element.children(".bi-keyword-red-mark").length).to.equal(0); + text.destroy(); + }); + + /** + * test_author_windy + */ + it("gap测试", function () { + var text = BI.Test.createWidget({ + type: "bi.text", + text: "我是要标红的A", + keyword: "A" + }); + text.unRedMark(); + expect(text.element.children(".bi-keyword-red-mark").length).to.equal(0); + text.destroy(); + }); + + /** + * test_author_windy + */ + it("空格测试", function () { + var text = BI.Test.createWidget({ + type: "bi.text", + text: "我是要标红的 A", + keyword: "A" + }); + text.unRedMark(); + expect(text.element.children(".bi-keyword-red-mark").length).to.equal(0); + text.destroy(); + }); }); BI.prepares.push(function () { BI.Resizers = new BI.ResizeController(); @@ -35240,7 +35282,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, { type: "bi.text_button", cls: "bi-water-mark cursor-default", textAlign: "left", - height: 20, + whiteSpace: "normal", text: o.watermark, invalid: o.invalid, disabled: o.disabled @@ -40452,73 +40494,7 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, { } }); BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);/** - * @class BI.SmallTextValueCheckCombo - * @extend BI.Widget - * combo : text + icon, popup : check + text - */ -BI.SmallTextValueCheckCombo = BI.inherit(BI.Widget, { - _defaultConfig: function () { - return BI.extend(BI.SmallTextValueCheckCombo.superclass._defaultConfig.apply(this, arguments), { - width: 100, - height: 24, - chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, - text: "" - }); - }, - - _init: function () { - BI.SmallTextValueCheckCombo.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.trigger = BI.createWidget({ - type: "bi.small_select_text_trigger", - items: o.items, - height: o.height, - text: o.text, - value: o.value - }); - this.popup = BI.createWidget({ - type: "bi.text_value_check_combo_popup", - chooseType: o.chooseType, - items: o.items, - value: o.value - }); - this.popup.on(BI.TextValueCheckComboPopup.EVENT_CHANGE, function () { - self.setValue(self.popup.getValue()); - self.SmallTextIconCheckCombo.hideView(); - self.fireEvent(BI.SmallTextValueCheckCombo.EVENT_CHANGE); - }); - this.popup.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); - this.SmallTextIconCheckCombo = BI.createWidget({ - type: "bi.combo", - container: o.container, - element: this, - adjustLength: 2, - el: this.trigger, - popup: { - el: this.popup, - maxHeight: 300 - } - }); - }, - - setValue: function (v) { - this.SmallTextIconCheckCombo.setValue(v); - }, - - getValue: function () { - return this.popup.getValue(); - }, - - populate: function (items) { - this.options.items = items; - this.SmallTextIconCheckCombo.populate(items); - } -}); -BI.SmallTextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; -BI.shortcut("bi.small_text_value_check_combo", BI.SmallTextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, { +BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, { _defaultConfig: function () { return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-text-icon-popup", @@ -41737,7 +41713,7 @@ BI.StateEditor = BI.inherit(BI.Widget, { }); this.text = BI.createWidget({ type: "bi.text_button", - cls: "state-editor-infinite-text tip-text-style", + cls: "bi-water-mark tip-text-style", textAlign: "left", height: o.height, text: o.text, @@ -41934,31 +41910,31 @@ BI.StateEditor = BI.inherit(BI.Widget, { if (BI.isNumber(v)) { if (v === BI.Selection.All) { this.text.setText(BI.i18nText("BI-Select_All")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else if (v === BI.Selection.Multi) { this.text.setText(BI.i18nText("BI-Select_Part")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } return; } if (BI.isString(v)) { this.text.setText(v); - this.text.element.removeClass("state-editor-infinite-text"); + v === o.text ? this.text.element.addClass("bi-water-mark") : this.text.element.removeClass("bi-water-mark"); return; } if (BI.isArray(v)) { if (BI.isEmpty(v)) { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } else if (v.length === 1) { this.text.setText(v[0]); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else { this.text.setText(BI.i18nText("BI-Select_Part")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } } }, @@ -42036,7 +42012,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { }); this.text = BI.createWidget({ type: "bi.text_button", - cls: "state-editor-infinite-text", + cls: "bi-water-mark", textAlign: "left", text: o.text, height: o.height, @@ -42218,26 +42194,26 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, { if (BI.isNumber(v)) { if (v === BI.Selection.All) { this.text.setText(BI.i18nText("BI-Already_Selected")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else if (v === BI.Selection.Multi) { this.text.setText(BI.i18nText("BI-Already_Selected")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } return; } if (!BI.isArray(v) || v.length === 1) { this.text.setText(v); this.text.setTitle(v); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } else if (BI.isEmpty(v)) { this.text.setText(o.text); - this.text.element.addClass("state-editor-infinite-text"); + this.text.element.addClass("bi-water-mark"); } else { this.text.setText(BI.i18nText("BI-Already_Selected")); - this.text.element.removeClass("state-editor-infinite-text"); + this.text.element.removeClass("bi-water-mark"); } } }); @@ -44722,7 +44698,8 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { baseCls: (conf.baseCls || "") + " bi-text-trigger", height: 24, iconHeight: null, - iconWidth: null + iconWidth: null, + textCls: "" }); }, @@ -44731,7 +44708,7 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options, c = this._const; this.text = BI.createWidget({ type: "bi.label", - cls: "select-text-label", + cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""), textAlign: "left", height: o.height, text: o.text @@ -44796,6 +44773,12 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, { } }, + setTextCls: function(cls) { + var o = this.options; + this.text.element.removeClass(o.textCls).addClass(cls); + o.textCls = cls; + }, + setText: function (text) { this.text.setText(text); } @@ -44824,6 +44807,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, { type: "bi.icon_text_trigger", element: this, text: obj.text, + textCls: obj.textCls, iconCls: obj.iconCls, height: o.height, iconHeight: o.iconHeight, @@ -44850,11 +44834,13 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, { if (BI.isNotNull(result)) { return { text: result.text, + textCls: "", iconCls: result.iconCls }; } else { return { text: o.text, + textCls: "bi-water-mark", iconCls: o.iconCls }; } @@ -44864,6 +44850,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, { var obj = this._digist(vals, this.options.items); this.trigger.setText(obj.text); this.trigger.setIcon(obj.iconCls); + this.trigger.setTextCls(obj.textCls); }, populate: function (items) { @@ -44886,7 +44873,8 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments); return BI.extend(conf, { baseCls: (conf.baseCls || "") + " bi-text-trigger", - height: 24 + height: 24, + textCls: "" }); }, @@ -44895,7 +44883,7 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { var self = this, o = this.options, c = this._const; this.text = BI.createWidget({ type: "bi.label", - cls: "select-text-label", + cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""), textAlign: "left", height: o.height, text: o.text, @@ -44926,6 +44914,12 @@ BI.TextTrigger = BI.inherit(BI.Trigger, { }); }, + setTextCls: function(cls) { + var o = this.options; + this.text.element.removeClass(o.textCls).addClass(cls); + o.textCls = cls; + }, + setText: function (text) { this.text.setText(text); }, @@ -44955,12 +44949,14 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { this.options.height -= 2; BI.SelectTextTrigger.superclass._init.apply(this, arguments); var self = this, o = this.options; + var obj = this._digest(o.text, o.items); this.trigger = BI.createWidget({ type: "bi.text_trigger", element: this, height: o.height, readonly: o.readonly, - text: this._digest(o.value, o.items), + text: obj.text, + textCls: obj.textCls, tipType: o.tipType, warningTitle: o.warningTitle }); @@ -44978,14 +44974,22 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, { }); if (result.length > 0) { - return result.join(","); + return { + textCls: "", + text: result.join(",") + } } else { - return BI.isFunction(o.text) ? o.text() : o.text; + return { + textCls: "bi-water-mark", + text: BI.isFunction(o.text) ? o.text() : o.text + } } }, setValue: function (vals) { - this.trigger.setText(this._digest(vals, this.options.items)); + var formatValue = this._digest(vals, this.options.items); + this.trigger.setTextCls(formatValue.textCls); + this.trigger.setText(formatValue.text); }, setTipType: function (v) { @@ -68172,6 +68176,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear }, _createMonths: function () { + var self = this; // 纵向排列月 var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12]; var items = []; @@ -68193,7 +68198,10 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear height: 23, width: 38, value: td, - text: td + text: td, + ref: function (_ref) { + self.monthMap[j === 0 ? i : i + 6] = _ref; + } }; }); }); @@ -68201,10 +68209,13 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear render: function () { var self = this, o = this.options; + this.monthMap = {}; return { type: "bi.vertical", items: [{ type: "bi.year_picker", + min: o.min, + max: o.max, ref: function () { self.yearPicker = this; }, @@ -68214,6 +68225,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear eventName: BI.YearPicker.EVENT_CHANGE, action: function () { var value = this.getValue(); + self._checkMonthStatus(value); self.setValue({ year: value, month: self.selectedMonth @@ -68253,6 +68265,23 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear }; }, + mounted: function() { + this._checkMonthStatus(this.selectedYear); + }, + + _checkMonthStatus: function (year) { + var o = this.options; + var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"), maxDate = BI.parseDateTime(o.max, "%Y-%X-%d"); + var minYear = minDate.getFullYear(), maxYear = maxDate.getFullYear(); + var minMonth = 0; var maxMonth = 11; + minYear === year && (minMonth = minDate.getMonth()); + maxYear === year && (maxMonth = maxDate.getMonth()); + var yearInvalid = year < minYear || year > maxYear; + BI.each(this.monthMap, function (month, obj) { + var monthInvalid = month < minMonth || month > maxMonth; + obj.setEnable(!yearInvalid && !monthInvalid); + }); + }, getValue: function () { return { @@ -68287,8 +68316,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { props: { baseCls: "bi-year-month-combo bi-border bi-focus-shadow", behaviors: {}, - min: "1900-01-01", // 最小日期 - max: "2099-12-31", // 最大日期 + minDate: "1900-01-01", // 最小日期 + maxDate: "2099-12-31", // 最大日期 height: 22 }, @@ -68299,8 +68328,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { this.storeTriggerValue = ""; this.trigger = BI.createWidget({ type: "bi.dynamic_year_month_trigger", - min: o.min, - max: o.max, + min: o.minDate, + max: o.maxDate, height: o.height, value: o.value || "" }); @@ -68384,8 +68413,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { } }], behaviors: o.behaviors, - min: o.min, - max: o.max + min: o.minDate, + max: o.maxDate }, value: o.value || "" } @@ -68739,12 +68768,13 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY _createEditor: function (isYear) { var self = this, o = this.options, c = this._const; + var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"); var editor = BI.createWidget({ type: "bi.sign_editor", height: o.height, validationChecker: function (v) { if(isYear) { - return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, 1, 1, o.min, o.max)[0]); + return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, v === minDate.getFullYear() ? minDate.getMonth() + 1 : 1, 1, o.min, o.max)[0]); } return v === "" || ((BI.isPositiveInteger(v) && v >= 1 && v <= 12) && !BI.checkDateVoid(BI.getDate().getFullYear(), v, 1, o.min, o.max)[0]); }, diff --git a/dist/widget.js b/dist/widget.js index 4d1354e12..78b6a7400 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -23054,6 +23054,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear }, _createMonths: function () { + var self = this; // 纵向排列月 var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12]; var items = []; @@ -23075,7 +23076,10 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear height: 23, width: 38, value: td, - text: td + text: td, + ref: function (_ref) { + self.monthMap[j === 0 ? i : i + 6] = _ref; + } }; }); }); @@ -23083,10 +23087,13 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear render: function () { var self = this, o = this.options; + this.monthMap = {}; return { type: "bi.vertical", items: [{ type: "bi.year_picker", + min: o.min, + max: o.max, ref: function () { self.yearPicker = this; }, @@ -23096,6 +23103,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear eventName: BI.YearPicker.EVENT_CHANGE, action: function () { var value = this.getValue(); + self._checkMonthStatus(value); self.setValue({ year: value, month: self.selectedMonth @@ -23135,6 +23143,23 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear }; }, + mounted: function() { + this._checkMonthStatus(this.selectedYear); + }, + + _checkMonthStatus: function (year) { + var o = this.options; + var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"), maxDate = BI.parseDateTime(o.max, "%Y-%X-%d"); + var minYear = minDate.getFullYear(), maxYear = maxDate.getFullYear(); + var minMonth = 0; var maxMonth = 11; + minYear === year && (minMonth = minDate.getMonth()); + maxYear === year && (maxMonth = maxDate.getMonth()); + var yearInvalid = year < minYear || year > maxYear; + BI.each(this.monthMap, function (month, obj) { + var monthInvalid = month < minMonth || month > maxMonth; + obj.setEnable(!yearInvalid && !monthInvalid); + }); + }, getValue: function () { return { @@ -23169,8 +23194,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { props: { baseCls: "bi-year-month-combo bi-border bi-focus-shadow", behaviors: {}, - min: "1900-01-01", // 最小日期 - max: "2099-12-31", // 最大日期 + minDate: "1900-01-01", // 最小日期 + maxDate: "2099-12-31", // 最大日期 height: 22 }, @@ -23181,8 +23206,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { this.storeTriggerValue = ""; this.trigger = BI.createWidget({ type: "bi.dynamic_year_month_trigger", - min: o.min, - max: o.max, + min: o.minDate, + max: o.maxDate, height: o.height, value: o.value || "" }); @@ -23266,8 +23291,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, { } }], behaviors: o.behaviors, - min: o.min, - max: o.max + min: o.minDate, + max: o.maxDate }, value: o.value || "" } @@ -23621,12 +23646,13 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY _createEditor: function (isYear) { var self = this, o = this.options, c = this._const; + var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"); var editor = BI.createWidget({ type: "bi.sign_editor", height: o.height, validationChecker: function (v) { if(isYear) { - return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, 1, 1, o.min, o.max)[0]); + return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, v === minDate.getFullYear() ? minDate.getMonth() + 1 : 1, 1, o.min, o.max)[0]); } return v === "" || ((BI.isPositiveInteger(v) && v >= 1 && v <= 12) && !BI.checkDateVoid(BI.getDate().getFullYear(), v, 1, o.min, o.max)[0]); },