Browse Source

Merge pull request #352 in FUI/fineui from ~WINDY/fui:master to master

* commit '9c9ce048b652c83502ea2cbb986dcb55be4d8811':
  BI-18028 && BI-18713 && BI-18709 && BI-18647 && BI-18662 && BI-18203 && BI-18625
es6
guy 7 years ago
parent
commit
ef0cbbd42d
  1. 2
      demo/js/widget/timeinterval/demo.time_interval.js
  2. 2
      demo/version.js
  3. 28
      dist/_fineui.min.js
  4. 117
      dist/bundle.js
  5. 26
      dist/bundle.min.js
  6. 2
      dist/config.js
  7. 2
      dist/demo.js
  8. 28
      dist/fineui.min.js
  9. 115
      dist/widget.js
  10. 528
      package-lock.json
  11. 2
      public/js/index.js
  12. 4
      src/widget/date/calendar/picker.date.js
  13. 41
      src/widget/dynamicdate/dynamicdate.trigger.js
  14. 45
      src/widget/dynamicdatetime/dynamicdatetime.trigger.js
  15. 11
      src/widget/yearmonth/combo.yearmonth.js
  16. 12
      src/widget/yearquarter/combo.yearquarter.js
  17. 2
      ui/js/index.js

2
demo/js/widget/timeinterval/demo.time_interval.js

@ -28,7 +28,7 @@ Demo.TimeInterval = BI.inherit(BI.Widget, {
type: 1, type: 1,
value: { value: {
year: 2018, year: 2018,
month: 0, month: 1,
day: 12 day: 12
} }
} }

2
demo/version.js

