guy 7 years ago
parent
commit
feacef899f
  1. 3
      demo/version.js
  2. 24
      dist/_fineui.min.js
  3. 308
      dist/bundle.js
  4. 26
      dist/bundle.min.js
  5. 3
      dist/config.js
  6. 24
      dist/fineui.min.js
  7. 305
      dist/widget.js
  8. 3
      public/js/index.js
  9. 9
      src/widget/dynamic/datepane/datepane.js
  10. 44
      src/widget/dynamic/year/combo.year.js
  11. 10
      src/widget/dynamic/year/popup.year.js
  12. 40
      src/widget/dynamic/year/trigger.year.js
  13. 1
      src/widget/dynamic/yearmonth/card.static.yearmonth.js
  14. 44
      src/widget/dynamic/yearmonth/combo.yearmonth.js
  15. 10
      src/widget/dynamic/yearmonth/popup.yearmonth.js
  16. 12
      src/widget/dynamic/yearmonth/trigger.yearmonth.js
  17. 1
      src/widget/dynamic/yearquarter/card.static.yearquarter.js
  18. 44
      src/widget/dynamic/yearquarter/combo.yearquarter.js
  19. 10
      src/widget/dynamic/yearquarter/popup.yearquarter.js
  20. 12
      src/widget/dynamic/yearquarter/trigger.yearquarter.js
  21. 28
      src/widget/dynamicdate/dynamicdate.combo.js
  22. 7
      src/widget/dynamicdate/dynamicdate.param.item.js
  23. 11
      src/widget/dynamicdate/dynamicdate.popup.js
  24. 20
      src/widget/dynamicdate/dynamicdate.trigger.js
  25. 2
      src/widget/multidate/multidate.popup.js
  26. 3
      ui/js/index.js

3
demo/version.js

@ -145,5 +145,6 @@ BI.i18n = {
"BI-Basic_Current_Month": "本月", "BI-Basic_Current_Month": "本月",
"BI-Basic_Current_Quarter": "本季度", "BI-Basic_Current_Quarter": "本季度",
"BI-Basic_Year_Month": "年月", "BI-Basic_Year_Month": "年月",
"BI-Basic_Year_Quarter": "年季度" "BI-Basic_Year_Quarter": "年季度",
"BI-Basic_Input_Can_Not_Null": "输入框不能为空"
}; };

24
dist/_fineui.min.js vendored

File diff suppressed because one or more lines are too long

308
dist/bundle.js vendored

