|
|
|
@ -2710,7 +2710,9 @@ BI.extend(BI.DynamicDateCard, {
|
|
|
|
|
baseCls: "bi-dynamic-date-combo bi-border bi-focus-shadow bi-border-radius", |
|
|
|
|
height: 22, |
|
|
|
|
minDate: "1900-01-01", |
|
|
|
|
maxDate: "2099-12-31" |
|
|
|
|
maxDate: "2099-12-31", |
|
|
|
|
format: "", |
|
|
|
|
allowEdit: true |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -2748,6 +2750,8 @@ BI.extend(BI.DynamicDateCard, {
|
|
|
|
|
type: "bi.dynamic_date_trigger", |
|
|
|
|
min: opts.minDate, |
|
|
|
|
max: opts.maxDate, |
|
|
|
|
format: opts.format, |
|
|
|
|
allowEdit: opts.allowEdit, |
|
|
|
|
height: opts.height, |
|
|
|
|
value: opts.value, |
|
|
|
|
ref: function () { |
|
|
|
@ -3332,14 +3336,17 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
|
|
|
|
|
vgap: 2, |
|
|
|
|
yearLength: 4, |
|
|
|
|
yearMonthLength: 6, |
|
|
|
|
yearFullMonthLength: 7 |
|
|
|
|
yearFullMonthLength: 7, |
|
|
|
|
compareFormat: "%Y-%X-%d" |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
props: { |
|
|
|
|
extraCls: "bi-date-trigger", |
|
|
|
|
min: "1900-01-01", // 最小日期
|
|
|
|
|
max: "2099-12-31", // 最大日期
|
|
|
|
|
height: 24 |
|
|
|
|
height: 24, |
|
|
|
|
format: "", // 显示的日期格式化方式
|
|
|
|
|
allowEdit: true // 是否允许编辑
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_init: function () { |
|
|
|
@ -3350,9 +3357,10 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
|
|
|
|
|
type: "bi.sign_editor", |
|
|
|
|
height: o.height, |
|
|
|
|
validationChecker: function (v) { |
|
|
|
|
var date = v.match(/\d+/g); |
|
|
|
|
self._autoAppend(v, date); |
|
|
|
|
return self._dateCheck(v) && BI.checkDateLegal(v) && self._checkVoid({ |
|
|
|
|
var formatStr = self._getStandardDateStr(v); |
|
|
|
|
var date = formatStr.match(/\d+/g); |
|
|
|
|
!BI.isKey(o.format) && self._autoAppend(v, date); |
|
|
|
|
return self._dateCheck(formatStr) && BI.checkDateLegal(formatStr) && self._checkVoid({ |
|
|
|
|
year: date[0] | 0, |
|
|
|
|
month: date[1] | 0, |
|
|
|
|
day: date[2] | 0 |
|
|
|
@ -3366,30 +3374,13 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
|
|
|
|
|
allowBlank: true, |
|
|
|
|
watermark: BI.i18nText("BI-Basic_Unrestricted"), |
|
|
|
|
errorText: function () { |
|
|
|
|
if (self.editor.isEditing()) { |
|
|
|
|
return BI.i18nText("BI-Date_Trigger_Error_Text"); |
|
|
|
|
var str = ""; |
|
|
|
|
if (!BI.isKey(o.format)) { |
|
|
|
|
str = self.editor.isEditing() ? BI.i18nText("BI-Date_Trigger_Error_Text"): BI.i18nText("BI-Year_Trigger_Invalid_Text"); |
|
|
|
|
} |
|
|
|
|
return BI.i18nText("BI-Year_Trigger_Invalid_Text"); |
|
|
|
|
return str; |
|
|
|
|
}, |
|
|
|
|
title: function () { |
|
|
|
|
var storeValue = self.storeValue || {}; |
|
|
|
|
var type = storeValue.type || BI.DynamicDateCombo.Static; |
|
|
|
|
var value = storeValue.value; |
|
|
|
|
switch (type) { |
|
|
|
|
case BI.DynamicDateCombo.Dynamic: |
|
|
|
|
var text = self._getText(value); |
|
|
|
|
var date = BI.getDate(); |
|
|
|
|
date = BI.DynamicDateHelper.getCalculation(value); |
|
|
|
|
var dateStr = BI.print(date, "%Y-%X-%d"); |
|
|
|
|
return BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr); |
|
|
|
|
case BI.DynamicDateCombo.Static: |
|
|
|
|
default: |
|
|
|
|
if (BI.isNull(value) || BI.isNull(value.day)) { |
|
|
|
|
return ""; |
|
|
|
|
} |
|
|
|
|
return BI.print(BI.getDate(value.year, (value.month - 1), value.day), "%Y-%X-%d"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
title: BI.bind(this._getTitle, this) |
|
|
|
|
}); |
|
|
|
|
this.editor.on(BI.SignEditor.EVENT_KEY_DOWN, function () { |
|
|
|
|
self.fireEvent(BI.DynamicDateTrigger.EVENT_KEY_DOWN); |
|
|
|
@ -3414,7 +3405,8 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (BI.isNotEmptyString(value) && !BI.isEqual(self.storeTriggerValue, self.getKey())) { |
|
|
|
|
var date = value.split("-"); |
|
|
|
|
var formatStr = self._getStandardDateStr(value); |
|
|
|
|
var date = formatStr.match(/\d+/g); |
|
|
|
|
self.storeValue = { |
|
|
|
|
type: BI.DynamicDateCombo.Static, |
|
|
|
|
value: { |
|
|
|
@ -3447,8 +3439,81 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
|
|
|
|
|
width: 24 |
|
|
|
|
}] |
|
|
|
|
}); |
|
|
|
|
!o.allowEdit && BI.createWidget({ |
|
|
|
|
type: "bi.absolute", |
|
|
|
|
element: this, |
|
|
|
|
items: [{ |
|
|
|
|
el: { |
|
|
|
|
type: "bi.text", |
|
|
|
|
title: BI.bind(this._getTitle, this) |
|
|
|
|
}, |
|
|
|
|
left: 0, |
|
|
|
|
right: 24, |
|
|
|
|
top: 0, |
|
|
|
|
bottom: 0 |
|
|
|
|
}] |
|
|
|
|
}); |
|
|
|
|
this.setValue(o.value); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_getTitle: function () { |
|
|
|
|
var storeValue = this.storeValue || {}; |
|
|
|
|
var type = storeValue.type || BI.DynamicDateCombo.Static; |
|
|
|
|
var value = storeValue.value; |
|
|
|
|
switch (type) { |
|
|
|
|
case BI.DynamicDateCombo.Dynamic: |
|
|
|
|
var text = this._getText(value); |
|
|
|
|
var date = BI.getDate(); |
|
|
|
|
date = BI.DynamicDateHelper.getCalculation(value); |
|
|
|
|
var dateStr = BI.print(date, this._getFormatString()); |
|
|
|
|
return BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr); |
|
|
|
|
case BI.DynamicDateCombo.Static: |
|
|
|
|
default: |
|
|
|
|
if (BI.isNull(value) || BI.isNull(value.day)) { |
|
|
|
|
return ""; |
|
|
|
|
} |
|
|
|
|
return BI.print(BI.getDate(value.year, (value.month - 1), value.day), this._getFormatString()); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_getStandardDateStr: function (v) { |
|
|
|
|
var c = this._const; |
|
|
|
|
var result = [0, 1, 2]; |
|
|
|
|
var formatArray = this._getFormatString().match(/%./g); |
|
|
|
|
BI.each(formatArray, function (idx, v) { |
|
|
|
|
switch (v) { |
|
|
|
|
case "%Y": |
|
|
|
|
case "%y": |
|
|
|
|
result[0] = idx; |
|
|
|
|
break; |
|
|
|
|
case "%X": |
|
|
|
|
case "%x": |
|
|
|
|
result[1] = idx; |
|
|
|
|
break; |
|
|
|
|
case "%d": |
|
|
|
|
case "%e": |
|
|
|
|
default: |
|
|
|
|
result[2] = idx; |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
var dateArray = v.match(/\d+/g); |
|
|
|
|
var newArray = []; |
|
|
|
|
BI.each(dateArray, function (idx) { |
|
|
|
|
newArray[idx] = dateArray[result[idx]]; |
|
|
|
|
}); |
|
|
|
|
// 这边之所以不直接返回join结果是因为年的格式可能只有2位,所以需要format一下
|
|
|
|
|
if(newArray.length === result.length && newArray[0].length === 2) { |
|
|
|
|
return BI.print(BI.parseDateTime(newArray.join("-"), c.compareFormat), c.compareFormat); |
|
|
|
|
} |
|
|
|
|
// 这边format成-20-也没关系, 反正都是不合法的
|
|
|
|
|
return newArray.join("-"); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_getFormatString: function () { |
|
|
|
|
return this.options.format || this._const.compareFormat; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_dateCheck: function (date) { |
|
|
|
|
return BI.print(BI.parseDateTime(date, "%Y-%x-%d"), "%Y-%x-%d") === date || |
|
|
|
|
BI.print(BI.parseDateTime(date, "%Y-%X-%d"), "%Y-%X-%d") === date || |
|
|
|
@ -3478,19 +3543,19 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_yearCheck: function (v) { |
|
|
|
|
var date = BI.print(BI.parseDateTime(v, "%Y-%X-%d"), "%Y-%X-%d"); |
|
|
|
|
var date = BI.print(BI.parseDateTime(v, this._getFormatString()), this._const.compareFormat); |
|
|
|
|
return BI.print(BI.parseDateTime(v, "%Y"), "%Y") === v && date >= this.options.min && date <= this.options.max; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_monthCheck: function (v) { |
|
|
|
|
var date = BI.parseDateTime(v, "%Y-%X-%d"); |
|
|
|
|
var dateStr = BI.print(date, "%Y-%X-%d"); |
|
|
|
|
var date = BI.parseDateTime(v, this._getFormatString()); |
|
|
|
|
var dateStr = BI.print(date, this._const.compareFormat); |
|
|
|
|
return (date.getMonth() >= 0 && (BI.print(BI.parseDateTime(v, "%Y-%X"), "%Y-%X") === v || |
|
|
|
|
BI.print(BI.parseDateTime(v, "%Y-%x"), "%Y-%x") === v)) && dateStr >= this.options.min && dateStr <= this.options.max; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_setInnerValue: function (date) { |
|
|
|
|
var dateStr = BI.print(date, "%Y-%X-%d"); |
|
|
|
|
var dateStr = BI.print(date, this._getFormatString()); |
|
|
|
|
this.editor.setState(dateStr); |
|
|
|
|
this.editor.setValue(dateStr); |
|
|
|
|
}, |
|
|
|
@ -3566,7 +3631,7 @@ BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup);BI.DynamicDateTrigger
|
|
|
|
|
this.editor.setState(""); |
|
|
|
|
this.editor.setValue(""); |
|
|
|
|
} else { |
|
|
|
|
var dateStr = BI.print(BI.getDate(value.year, (value.month - 1), value.day), "%Y-%X-%d"); |
|
|
|
|
var dateStr = BI.print(BI.getDate(value.year, (value.month - 1), value.day), this._getFormatString()); |
|
|
|
|
this.editor.setState(dateStr); |
|
|
|
|
this.editor.setValue(dateStr); |
|
|
|
|
} |
|
|
|
@ -3605,7 +3670,9 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
|
|
|
|
|
baseCls: "bi-dynamic-date-combo bi-border bi-focus-shadow", |
|
|
|
|
height: 22, |
|
|
|
|
minDate: "1900-01-01", |
|
|
|
|
maxDate: "2099-12-31" |
|
|
|
|
maxDate: "2099-12-31", |
|
|
|
|
format: "", |
|
|
|
|
allowEdit: true |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -3643,6 +3710,8 @@ BI.DynamicDateTimeCombo = BI.inherit(BI.Single, {
|
|
|
|
|
type: "bi.dynamic_date_time_trigger", |
|
|
|
|
min: opts.minDate, |
|
|
|
|
max: opts.maxDate, |
|
|
|
|
allowEdit: opts.allowEdit, |
|
|
|
|
format: opts.format, |
|
|
|
|
height: opts.height, |
|
|
|
|
value: opts.value, |
|
|
|
|
ref: function () { |
|
|
|
@ -4337,14 +4406,17 @@ BI.extend(BI.DynamicDateTimeSelect, {
|
|
|
|
|
vgap: 2, |
|
|
|
|
yearLength: 4, |
|
|
|
|
yearMonthLength: 6, |
|
|
|
|
yearFullMonthLength: 7 |
|
|
|
|
yearFullMonthLength: 7, |
|
|
|
|
compareFormat: "%Y-%X-%d %H:%M:%S" |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
props: { |
|
|
|
|
extraCls: "bi-date-time-trigger", |
|
|
|
|
min: "1900-01-01", // 最小日期
|
|
|
|
|
max: "2099-12-31", // 最大日期
|
|
|
|
|
height: 24 |
|
|
|
|
height: 24, |
|
|
|
|
format: "", // 显示的日期格式化方式
|
|
|
|
|
allowEdit: true // 是否允许编辑
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_init: function () { |
|
|
|
@ -4355,9 +4427,10 @@ BI.extend(BI.DynamicDateTimeSelect, {
|
|
|
|
|
type: "bi.sign_editor", |
|
|
|
|
height: o.height, |
|
|
|
|
validationChecker: function (v) { |
|
|
|
|
var date = v.match(/\d+/g); |
|
|
|
|
self._autoAppend(v, date); |
|
|
|
|
return self._dateCheck(v) && BI.checkDateLegal(v) && self._checkVoid({ |
|
|
|
|
var formatStr = self._getStandardDateStr(v); |
|
|
|
|
var date = formatStr.match(/\d+/g); |
|
|
|
|
!BI.isKey(o.format) && self._autoAppend(v, date); |
|
|
|
|
return self._dateCheck(formatStr) && BI.checkDateLegal(formatStr) && self._checkVoid({ |
|
|
|
|
year: date[0] | 0, |
|
|
|
|
month: date[1] | 0, |
|
|
|
|
day: date[2] | 0 |
|
|
|
@ -4371,30 +4444,13 @@ BI.extend(BI.DynamicDateTimeSelect, {
|
|
|
|
|
allowBlank: true, |
|
|
|
|
watermark: BI.i18nText("BI-Basic_Unrestricted"), |
|
|
|
|
errorText: function () { |
|
|
|
|
if (self.editor.isEditing()) { |
|
|
|
|
return BI.i18nText("BI-Basic_Date_Time_Error_Text"); |
|
|
|
|
var str = ""; |
|
|
|
|
if (!BI.isKey(o.format)) { |
|
|
|
|
str = self.editor.isEditing() ? BI.i18nText("BI-Basic_Date_Time_Error_Text") : BI.i18nText("BI-Year_Trigger_Invalid_Text"); |
|
|
|
|
} |
|
|
|
|
return BI.i18nText("BI-Year_Trigger_Invalid_Text"); |
|
|
|
|
return str; |
|
|
|
|
}, |
|
|
|
|
title: function () { |
|
|
|
|
var storeValue = self.storeValue || {}; |
|
|
|
|
var type = storeValue.type || BI.DynamicDateCombo.Static; |
|
|
|
|
var value = storeValue.value; |
|
|
|
|
switch (type) { |
|
|
|
|
case BI.DynamicDateCombo.Dynamic: |
|
|
|
|
var text = self._getText(value); |
|
|
|
|
var date = BI.DynamicDateHelper.getCalculation(value); |
|
|
|
|
var dateStr = BI.print(date, "%Y-%x-%e %H:%M:%S"); |
|
|
|
|
return BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr); |
|
|
|
|
case BI.DynamicDateCombo.Static: |
|
|
|
|
default: |
|
|
|
|
if (BI.isNull(value) || BI.isNull(value.day)) { |
|
|
|
|
return ""; |
|
|
|
|
} |
|
|
|
|
return BI.print(BI.getDate(value.year, (value.month - 1), value.day, value.hour || 0, value.minute || 0, |
|
|
|
|
value.second || 0), "%Y-%X-%d %H:%M:%S"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
title: BI.bind(this._getTitle, this) |
|
|
|
|
}); |
|
|
|
|
this.editor.on(BI.SignEditor.EVENT_KEY_DOWN, function () { |
|
|
|
|
self.fireEvent(BI.DynamicDateTimeTrigger.EVENT_KEY_DOWN); |
|
|
|
@ -4419,7 +4475,8 @@ BI.extend(BI.DynamicDateTimeSelect, {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (BI.isNotEmptyString(value) && !BI.isEqual(self.storeTriggerValue, self.getKey())) { |
|
|
|
|
var date = value.split(/-|\s|:/); |
|
|
|
|
var formatStr = self._getStandardDateStr(value); |
|
|
|
|
var date = formatStr.match(/\d+/g); |
|
|
|
|
self.storeValue = { |
|
|
|
|
type: BI.DynamicDateCombo.Static, |
|
|
|
|
value: { |
|
|
|
@ -4450,8 +4507,94 @@ BI.extend(BI.DynamicDateTimeSelect, {
|
|
|
|
|
width: 24 |
|
|
|
|
}] |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
!o.allowEdit && BI.createWidget({ |
|
|
|
|
type: "bi.absolute", |
|
|
|
|
element: this, |
|
|
|
|
items: [{ |
|
|
|
|
el: { |
|
|
|
|
type: "bi.text", |
|
|
|
|
title: BI.bind(this._getTitle, this) |
|
|
|
|
}, |
|
|
|
|
left: 0, |
|
|
|
|
right: 24, |
|
|
|
|
top: 0, |
|
|
|
|
bottom: 0 |
|
|
|
|
}] |
|
|
|
|
}); |
|
|
|
|
this.setValue(o.value); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_getTitle: function () { |
|
|
|
|
var storeValue = this.storeValue || {}; |
|
|
|
|
var type = storeValue.type || BI.DynamicDateCombo.Static; |
|
|
|
|
var value = storeValue.value; |
|
|
|
|
switch (type) { |
|
|
|
|
case BI.DynamicDateCombo.Dynamic: |
|
|
|
|
var text = this._getText(value); |
|
|
|
|
var date = BI.DynamicDateHelper.getCalculation(value); |
|
|
|
|
var dateStr = BI.print(date, this._getFormatString()); |
|
|
|
|
return BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr); |
|
|
|
|
case BI.DynamicDateCombo.Static: |
|
|
|
|
default: |
|
|
|
|
if (BI.isNull(value) || BI.isNull(value.day)) { |
|
|
|
|
return ""; |
|
|
|
|
} |
|
|
|
|
return BI.print(BI.getDate(value.year, (value.month - 1), value.day, value.hour || 0, value.minute || 0, |
|
|
|
|
value.second || 0), this._getFormatString()); |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_getStandardDateStr: function (v) { |
|
|
|
|
var result = []; |
|
|
|
|
var hasSecond = false; |
|
|
|
|
var formatArray = this._getFormatString().match(/%./g); |
|
|
|
|
BI.each(formatArray, function (idx, v) { |
|
|
|
|
switch (v) { |
|
|
|
|
case "%Y": |
|
|
|
|
case "%y": |
|
|
|
|
result[0] = idx; |
|
|
|
|
break; |
|
|
|
|
case "%X": |
|
|
|
|
case "%x": |
|
|
|
|
result[1] = idx; |
|
|
|
|
break; |
|
|
|
|
case "%d": |
|
|
|
|
case "%e": |
|
|
|
|
result[2] = idx; |
|
|
|
|
break; |
|
|
|
|
case "%S": |
|
|
|
|
hasSecond = true; |
|
|
|
|
break; |
|
|
|
|
default: |
|
|
|
|
break; |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
var dateArray = v.match(/\d+/g); |
|
|
|
|
var newArray = []; |
|
|
|
|
// 处理乱序的年月日
|
|
|
|
|
BI.each(dateArray.slice(0, 3), function (idx) { |
|
|
|
|
newArray[idx] = dateArray[result[idx]]; |
|
|
|
|
}); |
|
|
|
|
// 拼接时分秒和pm
|
|
|
|
|
var suffixArray = dateArray.slice(3); |
|
|
|
|
// hh:mm
|
|
|
|
|
if(suffixArray.length === 2 && !hasSecond) { |
|
|
|
|
suffixArray.push("00"); |
|
|
|
|
} |
|
|
|
|
var suffixString = suffixArray.join(":"); |
|
|
|
|
var dateString = newArray.slice(0, 3).join("-"); |
|
|
|
|
if (BI.isNotEmptyString(suffixString)) { |
|
|
|
|
dateString += " " + suffixString; |
|
|
|
|
} |
|
|
|
|
return dateString; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_getFormatString: function () { |
|
|
|
|
return this.options.format || this._const.compareFormat; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_dateCheck: function (date) { |
|
|
|
|
return BI.print(BI.parseDateTime(date, "%Y-%x-%d %H:%M:%S"), "%Y-%x-%d %H:%M:%S") === date || |
|
|
|
|
BI.print(BI.parseDateTime(date, "%Y-%X-%d %H:%M:%S"), "%Y-%X-%d %H:%M:%S") === date || |
|
|
|
@ -4498,7 +4641,7 @@ BI.extend(BI.DynamicDateTimeSelect, {
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_setInnerValue: function (date) { |
|
|
|
|
var dateStr = BI.print(date, "%Y-%X-%e %H:%M:%S"); |
|
|
|
|
var dateStr = BI.print(date, this._getFormatString()); |
|
|
|
|
this.editor.setState(dateStr); |
|
|
|
|
this.editor.setValue(dateStr); |
|
|
|
|
}, |
|
|
|
@ -4575,7 +4718,7 @@ BI.extend(BI.DynamicDateTimeSelect, {
|
|
|
|
|
this.editor.setValue(""); |
|
|
|
|
} else { |
|
|
|
|
var dateStr = BI.print(BI.getDate(value.year, (value.month - 1), value.day, value.hour || 0, value.minute || 0, |
|
|
|
|
value.second || 0), "%Y-%X-%d %H:%M:%S"); |
|
|
|
|
value.second || 0), this._getFormatString()); |
|
|
|
|
this.editor.setState(dateStr); |
|
|
|
|
this.editor.setValue(dateStr); |
|
|
|
|
} |
|
|
|
@ -4716,6 +4859,9 @@ BI.SearchEditor = BI.inherit(BI.Widget, {
|
|
|
|
|
this.editor.on(BI.Editor.EVENT_CONFIRM, function () { |
|
|
|
|
self.fireEvent(BI.SearchEditor.EVENT_CONFIRM); |
|
|
|
|
}); |
|
|
|
|
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () { |
|
|
|
|
self.fireEvent(BI.SearchEditor.EVENT_CHANGE_CONFIRM); |
|
|
|
|
}); |
|
|
|
|
this.editor.on(BI.Editor.EVENT_START, function () { |
|
|
|
|
self.fireEvent(BI.SearchEditor.EVENT_START); |
|
|
|
|
}); |
|
|
|
@ -4793,6 +4939,7 @@ BI.SearchEditor.EVENT_START = "EVENT_START";
|
|
|
|
|
BI.SearchEditor.EVENT_PAUSE = "EVENT_PAUSE"; |
|
|
|
|
BI.SearchEditor.EVENT_STOP = "EVENT_STOP"; |
|
|
|
|
BI.SearchEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; |
|
|
|
|
BI.SearchEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM"; |
|
|
|
|
BI.SearchEditor.EVENT_VALID = "EVENT_VALID"; |
|
|
|
|
BI.SearchEditor.EVENT_ERROR = "EVENT_ERROR"; |
|
|
|
|
BI.SearchEditor.EVENT_ENTER = "EVENT_ENTER"; |
|
|
|
@ -4903,6 +5050,9 @@ BI.TextEditor = BI.inherit(BI.Widget, {
|
|
|
|
|
this.editor.on(BI.Editor.EVENT_CONFIRM, function () { |
|
|
|
|
self.fireEvent(BI.TextEditor.EVENT_CONFIRM); |
|
|
|
|
}); |
|
|
|
|
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () { |
|
|
|
|
self.fireEvent(BI.TextEditor.EVENT_CHANGE_CONFIRM); |
|
|
|
|
}); |
|
|
|
|
this.editor.on(BI.Editor.EVENT_REMOVE, function (v) { |
|
|
|
|
self.fireEvent(BI.TextEditor.EVENT_REMOVE); |
|
|
|
|
}); |
|
|
|
@ -4975,6 +5125,7 @@ BI.TextEditor.EVENT_START = "EVENT_START";
|
|
|
|
|
BI.TextEditor.EVENT_PAUSE = "EVENT_PAUSE"; |
|
|
|
|
BI.TextEditor.EVENT_STOP = "EVENT_STOP"; |
|
|
|
|
BI.TextEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; |
|
|
|
|
BI.TextEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM"; |
|
|
|
|
BI.TextEditor.EVENT_VALID = "EVENT_VALID"; |
|
|
|
|
BI.TextEditor.EVENT_ERROR = "EVENT_ERROR"; |
|
|
|
|
BI.TextEditor.EVENT_ENTER = "EVENT_ENTER"; |
|
|
|
@ -8712,7 +8863,8 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
|
|
|
|
|
height: 24, |
|
|
|
|
attributes: { |
|
|
|
|
tabIndex: 0 |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
allowEdit: true |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
@ -8731,6 +8883,7 @@ BI.MultiSelectInsertCombo = BI.inherit(BI.Single, {
|
|
|
|
|
|
|
|
|
|
this.trigger = BI.createWidget({ |
|
|
|
|
type: "bi.multi_select_insert_trigger", |
|
|
|
|
allowEdit: o.allowEdit, |
|
|
|
|
height: o.height, |
|
|
|
|
text: o.text, |
|
|
|
|
// adapter: this.popup,
|
|
|
|
@ -9494,7 +9647,8 @@ BI.MultiSelectInsertTrigger = BI.inherit(BI.Trigger, {
|
|
|
|
|
switcher: {}, |
|
|
|
|
|
|
|
|
|
adapter: null, |
|
|
|
|
masker: {} |
|
|
|
|
masker: {}, |
|
|
|
|
allowEdit: true |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
@ -9574,6 +9728,20 @@ BI.MultiSelectInsertTrigger = BI.inherit(BI.Trigger, {
|
|
|
|
|
}] |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
!o.allowEdit && BI.createWidget({ |
|
|
|
|
type: "bi.absolute", |
|
|
|
|
element: this, |
|
|
|
|
items: [{ |
|
|
|
|
el: { |
|
|
|
|
type: "bi.layout" |
|
|
|
|
}, |
|
|
|
|
left: 0, |
|
|
|
|
right: 24, |
|
|
|
|
top: 0, |
|
|
|
|
bottom: 0 |
|
|
|
|
}] |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.numberCounter.on(BI.Events.VIEW, function (b) { |
|
|
|
|
BI.nextTick(function () {// 自动调整宽度
|
|
|
|
|
wrapper.attr("items")[1].width = (b === true ? self.numberCounter.element.outerWidth() + 8 : 0); |
|
|
|
@ -10197,7 +10365,8 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, {
|
|
|
|
|
switcher: {}, |
|
|
|
|
|
|
|
|
|
adapter: null, |
|
|
|
|
masker: {} |
|
|
|
|
masker: {}, |
|
|
|
|
allowEdit: true |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
@ -10274,6 +10443,20 @@ BI.MultiSelectTrigger = BI.inherit(BI.Trigger, {
|
|
|
|
|
}] |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
!o.allowEdit && BI.createWidget({ |
|
|
|
|
type: "bi.absolute", |
|
|
|
|
element: this, |
|
|
|
|
items: [{ |
|
|
|
|
el: { |
|
|
|
|
type: "bi.layout" |
|
|
|
|
}, |
|
|
|
|
left: 0, |
|
|
|
|
right: 24, |
|
|
|
|
top: 0, |
|
|
|
|
bottom: 0 |
|
|
|
|
}] |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
this.numberCounter.on(BI.Events.VIEW, function (b) { |
|
|
|
|
BI.nextTick(function () {// 自动调整宽度
|
|
|
|
|
wrapper.attr("items")[1].width = (b === true ? self.numberCounter.element.outerWidth() + 8 : 0); |
|
|
|
@ -12976,7 +13159,8 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
|
|
|
|
|
baseCls: "bi-multi-tree-insert-combo", |
|
|
|
|
itemsCreator: BI.emptyFn, |
|
|
|
|
valueFormatter: BI.emptyFn, |
|
|
|
|
height: 24 |
|
|
|
|
height: 24, |
|
|
|
|
allowEdit: true |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
@ -12992,6 +13176,7 @@ BI.MultiTreeInsertCombo = BI.inherit(BI.Single, {
|
|
|
|
|
|
|
|
|
|
this.trigger = BI.createWidget({ |
|
|
|
|
type: "bi.multi_select_trigger", |
|
|
|
|
allowEdit: o.allowEdit, |
|
|
|
|
height: o.height, |
|
|
|
|
valueFormatter: o.valueFormatter, |
|
|
|
|
// adapter: this.popup,
|
|
|
|
@ -13261,7 +13446,8 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
|
|
|
|
|
baseCls: "bi-multi-tree-list-combo", |
|
|
|
|
itemsCreator: BI.emptyFn, |
|
|
|
|
valueFormatter: BI.emptyFn, |
|
|
|
|
height: 24 |
|
|
|
|
height: 24, |
|
|
|
|
allowEdit: true |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
@ -13277,6 +13463,7 @@ BI.MultiTreeListCombo = BI.inherit(BI.Single, {
|
|
|
|
|
|
|
|
|
|
this.trigger = BI.createWidget({ |
|
|
|
|
type: "bi.multi_select_trigger", |
|
|
|
|
allowEdit: o.allowEdit, |
|
|
|
|
height: o.height, |
|
|
|
|
valueFormatter: o.valueFormatter, |
|
|
|
|
// adapter: this.popup,
|
|
|
|
@ -14650,7 +14837,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
|
|
|
|
|
|
|
|
|
|
_setFocusEvent: function (w) { |
|
|
|
|
var self = this, c = this.constants; |
|
|
|
|
w.on(BI.Editor.EVENT_FOCUS, function () { |
|
|
|
|
w.on(BI.NumberIntervalSingleEidtor.EVENT_FOCUS, function () { |
|
|
|
|
self._setTitle(""); |
|
|
|
|
switch (self._checkValidation()) { |
|
|
|
|
case c.typeError: |
|
|
|
@ -14679,7 +14866,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
|
|
|
|
|
}, |
|
|
|
|
_setBlurEvent: function (w) { |
|
|
|
|
var c = this.constants, self = this; |
|
|
|
|
w.on(BI.Editor.EVENT_BLUR, function () { |
|
|
|
|
w.on(BI.NumberIntervalSingleEidtor.EVENT_BLUR, function () { |
|
|
|
|
BI.Bubbles.hide(c.typeError); |
|
|
|
|
BI.Bubbles.hide(c.numberError); |
|
|
|
|
BI.Bubbles.hide(c.signalError); |
|
|
|
@ -14701,7 +14888,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
|
|
|
|
|
|
|
|
|
|
_setErrorEvent: function (w) { |
|
|
|
|
var c = this.constants, self = this; |
|
|
|
|
w.on(BI.Editor.EVENT_ERROR, function () { |
|
|
|
|
w.on(BI.NumberIntervalSingleEidtor.EVENT_ERROR, function () { |
|
|
|
|
self._checkValidation(); |
|
|
|
|
BI.Bubbles.show(c.typeError, BI.i18nText("BI-Numerical_Interval_Input_Data"), self, { |
|
|
|
|
offsetStyle: "left", |
|
|
|
@ -14714,7 +14901,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
|
|
|
|
|
|
|
|
|
|
_setValidEvent: function (w) { |
|
|
|
|
var self = this, c = this.constants; |
|
|
|
|
w.on(BI.Editor.EVENT_VALID, function () { |
|
|
|
|
w.on(BI.NumberIntervalSingleEidtor.EVENT_VALID, function () { |
|
|
|
|
switch (self._checkValidation()) { |
|
|
|
|
case c.numberError: |
|
|
|
|
BI.Bubbles.show(c.numberError, BI.i18nText("BI-Numerical_Interval_Number_Value"), self, { |
|
|
|
@ -14739,7 +14926,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
|
|
|
|
|
|
|
|
|
|
_setEditorValueChangedEvent: function (w) { |
|
|
|
|
var self = this, c = this.constants; |
|
|
|
|
w.on(BI.Editor.EVENT_CHANGE, function () { |
|
|
|
|
w.on(BI.NumberIntervalSingleEidtor.EVENT_CHANGE, function () { |
|
|
|
|
switch (self._checkValidation()) { |
|
|
|
|
case c.typeError: |
|
|
|
|
BI.Bubbles.show(c.typeError, BI.i18nText("BI-Numerical_Interval_Input_Data"), self, { |
|
|
|
@ -14764,7 +14951,7 @@ BI.NumberInterval = BI.inherit(BI.Single, {
|
|
|
|
|
} |
|
|
|
|
self.fireEvent(BI.NumberInterval.EVENT_CHANGE); |
|
|
|
|
}); |
|
|
|
|
w.on(BI.Editor.EVENT_CONFIRM, function () { |
|
|
|
|
w.on(BI.NumberIntervalSingleEidtor.EVENT_CONFIRM, function () { |
|
|
|
|
self.fireEvent(BI.NumberInterval.EVENT_CONFIRM); |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
@ -14929,32 +15116,37 @@ BI.shortcut("bi.number_interval", BI.NumberInterval);BI.NumberIntervalSingleEidt
|
|
|
|
|
listeners: [{ |
|
|
|
|
eventName: BI.Editor.EVENT_ERROR, |
|
|
|
|
action: function () { |
|
|
|
|
self.fireEvent(BI.Editor.EVENT_ERROR, arguments); |
|
|
|
|
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_ERROR, arguments); |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
eventName: BI.Editor.EVENT_FOCUS, |
|
|
|
|
action: function () { |
|
|
|
|
self.fireEvent(BI.Editor.EVENT_FOCUS, arguments); |
|
|
|
|
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_FOCUS, arguments); |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
eventName: BI.Editor.EVENT_BLUR, |
|
|
|
|
action: function () { |
|
|
|
|
self.fireEvent(BI.Editor.EVENT_BLUR, arguments); |
|
|
|
|
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_BLUR, arguments); |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
eventName: BI.Editor.EVENT_VALID, |
|
|
|
|
action: function () { |
|
|
|
|
self.fireEvent(BI.Editor.EVENT_VALID, arguments); |
|
|
|
|
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_VALID, arguments); |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
eventName: BI.Editor.EVENT_CHANGE, |
|
|
|
|
action: function () { |
|
|
|
|
self.fireEvent(BI.Editor.EVENT_CHANGE, arguments); |
|
|
|
|
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_CHANGE, arguments); |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
eventName: BI.Editor.EVENT_CONFIRM, |
|
|
|
|
action: function () { |
|
|
|
|
self.fireEvent(BI.Editor.EVENT_CONFIRM, arguments); |
|
|
|
|
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_CONFIRM, arguments); |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
eventName: BI.Editor.EVENT_CHANGE_CONFIRM, |
|
|
|
|
action: function () { |
|
|
|
|
self.fireEvent(BI.NumberIntervalSingleEidtor.EVENT_CHANGE_CONFIRM, arguments); |
|
|
|
|
} |
|
|
|
|
}] |
|
|
|
|
}] |
|
|
|
@ -14978,6 +15170,13 @@ BI.shortcut("bi.number_interval", BI.NumberInterval);BI.NumberIntervalSingleEidt
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
BI.NumberIntervalSingleEidtor.EVENT_FOCUS = "EVENT_FOCUS"; |
|
|
|
|
BI.NumberIntervalSingleEidtor.EVENT_BLUR = "EVENT_BLUR"; |
|
|
|
|
BI.NumberIntervalSingleEidtor.EVENT_ERROR = "EVENT_ERROR"; |
|
|
|
|
BI.NumberIntervalSingleEidtor.EVENT_VALID = "EVENT_VALID"; |
|
|
|
|
BI.NumberIntervalSingleEidtor.EVENT_CHANGE = "EVENT_CHANGE"; |
|
|
|
|
BI.NumberIntervalSingleEidtor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM"; |
|
|
|
|
BI.NumberIntervalSingleEidtor.EVENT_CONFIRM = "EVENT_CONFIRM"; |
|
|
|
|
BI.shortcut("bi.number_interval_single_editor", BI.NumberIntervalSingleEidtor);/** |
|
|
|
|
* 季度下拉框 |
|
|
|
|
* |
|
|
|
@ -18925,6 +19124,11 @@ BI.SignTextEditor = BI.inherit(BI.Widget, {
|
|
|
|
|
self._checkText(); |
|
|
|
|
self.fireEvent(BI.SignTextEditor.EVENT_CONFIRM, arguments); |
|
|
|
|
}); |
|
|
|
|
this.editor.on(BI.Editor.EVENT_CHANGE_CONFIRM, function () { |
|
|
|
|
self._showHint(); |
|
|
|
|
self._checkText(); |
|
|
|
|
self.fireEvent(BI.SignTextEditor.EVENT_CHANGE_CONFIRM, arguments); |
|
|
|
|
}); |
|
|
|
|
this.editor.on(BI.Editor.EVENT_ERROR, function () { |
|
|
|
|
self._checkText(); |
|
|
|
|
}); |
|
|
|
@ -19045,6 +19249,7 @@ BI.SignTextEditor = BI.inherit(BI.Widget, {
|
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
BI.SignTextEditor.EVENT_CONFIRM = "EVENT_CONFIRM"; |
|
|
|
|
BI.SignTextEditor.EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM"; |
|
|
|
|
BI.SignTextEditor.EVENT_CLICK_LABEL = "EVENT_CLICK_LABEL"; |
|
|
|
|
|
|
|
|
|
BI.shortcut("bi.sign_text_editor", BI.SignTextEditor);/** |
|
|
|
@ -20326,12 +20531,14 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
|
|
|
|
|
props: { |
|
|
|
|
baseCls: "bi-time-combo bi-border bi-border-radius", |
|
|
|
|
width: 78, |
|
|
|
|
height: 22 |
|
|
|
|
height: 22, |
|
|
|
|
format: "", |
|
|
|
|
allowEdit: false |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
render: function () { |
|
|
|
|
var self = this, opts = this.options; |
|
|
|
|
|
|
|
|
|
this.storeTriggerValue = ""; |
|
|
|
|
this.storeValue = opts.value; |
|
|
|
|
|
|
|
|
|
var popup = { |
|
|
|
@ -20374,10 +20581,74 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
|
|
|
|
|
isNeedAdjustWidth: false, |
|
|
|
|
el: { |
|
|
|
|
type: "bi.time_trigger", |
|
|
|
|
allowEdit: opts.allowEdit, |
|
|
|
|
format: opts.format, |
|
|
|
|
value: opts.value, |
|
|
|
|
ref: function (_ref) { |
|
|
|
|
self.trigger = _ref; |
|
|
|
|
}, |
|
|
|
|
listeners: [{ |
|
|
|
|
eventName: "EVENT_KEY_DOWN", |
|
|
|
|
action: function () { |
|
|
|
|
if (self.combo.isViewVisible()) { |
|
|
|
|
self.combo.hideView(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
eventName: "EVENT_STOP", |
|
|
|
|
action: function () { |
|
|
|
|
if (!self.combo.isViewVisible()) { |
|
|
|
|
self.combo.showView(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
eventName: "EVENT_FOCUS", |
|
|
|
|
action: function () { |
|
|
|
|
self.storeTriggerValue = self.trigger.getKey(); |
|
|
|
|
if (!self.combo.isViewVisible()) { |
|
|
|
|
self.combo.showView(); |
|
|
|
|
} |
|
|
|
|
self.fireEvent("EVENT_FOCUS"); |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
eventName: "EVENT_ERROR", |
|
|
|
|
action: function () { |
|
|
|
|
var date = BI.getDate(); |
|
|
|
|
self.storeValue = { |
|
|
|
|
hour: date.getHours(), |
|
|
|
|
minute: date.getMinutes(), |
|
|
|
|
second: date.getSeconds() |
|
|
|
|
}; |
|
|
|
|
self.fireEvent("EVENT_ERROR"); |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
eventName: "EVENT_VALID", |
|
|
|
|
action: function () { |
|
|
|
|
self.fireEvent("EVENT_VALID"); |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
eventName: "EVENT_CHANGE", |
|
|
|
|
action: function () { |
|
|
|
|
self.fireEvent("EVENT_CHANGE"); |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
eventName: "EVENT_CONFIRM", |
|
|
|
|
action: function () { |
|
|
|
|
if (self.combo.isViewVisible()) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
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()); |
|
|
|
|
} else if (BI.isEmptyString(dateObj)) { |
|
|
|
|
self.storeValue = null; |
|
|
|
|
self.trigger.setValue(); |
|
|
|
|
} |
|
|
|
|
self.fireEvent("EVENT_CONFIRM"); |
|
|
|
|
} |
|
|
|
|
}] |
|
|
|
|
}, |
|
|
|
|
adjustLength: this.constants.comboAdjustHeight, |
|
|
|
|
popup: { |
|
|
|
@ -20401,7 +20672,7 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
|
|
|
|
|
}, |
|
|
|
|
top: 0, |
|
|
|
|
left: 0, |
|
|
|
|
right: 0, |
|
|
|
|
right: 22, |
|
|
|
|
bottom: 0 |
|
|
|
|
}, { |
|
|
|
|
el: { |
|
|
|
@ -20461,42 +20732,165 @@ BI.shortcut("bi.single_tree_trigger", BI.SingleTreeTrigger);!(function () {
|
|
|
|
|
BI.shortcut("bi.time_combo", BI.TimeCombo); |
|
|
|
|
})();!(function () { |
|
|
|
|
BI.TimeTrigger = BI.inherit(BI.Trigger, { |
|
|
|
|
|
|
|
|
|
_const: { |
|
|
|
|
COMPARE_FORMAT: "%H:%M:%S", |
|
|
|
|
COMPLETE_COMPARE_FORMAT: "%Y-%M-%d %H:%M:%S", |
|
|
|
|
FORMAT_ARRAY: [ |
|
|
|
|
"%H:%M:%S", // HH:mm:ss
|
|
|
|
|
"%I:%M:%S", // hh:mm:ss
|
|
|
|
|
"%l:%M:%S", // h:mm:ss
|
|
|
|
|
"%k:%M:%S", // H:mm:ss
|
|
|
|
|
"%l:%M:%S %p", // h:mm:ss a
|
|
|
|
|
"%l:%M:%S %P", // h:mm:ss a
|
|
|
|
|
"%l:%M", // h:mm
|
|
|
|
|
"%k:%M", // H:mm
|
|
|
|
|
"%I:%M", // hh:mm
|
|
|
|
|
"%H:%M", // HH:mm
|
|
|
|
|
"%M:%S" // mm:ss
|
|
|
|
|
], |
|
|
|
|
DEFAULT_DATE_STRING: "2000-01-01" |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
props: { |
|
|
|
|
extraCls: "bi-time-trigger", |
|
|
|
|
height: 22, |
|
|
|
|
width: 80, |
|
|
|
|
value: {} |
|
|
|
|
value: {}, |
|
|
|
|
format: "", |
|
|
|
|
allowEdit: false |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
render: function () { |
|
|
|
|
var self = this, o = this.options; |
|
|
|
|
this.storeTriggerValue = ""; |
|
|
|
|
this.storeValue = o.value; |
|
|
|
|
return { |
|
|
|
|
type: "bi.htape", |
|
|
|
|
type: "bi.absolute", |
|
|
|
|
items: [{ |
|
|
|
|
el: { |
|
|
|
|
type: "bi.label", |
|
|
|
|
title: function () { |
|
|
|
|
return self.text.getText(); |
|
|
|
|
}, |
|
|
|
|
textAlign: "left", |
|
|
|
|
type: "bi.sign_editor", |
|
|
|
|
height: o.height, |
|
|
|
|
width: o.width, |
|
|
|
|
text: this._formatValue(o.value), |
|
|
|
|
validationChecker: function (v) { |
|
|
|
|
return self._dateCheck(v); |
|
|
|
|
}, |
|
|
|
|
quitChecker: function () { |
|
|
|
|
return false; |
|
|
|
|
}, |
|
|
|
|
ref: function (_ref) { |
|
|
|
|
self.text = _ref; |
|
|
|
|
self.editor = _ref; |
|
|
|
|
}, |
|
|
|
|
value: this._formatValue(o.value), |
|
|
|
|
hgap: 4, |
|
|
|
|
allowBlank: true, |
|
|
|
|
watermark: BI.i18nText("BI-Basic_Unrestricted"), |
|
|
|
|
title: BI.bind(this._getTitle, this), |
|
|
|
|
listeners: [{ |
|
|
|
|
eventName: "EVENT_KEY_DOWN", |
|
|
|
|
action: function () { |
|
|
|
|
self.fireEvent("EVENT_KEY_DOWN"); |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
eventName: "EVENT_FOCUS", |
|
|
|
|
action: function () { |
|
|
|
|
self.storeTriggerValue = self.getKey(); |
|
|
|
|
self.fireEvent("EVENT_FOCUS"); |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
eventName: "EVENT_STOP", |
|
|
|
|
action: function () { |
|
|
|
|
self.fireEvent("EVENT_STOP"); |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
eventName: "EVENT_VALID", |
|
|
|
|
action: function () { |
|
|
|
|
self.fireEvent("EVENT_VALID"); |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
eventName: "EVENT_ERROR", |
|
|
|
|
action: function () { |
|
|
|
|
self.fireEvent("EVENT_ERROR"); |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
eventName: "EVENT_CONFIRM", |
|
|
|
|
action: function () { |
|
|
|
|
var value = self.editor.getValue(); |
|
|
|
|
if (BI.isNotNull(value)) { |
|
|
|
|
self.editor.setState(value); |
|
|
|
|
} |
|
|
|
|
if (BI.isNotEmptyString(value) && !BI.isEqual(self.storeTriggerValue, self.getKey())) { |
|
|
|
|
var date = value.match(/\d+/g); |
|
|
|
|
self.storeValue = { |
|
|
|
|
hour: date[0] | 0, |
|
|
|
|
minute: date[1] | 0, |
|
|
|
|
second: date[2] | 0 |
|
|
|
|
}; |
|
|
|
|
} |
|
|
|
|
self.fireEvent("EVENT_CONFIRM"); |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
eventName: "EVENT_START", |
|
|
|
|
action: function () { |
|
|
|
|
self.fireEvent("EVENT_START"); |
|
|
|
|
} |
|
|
|
|
}, { |
|
|
|
|
eventName: "EVENT_CHANGE", |
|
|
|
|
action: function () { |
|
|
|
|
self.fireEvent("EVENT_CHANGE"); |
|
|
|
|
} |
|
|
|
|
}] |
|
|
|
|
}, |
|
|
|
|
left: 0, |
|
|
|
|
right: 0, |
|
|
|
|
top: 0, |
|
|
|
|
bottom: 0 |
|
|
|
|
}, { |
|
|
|
|
el: { |
|
|
|
|
type: "bi.text", |
|
|
|
|
invisible: o.allowEdit, |
|
|
|
|
cls: "show-text", |
|
|
|
|
title: BI.bind(this._getTitle, this), |
|
|
|
|
hgap: 4 |
|
|
|
|
}, |
|
|
|
|
left: 0, |
|
|
|
|
right: 0, |
|
|
|
|
top: 0, |
|
|
|
|
bottom: 0 |
|
|
|
|
}] |
|
|
|
|
}; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
setValue: function (v) { |
|
|
|
|
this.text.setText(this._formatValue(v)); |
|
|
|
|
_dateCheck: function (date) { |
|
|
|
|
var c = this._const; |
|
|
|
|
return BI.any(c.FORMAT_ARRAY, function (idx, format) { |
|
|
|
|
return BI.print(BI.parseDateTime(c.DEFAULT_DATE_STRING + " " + date, c.COMPLETE_COMPARE_FORMAT), format) === date; |
|
|
|
|
}); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_getTitle: function () { |
|
|
|
|
var storeValue = this.storeValue || {}; |
|
|
|
|
var date = BI.getDate(); |
|
|
|
|
return BI.print(BI.getDate(date.getFullYear(), 0, 1, storeValue.hour, storeValue.minute, storeValue.second), this._getFormatString()); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_getFormatString: function () { |
|
|
|
|
return this.options.format || this._const.COMPARE_FORMAT; |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
_formatValue: function (v) { |
|
|
|
|
var now = BI.getDate(); |
|
|
|
|
return BI.isNotEmptyObject(v) ? BI.print(BI.getDate(now.getFullYear(), now.getMonth(), now.getDay(), v.hour, v.minute, v.second), "%H:%M:%S") : BI.i18nText("BI-Basic_Unrestricted"); |
|
|
|
|
return BI.isNotEmptyObject(v) ? BI.print(BI.getDate(now.getFullYear(), now.getMonth(), now.getDay(), v.hour, v.minute, v.second), this._getFormatString()) : BI.i18nText("BI-Basic_Unrestricted"); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
getKey: function () { |
|
|
|
|
return this.editor.getValue(); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
setValue: function (v) { |
|
|
|
|
this.storeValue = v; |
|
|
|
|
this.editor.setValue(this._formatValue(v)); |
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
getValue: function () { |
|
|
|
|
return this.storeValue; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|