Browse Source

Merge pull request #1034 in VISUAL/fineui from ~WINDY/fineui:master to master

* commit '088a3c3dc06458188e224e5c9aec6b182ffddf93':
  fix: 根据comment修改
  改多了
  dist提交一下
  REPORT-19859 fix: 年月控件支持最大最小日期限制
  fix: 根据comment修改
  refactor: 删除多余控件
  BI-48579 refactor: 下拉显示默认值的时候文本搞成水印色
  REPORT-19888 textareaeditor水印可换行
master
guy 5 years ago
parent
commit
44a8a5d090
  1. 192
      dist/2.0/fineui.ie.js
  2. 192
      dist/2.0/fineui.js
  3. 2
      dist/base.js
  4. 192
      dist/bundle.ie.js
  5. 192
      dist/bundle.js
  6. 144
      dist/case.js
  7. 4
      dist/core.js
  8. 192
      dist/fineui.ie.js
  9. 192
      dist/fineui.js
  10. 230
      dist/fineui_without_jquery_polyfill.js
  11. 42
      dist/widget.js
  12. 2
      src/base/single/editor/editor.textarea.js
  13. 67
      src/case/combo/textvaluecheckcombo/combo.textvaluechecksmall.js
  14. 16
      src/case/editor/editor.state.js
  15. 14
      src/case/editor/editor.state.simple.js
  16. 12
      src/case/trigger/trigger.icon.text.js
  17. 4
      src/case/trigger/trigger.icon.text.select.js
  18. 12
      src/case/trigger/trigger.text.js
  19. 18
      src/case/trigger/trigger.text.select.js
  20. 2
      src/case/trigger/trigger.text.select.small.js
  21. 27
      src/widget/yearmonth/card.static.yearmonth.js
  22. 12
      src/widget/yearmonth/combo.yearmonth.js
  23. 3
      src/widget/yearmonth/trigger.yearmonth.js

192
dist/2.0/fineui.ie.js vendored