@ -89230,7 +89230,8 @@ BI.shortcut("bi.static_date_pane_card", BI.StaticDatePaneCard);BI.DynamicDatePan
type: "bi.vtape", type: "bi.vtape",
items: [{ items: [{
el: { el: {
type: "bi.button_group", type: "bi.linear_segment",
cls: "bi-border-bottom",
height: 30, height: 30,
items: BI.createItems([{ items: BI.createItems([{
text: BI.i18nText("BI-Multi_Date_YMD"), text: BI.i18nText("BI-Multi_Date_YMD"),
@ -89239,12 +89240,8 @@ BI.shortcut("bi.static_date_pane_card", BI.StaticDatePaneCard);BI.DynamicDatePan
text: BI.i18nText("BI-Basic_Dynamic_Title"), text: BI.i18nText("BI-Basic_Dynamic_Title"),
value: BI.DynamicDatePane.Dynamic value: BI.DynamicDatePane.Dynamic
}], { }], {
textAlign: "center", textAlign: "center"
cls: "bi-list-item-active"
}), }),
layouts: [{
type: "bi.center"
}],
listeners: [{ listeners: [{
eventName: BI.ButtonGroup.EVENT_CHANGE, eventName: BI.ButtonGroup.EVENT_CHANGE,
action: function () { action: function () {
@ -89584,7 +89581,7 @@ BI.StaticYearCard.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.static_year_card", BI.StaticYearCard);BI.DynamicYearCombo = BI.inherit(BI.Widget, { BI.shortcut("bi.static_year_card", BI.StaticYearCard);BI.DynamicYearCombo = BI.inherit(BI.Widget, {
props: { props: {
baseCls: "bi-year-combo", baseCls: "bi-year-combo bi-border",
behaviors: {}, behaviors: {},
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 max: "2099-12-31", // 最大日期
@ -89629,7 +89626,6 @@ BI.shortcut("bi.static_year_card", BI.StaticYearCard);BI.DynamicYearCombo = BI.i
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.combo", type: "bi.combo",
element: this,
isNeedAdjustHeight: false, isNeedAdjustHeight: false,
isNeedAdjustWidth: false, isNeedAdjustWidth: false,
el: this.trigger, el: this.trigger,
@ -89682,11 +89678,52 @@ BI.shortcut("bi.static_year_card", BI.StaticYearCard);BI.DynamicYearCombo = BI.i
self.popup.setValue(self.storeValue); self.popup.setValue(self.storeValue);
self.fireEvent(BI.DynamicYearCombo.EVENT_BEFORE_POPUPVIEW); self.fireEvent(BI.DynamicYearCombo.EVENT_BEFORE_POPUPVIEW);
}); });
BI.createWidget({
type: "bi.htape",
element: this,
ref: function () {
self.comboWrapper = this;
},
items: [{
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font",
width: 24,
height: 24,
ref: function () {
self.changeIcon = this;
}
},
width: 30
}, this.combo]
});
this._checkDynamicValue(o.value);
},
_checkDynamicValue: function (v) {
var type = null;
if (BI.isNotNull(v)) {
type = v.type;
}
switch (type) {
case BI.DynamicYearCombo.Dynamic:
this.changeIcon.setVisible(true);
this.comboWrapper.attr("items")[0].width = 30;
this.comboWrapper.resize();
break;
default:
this.comboWrapper.attr("items")[0].width = 0;
this.comboWrapper.resize();
this.changeIcon.setVisible(false);
break;
}
}, },
setValue: function (v) { setValue: function (v) {
this.storeValue = v; this.storeValue = v;
this.trigger.setValue(v); this.trigger.setValue(v);
this._checkDynamicValue(v);
}, },
getValue: function () { getValue: function () {
@ -89799,6 +89836,8 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, {
self.dateTab = this; self.dateTab = this;
}, },
tab: { tab: {
type: "bi.linear_segment",
cls: "bi-border-bottom",
height: this.constants.tabHeight, height: this.constants.tabHeight,
items: BI.createItems([{ items: BI.createItems([{
text: BI.i18nText("BI-Basic_Year_Fen"), text: BI.i18nText("BI-Basic_Year_Fen"),
@ -89807,12 +89846,8 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, {
text: BI.i18nText("BI-Basic_Dynamic_Title"), text: BI.i18nText("BI-Basic_Dynamic_Title"),
value: BI.DynamicYearCombo.Dynamic value: BI.DynamicYearCombo.Dynamic
}], { }], {
textAlign: "center", textAlign: "center"
cls: "bi-list-item-active" })
}),
layouts: [{
type: "bi.center"
}]
}, },
cardCreator: function (v) { cardCreator: function (v) {
switch (v) { switch (v) {
@ -89919,7 +89954,7 @@ BI.shortcut("bi.dynamic_year_popup", BI.DynamicYearPopup);BI.DynamicYearTrigger
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.DynamicYearTrigger.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.DynamicYearTrigger.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-year-trigger bi-border", extraCls: "bi-year-trigger",
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 max: "2099-12-31", // 最大日期
height: 24 height: 24
@ -89939,6 +89974,7 @@ BI.shortcut("bi.dynamic_year_popup", BI.DynamicYearPopup);BI.DynamicYearTrigger
}, },
hgap: c.hgap, hgap: c.hgap,
vgap: c.vgap, vgap: c.vgap,
watermark: BI.i18nText("BI-Basic_Unrestricted"),
allowBlank: true, allowBlank: true,
errorText: function (v) { errorText: function (v) {
return !BI.isPositiveInteger(v) ? c.errorText : c.errorTextInvalid; return !BI.isPositiveInteger(v) ? c.errorText : c.errorTextInvalid;
@ -89980,32 +90016,30 @@ BI.shortcut("bi.dynamic_year_popup", BI.DynamicYearPopup);BI.DynamicYearTrigger
BI.createWidget({ BI.createWidget({
element: this, element: this,
type: "bi.htape", type: "bi.htape",
items: [ items: [{
{ el: this.editor
el: this.editor }, {
}, { el: {
el: { type: "bi.text_button",
type: "bi.text_button", baseCls: "bi-trigger-year-text",
baseCls: "bi-trigger-year-text", text: BI.i18nText("BI-Multi_Date_Year"),
text: BI.i18nText("BI-Multi_Date_Year"),
width: o.height
},
width: o.height width: o.height
}, { },
el: { width: o.height
type: "bi.trigger_icon_button", }, {
width: o.height el: {
}, type: "bi.trigger_icon_button",
width: o.height width: o.height
} },
] width: o.height
}]
}); });
this.setValue(o.value); this.setValue(o.value);
}, },
_getText: function (obj) { _getText: function (obj) {
var value = ""; var value = "";
if(BI.isNotNull(obj.year)) { if(BI.isNotNull(obj.year) && obj.year !== 0) {
value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind"));
} }
return value; return value;
@ -90015,7 +90049,7 @@ BI.shortcut("bi.dynamic_year_popup", BI.DynamicYearPopup);BI.DynamicYearTrigger
var dateStr = date.print("%Y"); var dateStr = date.print("%Y");
this.editor.setState(dateStr); this.editor.setState(dateStr);
this.editor.setValue(dateStr); this.editor.setValue(dateStr);
this.setTitle(text + ":" + dateStr); this.setTitle(BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr));
}, },
setValue: function (v) { setValue: function (v) {
@ -90034,6 +90068,7 @@ BI.shortcut("bi.dynamic_year_popup", BI.DynamicYearPopup);BI.DynamicYearTrigger
break; break;
case BI.DynamicDateCombo.Static: case BI.DynamicDateCombo.Static:
default: default:
value = value || {};
this.editor.setState(value.year); this.editor.setState(value.year);
this.editor.setValue(value.year); this.editor.setValue(value.year);
this.editor.setTitle(value.year); this.editor.setTitle(value.year);
@ -90207,6 +90242,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
listeners: [{ listeners: [{
eventName: BI.ButtonGroup.EVENT_CHANGE, eventName: BI.ButtonGroup.EVENT_CHANGE,
action: function () { action: function () {
self.selectedYear = self.yearPicker.getValue();
self.selectedMonth = this.getValue()[0]; self.selectedMonth = this.getValue()[0];
self.fireEvent(BI.StaticYearMonthCard.EVENT_CHANGE); self.fireEvent(BI.StaticYearMonthCard.EVENT_CHANGE);
} }
@ -90247,7 +90283,7 @@ BI.StaticYearMonthCard.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.static_year_month_card", BI.StaticYearMonthCard);BI.DynamicYearMonthCombo = BI.inherit(BI.Widget, { BI.shortcut("bi.static_year_month_card", BI.StaticYearMonthCard);BI.DynamicYearMonthCombo = BI.inherit(BI.Widget, {
props: { props: {
baseCls: "bi-year-month-combo", baseCls: "bi-year-month-combo bi-border",
behaviors: {}, behaviors: {},
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 max: "2099-12-31", // 最大日期
@ -90283,7 +90319,6 @@ BI.shortcut("bi.static_year_month_card", BI.StaticYearMonthCard);BI.DynamicYearM
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.combo", type: "bi.combo",
element: this,
isNeedAdjustHeight: false, isNeedAdjustHeight: false,
isNeedAdjustWidth: false, isNeedAdjustWidth: false,
el: this.trigger, el: this.trigger,
@ -90336,11 +90371,52 @@ BI.shortcut("bi.static_year_month_card", BI.StaticYearMonthCard);BI.DynamicYearM
self.popup.setValue(self.storeValue); self.popup.setValue(self.storeValue);
self.fireEvent(BI.DynamicYearMonthCombo.EVENT_BEFORE_POPUPVIEW); self.fireEvent(BI.DynamicYearMonthCombo.EVENT_BEFORE_POPUPVIEW);
}); });
BI.createWidget({
type: "bi.htape",
element: this,
ref: function () {
self.comboWrapper = this;
},
items: [{
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font",
width: 24,
height: 24,
ref: function () {
self.changeIcon = this;
}
},
width: 30
}, this.combo]
});
this._checkDynamicValue(o.value);
},
_checkDynamicValue: function (v) {
var type = null;
if (BI.isNotNull(v)) {
type = v.type;
}
switch (type) {
case BI.DynamicYearMonthCombo.Dynamic:
this.changeIcon.setVisible(true);
this.comboWrapper.attr("items")[0].width = 30;
this.comboWrapper.resize();
break;
default:
this.comboWrapper.attr("items")[0].width = 0;
this.comboWrapper.resize();
this.changeIcon.setVisible(false);
break;
}
}, },
setValue: function (v) { setValue: function (v) {
this.storeValue = v; this.storeValue = v;
this.trigger.setValue(v); this.trigger.setValue(v);
this._checkDynamicValue(v);
}, },
getValue: function () { getValue: function () {
@ -90453,6 +90529,8 @@ BI.DynamicYearMonthPopup = BI.inherit(BI.Widget, {
self.dateTab = this; self.dateTab = this;
}, },
tab: { tab: {
type: "bi.linear_segment",
cls: "bi-border-bottom",
height: this.constants.tabHeight, height: this.constants.tabHeight,
items: BI.createItems([{ items: BI.createItems([{
text: BI.i18nText("BI-Basic_Year_Fen"), text: BI.i18nText("BI-Basic_Year_Fen"),
@ -90461,12 +90539,8 @@ BI.DynamicYearMonthPopup = BI.inherit(BI.Widget, {
text: BI.i18nText("BI-Basic_Dynamic_Title"), text: BI.i18nText("BI-Basic_Dynamic_Title"),
value: BI.DynamicYearCombo.Dynamic value: BI.DynamicYearCombo.Dynamic
}], { }], {
textAlign: "center", textAlign: "center"
cls: "bi-list-item-active" })
}),
layouts: [{
type: "bi.center"
}]
}, },
cardCreator: function (v) { cardCreator: function (v) {
switch (v) { switch (v) {
@ -90572,7 +90646,7 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY
}, },
props: { props: {
extraCls: "bi-year-month-trigger bi-border", extraCls: "bi-year-month-trigger",
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 max: "2099-12-31", // 最大日期
height: 24 height: 24
@ -90627,11 +90701,15 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY
type: "bi.sign_editor", type: "bi.sign_editor",
height: o.height, height: o.height,
validationChecker: function (v) { validationChecker: function (v) {
return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(isYear ? v : BI.getDate().getFullYear(), isYear ? 1 : v, 1, o.min, o.max)[0]); if(isYear) {
return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, 1, 1, o.min, o.max)[0]);
}
return v === "" || ((v >= 1 && v <= 12) && !BI.checkDateVoid(BI.getDate().getFullYear(), v, 1, o.min, o.max)[0]);
}, },
quitChecker: function () { quitChecker: function () {
return false; return false;
}, },
watermark: BI.i18nText("BI-Basic_Unrestricted"),
errorText: function (v) { errorText: function (v) {
return !BI.isPositiveInteger(v) ? c.errorText : c.errorTextInvalid; return !BI.isPositiveInteger(v) ? c.errorText : c.errorTextInvalid;
}, },
@ -90701,7 +90779,7 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY
if(BI.isNotNull(obj.year)) { if(BI.isNotNull(obj.year)) {
value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind"));
} }
if(BI.isNotNull(obj.month)) { if(BI.isNotNull(obj.month) && obj.month !== 0) {
value += Math.abs(obj.month) + BI.i18nText("BI-Basic_Year") + (obj.month < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); value += Math.abs(obj.month) + BI.i18nText("BI-Basic_Year") + (obj.month < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind"));
} }
return value; return value;
@ -90711,7 +90789,7 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY
var dateStr = date.print("%Y-%x"); var dateStr = date.print("%Y-%x");
this.yearEditor.setValue(date.getFullYear()); this.yearEditor.setValue(date.getFullYear());
this.monthEditor.setValue(date.getMonth() + 1); this.monthEditor.setValue(date.getMonth() + 1);
this.setTitle(text + ":" + dateStr); this.setTitle(BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr));
}, },
setValue: function (v) { setValue: function (v) {
@ -90894,6 +90972,7 @@ BI.shortcut("bi.dynamic_year_quarter_card", BI.DynamicYearQuarterCard);BI.Static
listeners: [{ listeners: [{
eventName: BI.ButtonGroup.EVENT_CHANGE, eventName: BI.ButtonGroup.EVENT_CHANGE,
action: function () { action: function () {
self.selectedYear = self.yearPicker.getValue();
self.selectedQuarter = this.getValue()[0]; self.selectedQuarter = this.getValue()[0];
self.fireEvent(BI.StaticYearQuarterCard.EVENT_CHANGE); self.fireEvent(BI.StaticYearQuarterCard.EVENT_CHANGE);
} }
@ -90934,7 +91013,7 @@ BI.StaticYearQuarterCard.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.static_year_quarter_card", BI.StaticYearQuarterCard);BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, { BI.shortcut("bi.static_year_quarter_card", BI.StaticYearQuarterCard);BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
props: { props: {
baseCls: "bi-year-quarter-combo", baseCls: "bi-year-quarter-combo bi-border",
behaviors: {}, behaviors: {},
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 max: "2099-12-31", // 最大日期
@ -90970,7 +91049,6 @@ BI.shortcut("bi.static_year_quarter_card", BI.StaticYearQuarterCard);BI.DynamicY
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.combo", type: "bi.combo",
element: this,
isNeedAdjustHeight: false, isNeedAdjustHeight: false,
isNeedAdjustWidth: false, isNeedAdjustWidth: false,
el: this.trigger, el: this.trigger,
@ -91023,11 +91101,52 @@ BI.shortcut("bi.static_year_quarter_card", BI.StaticYearQuarterCard);BI.DynamicY
self.popup.setValue(self.storeValue); self.popup.setValue(self.storeValue);
self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_BEFORE_POPUPVIEW); self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_BEFORE_POPUPVIEW);
}); });
BI.createWidget({
type: "bi.htape",
element: this,
ref: function () {
self.comboWrapper = this;
},
items: [{
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font",
width: 24,
height: 24,
ref: function () {
self.changeIcon = this;
}
},
width: 30
}, this.combo]
});
this._checkDynamicValue(o.value);
},
_checkDynamicValue: function (v) {
var type = null;
if (BI.isNotNull(v)) {
type = v.type;
}
switch (type) {
case BI.DynamicYearQuarterCombo.Dynamic:
this.changeIcon.setVisible(true);
this.comboWrapper.attr("items")[0].width = 30;
this.comboWrapper.resize();
break;
default:
this.comboWrapper.attr("items")[0].width = 0;
this.comboWrapper.resize();
this.changeIcon.setVisible(false);
break;
}
}, },
setValue: function (v) { setValue: function (v) {
this.storeValue = v; this.storeValue = v;
this.trigger.setValue(v); this.trigger.setValue(v);
this._checkDynamicValue(v);
}, },
getValue: function () { getValue: function () {
@ -91133,6 +91252,8 @@ BI.extend(BI.DynamicYearQuarterCombo, {
self.dateTab = this; self.dateTab = this;
}, },
tab: { tab: {
type: "bi.linear_segment",
cls: "bi-border-bottom",
height: this.constants.tabHeight, height: this.constants.tabHeight,
items: BI.createItems([{ items: BI.createItems([{
text: BI.i18nText("BI-Basic_Year_Fen"), text: BI.i18nText("BI-Basic_Year_Fen"),
@ -91141,12 +91262,8 @@ BI.extend(BI.DynamicYearQuarterCombo, {
text: BI.i18nText("BI-Basic_Dynamic_Title"), text: BI.i18nText("BI-Basic_Dynamic_Title"),
value: BI.DynamicYearQuarterCombo.Dynamic value: BI.DynamicYearQuarterCombo.Dynamic
}], { }], {
textAlign: "center", textAlign: "center"
cls: "bi-list-item-active" })
}),
layouts: [{
type: "bi.center"
}]
}, },
cardCreator: function (v) { cardCreator: function (v) {
switch (v) { switch (v) {
@ -91252,7 +91369,7 @@ BI.shortcut("bi.dynamic_year_quarter_popup", BI.DynamicYearQuarterPopup);BI.Dyna
}, },
props: { props: {
extraCls: "bi-year-quarter-trigger bi-border", extraCls: "bi-year-quarter-trigger",
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 max: "2099-12-31", // 最大日期
height: 24 height: 24
@ -91307,7 +91424,10 @@ BI.shortcut("bi.dynamic_year_quarter_popup", BI.DynamicYearQuarterPopup);BI.Dyna
type: "bi.sign_editor", type: "bi.sign_editor",
height: o.height, height: o.height,
validationChecker: function (v) { validationChecker: function (v) {
return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(isYear ? v : BI.getDate().getFullYear(), isYear ? 1 : v, 1, o.min, o.max)[0]); if(isYear) {
return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, 1, 1, o.min, o.max)[0]);
}
return v === "" || ((v >= 1 && v <= 4) && !BI.checkDateVoid(BI.getDate().getFullYear(), v, 1, o.min, o.max)[0]);
}, },
quitChecker: function () { quitChecker: function () {
return false; return false;
@ -91315,6 +91435,7 @@ BI.shortcut("bi.dynamic_year_quarter_popup", BI.DynamicYearQuarterPopup);BI.Dyna
errorText: function (v) { errorText: function (v) {
return !BI.isPositiveInteger(v) ? c.errorText : c.errorTextInvalid; return !BI.isPositiveInteger(v) ? c.errorText : c.errorTextInvalid;
}, },
watermark: BI.i18nText("BI-Basic_Unrestricted"),
hgap: c.hgap, hgap: c.hgap,
vgap: c.vgap, vgap: c.vgap,
allowBlank: true allowBlank: true
@ -91381,7 +91502,7 @@ BI.shortcut("bi.dynamic_year_quarter_popup", BI.DynamicYearQuarterPopup);BI.Dyna
if(BI.isNotNull(obj.year)) { if(BI.isNotNull(obj.year)) {
value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind"));
} }
if(BI.isNotNull(obj.quarter)) { if(BI.isNotNull(obj.quarter) && obj.quarter !== 0) {
value += Math.abs(obj.quarter) + BI.i18nText("BI-Basic_Year") + (obj.quarter < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); value += Math.abs(obj.quarter) + BI.i18nText("BI-Basic_Year") + (obj.quarter < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind"));
} }
return value; return value;
@ -91391,7 +91512,7 @@ BI.shortcut("bi.dynamic_year_quarter_popup", BI.DynamicYearQuarterPopup);BI.Dyna
var dateStr = date.print("%Y-%x"); var dateStr = date.print("%Y-%x");
this.yearEditor.setValue(date.getFullYear()); this.yearEditor.setValue(date.getFullYear());
this.quarterEditor.setValue(date.getQuarter()); this.quarterEditor.setValue(date.getQuarter());
this.setTitle(text + ":" + dateStr); this.setTitle(BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr));
}, },
setValue: function (v) { setValue: function (v) {
@ -91817,6 +91938,17 @@ BI.extend(BI.DynamicDateCard, {
return { return {
type: "bi.htape", type: "bi.htape",
items: [{ items: [{
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font",
width: 24,
height: 24,
ref: function () {
self.changeIcon = this;
}
},
width: 30
}, {
type: "bi.absolute", type: "bi.absolute",
items: [{ items: [{
el: { el: {
@ -91979,19 +92111,8 @@ BI.extend(BI.DynamicDateCard, {
}] }]
}, },
top: 0, top: 0,
left: 0 right: 0
}] }]
}, {
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font",
width: 24,
height: 24,
ref: function () {
self.changeIcon = this;
}
},
width: 30
}], }],
ref: function (_ref) { ref: function (_ref) {
self.comboWrapper = _ref; self.comboWrapper = _ref;
@ -92011,11 +92132,11 @@ BI.extend(BI.DynamicDateCard, {
switch (type) { switch (type) {
case BI.DynamicDateCombo.Dynamic: case BI.DynamicDateCombo.Dynamic:
this.changeIcon.setVisible(true); this.changeIcon.setVisible(true);
this.comboWrapper.attr("items")[1].width = 30; this.comboWrapper.attr("items")[0].width = 30;
this.comboWrapper.resize(); this.comboWrapper.resize();
break; break;
default: default:
this.comboWrapper.attr("items")[1].width = 0; this.comboWrapper.attr("items")[0].width = 0;
this.comboWrapper.resize(); this.comboWrapper.resize();
this.changeIcon.setVisible(false); this.changeIcon.setVisible(false);
break; break;
@ -92076,6 +92197,13 @@ BI.extend(BI.DynamicDateCombo, {
ref: function () { ref: function () {
self.editor = this; self.editor = this;
}, },
errorText: function (v) {
if(BI.isEmptyString(v)) {
return BI.i18nText("BI-Basic_Input_Can_Not_Null");
}
return BI.i18nText("BI-Please_Input_Positive_Integer");
},
allowBlank: false,
listeners: [{ listeners: [{
eventName: BI.SignEditor.EVENT_CONFIRM, eventName: BI.SignEditor.EVENT_CONFIRM,
action: function () { action: function () {
@ -92235,7 +92363,8 @@ BI.shortcut("bi.dynamic_date_param_item", BI.DynamicDateParamItem);BI.DynamicDat
self.dateTab = this; self.dateTab = this;
}, },
tab: { tab: {
cls: "bi-multidate-popup-tab bi-border-bottom", type: "bi.linear_segment",
cls: "bi-border-bottom",
height: this.constants.tabHeight, height: this.constants.tabHeight,
items: BI.createItems([{ items: BI.createItems([{
text: BI.i18nText("BI-Multi_Date_YMD"), text: BI.i18nText("BI-Multi_Date_YMD"),
@ -92244,12 +92373,8 @@ BI.shortcut("bi.dynamic_date_param_item", BI.DynamicDateParamItem);BI.DynamicDat
text: BI.i18nText("BI-Basic_Dynamic_Title"), text: BI.i18nText("BI-Basic_Dynamic_Title"),
value: BI.DynamicDateCombo.Dynamic value: BI.DynamicDateCombo.Dynamic
}], { }], {
textAlign: "center", textAlign: "center"
cls: "bi-list-item-active" })
}),
layouts: [{
type: "bi.center"
}]
}, },
cardCreator: function (v) { cardCreator: function (v) {
switch (v) { switch (v) {
@ -92467,10 +92592,10 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
type: "bi.htape", type: "bi.htape",
element: this, element: this,
items: [{ items: [{
el: this.editor
}, {
el: BI.createWidget(), el: BI.createWidget(),
width: 30 width: 30
}, {
el: this.editor
}] }]
}); });
this.setValue(o.value); this.setValue(o.value);
@ -92515,32 +92640,32 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
var dateStr = date.print("%Y-%x-%e"); var dateStr = date.print("%Y-%x-%e");
this.editor.setState(dateStr); this.editor.setState(dateStr);
this.editor.setValue(dateStr); this.editor.setValue(dateStr);
this.setTitle(text + ":" + dateStr); this.setTitle(BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr));
}, },
_getText: function (obj) { _getText: function (obj) {
var value = ""; var value = "";
if(BI.isNotNull(obj.year)) { if(BI.isNotNull(obj.year) && obj.year !== 0) {
value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Year"), obj.position); value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Year"), obj.position);
} }
if(BI.isNotNull(obj.quarter)) { if(BI.isNotNull(obj.quarter) && obj.quarter !== 0) {
value += Math.abs(obj.quarter) + BI.i18nText("BI-Basic_Single_Quarter") + (obj.quarter < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Year"), obj.position); value += Math.abs(obj.quarter) + BI.i18nText("BI-Basic_Single_Quarter") + (obj.quarter < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Year"), obj.position);
} }
if(BI.isNotNull(obj.month)) { if(BI.isNotNull(obj.month) && obj.month !== 0) {
value += Math.abs(obj.month) + BI.i18nText("BI-Basic_Month") + (obj.month < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Month"), obj.position); value += Math.abs(obj.month) + BI.i18nText("BI-Basic_Month") + (obj.month < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Month"), obj.position);
} }
if(BI.isNotNull(obj.week)) { if(BI.isNotNull(obj.week) && obj.week !== 0) {
value += Math.abs(obj.week) + BI.i18nText("BI-Basic_Week") + (obj.week < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Week"), obj.position); value += Math.abs(obj.week) + BI.i18nText("BI-Basic_Week") + (obj.week < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Week"), obj.position);
} }
if(BI.isNotNull(obj.day)) { if(BI.isNotNull(obj.day) && obj.day !== 0) {
value += Math.abs(obj.day) + BI.i18nText("BI-Basic_Day") + (obj.day < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + BI.size(obj) === 1 ? getPositionText(BI.i18nText("BI-Basic_Month"), obj.position) : ""; value += Math.abs(obj.day) + BI.i18nText("BI-Basic_Day") + (obj.day < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + BI.size(obj) === 1 ? getPositionText(BI.i18nText("BI-Basic_Month"), obj.position) : "";
} }
if(BI.isNotNull(obj.workDay)) { if(BI.isNotNull(obj.workDay) && obj.workDay !== 0) {
value += Math.abs(obj.workDay) + BI.i18nText("BI-Basic_Work_Day") + (obj.workDay < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); value += Math.abs(obj.workDay) + BI.i18nText("BI-Basic_Work_Day") + (obj.workDay < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind"));
} }
return value; return value;
function getPositionText(baseText, position) { function getPositionText (baseText, position) {
switch (position) { switch (position) {
case BI.DynamicDateCard.OFFSET.BEGIN: case BI.DynamicDateCard.OFFSET.BEGIN:
return baseText + BI.i18nText("BI-Basic_Begin_Start"); return baseText + BI.i18nText("BI-Basic_Begin_Start");
@ -95271,7 +95396,7 @@ BI.MultiDatePopup = BI.inherit(BI.Widget, {
this.dateTab = BI.createWidget({ this.dateTab = BI.createWidget({
type: "bi.tab", type: "bi.tab",
tab: { tab: {
cls: "bi-multidate-popup-tab bi-border-bottom", cls: "bi-border-bottom",
height: this.constants.tabHeight, height: this.constants.tabHeight,
items: BI.createItems([{ items: BI.createItems([{
text: BI.i18nText("BI-Multi_Date_YMD"), text: BI.i18nText("BI-Multi_Date_YMD"),
@ -110307,5 +110432,6 @@ BI.i18n = {
"BI-Basic_Current_Month": "本月", "BI-Basic_Current_Month": "本月",
"BI-Basic_Current_Quarter": "本季度", "BI-Basic_Current_Quarter": "本季度",
"BI-Basic_Year_Month": "年月", "BI-Basic_Year_Month": "年月",
"BI-Basic_Year_Quarter": "年季度" "BI-Basic_Year_Quarter": "年季度",
"BI-Basic_Input_Can_Not_Null": "输入框不能为空"
}; };

26
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

3
dist/config.js vendored

@ -145,5 +145,6 @@ BI.i18n = {
"BI-Basic_Current_Month": "本月", "BI-Basic_Current_Month": "本月",
"BI-Basic_Current_Quarter": "本季度", "BI-Basic_Current_Quarter": "本季度",
"BI-Basic_Year_Month": "年月", "BI-Basic_Year_Month": "年月",
"BI-Basic_Year_Quarter": "年季度" "BI-Basic_Year_Quarter": "年季度",
"BI-Basic_Input_Can_Not_Null": "输入框不能为空"
}; };

24
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

305
dist/widget.js vendored

@ -2661,7 +2661,8 @@ BI.shortcut("bi.static_date_pane_card", BI.StaticDatePaneCard);BI.DynamicDatePan
type: "bi.vtape", type: "bi.vtape",
items: [{ items: [{
el: { el: {
type: "bi.button_group", type: "bi.linear_segment",
cls: "bi-border-bottom",
height: 30, height: 30,
items: BI.createItems([{ items: BI.createItems([{
text: BI.i18nText("BI-Multi_Date_YMD"), text: BI.i18nText("BI-Multi_Date_YMD"),
@ -2670,12 +2671,8 @@ BI.shortcut("bi.static_date_pane_card", BI.StaticDatePaneCard);BI.DynamicDatePan
text: BI.i18nText("BI-Basic_Dynamic_Title"), text: BI.i18nText("BI-Basic_Dynamic_Title"),
value: BI.DynamicDatePane.Dynamic value: BI.DynamicDatePane.Dynamic
}], { }], {
textAlign: "center", textAlign: "center"
cls: "bi-list-item-active"
}), }),
layouts: [{
type: "bi.center"
}],
listeners: [{ listeners: [{
eventName: BI.ButtonGroup.EVENT_CHANGE, eventName: BI.ButtonGroup.EVENT_CHANGE,
action: function () { action: function () {
@ -3015,7 +3012,7 @@ BI.StaticYearCard.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.static_year_card", BI.StaticYearCard);BI.DynamicYearCombo = BI.inherit(BI.Widget, { BI.shortcut("bi.static_year_card", BI.StaticYearCard);BI.DynamicYearCombo = BI.inherit(BI.Widget, {
props: { props: {
baseCls: "bi-year-combo", baseCls: "bi-year-combo bi-border",
behaviors: {}, behaviors: {},
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 max: "2099-12-31", // 最大日期
@ -3060,7 +3057,6 @@ BI.shortcut("bi.static_year_card", BI.StaticYearCard);BI.DynamicYearCombo = BI.i
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.combo", type: "bi.combo",
element: this,
isNeedAdjustHeight: false, isNeedAdjustHeight: false,
isNeedAdjustWidth: false, isNeedAdjustWidth: false,
el: this.trigger, el: this.trigger,
@ -3113,11 +3109,52 @@ BI.shortcut("bi.static_year_card", BI.StaticYearCard);BI.DynamicYearCombo = BI.i
self.popup.setValue(self.storeValue); self.popup.setValue(self.storeValue);
self.fireEvent(BI.DynamicYearCombo.EVENT_BEFORE_POPUPVIEW); self.fireEvent(BI.DynamicYearCombo.EVENT_BEFORE_POPUPVIEW);
}); });
BI.createWidget({
type: "bi.htape",
element: this,
ref: function () {
self.comboWrapper = this;
},
items: [{
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font",
width: 24,
height: 24,
ref: function () {
self.changeIcon = this;
}
},
width: 30
}, this.combo]
});
this._checkDynamicValue(o.value);
},
_checkDynamicValue: function (v) {
var type = null;
if (BI.isNotNull(v)) {
type = v.type;
}
switch (type) {
case BI.DynamicYearCombo.Dynamic:
this.changeIcon.setVisible(true);
this.comboWrapper.attr("items")[0].width = 30;
this.comboWrapper.resize();
break;
default:
this.comboWrapper.attr("items")[0].width = 0;
this.comboWrapper.resize();
this.changeIcon.setVisible(false);
break;
}
}, },
setValue: function (v) { setValue: function (v) {
this.storeValue = v; this.storeValue = v;
this.trigger.setValue(v); this.trigger.setValue(v);
this._checkDynamicValue(v);
}, },
getValue: function () { getValue: function () {
@ -3230,6 +3267,8 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, {
self.dateTab = this; self.dateTab = this;
}, },
tab: { tab: {
type: "bi.linear_segment",
cls: "bi-border-bottom",
height: this.constants.tabHeight, height: this.constants.tabHeight,
items: BI.createItems([{ items: BI.createItems([{
text: BI.i18nText("BI-Basic_Year_Fen"), text: BI.i18nText("BI-Basic_Year_Fen"),
@ -3238,12 +3277,8 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, {
text: BI.i18nText("BI-Basic_Dynamic_Title"), text: BI.i18nText("BI-Basic_Dynamic_Title"),
value: BI.DynamicYearCombo.Dynamic value: BI.DynamicYearCombo.Dynamic
}], { }], {
textAlign: "center", textAlign: "center"
cls: "bi-list-item-active" })
}),
layouts: [{
type: "bi.center"
}]
}, },
cardCreator: function (v) { cardCreator: function (v) {
switch (v) { switch (v) {
@ -3350,7 +3385,7 @@ BI.shortcut("bi.dynamic_year_popup", BI.DynamicYearPopup);BI.DynamicYearTrigger
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.DynamicYearTrigger.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.DynamicYearTrigger.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-year-trigger bi-border", extraCls: "bi-year-trigger",
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 max: "2099-12-31", // 最大日期
height: 24 height: 24
@ -3370,6 +3405,7 @@ BI.shortcut("bi.dynamic_year_popup", BI.DynamicYearPopup);BI.DynamicYearTrigger
}, },
hgap: c.hgap, hgap: c.hgap,
vgap: c.vgap, vgap: c.vgap,
watermark: BI.i18nText("BI-Basic_Unrestricted"),
allowBlank: true, allowBlank: true,
errorText: function (v) { errorText: function (v) {
return !BI.isPositiveInteger(v) ? c.errorText : c.errorTextInvalid; return !BI.isPositiveInteger(v) ? c.errorText : c.errorTextInvalid;
@ -3411,32 +3447,30 @@ BI.shortcut("bi.dynamic_year_popup", BI.DynamicYearPopup);BI.DynamicYearTrigger
BI.createWidget({ BI.createWidget({
element: this, element: this,
type: "bi.htape", type: "bi.htape",
items: [ items: [{
{ el: this.editor
el: this.editor }, {
}, { el: {
el: { type: "bi.text_button",
type: "bi.text_button", baseCls: "bi-trigger-year-text",
baseCls: "bi-trigger-year-text", text: BI.i18nText("BI-Multi_Date_Year"),
text: BI.i18nText("BI-Multi_Date_Year"),
width: o.height
},
width: o.height width: o.height
}, { },
el: { width: o.height
type: "bi.trigger_icon_button", }, {
width: o.height el: {
}, type: "bi.trigger_icon_button",
width: o.height width: o.height
} },
] width: o.height
}]
}); });
this.setValue(o.value); this.setValue(o.value);
}, },
_getText: function (obj) { _getText: function (obj) {
var value = ""; var value = "";
if(BI.isNotNull(obj.year)) { if(BI.isNotNull(obj.year) && obj.year !== 0) {
value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind"));
} }
return value; return value;
@ -3446,7 +3480,7 @@ BI.shortcut("bi.dynamic_year_popup", BI.DynamicYearPopup);BI.DynamicYearTrigger
var dateStr = date.print("%Y"); var dateStr = date.print("%Y");
this.editor.setState(dateStr); this.editor.setState(dateStr);
this.editor.setValue(dateStr); this.editor.setValue(dateStr);
this.setTitle(text + ":" + dateStr); this.setTitle(BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr));
}, },
setValue: function (v) { setValue: function (v) {
@ -3465,6 +3499,7 @@ BI.shortcut("bi.dynamic_year_popup", BI.DynamicYearPopup);BI.DynamicYearTrigger
break; break;
case BI.DynamicDateCombo.Static: case BI.DynamicDateCombo.Static:
default: default:
value = value || {};
this.editor.setState(value.year); this.editor.setState(value.year);
this.editor.setValue(value.year); this.editor.setValue(value.year);
this.editor.setTitle(value.year); this.editor.setTitle(value.year);
@ -3638,6 +3673,7 @@ BI.shortcut("bi.dynamic_year_month_card", BI.DynamicYearMonthCard);BI.StaticYear
listeners: [{ listeners: [{
eventName: BI.ButtonGroup.EVENT_CHANGE, eventName: BI.ButtonGroup.EVENT_CHANGE,
action: function () { action: function () {
self.selectedYear = self.yearPicker.getValue();
self.selectedMonth = this.getValue()[0]; self.selectedMonth = this.getValue()[0];
self.fireEvent(BI.StaticYearMonthCard.EVENT_CHANGE); self.fireEvent(BI.StaticYearMonthCard.EVENT_CHANGE);
} }
@ -3678,7 +3714,7 @@ BI.StaticYearMonthCard.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.static_year_month_card", BI.StaticYearMonthCard);BI.DynamicYearMonthCombo = BI.inherit(BI.Widget, { BI.shortcut("bi.static_year_month_card", BI.StaticYearMonthCard);BI.DynamicYearMonthCombo = BI.inherit(BI.Widget, {
props: { props: {
baseCls: "bi-year-month-combo", baseCls: "bi-year-month-combo bi-border",
behaviors: {}, behaviors: {},
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 max: "2099-12-31", // 最大日期
@ -3714,7 +3750,6 @@ BI.shortcut("bi.static_year_month_card", BI.StaticYearMonthCard);BI.DynamicYearM
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.combo", type: "bi.combo",
element: this,
isNeedAdjustHeight: false, isNeedAdjustHeight: false,
isNeedAdjustWidth: false, isNeedAdjustWidth: false,
el: this.trigger, el: this.trigger,
@ -3767,11 +3802,52 @@ BI.shortcut("bi.static_year_month_card", BI.StaticYearMonthCard);BI.DynamicYearM
self.popup.setValue(self.storeValue); self.popup.setValue(self.storeValue);
self.fireEvent(BI.DynamicYearMonthCombo.EVENT_BEFORE_POPUPVIEW); self.fireEvent(BI.DynamicYearMonthCombo.EVENT_BEFORE_POPUPVIEW);
}); });
BI.createWidget({
type: "bi.htape",
element: this,
ref: function () {
self.comboWrapper = this;
},
items: [{
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font",
width: 24,
height: 24,
ref: function () {
self.changeIcon = this;
}
},
width: 30
}, this.combo]
});
this._checkDynamicValue(o.value);
},
_checkDynamicValue: function (v) {
var type = null;
if (BI.isNotNull(v)) {
type = v.type;
}
switch (type) {
case BI.DynamicYearMonthCombo.Dynamic:
this.changeIcon.setVisible(true);
this.comboWrapper.attr("items")[0].width = 30;
this.comboWrapper.resize();
break;
default:
this.comboWrapper.attr("items")[0].width = 0;
this.comboWrapper.resize();
this.changeIcon.setVisible(false);
break;
}
}, },
setValue: function (v) { setValue: function (v) {
this.storeValue = v; this.storeValue = v;
this.trigger.setValue(v); this.trigger.setValue(v);
this._checkDynamicValue(v);
}, },
getValue: function () { getValue: function () {
@ -3884,6 +3960,8 @@ BI.DynamicYearMonthPopup = BI.inherit(BI.Widget, {
self.dateTab = this; self.dateTab = this;
}, },
tab: { tab: {
type: "bi.linear_segment",
cls: "bi-border-bottom",
height: this.constants.tabHeight, height: this.constants.tabHeight,
items: BI.createItems([{ items: BI.createItems([{
text: BI.i18nText("BI-Basic_Year_Fen"), text: BI.i18nText("BI-Basic_Year_Fen"),
@ -3892,12 +3970,8 @@ BI.DynamicYearMonthPopup = BI.inherit(BI.Widget, {
text: BI.i18nText("BI-Basic_Dynamic_Title"), text: BI.i18nText("BI-Basic_Dynamic_Title"),
value: BI.DynamicYearCombo.Dynamic value: BI.DynamicYearCombo.Dynamic
}], { }], {
textAlign: "center", textAlign: "center"
cls: "bi-list-item-active" })
}),
layouts: [{
type: "bi.center"
}]
}, },
cardCreator: function (v) { cardCreator: function (v) {
switch (v) { switch (v) {
@ -4003,7 +4077,7 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY
}, },
props: { props: {
extraCls: "bi-year-month-trigger bi-border", extraCls: "bi-year-month-trigger",
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 max: "2099-12-31", // 最大日期
height: 24 height: 24
@ -4058,11 +4132,15 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY
type: "bi.sign_editor", type: "bi.sign_editor",
height: o.height, height: o.height,
validationChecker: function (v) { validationChecker: function (v) {
return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(isYear ? v : BI.getDate().getFullYear(), isYear ? 1 : v, 1, o.min, o.max)[0]); if(isYear) {
return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, 1, 1, o.min, o.max)[0]);
}
return v === "" || ((v >= 1 && v <= 12) && !BI.checkDateVoid(BI.getDate().getFullYear(), v, 1, o.min, o.max)[0]);
}, },
quitChecker: function () { quitChecker: function () {
return false; return false;
}, },
watermark: BI.i18nText("BI-Basic_Unrestricted"),
errorText: function (v) { errorText: function (v) {
return !BI.isPositiveInteger(v) ? c.errorText : c.errorTextInvalid; return !BI.isPositiveInteger(v) ? c.errorText : c.errorTextInvalid;
}, },
@ -4132,7 +4210,7 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY
if(BI.isNotNull(obj.year)) { if(BI.isNotNull(obj.year)) {
value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind"));
} }
if(BI.isNotNull(obj.month)) { if(BI.isNotNull(obj.month) && obj.month !== 0) {
value += Math.abs(obj.month) + BI.i18nText("BI-Basic_Year") + (obj.month < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); value += Math.abs(obj.month) + BI.i18nText("BI-Basic_Year") + (obj.month < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind"));
} }
return value; return value;
@ -4142,7 +4220,7 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY
var dateStr = date.print("%Y-%x"); var dateStr = date.print("%Y-%x");
this.yearEditor.setValue(date.getFullYear()); this.yearEditor.setValue(date.getFullYear());
this.monthEditor.setValue(date.getMonth() + 1); this.monthEditor.setValue(date.getMonth() + 1);
this.setTitle(text + ":" + dateStr); this.setTitle(BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr));
}, },
setValue: function (v) { setValue: function (v) {
@ -4325,6 +4403,7 @@ BI.shortcut("bi.dynamic_year_quarter_card", BI.DynamicYearQuarterCard);BI.Static
listeners: [{ listeners: [{
eventName: BI.ButtonGroup.EVENT_CHANGE, eventName: BI.ButtonGroup.EVENT_CHANGE,
action: function () { action: function () {
self.selectedYear = self.yearPicker.getValue();
self.selectedQuarter = this.getValue()[0]; self.selectedQuarter = this.getValue()[0];
self.fireEvent(BI.StaticYearQuarterCard.EVENT_CHANGE); self.fireEvent(BI.StaticYearQuarterCard.EVENT_CHANGE);
} }
@ -4365,7 +4444,7 @@ BI.StaticYearQuarterCard.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.static_year_quarter_card", BI.StaticYearQuarterCard);BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, { BI.shortcut("bi.static_year_quarter_card", BI.StaticYearQuarterCard);BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
props: { props: {
baseCls: "bi-year-quarter-combo", baseCls: "bi-year-quarter-combo bi-border",
behaviors: {}, behaviors: {},
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 max: "2099-12-31", // 最大日期
@ -4401,7 +4480,6 @@ BI.shortcut("bi.static_year_quarter_card", BI.StaticYearQuarterCard);BI.DynamicY
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.combo", type: "bi.combo",
element: this,
isNeedAdjustHeight: false, isNeedAdjustHeight: false,
isNeedAdjustWidth: false, isNeedAdjustWidth: false,
el: this.trigger, el: this.trigger,
@ -4454,11 +4532,52 @@ BI.shortcut("bi.static_year_quarter_card", BI.StaticYearQuarterCard);BI.DynamicY
self.popup.setValue(self.storeValue); self.popup.setValue(self.storeValue);
self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_BEFORE_POPUPVIEW); self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_BEFORE_POPUPVIEW);
}); });
BI.createWidget({
type: "bi.htape",
element: this,
ref: function () {
self.comboWrapper = this;
},
items: [{
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font",
width: 24,
height: 24,
ref: function () {
self.changeIcon = this;
}
},
width: 30
}, this.combo]
});
this._checkDynamicValue(o.value);
},
_checkDynamicValue: function (v) {
var type = null;
if (BI.isNotNull(v)) {
type = v.type;
}
switch (type) {
case BI.DynamicYearQuarterCombo.Dynamic:
this.changeIcon.setVisible(true);
this.comboWrapper.attr("items")[0].width = 30;
this.comboWrapper.resize();
break;
default:
this.comboWrapper.attr("items")[0].width = 0;
this.comboWrapper.resize();
this.changeIcon.setVisible(false);
break;
}
}, },
setValue: function (v) { setValue: function (v) {
this.storeValue = v; this.storeValue = v;
this.trigger.setValue(v); this.trigger.setValue(v);
this._checkDynamicValue(v);
}, },
getValue: function () { getValue: function () {
@ -4564,6 +4683,8 @@ BI.extend(BI.DynamicYearQuarterCombo, {
self.dateTab = this; self.dateTab = this;
}, },
tab: { tab: {
type: "bi.linear_segment",
cls: "bi-border-bottom",
height: this.constants.tabHeight, height: this.constants.tabHeight,
items: BI.createItems([{ items: BI.createItems([{
text: BI.i18nText("BI-Basic_Year_Fen"), text: BI.i18nText("BI-Basic_Year_Fen"),
@ -4572,12 +4693,8 @@ BI.extend(BI.DynamicYearQuarterCombo, {
text: BI.i18nText("BI-Basic_Dynamic_Title"), text: BI.i18nText("BI-Basic_Dynamic_Title"),
value: BI.DynamicYearQuarterCombo.Dynamic value: BI.DynamicYearQuarterCombo.Dynamic
}], { }], {
textAlign: "center", textAlign: "center"
cls: "bi-list-item-active" })
}),
layouts: [{
type: "bi.center"
}]
}, },
cardCreator: function (v) { cardCreator: function (v) {
switch (v) { switch (v) {
@ -4683,7 +4800,7 @@ BI.shortcut("bi.dynamic_year_quarter_popup", BI.DynamicYearQuarterPopup);BI.Dyna
}, },
props: { props: {
extraCls: "bi-year-quarter-trigger bi-border", extraCls: "bi-year-quarter-trigger",
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 max: "2099-12-31", // 最大日期
height: 24 height: 24
@ -4738,7 +4855,10 @@ BI.shortcut("bi.dynamic_year_quarter_popup", BI.DynamicYearQuarterPopup);BI.Dyna
type: "bi.sign_editor", type: "bi.sign_editor",
height: o.height, height: o.height,
validationChecker: function (v) { validationChecker: function (v) {
return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(isYear ? v : BI.getDate().getFullYear(), isYear ? 1 : v, 1, o.min, o.max)[0]); if(isYear) {
return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, 1, 1, o.min, o.max)[0]);
}
return v === "" || ((v >= 1 && v <= 4) && !BI.checkDateVoid(BI.getDate().getFullYear(), v, 1, o.min, o.max)[0]);
}, },
quitChecker: function () { quitChecker: function () {
return false; return false;
@ -4746,6 +4866,7 @@ BI.shortcut("bi.dynamic_year_quarter_popup", BI.DynamicYearQuarterPopup);BI.Dyna
errorText: function (v) { errorText: function (v) {
return !BI.isPositiveInteger(v) ? c.errorText : c.errorTextInvalid; return !BI.isPositiveInteger(v) ? c.errorText : c.errorTextInvalid;
}, },
watermark: BI.i18nText("BI-Basic_Unrestricted"),
hgap: c.hgap, hgap: c.hgap,
vgap: c.vgap, vgap: c.vgap,
allowBlank: true allowBlank: true
@ -4812,7 +4933,7 @@ BI.shortcut("bi.dynamic_year_quarter_popup", BI.DynamicYearQuarterPopup);BI.Dyna
if(BI.isNotNull(obj.year)) { if(BI.isNotNull(obj.year)) {
value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind"));
} }
if(BI.isNotNull(obj.quarter)) { if(BI.isNotNull(obj.quarter) && obj.quarter !== 0) {
value += Math.abs(obj.quarter) + BI.i18nText("BI-Basic_Year") + (obj.quarter < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); value += Math.abs(obj.quarter) + BI.i18nText("BI-Basic_Year") + (obj.quarter < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind"));
} }
return value; return value;
@ -4822,7 +4943,7 @@ BI.shortcut("bi.dynamic_year_quarter_popup", BI.DynamicYearQuarterPopup);BI.Dyna
var dateStr = date.print("%Y-%x"); var dateStr = date.print("%Y-%x");
this.yearEditor.setValue(date.getFullYear()); this.yearEditor.setValue(date.getFullYear());
this.quarterEditor.setValue(date.getQuarter()); this.quarterEditor.setValue(date.getQuarter());
this.setTitle(text + ":" + dateStr); this.setTitle(BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr));
}, },
setValue: function (v) { setValue: function (v) {
@ -5248,6 +5369,17 @@ BI.extend(BI.DynamicDateCard, {
return { return {
type: "bi.htape", type: "bi.htape",
items: [{ items: [{
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font",
width: 24,
height: 24,
ref: function () {
self.changeIcon = this;
}
},
width: 30
}, {
type: "bi.absolute", type: "bi.absolute",
items: [{ items: [{
el: { el: {
@ -5410,19 +5542,8 @@ BI.extend(BI.DynamicDateCard, {
}] }]
}, },
top: 0, top: 0,
left: 0 right: 0
}] }]
}, {
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font",
width: 24,
height: 24,
ref: function () {
self.changeIcon = this;
}
},
width: 30
}], }],
ref: function (_ref) { ref: function (_ref) {
self.comboWrapper = _ref; self.comboWrapper = _ref;
@ -5442,11 +5563,11 @@ BI.extend(BI.DynamicDateCard, {
switch (type) { switch (type) {
case BI.DynamicDateCombo.Dynamic: case BI.DynamicDateCombo.Dynamic:
this.changeIcon.setVisible(true); this.changeIcon.setVisible(true);
this.comboWrapper.attr("items")[1].width = 30; this.comboWrapper.attr("items")[0].width = 30;
this.comboWrapper.resize(); this.comboWrapper.resize();
break; break;
default: default:
this.comboWrapper.attr("items")[1].width = 0; this.comboWrapper.attr("items")[0].width = 0;
this.comboWrapper.resize(); this.comboWrapper.resize();
this.changeIcon.setVisible(false); this.changeIcon.setVisible(false);
break; break;
@ -5507,6 +5628,13 @@ BI.extend(BI.DynamicDateCombo, {
ref: function () { ref: function () {
self.editor = this; self.editor = this;
}, },
errorText: function (v) {
if(BI.isEmptyString(v)) {
return BI.i18nText("BI-Basic_Input_Can_Not_Null");
}
return BI.i18nText("BI-Please_Input_Positive_Integer");
},
allowBlank: false,
listeners: [{ listeners: [{
eventName: BI.SignEditor.EVENT_CONFIRM, eventName: BI.SignEditor.EVENT_CONFIRM,
action: function () { action: function () {
@ -5666,7 +5794,8 @@ BI.shortcut("bi.dynamic_date_param_item", BI.DynamicDateParamItem);BI.DynamicDat
self.dateTab = this; self.dateTab = this;
}, },
tab: { tab: {
cls: "bi-multidate-popup-tab bi-border-bottom", type: "bi.linear_segment",
cls: "bi-border-bottom",
height: this.constants.tabHeight, height: this.constants.tabHeight,
items: BI.createItems([{ items: BI.createItems([{
text: BI.i18nText("BI-Multi_Date_YMD"), text: BI.i18nText("BI-Multi_Date_YMD"),
@ -5675,12 +5804,8 @@ BI.shortcut("bi.dynamic_date_param_item", BI.DynamicDateParamItem);BI.DynamicDat
text: BI.i18nText("BI-Basic_Dynamic_Title"), text: BI.i18nText("BI-Basic_Dynamic_Title"),
value: BI.DynamicDateCombo.Dynamic value: BI.DynamicDateCombo.Dynamic
}], { }], {
textAlign: "center", textAlign: "center"
cls: "bi-list-item-active" })
}),
layouts: [{
type: "bi.center"
}]
}, },
cardCreator: function (v) { cardCreator: function (v) {
switch (v) { switch (v) {
@ -5898,10 +6023,10 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
type: "bi.htape", type: "bi.htape",
element: this, element: this,
items: [{ items: [{
el: this.editor
}, {
el: BI.createWidget(), el: BI.createWidget(),
width: 30 width: 30
}, {
el: this.editor
}] }]
}); });
this.setValue(o.value); this.setValue(o.value);
@ -5946,32 +6071,32 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
var dateStr = date.print("%Y-%x-%e"); var dateStr = date.print("%Y-%x-%e");
this.editor.setState(dateStr); this.editor.setState(dateStr);
this.editor.setValue(dateStr); this.editor.setValue(dateStr);
this.setTitle(text + ":" + dateStr); this.setTitle(BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr));
}, },
_getText: function (obj) { _getText: function (obj) {
var value = ""; var value = "";
if(BI.isNotNull(obj.year)) { if(BI.isNotNull(obj.year) && obj.year !== 0) {
value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Year"), obj.position); value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Year"), obj.position);
} }
if(BI.isNotNull(obj.quarter)) { if(BI.isNotNull(obj.quarter) && obj.quarter !== 0) {
value += Math.abs(obj.quarter) + BI.i18nText("BI-Basic_Single_Quarter") + (obj.quarter < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Year"), obj.position); value += Math.abs(obj.quarter) + BI.i18nText("BI-Basic_Single_Quarter") + (obj.quarter < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Year"), obj.position);
} }
if(BI.isNotNull(obj.month)) { if(BI.isNotNull(obj.month) && obj.month !== 0) {
value += Math.abs(obj.month) + BI.i18nText("BI-Basic_Month") + (obj.month < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Month"), obj.position); value += Math.abs(obj.month) + BI.i18nText("BI-Basic_Month") + (obj.month < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Month"), obj.position);
} }
if(BI.isNotNull(obj.week)) { if(BI.isNotNull(obj.week) && obj.week !== 0) {
value += Math.abs(obj.week) + BI.i18nText("BI-Basic_Week") + (obj.week < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Week"), obj.position); value += Math.abs(obj.week) + BI.i18nText("BI-Basic_Week") + (obj.week < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Week"), obj.position);
} }
if(BI.isNotNull(obj.day)) { if(BI.isNotNull(obj.day) && obj.day !== 0) {
value += Math.abs(obj.day) + BI.i18nText("BI-Basic_Day") + (obj.day < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + BI.size(obj) === 1 ? getPositionText(BI.i18nText("BI-Basic_Month"), obj.position) : ""; value += Math.abs(obj.day) + BI.i18nText("BI-Basic_Day") + (obj.day < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + BI.size(obj) === 1 ? getPositionText(BI.i18nText("BI-Basic_Month"), obj.position) : "";
} }
if(BI.isNotNull(obj.workDay)) { if(BI.isNotNull(obj.workDay) && obj.workDay !== 0) {
value += Math.abs(obj.workDay) + BI.i18nText("BI-Basic_Work_Day") + (obj.workDay < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); value += Math.abs(obj.workDay) + BI.i18nText("BI-Basic_Work_Day") + (obj.workDay < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind"));
} }
return value; return value;
function getPositionText(baseText, position) { function getPositionText (baseText, position) {
switch (position) { switch (position) {
case BI.DynamicDateCard.OFFSET.BEGIN: case BI.DynamicDateCard.OFFSET.BEGIN:
return baseText + BI.i18nText("BI-Basic_Begin_Start"); return baseText + BI.i18nText("BI-Basic_Begin_Start");
@ -8702,7 +8827,7 @@ BI.MultiDatePopup = BI.inherit(BI.Widget, {
this.dateTab = BI.createWidget({ this.dateTab = BI.createWidget({
type: "bi.tab", type: "bi.tab",
tab: { tab: {
cls: "bi-multidate-popup-tab bi-border-bottom", cls: "bi-border-bottom",
height: this.constants.tabHeight, height: this.constants.tabHeight,
items: BI.createItems([{ items: BI.createItems([{
text: BI.i18nText("BI-Multi_Date_YMD"), text: BI.i18nText("BI-Multi_Date_YMD"),

3
public/js/index.js

@ -145,5 +145,6 @@ BI.i18n = {
"BI-Basic_Current_Month": "本月", "BI-Basic_Current_Month": "本月",
"BI-Basic_Current_Quarter": "本季度", "BI-Basic_Current_Quarter": "本季度",
"BI-Basic_Year_Month": "年月", "BI-Basic_Year_Month": "年月",
"BI-Basic_Year_Quarter": "年季度" "BI-Basic_Year_Quarter": "年季度",
"BI-Basic_Input_Can_Not_Null": "输入框不能为空"
}; };

9
src/widget/dynamic/datepane/datepane.js

@ -10,7 +10,8 @@ BI.DynamicDatePane = BI.inherit(BI.Widget, {
type: "bi.vtape", type: "bi.vtape",
items: [{ items: [{
el: { el: {
type: "bi.button_group", type: "bi.linear_segment",
cls: "bi-border-bottom",
height: 30, height: 30,
items: BI.createItems([{ items: BI.createItems([{
text: BI.i18nText("BI-Multi_Date_YMD"), text: BI.i18nText("BI-Multi_Date_YMD"),
@ -19,12 +20,8 @@ BI.DynamicDatePane = BI.inherit(BI.Widget, {
text: BI.i18nText("BI-Basic_Dynamic_Title"), text: BI.i18nText("BI-Basic_Dynamic_Title"),
value: BI.DynamicDatePane.Dynamic value: BI.DynamicDatePane.Dynamic
}], { }], {
textAlign: "center", textAlign: "center"
cls: "bi-list-item-active"
}), }),
layouts: [{
type: "bi.center"
}],
listeners: [{ listeners: [{
eventName: BI.ButtonGroup.EVENT_CHANGE, eventName: BI.ButtonGroup.EVENT_CHANGE,
action: function () { action: function () {

44
src/widget/dynamic/year/combo.year.js

@ -1,7 +1,7 @@
BI.DynamicYearCombo = BI.inherit(BI.Widget, { BI.DynamicYearCombo = BI.inherit(BI.Widget, {
props: { props: {
baseCls: "bi-year-combo", baseCls: "bi-year-combo bi-border",
behaviors: {}, behaviors: {},
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 max: "2099-12-31", // 最大日期
@ -46,7 +46,6 @@ BI.DynamicYearCombo = BI.inherit(BI.Widget, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.combo", type: "bi.combo",
element: this,
isNeedAdjustHeight: false, isNeedAdjustHeight: false,
isNeedAdjustWidth: false, isNeedAdjustWidth: false,
el: this.trigger, el: this.trigger,
@ -99,11 +98,52 @@ BI.DynamicYearCombo = BI.inherit(BI.Widget, {
self.popup.setValue(self.storeValue); self.popup.setValue(self.storeValue);
self.fireEvent(BI.DynamicYearCombo.EVENT_BEFORE_POPUPVIEW); self.fireEvent(BI.DynamicYearCombo.EVENT_BEFORE_POPUPVIEW);
}); });
BI.createWidget({
type: "bi.htape",
element: this,
ref: function () {
self.comboWrapper = this;
},
items: [{
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font",
width: 24,
height: 24,
ref: function () {
self.changeIcon = this;
}
},
width: 30
}, this.combo]
});
this._checkDynamicValue(o.value);
},
_checkDynamicValue: function (v) {
var type = null;
if (BI.isNotNull(v)) {
type = v.type;
}
switch (type) {
case BI.DynamicYearCombo.Dynamic:
this.changeIcon.setVisible(true);
this.comboWrapper.attr("items")[0].width = 30;
this.comboWrapper.resize();
break;
default:
this.comboWrapper.attr("items")[0].width = 0;
this.comboWrapper.resize();
this.changeIcon.setVisible(false);
break;
}
}, },
setValue: function (v) { setValue: function (v) {
this.storeValue = v; this.storeValue = v;
this.trigger.setValue(v); this.trigger.setValue(v);
this._checkDynamicValue(v);
}, },
getValue: function () { getValue: function () {

10
src/widget/dynamic/year/popup.year.js

@ -96,6 +96,8 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, {
self.dateTab = this; self.dateTab = this;
}, },
tab: { tab: {
type: "bi.linear_segment",
cls: "bi-border-bottom",
height: this.constants.tabHeight, height: this.constants.tabHeight,
items: BI.createItems([{ items: BI.createItems([{
text: BI.i18nText("BI-Basic_Year_Fen"), text: BI.i18nText("BI-Basic_Year_Fen"),
@ -104,12 +106,8 @@ BI.DynamicYearPopup = BI.inherit(BI.Widget, {
text: BI.i18nText("BI-Basic_Dynamic_Title"), text: BI.i18nText("BI-Basic_Dynamic_Title"),
value: BI.DynamicYearCombo.Dynamic value: BI.DynamicYearCombo.Dynamic
}], { }], {
textAlign: "center", textAlign: "center"
cls: "bi-list-item-active" })
}),
layouts: [{
type: "bi.center"
}]
}, },
cardCreator: function (v) { cardCreator: function (v) {
switch (v) { switch (v) {

40
src/widget/dynamic/year/trigger.year.js

@ -8,7 +8,7 @@ BI.DynamicYearTrigger = BI.inherit(BI.Trigger, {
_defaultConfig: function () { _defaultConfig: function () {
return BI.extend(BI.DynamicYearTrigger.superclass._defaultConfig.apply(this, arguments), { return BI.extend(BI.DynamicYearTrigger.superclass._defaultConfig.apply(this, arguments), {
extraCls: "bi-year-trigger bi-border", extraCls: "bi-year-trigger",
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 max: "2099-12-31", // 最大日期
height: 24 height: 24
@ -28,6 +28,7 @@ BI.DynamicYearTrigger = BI.inherit(BI.Trigger, {
}, },
hgap: c.hgap, hgap: c.hgap,
vgap: c.vgap, vgap: c.vgap,
watermark: BI.i18nText("BI-Basic_Unrestricted"),
allowBlank: true, allowBlank: true,
errorText: function (v) { errorText: function (v) {
return !BI.isPositiveInteger(v) ? c.errorText : c.errorTextInvalid; return !BI.isPositiveInteger(v) ? c.errorText : c.errorTextInvalid;
@ -69,32 +70,30 @@ BI.DynamicYearTrigger = BI.inherit(BI.Trigger, {
BI.createWidget({ BI.createWidget({
element: this, element: this,
type: "bi.htape", type: "bi.htape",
items: [ items: [{
{ el: this.editor
el: this.editor }, {
}, { el: {
el: { type: "bi.text_button",
type: "bi.text_button", baseCls: "bi-trigger-year-text",
baseCls: "bi-trigger-year-text", text: BI.i18nText("BI-Multi_Date_Year"),
text: BI.i18nText("BI-Multi_Date_Year"),
width: o.height
},
width: o.height width: o.height
}, { },
el: { width: o.height
type: "bi.trigger_icon_button", }, {
width: o.height el: {
}, type: "bi.trigger_icon_button",
width: o.height width: o.height
} },
] width: o.height
}]
}); });
this.setValue(o.value); this.setValue(o.value);
}, },
_getText: function (obj) { _getText: function (obj) {
var value = ""; var value = "";
if(BI.isNotNull(obj.year)) { if(BI.isNotNull(obj.year) && obj.year !== 0) {
value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind"));
} }
return value; return value;
@ -104,7 +103,7 @@ BI.DynamicYearTrigger = BI.inherit(BI.Trigger, {
var dateStr = date.print("%Y"); var dateStr = date.print("%Y");
this.editor.setState(dateStr); this.editor.setState(dateStr);
this.editor.setValue(dateStr); this.editor.setValue(dateStr);
this.setTitle(text + ":" + dateStr); this.setTitle(BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr));
}, },
setValue: function (v) { setValue: function (v) {
@ -123,6 +122,7 @@ BI.DynamicYearTrigger = BI.inherit(BI.Trigger, {
break; break;
case BI.DynamicDateCombo.Static: case BI.DynamicDateCombo.Static:
default: default:
value = value || {};
this.editor.setState(value.year); this.editor.setState(value.year);
this.editor.setValue(value.year); this.editor.setValue(value.year);
this.editor.setTitle(value.year); this.editor.setTitle(value.year);

1
src/widget/dynamic/yearmonth/card.static.yearmonth.js

@ -76,6 +76,7 @@ BI.StaticYearMonthCard = BI.inherit(BI.Widget, {
listeners: [{ listeners: [{
eventName: BI.ButtonGroup.EVENT_CHANGE, eventName: BI.ButtonGroup.EVENT_CHANGE,
action: function () { action: function () {
self.selectedYear = self.yearPicker.getValue();
self.selectedMonth = this.getValue()[0]; self.selectedMonth = this.getValue()[0];
self.fireEvent(BI.StaticYearMonthCard.EVENT_CHANGE); self.fireEvent(BI.StaticYearMonthCard.EVENT_CHANGE);
} }

44
src/widget/dynamic/yearmonth/combo.yearmonth.js

@ -1,7 +1,7 @@
BI.DynamicYearMonthCombo = BI.inherit(BI.Widget, { BI.DynamicYearMonthCombo = BI.inherit(BI.Widget, {
props: { props: {
baseCls: "bi-year-month-combo", baseCls: "bi-year-month-combo bi-border",
behaviors: {}, behaviors: {},
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 max: "2099-12-31", // 最大日期
@ -37,7 +37,6 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Widget, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.combo", type: "bi.combo",
element: this,
isNeedAdjustHeight: false, isNeedAdjustHeight: false,
isNeedAdjustWidth: false, isNeedAdjustWidth: false,
el: this.trigger, el: this.trigger,
@ -90,11 +89,52 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Widget, {
self.popup.setValue(self.storeValue); self.popup.setValue(self.storeValue);
self.fireEvent(BI.DynamicYearMonthCombo.EVENT_BEFORE_POPUPVIEW); self.fireEvent(BI.DynamicYearMonthCombo.EVENT_BEFORE_POPUPVIEW);
}); });
BI.createWidget({
type: "bi.htape",
element: this,
ref: function () {
self.comboWrapper = this;
},
items: [{
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font",
width: 24,
height: 24,
ref: function () {
self.changeIcon = this;
}
},
width: 30
}, this.combo]
});
this._checkDynamicValue(o.value);
},
_checkDynamicValue: function (v) {
var type = null;
if (BI.isNotNull(v)) {
type = v.type;
}
switch (type) {
case BI.DynamicYearMonthCombo.Dynamic:
this.changeIcon.setVisible(true);
this.comboWrapper.attr("items")[0].width = 30;
this.comboWrapper.resize();
break;
default:
this.comboWrapper.attr("items")[0].width = 0;
this.comboWrapper.resize();
this.changeIcon.setVisible(false);
break;
}
}, },
setValue: function (v) { setValue: function (v) {
this.storeValue = v; this.storeValue = v;
this.trigger.setValue(v); this.trigger.setValue(v);
this._checkDynamicValue(v);
}, },
getValue: function () { getValue: function () {

10
src/widget/dynamic/yearmonth/popup.yearmonth.js

@ -96,6 +96,8 @@ BI.DynamicYearMonthPopup = BI.inherit(BI.Widget, {
self.dateTab = this; self.dateTab = this;
}, },
tab: { tab: {
type: "bi.linear_segment",
cls: "bi-border-bottom",
height: this.constants.tabHeight, height: this.constants.tabHeight,
items: BI.createItems([{ items: BI.createItems([{
text: BI.i18nText("BI-Basic_Year_Fen"), text: BI.i18nText("BI-Basic_Year_Fen"),
@ -104,12 +106,8 @@ BI.DynamicYearMonthPopup = BI.inherit(BI.Widget, {
text: BI.i18nText("BI-Basic_Dynamic_Title"), text: BI.i18nText("BI-Basic_Dynamic_Title"),
value: BI.DynamicYearCombo.Dynamic value: BI.DynamicYearCombo.Dynamic
}], { }], {
textAlign: "center", textAlign: "center"
cls: "bi-list-item-active" })
}),
layouts: [{
type: "bi.center"
}]
}, },
cardCreator: function (v) { cardCreator: function (v) {
switch (v) { switch (v) {

12
src/widget/dynamic/yearmonth/trigger.yearmonth.js

@ -7,7 +7,7 @@ BI.DynamicYearMonthTrigger = BI.inherit(BI.Trigger, {
}, },
props: { props: {
extraCls: "bi-year-month-trigger bi-border", extraCls: "bi-year-month-trigger",
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 max: "2099-12-31", // 最大日期
height: 24 height: 24
@ -62,11 +62,15 @@ BI.DynamicYearMonthTrigger = BI.inherit(BI.Trigger, {
type: "bi.sign_editor", type: "bi.sign_editor",
height: o.height, height: o.height,
validationChecker: function (v) { validationChecker: function (v) {
return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(isYear ? v : BI.getDate().getFullYear(), isYear ? 1 : v, 1, o.min, o.max)[0]); if(isYear) {
return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, 1, 1, o.min, o.max)[0]);
}
return v === "" || ((v >= 1 && v <= 12) && !BI.checkDateVoid(BI.getDate().getFullYear(), v, 1, o.min, o.max)[0]);
}, },
quitChecker: function () { quitChecker: function () {
return false; return false;
}, },
watermark: BI.i18nText("BI-Basic_Unrestricted"),
errorText: function (v) { errorText: function (v) {
return !BI.isPositiveInteger(v) ? c.errorText : c.errorTextInvalid; return !BI.isPositiveInteger(v) ? c.errorText : c.errorTextInvalid;
}, },
@ -136,7 +140,7 @@ BI.DynamicYearMonthTrigger = BI.inherit(BI.Trigger, {
if(BI.isNotNull(obj.year)) { if(BI.isNotNull(obj.year)) {
value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind"));
} }
if(BI.isNotNull(obj.month)) { if(BI.isNotNull(obj.month) && obj.month !== 0) {
value += Math.abs(obj.month) + BI.i18nText("BI-Basic_Year") + (obj.month < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); value += Math.abs(obj.month) + BI.i18nText("BI-Basic_Year") + (obj.month < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind"));
} }
return value; return value;
@ -146,7 +150,7 @@ BI.DynamicYearMonthTrigger = BI.inherit(BI.Trigger, {
var dateStr = date.print("%Y-%x"); var dateStr = date.print("%Y-%x");
this.yearEditor.setValue(date.getFullYear()); this.yearEditor.setValue(date.getFullYear());
this.monthEditor.setValue(date.getMonth() + 1); this.monthEditor.setValue(date.getMonth() + 1);
this.setTitle(text + ":" + dateStr); this.setTitle(BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr));
}, },
setValue: function (v) { setValue: function (v) {

1
src/widget/dynamic/yearquarter/card.static.yearquarter.js

@ -68,6 +68,7 @@ BI.StaticYearQuarterCard = BI.inherit(BI.Widget, {
listeners: [{ listeners: [{
eventName: BI.ButtonGroup.EVENT_CHANGE, eventName: BI.ButtonGroup.EVENT_CHANGE,
action: function () { action: function () {
self.selectedYear = self.yearPicker.getValue();
self.selectedQuarter = this.getValue()[0]; self.selectedQuarter = this.getValue()[0];
self.fireEvent(BI.StaticYearQuarterCard.EVENT_CHANGE); self.fireEvent(BI.StaticYearQuarterCard.EVENT_CHANGE);
} }

44
src/widget/dynamic/yearquarter/combo.yearquarter.js

@ -1,7 +1,7 @@
BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, { BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
props: { props: {
baseCls: "bi-year-quarter-combo", baseCls: "bi-year-quarter-combo bi-border",
behaviors: {}, behaviors: {},
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 max: "2099-12-31", // 最大日期
@ -37,7 +37,6 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.combo", type: "bi.combo",
element: this,
isNeedAdjustHeight: false, isNeedAdjustHeight: false,
isNeedAdjustWidth: false, isNeedAdjustWidth: false,
el: this.trigger, el: this.trigger,
@ -90,11 +89,52 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
self.popup.setValue(self.storeValue); self.popup.setValue(self.storeValue);
self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_BEFORE_POPUPVIEW); self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_BEFORE_POPUPVIEW);
}); });
BI.createWidget({
type: "bi.htape",
element: this,
ref: function () {
self.comboWrapper = this;
},
items: [{
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font",
width: 24,
height: 24,
ref: function () {
self.changeIcon = this;
}
},
width: 30
}, this.combo]
});
this._checkDynamicValue(o.value);
},
_checkDynamicValue: function (v) {
var type = null;
if (BI.isNotNull(v)) {
type = v.type;
}
switch (type) {
case BI.DynamicYearQuarterCombo.Dynamic:
this.changeIcon.setVisible(true);
this.comboWrapper.attr("items")[0].width = 30;
this.comboWrapper.resize();
break;
default:
this.comboWrapper.attr("items")[0].width = 0;
this.comboWrapper.resize();
this.changeIcon.setVisible(false);
break;
}
}, },
setValue: function (v) { setValue: function (v) {
this.storeValue = v; this.storeValue = v;
this.trigger.setValue(v); this.trigger.setValue(v);
this._checkDynamicValue(v);
}, },
getValue: function () { getValue: function () {

10
src/widget/dynamic/yearquarter/popup.yearquarter.js

@ -89,6 +89,8 @@ BI.DynamicYearQuarterPopup = BI.inherit(BI.Widget, {
self.dateTab = this; self.dateTab = this;
}, },
tab: { tab: {
type: "bi.linear_segment",
cls: "bi-border-bottom",
height: this.constants.tabHeight, height: this.constants.tabHeight,
items: BI.createItems([{ items: BI.createItems([{
text: BI.i18nText("BI-Basic_Year_Fen"), text: BI.i18nText("BI-Basic_Year_Fen"),
@ -97,12 +99,8 @@ BI.DynamicYearQuarterPopup = BI.inherit(BI.Widget, {
text: BI.i18nText("BI-Basic_Dynamic_Title"), text: BI.i18nText("BI-Basic_Dynamic_Title"),
value: BI.DynamicYearQuarterCombo.Dynamic value: BI.DynamicYearQuarterCombo.Dynamic
}], { }], {
textAlign: "center", textAlign: "center"
cls: "bi-list-item-active" })
}),
layouts: [{
type: "bi.center"
}]
}, },
cardCreator: function (v) { cardCreator: function (v) {
switch (v) { switch (v) {

12
src/widget/dynamic/yearquarter/trigger.yearquarter.js

@ -7,7 +7,7 @@ BI.DynamicYearQuarterTrigger = BI.inherit(BI.Trigger, {
}, },
props: { props: {
extraCls: "bi-year-quarter-trigger bi-border", extraCls: "bi-year-quarter-trigger",
min: "1900-01-01", // 最小日期 min: "1900-01-01", // 最小日期
max: "2099-12-31", // 最大日期 max: "2099-12-31", // 最大日期
height: 24 height: 24
@ -62,7 +62,10 @@ BI.DynamicYearQuarterTrigger = BI.inherit(BI.Trigger, {
type: "bi.sign_editor", type: "bi.sign_editor",
height: o.height, height: o.height,
validationChecker: function (v) { validationChecker: function (v) {
return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(isYear ? v : BI.getDate().getFullYear(), isYear ? 1 : v, 1, o.min, o.max)[0]); if(isYear) {
return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, 1, 1, o.min, o.max)[0]);
}
return v === "" || ((v >= 1 && v <= 4) && !BI.checkDateVoid(BI.getDate().getFullYear(), v, 1, o.min, o.max)[0]);
}, },
quitChecker: function () { quitChecker: function () {
return false; return false;
@ -70,6 +73,7 @@ BI.DynamicYearQuarterTrigger = BI.inherit(BI.Trigger, {
errorText: function (v) { errorText: function (v) {
return !BI.isPositiveInteger(v) ? c.errorText : c.errorTextInvalid; return !BI.isPositiveInteger(v) ? c.errorText : c.errorTextInvalid;
}, },
watermark: BI.i18nText("BI-Basic_Unrestricted"),
hgap: c.hgap, hgap: c.hgap,
vgap: c.vgap, vgap: c.vgap,
allowBlank: true allowBlank: true
@ -136,7 +140,7 @@ BI.DynamicYearQuarterTrigger = BI.inherit(BI.Trigger, {
if(BI.isNotNull(obj.year)) { if(BI.isNotNull(obj.year)) {
value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind"));
} }
if(BI.isNotNull(obj.quarter)) { if(BI.isNotNull(obj.quarter) && obj.quarter !== 0) {
value += Math.abs(obj.quarter) + BI.i18nText("BI-Basic_Year") + (obj.quarter < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); value += Math.abs(obj.quarter) + BI.i18nText("BI-Basic_Year") + (obj.quarter < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind"));
} }
return value; return value;
@ -146,7 +150,7 @@ BI.DynamicYearQuarterTrigger = BI.inherit(BI.Trigger, {
var dateStr = date.print("%Y-%x"); var dateStr = date.print("%Y-%x");
this.yearEditor.setValue(date.getFullYear()); this.yearEditor.setValue(date.getFullYear());
this.quarterEditor.setValue(date.getQuarter()); this.quarterEditor.setValue(date.getQuarter());
this.setTitle(text + ":" + dateStr); this.setTitle(BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr));
}, },
setValue: function (v) { setValue: function (v) {

28
src/widget/dynamicdate/dynamicdate.combo.js

@ -22,6 +22,17 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
return { return {
type: "bi.htape", type: "bi.htape",
items: [{ items: [{
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font",
width: 24,
height: 24,
ref: function () {
self.changeIcon = this;
}
},
width: 30
}, {
type: "bi.absolute", type: "bi.absolute",
items: [{ items: [{
el: { el: {
@ -184,19 +195,8 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
}] }]
}, },
top: 0, top: 0,
left: 0 right: 0
}] }]
}, {
el: {
type: "bi.icon_button",
cls: "bi-trigger-icon-button date-change-h-font",
width: 24,
height: 24,
ref: function () {
self.changeIcon = this;
}
},
width: 30
}], }],
ref: function (_ref) { ref: function (_ref) {
self.comboWrapper = _ref; self.comboWrapper = _ref;
@ -216,11 +216,11 @@ BI.DynamicDateCombo = BI.inherit(BI.Single, {
switch (type) { switch (type) {
case BI.DynamicDateCombo.Dynamic: case BI.DynamicDateCombo.Dynamic:
this.changeIcon.setVisible(true); this.changeIcon.setVisible(true);
this.comboWrapper.attr("items")[1].width = 30; this.comboWrapper.attr("items")[0].width = 30;
this.comboWrapper.resize(); this.comboWrapper.resize();
break; break;
default: default:
this.comboWrapper.attr("items")[1].width = 0; this.comboWrapper.attr("items")[0].width = 0;
this.comboWrapper.resize(); this.comboWrapper.resize();
this.changeIcon.setVisible(false); this.changeIcon.setVisible(false);
break; break;

7
src/widget/dynamicdate/dynamicdate.param.item.js

@ -24,6 +24,13 @@ BI.DynamicDateParamItem = BI.inherit(BI.Widget, {
ref: function () { ref: function () {
self.editor = this; self.editor = this;
}, },
errorText: function (v) {
if(BI.isEmptyString(v)) {
return BI.i18nText("BI-Basic_Input_Can_Not_Null");
}
return BI.i18nText("BI-Please_Input_Positive_Integer");
},
allowBlank: false,
listeners: [{ listeners: [{
eventName: BI.SignEditor.EVENT_CONFIRM, eventName: BI.SignEditor.EVENT_CONFIRM,
action: function () { action: function () {

11
src/widget/dynamicdate/dynamicdate.popup.js

@ -77,7 +77,8 @@ BI.DynamicDatePopup = BI.inherit(BI.Widget, {
self.dateTab = this; self.dateTab = this;
}, },
tab: { tab: {
cls: "bi-multidate-popup-tab bi-border-bottom", type: "bi.linear_segment",
cls: "bi-border-bottom",
height: this.constants.tabHeight, height: this.constants.tabHeight,
items: BI.createItems([{ items: BI.createItems([{
text: BI.i18nText("BI-Multi_Date_YMD"), text: BI.i18nText("BI-Multi_Date_YMD"),
@ -86,12 +87,8 @@ BI.DynamicDatePopup = BI.inherit(BI.Widget, {
text: BI.i18nText("BI-Basic_Dynamic_Title"), text: BI.i18nText("BI-Basic_Dynamic_Title"),
value: BI.DynamicDateCombo.Dynamic value: BI.DynamicDateCombo.Dynamic
}], { }], {
textAlign: "center", textAlign: "center"
cls: "bi-list-item-active" })
}),
layouts: [{
type: "bi.center"
}]
}, },
cardCreator: function (v) { cardCreator: function (v) {
switch (v) { switch (v) {

20
src/widget/dynamicdate/dynamicdate.trigger.js

@ -91,10 +91,10 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
type: "bi.htape", type: "bi.htape",
element: this, element: this,
items: [{ items: [{
el: this.editor
}, {
el: BI.createWidget(), el: BI.createWidget(),
width: 30 width: 30
}, {
el: this.editor
}] }]
}); });
this.setValue(o.value); this.setValue(o.value);
@ -139,32 +139,32 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
var dateStr = date.print("%Y-%x-%e"); var dateStr = date.print("%Y-%x-%e");
this.editor.setState(dateStr); this.editor.setState(dateStr);
this.editor.setValue(dateStr); this.editor.setValue(dateStr);
this.setTitle(text + ":" + dateStr); this.setTitle(BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr));
}, },
_getText: function (obj) { _getText: function (obj) {
var value = ""; var value = "";
if(BI.isNotNull(obj.year)) { if(BI.isNotNull(obj.year) && obj.year !== 0) {
value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Year"), obj.position); value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Year"), obj.position);
} }
if(BI.isNotNull(obj.quarter)) { if(BI.isNotNull(obj.quarter) && obj.quarter !== 0) {
value += Math.abs(obj.quarter) + BI.i18nText("BI-Basic_Single_Quarter") + (obj.quarter < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Year"), obj.position); value += Math.abs(obj.quarter) + BI.i18nText("BI-Basic_Single_Quarter") + (obj.quarter < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Year"), obj.position);
} }
if(BI.isNotNull(obj.month)) { if(BI.isNotNull(obj.month) && obj.month !== 0) {
value += Math.abs(obj.month) + BI.i18nText("BI-Basic_Month") + (obj.month < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Month"), obj.position); value += Math.abs(obj.month) + BI.i18nText("BI-Basic_Month") + (obj.month < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Month"), obj.position);
} }
if(BI.isNotNull(obj.week)) { if(BI.isNotNull(obj.week) && obj.week !== 0) {
value += Math.abs(obj.week) + BI.i18nText("BI-Basic_Week") + (obj.week < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Week"), obj.position); value += Math.abs(obj.week) + BI.i18nText("BI-Basic_Week") + (obj.week < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + getPositionText(BI.i18nText("BI-Basic_Week"), obj.position);
} }
if(BI.isNotNull(obj.day)) { if(BI.isNotNull(obj.day) && obj.day !== 0) {
value += Math.abs(obj.day) + BI.i18nText("BI-Basic_Day") + (obj.day < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + BI.size(obj) === 1 ? getPositionText(BI.i18nText("BI-Basic_Month"), obj.position) : ""; value += Math.abs(obj.day) + BI.i18nText("BI-Basic_Day") + (obj.day < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")) + BI.size(obj) === 1 ? getPositionText(BI.i18nText("BI-Basic_Month"), obj.position) : "";
} }
if(BI.isNotNull(obj.workDay)) { if(BI.isNotNull(obj.workDay) && obj.workDay !== 0) {
value += Math.abs(obj.workDay) + BI.i18nText("BI-Basic_Work_Day") + (obj.workDay < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); value += Math.abs(obj.workDay) + BI.i18nText("BI-Basic_Work_Day") + (obj.workDay < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind"));
} }
return value; return value;
function getPositionText(baseText, position) { function getPositionText (baseText, position) {
switch (position) { switch (position) {
case BI.DynamicDateCard.OFFSET.BEGIN: case BI.DynamicDateCard.OFFSET.BEGIN:
return baseText + BI.i18nText("BI-Basic_Begin_Start"); return baseText + BI.i18nText("BI-Basic_Begin_Start");

2
src/widget/multidate/multidate.popup.js

@ -64,7 +64,7 @@ BI.MultiDatePopup = BI.inherit(BI.Widget, {
this.dateTab = BI.createWidget({ this.dateTab = BI.createWidget({
type: "bi.tab", type: "bi.tab",
tab: { tab: {
cls: "bi-multidate-popup-tab bi-border-bottom", cls: "bi-border-bottom",
height: this.constants.tabHeight, height: this.constants.tabHeight,
items: BI.createItems([{ items: BI.createItems([{
text: BI.i18nText("BI-Multi_Date_YMD"), text: BI.i18nText("BI-Multi_Date_YMD"),

3
ui/js/index.js

@ -146,5 +146,6 @@ BI.i18n = {
"BI-Basic_Current_Month": "本月", "BI-Basic_Current_Month": "本月",
"BI-Basic_Current_Quarter": "本季度", "BI-Basic_Current_Quarter": "本季度",
"BI-Basic_Year_Month": "年月", "BI-Basic_Year_Month": "年月",
"BI-Basic_Year_Quarter": "年季度" "BI-Basic_Year_Quarter": "年季度",
"BI-Basic_Input_Can_Not_Null": "输入框不能为空"
}; };
Loading…
Cancel
Save