@ -110,7 +110,7 @@ BI.i18n = {
"BI-Transparent_Color": "透明", "BI-Transparent_Color": "透明",
"BI-Basic_Simple_Monday": "一", "BI-Basic_Simple_Monday": "一",
"BI-Multi_Date_Year_End": "年末", "BI-Multi_Date_Year_End": "年末",
"BI-Time_Interval_Error_Text": "请保证前面时间小于/等于后面的时间", "BI-Time_Interval_Error_Text": "请保证开始时间早于/等于时间",
"BI-Basic_Time": "时间", "BI-Basic_Time": "时间",
"BI-Basic_OK": "确定", "BI-Basic_OK": "确定",
"BI-Basic_Sure": "确定", "BI-Basic_Sure": "确定",

28
dist/_fineui.min.js vendored

File diff suppressed because one or more lines are too long

117
dist/bundle.js vendored

@ -87717,7 +87717,7 @@ BI.DatePicker = BI.inherit(BI.Widget, {
height: 25 height: 25
}); });
this.left.on(BI.IconButton.EVENT_CHANGE, function () { this.left.on(BI.IconButton.EVENT_CHANGE, function () {
if (self._month === 0) { if (self._month === 1) {
self.setValue({ self.setValue({
year: self.year.getValue() - 1, year: self.year.getValue() - 1,
month: 12 month: 12
@ -87741,7 +87741,7 @@ BI.DatePicker = BI.inherit(BI.Widget, {
}); });
this.right.on(BI.IconButton.EVENT_CHANGE, function () { this.right.on(BI.IconButton.EVENT_CHANGE, function () {
if (self._month === 11) { if (self._month === 12) {
self.setValue({ self.setValue({
year: self.year.getValue() + 1, year: self.year.getValue() + 1,
month: 0 month: 0
@ -91308,9 +91308,10 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
}, },
_monthCheck: function (v) { _monthCheck: function (v) {
var date = BI.parseDateTime(v, "%Y-%X-%d").print("%Y-%X-%d"); var date = BI.parseDateTime(v, "%Y-%X-%d");
return (BI.parseDateTime(v, "%Y-%X").print("%Y-%X") === v || var dateStr = date.print("%Y-%X-%d");
BI.parseDateTime(v, "%Y-%x").print("%Y-%x") === v) && date >= this.options.min && date <= this.options.max; return (date.getMonth() > 0 && (BI.parseDateTime(v, "%Y-%X").print("%Y-%X") === v ||
BI.parseDateTime(v, "%Y-%x").print("%Y-%x") === v)) && dateStr >= this.options.min && dateStr <= this.options.max;
}, },
_setInnerValue: function (date, text) { _setInnerValue: function (date, text) {
@ -91323,30 +91324,40 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
_getText: function (obj) { _getText: function (obj) {
var value = ""; var value = "";
var endText = ""; var endText = "";
if(BI.isNotNull(obj.year) && BI.parseInt(obj.year) !== 0) { 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")); if(BI.parseInt(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"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Year"), obj.position); endText = getPositionText(BI.i18nText("BI-Basic_Year"), obj.position);
} }
if(BI.isNotNull(obj.quarter) && BI.parseInt(obj.quarter) !== 0) { if(BI.isNotNull(obj.quarter)) {
value += Math.abs(obj.quarter) + BI.i18nText("BI-Basic_Single_Quarter") + (obj.quarter < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); if(BI.parseInt(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"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Single_Quarter"), obj.position); endText = getPositionText(BI.i18nText("BI-Basic_Single_Quarter"), obj.position);
} }
if(BI.isNotNull(obj.month) && BI.parseInt(obj.month) !== 0) { if(BI.isNotNull(obj.month)) {
value += Math.abs(obj.month) + BI.i18nText("BI-Basic_Month") + (obj.month < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); if(BI.parseInt(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"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Month"), obj.position); endText = getPositionText(BI.i18nText("BI-Basic_Month"), obj.position);
} }
if(BI.isNotNull(obj.week) && BI.parseInt(obj.week) !== 0) { if(BI.isNotNull(obj.week)) {
value += Math.abs(obj.week) + BI.i18nText("BI-Basic_Week") + (obj.week < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); if(BI.parseInt(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"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Week"), obj.position); endText = getPositionText(BI.i18nText("BI-Basic_Week"), obj.position);
} }
if(BI.isNotNull(obj.day) && BI.parseInt(obj.day) !== 0) { if(BI.isNotNull(obj.day)) {
value += Math.abs(obj.day) + BI.i18nText("BI-Basic_Day") + (obj.day < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); if(BI.parseInt(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"));
}
endText = BI.size(obj) === 1 ? getPositionText(BI.i18nText("BI-Basic_Month"), obj.position) : ""; endText = BI.size(obj) === 1 ? getPositionText(BI.i18nText("BI-Basic_Month"), obj.position) : "";
} }
if(BI.isNotNull(obj.workDay) && BI.parseInt(obj.workDay) !== 0) { if(BI.isNotNull(obj.workDay) && BI.parseInt(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 + endText; return value + endText;
function getPositionText (baseText, position) { function getPositionText (baseText, position) {
switch (position) { switch (position) {
@ -91382,7 +91393,7 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
this.editor.setValue(""); this.editor.setValue("");
this.setTitle(""); this.setTitle("");
} else { } else {
var dateStr = value.year + "-" + (value.month) + "-" + value.day; var dateStr = BI.getDate(value.year, (value.month - 1), value.day).print("%Y-%X-%d");
this.editor.setState(dateStr); this.editor.setState(dateStr);
this.editor.setValue(dateStr); this.editor.setValue(dateStr);
this.setTitle(dateStr); this.setTitle(dateStr);
@ -92203,9 +92214,10 @@ BI.extend(BI.DynamicDateTimeSelect, {
}, },
_monthCheck: function (v) { _monthCheck: function (v) {
var date = BI.parseDateTime(v, "%Y-%X-%d").print("%Y-%X-%d"); var date = BI.parseDateTime(v, "%Y-%X-%d");
return (BI.parseDateTime(v, "%Y-%X").print("%Y-%X") === v || var dateStr = date.print("%Y-%X-%d");
BI.parseDateTime(v, "%Y-%x").print("%Y-%x") === v) && date >= this.options.min && date <= this.options.max; return (date.getMonth() > 0 && (BI.parseDateTime(v, "%Y-%X").print("%Y-%X") === v ||
BI.parseDateTime(v, "%Y-%x").print("%Y-%x") === v)) && dateStr >= this.options.min && dateStr <= this.options.max;
}, },
_setInnerValue: function (date, text) { _setInnerValue: function (date, text) {
@ -92217,25 +92229,41 @@ BI.extend(BI.DynamicDateTimeSelect, {
_getText: function (obj) { _getText: function (obj) {
var value = ""; var value = "";
if(BI.isNotNull(obj.year) && BI.parseInt(obj.year) !== 0) { var endText = "";
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.year)) {
if(BI.parseInt(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"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Year"), obj.position);
} }
if(BI.isNotNull(obj.quarter) && BI.parseInt(obj.quarter) !== 0) { if(BI.isNotNull(obj.quarter)) {
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.parseInt(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"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Single_Quarter"), obj.position);
} }
if(BI.isNotNull(obj.month) && BI.parseInt(obj.month) !== 0) { if(BI.isNotNull(obj.month)) {
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.parseInt(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"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Month"), obj.position);
} }
if(BI.isNotNull(obj.week) && BI.parseInt(obj.week) !== 0) { if(BI.isNotNull(obj.week)) {
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.parseInt(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"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Week"), obj.position);
} }
if(BI.isNotNull(obj.day) && BI.parseInt(obj.day) !== 0) { if(BI.isNotNull(obj.day)) {
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.parseInt(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"));
}
endText = BI.size(obj) === 1 ? getPositionText(BI.i18nText("BI-Basic_Month"), obj.position) : "";
} }
if(BI.isNotNull(obj.workDay) && BI.parseInt(obj.workDay) !== 0) { if(BI.isNotNull(obj.workDay) && BI.parseInt(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 + endText;
function getPositionText (baseText, position) { function getPositionText (baseText, position) {
switch (position) { switch (position) {
@ -108818,6 +108846,7 @@ BI.shortcut("bi.static_year_month_card", BI.StaticYearMonthCard);BI.DynamicYearM
BI.DynamicYearMonthCombo.superclass._init.apply(this, arguments); BI.DynamicYearMonthCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.storeValue = o.value; this.storeValue = o.value;
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.min,
@ -108841,11 +108870,17 @@ BI.shortcut("bi.static_year_month_card", BI.StaticYearMonthCard);BI.DynamicYearM
if (self.combo.isViewVisible()) { if (self.combo.isViewVisible()) {
return; return;
} }
self.storeValue = self.trigger.getValue(); var dateStore = self.storeTriggerValue;
var dateObj = self.trigger.getKey();
if (BI.isNotEmptyString(dateObj) && !BI.isEqual(dateObj, dateStore)) {
self.storeValue = self.trigger.getValue();
self.setValue(self.trigger.getValue());
}
self._checkDynamicValue(self.storeValue); self._checkDynamicValue(self.storeValue);
self.fireEvent(BI.DynamicYearMonthCombo.EVENT_CONFIRM); self.fireEvent(BI.DynamicYearMonthCombo.EVENT_CONFIRM);
}); });
this.trigger.on(BI.DynamicYearMonthCombo.EVENT_FOCUS, function () { this.trigger.on(BI.DynamicYearMonthTrigger.EVENT_FOCUS, function () {
self.storeTriggerValue = self.trigger.getKey();
self.fireEvent(BI.DynamicYearMonthCombo.EVENT_FOCUS); self.fireEvent(BI.DynamicYearMonthCombo.EVENT_FOCUS);
}); });
@ -109381,7 +109416,7 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY
}, },
getKey: function () { getKey: function () {
return this.yearEditor.getValue() + "-" + this.monthEditor.getValue(); return this.yearEditor.getState() + "-" + this.monthEditor.getState();
} }
}); });
BI.DynamicYearMonthTrigger.EVENT_VALID = "EVENT_FOCUS"; BI.DynamicYearMonthTrigger.EVENT_VALID = "EVENT_FOCUS";
@ -109773,6 +109808,7 @@ BI.shortcut("bi.static_year_quarter_card", BI.StaticYearQuarterCard);BI.DynamicY
BI.DynamicYearQuarterCombo.superclass._init.apply(this, arguments); BI.DynamicYearQuarterCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.storeValue = o.value; this.storeValue = o.value;
self.storeTriggerValue = "";
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.dynamic_year_quarter_trigger", type: "bi.dynamic_year_quarter_trigger",
min: o.min, min: o.min,
@ -109792,10 +109828,19 @@ BI.shortcut("bi.static_year_quarter_card", BI.StaticYearQuarterCard);BI.DynamicY
if (self.combo.isViewVisible()) { if (self.combo.isViewVisible()) {
return; return;
} }
self.storeValue = self.trigger.getValue(); var dateStore = self.storeTriggerValue;
var dateObj = self.trigger.getKey();
if (BI.isNotEmptyString(dateObj) && !BI.isEqual(dateObj, dateStore)) {
self.storeValue = self.trigger.getValue();
self.setValue(self.trigger.getValue());
}
self._checkDynamicValue(self.storeValue); self._checkDynamicValue(self.storeValue);
self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_CONFIRM); self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_CONFIRM);
}); });
this.trigger.on(BI.DynamicYearQuarterTrigger.EVENT_FOCUS, function () {
self.storeTriggerValue = self.trigger.getKey();
self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_FOCUS);
});
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.combo", type: "bi.combo",
@ -112406,7 +112451,7 @@ BI.i18n = {
"BI-Transparent_Color": "透明", "BI-Transparent_Color": "透明",
"BI-Basic_Simple_Monday": "一", "BI-Basic_Simple_Monday": "一",
"BI-Multi_Date_Year_End": "年末", "BI-Multi_Date_Year_End": "年末",
"BI-Time_Interval_Error_Text": "请保证前面时间小于/等于后面的时间", "BI-Time_Interval_Error_Text": "请保证开始时间早于/等于结束时间",
"BI-Basic_Time": "时间", "BI-Basic_Time": "时间",
"BI-Basic_OK": "确定", "BI-Basic_OK": "确定",
"BI-Basic_Sure": "确定", "BI-Basic_Sure": "确定",

26
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

2
dist/config.js vendored

@ -110,7 +110,7 @@ BI.i18n = {
"BI-Transparent_Color": "透明", "BI-Transparent_Color": "透明",
"BI-Basic_Simple_Monday": "一", "BI-Basic_Simple_Monday": "一",
"BI-Multi_Date_Year_End": "年末", "BI-Multi_Date_Year_End": "年末",
"BI-Time_Interval_Error_Text": "请保证前面时间小于/等于后面的时间", "BI-Time_Interval_Error_Text": "请保证开始时间早于/等于时间",
"BI-Basic_Time": "时间", "BI-Basic_Time": "时间",
"BI-Basic_OK": "确定", "BI-Basic_OK": "确定",
"BI-Basic_Sure": "确定", "BI-Basic_Sure": "确定",

2
dist/demo.js vendored

@ -14304,7 +14304,7 @@ Demo.TimeInterval = BI.inherit(BI.Widget, {
type: 1, type: 1,
value: { value: {
year: 2018, year: 2018,
month: 0, month: 1,
day: 12 day: 12
} }
} }

28
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

115
dist/widget.js vendored

@ -570,7 +570,7 @@ BI.DatePicker = BI.inherit(BI.Widget, {
height: 25 height: 25
}); });
this.left.on(BI.IconButton.EVENT_CHANGE, function () { this.left.on(BI.IconButton.EVENT_CHANGE, function () {
if (self._month === 0) { if (self._month === 1) {
self.setValue({ self.setValue({
year: self.year.getValue() - 1, year: self.year.getValue() - 1,
month: 12 month: 12
@ -594,7 +594,7 @@ BI.DatePicker = BI.inherit(BI.Widget, {
}); });
this.right.on(BI.IconButton.EVENT_CHANGE, function () { this.right.on(BI.IconButton.EVENT_CHANGE, function () {
if (self._month === 11) { if (self._month === 12) {
self.setValue({ self.setValue({
year: self.year.getValue() + 1, year: self.year.getValue() + 1,
month: 0 month: 0
@ -4161,9 +4161,10 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
}, },
_monthCheck: function (v) { _monthCheck: function (v) {
var date = BI.parseDateTime(v, "%Y-%X-%d").print("%Y-%X-%d"); var date = BI.parseDateTime(v, "%Y-%X-%d");
return (BI.parseDateTime(v, "%Y-%X").print("%Y-%X") === v || var dateStr = date.print("%Y-%X-%d");
BI.parseDateTime(v, "%Y-%x").print("%Y-%x") === v) && date >= this.options.min && date <= this.options.max; return (date.getMonth() > 0 && (BI.parseDateTime(v, "%Y-%X").print("%Y-%X") === v ||
BI.parseDateTime(v, "%Y-%x").print("%Y-%x") === v)) && dateStr >= this.options.min && dateStr <= this.options.max;
}, },
_setInnerValue: function (date, text) { _setInnerValue: function (date, text) {
@ -4176,30 +4177,40 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
_getText: function (obj) { _getText: function (obj) {
var value = ""; var value = "";
var endText = ""; var endText = "";
if(BI.isNotNull(obj.year) && BI.parseInt(obj.year) !== 0) { 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")); if(BI.parseInt(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"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Year"), obj.position); endText = getPositionText(BI.i18nText("BI-Basic_Year"), obj.position);
} }
if(BI.isNotNull(obj.quarter) && BI.parseInt(obj.quarter) !== 0) { if(BI.isNotNull(obj.quarter)) {
value += Math.abs(obj.quarter) + BI.i18nText("BI-Basic_Single_Quarter") + (obj.quarter < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); if(BI.parseInt(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"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Single_Quarter"), obj.position); endText = getPositionText(BI.i18nText("BI-Basic_Single_Quarter"), obj.position);
} }
if(BI.isNotNull(obj.month) && BI.parseInt(obj.month) !== 0) { if(BI.isNotNull(obj.month)) {
value += Math.abs(obj.month) + BI.i18nText("BI-Basic_Month") + (obj.month < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); if(BI.parseInt(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"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Month"), obj.position); endText = getPositionText(BI.i18nText("BI-Basic_Month"), obj.position);
} }
if(BI.isNotNull(obj.week) && BI.parseInt(obj.week) !== 0) { if(BI.isNotNull(obj.week)) {
value += Math.abs(obj.week) + BI.i18nText("BI-Basic_Week") + (obj.week < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); if(BI.parseInt(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"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Week"), obj.position); endText = getPositionText(BI.i18nText("BI-Basic_Week"), obj.position);
} }
if(BI.isNotNull(obj.day) && BI.parseInt(obj.day) !== 0) { if(BI.isNotNull(obj.day)) {
value += Math.abs(obj.day) + BI.i18nText("BI-Basic_Day") + (obj.day < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); if(BI.parseInt(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"));
}
endText = BI.size(obj) === 1 ? getPositionText(BI.i18nText("BI-Basic_Month"), obj.position) : ""; endText = BI.size(obj) === 1 ? getPositionText(BI.i18nText("BI-Basic_Month"), obj.position) : "";
} }
if(BI.isNotNull(obj.workDay) && BI.parseInt(obj.workDay) !== 0) { if(BI.isNotNull(obj.workDay) && BI.parseInt(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 + endText; return value + endText;
function getPositionText (baseText, position) { function getPositionText (baseText, position) {
switch (position) { switch (position) {
@ -4235,7 +4246,7 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
this.editor.setValue(""); this.editor.setValue("");
this.setTitle(""); this.setTitle("");
} else { } else {
var dateStr = value.year + "-" + (value.month) + "-" + value.day; var dateStr = BI.getDate(value.year, (value.month - 1), value.day).print("%Y-%X-%d");
this.editor.setState(dateStr); this.editor.setState(dateStr);
this.editor.setValue(dateStr); this.editor.setValue(dateStr);
this.setTitle(dateStr); this.setTitle(dateStr);
@ -5056,9 +5067,10 @@ BI.extend(BI.DynamicDateTimeSelect, {
}, },
_monthCheck: function (v) { _monthCheck: function (v) {
var date = BI.parseDateTime(v, "%Y-%X-%d").print("%Y-%X-%d"); var date = BI.parseDateTime(v, "%Y-%X-%d");
return (BI.parseDateTime(v, "%Y-%X").print("%Y-%X") === v || var dateStr = date.print("%Y-%X-%d");
BI.parseDateTime(v, "%Y-%x").print("%Y-%x") === v) && date >= this.options.min && date <= this.options.max; return (date.getMonth() > 0 && (BI.parseDateTime(v, "%Y-%X").print("%Y-%X") === v ||
BI.parseDateTime(v, "%Y-%x").print("%Y-%x") === v)) && dateStr >= this.options.min && dateStr <= this.options.max;
}, },
_setInnerValue: function (date, text) { _setInnerValue: function (date, text) {
@ -5070,25 +5082,41 @@ BI.extend(BI.DynamicDateTimeSelect, {
_getText: function (obj) { _getText: function (obj) {
var value = ""; var value = "";
if(BI.isNotNull(obj.year) && BI.parseInt(obj.year) !== 0) { var endText = "";
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.year)) {
if(BI.parseInt(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"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Year"), obj.position);
} }
if(BI.isNotNull(obj.quarter) && BI.parseInt(obj.quarter) !== 0) { if(BI.isNotNull(obj.quarter)) {
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.parseInt(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"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Single_Quarter"), obj.position);
} }
if(BI.isNotNull(obj.month) && BI.parseInt(obj.month) !== 0) { if(BI.isNotNull(obj.month)) {
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.parseInt(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"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Month"), obj.position);
} }
if(BI.isNotNull(obj.week) && BI.parseInt(obj.week) !== 0) { if(BI.isNotNull(obj.week)) {
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.parseInt(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"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Week"), obj.position);
} }
if(BI.isNotNull(obj.day) && BI.parseInt(obj.day) !== 0) { if(BI.isNotNull(obj.day)) {
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.parseInt(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"));
}
endText = BI.size(obj) === 1 ? getPositionText(BI.i18nText("BI-Basic_Month"), obj.position) : "";
} }
if(BI.isNotNull(obj.workDay) && BI.parseInt(obj.workDay) !== 0) { if(BI.isNotNull(obj.workDay) && BI.parseInt(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 + endText;
function getPositionText (baseText, position) { function getPositionText (baseText, position) {
switch (position) { switch (position) {
@ -21671,6 +21699,7 @@ BI.shortcut("bi.static_year_month_card", BI.StaticYearMonthCard);BI.DynamicYearM
BI.DynamicYearMonthCombo.superclass._init.apply(this, arguments); BI.DynamicYearMonthCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.storeValue = o.value; this.storeValue = o.value;
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.min,
@ -21694,11 +21723,17 @@ BI.shortcut("bi.static_year_month_card", BI.StaticYearMonthCard);BI.DynamicYearM
if (self.combo.isViewVisible()) { if (self.combo.isViewVisible()) {
return; return;
} }
self.storeValue = self.trigger.getValue(); var dateStore = self.storeTriggerValue;
var dateObj = self.trigger.getKey();
if (BI.isNotEmptyString(dateObj) && !BI.isEqual(dateObj, dateStore)) {
self.storeValue = self.trigger.getValue();
self.setValue(self.trigger.getValue());
}
self._checkDynamicValue(self.storeValue); self._checkDynamicValue(self.storeValue);
self.fireEvent(BI.DynamicYearMonthCombo.EVENT_CONFIRM); self.fireEvent(BI.DynamicYearMonthCombo.EVENT_CONFIRM);
}); });
this.trigger.on(BI.DynamicYearMonthCombo.EVENT_FOCUS, function () { this.trigger.on(BI.DynamicYearMonthTrigger.EVENT_FOCUS, function () {
self.storeTriggerValue = self.trigger.getKey();
self.fireEvent(BI.DynamicYearMonthCombo.EVENT_FOCUS); self.fireEvent(BI.DynamicYearMonthCombo.EVENT_FOCUS);
}); });
@ -22234,7 +22269,7 @@ BI.shortcut("bi.dynamic_year_month_popup", BI.DynamicYearMonthPopup);BI.DynamicY
}, },
getKey: function () { getKey: function () {
return this.yearEditor.getValue() + "-" + this.monthEditor.getValue(); return this.yearEditor.getState() + "-" + this.monthEditor.getState();
} }
}); });
BI.DynamicYearMonthTrigger.EVENT_VALID = "EVENT_FOCUS"; BI.DynamicYearMonthTrigger.EVENT_VALID = "EVENT_FOCUS";
@ -22626,6 +22661,7 @@ BI.shortcut("bi.static_year_quarter_card", BI.StaticYearQuarterCard);BI.DynamicY
BI.DynamicYearQuarterCombo.superclass._init.apply(this, arguments); BI.DynamicYearQuarterCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.storeValue = o.value; this.storeValue = o.value;
self.storeTriggerValue = "";
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.dynamic_year_quarter_trigger", type: "bi.dynamic_year_quarter_trigger",
min: o.min, min: o.min,
@ -22645,10 +22681,19 @@ BI.shortcut("bi.static_year_quarter_card", BI.StaticYearQuarterCard);BI.DynamicY
if (self.combo.isViewVisible()) { if (self.combo.isViewVisible()) {
return; return;
} }
self.storeValue = self.trigger.getValue(); var dateStore = self.storeTriggerValue;
var dateObj = self.trigger.getKey();
if (BI.isNotEmptyString(dateObj) && !BI.isEqual(dateObj, dateStore)) {
self.storeValue = self.trigger.getValue();
self.setValue(self.trigger.getValue());
}
self._checkDynamicValue(self.storeValue); self._checkDynamicValue(self.storeValue);
self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_CONFIRM); self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_CONFIRM);
}); });
this.trigger.on(BI.DynamicYearQuarterTrigger.EVENT_FOCUS, function () {
self.storeTriggerValue = self.trigger.getKey();
self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_FOCUS);
});
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.combo", type: "bi.combo",

528
package-lock.json generated

File diff suppressed because it is too large Load Diff

2
public/js/index.js

@ -110,7 +110,7 @@ BI.i18n = {
"BI-Transparent_Color": "透明", "BI-Transparent_Color": "透明",
"BI-Basic_Simple_Monday": "一", "BI-Basic_Simple_Monday": "一",
"BI-Multi_Date_Year_End": "年末", "BI-Multi_Date_Year_End": "年末",
"BI-Time_Interval_Error_Text": "请保证前面时间小于/等于后面的时间", "BI-Time_Interval_Error_Text": "请保证开始时间早于/等于结束时间",
"BI-Basic_Time": "时间", "BI-Basic_Time": "时间",
"BI-Basic_OK": "确定", "BI-Basic_OK": "确定",
"BI-Basic_Sure": "确定", "BI-Basic_Sure": "确定",

4
src/widget/date/calendar/picker.date.js

@ -26,7 +26,7 @@ BI.DatePicker = BI.inherit(BI.Widget, {
height: 25 height: 25
}); });
this.left.on(BI.IconButton.EVENT_CHANGE, function () { this.left.on(BI.IconButton.EVENT_CHANGE, function () {
if (self._month === 0) { if (self._month === 1) {
self.setValue({ self.setValue({
year: self.year.getValue() - 1, year: self.year.getValue() - 1,
month: 12 month: 12
@ -50,7 +50,7 @@ BI.DatePicker = BI.inherit(BI.Widget, {
}); });
this.right.on(BI.IconButton.EVENT_CHANGE, function () { this.right.on(BI.IconButton.EVENT_CHANGE, function () {
if (self._month === 11) { if (self._month === 12) {
self.setValue({ self.setValue({
year: self.year.getValue() + 1, year: self.year.getValue() + 1,
month: 0 month: 0

41
src/widget/dynamicdate/dynamicdate.trigger.js

@ -133,9 +133,10 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
}, },
_monthCheck: function (v) { _monthCheck: function (v) {
var date = BI.parseDateTime(v, "%Y-%X-%d").print("%Y-%X-%d"); var date = BI.parseDateTime(v, "%Y-%X-%d");
return (BI.parseDateTime(v, "%Y-%X").print("%Y-%X") === v || var dateStr = date.print("%Y-%X-%d");
BI.parseDateTime(v, "%Y-%x").print("%Y-%x") === v) && date >= this.options.min && date <= this.options.max; return (date.getMonth() > 0 && (BI.parseDateTime(v, "%Y-%X").print("%Y-%X") === v ||
BI.parseDateTime(v, "%Y-%x").print("%Y-%x") === v)) && dateStr >= this.options.min && dateStr <= this.options.max;
}, },
_setInnerValue: function (date, text) { _setInnerValue: function (date, text) {
@ -148,30 +149,40 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
_getText: function (obj) { _getText: function (obj) {
var value = ""; var value = "";
var endText = ""; var endText = "";
if(BI.isNotNull(obj.year) && BI.parseInt(obj.year) !== 0) { 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")); if(BI.parseInt(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"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Year"), obj.position); endText = getPositionText(BI.i18nText("BI-Basic_Year"), obj.position);
} }
if(BI.isNotNull(obj.quarter) && BI.parseInt(obj.quarter) !== 0) { if(BI.isNotNull(obj.quarter)) {
value += Math.abs(obj.quarter) + BI.i18nText("BI-Basic_Single_Quarter") + (obj.quarter < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); if(BI.parseInt(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"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Single_Quarter"), obj.position); endText = getPositionText(BI.i18nText("BI-Basic_Single_Quarter"), obj.position);
} }
if(BI.isNotNull(obj.month) && BI.parseInt(obj.month) !== 0) { if(BI.isNotNull(obj.month)) {
value += Math.abs(obj.month) + BI.i18nText("BI-Basic_Month") + (obj.month < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); if(BI.parseInt(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"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Month"), obj.position); endText = getPositionText(BI.i18nText("BI-Basic_Month"), obj.position);
} }
if(BI.isNotNull(obj.week) && BI.parseInt(obj.week) !== 0) { if(BI.isNotNull(obj.week)) {
value += Math.abs(obj.week) + BI.i18nText("BI-Basic_Week") + (obj.week < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); if(BI.parseInt(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"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Week"), obj.position); endText = getPositionText(BI.i18nText("BI-Basic_Week"), obj.position);
} }
if(BI.isNotNull(obj.day) && BI.parseInt(obj.day) !== 0) { if(BI.isNotNull(obj.day)) {
value += Math.abs(obj.day) + BI.i18nText("BI-Basic_Day") + (obj.day < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); if(BI.parseInt(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"));
}
endText = BI.size(obj) === 1 ? getPositionText(BI.i18nText("BI-Basic_Month"), obj.position) : ""; endText = BI.size(obj) === 1 ? getPositionText(BI.i18nText("BI-Basic_Month"), obj.position) : "";
} }
if(BI.isNotNull(obj.workDay) && BI.parseInt(obj.workDay) !== 0) { if(BI.isNotNull(obj.workDay) && BI.parseInt(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 + endText; return value + endText;
function getPositionText (baseText, position) { function getPositionText (baseText, position) {
switch (position) { switch (position) {
@ -207,7 +218,7 @@ BI.DynamicDateTrigger = BI.inherit(BI.Trigger, {
this.editor.setValue(""); this.editor.setValue("");
this.setTitle(""); this.setTitle("");
} else { } else {
var dateStr = value.year + "-" + (value.month) + "-" + value.day; var dateStr = BI.getDate(value.year, (value.month - 1), value.day).print("%Y-%X-%d");
this.editor.setState(dateStr); this.editor.setState(dateStr);
this.editor.setValue(dateStr); this.editor.setValue(dateStr);
this.setTitle(dateStr); this.setTitle(dateStr);

45
src/widget/dynamicdatetime/dynamicdatetime.trigger.js

@ -135,9 +135,10 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
}, },
_monthCheck: function (v) { _monthCheck: function (v) {
var date = BI.parseDateTime(v, "%Y-%X-%d").print("%Y-%X-%d"); var date = BI.parseDateTime(v, "%Y-%X-%d");
return (BI.parseDateTime(v, "%Y-%X").print("%Y-%X") === v || var dateStr = date.print("%Y-%X-%d");
BI.parseDateTime(v, "%Y-%x").print("%Y-%x") === v) && date >= this.options.min && date <= this.options.max; return (date.getMonth() > 0 && (BI.parseDateTime(v, "%Y-%X").print("%Y-%X") === v ||
BI.parseDateTime(v, "%Y-%x").print("%Y-%x") === v)) && dateStr >= this.options.min && dateStr <= this.options.max;
}, },
_setInnerValue: function (date, text) { _setInnerValue: function (date, text) {
@ -149,25 +150,41 @@ BI.DynamicDateTimeTrigger = BI.inherit(BI.Trigger, {
_getText: function (obj) { _getText: function (obj) {
var value = ""; var value = "";
if(BI.isNotNull(obj.year) && BI.parseInt(obj.year) !== 0) { var endText = "";
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.year)) {
if(BI.parseInt(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"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Year"), obj.position);
} }
if(BI.isNotNull(obj.quarter) && BI.parseInt(obj.quarter) !== 0) { if(BI.isNotNull(obj.quarter)) {
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.parseInt(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"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Single_Quarter"), obj.position);
} }
if(BI.isNotNull(obj.month) && BI.parseInt(obj.month) !== 0) { if(BI.isNotNull(obj.month)) {
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.parseInt(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"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Month"), obj.position);
} }
if(BI.isNotNull(obj.week) && BI.parseInt(obj.week) !== 0) { if(BI.isNotNull(obj.week)) {
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.parseInt(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"));
}
endText = getPositionText(BI.i18nText("BI-Basic_Week"), obj.position);
} }
if(BI.isNotNull(obj.day) && BI.parseInt(obj.day) !== 0) { if(BI.isNotNull(obj.day)) {
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.parseInt(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"));
}
endText = BI.size(obj) === 1 ? getPositionText(BI.i18nText("BI-Basic_Month"), obj.position) : "";
} }
if(BI.isNotNull(obj.workDay) && BI.parseInt(obj.workDay) !== 0) { if(BI.isNotNull(obj.workDay) && BI.parseInt(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 + endText;
function getPositionText (baseText, position) { function getPositionText (baseText, position) {
switch (position) { switch (position) {

11
src/widget/yearmonth/combo.yearmonth.js

@ -12,6 +12,7 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
BI.DynamicYearMonthCombo.superclass._init.apply(this, arguments); BI.DynamicYearMonthCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.storeValue = o.value; this.storeValue = o.value;
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.min,
@ -35,11 +36,17 @@ BI.DynamicYearMonthCombo = BI.inherit(BI.Single, {
if (self.combo.isViewVisible()) { if (self.combo.isViewVisible()) {
return; return;
} }
self.storeValue = self.trigger.getValue(); var dateStore = self.storeTriggerValue;
var dateObj = self.trigger.getKey();
if (BI.isNotEmptyString(dateObj) && !BI.isEqual(dateObj, dateStore)) {
self.storeValue = self.trigger.getValue();
self.setValue(self.trigger.getValue());
}
self._checkDynamicValue(self.storeValue); self._checkDynamicValue(self.storeValue);
self.fireEvent(BI.DynamicYearMonthCombo.EVENT_CONFIRM); self.fireEvent(BI.DynamicYearMonthCombo.EVENT_CONFIRM);
}); });
this.trigger.on(BI.DynamicYearMonthCombo.EVENT_FOCUS, function () { this.trigger.on(BI.DynamicYearMonthTrigger.EVENT_FOCUS, function () {
self.storeTriggerValue = self.trigger.getKey();
self.fireEvent(BI.DynamicYearMonthCombo.EVENT_FOCUS); self.fireEvent(BI.DynamicYearMonthCombo.EVENT_FOCUS);
}); });

12
src/widget/yearquarter/combo.yearquarter.js

@ -12,6 +12,7 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
BI.DynamicYearQuarterCombo.superclass._init.apply(this, arguments); BI.DynamicYearQuarterCombo.superclass._init.apply(this, arguments);
var self = this, o = this.options; var self = this, o = this.options;
this.storeValue = o.value; this.storeValue = o.value;
self.storeTriggerValue = "";
this.trigger = BI.createWidget({ this.trigger = BI.createWidget({
type: "bi.dynamic_year_quarter_trigger", type: "bi.dynamic_year_quarter_trigger",
min: o.min, min: o.min,
@ -31,10 +32,19 @@ BI.DynamicYearQuarterCombo = BI.inherit(BI.Widget, {
if (self.combo.isViewVisible()) { if (self.combo.isViewVisible()) {
return; return;
} }
self.storeValue = self.trigger.getValue(); var dateStore = self.storeTriggerValue;
var dateObj = self.trigger.getKey();
if (BI.isNotEmptyString(dateObj) && !BI.isEqual(dateObj, dateStore)) {
self.storeValue = self.trigger.getValue();
self.setValue(self.trigger.getValue());
}
self._checkDynamicValue(self.storeValue); self._checkDynamicValue(self.storeValue);
self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_CONFIRM); self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_CONFIRM);
}); });
this.trigger.on(BI.DynamicYearQuarterTrigger.EVENT_FOCUS, function () {
self.storeTriggerValue = self.trigger.getKey();
self.fireEvent(BI.DynamicYearQuarterCombo.EVENT_FOCUS);
});
this.combo = BI.createWidget({ this.combo = BI.createWidget({
type: "bi.combo", type: "bi.combo",

2
ui/js/index.js

@ -110,7 +110,7 @@ BI.i18n = {
"BI-Transparent_Color": "透明", "BI-Transparent_Color": "透明",
"BI-Basic_Simple_Monday": "一", "BI-Basic_Simple_Monday": "一",
"BI-Multi_Date_Year_End": "年末", "BI-Multi_Date_Year_End": "年末",
"BI-Time_Interval_Error_Text": "请保证前面时间小于/等于后面的时间", "BI-Time_Interval_Error_Text": "请保证开始时间早于/等于结束时间",
"BI-Basic_Time": "时间", "BI-Basic_Time": "时间",
"BI-Basic_OK": "确定", "BI-Basic_OK": "确定",
"BI-Basic_Sure": "确定", "BI-Basic_Sure": "确定",

Loading…
Cancel
Save