@ -32414,7 +32414,9 @@ $.extend($.Event.prototype, {
py = BI.toUpperCase(py); py = BI.toUpperCase(py);
} }
this.empty(); 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 tidx = BI.toUpperCase(textLeft).indexOf(keyword);
var pidx = null; var pidx = null;
if (py != null) { if (py != null) {
@ -47272,7 +47274,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
type: "bi.text_button", type: "bi.text_button",
cls: "bi-water-mark cursor-default", cls: "bi-water-mark cursor-default",
textAlign: "left", textAlign: "left",
height: 20, whiteSpace: "normal",
text: o.watermark, text: o.watermark,
invalid: o.invalid, invalid: o.invalid,
disabled: o.disabled disabled: o.disabled
@ -57022,73 +57024,7 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, {
} }
}); });
BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);/** BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, {
* @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, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-text-icon-popup", baseCls: "bi-text-icon-popup",
@ -58307,7 +58243,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
}); });
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.text_button", type: "bi.text_button",
cls: "state-editor-infinite-text tip-text-style", cls: "bi-water-mark tip-text-style",
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, text: o.text,
@ -58504,31 +58440,31 @@ BI.StateEditor = BI.inherit(BI.Widget, {
if (BI.isNumber(v)) { if (BI.isNumber(v)) {
if (v === BI.Selection.All) { if (v === BI.Selection.All) {
this.text.setText(BI.i18nText("BI-Select_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) { } else if (v === BI.Selection.Multi) {
this.text.setText(BI.i18nText("BI-Select_Part")); this.text.setText(BI.i18nText("BI-Select_Part"));
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} }
return; return;
} }
if (BI.isString(v)) { if (BI.isString(v)) {
this.text.setText(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; return;
} }
if (BI.isArray(v)) { if (BI.isArray(v)) {
if (BI.isEmpty(v)) { if (BI.isEmpty(v)) {
this.text.setText(o.text); 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) { } else if (v.length === 1) {
this.text.setText(v[0]); this.text.setText(v[0]);
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(BI.i18nText("BI-Select_Part")); 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({ this.text = BI.createWidget({
type: "bi.text_button", type: "bi.text_button",
cls: "state-editor-infinite-text", cls: "bi-water-mark",
textAlign: "left", textAlign: "left",
text: o.text, text: o.text,
height: o.height, height: o.height,
@ -58788,26 +58724,26 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
if (BI.isNumber(v)) { if (BI.isNumber(v)) {
if (v === BI.Selection.All) { if (v === BI.Selection.All) {
this.text.setText(BI.i18nText("BI-Already_Selected")); 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) { } else if (v === BI.Selection.Multi) {
this.text.setText(BI.i18nText("BI-Already_Selected")); this.text.setText(BI.i18nText("BI-Already_Selected"));
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} }
return; return;
} }
if (!BI.isArray(v) || v.length === 1) { if (!BI.isArray(v) || v.length === 1) {
this.text.setText(v); this.text.setText(v);
this.text.setTitle(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)) { } else if (BI.isEmpty(v)) {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} else { } else {
this.text.setText(BI.i18nText("BI-Already_Selected")); 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", baseCls: (conf.baseCls || "") + " bi-text-trigger",
height: 24, height: 24,
iconHeight: null, 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; var self = this, o = this.options, c = this._const;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
cls: "select-text-label", cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""),
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text 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) { setText: function (text) {
this.text.setText(text); this.text.setText(text);
} }
@ -61670,6 +61613,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
type: "bi.icon_text_trigger", type: "bi.icon_text_trigger",
element: this, element: this,
text: obj.text, text: obj.text,
textCls: obj.textCls,
iconCls: obj.iconCls, iconCls: obj.iconCls,
height: o.height, height: o.height,
iconHeight: o.iconHeight, iconHeight: o.iconHeight,
@ -61696,11 +61640,13 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
if (BI.isNotNull(result)) { if (BI.isNotNull(result)) {
return { return {
text: result.text, text: result.text,
textCls: "",
iconCls: result.iconCls iconCls: result.iconCls
}; };
} else { } else {
return { return {
text: o.text, text: o.text,
textCls: "bi-water-mark",
iconCls: o.iconCls iconCls: o.iconCls
}; };
} }
@ -61710,6 +61656,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
var obj = this._digist(vals, this.options.items); var obj = this._digist(vals, this.options.items);
this.trigger.setText(obj.text); this.trigger.setText(obj.text);
this.trigger.setIcon(obj.iconCls); this.trigger.setIcon(obj.iconCls);
this.trigger.setTextCls(obj.textCls);
}, },
populate: function (items) { populate: function (items) {
@ -61732,7 +61679,8 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments); var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-text-trigger", 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; var self = this, o = this.options, c = this._const;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
cls: "select-text-label", cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""),
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, 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) { setText: function (text) {
this.text.setText(text); this.text.setText(text);
}, },
@ -61801,12 +61755,14 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
this.options.height -= 2; this.options.height -= 2;
BI.SelectTextTrigger.superclass._init.apply(this, arguments); BI.SelectTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var obj = this._digest(o.value, o.items);
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.text_trigger", type: "bi.text_trigger",
element: this, element: this,
height: o.height, height: o.height,
readonly: o.readonly, readonly: o.readonly,
text: this._digest(o.value, o.items), text: obj.text,
textCls: obj.textCls,
tipType: o.tipType, tipType: o.tipType,
warningTitle: o.warningTitle warningTitle: o.warningTitle
}); });
@ -61824,14 +61780,22 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
}); });
if (result.length > 0) { if (result.length > 0) {
return result.join(","); return {
textCls: "",
text: result.join(",")
}
} else { } 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) { 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) { setTipType: function (v) {
@ -61862,7 +61826,7 @@ BI.SmallSelectTextTrigger = BI.inherit(BI.Trigger, {
this.options.height -= 2; this.options.height -= 2;
BI.SmallSelectTextTrigger.superclass._init.apply(this, arguments); BI.SmallSelectTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var obj = this._digest(o.text, o.items); var obj = this._digest(o.value, o.items);
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.small_text_trigger", type: "bi.small_text_trigger",
element: this, element: this,
@ -85018,6 +84982,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
}, },
_createMonths: function () { _createMonths: function () {
var self = this;
// 纵向排列月 // 纵向排列月
var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12]; var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12];
var items = []; var items = [];
@ -85039,7 +85004,10 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
height: 23, height: 23,
width: 38, width: 38,
value: td, 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 () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;
this.monthMap = {};
return { return {
type: "bi.vertical", type: "bi.vertical",
items: [{ items: [{
type: "bi.year_picker", type: "bi.year_picker",
min: o.min,
max: o.max,
ref: function () { ref: function () {
self.yearPicker = this; self.yearPicker = this;
}, },
@ -85060,6 +85031,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
eventName: BI.YearPicker.EVENT_CHANGE, eventName: BI.YearPicker.EVENT_CHANGE,
action: function () { action: function () {
var value = this.getValue(); var value = this.getValue();
self._checkMonthStatus(value);
self.setValue({ self.setValue({
year: value, year: value,
month: self.selectedMonth 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 () { getValue: function () {
return { return {
@ -85133,8 +85122,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
props: { props: {
baseCls: "bi-year-month-combo bi-border bi-focus-shadow", baseCls: "bi-year-month-combo bi-border bi-focus-shadow",
behaviors: {}, behaviors: {},
min: "1900-01-01", // 最小日期 minDate: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 maxDate: "2099-12-31", // 最大日期
height: 22 height: 22
}, },
@ -85145,8 +85134,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
this.storeTriggerValue = ""; this.storeTriggerValue = "";
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.dynamic_year_month_trigger", type: "bi.dynamic_year_month_trigger",
min: o.min, min: o.minDate,
max: o.max, max: o.maxDate,
height: o.height, height: o.height,
value: o.value || "" value: o.value || ""
}); });
@ -85230,8 +85219,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
} }
}], }],
behaviors: o.behaviors, behaviors: o.behaviors,
min: o.min, min: o.minDate,
max: o.max max: o.maxDate
}, },
value: o.value || "" value: o.value || ""
} }
@ -85585,12 +85574,13 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY
_createEditor: function (isYear) { _createEditor: function (isYear) {
var self = this, o = this.options, c = this._const; var self = this, o = this.options, c = this._const;
var minDate = BI.parseDateTime(o.min, "%Y-%X-%d");
var editor = BI.createWidget({ var editor = BI.createWidget({
type: "bi.sign_editor", type: "bi.sign_editor",
height: o.height, height: o.height,
validationChecker: function (v) { validationChecker: function (v) {
if(isYear) { 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]); return v === "" || ((BI.isPositiveInteger(v) && v >= 1 && v <= 12) && !BI.checkDateVoid(BI.getDate().getFullYear(), v, 1, o.min, o.max)[0]);
}, },

192
dist/2.0/fineui.js vendored

@ -32414,7 +32414,9 @@ $.extend($.Event.prototype, {
py = BI.toUpperCase(py); py = BI.toUpperCase(py);
} }
this.empty(); 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 tidx = BI.toUpperCase(textLeft).indexOf(keyword);
var pidx = null; var pidx = null;
if (py != null) { if (py != null) {
@ -47676,7 +47678,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
type: "bi.text_button", type: "bi.text_button",
cls: "bi-water-mark cursor-default", cls: "bi-water-mark cursor-default",
textAlign: "left", textAlign: "left",
height: 20, whiteSpace: "normal",
text: o.watermark, text: o.watermark,
invalid: o.invalid, invalid: o.invalid,
disabled: o.disabled disabled: o.disabled
@ -57426,73 +57428,7 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, {
} }
}); });
BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);/** BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, {
* @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, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-text-icon-popup", baseCls: "bi-text-icon-popup",
@ -58711,7 +58647,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
}); });
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.text_button", type: "bi.text_button",
cls: "state-editor-infinite-text tip-text-style", cls: "bi-water-mark tip-text-style",
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, text: o.text,
@ -58908,31 +58844,31 @@ BI.StateEditor = BI.inherit(BI.Widget, {
if (BI.isNumber(v)) { if (BI.isNumber(v)) {
if (v === BI.Selection.All) { if (v === BI.Selection.All) {
this.text.setText(BI.i18nText("BI-Select_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) { } else if (v === BI.Selection.Multi) {
this.text.setText(BI.i18nText("BI-Select_Part")); this.text.setText(BI.i18nText("BI-Select_Part"));
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} }
return; return;
} }
if (BI.isString(v)) { if (BI.isString(v)) {
this.text.setText(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; return;
} }
if (BI.isArray(v)) { if (BI.isArray(v)) {
if (BI.isEmpty(v)) { if (BI.isEmpty(v)) {
this.text.setText(o.text); 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) { } else if (v.length === 1) {
this.text.setText(v[0]); this.text.setText(v[0]);
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(BI.i18nText("BI-Select_Part")); 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({ this.text = BI.createWidget({
type: "bi.text_button", type: "bi.text_button",
cls: "state-editor-infinite-text", cls: "bi-water-mark",
textAlign: "left", textAlign: "left",
text: o.text, text: o.text,
height: o.height, height: o.height,
@ -59192,26 +59128,26 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
if (BI.isNumber(v)) { if (BI.isNumber(v)) {
if (v === BI.Selection.All) { if (v === BI.Selection.All) {
this.text.setText(BI.i18nText("BI-Already_Selected")); 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) { } else if (v === BI.Selection.Multi) {
this.text.setText(BI.i18nText("BI-Already_Selected")); this.text.setText(BI.i18nText("BI-Already_Selected"));
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} }
return; return;
} }
if (!BI.isArray(v) || v.length === 1) { if (!BI.isArray(v) || v.length === 1) {
this.text.setText(v); this.text.setText(v);
this.text.setTitle(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)) { } else if (BI.isEmpty(v)) {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} else { } else {
this.text.setText(BI.i18nText("BI-Already_Selected")); 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", baseCls: (conf.baseCls || "") + " bi-text-trigger",
height: 24, height: 24,
iconHeight: null, 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; var self = this, o = this.options, c = this._const;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
cls: "select-text-label", cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""),
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text 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) { setText: function (text) {
this.text.setText(text); this.text.setText(text);
} }
@ -62074,6 +62017,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
type: "bi.icon_text_trigger", type: "bi.icon_text_trigger",
element: this, element: this,
text: obj.text, text: obj.text,
textCls: obj.textCls,
iconCls: obj.iconCls, iconCls: obj.iconCls,
height: o.height, height: o.height,
iconHeight: o.iconHeight, iconHeight: o.iconHeight,
@ -62100,11 +62044,13 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
if (BI.isNotNull(result)) { if (BI.isNotNull(result)) {
return { return {
text: result.text, text: result.text,
textCls: "",
iconCls: result.iconCls iconCls: result.iconCls
}; };
} else { } else {
return { return {
text: o.text, text: o.text,
textCls: "bi-water-mark",
iconCls: o.iconCls iconCls: o.iconCls
}; };
} }
@ -62114,6 +62060,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
var obj = this._digist(vals, this.options.items); var obj = this._digist(vals, this.options.items);
this.trigger.setText(obj.text); this.trigger.setText(obj.text);
this.trigger.setIcon(obj.iconCls); this.trigger.setIcon(obj.iconCls);
this.trigger.setTextCls(obj.textCls);
}, },
populate: function (items) { populate: function (items) {
@ -62136,7 +62083,8 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments); var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-text-trigger", 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; var self = this, o = this.options, c = this._const;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
cls: "select-text-label", cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""),
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, 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) { setText: function (text) {
this.text.setText(text); this.text.setText(text);
}, },
@ -62205,12 +62159,14 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
this.options.height -= 2; this.options.height -= 2;
BI.SelectTextTrigger.superclass._init.apply(this, arguments); BI.SelectTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var obj = this._digest(o.value, o.items);
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.text_trigger", type: "bi.text_trigger",
element: this, element: this,
height: o.height, height: o.height,
readonly: o.readonly, readonly: o.readonly,
text: this._digest(o.value, o.items), text: obj.text,
textCls: obj.textCls,
tipType: o.tipType, tipType: o.tipType,
warningTitle: o.warningTitle warningTitle: o.warningTitle
}); });
@ -62228,14 +62184,22 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
}); });
if (result.length > 0) { if (result.length > 0) {
return result.join(","); return {
textCls: "",
text: result.join(",")
}
} else { } 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) { 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) { setTipType: function (v) {
@ -62266,7 +62230,7 @@ BI.SmallSelectTextTrigger = BI.inherit(BI.Trigger, {
this.options.height -= 2; this.options.height -= 2;
BI.SmallSelectTextTrigger.superclass._init.apply(this, arguments); BI.SmallSelectTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var obj = this._digest(o.text, o.items); var obj = this._digest(o.value, o.items);
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.small_text_trigger", type: "bi.small_text_trigger",
element: this, element: this,
@ -85422,6 +85386,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
}, },
_createMonths: function () { _createMonths: function () {
var self = this;
// 纵向排列月 // 纵向排列月
var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12]; var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12];
var items = []; var items = [];
@ -85443,7 +85408,10 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
height: 23, height: 23,
width: 38, width: 38,
value: td, 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 () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;
this.monthMap = {};
return { return {
type: "bi.vertical", type: "bi.vertical",
items: [{ items: [{
type: "bi.year_picker", type: "bi.year_picker",
min: o.min,
max: o.max,
ref: function () { ref: function () {
self.yearPicker = this; self.yearPicker = this;
}, },
@ -85464,6 +85435,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
eventName: BI.YearPicker.EVENT_CHANGE, eventName: BI.YearPicker.EVENT_CHANGE,
action: function () { action: function () {
var value = this.getValue(); var value = this.getValue();
self._checkMonthStatus(value);
self.setValue({ self.setValue({
year: value, year: value,
month: self.selectedMonth 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 () { getValue: function () {
return { return {
@ -85537,8 +85526,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
props: { props: {
baseCls: "bi-year-month-combo bi-border bi-focus-shadow", baseCls: "bi-year-month-combo bi-border bi-focus-shadow",
behaviors: {}, behaviors: {},
min: "1900-01-01", // 最小日期 minDate: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 maxDate: "2099-12-31", // 最大日期
height: 22 height: 22
}, },
@ -85549,8 +85538,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
this.storeTriggerValue = ""; this.storeTriggerValue = "";
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.dynamic_year_month_trigger", type: "bi.dynamic_year_month_trigger",
min: o.min, min: o.minDate,
max: o.max, max: o.maxDate,
height: o.height, height: o.height,
value: o.value || "" value: o.value || ""
}); });
@ -85634,8 +85623,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
} }
}], }],
behaviors: o.behaviors, behaviors: o.behaviors,
min: o.min, min: o.minDate,
max: o.max max: o.maxDate
}, },
value: o.value || "" value: o.value || ""
} }
@ -85989,12 +85978,13 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY
_createEditor: function (isYear) { _createEditor: function (isYear) {
var self = this, o = this.options, c = this._const; var self = this, o = this.options, c = this._const;
var minDate = BI.parseDateTime(o.min, "%Y-%X-%d");
var editor = BI.createWidget({ var editor = BI.createWidget({
type: "bi.sign_editor", type: "bi.sign_editor",
height: o.height, height: o.height,
validationChecker: function (v) { validationChecker: function (v) {
if(isYear) { 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]); return v === "" || ((BI.isPositiveInteger(v) && v >= 1 && v <= 12) && !BI.checkDateVoid(BI.getDate().getFullYear(), v, 1, o.min, o.max)[0]);
}, },

2
dist/base.js vendored

@ -9412,7 +9412,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
type: "bi.text_button", type: "bi.text_button",
cls: "bi-water-mark cursor-default", cls: "bi-water-mark cursor-default",
textAlign: "left", textAlign: "left",
height: 20, whiteSpace: "normal",
text: o.watermark, text: o.watermark,
invalid: o.invalid, invalid: o.invalid,
disabled: o.disabled disabled: o.disabled

192
dist/bundle.ie.js vendored

@ -32414,7 +32414,9 @@ $.extend($.Event.prototype, {
py = BI.toUpperCase(py); py = BI.toUpperCase(py);
} }
this.empty(); 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 tidx = BI.toUpperCase(textLeft).indexOf(keyword);
var pidx = null; var pidx = null;
if (py != null) { if (py != null) {
@ -47272,7 +47274,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
type: "bi.text_button", type: "bi.text_button",
cls: "bi-water-mark cursor-default", cls: "bi-water-mark cursor-default",
textAlign: "left", textAlign: "left",
height: 20, whiteSpace: "normal",
text: o.watermark, text: o.watermark,
invalid: o.invalid, invalid: o.invalid,
disabled: o.disabled disabled: o.disabled
@ -57022,73 +57024,7 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, {
} }
}); });
BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);/** BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, {
* @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, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-text-icon-popup", baseCls: "bi-text-icon-popup",
@ -58307,7 +58243,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
}); });
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.text_button", type: "bi.text_button",
cls: "state-editor-infinite-text tip-text-style", cls: "bi-water-mark tip-text-style",
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, text: o.text,
@ -58504,31 +58440,31 @@ BI.StateEditor = BI.inherit(BI.Widget, {
if (BI.isNumber(v)) { if (BI.isNumber(v)) {
if (v === BI.Selection.All) { if (v === BI.Selection.All) {
this.text.setText(BI.i18nText("BI-Select_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) { } else if (v === BI.Selection.Multi) {
this.text.setText(BI.i18nText("BI-Select_Part")); this.text.setText(BI.i18nText("BI-Select_Part"));
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} }
return; return;
} }
if (BI.isString(v)) { if (BI.isString(v)) {
this.text.setText(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; return;
} }
if (BI.isArray(v)) { if (BI.isArray(v)) {
if (BI.isEmpty(v)) { if (BI.isEmpty(v)) {
this.text.setText(o.text); 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) { } else if (v.length === 1) {
this.text.setText(v[0]); this.text.setText(v[0]);
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(BI.i18nText("BI-Select_Part")); 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({ this.text = BI.createWidget({
type: "bi.text_button", type: "bi.text_button",
cls: "state-editor-infinite-text", cls: "bi-water-mark",
textAlign: "left", textAlign: "left",
text: o.text, text: o.text,
height: o.height, height: o.height,
@ -58788,26 +58724,26 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
if (BI.isNumber(v)) { if (BI.isNumber(v)) {
if (v === BI.Selection.All) { if (v === BI.Selection.All) {
this.text.setText(BI.i18nText("BI-Already_Selected")); 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) { } else if (v === BI.Selection.Multi) {
this.text.setText(BI.i18nText("BI-Already_Selected")); this.text.setText(BI.i18nText("BI-Already_Selected"));
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} }
return; return;
} }
if (!BI.isArray(v) || v.length === 1) { if (!BI.isArray(v) || v.length === 1) {
this.text.setText(v); this.text.setText(v);
this.text.setTitle(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)) { } else if (BI.isEmpty(v)) {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} else { } else {
this.text.setText(BI.i18nText("BI-Already_Selected")); 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", baseCls: (conf.baseCls || "") + " bi-text-trigger",
height: 24, height: 24,
iconHeight: null, 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; var self = this, o = this.options, c = this._const;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
cls: "select-text-label", cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""),
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text 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) { setText: function (text) {
this.text.setText(text); this.text.setText(text);
} }
@ -61670,6 +61613,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
type: "bi.icon_text_trigger", type: "bi.icon_text_trigger",
element: this, element: this,
text: obj.text, text: obj.text,
textCls: obj.textCls,
iconCls: obj.iconCls, iconCls: obj.iconCls,
height: o.height, height: o.height,
iconHeight: o.iconHeight, iconHeight: o.iconHeight,
@ -61696,11 +61640,13 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
if (BI.isNotNull(result)) { if (BI.isNotNull(result)) {
return { return {
text: result.text, text: result.text,
textCls: "",
iconCls: result.iconCls iconCls: result.iconCls
}; };
} else { } else {
return { return {
text: o.text, text: o.text,
textCls: "bi-water-mark",
iconCls: o.iconCls iconCls: o.iconCls
}; };
} }
@ -61710,6 +61656,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
var obj = this._digist(vals, this.options.items); var obj = this._digist(vals, this.options.items);
this.trigger.setText(obj.text); this.trigger.setText(obj.text);
this.trigger.setIcon(obj.iconCls); this.trigger.setIcon(obj.iconCls);
this.trigger.setTextCls(obj.textCls);
}, },
populate: function (items) { populate: function (items) {
@ -61732,7 +61679,8 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments); var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-text-trigger", 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; var self = this, o = this.options, c = this._const;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
cls: "select-text-label", cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""),
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, 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) { setText: function (text) {
this.text.setText(text); this.text.setText(text);
}, },
@ -61801,12 +61755,14 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
this.options.height -= 2; this.options.height -= 2;
BI.SelectTextTrigger.superclass._init.apply(this, arguments); BI.SelectTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var obj = this._digest(o.value, o.items);
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.text_trigger", type: "bi.text_trigger",
element: this, element: this,
height: o.height, height: o.height,
readonly: o.readonly, readonly: o.readonly,
text: this._digest(o.value, o.items), text: obj.text,
textCls: obj.textCls,
tipType: o.tipType, tipType: o.tipType,
warningTitle: o.warningTitle warningTitle: o.warningTitle
}); });
@ -61824,14 +61780,22 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
}); });
if (result.length > 0) { if (result.length > 0) {
return result.join(","); return {
textCls: "",
text: result.join(",")
}
} else { } 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) { 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) { setTipType: function (v) {
@ -61862,7 +61826,7 @@ BI.SmallSelectTextTrigger = BI.inherit(BI.Trigger, {
this.options.height -= 2; this.options.height -= 2;
BI.SmallSelectTextTrigger.superclass._init.apply(this, arguments); BI.SmallSelectTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var obj = this._digest(o.text, o.items); var obj = this._digest(o.value, o.items);
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.small_text_trigger", type: "bi.small_text_trigger",
element: this, element: this,
@ -85018,6 +84982,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
}, },
_createMonths: function () { _createMonths: function () {
var self = this;
// 纵向排列月 // 纵向排列月
var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12]; var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12];
var items = []; var items = [];
@ -85039,7 +85004,10 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
height: 23, height: 23,
width: 38, width: 38,
value: td, 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 () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;
this.monthMap = {};
return { return {
type: "bi.vertical", type: "bi.vertical",
items: [{ items: [{
type: "bi.year_picker", type: "bi.year_picker",
min: o.min,
max: o.max,
ref: function () { ref: function () {
self.yearPicker = this; self.yearPicker = this;
}, },
@ -85060,6 +85031,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
eventName: BI.YearPicker.EVENT_CHANGE, eventName: BI.YearPicker.EVENT_CHANGE,
action: function () { action: function () {
var value = this.getValue(); var value = this.getValue();
self._checkMonthStatus(value);
self.setValue({ self.setValue({
year: value, year: value,
month: self.selectedMonth 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 () { getValue: function () {
return { return {
@ -85133,8 +85122,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
props: { props: {
baseCls: "bi-year-month-combo bi-border bi-focus-shadow", baseCls: "bi-year-month-combo bi-border bi-focus-shadow",
behaviors: {}, behaviors: {},
min: "1900-01-01", // 最小日期 minDate: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 maxDate: "2099-12-31", // 最大日期
height: 22 height: 22
}, },
@ -85145,8 +85134,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
this.storeTriggerValue = ""; this.storeTriggerValue = "";
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.dynamic_year_month_trigger", type: "bi.dynamic_year_month_trigger",
min: o.min, min: o.minDate,
max: o.max, max: o.maxDate,
height: o.height, height: o.height,
value: o.value || "" value: o.value || ""
}); });
@ -85230,8 +85219,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
} }
}], }],
behaviors: o.behaviors, behaviors: o.behaviors,
min: o.min, min: o.minDate,
max: o.max max: o.maxDate
}, },
value: o.value || "" value: o.value || ""
} }
@ -85585,12 +85574,13 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY
_createEditor: function (isYear) { _createEditor: function (isYear) {
var self = this, o = this.options, c = this._const; var self = this, o = this.options, c = this._const;
var minDate = BI.parseDateTime(o.min, "%Y-%X-%d");
var editor = BI.createWidget({ var editor = BI.createWidget({
type: "bi.sign_editor", type: "bi.sign_editor",
height: o.height, height: o.height,
validationChecker: function (v) { validationChecker: function (v) {
if(isYear) { 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]); return v === "" || ((BI.isPositiveInteger(v) && v >= 1 && v <= 12) && !BI.checkDateVoid(BI.getDate().getFullYear(), v, 1, o.min, o.max)[0]);
}, },

192
dist/bundle.js vendored

@ -32414,7 +32414,9 @@ $.extend($.Event.prototype, {
py = BI.toUpperCase(py); py = BI.toUpperCase(py);
} }
this.empty(); 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 tidx = BI.toUpperCase(textLeft).indexOf(keyword);
var pidx = null; var pidx = null;
if (py != null) { if (py != null) {
@ -47676,7 +47678,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
type: "bi.text_button", type: "bi.text_button",
cls: "bi-water-mark cursor-default", cls: "bi-water-mark cursor-default",
textAlign: "left", textAlign: "left",
height: 20, whiteSpace: "normal",
text: o.watermark, text: o.watermark,
invalid: o.invalid, invalid: o.invalid,
disabled: o.disabled disabled: o.disabled
@ -57426,73 +57428,7 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, {
} }
}); });
BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);/** BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, {
* @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, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-text-icon-popup", baseCls: "bi-text-icon-popup",
@ -58711,7 +58647,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
}); });
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.text_button", type: "bi.text_button",
cls: "state-editor-infinite-text tip-text-style", cls: "bi-water-mark tip-text-style",
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, text: o.text,
@ -58908,31 +58844,31 @@ BI.StateEditor = BI.inherit(BI.Widget, {
if (BI.isNumber(v)) { if (BI.isNumber(v)) {
if (v === BI.Selection.All) { if (v === BI.Selection.All) {
this.text.setText(BI.i18nText("BI-Select_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) { } else if (v === BI.Selection.Multi) {
this.text.setText(BI.i18nText("BI-Select_Part")); this.text.setText(BI.i18nText("BI-Select_Part"));
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} }
return; return;
} }
if (BI.isString(v)) { if (BI.isString(v)) {
this.text.setText(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; return;
} }
if (BI.isArray(v)) { if (BI.isArray(v)) {
if (BI.isEmpty(v)) { if (BI.isEmpty(v)) {
this.text.setText(o.text); 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) { } else if (v.length === 1) {
this.text.setText(v[0]); this.text.setText(v[0]);
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(BI.i18nText("BI-Select_Part")); 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({ this.text = BI.createWidget({
type: "bi.text_button", type: "bi.text_button",
cls: "state-editor-infinite-text", cls: "bi-water-mark",
textAlign: "left", textAlign: "left",
text: o.text, text: o.text,
height: o.height, height: o.height,
@ -59192,26 +59128,26 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
if (BI.isNumber(v)) { if (BI.isNumber(v)) {
if (v === BI.Selection.All) { if (v === BI.Selection.All) {
this.text.setText(BI.i18nText("BI-Already_Selected")); 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) { } else if (v === BI.Selection.Multi) {
this.text.setText(BI.i18nText("BI-Already_Selected")); this.text.setText(BI.i18nText("BI-Already_Selected"));
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} }
return; return;
} }
if (!BI.isArray(v) || v.length === 1) { if (!BI.isArray(v) || v.length === 1) {
this.text.setText(v); this.text.setText(v);
this.text.setTitle(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)) { } else if (BI.isEmpty(v)) {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} else { } else {
this.text.setText(BI.i18nText("BI-Already_Selected")); 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", baseCls: (conf.baseCls || "") + " bi-text-trigger",
height: 24, height: 24,
iconHeight: null, 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; var self = this, o = this.options, c = this._const;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
cls: "select-text-label", cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""),
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text 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) { setText: function (text) {
this.text.setText(text); this.text.setText(text);
} }
@ -62074,6 +62017,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
type: "bi.icon_text_trigger", type: "bi.icon_text_trigger",
element: this, element: this,
text: obj.text, text: obj.text,
textCls: obj.textCls,
iconCls: obj.iconCls, iconCls: obj.iconCls,
height: o.height, height: o.height,
iconHeight: o.iconHeight, iconHeight: o.iconHeight,
@ -62100,11 +62044,13 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
if (BI.isNotNull(result)) { if (BI.isNotNull(result)) {
return { return {
text: result.text, text: result.text,
textCls: "",
iconCls: result.iconCls iconCls: result.iconCls
}; };
} else { } else {
return { return {
text: o.text, text: o.text,
textCls: "bi-water-mark",
iconCls: o.iconCls iconCls: o.iconCls
}; };
} }
@ -62114,6 +62060,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
var obj = this._digist(vals, this.options.items); var obj = this._digist(vals, this.options.items);
this.trigger.setText(obj.text); this.trigger.setText(obj.text);
this.trigger.setIcon(obj.iconCls); this.trigger.setIcon(obj.iconCls);
this.trigger.setTextCls(obj.textCls);
}, },
populate: function (items) { populate: function (items) {
@ -62136,7 +62083,8 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments); var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-text-trigger", 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; var self = this, o = this.options, c = this._const;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
cls: "select-text-label", cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""),
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, 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) { setText: function (text) {
this.text.setText(text); this.text.setText(text);
}, },
@ -62205,12 +62159,14 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
this.options.height -= 2; this.options.height -= 2;
BI.SelectTextTrigger.superclass._init.apply(this, arguments); BI.SelectTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var obj = this._digest(o.value, o.items);
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.text_trigger", type: "bi.text_trigger",
element: this, element: this,
height: o.height, height: o.height,
readonly: o.readonly, readonly: o.readonly,
text: this._digest(o.value, o.items), text: obj.text,
textCls: obj.textCls,
tipType: o.tipType, tipType: o.tipType,
warningTitle: o.warningTitle warningTitle: o.warningTitle
}); });
@ -62228,14 +62184,22 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
}); });
if (result.length > 0) { if (result.length > 0) {
return result.join(","); return {
textCls: "",
text: result.join(",")
}
} else { } 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) { 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) { setTipType: function (v) {
@ -62266,7 +62230,7 @@ BI.SmallSelectTextTrigger = BI.inherit(BI.Trigger, {
this.options.height -= 2; this.options.height -= 2;
BI.SmallSelectTextTrigger.superclass._init.apply(this, arguments); BI.SmallSelectTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var obj = this._digest(o.text, o.items); var obj = this._digest(o.value, o.items);
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.small_text_trigger", type: "bi.small_text_trigger",
element: this, element: this,
@ -85422,6 +85386,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
}, },
_createMonths: function () { _createMonths: function () {
var self = this;
// 纵向排列月 // 纵向排列月
var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12]; var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12];
var items = []; var items = [];
@ -85443,7 +85408,10 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
height: 23, height: 23,
width: 38, width: 38,
value: td, 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 () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;
this.monthMap = {};
return { return {
type: "bi.vertical", type: "bi.vertical",
items: [{ items: [{
type: "bi.year_picker", type: "bi.year_picker",
min: o.min,
max: o.max,
ref: function () { ref: function () {
self.yearPicker = this; self.yearPicker = this;
}, },
@ -85464,6 +85435,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
eventName: BI.YearPicker.EVENT_CHANGE, eventName: BI.YearPicker.EVENT_CHANGE,
action: function () { action: function () {
var value = this.getValue(); var value = this.getValue();
self._checkMonthStatus(value);
self.setValue({ self.setValue({
year: value, year: value,
month: self.selectedMonth 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 () { getValue: function () {
return { return {
@ -85537,8 +85526,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
props: { props: {
baseCls: "bi-year-month-combo bi-border bi-focus-shadow", baseCls: "bi-year-month-combo bi-border bi-focus-shadow",
behaviors: {}, behaviors: {},
min: "1900-01-01", // 最小日期 minDate: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 maxDate: "2099-12-31", // 最大日期
height: 22 height: 22
}, },
@ -85549,8 +85538,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
this.storeTriggerValue = ""; this.storeTriggerValue = "";
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.dynamic_year_month_trigger", type: "bi.dynamic_year_month_trigger",
min: o.min, min: o.minDate,
max: o.max, max: o.maxDate,
height: o.height, height: o.height,
value: o.value || "" value: o.value || ""
}); });
@ -85634,8 +85623,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
} }
}], }],
behaviors: o.behaviors, behaviors: o.behaviors,
min: o.min, min: o.minDate,
max: o.max max: o.maxDate
}, },
value: o.value || "" value: o.value || ""
} }
@ -85989,12 +85978,13 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY
_createEditor: function (isYear) { _createEditor: function (isYear) {
var self = this, o = this.options, c = this._const; var self = this, o = this.options, c = this._const;
var minDate = BI.parseDateTime(o.min, "%Y-%X-%d");
var editor = BI.createWidget({ var editor = BI.createWidget({
type: "bi.sign_editor", type: "bi.sign_editor",
height: o.height, height: o.height,
validationChecker: function (v) { validationChecker: function (v) {
if(isYear) { 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]); return v === "" || ((BI.isPositiveInteger(v) && v >= 1 && v <= 12) && !BI.checkDateVoid(BI.getDate().getFullYear(), v, 1, o.min, o.max)[0]);
}, },

144
dist/case.js vendored

@ -5004,73 +5004,7 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, {
} }
}); });
BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);/** BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, {
* @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, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-text-icon-popup", baseCls: "bi-text-icon-popup",
@ -6289,7 +6223,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
}); });
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.text_button", type: "bi.text_button",
cls: "state-editor-infinite-text tip-text-style", cls: "bi-water-mark tip-text-style",
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, text: o.text,
@ -6486,31 +6420,31 @@ BI.StateEditor = BI.inherit(BI.Widget, {
if (BI.isNumber(v)) { if (BI.isNumber(v)) {
if (v === BI.Selection.All) { if (v === BI.Selection.All) {
this.text.setText(BI.i18nText("BI-Select_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) { } else if (v === BI.Selection.Multi) {
this.text.setText(BI.i18nText("BI-Select_Part")); this.text.setText(BI.i18nText("BI-Select_Part"));
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} }
return; return;
} }
if (BI.isString(v)) { if (BI.isString(v)) {
this.text.setText(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; return;
} }
if (BI.isArray(v)) { if (BI.isArray(v)) {
if (BI.isEmpty(v)) { if (BI.isEmpty(v)) {
this.text.setText(o.text); 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) { } else if (v.length === 1) {
this.text.setText(v[0]); this.text.setText(v[0]);
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(BI.i18nText("BI-Select_Part")); 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({ this.text = BI.createWidget({
type: "bi.text_button", type: "bi.text_button",
cls: "state-editor-infinite-text", cls: "bi-water-mark",
textAlign: "left", textAlign: "left",
text: o.text, text: o.text,
height: o.height, height: o.height,
@ -6770,26 +6704,26 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
if (BI.isNumber(v)) { if (BI.isNumber(v)) {
if (v === BI.Selection.All) { if (v === BI.Selection.All) {
this.text.setText(BI.i18nText("BI-Already_Selected")); 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) { } else if (v === BI.Selection.Multi) {
this.text.setText(BI.i18nText("BI-Already_Selected")); this.text.setText(BI.i18nText("BI-Already_Selected"));
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} }
return; return;
} }
if (!BI.isArray(v) || v.length === 1) { if (!BI.isArray(v) || v.length === 1) {
this.text.setText(v); this.text.setText(v);
this.text.setTitle(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)) { } else if (BI.isEmpty(v)) {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} else { } else {
this.text.setText(BI.i18nText("BI-Already_Selected")); 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", baseCls: (conf.baseCls || "") + " bi-text-trigger",
height: 24, height: 24,
iconHeight: null, 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; var self = this, o = this.options, c = this._const;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
cls: "select-text-label", cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""),
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text 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) { setText: function (text) {
this.text.setText(text); this.text.setText(text);
} }
@ -9652,6 +9593,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
type: "bi.icon_text_trigger", type: "bi.icon_text_trigger",
element: this, element: this,
text: obj.text, text: obj.text,
textCls: obj.textCls,
iconCls: obj.iconCls, iconCls: obj.iconCls,
height: o.height, height: o.height,
iconHeight: o.iconHeight, iconHeight: o.iconHeight,
@ -9678,11 +9620,13 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
if (BI.isNotNull(result)) { if (BI.isNotNull(result)) {
return { return {
text: result.text, text: result.text,
textCls: "",
iconCls: result.iconCls iconCls: result.iconCls
}; };
} else { } else {
return { return {
text: o.text, text: o.text,
textCls: "bi-water-mark",
iconCls: o.iconCls iconCls: o.iconCls
}; };
} }
@ -9692,6 +9636,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
var obj = this._digist(vals, this.options.items); var obj = this._digist(vals, this.options.items);
this.trigger.setText(obj.text); this.trigger.setText(obj.text);
this.trigger.setIcon(obj.iconCls); this.trigger.setIcon(obj.iconCls);
this.trigger.setTextCls(obj.textCls);
}, },
populate: function (items) { populate: function (items) {
@ -9714,7 +9659,8 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments); var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-text-trigger", 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; var self = this, o = this.options, c = this._const;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
cls: "select-text-label", cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""),
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, 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) { setText: function (text) {
this.text.setText(text); this.text.setText(text);
}, },
@ -9783,12 +9735,14 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
this.options.height -= 2; this.options.height -= 2;
BI.SelectTextTrigger.superclass._init.apply(this, arguments); BI.SelectTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var obj = this._digest(o.value, o.items);
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.text_trigger", type: "bi.text_trigger",
element: this, element: this,
height: o.height, height: o.height,
readonly: o.readonly, readonly: o.readonly,
text: this._digest(o.value, o.items), text: obj.text,
textCls: obj.textCls,
tipType: o.tipType, tipType: o.tipType,
warningTitle: o.warningTitle warningTitle: o.warningTitle
}); });
@ -9806,14 +9760,22 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
}); });
if (result.length > 0) { if (result.length > 0) {
return result.join(","); return {
textCls: "",
text: result.join(",")
}
} else { } 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) { 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) { setTipType: function (v) {
@ -9844,7 +9806,7 @@ BI.SmallSelectTextTrigger = BI.inherit(BI.Trigger, {
this.options.height -= 2; this.options.height -= 2;
BI.SmallSelectTextTrigger.superclass._init.apply(this, arguments); BI.SmallSelectTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var obj = this._digest(o.text, o.items); var obj = this._digest(o.value, o.items);
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.small_text_trigger", type: "bi.small_text_trigger",
element: this, element: this,

4
dist/core.js vendored

@ -32414,7 +32414,9 @@ $.extend($.Event.prototype, {
py = BI.toUpperCase(py); py = BI.toUpperCase(py);
} }
this.empty(); 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 tidx = BI.toUpperCase(textLeft).indexOf(keyword);
var pidx = null; var pidx = null;
if (py != null) { if (py != null) {

192
dist/fineui.ie.js vendored

@ -32659,7 +32659,9 @@ $.extend($.Event.prototype, {
py = BI.toUpperCase(py); py = BI.toUpperCase(py);
} }
this.empty(); 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 tidx = BI.toUpperCase(textLeft).indexOf(keyword);
var pidx = null; var pidx = null;
if (py != null) { if (py != null) {
@ -47517,7 +47519,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
type: "bi.text_button", type: "bi.text_button",
cls: "bi-water-mark cursor-default", cls: "bi-water-mark cursor-default",
textAlign: "left", textAlign: "left",
height: 20, whiteSpace: "normal",
text: o.watermark, text: o.watermark,
invalid: o.invalid, invalid: o.invalid,
disabled: o.disabled disabled: o.disabled
@ -57267,73 +57269,7 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, {
} }
}); });
BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);/** BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, {
* @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, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-text-icon-popup", baseCls: "bi-text-icon-popup",
@ -58552,7 +58488,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
}); });
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.text_button", type: "bi.text_button",
cls: "state-editor-infinite-text tip-text-style", cls: "bi-water-mark tip-text-style",
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, text: o.text,
@ -58749,31 +58685,31 @@ BI.StateEditor = BI.inherit(BI.Widget, {
if (BI.isNumber(v)) { if (BI.isNumber(v)) {
if (v === BI.Selection.All) { if (v === BI.Selection.All) {
this.text.setText(BI.i18nText("BI-Select_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) { } else if (v === BI.Selection.Multi) {
this.text.setText(BI.i18nText("BI-Select_Part")); this.text.setText(BI.i18nText("BI-Select_Part"));
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} }
return; return;
} }
if (BI.isString(v)) { if (BI.isString(v)) {
this.text.setText(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; return;
} }
if (BI.isArray(v)) { if (BI.isArray(v)) {
if (BI.isEmpty(v)) { if (BI.isEmpty(v)) {
this.text.setText(o.text); 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) { } else if (v.length === 1) {
this.text.setText(v[0]); this.text.setText(v[0]);
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(BI.i18nText("BI-Select_Part")); 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({ this.text = BI.createWidget({
type: "bi.text_button", type: "bi.text_button",
cls: "state-editor-infinite-text", cls: "bi-water-mark",
textAlign: "left", textAlign: "left",
text: o.text, text: o.text,
height: o.height, height: o.height,
@ -59033,26 +58969,26 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
if (BI.isNumber(v)) { if (BI.isNumber(v)) {
if (v === BI.Selection.All) { if (v === BI.Selection.All) {
this.text.setText(BI.i18nText("BI-Already_Selected")); 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) { } else if (v === BI.Selection.Multi) {
this.text.setText(BI.i18nText("BI-Already_Selected")); this.text.setText(BI.i18nText("BI-Already_Selected"));
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} }
return; return;
} }
if (!BI.isArray(v) || v.length === 1) { if (!BI.isArray(v) || v.length === 1) {
this.text.setText(v); this.text.setText(v);
this.text.setTitle(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)) { } else if (BI.isEmpty(v)) {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} else { } else {
this.text.setText(BI.i18nText("BI-Already_Selected")); 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", baseCls: (conf.baseCls || "") + " bi-text-trigger",
height: 24, height: 24,
iconHeight: null, 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; var self = this, o = this.options, c = this._const;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
cls: "select-text-label", cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""),
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text 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) { setText: function (text) {
this.text.setText(text); this.text.setText(text);
} }
@ -61915,6 +61858,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
type: "bi.icon_text_trigger", type: "bi.icon_text_trigger",
element: this, element: this,
text: obj.text, text: obj.text,
textCls: obj.textCls,
iconCls: obj.iconCls, iconCls: obj.iconCls,
height: o.height, height: o.height,
iconHeight: o.iconHeight, iconHeight: o.iconHeight,
@ -61941,11 +61885,13 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
if (BI.isNotNull(result)) { if (BI.isNotNull(result)) {
return { return {
text: result.text, text: result.text,
textCls: "",
iconCls: result.iconCls iconCls: result.iconCls
}; };
} else { } else {
return { return {
text: o.text, text: o.text,
textCls: "bi-water-mark",
iconCls: o.iconCls iconCls: o.iconCls
}; };
} }
@ -61955,6 +61901,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
var obj = this._digist(vals, this.options.items); var obj = this._digist(vals, this.options.items);
this.trigger.setText(obj.text); this.trigger.setText(obj.text);
this.trigger.setIcon(obj.iconCls); this.trigger.setIcon(obj.iconCls);
this.trigger.setTextCls(obj.textCls);
}, },
populate: function (items) { populate: function (items) {
@ -61977,7 +61924,8 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments); var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-text-trigger", 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; var self = this, o = this.options, c = this._const;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
cls: "select-text-label", cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""),
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, 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) { setText: function (text) {
this.text.setText(text); this.text.setText(text);
}, },
@ -62046,12 +62000,14 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
this.options.height -= 2; this.options.height -= 2;
BI.SelectTextTrigger.superclass._init.apply(this, arguments); BI.SelectTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var obj = this._digest(o.value, o.items);
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.text_trigger", type: "bi.text_trigger",
element: this, element: this,
height: o.height, height: o.height,
readonly: o.readonly, readonly: o.readonly,
text: this._digest(o.value, o.items), text: obj.text,
textCls: obj.textCls,
tipType: o.tipType, tipType: o.tipType,
warningTitle: o.warningTitle warningTitle: o.warningTitle
}); });
@ -62069,14 +62025,22 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
}); });
if (result.length > 0) { if (result.length > 0) {
return result.join(","); return {
textCls: "",
text: result.join(",")
}
} else { } 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) { 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) { setTipType: function (v) {
@ -62107,7 +62071,7 @@ BI.SmallSelectTextTrigger = BI.inherit(BI.Trigger, {
this.options.height -= 2; this.options.height -= 2;
BI.SmallSelectTextTrigger.superclass._init.apply(this, arguments); BI.SmallSelectTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var obj = this._digest(o.text, o.items); var obj = this._digest(o.value, o.items);
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.small_text_trigger", type: "bi.small_text_trigger",
element: this, element: this,
@ -85263,6 +85227,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
}, },
_createMonths: function () { _createMonths: function () {
var self = this;
// 纵向排列月 // 纵向排列月
var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12]; var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12];
var items = []; var items = [];
@ -85284,7 +85249,10 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
height: 23, height: 23,
width: 38, width: 38,
value: td, 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 () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;
this.monthMap = {};
return { return {
type: "bi.vertical", type: "bi.vertical",
items: [{ items: [{
type: "bi.year_picker", type: "bi.year_picker",
min: o.min,
max: o.max,
ref: function () { ref: function () {
self.yearPicker = this; self.yearPicker = this;
}, },
@ -85305,6 +85276,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
eventName: BI.YearPicker.EVENT_CHANGE, eventName: BI.YearPicker.EVENT_CHANGE,
action: function () { action: function () {
var value = this.getValue(); var value = this.getValue();
self._checkMonthStatus(value);
self.setValue({ self.setValue({
year: value, year: value,
month: self.selectedMonth 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 () { getValue: function () {
return { return {
@ -85378,8 +85367,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
props: { props: {
baseCls: "bi-year-month-combo bi-border bi-focus-shadow", baseCls: "bi-year-month-combo bi-border bi-focus-shadow",
behaviors: {}, behaviors: {},
min: "1900-01-01", // 最小日期 minDate: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 maxDate: "2099-12-31", // 最大日期
height: 22 height: 22
}, },
@ -85390,8 +85379,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
this.storeTriggerValue = ""; this.storeTriggerValue = "";
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.dynamic_year_month_trigger", type: "bi.dynamic_year_month_trigger",
min: o.min, min: o.minDate,
max: o.max, max: o.maxDate,
height: o.height, height: o.height,
value: o.value || "" value: o.value || ""
}); });
@ -85475,8 +85464,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
} }
}], }],
behaviors: o.behaviors, behaviors: o.behaviors,
min: o.min, min: o.minDate,
max: o.max max: o.maxDate
}, },
value: o.value || "" value: o.value || ""
} }
@ -85830,12 +85819,13 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY
_createEditor: function (isYear) { _createEditor: function (isYear) {
var self = this, o = this.options, c = this._const; var self = this, o = this.options, c = this._const;
var minDate = BI.parseDateTime(o.min, "%Y-%X-%d");
var editor = BI.createWidget({ var editor = BI.createWidget({
type: "bi.sign_editor", type: "bi.sign_editor",
height: o.height, height: o.height,
validationChecker: function (v) { validationChecker: function (v) {
if(isYear) { 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]); return v === "" || ((BI.isPositiveInteger(v) && v >= 1 && v <= 12) && !BI.checkDateVoid(BI.getDate().getFullYear(), v, 1, o.min, o.max)[0]);
}, },

192
dist/fineui.js vendored

@ -32659,7 +32659,9 @@ $.extend($.Event.prototype, {
py = BI.toUpperCase(py); py = BI.toUpperCase(py);
} }
this.empty(); 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 tidx = BI.toUpperCase(textLeft).indexOf(keyword);
var pidx = null; var pidx = null;
if (py != null) { if (py != null) {
@ -47921,7 +47923,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
type: "bi.text_button", type: "bi.text_button",
cls: "bi-water-mark cursor-default", cls: "bi-water-mark cursor-default",
textAlign: "left", textAlign: "left",
height: 20, whiteSpace: "normal",
text: o.watermark, text: o.watermark,
invalid: o.invalid, invalid: o.invalid,
disabled: o.disabled disabled: o.disabled
@ -57671,73 +57673,7 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, {
} }
}); });
BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);/** BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, {
* @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, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-text-icon-popup", baseCls: "bi-text-icon-popup",
@ -58956,7 +58892,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
}); });
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.text_button", type: "bi.text_button",
cls: "state-editor-infinite-text tip-text-style", cls: "bi-water-mark tip-text-style",
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, text: o.text,
@ -59153,31 +59089,31 @@ BI.StateEditor = BI.inherit(BI.Widget, {
if (BI.isNumber(v)) { if (BI.isNumber(v)) {
if (v === BI.Selection.All) { if (v === BI.Selection.All) {
this.text.setText(BI.i18nText("BI-Select_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) { } else if (v === BI.Selection.Multi) {
this.text.setText(BI.i18nText("BI-Select_Part")); this.text.setText(BI.i18nText("BI-Select_Part"));
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} }
return; return;
} }
if (BI.isString(v)) { if (BI.isString(v)) {
this.text.setText(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; return;
} }
if (BI.isArray(v)) { if (BI.isArray(v)) {
if (BI.isEmpty(v)) { if (BI.isEmpty(v)) {
this.text.setText(o.text); 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) { } else if (v.length === 1) {
this.text.setText(v[0]); this.text.setText(v[0]);
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(BI.i18nText("BI-Select_Part")); 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({ this.text = BI.createWidget({
type: "bi.text_button", type: "bi.text_button",
cls: "state-editor-infinite-text", cls: "bi-water-mark",
textAlign: "left", textAlign: "left",
text: o.text, text: o.text,
height: o.height, height: o.height,
@ -59437,26 +59373,26 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
if (BI.isNumber(v)) { if (BI.isNumber(v)) {
if (v === BI.Selection.All) { if (v === BI.Selection.All) {
this.text.setText(BI.i18nText("BI-Already_Selected")); 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) { } else if (v === BI.Selection.Multi) {
this.text.setText(BI.i18nText("BI-Already_Selected")); this.text.setText(BI.i18nText("BI-Already_Selected"));
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} }
return; return;
} }
if (!BI.isArray(v) || v.length === 1) { if (!BI.isArray(v) || v.length === 1) {
this.text.setText(v); this.text.setText(v);
this.text.setTitle(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)) { } else if (BI.isEmpty(v)) {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} else { } else {
this.text.setText(BI.i18nText("BI-Already_Selected")); 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", baseCls: (conf.baseCls || "") + " bi-text-trigger",
height: 24, height: 24,
iconHeight: null, 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; var self = this, o = this.options, c = this._const;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
cls: "select-text-label", cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""),
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text 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) { setText: function (text) {
this.text.setText(text); this.text.setText(text);
} }
@ -62319,6 +62262,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
type: "bi.icon_text_trigger", type: "bi.icon_text_trigger",
element: this, element: this,
text: obj.text, text: obj.text,
textCls: obj.textCls,
iconCls: obj.iconCls, iconCls: obj.iconCls,
height: o.height, height: o.height,
iconHeight: o.iconHeight, iconHeight: o.iconHeight,
@ -62345,11 +62289,13 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
if (BI.isNotNull(result)) { if (BI.isNotNull(result)) {
return { return {
text: result.text, text: result.text,
textCls: "",
iconCls: result.iconCls iconCls: result.iconCls
}; };
} else { } else {
return { return {
text: o.text, text: o.text,
textCls: "bi-water-mark",
iconCls: o.iconCls iconCls: o.iconCls
}; };
} }
@ -62359,6 +62305,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
var obj = this._digist(vals, this.options.items); var obj = this._digist(vals, this.options.items);
this.trigger.setText(obj.text); this.trigger.setText(obj.text);
this.trigger.setIcon(obj.iconCls); this.trigger.setIcon(obj.iconCls);
this.trigger.setTextCls(obj.textCls);
}, },
populate: function (items) { populate: function (items) {
@ -62381,7 +62328,8 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments); var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-text-trigger", 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; var self = this, o = this.options, c = this._const;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
cls: "select-text-label", cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""),
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, 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) { setText: function (text) {
this.text.setText(text); this.text.setText(text);
}, },
@ -62450,12 +62404,14 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
this.options.height -= 2; this.options.height -= 2;
BI.SelectTextTrigger.superclass._init.apply(this, arguments); BI.SelectTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var obj = this._digest(o.value, o.items);
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.text_trigger", type: "bi.text_trigger",
element: this, element: this,
height: o.height, height: o.height,
readonly: o.readonly, readonly: o.readonly,
text: this._digest(o.value, o.items), text: obj.text,
textCls: obj.textCls,
tipType: o.tipType, tipType: o.tipType,
warningTitle: o.warningTitle warningTitle: o.warningTitle
}); });
@ -62473,14 +62429,22 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
}); });
if (result.length > 0) { if (result.length > 0) {
return result.join(","); return {
textCls: "",
text: result.join(",")
}
} else { } 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) { 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) { setTipType: function (v) {
@ -62511,7 +62475,7 @@ BI.SmallSelectTextTrigger = BI.inherit(BI.Trigger, {
this.options.height -= 2; this.options.height -= 2;
BI.SmallSelectTextTrigger.superclass._init.apply(this, arguments); BI.SmallSelectTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var obj = this._digest(o.text, o.items); var obj = this._digest(o.value, o.items);
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.small_text_trigger", type: "bi.small_text_trigger",
element: this, element: this,
@ -85667,6 +85631,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
}, },
_createMonths: function () { _createMonths: function () {
var self = this;
// 纵向排列月 // 纵向排列月
var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12]; var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12];
var items = []; var items = [];
@ -85688,7 +85653,10 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
height: 23, height: 23,
width: 38, width: 38,
value: td, 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 () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;
this.monthMap = {};
return { return {
type: "bi.vertical", type: "bi.vertical",
items: [{ items: [{
type: "bi.year_picker", type: "bi.year_picker",
min: o.min,
max: o.max,
ref: function () { ref: function () {
self.yearPicker = this; self.yearPicker = this;
}, },
@ -85709,6 +85680,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
eventName: BI.YearPicker.EVENT_CHANGE, eventName: BI.YearPicker.EVENT_CHANGE,
action: function () { action: function () {
var value = this.getValue(); var value = this.getValue();
self._checkMonthStatus(value);
self.setValue({ self.setValue({
year: value, year: value,
month: self.selectedMonth 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 () { getValue: function () {
return { return {
@ -85782,8 +85771,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
props: { props: {
baseCls: "bi-year-month-combo bi-border bi-focus-shadow", baseCls: "bi-year-month-combo bi-border bi-focus-shadow",
behaviors: {}, behaviors: {},
min: "1900-01-01", // 最小日期 minDate: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 maxDate: "2099-12-31", // 最大日期
height: 22 height: 22
}, },
@ -85794,8 +85783,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
this.storeTriggerValue = ""; this.storeTriggerValue = "";
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.dynamic_year_month_trigger", type: "bi.dynamic_year_month_trigger",
min: o.min, min: o.minDate,
max: o.max, max: o.maxDate,
height: o.height, height: o.height,
value: o.value || "" value: o.value || ""
}); });
@ -85879,8 +85868,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
} }
}], }],
behaviors: o.behaviors, behaviors: o.behaviors,
min: o.min, min: o.minDate,
max: o.max max: o.maxDate
}, },
value: o.value || "" value: o.value || ""
} }
@ -86234,12 +86223,13 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY
_createEditor: function (isYear) { _createEditor: function (isYear) {
var self = this, o = this.options, c = this._const; var self = this, o = this.options, c = this._const;
var minDate = BI.parseDateTime(o.min, "%Y-%X-%d");
var editor = BI.createWidget({ var editor = BI.createWidget({
type: "bi.sign_editor", type: "bi.sign_editor",
height: o.height, height: o.height,
validationChecker: function (v) { validationChecker: function (v) {
if(isYear) { 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]); return v === "" || ((BI.isPositiveInteger(v) && v >= 1 && v <= 12) && !BI.checkDateVoid(BI.getDate().getFullYear(), v, 1, o.min, o.max)[0]);
}, },

230
dist/fineui_without_jquery_polyfill.js vendored

@ -28756,6 +28756,48 @@ describe("TextTest", function () {
expect(text.element.children(".bi-keyword-red-mark").length).to.equal(0); expect(text.element.children(".bi-keyword-red-mark").length).to.equal(0);
text.destroy(); 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.prepares.push(function () {
BI.Resizers = new BI.ResizeController(); BI.Resizers = new BI.ResizeController();
@ -35240,7 +35282,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
type: "bi.text_button", type: "bi.text_button",
cls: "bi-water-mark cursor-default", cls: "bi-water-mark cursor-default",
textAlign: "left", textAlign: "left",
height: 20, whiteSpace: "normal",
text: o.watermark, text: o.watermark,
invalid: o.invalid, invalid: o.invalid,
disabled: o.disabled disabled: o.disabled
@ -40452,73 +40494,7 @@ BI.TextValueCheckCombo = BI.inherit(BI.Widget, {
} }
}); });
BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);/** BI.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, {
* @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, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-text-icon-popup", baseCls: "bi-text-icon-popup",
@ -41737,7 +41713,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
}); });
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.text_button", type: "bi.text_button",
cls: "state-editor-infinite-text tip-text-style", cls: "bi-water-mark tip-text-style",
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, text: o.text,
@ -41934,31 +41910,31 @@ BI.StateEditor = BI.inherit(BI.Widget, {
if (BI.isNumber(v)) { if (BI.isNumber(v)) {
if (v === BI.Selection.All) { if (v === BI.Selection.All) {
this.text.setText(BI.i18nText("BI-Select_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) { } else if (v === BI.Selection.Multi) {
this.text.setText(BI.i18nText("BI-Select_Part")); this.text.setText(BI.i18nText("BI-Select_Part"));
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} }
return; return;
} }
if (BI.isString(v)) { if (BI.isString(v)) {
this.text.setText(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; return;
} }
if (BI.isArray(v)) { if (BI.isArray(v)) {
if (BI.isEmpty(v)) { if (BI.isEmpty(v)) {
this.text.setText(o.text); 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) { } else if (v.length === 1) {
this.text.setText(v[0]); this.text.setText(v[0]);
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(BI.i18nText("BI-Select_Part")); 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({ this.text = BI.createWidget({
type: "bi.text_button", type: "bi.text_button",
cls: "state-editor-infinite-text", cls: "bi-water-mark",
textAlign: "left", textAlign: "left",
text: o.text, text: o.text,
height: o.height, height: o.height,
@ -42218,26 +42194,26 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
if (BI.isNumber(v)) { if (BI.isNumber(v)) {
if (v === BI.Selection.All) { if (v === BI.Selection.All) {
this.text.setText(BI.i18nText("BI-Already_Selected")); 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) { } else if (v === BI.Selection.Multi) {
this.text.setText(BI.i18nText("BI-Already_Selected")); this.text.setText(BI.i18nText("BI-Already_Selected"));
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} }
return; return;
} }
if (!BI.isArray(v) || v.length === 1) { if (!BI.isArray(v) || v.length === 1) {
this.text.setText(v); this.text.setText(v);
this.text.setTitle(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)) { } else if (BI.isEmpty(v)) {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} else { } else {
this.text.setText(BI.i18nText("BI-Already_Selected")); 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", baseCls: (conf.baseCls || "") + " bi-text-trigger",
height: 24, height: 24,
iconHeight: null, 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; var self = this, o = this.options, c = this._const;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
cls: "select-text-label", cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""),
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text 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) { setText: function (text) {
this.text.setText(text); this.text.setText(text);
} }
@ -44824,6 +44807,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
type: "bi.icon_text_trigger", type: "bi.icon_text_trigger",
element: this, element: this,
text: obj.text, text: obj.text,
textCls: obj.textCls,
iconCls: obj.iconCls, iconCls: obj.iconCls,
height: o.height, height: o.height,
iconHeight: o.iconHeight, iconHeight: o.iconHeight,
@ -44850,11 +44834,13 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
if (BI.isNotNull(result)) { if (BI.isNotNull(result)) {
return { return {
text: result.text, text: result.text,
textCls: "",
iconCls: result.iconCls iconCls: result.iconCls
}; };
} else { } else {
return { return {
text: o.text, text: o.text,
textCls: "bi-water-mark",
iconCls: o.iconCls iconCls: o.iconCls
}; };
} }
@ -44864,6 +44850,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
var obj = this._digist(vals, this.options.items); var obj = this._digist(vals, this.options.items);
this.trigger.setText(obj.text); this.trigger.setText(obj.text);
this.trigger.setIcon(obj.iconCls); this.trigger.setIcon(obj.iconCls);
this.trigger.setTextCls(obj.textCls);
}, },
populate: function (items) { populate: function (items) {
@ -44886,7 +44873,8 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments); var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-text-trigger", 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; var self = this, o = this.options, c = this._const;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
cls: "select-text-label", cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""),
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, 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) { setText: function (text) {
this.text.setText(text); this.text.setText(text);
}, },
@ -44955,12 +44949,14 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
this.options.height -= 2; this.options.height -= 2;
BI.SelectTextTrigger.superclass._init.apply(this, arguments); BI.SelectTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var obj = this._digest(o.value, o.items);
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.text_trigger", type: "bi.text_trigger",
element: this, element: this,
height: o.height, height: o.height,
readonly: o.readonly, readonly: o.readonly,
text: this._digest(o.value, o.items), text: obj.text,
textCls: obj.textCls,
tipType: o.tipType, tipType: o.tipType,
warningTitle: o.warningTitle warningTitle: o.warningTitle
}); });
@ -44978,14 +44974,22 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
}); });
if (result.length > 0) { if (result.length > 0) {
return result.join(","); return {
textCls: "",
text: result.join(",")
}
} else { } 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) { 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) { setTipType: function (v) {
@ -45016,7 +45020,7 @@ BI.SmallSelectTextTrigger = BI.inherit(BI.Trigger, {
this.options.height -= 2; this.options.height -= 2;
BI.SmallSelectTextTrigger.superclass._init.apply(this, arguments); BI.SmallSelectTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var obj = this._digest(o.text, o.items); var obj = this._digest(o.value, o.items);
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.small_text_trigger", type: "bi.small_text_trigger",
element: this, element: this,
@ -68172,6 +68176,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
}, },
_createMonths: function () { _createMonths: function () {
var self = this;
// 纵向排列月 // 纵向排列月
var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12]; var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12];
var items = []; var items = [];
@ -68193,7 +68198,10 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
height: 23, height: 23,
width: 38, width: 38,
value: td, 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 () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;
this.monthMap = {};
return { return {
type: "bi.vertical", type: "bi.vertical",
items: [{ items: [{
type: "bi.year_picker", type: "bi.year_picker",
min: o.min,
max: o.max,
ref: function () { ref: function () {
self.yearPicker = this; self.yearPicker = this;
}, },
@ -68214,6 +68225,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
eventName: BI.YearPicker.EVENT_CHANGE, eventName: BI.YearPicker.EVENT_CHANGE,
action: function () { action: function () {
var value = this.getValue(); var value = this.getValue();
self._checkMonthStatus(value);
self.setValue({ self.setValue({
year: value, year: value,
month: self.selectedMonth 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 () { getValue: function () {
return { return {
@ -68287,8 +68316,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
props: { props: {
baseCls: "bi-year-month-combo bi-border bi-focus-shadow", baseCls: "bi-year-month-combo bi-border bi-focus-shadow",
behaviors: {}, behaviors: {},
min: "1900-01-01", // 最小日期 minDate: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 maxDate: "2099-12-31", // 最大日期
height: 22 height: 22
}, },
@ -68299,8 +68328,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
this.storeTriggerValue = ""; this.storeTriggerValue = "";
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.dynamic_year_month_trigger", type: "bi.dynamic_year_month_trigger",
min: o.min, min: o.minDate,
max: o.max, max: o.maxDate,
height: o.height, height: o.height,
value: o.value || "" value: o.value || ""
}); });
@ -68384,8 +68413,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
} }
}], }],
behaviors: o.behaviors, behaviors: o.behaviors,
min: o.min, min: o.minDate,
max: o.max max: o.maxDate
}, },
value: o.value || "" value: o.value || ""
} }
@ -68739,12 +68768,13 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY
_createEditor: function (isYear) { _createEditor: function (isYear) {
var self = this, o = this.options, c = this._const; var self = this, o = this.options, c = this._const;
var minDate = BI.parseDateTime(o.min, "%Y-%X-%d");
var editor = BI.createWidget({ var editor = BI.createWidget({
type: "bi.sign_editor", type: "bi.sign_editor",
height: o.height, height: o.height,
validationChecker: function (v) { validationChecker: function (v) {
if(isYear) { 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]); return v === "" || ((BI.isPositiveInteger(v) && v >= 1 && v <= 12) && !BI.checkDateVoid(BI.getDate().getFullYear(), v, 1, o.min, o.max)[0]);
}, },

42
dist/widget.js vendored

@ -23054,6 +23054,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
}, },
_createMonths: function () { _createMonths: function () {
var self = this;
// 纵向排列月 // 纵向排列月
var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12]; var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12];
var items = []; var items = [];
@ -23075,7 +23076,10 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
height: 23, height: 23,
width: 38, width: 38,
value: td, 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 () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;
this.monthMap = {};
return { return {
type: "bi.vertical", type: "bi.vertical",
items: [{ items: [{
type: "bi.year_picker", type: "bi.year_picker",
min: o.min,
max: o.max,
ref: function () { ref: function () {
self.yearPicker = this; self.yearPicker = this;
}, },
@ -23096,6 +23103,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
eventName: BI.YearPicker.EVENT_CHANGE, eventName: BI.YearPicker.EVENT_CHANGE,
action: function () { action: function () {
var value = this.getValue(); var value = this.getValue();
self._checkMonthStatus(value);
self.setValue({ self.setValue({
year: value, year: value,
month: self.selectedMonth 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 () { getValue: function () {
return { return {
@ -23169,8 +23194,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
props: { props: {
baseCls: "bi-year-month-combo bi-border bi-focus-shadow", baseCls: "bi-year-month-combo bi-border bi-focus-shadow",
behaviors: {}, behaviors: {},
min: "1900-01-01", // 最小日期 minDate: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 maxDate: "2099-12-31", // 最大日期
height: 22 height: 22
}, },
@ -23181,8 +23206,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
this.storeTriggerValue = ""; this.storeTriggerValue = "";
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.dynamic_year_month_trigger", type: "bi.dynamic_year_month_trigger",
min: o.min, min: o.minDate,
max: o.max, max: o.maxDate,
height: o.height, height: o.height,
value: o.value || "" value: o.value || ""
}); });
@ -23266,8 +23291,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
} }
}], }],
behaviors: o.behaviors, behaviors: o.behaviors,
min: o.min, min: o.minDate,
max: o.max max: o.maxDate
}, },
value: o.value || "" value: o.value || ""
} }
@ -23621,12 +23646,13 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY
_createEditor: function (isYear) { _createEditor: function (isYear) {
var self = this, o = this.options, c = this._const; var self = this, o = this.options, c = this._const;
var minDate = BI.parseDateTime(o.min, "%Y-%X-%d");
var editor = BI.createWidget({ var editor = BI.createWidget({
type: "bi.sign_editor", type: "bi.sign_editor",
height: o.height, height: o.height,
validationChecker: function (v) { validationChecker: function (v) {
if(isYear) { 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]); return v === "" || ((BI.isPositiveInteger(v) && v >= 1 && v <= 12) && !BI.checkDateVoid(BI.getDate().getFullYear(), v, 1, o.min, o.max)[0]);
}, },

2
src/base/single/editor/editor.textarea.js

@ -83,7 +83,7 @@ BI.TextAreaEditor = BI.inherit(BI.Single, {
type: "bi.text_button", type: "bi.text_button",
cls: "bi-water-mark cursor-default", cls: "bi-water-mark cursor-default",
textAlign: "left", textAlign: "left",
height: 20, whiteSpace: "normal",
text: o.watermark, text: o.watermark,
invalid: o.invalid, invalid: o.invalid,
disabled: o.disabled disabled: o.disabled

67
src/case/combo/textvaluecheckcombo/combo.textvaluechecksmall.js

@ -1,67 +0,0 @@
/**
* @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);

16
src/case/editor/editor.state.js

@ -46,7 +46,7 @@ BI.StateEditor = BI.inherit(BI.Widget, {
}); });
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.text_button", type: "bi.text_button",
cls: "state-editor-infinite-text tip-text-style", cls: "bi-water-mark tip-text-style",
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, text: o.text,
@ -243,31 +243,31 @@ BI.StateEditor = BI.inherit(BI.Widget, {
if (BI.isNumber(v)) { if (BI.isNumber(v)) {
if (v === BI.Selection.All) { if (v === BI.Selection.All) {
this.text.setText(BI.i18nText("BI-Select_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) { } else if (v === BI.Selection.Multi) {
this.text.setText(BI.i18nText("BI-Select_Part")); this.text.setText(BI.i18nText("BI-Select_Part"));
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} }
return; return;
} }
if (BI.isString(v)) { if (BI.isString(v)) {
this.text.setText(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; return;
} }
if (BI.isArray(v)) { if (BI.isArray(v)) {
if (BI.isEmpty(v)) { if (BI.isEmpty(v)) {
this.text.setText(o.text); 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) { } else if (v.length === 1) {
this.text.setText(v[0]); this.text.setText(v[0]);
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(BI.i18nText("BI-Select_Part")); this.text.setText(BI.i18nText("BI-Select_Part"));
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} }
} }
}, },

14
src/case/editor/editor.state.simple.js

@ -47,7 +47,7 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
}); });
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.text_button", type: "bi.text_button",
cls: "state-editor-infinite-text", cls: "bi-water-mark",
textAlign: "left", textAlign: "left",
text: o.text, text: o.text,
height: o.height, height: o.height,
@ -229,26 +229,26 @@ BI.SimpleStateEditor = BI.inherit(BI.Widget, {
if (BI.isNumber(v)) { if (BI.isNumber(v)) {
if (v === BI.Selection.All) { if (v === BI.Selection.All) {
this.text.setText(BI.i18nText("BI-Already_Selected")); 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) { } else if (v === BI.Selection.Multi) {
this.text.setText(BI.i18nText("BI-Already_Selected")); this.text.setText(BI.i18nText("BI-Already_Selected"));
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} else { } else {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} }
return; return;
} }
if (!BI.isArray(v) || v.length === 1) { if (!BI.isArray(v) || v.length === 1) {
this.text.setText(v); this.text.setText(v);
this.text.setTitle(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)) { } else if (BI.isEmpty(v)) {
this.text.setText(o.text); this.text.setText(o.text);
this.text.element.addClass("state-editor-infinite-text"); this.text.element.addClass("bi-water-mark");
} else { } else {
this.text.setText(BI.i18nText("BI-Already_Selected")); this.text.setText(BI.i18nText("BI-Already_Selected"));
this.text.element.removeClass("state-editor-infinite-text"); this.text.element.removeClass("bi-water-mark");
} }
} }
}); });

12
src/case/trigger/trigger.icon.text.js

@ -16,7 +16,8 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
baseCls: (conf.baseCls || "") + " bi-text-trigger", baseCls: (conf.baseCls || "") + " bi-text-trigger",
height: 24, height: 24,
iconHeight: null, iconHeight: null,
iconWidth: null iconWidth: null,
textCls: ""
}); });
}, },
@ -25,7 +26,7 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
var self = this, o = this.options, c = this._const; var self = this, o = this.options, c = this._const;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
cls: "select-text-label", cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""),
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text text: o.text
@ -90,6 +91,13 @@ BI.IconTextTrigger = BI.inherit(BI.Trigger, {
} }
}, },
setTextCls: function(cls) {
var o = this.options;
var oldCls = o.textCls;
o.textCls = cls;
this.text.element.removeClass(oldCls).addClass(cls);
},
setText: function (text) { setText: function (text) {
this.text.setText(text); this.text.setText(text);
} }

4
src/case/trigger/trigger.icon.text.select.js

@ -22,6 +22,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
type: "bi.icon_text_trigger", type: "bi.icon_text_trigger",
element: this, element: this,
text: obj.text, text: obj.text,
textCls: obj.textCls,
iconCls: obj.iconCls, iconCls: obj.iconCls,
height: o.height, height: o.height,
iconHeight: o.iconHeight, iconHeight: o.iconHeight,
@ -48,11 +49,13 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
if (BI.isNotNull(result)) { if (BI.isNotNull(result)) {
return { return {
text: result.text, text: result.text,
textCls: "",
iconCls: result.iconCls iconCls: result.iconCls
}; };
} else { } else {
return { return {
text: o.text, text: o.text,
textCls: "bi-water-mark",
iconCls: o.iconCls iconCls: o.iconCls
}; };
} }
@ -62,6 +65,7 @@ BI.SelectIconTextTrigger = BI.inherit(BI.Trigger, {
var obj = this._digist(vals, this.options.items); var obj = this._digist(vals, this.options.items);
this.trigger.setText(obj.text); this.trigger.setText(obj.text);
this.trigger.setIcon(obj.iconCls); this.trigger.setIcon(obj.iconCls);
this.trigger.setTextCls(obj.textCls);
}, },
populate: function (items) { populate: function (items) {

12
src/case/trigger/trigger.text.js

@ -14,7 +14,8 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments); var conf = BI.TextTrigger.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-text-trigger", baseCls: (conf.baseCls || "") + " bi-text-trigger",
height: 24 height: 24,
textCls: ""
}); });
}, },
@ -23,7 +24,7 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
var self = this, o = this.options, c = this._const; var self = this, o = this.options, c = this._const;
this.text = BI.createWidget({ this.text = BI.createWidget({
type: "bi.label", type: "bi.label",
cls: "select-text-label", cls: "select-text-label" + (BI.isKey(o.textCls) ? (" " + o.textCls) : ""),
textAlign: "left", textAlign: "left",
height: o.height, height: o.height,
text: o.text, text: o.text,
@ -54,6 +55,13 @@ BI.TextTrigger = BI.inherit(BI.Trigger, {
}); });
}, },
setTextCls: function(cls) {
var o = this.options;
var oldCls = o.textCls;
o.textCls = cls;
this.text.element.removeClass(oldCls).addClass(cls);
},
setText: function (text) { setText: function (text) {
this.text.setText(text); this.text.setText(text);
}, },

18
src/case/trigger/trigger.text.select.js

@ -18,12 +18,14 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
this.options.height -= 2; this.options.height -= 2;
BI.SelectTextTrigger.superclass._init.apply(this, arguments); BI.SelectTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var obj = this._digest(o.value, o.items);
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.text_trigger", type: "bi.text_trigger",
element: this, element: this,
height: o.height, height: o.height,
readonly: o.readonly, readonly: o.readonly,
text: this._digest(o.value, o.items), text: obj.text,
textCls: obj.textCls,
tipType: o.tipType, tipType: o.tipType,
warningTitle: o.warningTitle warningTitle: o.warningTitle
}); });
@ -41,14 +43,22 @@ BI.SelectTextTrigger = BI.inherit(BI.Trigger, {
}); });
if (result.length > 0) { if (result.length > 0) {
return result.join(","); return {
textCls: "",
text: result.join(",")
}
} else { } 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) { 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) { setTipType: function (v) {

2
src/case/trigger/trigger.text.select.small.js

@ -17,7 +17,7 @@ BI.SmallSelectTextTrigger = BI.inherit(BI.Trigger, {
this.options.height -= 2; this.options.height -= 2;
BI.SmallSelectTextTrigger.superclass._init.apply(this, arguments); BI.SmallSelectTextTrigger.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
var obj = this._digest(o.text, o.items); var obj = this._digest(o.value, o.items);
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.small_text_trigger", type: "bi.small_text_trigger",
element: this, element: this,

27
src/widget/yearmonth/card.static.yearmonth.js

@ -6,6 +6,7 @@ BI.StaticYearMonthCard = BI.inherit(BI.Widget, {
}, },
_createMonths: function () { _createMonths: function () {
var self = this;
// 纵向排列月 // 纵向排列月
var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12]; var month = [1, 7, 2, 8, 3, 9, 4, 10, 5, 11, 6, 12];
var items = []; var items = [];
@ -27,7 +28,10 @@ BI.StaticYearMonthCard = BI.inherit(BI.Widget, {
height: 23, height: 23,
width: 38, width: 38,
value: td, value: td,
text: td text: td,
ref: function (_ref) {
self.monthMap[j === 0 ? i : i + 6] = _ref;
}
}; };
}); });
}); });
@ -35,10 +39,13 @@ BI.StaticYearMonthCard = BI.inherit(BI.Widget, {
render: function () { render: function () {
var self = this, o = this.options; var self = this, o = this.options;
this.monthMap = {};
return { return {
type: "bi.vertical", type: "bi.vertical",
items: [{ items: [{
type: "bi.year_picker", type: "bi.year_picker",
min: o.min,
max: o.max,
ref: function () { ref: function () {
self.yearPicker = this; self.yearPicker = this;
}, },
@ -48,6 +55,7 @@ BI.StaticYearMonthCard = BI.inherit(BI.Widget, {
eventName: BI.YearPicker.EVENT_CHANGE, eventName: BI.YearPicker.EVENT_CHANGE,
action: function () { action: function () {
var value = this.getValue(); var value = this.getValue();
self._checkMonthStatus(value);
self.setValue({ self.setValue({
year: value, year: value,
month: self.selectedMonth month: self.selectedMonth
@ -87,6 +95,23 @@ BI.StaticYearMonthCard = BI.inherit(BI.Widget, {
}; };
}, },
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 () { getValue: function () {
return { return {

12
src/widget/yearmonth/combo.yearmonth.js

@ -3,8 +3,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
props: { props: {
baseCls: "bi-year-month-combo bi-border bi-focus-shadow", baseCls: "bi-year-month-combo bi-border bi-focus-shadow",
behaviors: {}, behaviors: {},
min: "1900-01-01", // 最小日期 minDate: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 maxDate: "2099-12-31", // 最大日期
height: 22 height: 22
}, },
@ -15,8 +15,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
this.storeTriggerValue = ""; this.storeTriggerValue = "";
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.dynamic_year_month_trigger", type: "bi.dynamic_year_month_trigger",
min: o.min, min: o.minDate,
max: o.max, max: o.maxDate,
height: o.height, height: o.height,
value: o.value || "" value: o.value || ""
}); });
@ -100,8 +100,8 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
} }
}], }],
behaviors: o.behaviors, behaviors: o.behaviors,
min: o.min, min: o.minDate,
max: o.max max: o.maxDate
}, },
value: o.value || "" value: o.value || ""
} }

3
src/widget/yearmonth/trigger.yearmonth.js

@ -62,12 +62,13 @@ BI.DynamicYearMonthTrigger = BI.inherit(BI.Trigger, {
_createEditor: function (isYear) { _createEditor: function (isYear) {
var self = this, o = this.options, c = this._const; var self = this, o = this.options, c = this._const;
var minDate = BI.parseDateTime(o.min, "%Y-%X-%d");
var editor = BI.createWidget({ var editor = BI.createWidget({
type: "bi.sign_editor", type: "bi.sign_editor",
height: o.height, height: o.height,
validationChecker: function (v) { validationChecker: function (v) {
if(isYear) { 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]); return v === "" || ((BI.isPositiveInteger(v) && v >= 1 && v <= 12) && !BI.checkDateVoid(BI.getDate().getFullYear(), v, 1, o.min, o.max)[0]);
}, },

Loading…
Cancel
Save