forked from fanruan/fineui
Treecat
2 years ago
30 changed files with 3181 additions and 2991 deletions
@ -1,185 +1,207 @@ |
|||||||
/** |
import { shortcut, Widget, extend, createWidget, bind, isNull, each, isNotEmptyString, getDate, getMonthDays } from "@/core"; |
||||||
* Created by zcf on 2017/2/20. |
import { DatePicker, DateCalendarPopup } from "../date/calendar"; |
||||||
*/ |
import { Calendar } from "@/case"; |
||||||
BI.StaticDatePaneCard = BI.inherit(BI.Widget, { |
import { Navigation } from "@/base"; |
||||||
_defaultConfig: function () { |
|
||||||
var conf = BI.StaticDatePaneCard.superclass._defaultConfig.apply(this, arguments); |
@shortcut() |
||||||
return BI.extend(conf, { |
export class StaticDatePaneCard extends Widget { |
||||||
|
static xtype = "bi.static_date_pane_card"; |
||||||
|
|
||||||
|
static EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = |
||||||
|
"EVENT_BEFORE_YEAR_MONTH_POPUPVIEW"; |
||||||
|
|
||||||
|
_defaultConfig() { |
||||||
|
const conf = super._defaultConfig(...arguments); |
||||||
|
|
||||||
|
return extend(conf, { |
||||||
baseCls: "bi-date-pane", |
baseCls: "bi-date-pane", |
||||||
min: "1900-01-01", // 最小日期
|
min: "1900-01-01", // 最小日期
|
||||||
max: "2099-12-31", // 最大日期
|
max: "2099-12-31", // 最大日期
|
||||||
selectedTime: null |
selectedTime: null, |
||||||
}); |
}); |
||||||
}, |
} |
||||||
_init: function () { |
|
||||||
BI.StaticDatePaneCard.superclass._init.apply(this, arguments); |
_init() { |
||||||
var self = this, o = this.options; |
super._init(...arguments); |
||||||
|
const o = this.options; |
||||||
|
|
||||||
this.today = BI.getDate(); |
this.today = getDate(); |
||||||
this._year = this.today.getFullYear(); |
this._year = this.today.getFullYear(); |
||||||
this._month = this.today.getMonth() + 1; |
this._month = this.today.getMonth() + 1; |
||||||
|
|
||||||
this.selectedTime = o.selectedTime || { |
this.selectedTime = o.selectedTime || { |
||||||
year: this._year, |
year: this._year, |
||||||
month: this._month |
month: this._month, |
||||||
}; |
}; |
||||||
|
|
||||||
this.datePicker = BI.createWidget({ |
this.datePicker = createWidget({ |
||||||
type: "bi.date_picker", |
type: "bi.date_picker", |
||||||
behaviors: o.behaviors, |
behaviors: o.behaviors, |
||||||
min: o.min, |
min: o.min, |
||||||
max: o.max |
max: o.max, |
||||||
}); |
}); |
||||||
this.datePicker.on(BI.DatePicker.EVENT_CHANGE, function () { |
this.datePicker.on(DatePicker.EVENT_CHANGE, () => { |
||||||
var value = self.datePicker.getValue(); |
const value = this.datePicker.getValue(); |
||||||
var monthDay = BI.getMonthDays(BI.getDate(value.year, value.month - 1, 1)); |
const monthDay = getMonthDays( |
||||||
var day = self.selectedTime.day || 0; |
getDate(value.year, value.month - 1, 1) |
||||||
|
); |
||||||
|
let day = this.selectedTime.day || 0; |
||||||
if (day > monthDay) { |
if (day > monthDay) { |
||||||
day = monthDay; |
day = monthDay; |
||||||
} |
} |
||||||
self.selectedTime = { |
this.selectedTime = { |
||||||
year: value.year, |
year: value.year, |
||||||
month: value.month |
month: value.month, |
||||||
}; |
}; |
||||||
day !== 0 && (self.selectedTime.day = day); |
day !== 0 && (this.selectedTime.day = day); |
||||||
self.calendar.setSelect(BI.Calendar.getPageByDateJSON(self.selectedTime)); |
this.calendar.setSelect( |
||||||
self.calendar.setValue(self.selectedTime); |
Calendar.getPageByDateJSON(this.selectedTime) |
||||||
day !== 0 && self.fireEvent(BI.DateCalendarPopup.EVENT_CHANGE); |
); |
||||||
}); |
this.calendar.setValue(this.selectedTime); |
||||||
this.datePicker.on(BI.DatePicker.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW, function () { |
day !== 0 && this.fireEvent(DateCalendarPopup.EVENT_CHANGE); |
||||||
self.fireEvent(BI.StaticDatePaneCard.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); |
|
||||||
}); |
}); |
||||||
|
this.datePicker.on( |
||||||
|
DatePicker.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW, |
||||||
|
() => { |
||||||
|
this.fireEvent( |
||||||
|
StaticDatePaneCard.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW |
||||||
|
); |
||||||
|
} |
||||||
|
); |
||||||
|
|
||||||
this.calendar = BI.createWidget({ |
this.calendar = createWidget({ |
||||||
direction: "custom", |
direction: "custom", |
||||||
// logic: {
|
// logic: {
|
||||||
// dynamic: false
|
// dynamic: false
|
||||||
// },
|
// },
|
||||||
type: "bi.navigation", |
type: "bi.navigation", |
||||||
tab: this.datePicker, |
tab: this.datePicker, |
||||||
cardCreator: BI.bind(this._createNav, this) |
cardCreator: bind(this._createNav, this), |
||||||
}); |
}); |
||||||
this.calendar.on(BI.Navigation.EVENT_CHANGE, function () { |
this.calendar.on(Navigation.EVENT_CHANGE, () => { |
||||||
self.selectedTime = self.calendar.getValue(); |
this.selectedTime = this.calendar.getValue(); |
||||||
self.calendar.empty(); |
this.calendar.empty(); |
||||||
self.setValue(self.selectedTime); |
this.setValue(this.selectedTime); |
||||||
self.fireEvent(BI.DateCalendarPopup.EVENT_CHANGE); |
this.fireEvent(DateCalendarPopup.EVENT_CHANGE); |
||||||
}); |
}); |
||||||
this.setValue(o.selectedTime); |
this.setValue(o.selectedTime); |
||||||
|
|
||||||
BI.createWidget({ |
createWidget({ |
||||||
type: "bi.vtape", |
type: "bi.vtape", |
||||||
element: this, |
element: this, |
||||||
items: [{ |
items: [ |
||||||
el: this.datePicker, |
{ |
||||||
height: 40 |
el: this.datePicker, |
||||||
}, this.calendar], |
height: 40, |
||||||
hgap: 10 |
}, |
||||||
|
this.calendar |
||||||
|
], |
||||||
|
hgap: 10, |
||||||
}); |
}); |
||||||
|
|
||||||
BI.createWidget({ |
createWidget({ |
||||||
type: "bi.absolute", |
type: "bi.absolute", |
||||||
element: this, |
element: this, |
||||||
items: [{ |
items: [ |
||||||
el: { |
{ |
||||||
type: "bi.layout", |
el: { |
||||||
cls: "bi-split-top" |
type: "bi.layout", |
||||||
}, |
cls: "bi-split-top", |
||||||
height: 1, |
}, |
||||||
top: 40, |
height: 1, |
||||||
left: 0, |
top: 40, |
||||||
right: 0 |
left: 0, |
||||||
}] |
right: 0, |
||||||
|
} |
||||||
|
], |
||||||
}); |
}); |
||||||
|
} |
||||||
|
|
||||||
}, |
_createNav(v) { |
||||||
|
const date = Calendar.getDateJSONByPage(v); |
||||||
_createNav: function (v) { |
const calendar = createWidget({ |
||||||
var date = BI.Calendar.getDateJSONByPage(v); |
|
||||||
var calendar = BI.createWidget({ |
|
||||||
type: "bi.calendar", |
type: "bi.calendar", |
||||||
logic: { |
logic: { |
||||||
dynamic: false |
dynamic: false, |
||||||
}, |
}, |
||||||
min: this.options.min, |
min: this.options.min, |
||||||
max: this.options.max, |
max: this.options.max, |
||||||
year: date.year, |
year: date.year, |
||||||
month: date.month, |
month: date.month, |
||||||
day: this.selectedTime.day |
day: this.selectedTime.day, |
||||||
}); |
}); |
||||||
|
|
||||||
return calendar; |
return calendar; |
||||||
}, |
} |
||||||
|
|
||||||
_getNewCurrentDate: function () { |
_getNewCurrentDate() { |
||||||
var today = BI.getDate(); |
const today = getDate(); |
||||||
|
|
||||||
return { |
return { |
||||||
year: today.getFullYear(), |
year: today.getFullYear(), |
||||||
month: today.getMonth() + 1 |
month: today.getMonth() + 1, |
||||||
}; |
}; |
||||||
}, |
} |
||||||
|
|
||||||
_setCalenderValue: function (date) { |
_setCalenderValue(date) { |
||||||
this.calendar.setSelect(BI.Calendar.getPageByDateJSON(date)); |
this.calendar.setSelect(Calendar.getPageByDateJSON(date)); |
||||||
this.calendar.setValue(date); |
this.calendar.setValue(date); |
||||||
this.selectedTime = date; |
this.selectedTime = date; |
||||||
}, |
} |
||||||
|
|
||||||
_setDatePicker: function (timeOb) { |
_setDatePicker(timeOb) { |
||||||
if (BI.isNull(timeOb) || BI.isNull(timeOb.year) || BI.isNull(timeOb.month)) { |
if (isNull(timeOb) || isNull(timeOb.year) || isNull(timeOb.month)) { |
||||||
this.datePicker.setValue(this._getNewCurrentDate()); |
this.datePicker.setValue(this._getNewCurrentDate()); |
||||||
} else { |
} else { |
||||||
this.datePicker.setValue(timeOb); |
this.datePicker.setValue(timeOb); |
||||||
} |
} |
||||||
}, |
} |
||||||
|
|
||||||
_setCalendar: function (timeOb) { |
_setCalendar(timeOb) { |
||||||
if (BI.isNull(timeOb) || BI.isNull(timeOb.day)) { |
if (isNull(timeOb) || isNull(timeOb.day)) { |
||||||
this.calendar.empty(); |
this.calendar.empty(); |
||||||
this._setCalenderValue(this._getNewCurrentDate()); |
this._setCalenderValue(this._getNewCurrentDate()); |
||||||
} else { |
} else { |
||||||
this._setCalenderValue(timeOb); |
this._setCalenderValue(timeOb); |
||||||
} |
} |
||||||
}, |
} |
||||||
|
|
||||||
_checkMin: function () { |
_checkMin() { |
||||||
var o = this.options; |
const o = this.options; |
||||||
BI.each(this.calendar.getAllCard(), function (idx, calendar) { |
each(this.calendar.getAllCard(), (idx, calendar) => { |
||||||
calendar.setMinDate(o.min); |
calendar.setMinDate(o.min); |
||||||
}); |
}); |
||||||
}, |
} |
||||||
|
|
||||||
_checkMax: function () { |
_checkMax() { |
||||||
var o = this.options; |
const o = this.options; |
||||||
BI.each(this.calendar.getAllCard(), function (idx, calendar) { |
each(this.calendar.getAllCard(), (idx, calendar) => { |
||||||
calendar.setMaxDate(o.max); |
calendar.setMaxDate(o.max); |
||||||
}); |
}); |
||||||
}, |
} |
||||||
|
|
||||||
setMinDate: function (minDate) { |
setMinDate(minDate) { |
||||||
if (BI.isNotEmptyString(this.options.min)) { |
if (isNotEmptyString(this.options.min)) { |
||||||
this.options.min = minDate; |
this.options.min = minDate; |
||||||
this.datePicker.setMinDate(minDate); |
this.datePicker.setMinDate(minDate); |
||||||
this._checkMin(); |
this._checkMin(); |
||||||
} |
} |
||||||
}, |
} |
||||||
|
|
||||||
setMaxDate: function (maxDate) { |
setMaxDate(maxDate) { |
||||||
if (BI.isNotEmptyString(this.options.max)) { |
if (isNotEmptyString(this.options.max)) { |
||||||
this.options.max = maxDate; |
this.options.max = maxDate; |
||||||
this.datePicker.setMaxDate(maxDate); |
this.datePicker.setMaxDate(maxDate); |
||||||
this._checkMax(); |
this._checkMax(); |
||||||
} |
} |
||||||
}, |
} |
||||||
|
|
||||||
setValue: function (timeOb) { |
setValue(timeOb) { |
||||||
this._setDatePicker(timeOb); |
this._setDatePicker(timeOb); |
||||||
this._setCalendar(timeOb); |
this._setCalendar(timeOb); |
||||||
}, |
} |
||||||
|
|
||||||
getValue: function () { |
getValue() { |
||||||
return this.selectedTime; |
return this.selectedTime; |
||||||
} |
} |
||||||
|
} |
||||||
}); |
|
||||||
BI.StaticDatePaneCard.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW" |
|
||||||
BI.shortcut("bi.static_date_pane_card", BI.StaticDatePaneCard); |
|
||||||
|
@ -0,0 +1,2 @@ |
|||||||
|
export { StaticDatePaneCard } from "./card.static.datepane"; |
||||||
|
export { DynamicDatePane } from "./datepane"; |
@ -1,113 +1,121 @@ |
|||||||
/** |
import { shortcut, Widget, extend, createWidget, i18nText, isNull, getDate } from "@/core"; |
||||||
* Created by Urthur on 2017/7/14. |
import { TextButton } from "@/base"; |
||||||
*/ |
import { DateCalendarPopup } from "../date/calendar"; |
||||||
BI.DateTimePopup = BI.inherit(BI.Widget, { |
|
||||||
_defaultConfig: function () { |
@shortcut() |
||||||
return BI.extend(BI.DateTimePopup.superclass._defaultConfig.apply(this, arguments), { |
export class DateTimePopup extends Widget { |
||||||
|
static xtype = "bi.date_time_popup" |
||||||
|
|
||||||
|
static BUTTON_OK_EVENT_CHANGE = "BUTTON_OK_EVENT_CHANGE" |
||||||
|
static BUTTON_CANCEL_EVENT_CHANGE = "BUTTON_CANCEL_EVENT_CHANGE" |
||||||
|
static CALENDAR_EVENT_CHANGE = "CALENDAR_EVENT_CHANGE" |
||||||
|
|
||||||
|
_defaultConfig() { |
||||||
|
return extend(super._defaultConfig(...arguments), { |
||||||
baseCls: "bi-date-time-popup", |
baseCls: "bi-date-time-popup", |
||||||
width: 268, |
width: 268, |
||||||
height: 374 |
height: 374, |
||||||
}); |
}); |
||||||
}, |
} |
||||||
_init: function () { |
|
||||||
BI.DateTimePopup.superclass._init.apply(this, arguments); |
_init() { |
||||||
var self = this, opts = this.options; |
super._init(...arguments); |
||||||
this.cancelButton = BI.createWidget({ |
const opts = this.options; |
||||||
|
this.cancelButton = createWidget({ |
||||||
type: "bi.text_button", |
type: "bi.text_button", |
||||||
cls: "multidate-popup-button bi-border-top bi-border-right", |
cls: "multidate-popup-button bi-border-top bi-border-right", |
||||||
shadow: true, |
shadow: true, |
||||||
text: BI.i18nText("BI-Basic_Cancel") |
text: i18nText("BI-Basic_Cancel"), |
||||||
}); |
}); |
||||||
this.cancelButton.on(BI.TextButton.EVENT_CHANGE, function () { |
this.cancelButton.on(TextButton.EVENT_CHANGE, () => { |
||||||
self.fireEvent(BI.DateTimePopup.BUTTON_CANCEL_EVENT_CHANGE); |
this.fireEvent(DateTimePopup.BUTTON_CANCEL_EVENT_CHANGE); |
||||||
}); |
}); |
||||||
|
|
||||||
this.okButton = BI.createWidget({ |
this.okButton = createWidget({ |
||||||
type: "bi.text_button", |
type: "bi.text_button", |
||||||
cls: "multidate-popup-button bi-border-top", |
cls: "multidate-popup-button bi-border-top", |
||||||
shadow: true, |
shadow: true, |
||||||
text: BI.i18nText("BI-Basic_OK") |
text: i18nText("BI-Basic_OK"), |
||||||
}); |
}); |
||||||
this.okButton.on(BI.TextButton.EVENT_CHANGE, function () { |
this.okButton.on(TextButton.EVENT_CHANGE, () => { |
||||||
self.fireEvent(BI.DateTimePopup.BUTTON_OK_EVENT_CHANGE); |
this.fireEvent(DateTimePopup.BUTTON_OK_EVENT_CHANGE); |
||||||
}); |
}); |
||||||
|
|
||||||
this.dateCombo = BI.createWidget({ |
this.dateCombo = createWidget({ |
||||||
type: "bi.date_calendar_popup", |
type: "bi.date_calendar_popup", |
||||||
behaviors: opts.behaviors, |
behaviors: opts.behaviors, |
||||||
min: self.options.min, |
min: this.options.min, |
||||||
max: self.options.max |
max: this.options.max, |
||||||
}); |
}); |
||||||
self.dateCombo.on(BI.DateCalendarPopup.EVENT_CHANGE, function () { |
this.dateCombo.on(DateCalendarPopup.EVENT_CHANGE, () => { |
||||||
self.fireEvent(BI.DateTimePopup.CALENDAR_EVENT_CHANGE); |
this.fireEvent(DateTimePopup.CALENDAR_EVENT_CHANGE); |
||||||
}); |
}); |
||||||
|
|
||||||
this.dateButton = BI.createWidget({ |
this.dateButton = createWidget({ |
||||||
type: "bi.grid", |
type: "bi.grid", |
||||||
items: [[this.cancelButton, this.okButton]] |
items: [ |
||||||
|
[this.cancelButton, this.okButton] |
||||||
|
], |
||||||
}); |
}); |
||||||
BI.createWidget({ |
createWidget({ |
||||||
element: this, |
element: this, |
||||||
type: "bi.vtape", |
type: "bi.vtape", |
||||||
items: [{ |
items: [{ |
||||||
el: this.dateCombo |
el: this.dateCombo, |
||||||
}, { |
}, { |
||||||
el: { |
el: { |
||||||
type: "bi.center_adapt", |
type: "bi.center_adapt", |
||||||
cls: "bi-split-top", |
cls: "bi-split-top", |
||||||
items: [{ |
items: [{ |
||||||
type: "bi.dynamic_date_time_select", |
type: "bi.dynamic_date_time_select", |
||||||
ref: function (_ref) { |
ref: _ref => { |
||||||
self.timeSelect = _ref; |
this.timeSelect = _ref; |
||||||
} |
}, |
||||||
}] |
}], |
||||||
}, |
}, |
||||||
height: 50 |
height: 50, |
||||||
}, { |
}, { |
||||||
el: this.dateButton, |
el: this.dateButton, |
||||||
height: 30 |
height: 30, |
||||||
}] |
}], |
||||||
}); |
}); |
||||||
this.setValue(opts.value); |
this.setValue(opts.value); |
||||||
}, |
} |
||||||
|
|
||||||
setValue: function (v) { |
setValue(v) { |
||||||
var value = v, date; |
const value = v; |
||||||
if (BI.isNull(value)) { |
let date; |
||||||
date = BI.getDate(); |
if (isNull(value)) { |
||||||
|
date = getDate(); |
||||||
this.dateCombo.setValue({ |
this.dateCombo.setValue({ |
||||||
year: date.getFullYear(), |
year: date.getFullYear(), |
||||||
month: date.getMonth() + 1, |
month: date.getMonth() + 1, |
||||||
day: date.getDate() |
day: date.getDate(), |
||||||
}); |
}); |
||||||
this.timeSelect.setValue({ |
this.timeSelect.setValue({ |
||||||
hour: date.getHours(), |
hour: date.getHours(), |
||||||
minute: date.getMinutes(), |
minute: date.getMinutes(), |
||||||
second: date.getSeconds() |
second: date.getSeconds(), |
||||||
}); |
}); |
||||||
} else { |
} else { |
||||||
this.dateCombo.setValue({ |
this.dateCombo.setValue({ |
||||||
year: value.year, |
year: value.year, |
||||||
month: value.month, |
month: value.month, |
||||||
day: value.day |
day: value.day, |
||||||
}); |
}); |
||||||
this.timeSelect.setValue({ |
this.timeSelect.setValue({ |
||||||
hour: value.hour, |
hour: value.hour, |
||||||
minute: value.minute, |
minute: value.minute, |
||||||
second: value.second |
second: value.second, |
||||||
}); |
}); |
||||||
} |
} |
||||||
}, |
} |
||||||
|
|
||||||
getValue: function () { |
getValue() { |
||||||
return BI.extend({ |
return extend({ |
||||||
year: this.dateCombo.getValue().year, |
year: this.dateCombo.getValue().year, |
||||||
month: this.dateCombo.getValue().month, |
month: this.dateCombo.getValue().month, |
||||||
day: this.dateCombo.getValue().day |
day: this.dateCombo.getValue().day, |
||||||
}, this.timeSelect.getValue()); |
}, this.timeSelect.getValue()); |
||||||
} |
} |
||||||
}); |
} |
||||||
BI.DateTimePopup.BUTTON_OK_EVENT_CHANGE = "BUTTON_OK_EVENT_CHANGE"; |
|
||||||
BI.DateTimePopup.BUTTON_CANCEL_EVENT_CHANGE = "BUTTON_CANCEL_EVENT_CHANGE"; |
|
||||||
BI.DateTimePopup.CALENDAR_EVENT_CHANGE = "CALENDAR_EVENT_CHANGE"; |
|
||||||
BI.shortcut("bi.date_time_popup", BI.DateTimePopup); |
|
||||||
|
@ -1,63 +1,75 @@ |
|||||||
/** |
import { |
||||||
* Created by Urthur on 2017/7/14. |
shortcut, |
||||||
*/ |
extend, |
||||||
BI.DateTimeTrigger = BI.inherit(BI.Trigger, { |
createWidget, |
||||||
_const: { |
isNull, |
||||||
|
getDate, |
||||||
|
print |
||||||
|
} from "@/core"; |
||||||
|
import { |
||||||
|
Trigger |
||||||
|
} from "@/base"; |
||||||
|
|
||||||
|
|
||||||
|
@shortcut() |
||||||
|
export class DateTimeTrigger extends Trigger { |
||||||
|
static xtype = "bi.date_time_trigger" |
||||||
|
|
||||||
|
_const = { |
||||||
hgap: 4, |
hgap: 4, |
||||||
iconWidth:24 |
iconWidth: 24, |
||||||
}, |
}; |
||||||
|
|
||||||
_defaultConfig: function () { |
_defaultConfig() { |
||||||
return BI.extend(BI.DateTimeTrigger.superclass._defaultConfig.apply(this, arguments), { |
return extend(super._defaultConfig(...arguments), { |
||||||
extraCls: "bi-date-time-trigger", |
extraCls: "bi-date-time-trigger", |
||||||
min: "1900-01-01", // 最小日期
|
min: "1900-01-01", // 最小日期
|
||||||
max: "2099-12-31", // 最大日期
|
max: "2099-12-31", // 最大日期
|
||||||
height: 24, |
height: 24, |
||||||
width: 200 |
width: 200, |
||||||
}); |
}); |
||||||
}, |
} |
||||||
_init: function () { |
|
||||||
BI.DateTimeTrigger.superclass._init.apply(this, arguments); |
_init() { |
||||||
var self = this, o = this.options, c = this._const; |
super._init(...arguments); |
||||||
this.text = BI.createWidget({ |
const o = this.options, |
||||||
|
c = this._const; |
||||||
|
this.text = createWidget({ |
||||||
type: "bi.label", |
type: "bi.label", |
||||||
textAlign: "left", |
textAlign: "left", |
||||||
height: o.height, |
height: o.height, |
||||||
width: o.width, |
width: o.width, |
||||||
hgap: c.hgap |
hgap: c.hgap, |
||||||
}); |
}); |
||||||
|
|
||||||
BI.createWidget({ |
createWidget({ |
||||||
type: "bi.htape", |
type: "bi.htape", |
||||||
element: this, |
element: this, |
||||||
items: [{ |
items: [{ |
||||||
el: this.text |
el: this.text, |
||||||
},{ |
}, { |
||||||
el: BI.createWidget(), |
el: createWidget(), |
||||||
width: this._const.iconWidth |
width: this._const.iconWidth, |
||||||
}] |
}], |
||||||
}); |
}); |
||||||
this.setValue(o.value); |
this.setValue(o.value); |
||||||
}, |
} |
||||||
|
|
||||||
_printTime: function (v) { |
_printTime(v) { |
||||||
return v < 10 ? "0" + v : v; |
return v < 10 ? `0${v}` : v; |
||||||
}, |
} |
||||||
|
|
||||||
setValue: function (v) { |
|
||||||
var self = this; |
|
||||||
var value = v, dateStr; |
|
||||||
if(BI.isNull(value)) { |
|
||||||
value = BI.getDate(); |
|
||||||
dateStr = BI.print(value, "%Y-%X-%d %H:%M:%S"); |
|
||||||
} else { |
|
||||||
var date = BI.getDate(value.year, value.month - 1, value.day, value.hour, value.minute, value.second); |
|
||||||
dateStr = BI.print(date, "%Y-%X-%d %H:%M:%S"); |
|
||||||
|
|
||||||
|
setValue(v) { |
||||||
|
let value = v, |
||||||
|
dateStr; |
||||||
|
if (isNull(value)) { |
||||||
|
value = getDate(); |
||||||
|
dateStr = print(value, "%Y-%X-%d %H:%M:%S"); |
||||||
|
} else { |
||||||
|
const date = getDate(value.year, value.month - 1, value.day, value.hour, value.minute, value.second); |
||||||
|
dateStr = print(date, "%Y-%X-%d %H:%M:%S"); |
||||||
} |
} |
||||||
this.text.setText(dateStr); |
this.text.setText(dateStr); |
||||||
this.text.setTitle(dateStr); |
this.text.setTitle(dateStr); |
||||||
} |
} |
||||||
|
} |
||||||
}); |
|
||||||
BI.shortcut("bi.date_time_trigger", BI.DateTimeTrigger); |
|
||||||
|
@ -0,0 +1,3 @@ |
|||||||
|
export { DateTimeCombo } from "./datetime.combo"; |
||||||
|
export { DateTimePopup } from "./datetime.popup"; |
||||||
|
export { DateTimeTrigger } from "./datetime.trigger"; |
@ -1,205 +1,216 @@ |
|||||||
BI.StaticDateTimePaneCard = BI.inherit(BI.Widget, { |
import { shortcut, Widget, extend, getDate, createWidget, bind, isNull, each, isNotEmptyString, getMonthDays } from "@/core"; |
||||||
_defaultConfig: function () { |
import { DatePicker, DateCalendarPopup } from "../date/calendar"; |
||||||
var conf = BI.StaticDateTimePaneCard.superclass._defaultConfig.apply(this, arguments); |
import { Calendar } from "@/case"; |
||||||
return BI.extend(conf, { |
import { Navigation } from "@/base"; |
||||||
|
import { DynamicDateTimeSelect } from "../dynamicdatetime/dynamicdatetime.timeselect"; |
||||||
|
|
||||||
|
@shortcut() |
||||||
|
export class StaticDateTimePaneCard extends Widget { |
||||||
|
static xtype = "bi.static_date_time_pane_card" |
||||||
|
|
||||||
|
static EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW" |
||||||
|
|
||||||
|
_defaultConfig() { |
||||||
|
const conf = super._defaultConfig(...arguments); |
||||||
|
|
||||||
|
return extend(conf, { |
||||||
baseCls: "bi-date-time-pane", |
baseCls: "bi-date-time-pane", |
||||||
min: "1900-01-01", // 最小日期
|
min: "1900-01-01", // 最小日期
|
||||||
max: "2099-12-31", // 最大日期
|
max: "2099-12-31", // 最大日期
|
||||||
selectedTime: null |
selectedTime: null, |
||||||
}); |
}); |
||||||
}, |
} |
||||||
_init: function () { |
|
||||||
BI.StaticDateTimePaneCard.superclass._init.apply(this, arguments); |
_init() { |
||||||
var self = this, o = this.options; |
super._init(...arguments); |
||||||
|
const o = this.options; |
||||||
|
|
||||||
this.today = BI.getDate(); |
this.today = getDate(); |
||||||
this._year = this.today.getFullYear(); |
this._year = this.today.getFullYear(); |
||||||
this._month = this.today.getMonth() + 1; |
this._month = this.today.getMonth() + 1; |
||||||
|
|
||||||
this.selectedTime = o.selectedTime || { |
this.selectedTime = o.selectedTime || { |
||||||
year: this._year, |
year: this._year, |
||||||
month: this._month |
month: this._month, |
||||||
}; |
}; |
||||||
|
|
||||||
this.datePicker = BI.createWidget({ |
this.datePicker = createWidget({ |
||||||
type: "bi.date_picker", |
type: "bi.date_picker", |
||||||
behaviors: o.behaviors, |
behaviors: o.behaviors, |
||||||
min: o.min, |
min: o.min, |
||||||
max: o.max |
max: o.max, |
||||||
}); |
}); |
||||||
this.datePicker.on(BI.DatePicker.EVENT_CHANGE, function () { |
this.datePicker.on(DatePicker.EVENT_CHANGE, () => { |
||||||
var value = self.datePicker.getValue(); |
const value = this.datePicker.getValue(); |
||||||
var monthDay = BI.getMonthDays(BI.getDate(value.year, value.month - 1, 1)); |
const monthDay = getMonthDays(getDate(value.year, value.month - 1, 1)); |
||||||
var day = self.selectedTime.day || 0; |
let day = this.selectedTime.day || 0; |
||||||
if (day > monthDay) { |
if (day > monthDay) { |
||||||
day = monthDay; |
day = monthDay; |
||||||
} |
} |
||||||
self.selectedTime = BI.extend(self.selectedTime, { |
this.selectedTime = extend(this.selectedTime, { |
||||||
year: value.year, |
year: value.year, |
||||||
month: value.month |
month: value.month, |
||||||
}); |
}); |
||||||
day !== 0 && (self.selectedTime.day = day); |
day !== 0 && (this.selectedTime.day = day); |
||||||
self.calendar.setSelect(BI.Calendar.getPageByDateJSON(self.selectedTime)); |
this.calendar.setSelect(Calendar.getPageByDateJSON(this.selectedTime)); |
||||||
self.calendar.setValue(self.selectedTime); |
this.calendar.setValue(this.selectedTime); |
||||||
day !== 0 && self.fireEvent(BI.DateCalendarPopup.EVENT_CHANGE); |
day !== 0 && this.fireEvent(DateCalendarPopup.EVENT_CHANGE); |
||||||
}); |
}); |
||||||
|
|
||||||
this.datePicker.on(BI.DatePicker.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW, function () { |
this.datePicker.on(DatePicker.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW, () => { |
||||||
self.fireEvent(BI.StaticDateTimePaneCard.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); |
this.fireEvent(StaticDateTimePaneCard.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); |
||||||
}); |
}); |
||||||
|
|
||||||
this.calendar = BI.createWidget({ |
this.calendar = createWidget({ |
||||||
direction: "custom", |
direction: "custom", |
||||||
// logic: {
|
// logic: {
|
||||||
// dynamic: false
|
// dynamic: false
|
||||||
// },
|
// },
|
||||||
type: "bi.navigation", |
type: "bi.navigation", |
||||||
tab: this.datePicker, |
tab: this.datePicker, |
||||||
cardCreator: BI.bind(this._createNav, this) |
cardCreator: bind(this._createNav, this), |
||||||
}); |
}); |
||||||
this.calendar.on(BI.Navigation.EVENT_CHANGE, function () { |
this.calendar.on(Navigation.EVENT_CHANGE, () => { |
||||||
self.selectedTime = BI.extend(self.calendar.getValue(), self.timeSelect.getValue()); |
this.selectedTime = extend(this.calendar.getValue(), this.timeSelect.getValue()); |
||||||
self.calendar.empty(); |
this.calendar.empty(); |
||||||
self.setValue(self.selectedTime); |
this.setValue(this.selectedTime); |
||||||
self.fireEvent(BI.DateCalendarPopup.EVENT_CHANGE); |
this.fireEvent(DateCalendarPopup.EVENT_CHANGE); |
||||||
}); |
}); |
||||||
|
|
||||||
BI.createWidget({ |
createWidget({ |
||||||
type: "bi.vtape", |
type: "bi.vtape", |
||||||
element: this, |
element: this, |
||||||
hgap: 10, |
hgap: 10, |
||||||
items: [{ |
items: [{ |
||||||
el: this.datePicker, |
el: this.datePicker, |
||||||
height: 40 |
height: 40, |
||||||
}, this.calendar, { |
}, this.calendar, { |
||||||
el: { |
el: { |
||||||
type: "bi.dynamic_date_time_select", |
type: "bi.dynamic_date_time_select", |
||||||
cls: "bi-split-top", |
cls: "bi-split-top", |
||||||
ref: function () { |
ref: _ref => { |
||||||
self.timeSelect = this; |
this.timeSelect = _ref; |
||||||
}, |
}, |
||||||
listeners: [{ |
listeners: [{ |
||||||
eventName: BI.DynamicDateTimeSelect.EVENT_CONFIRM, |
eventName: DynamicDateTimeSelect.EVENT_CONFIRM, |
||||||
action: function () { |
action: () => { |
||||||
self.selectedTime = BI.extend(self.calendar.getValue(), self.timeSelect.getValue()); |
this.selectedTime = extend(this.calendar.getValue(), this.timeSelect.getValue()); |
||||||
self.fireEvent("EVENT_CHANGE"); |
this.fireEvent("EVENT_CHANGE"); |
||||||
} |
}, |
||||||
}] |
}], |
||||||
}, |
}, |
||||||
height: 40 |
height: 40, |
||||||
}] |
}], |
||||||
}); |
}); |
||||||
|
|
||||||
BI.createWidget({ |
createWidget({ |
||||||
type: "bi.absolute", |
type: "bi.absolute", |
||||||
element: this, |
element: this, |
||||||
items: [{ |
items: [{ |
||||||
el: { |
el: { |
||||||
type: "bi.layout", |
type: "bi.layout", |
||||||
cls: "bi-split-top" |
cls: "bi-split-top", |
||||||
}, |
}, |
||||||
height: 1, |
height: 1, |
||||||
top: 40, |
top: 40, |
||||||
left: 0, |
left: 0, |
||||||
right: 0 |
right: 0, |
||||||
}] |
}], |
||||||
}); |
}); |
||||||
this.setValue(o.selectedTime); |
this.setValue(o.selectedTime); |
||||||
|
} |
||||||
|
|
||||||
}, |
_createNav(v) { |
||||||
|
const date = Calendar.getDateJSONByPage(v); |
||||||
_createNav: function (v) { |
const calendar = createWidget({ |
||||||
var date = BI.Calendar.getDateJSONByPage(v); |
|
||||||
var calendar = BI.createWidget({ |
|
||||||
type: "bi.calendar", |
type: "bi.calendar", |
||||||
logic: { |
logic: { |
||||||
dynamic: false |
dynamic: false, |
||||||
}, |
}, |
||||||
min: this.options.min, |
min: this.options.min, |
||||||
max: this.options.max, |
max: this.options.max, |
||||||
year: date.year, |
year: date.year, |
||||||
month: date.month, |
month: date.month, |
||||||
day: this.selectedTime.day |
day: this.selectedTime.day, |
||||||
}); |
}); |
||||||
|
|
||||||
return calendar; |
return calendar; |
||||||
}, |
} |
||||||
|
|
||||||
_getNewCurrentDate: function () { |
_getNewCurrentDate() { |
||||||
var today = BI.getDate(); |
const today = getDate(); |
||||||
|
|
||||||
return { |
return { |
||||||
year: today.getFullYear(), |
year: today.getFullYear(), |
||||||
month: today.getMonth() + 1 |
month: today.getMonth() + 1, |
||||||
}; |
}; |
||||||
}, |
} |
||||||
|
|
||||||
_setCalenderValue: function (date) { |
_setCalenderValue(date) { |
||||||
this.calendar.setSelect(BI.Calendar.getPageByDateJSON(date)); |
this.calendar.setSelect(Calendar.getPageByDateJSON(date)); |
||||||
this.calendar.setValue(date); |
this.calendar.setValue(date); |
||||||
this.selectedTime = BI.extend({}, this.timeSelect.getValue(), date); |
this.selectedTime = extend({}, this.timeSelect.getValue(), date); |
||||||
}, |
} |
||||||
|
|
||||||
_setDatePicker: function (timeOb) { |
_setDatePicker(timeOb) { |
||||||
if (BI.isNull(timeOb) || BI.isNull(timeOb.year) || BI.isNull(timeOb.month)) { |
if (isNull(timeOb) || isNull(timeOb.year) || isNull(timeOb.month)) { |
||||||
this.datePicker.setValue(this._getNewCurrentDate()); |
this.datePicker.setValue(this._getNewCurrentDate()); |
||||||
} else { |
} else { |
||||||
this.datePicker.setValue(timeOb); |
this.datePicker.setValue(timeOb); |
||||||
} |
} |
||||||
}, |
} |
||||||
|
|
||||||
_setCalendar: function (timeOb) { |
_setCalendar(timeOb) { |
||||||
if (BI.isNull(timeOb) || BI.isNull(timeOb.day)) { |
if (isNull(timeOb) || isNull(timeOb.day)) { |
||||||
this.calendar.empty(); |
this.calendar.empty(); |
||||||
this._setCalenderValue(this._getNewCurrentDate()); |
this._setCalenderValue(this._getNewCurrentDate()); |
||||||
} else { |
} else { |
||||||
this._setCalenderValue(timeOb); |
this._setCalenderValue(timeOb); |
||||||
} |
} |
||||||
}, |
} |
||||||
|
|
||||||
_checkMin: function () { |
_checkMin() { |
||||||
var o = this.options; |
const o = this.options; |
||||||
BI.each(this.calendar.getAllCard(), function (idx, calendar) { |
each(this.calendar.getAllCard(), (idx, calendar) => { |
||||||
calendar.setMinDate(o.min); |
calendar.setMinDate(o.min); |
||||||
}); |
}); |
||||||
}, |
} |
||||||
|
|
||||||
_checkMax: function () { |
_checkMax() { |
||||||
var o = this.options; |
const o = this.options; |
||||||
BI.each(this.calendar.getAllCard(), function (idx, calendar) { |
each(this.calendar.getAllCard(), (idx, calendar) => { |
||||||
calendar.setMaxDate(o.max); |
calendar.setMaxDate(o.max); |
||||||
}); |
}); |
||||||
}, |
} |
||||||
|
|
||||||
setMinDate: function (minDate) { |
setMinDate(minDate) { |
||||||
if (BI.isNotEmptyString(this.options.min)) { |
if (isNotEmptyString(this.options.min)) { |
||||||
this.options.min = minDate; |
this.options.min = minDate; |
||||||
this.datePicker.setMinDate(minDate); |
this.datePicker.setMinDate(minDate); |
||||||
this._checkMin(); |
this._checkMin(); |
||||||
} |
} |
||||||
}, |
} |
||||||
|
|
||||||
setMaxDate: function (maxDate) { |
setMaxDate(maxDate) { |
||||||
if (BI.isNotEmptyString(this.options.max)) { |
if (isNotEmptyString(this.options.max)) { |
||||||
this.options.max = maxDate; |
this.options.max = maxDate; |
||||||
this.datePicker.setMaxDate(maxDate); |
this.datePicker.setMaxDate(maxDate); |
||||||
this._checkMax(); |
this._checkMax(); |
||||||
} |
} |
||||||
}, |
} |
||||||
|
|
||||||
setValue: function (timeOb) { |
setValue(timeOb) { |
||||||
timeOb = timeOb || {}; |
timeOb = timeOb || {}; |
||||||
this._setDatePicker(timeOb); |
this._setDatePicker(timeOb); |
||||||
this._setCalendar(timeOb); |
this._setCalendar(timeOb); |
||||||
this.timeSelect.setValue({ |
this.timeSelect.setValue({ |
||||||
hour: timeOb.hour, |
hour: timeOb.hour, |
||||||
minute: timeOb.minute, |
minute: timeOb.minute, |
||||||
second: timeOb.second |
second: timeOb.second, |
||||||
}); |
}); |
||||||
}, |
} |
||||||
|
|
||||||
getValue: function () { |
getValue() { |
||||||
return this.selectedTime; |
return this.selectedTime; |
||||||
} |
} |
||||||
|
} |
||||||
}); |
|
||||||
BI.StaticDateTimePaneCard.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW"; |
|
||||||
BI.shortcut("bi.static_date_time_pane_card", BI.StaticDateTimePaneCard); |
|
||||||
|
@ -0,0 +1,2 @@ |
|||||||
|
export { StaticDateTimePaneCard } from "./card.static.datetimepane"; |
||||||
|
export { DynamicDateTimePane } from "./datetimepane"; |
@ -1,117 +1,119 @@ |
|||||||
!(function () { |
import { isNotNull, parseInt, getDate, i18nText, size, getOffsetQuarter, getOffsetMonth, getOffsetDate, getLastDateOfMonth, getWeekStartDate, getWeekEndDate, getQuarterStartDate, getQuarterEndDate, print } from "@/core"; |
||||||
BI.DynamicDateHelper = {}; |
import { DynamicDateCard } from "./dynamicdate.card"; |
||||||
BI.extend(BI.DynamicDateHelper, { |
|
||||||
getCalculation: function (obj) { |
|
||||||
var date = BI.getDate(); |
|
||||||
|
|
||||||
return this.getCalculationByDate(date, obj); |
export const DynamicDateHelper = { |
||||||
}, |
getCalculation (obj) { |
||||||
|
const date = getDate(); |
||||||
|
|
||||||
getDescription: function (obj) { |
return this.getCalculationByDate(date, obj); |
||||||
var value = ""; |
}, |
||||||
var endText = ""; |
|
||||||
if(BI.isNotNull(obj.year)) { |
getDescription (obj) { |
||||||
if(BI.parseInt(obj.year) !== 0) { |
let value = ""; |
||||||
value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); |
let endText = ""; |
||||||
} |
if (isNotNull(obj.year)) { |
||||||
endText = getPositionText(BI.i18nText("BI-Basic_Year"), obj.position); |
if (parseInt(obj.year) !== 0) { |
||||||
} |
value += Math.abs(obj.year) + i18nText("BI-Basic_Year") + (obj.year < 0 ? i18nText("BI-Basic_Front") : i18nText("BI-Basic_Behind")); |
||||||
if(BI.isNotNull(obj.quarter)) { |
} |
||||||
if(BI.parseInt(obj.quarter) !== 0) { |
endText = getPositionText(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")); |
} |
||||||
} |
if (isNotNull(obj.quarter)) { |
||||||
endText = getPositionText(BI.i18nText("BI-Basic_Single_Quarter"), obj.position); |
if (parseInt(obj.quarter) !== 0) { |
||||||
} |
value += Math.abs(obj.quarter) + i18nText("BI-Basic_Single_Quarter") + (obj.quarter < 0 ? i18nText("BI-Basic_Front") : i18nText("BI-Basic_Behind")); |
||||||
if(BI.isNotNull(obj.month)) { |
|
||||||
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)) { |
endText = getPositionText(i18nText("BI-Basic_Single_Quarter"), 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")); |
if (isNotNull(obj.month)) { |
||||||
} |
if (parseInt(obj.month) !== 0) { |
||||||
endText = getPositionText(BI.i18nText("BI-Basic_Week"), obj.position); |
value += Math.abs(obj.month) + i18nText("BI-Basic_Month") + (obj.month < 0 ? i18nText("BI-Basic_Front") : i18nText("BI-Basic_Behind")); |
||||||
} |
} |
||||||
if(BI.isNotNull(obj.day)) { |
endText = getPositionText(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")); |
if (isNotNull(obj.week)) { |
||||||
} |
if (parseInt(obj.week) !== 0) { |
||||||
endText = BI.size(obj) === 1 ? getPositionText(BI.i18nText("BI-Basic_Month"), obj.position) : ""; |
value += Math.abs(obj.week) + i18nText("BI-Basic_Week") + (obj.week < 0 ? i18nText("BI-Basic_Front") : i18nText("BI-Basic_Behind")); |
||||||
} |
} |
||||||
if(BI.isNotNull(obj.workDay) && BI.parseInt(obj.workDay) !== 0) { |
endText = getPositionText(i18nText("BI-Basic_Week"), obj.position); |
||||||
value += Math.abs(obj.workDay) + BI.i18nText("BI-Basic_Work_Day") + (obj.workDay < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); |
} |
||||||
|
if (isNotNull(obj.day)) { |
||||||
|
if (parseInt(obj.day) !== 0) { |
||||||
|
value += Math.abs(obj.day) + i18nText("BI-Basic_Day") + (obj.day < 0 ? i18nText("BI-Basic_Front") : i18nText("BI-Basic_Behind")); |
||||||
} |
} |
||||||
return value + endText; |
endText = size(obj) === 1 ? getPositionText(i18nText("BI-Basic_Month"), obj.position) : ""; |
||||||
|
} |
||||||
|
if (isNotNull(obj.workDay) && parseInt(obj.workDay) !== 0) { |
||||||
|
value += Math.abs(obj.workDay) + i18nText("BI-Basic_Work_Day") + (obj.workDay < 0 ? i18nText("BI-Basic_Front") : i18nText("BI-Basic_Behind")); |
||||||
|
} |
||||||
|
|
||||||
|
return value + endText; |
||||||
|
|
||||||
function getPositionText (baseText, position) { |
function getPositionText (baseText, position) { |
||||||
switch (position) { |
switch (position) { |
||||||
case BI.DynamicDateCard.OFFSET.BEGIN: |
case DynamicDateCard.OFFSET.BEGIN: |
||||||
return baseText + BI.i18nText("BI-Basic_Begin_Start"); |
return baseText + i18nText("BI-Basic_Begin_Start"); |
||||||
case BI.DynamicDateCard.OFFSET.END: |
case DynamicDateCard.OFFSET.END: |
||||||
return baseText + BI.i18nText("BI-Basic_End_Stop"); |
return baseText + i18nText("BI-Basic_End_Stop"); |
||||||
case BI.DynamicDateCard.OFFSET.CURRENT: |
case DynamicDateCard.OFFSET.CURRENT: |
||||||
default: |
default: |
||||||
return BI.i18nText("BI-Basic_Current_Day"); |
return i18nText("BI-Basic_Current_Day"); |
||||||
} |
|
||||||
} |
} |
||||||
}, |
} |
||||||
|
}, |
||||||
|
|
||||||
getCalculationByDate: function (date, obj) { |
getCalculationByDate (date, obj) { |
||||||
if (BI.isNotNull(obj.year)) { |
if (isNotNull(obj.year)) { |
||||||
date = BI.getDate((date.getFullYear() + BI.parseInt(obj.year)), date.getMonth(), date.getDate()); |
date = getDate((date.getFullYear() + parseInt(obj.year)), date.getMonth(), date.getDate()); |
||||||
} |
} |
||||||
if (BI.isNotNull(obj.quarter)) { |
if (isNotNull(obj.quarter)) { |
||||||
date = BI.getOffsetQuarter(date, BI.parseInt(obj.quarter)); |
date = getOffsetQuarter(date, parseInt(obj.quarter)); |
||||||
} |
} |
||||||
if (BI.isNotNull(obj.month)) { |
if (isNotNull(obj.month)) { |
||||||
date = BI.getOffsetMonth(date, BI.parseInt(obj.month)); |
date = getOffsetMonth(date, parseInt(obj.month)); |
||||||
} |
} |
||||||
if (BI.isNotNull(obj.week)) { |
if (isNotNull(obj.week)) { |
||||||
date = BI.getOffsetDate(date, BI.parseInt(obj.week) * 7); |
date = getOffsetDate(date, parseInt(obj.week) * 7); |
||||||
} |
} |
||||||
if (BI.isNotNull(obj.day)) { |
if (isNotNull(obj.day)) { |
||||||
date = BI.getOffsetDate(date, BI.parseInt(obj.day)); |
date = getOffsetDate(date, parseInt(obj.day)); |
||||||
} |
} |
||||||
if (BI.isNotNull(obj.workDay)) { |
if (isNotNull(obj.workDay)) { |
||||||
// 配置了节假日就按照节假日计算工作日偏移,否则按正常的天去算
|
// 配置了节假日就按照节假日计算工作日偏移,否则按正常的天去算
|
||||||
if(BI.isNotNull(BI.holidays)) { |
if (isNotNull(BI.holidays)) { |
||||||
var count = Math.abs(obj.workDay); |
const count = Math.abs(obj.workDay); |
||||||
for (var i = 0; i < count; i++) { |
for (let i = 0; i < count; i++) { |
||||||
date = BI.getOffsetDate(date, obj.workDay < 0 ? -1 : 1); |
date = getOffsetDate(date, obj.workDay < 0 ? -1 : 1); |
||||||
if(BI.isNotNull(BI.holidays[BI.print(date, "%Y-%X-%d")])) { |
if (isNotNull(BI.holidays[print(date, "%Y-%X-%d")])) { |
||||||
i--; |
i--; |
||||||
} |
|
||||||
} |
} |
||||||
} else { |
|
||||||
date = BI.getOffsetDate(date, BI.parseInt(obj.workDay)); |
|
||||||
} |
} |
||||||
|
} else { |
||||||
|
date = getOffsetDate(date, parseInt(obj.workDay)); |
||||||
} |
} |
||||||
if (BI.isNotNull(obj.position) && obj.position !== BI.DynamicDateCard.OFFSET.CURRENT) { |
} |
||||||
date = this.getBeginDate(date, obj); |
if (isNotNull(obj.position) && obj.position !== DynamicDateCard.OFFSET.CURRENT) { |
||||||
} |
date = this.getBeginDate(date, obj); |
||||||
|
} |
||||||
|
|
||||||
return BI.getDate(date.getFullYear(), date.getMonth(), date.getDate()); |
return getDate(date.getFullYear(), date.getMonth(), date.getDate()); |
||||||
}, |
}, |
||||||
|
|
||||||
getBeginDate: function (date, obj) { |
getBeginDate (date, obj) { |
||||||
if (BI.isNotNull(obj.day)) { |
if (isNotNull(obj.day)) { |
||||||
return obj.position === BI.DynamicDateCard.OFFSET.BEGIN ? BI.getDate(date.getFullYear(), date.getMonth(), 1) : BI.getDate(date.getFullYear(), date.getMonth(), (BI.getLastDateOfMonth(date)).getDate()); |
return obj.position === DynamicDateCard.OFFSET.BEGIN ? getDate(date.getFullYear(), date.getMonth(), 1) : getDate(date.getFullYear(), date.getMonth(), (getLastDateOfMonth(date)).getDate()); |
||||||
} |
} |
||||||
if (BI.isNotNull(obj.week)) { |
if (isNotNull(obj.week)) { |
||||||
return obj.position === BI.DynamicDateCard.OFFSET.BEGIN ? BI.getWeekStartDate(date) : BI.getWeekEndDate(date); |
return obj.position === DynamicDateCard.OFFSET.BEGIN ? getWeekStartDate(date) : getWeekEndDate(date); |
||||||
} |
} |
||||||
if (BI.isNotNull(obj.month)) { |
if (isNotNull(obj.month)) { |
||||||
return obj.position === BI.DynamicDateCard.OFFSET.BEGIN ? BI.getDate(date.getFullYear(), date.getMonth(), 1) : BI.getDate(date.getFullYear(), date.getMonth(), (BI.getLastDateOfMonth(date)).getDate()); |
return obj.position === DynamicDateCard.OFFSET.BEGIN ? getDate(date.getFullYear(), date.getMonth(), 1) : getDate(date.getFullYear(), date.getMonth(), (getLastDateOfMonth(date)).getDate()); |
||||||
} |
} |
||||||
if (BI.isNotNull(obj.quarter)) { |
if (isNotNull(obj.quarter)) { |
||||||
return obj.position === BI.DynamicDateCard.OFFSET.BEGIN ? BI.getQuarterStartDate(date) : BI.getQuarterEndDate(date); |
return obj.position === DynamicDateCard.OFFSET.BEGIN ? getQuarterStartDate(date) : getQuarterEndDate(date); |
||||||
} |
} |
||||||
if (BI.isNotNull(obj.year)) { |
if (isNotNull(obj.year)) { |
||||||
return obj.position === BI.DynamicDateCard.OFFSET.BEGIN ? BI.getDate(date.getFullYear(), 0, 1) : BI.getDate(date.getFullYear(), 11, 31); |
return obj.position === DynamicDateCard.OFFSET.BEGIN ? getDate(date.getFullYear(), 0, 1) : getDate(date.getFullYear(), 11, 31); |
||||||
} |
|
||||||
return date; |
|
||||||
} |
} |
||||||
}); |
|
||||||
})(); |
return date; |
||||||
|
}, |
||||||
|
}; |
||||||
|
@ -1,130 +1,137 @@ |
|||||||
BI.DynamicDateParamItem = BI.inherit(BI.Widget, { |
import { shortcut, Widget, toPix, isNaturalNumber, i18nText } from "@/core"; |
||||||
|
import { DynamicDateCard } from "./dynamicdate.card"; |
||||||
|
import { SignEditor, TextValueCombo } from "@/case"; |
||||||
|
|
||||||
props: function() { |
@shortcut() |
||||||
|
export class DynamicDateParamItem extends Widget { |
||||||
|
static xtype = "bi.dynamic_date_param_item" |
||||||
|
|
||||||
|
static EVENT_CHANGE = "EVENT_CHANGE" |
||||||
|
static EVENT_INPUT_CHANGE = "EVENT_INPUT_CHANGE" |
||||||
|
|
||||||
|
props() { |
||||||
return { |
return { |
||||||
baseCls: "bi-dynamic-date-param-item", |
baseCls: "bi-dynamic-date-param-item", |
||||||
dateType: BI.DynamicDateCard.TYPE.YEAR, |
dateType: DynamicDateCard.TYPE.YEAR, |
||||||
validationChecker: function() { |
validationChecker () { |
||||||
return true; |
return true; |
||||||
}, |
}, |
||||||
value: 0, |
value: 0, |
||||||
offset: 0, |
offset: 0, |
||||||
height: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, |
height: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, |
||||||
} |
}; |
||||||
}, |
} |
||||||
|
|
||||||
render: function () { |
render() { |
||||||
var self = this, o = this.options; |
const o = this.options; |
||||||
|
|
||||||
return { |
return { |
||||||
type: "bi.htape", |
type: "bi.htape", |
||||||
items: [{ |
items: [{ |
||||||
el: { |
el: { |
||||||
type: "bi.sign_editor", |
type: "bi.sign_editor", |
||||||
cls: "bi-border bi-focus-shadow bi-border-radius", |
cls: "bi-border bi-focus-shadow bi-border-radius", |
||||||
height: BI.toPix(BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, 2), |
height: toPix(BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, 2), |
||||||
validationChecker: function (v) { |
validationChecker (v) { |
||||||
return BI.isNaturalNumber(v); |
return isNaturalNumber(v); |
||||||
}, |
}, |
||||||
value: o.value, |
value: o.value, |
||||||
ref: function () { |
ref: _ref => { |
||||||
self.editor = this; |
this.editor = _ref; |
||||||
}, |
}, |
||||||
errorText: function () { |
errorText () { |
||||||
return BI.i18nText("BI-Please_Input_Natural_Number"); |
return i18nText("BI-Please_Input_Natural_Number"); |
||||||
}, |
}, |
||||||
allowBlank: false, |
allowBlank: false, |
||||||
listeners: [{ |
listeners: [{ |
||||||
eventName: BI.SignEditor.EVENT_CONFIRM, |
eventName: SignEditor.EVENT_CONFIRM, |
||||||
action: function () { |
action: () => { |
||||||
self.fireEvent(BI.DynamicDateParamItem.EVENT_CHANGE); |
this.fireEvent(DynamicDateParamItem.EVENT_CHANGE); |
||||||
} |
}, |
||||||
}, { |
}, { |
||||||
eventName: BI.SignEditor.EVENT_CHANGE, |
eventName: SignEditor.EVENT_CHANGE, |
||||||
action: function () { |
action: () => { |
||||||
self.fireEvent(BI.DynamicDateParamItem.EVENT_INPUT_CHANGE); |
this.fireEvent(DynamicDateParamItem.EVENT_INPUT_CHANGE); |
||||||
} |
}, |
||||||
}] |
}], |
||||||
}, |
}, |
||||||
width: 60 |
width: 60, |
||||||
}, { |
}, { |
||||||
el: { |
el: { |
||||||
type: "bi.label", |
type: "bi.label", |
||||||
height: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, |
height: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, |
||||||
text: this._getText() |
text: this._getText(), |
||||||
}, |
}, |
||||||
width: o.dateType === BI.DynamicDateCard.TYPE.WORK_DAY ? 60 : 20 |
width: o.dateType === DynamicDateCard.TYPE.WORK_DAY ? 60 : 20, |
||||||
}, { |
}, { |
||||||
type: "bi.text_value_combo", |
type: "bi.text_value_combo", |
||||||
height: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, |
height: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, |
||||||
items: [{ |
items: [{ |
||||||
text: BI.i18nText("BI-Basic_Front"), |
text: i18nText("BI-Basic_Front"), |
||||||
value: 0 |
value: 0, |
||||||
}, { |
}, { |
||||||
text: BI.i18nText("BI-Basic_Behind"), |
text: i18nText("BI-Basic_Behind"), |
||||||
value: 1 |
value: 1, |
||||||
}], |
}], |
||||||
ref: function () { |
ref: _ref => { |
||||||
self.offsetCombo = this; |
this.offsetCombo = _ref; |
||||||
}, |
}, |
||||||
container: null, |
container: null, |
||||||
value: o.offset, |
value: o.offset, |
||||||
listeners: [{ |
listeners: [{ |
||||||
eventName: BI.TextValueCombo.EVENT_CHANGE, |
eventName: BI.TextValueCombo.EVENT_CHANGE, |
||||||
action: function () { |
action: () => { |
||||||
self.fireEvent(BI.DynamicDateParamItem.EVENT_CHANGE); |
this.fireEvent(DynamicDateParamItem.EVENT_CHANGE); |
||||||
} |
}, |
||||||
}] |
}], |
||||||
}] |
}], |
||||||
}; |
}; |
||||||
}, |
} |
||||||
|
|
||||||
_getText: function () { |
_getText() { |
||||||
var text = ""; |
let text = ""; |
||||||
switch (this.options.dateType) { |
switch (this.options.dateType) { |
||||||
case BI.DynamicDateCard.TYPE.YEAR: |
case DynamicDateCard.TYPE.YEAR: |
||||||
text = BI.i18nText("BI-Basic_Year"); |
text = i18nText("BI-Basic_Year"); |
||||||
break; |
break; |
||||||
case BI.DynamicDateCard.TYPE.QUARTER: |
case DynamicDateCard.TYPE.QUARTER: |
||||||
text = BI.i18nText("BI-Basic_Single_Quarter"); |
text = i18nText("BI-Basic_Single_Quarter"); |
||||||
break; |
break; |
||||||
case BI.DynamicDateCard.TYPE.MONTH: |
case DynamicDateCard.TYPE.MONTH: |
||||||
text = BI.i18nText("BI-Basic_Month"); |
text = i18nText("BI-Basic_Month"); |
||||||
break; |
break; |
||||||
case BI.DynamicDateCard.TYPE.WEEK: |
case DynamicDateCard.TYPE.WEEK: |
||||||
text = BI.i18nText("BI-Basic_Week"); |
text = i18nText("BI-Basic_Week"); |
||||||
break; |
break; |
||||||
case BI.DynamicDateCard.TYPE.DAY: |
case DynamicDateCard.TYPE.DAY: |
||||||
text = BI.i18nText("BI-Basic_Day"); |
text = i18nText("BI-Basic_Day"); |
||||||
break; |
break; |
||||||
case BI.DynamicDateCard.TYPE.WORK_DAY: |
case DynamicDateCard.TYPE.WORK_DAY: |
||||||
default: |
default: |
||||||
text = BI.i18nText("BI-Basic_Work_Day"); |
text = i18nText("BI-Basic_Work_Day"); |
||||||
break; |
break; |
||||||
} |
} |
||||||
|
|
||||||
return text; |
return text; |
||||||
}, |
} |
||||||
|
|
||||||
checkValidation: function () { |
checkValidation() { |
||||||
return BI.isNaturalNumber(this.editor.getValue()); |
return isNaturalNumber(this.editor.getValue()); |
||||||
}, |
} |
||||||
|
|
||||||
setValue: function (v) { |
setValue(v) { |
||||||
v = v || {}; |
v = v || {}; |
||||||
v.value = v.value || 0; |
v.value = v.value || 0; |
||||||
v.offset = v.offset || 0; |
v.offset = v.offset || 0; |
||||||
this.editor.setValue(v.value); |
this.editor.setValue(v.value); |
||||||
this.offsetCombo.setValue(v.offset); |
this.offsetCombo.setValue(v.offset); |
||||||
}, |
} |
||||||
|
|
||||||
getValue: function () { |
getValue() { |
||||||
return { |
return { |
||||||
dateType: this.options.dateType, |
dateType: this.options.dateType, |
||||||
value: this.editor.getValue(), |
value: this.editor.getValue(), |
||||||
offset: this.offsetCombo.getValue()[0] |
offset: this.offsetCombo.getValue()[0], |
||||||
}; |
}; |
||||||
} |
} |
||||||
|
} |
||||||
}); |
|
||||||
BI.DynamicDateParamItem.EVENT_CHANGE = "EVENT_CHANGE"; |
|
||||||
BI.DynamicDateParamItem.EVENT_INPUT_CHANGE = "EVENT_INPUT_CHANGE"; |
|
||||||
BI.shortcut("bi.dynamic_date_param_item", BI.DynamicDateParamItem); |
|
||||||
|
@ -1,257 +1,267 @@ |
|||||||
BI.DynamicDatePopup = BI.inherit(BI.Widget, { |
import { shortcut, Widget, createWidget, i18nText, toPix, createItems, isNull, isEmptyObject, isEmptyString, getDate, checkDateVoid, print } from "@/core"; |
||||||
constants: { |
import { DynamicDateCombo } from "./dynamicdate.combo"; |
||||||
tabHeight: 40, |
import { TextButton, Tab } from "@/base"; |
||||||
}, |
import { DateCalendarPopup } from "../date/calendar"; |
||||||
|
import { DynamicDateHelper } from "./dynamicdate.caculate"; |
||||||
|
|
||||||
props: { |
@shortcut() |
||||||
|
export class DynamicDatePopup extends Widget { |
||||||
|
static xtype = "bi.dynamic_date_popup" |
||||||
|
|
||||||
|
props = { |
||||||
baseCls: "bi-dynamic-date-popup", |
baseCls: "bi-dynamic-date-popup", |
||||||
width: 272, |
width: 272, |
||||||
supportDynamic: true, |
supportDynamic: true, |
||||||
}, |
}; |
||||||
|
|
||||||
|
static EVENT_CHANGE = "EVENT_CHANGE" |
||||||
|
static BUTTON_OK_EVENT_CHANGE = "BUTTON_OK_EVENT_CHANGE" |
||||||
|
static BUTTON_lABEL_EVENT_CHANGE = "BUTTON_lABEL_EVENT_CHANGE" |
||||||
|
static BUTTON_CLEAR_EVENT_CHANGE = "BUTTON_CLEAR_EVENT_CHANGE" |
||||||
|
static EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW" |
||||||
|
|
||||||
_init: function () { |
_init() { |
||||||
BI.DynamicDatePopup.superclass._init.apply(this, arguments); |
super._init(...arguments); |
||||||
var self = this, opts = this.options, c = this.constants; |
const opts = this.options; |
||||||
this.storeValue = {type: BI.DynamicDateCombo.Static}; |
this.storeValue = { |
||||||
BI.createWidget({ |
type: DynamicDateCombo.Static, |
||||||
|
}; |
||||||
|
createWidget({ |
||||||
element: this, |
element: this, |
||||||
type: "bi.vertical", |
type: "bi.vertical", |
||||||
items: [{ |
items: [{ |
||||||
el: this._getTabJson() |
el: this._getTabJson(), |
||||||
}, { |
}, { |
||||||
el: { |
el: { |
||||||
type: "bi.grid", |
type: "bi.grid", |
||||||
items: [[{ |
items: [ |
||||||
type: "bi.text_button", |
[{ |
||||||
cls: "bi-high-light bi-split-top", |
type: "bi.text_button", |
||||||
shadow: true, |
cls: "bi-high-light bi-split-top", |
||||||
text: BI.i18nText("BI-Basic_Clear"), |
shadow: true, |
||||||
textHeight: BI.toPix(BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, 1), |
text: i18nText("BI-Basic_Clear"), |
||||||
listeners: [{ |
textHeight: toPix(BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, 1), |
||||||
eventName: BI.TextButton.EVENT_CHANGE, |
listeners: [{ |
||||||
action: function () { |
eventName: TextButton.EVENT_CHANGE, |
||||||
self.fireEvent(BI.DynamicDatePopup.BUTTON_CLEAR_EVENT_CHANGE); |
action: () => { |
||||||
} |
this.fireEvent(DynamicDatePopup.BUTTON_CLEAR_EVENT_CHANGE); |
||||||
}] |
}, |
||||||
}, { |
}], |
||||||
type: "bi.text_button", |
}, { |
||||||
cls: "bi-split-left bi-split-right bi-high-light bi-split-top", |
type: "bi.text_button", |
||||||
shadow: true, |
cls: "bi-split-left bi-split-right bi-high-light bi-split-top", |
||||||
textHeight: BI.toPix(BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, 1), |
shadow: true, |
||||||
text: BI.i18nText("BI-Multi_Date_Today"), |
textHeight: toPix(BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, 1), |
||||||
disabled: this._checkTodayValid(), |
text: i18nText("BI-Multi_Date_Today"), |
||||||
ref: function () { |
disabled: this._checkTodayValid(), |
||||||
self.todayButton = this; |
ref: _ref => { |
||||||
}, |
this.todayButton = _ref; |
||||||
listeners: [{ |
}, |
||||||
eventName: BI.TextButton.EVENT_CHANGE, |
listeners: [{ |
||||||
action: function () { |
eventName: TextButton.EVENT_CHANGE, |
||||||
self.fireEvent(BI.DynamicDatePopup.BUTTON_lABEL_EVENT_CHANGE); |
action: () => { |
||||||
} |
this.fireEvent(DynamicDatePopup.BUTTON_lABEL_EVENT_CHANGE); |
||||||
}] |
}, |
||||||
}, { |
}], |
||||||
type: "bi.text_button", |
}, { |
||||||
cls: "bi-high-light bi-split-top", |
type: "bi.text_button", |
||||||
textHeight: BI.toPix(BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, 1), |
cls: "bi-high-light bi-split-top", |
||||||
shadow: true, |
textHeight: toPix(BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, 1), |
||||||
text: BI.i18nText("BI-Basic_OK"), |
shadow: true, |
||||||
listeners: [{ |
text: i18nText("BI-Basic_OK"), |
||||||
eventName: BI.TextButton.EVENT_CHANGE, |
listeners: [{ |
||||||
action: function () { |
eventName: TextButton.EVENT_CHANGE, |
||||||
var type = self.dateTab.getSelect(); |
action: () => { |
||||||
if (type === BI.DynamicDateCombo.Dynamic) { |
const type = this.dateTab.getSelect(); |
||||||
self.dynamicPane.checkValidation(true) && self.fireEvent(BI.DynamicDatePopup.BUTTON_OK_EVENT_CHANGE); |
if (type === DynamicDateCombo.Dynamic) { |
||||||
} else { |
this.dynamicPane.checkValidation(true) && this.fireEvent(DynamicDatePopup.BUTTON_OK_EVENT_CHANGE); |
||||||
self.fireEvent(BI.DynamicDatePopup.BUTTON_OK_EVENT_CHANGE); |
} else { |
||||||
} |
this.fireEvent(DynamicDatePopup.BUTTON_OK_EVENT_CHANGE); |
||||||
} |
} |
||||||
|
}, |
||||||
|
}], |
||||||
}] |
}] |
||||||
}]], |
], |
||||||
height: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT |
height: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, |
||||||
}, |
}, |
||||||
}] |
}], |
||||||
}); |
}); |
||||||
this.setValue(opts.value); |
this.setValue(opts.value); |
||||||
}, |
} |
||||||
|
|
||||||
_getTabJson: function () { |
_getTabJson() { |
||||||
var self = this, o = this.options; |
const o = this.options; |
||||||
|
|
||||||
return { |
return { |
||||||
type: "bi.tab", |
type: "bi.tab", |
||||||
logic: { |
logic: { |
||||||
dynamic: true |
dynamic: true, |
||||||
}, |
}, |
||||||
ref: function () { |
ref: _ref => { |
||||||
self.dateTab = this; |
this.dateTab = _ref; |
||||||
}, |
}, |
||||||
tab: { |
tab: { |
||||||
type: "bi.linear_segment", |
type: "bi.linear_segment", |
||||||
invisible: !o.supportDynamic, |
invisible: !o.supportDynamic, |
||||||
cls: "bi-split-bottom", |
cls: "bi-split-bottom", |
||||||
height: this.constants.tabHeight, |
height: this.constants.tabHeight, |
||||||
items: BI.createItems([{ |
items: createItems([{ |
||||||
text: BI.i18nText("BI-Multi_Date_YMD"), |
text: i18nText("BI-Multi_Date_YMD"), |
||||||
value: BI.DynamicDateCombo.Static |
value: DynamicDateCombo.Static, |
||||||
}, { |
}, { |
||||||
text: BI.i18nText("BI-Basic_Dynamic_Title"), |
text: i18nText("BI-Basic_Dynamic_Title"), |
||||||
value: BI.DynamicDateCombo.Dynamic |
value: DynamicDateCombo.Dynamic, |
||||||
}], { |
}], { |
||||||
textAlign: "center" |
textAlign: "center", |
||||||
}) |
}), |
||||||
}, |
}, |
||||||
cardCreator: function (v) { |
cardCreator: v => { |
||||||
switch (v) { |
switch (v) { |
||||||
case BI.DynamicDateCombo.Dynamic: |
case DynamicDateCombo.Dynamic: |
||||||
return { |
return { |
||||||
type: "bi.dynamic_date_card", |
type: "bi.dynamic_date_card", |
||||||
cls: "dynamic-date-pane", |
cls: "dynamic-date-pane", |
||||||
listeners: [{ |
listeners: [{ |
||||||
eventName: "EVENT_CHANGE", |
eventName: "EVENT_CHANGE", |
||||||
action: function () { |
action: () => { |
||||||
self._setInnerValue(self.year, v); |
this._setInnerValue(this.year, v); |
||||||
} |
}, |
||||||
}], |
}], |
||||||
min: self.options.min, |
min: this.options.min, |
||||||
max: self.options.max, |
max: this.options.max, |
||||||
ref: function () { |
ref: _ref => { |
||||||
self.dynamicPane = this; |
this.dynamicPane = _ref; |
||||||
} |
}, |
||||||
}; |
}; |
||||||
case BI.DynamicDateCombo.Static: |
case DynamicDateCombo.Static: |
||||||
default: |
default: |
||||||
return { |
return { |
||||||
type: "bi.date_calendar_popup", |
type: "bi.date_calendar_popup", |
||||||
behaviors: o.behaviors, |
behaviors: o.behaviors, |
||||||
min: self.options.min, |
min: this.options.min, |
||||||
max: self.options.max, |
max: this.options.max, |
||||||
listeners: [{ |
listeners: [{ |
||||||
eventName: BI.DateCalendarPopup.EVENT_CHANGE, |
eventName: DateCalendarPopup.EVENT_CHANGE, |
||||||
action: function () { |
action: () => { |
||||||
self.fireEvent(BI.DynamicDatePopup.EVENT_CHANGE); |
this.fireEvent(DynamicDatePopup.EVENT_CHANGE); |
||||||
} |
}, |
||||||
}, { |
}, { |
||||||
eventName: BI.DateCalendarPopup.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW, |
eventName: DateCalendarPopup.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW, |
||||||
action: function () { |
action: () => { |
||||||
self.fireEvent(BI.DynamicDatePopup.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); |
this.fireEvent(DynamicDatePopup.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); |
||||||
} |
}, |
||||||
}], |
}], |
||||||
ref: function () { |
ref: _ref => { |
||||||
self.ymd = this; |
this.ymd = _ref; |
||||||
} |
}, |
||||||
}; |
}; |
||||||
} |
} |
||||||
}, |
}, |
||||||
listeners: [{ |
listeners: [{ |
||||||
eventName: BI.Tab.EVENT_CHANGE, |
eventName: Tab.EVENT_CHANGE, |
||||||
action: function () { |
action: () => { |
||||||
var v = self.dateTab.getSelect(); |
const v = this.dateTab.getSelect(); |
||||||
|
let date; |
||||||
switch (v) { |
switch (v) { |
||||||
case BI.DynamicDateCombo.Static: |
case DynamicDateCombo.Static: |
||||||
var date = BI.DynamicDateHelper.getCalculation(self.dynamicPane.getValue()); |
date = DynamicDateHelper.getCalculation(this.dynamicPane.getValue()); |
||||||
self.ymd.setValue({ |
this.ymd.setValue({ |
||||||
year: date.getFullYear(), |
year: date.getFullYear(), |
||||||
month: date.getMonth() + 1, |
month: date.getMonth() + 1, |
||||||
day: date.getDate() |
day: date.getDate(), |
||||||
|
}); |
||||||
|
this._setInnerValue(); |
||||||
|
break; |
||||||
|
case DynamicDateCombo.Dynamic: |
||||||
|
default: |
||||||
|
if (this.storeValue && this.storeValue.type === DynamicDateCombo.Dynamic) { |
||||||
|
this.dynamicPane.setValue(this.storeValue.value); |
||||||
|
} else { |
||||||
|
this.dynamicPane.setValue({ |
||||||
|
year: 0, |
||||||
}); |
}); |
||||||
self._setInnerValue(); |
} |
||||||
break; |
this._setInnerValue(); |
||||||
case BI.DynamicDateCombo.Dynamic: |
break; |
||||||
default: |
|
||||||
if(self.storeValue && self.storeValue.type === BI.DynamicDateCombo.Dynamic) { |
|
||||||
self.dynamicPane.setValue(self.storeValue.value); |
|
||||||
}else{ |
|
||||||
self.dynamicPane.setValue({ |
|
||||||
year: 0 |
|
||||||
}); |
|
||||||
} |
|
||||||
self._setInnerValue(); |
|
||||||
break; |
|
||||||
} |
} |
||||||
} |
}, |
||||||
}] |
}], |
||||||
}; |
}; |
||||||
}, |
} |
||||||
|
|
||||||
_setInnerValue: function () { |
_setInnerValue() { |
||||||
if (this.dateTab.getSelect() === BI.DynamicDateCombo.Static) { |
if (this.dateTab.getSelect() === DynamicDateCombo.Static) { |
||||||
this.todayButton.setValue(BI.i18nText("BI-Multi_Date_Today")); |
this.todayButton.setValue(i18nText("BI-Multi_Date_Today")); |
||||||
this.todayButton.setEnable(!this._checkTodayValid()); |
this.todayButton.setEnable(!this._checkTodayValid()); |
||||||
} else { |
} else { |
||||||
var date = BI.DynamicDateHelper.getCalculation(this.dynamicPane.getInputValue()); |
let date = DynamicDateHelper.getCalculation(this.dynamicPane.getInputValue()); |
||||||
date = BI.print(date, "%Y-%X-%d"); |
date = print(date, "%Y-%X-%d"); |
||||||
this.todayButton.setValue(date); |
this.todayButton.setValue(date); |
||||||
this.todayButton.setEnable(false); |
this.todayButton.setEnable(false); |
||||||
} |
} |
||||||
}, |
} |
||||||
|
|
||||||
_checkValueValid: function (value) { |
_checkValueValid(value) { |
||||||
return BI.isNull(value) || BI.isEmptyObject(value) || BI.isEmptyString(value); |
return isNull(value) || isEmptyObject(value) || isEmptyString(value); |
||||||
}, |
} |
||||||
|
|
||||||
_checkTodayValid: function () { |
_checkTodayValid() { |
||||||
var o = this.options; |
const o = this.options; |
||||||
var today = BI.getDate(); |
const today = getDate(); |
||||||
return !!BI.checkDateVoid(today.getFullYear(), today.getMonth() + 1, today.getDate(), o.min, o.max)[0]; |
|
||||||
}, |
return !!checkDateVoid(today.getFullYear(), today.getMonth() + 1, today.getDate(), o.min, o.max)[0]; |
||||||
|
} |
||||||
|
|
||||||
setMinDate: function (minDate) { |
setMinDate(minDate) { |
||||||
if (this.options.min !== minDate) { |
if (this.options.min !== minDate) { |
||||||
this.options.min = minDate; |
this.options.min = minDate; |
||||||
this.ymd && this.ymd.setMinDate(minDate); |
this.ymd && this.ymd.setMinDate(minDate); |
||||||
this.dynamicPane && this.dynamicPane.setMinDate(minDate); |
this.dynamicPane && this.dynamicPane.setMinDate(minDate); |
||||||
} |
} |
||||||
}, |
} |
||||||
|
|
||||||
setMaxDate: function (maxDate) { |
setMaxDate(maxDate) { |
||||||
if (this.options.max !== maxDate) { |
if (this.options.max !== maxDate) { |
||||||
this.options.max = maxDate; |
this.options.max = maxDate; |
||||||
this.ymd && this.ymd.setMaxDate(maxDate); |
this.ymd && this.ymd.setMaxDate(maxDate); |
||||||
this.dynamicPane && this.dynamicPane.setMaxDate(maxDate); |
this.dynamicPane && this.dynamicPane.setMaxDate(maxDate); |
||||||
} |
} |
||||||
}, |
} |
||||||
|
|
||||||
setValue: function (v) { |
setValue(v) { |
||||||
this.storeValue = v; |
this.storeValue = v; |
||||||
var self = this; |
|
||||||
var type, value; |
|
||||||
v = v || {}; |
v = v || {}; |
||||||
type = v.type || BI.DynamicDateCombo.Static; |
const type = v.type || DynamicDateCombo.Static; |
||||||
value = v.value || v; |
const value = v.value || v; |
||||||
this.dateTab.setSelect(type); |
this.dateTab.setSelect(type); |
||||||
switch (type) { |
switch (type) { |
||||||
case BI.DynamicDateCombo.Dynamic: |
case DynamicDateCombo.Dynamic: |
||||||
this.dynamicPane.setValue(value); |
this.dynamicPane.setValue(value); |
||||||
self._setInnerValue(); |
this._setInnerValue(); |
||||||
break; |
break; |
||||||
case BI.DynamicDateCombo.Static: |
case DynamicDateCombo.Static: |
||||||
default: |
default: |
||||||
if (this._checkValueValid(value)) { |
if (this._checkValueValid(value)) { |
||||||
var date = BI.getDate(); |
const date = getDate(); |
||||||
this.ymd.setValue({ |
this.ymd.setValue({ |
||||||
year: date.getFullYear(), |
year: date.getFullYear(), |
||||||
month: date.getMonth() + 1, |
month: date.getMonth() + 1, |
||||||
day: date.getDate() |
day: date.getDate(), |
||||||
}); |
}); |
||||||
this.todayButton.setValue(BI.i18nText("BI-Multi_Date_Today")); |
this.todayButton.setValue(i18nText("BI-Multi_Date_Today")); |
||||||
} else { |
} else { |
||||||
this.ymd.setValue(value); |
this.ymd.setValue(value); |
||||||
this.todayButton.setValue(BI.i18nText("BI-Multi_Date_Today")); |
this.todayButton.setValue(i18nText("BI-Multi_Date_Today")); |
||||||
} |
} |
||||||
this.todayButton.setEnable(!this._checkTodayValid()); |
this.todayButton.setEnable(!this._checkTodayValid()); |
||||||
break; |
break; |
||||||
} |
} |
||||||
}, |
} |
||||||
|
|
||||||
getValue: function () { |
getValue() { |
||||||
return { |
return { |
||||||
type: this.dateTab.getSelect(), |
type: this.dateTab.getSelect(), |
||||||
value: this.dateTab.getValue() |
value: this.dateTab.getValue(), |
||||||
}; |
}; |
||||||
} |
} |
||||||
}); |
} |
||||||
BI.DynamicDatePopup.EVENT_CHANGE = "EVENT_CHANGE"; |
|
||||||
BI.DynamicDatePopup.BUTTON_OK_EVENT_CHANGE = "BUTTON_OK_EVENT_CHANGE"; |
|
||||||
BI.DynamicDatePopup.BUTTON_lABEL_EVENT_CHANGE = "BUTTON_lABEL_EVENT_CHANGE"; |
|
||||||
BI.DynamicDatePopup.BUTTON_CLEAR_EVENT_CHANGE = "BUTTON_CLEAR_EVENT_CHANGE"; |
|
||||||
BI.DynamicDatePopup.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW"; |
|
||||||
BI.shortcut("bi.dynamic_date_popup", BI.DynamicDatePopup); |
|
||||||
|
@ -0,0 +1,6 @@ |
|||||||
|
export { DynamicDateHelper } from "./dynamicdate.caculate"; |
||||||
|
export { DynamicDateCard } from "./dynamicdate.card"; |
||||||
|
export { DynamicDateCombo } from "./dynamicdate.combo"; |
||||||
|
export { DynamicDateParamItem } from "./dynamicdate.param.item"; |
||||||
|
export { DynamicDatePopup } from "./dynamicdate.popup"; |
||||||
|
export { DynamicDateTrigger } from "./dynamicdate.trigger"; |
@ -1,271 +1,280 @@ |
|||||||
BI.DynamicDateTimePopup = BI.inherit(BI.Widget, { |
import { shortcut, Widget, createWidget, toPix, i18nText, createItems, print, isNull, isEmptyObject, isEmptyString, getDate, checkDateVoid, extend } from "@/core"; |
||||||
constants: { |
import { DynamicDateCombo, DynamicDateHelper } from "../dynamicdate"; |
||||||
tabHeight: 40, |
import { TextButton, Tab } from "@/base"; |
||||||
buttonHeight: 24 |
import { DateCalendarPopup } from "../date/calendar"; |
||||||
}, |
import { DynamicDateTimeCombo } from "./dynamicdatetime.combo"; |
||||||
|
|
||||||
props: { |
@shortcut() |
||||||
|
export class DynamicDateTimePopup extends Widget { |
||||||
|
static xtype = "bi.dynamic_date_time_popup" |
||||||
|
|
||||||
|
props = { |
||||||
baseCls: "bi-dynamic-date-time-popup", |
baseCls: "bi-dynamic-date-time-popup", |
||||||
width: 272, |
width: 272, |
||||||
supportDynamic: true, |
supportDynamic: true, |
||||||
}, |
}; |
||||||
|
|
||||||
|
static EVENT_CHANGE = "EVENT_CHANGE" |
||||||
|
static BUTTON_OK_EVENT_CHANGE = "BUTTON_OK_EVENT_CHANGE" |
||||||
|
static BUTTON_lABEL_EVENT_CHANGE = "BUTTON_lABEL_EVENT_CHANGE" |
||||||
|
static BUTTON_CLEAR_EVENT_CHANGE = "BUTTON_CLEAR_EVENT_CHANGE" |
||||||
|
static EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW" |
||||||
|
|
||||||
_init: function () { |
_init() { |
||||||
BI.DynamicDateTimePopup.superclass._init.apply(this, arguments); |
super._init(...arguments); |
||||||
var self = this, opts = this.options, c = this.constants; |
const opts = this.options; |
||||||
this.storeValue = {type: BI.DynamicDateCombo.Static}; |
this.storeValue = { |
||||||
BI.createWidget({ |
type: DynamicDateCombo.Static, |
||||||
|
}; |
||||||
|
createWidget({ |
||||||
element: this, |
element: this, |
||||||
type: "bi.vertical", |
type: "bi.vertical", |
||||||
items: [{ |
items: [{ |
||||||
el: this._getTabJson() |
el: this._getTabJson(), |
||||||
}, { |
}, { |
||||||
el: { |
el: { |
||||||
type: "bi.grid", |
type: "bi.grid", |
||||||
items: [[{ |
items: [ |
||||||
type: "bi.text_button", |
[{ |
||||||
cls: "bi-high-light bi-split-top", |
type: "bi.text_button", |
||||||
textHeight: BI.toPix(BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, 1), |
cls: "bi-high-light bi-split-top", |
||||||
shadow: true, |
textHeight: toPix(BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, 1), |
||||||
text: BI.i18nText("BI-Basic_Clear"), |
shadow: true, |
||||||
listeners: [{ |
text: i18nText("BI-Basic_Clear"), |
||||||
eventName: BI.TextButton.EVENT_CHANGE, |
listeners: [{ |
||||||
action: function () { |
eventName: TextButton.EVENT_CHANGE, |
||||||
self.fireEvent(BI.DynamicDateTimePopup.BUTTON_CLEAR_EVENT_CHANGE); |
action: () => { |
||||||
} |
this.fireEvent(DynamicDateTimePopup.BUTTON_CLEAR_EVENT_CHANGE); |
||||||
}] |
}, |
||||||
}, { |
}], |
||||||
type: "bi.text_button", |
}, { |
||||||
cls: "bi-split-left bi-split-right bi-high-light bi-split-top", |
type: "bi.text_button", |
||||||
textHeight: BI.toPix(BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, 1), |
cls: "bi-split-left bi-split-right bi-high-light bi-split-top", |
||||||
shadow: true, |
textHeight: toPix(BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, 1), |
||||||
text: BI.i18nText("BI-Multi_Date_Today"), |
shadow: true, |
||||||
disabled: this._checkTodayValid(), |
text: i18nText("BI-Multi_Date_Today"), |
||||||
ref: function () { |
disabled: this._checkTodayValid(), |
||||||
self.todayButton = this; |
ref: _ref => { |
||||||
}, |
this.todayButton = _ref; |
||||||
listeners: [{ |
}, |
||||||
eventName: BI.TextButton.EVENT_CHANGE, |
listeners: [{ |
||||||
action: function () { |
eventName: TextButton.EVENT_CHANGE, |
||||||
self.fireEvent(BI.DynamicDateTimePopup.BUTTON_lABEL_EVENT_CHANGE); |
action: () => { |
||||||
} |
this.fireEvent(DynamicDateTimePopup.BUTTON_lABEL_EVENT_CHANGE); |
||||||
}] |
}, |
||||||
}, { |
}], |
||||||
type: "bi.text_button", |
}, { |
||||||
cls: "bi-high-light bi-split-top", |
type: "bi.text_button", |
||||||
textHeight: BI.toPix(BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, 1), |
cls: "bi-high-light bi-split-top", |
||||||
shadow: true, |
textHeight: toPix(BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, 1), |
||||||
text: BI.i18nText("BI-Basic_OK"), |
shadow: true, |
||||||
listeners: [{ |
text: i18nText("BI-Basic_OK"), |
||||||
eventName: BI.TextButton.EVENT_CHANGE, |
listeners: [{ |
||||||
action: function () { |
eventName: TextButton.EVENT_CHANGE, |
||||||
var type = self.dateTab.getSelect(); |
action: () => { |
||||||
if (type === BI.DynamicDateCombo.Dynamic) { |
const type = this.dateTab.getSelect(); |
||||||
self.dynamicPane.checkValidation(true) && self.fireEvent(BI.DynamicDateTimePopup.BUTTON_OK_EVENT_CHANGE); |
if (type === DynamicDateCombo.Dynamic) { |
||||||
} else { |
this.dynamicPane.checkValidation(true) && this.fireEvent(DynamicDateTimePopup.BUTTON_OK_EVENT_CHANGE); |
||||||
self.fireEvent(BI.DynamicDateTimePopup.BUTTON_OK_EVENT_CHANGE) |
} else { |
||||||
} |
this.fireEvent(DynamicDateTimePopup.BUTTON_OK_EVENT_CHANGE); |
||||||
} |
} |
||||||
|
}, |
||||||
|
}], |
||||||
}] |
}] |
||||||
}]], |
], |
||||||
height: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT |
height: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, |
||||||
} |
}, |
||||||
}] |
}], |
||||||
}); |
}); |
||||||
this.setValue(opts.value); |
this.setValue(opts.value); |
||||||
}, |
} |
||||||
|
|
||||||
_getTabJson: function () { |
_getTabJson() { |
||||||
var self = this, o = this.options; |
const o = this.options; |
||||||
|
|
||||||
return { |
return { |
||||||
type: "bi.tab", |
type: "bi.tab", |
||||||
logic: { |
logic: { |
||||||
dynamic: true |
dynamic: true, |
||||||
}, |
}, |
||||||
ref: function () { |
ref: _ref => { |
||||||
self.dateTab = this; |
this.dateTab = _ref; |
||||||
}, |
}, |
||||||
tab: { |
tab: { |
||||||
type: "bi.linear_segment", |
type: "bi.linear_segment", |
||||||
invisible: !o.supportDynamic, |
invisible: !o.supportDynamic, |
||||||
cls: "bi-split-bottom", |
cls: "bi-split-bottom", |
||||||
height: this.constants.tabHeight, |
height: this.constants.tabHeight, |
||||||
items: BI.createItems([{ |
items: createItems([{ |
||||||
text: BI.i18nText("BI-Multi_Date_YMD"), |
text: i18nText("BI-Multi_Date_YMD"), |
||||||
value: BI.DynamicDateCombo.Static |
value: DynamicDateCombo.Static, |
||||||
}, { |
}, { |
||||||
text: BI.i18nText("BI-Basic_Dynamic_Title"), |
text: i18nText("BI-Basic_Dynamic_Title"), |
||||||
value: BI.DynamicDateCombo.Dynamic |
value: DynamicDateCombo.Dynamic, |
||||||
}], { |
}], { |
||||||
textAlign: "center" |
textAlign: "center", |
||||||
}) |
}), |
||||||
}, |
}, |
||||||
cardCreator: function (v) { |
cardCreator: v => { |
||||||
switch (v) { |
switch (v) { |
||||||
case BI.DynamicDateCombo.Dynamic: |
case DynamicDateCombo.Dynamic: |
||||||
return { |
return { |
||||||
type: "bi.dynamic_date_card", |
type: "bi.dynamic_date_card", |
||||||
cls: "dynamic-date-pane", |
cls: "dynamic-date-pane", |
||||||
|
listeners: [{ |
||||||
|
eventName: "EVENT_CHANGE", |
||||||
|
action: () => { |
||||||
|
this._setInnerValue(this.year, v); |
||||||
|
}, |
||||||
|
}], |
||||||
|
ref: _ref => { |
||||||
|
this.dynamicPane = _ref; |
||||||
|
}, |
||||||
|
min: this.options.min, |
||||||
|
max: this.options.max, |
||||||
|
}; |
||||||
|
case DynamicDateCombo.Static: |
||||||
|
default: |
||||||
|
return { |
||||||
|
type: "bi.vertical", |
||||||
|
items: [{ |
||||||
|
type: "bi.date_calendar_popup", |
||||||
|
behaviors: o.behaviors, |
||||||
|
min: this.options.min, |
||||||
|
max: this.options.max, |
||||||
|
ref: _ref => { |
||||||
|
this.ymd = _ref; |
||||||
|
}, |
||||||
listeners: [{ |
listeners: [{ |
||||||
eventName: "EVENT_CHANGE", |
eventName: DateCalendarPopup.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW, |
||||||
action: function () { |
action: () => { |
||||||
self._setInnerValue(self.year, v); |
this.fireEvent(DynamicDateTimePopup.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); |
||||||
} |
}, |
||||||
}], |
}], |
||||||
ref: function () { |
}, { |
||||||
self.dynamicPane = this; |
el: { |
||||||
}, |
type: "bi.dynamic_date_time_select", |
||||||
min: self.options.min, |
cls: "bi-split-top", |
||||||
max: self.options.max, |
ref: _ref => { |
||||||
}; |
this.timeSelect = _ref; |
||||||
case BI.DynamicDateCombo.Static: |
|
||||||
default: |
|
||||||
return { |
|
||||||
type: "bi.vertical", |
|
||||||
items: [{ |
|
||||||
type: "bi.date_calendar_popup", |
|
||||||
behaviors: o.behaviors, |
|
||||||
min: self.options.min, |
|
||||||
max: self.options.max, |
|
||||||
ref: function () { |
|
||||||
self.ymd = this; |
|
||||||
}, |
}, |
||||||
listeners: [{ |
height: 40, |
||||||
eventName: BI.DateCalendarPopup.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW, |
}, |
||||||
action: function () { |
}], |
||||||
self.fireEvent(BI.DynamicDateTimePopup.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW); |
}; |
||||||
} |
|
||||||
}], |
|
||||||
}, { |
|
||||||
el: { |
|
||||||
type: "bi.dynamic_date_time_select", |
|
||||||
cls: "bi-split-top", |
|
||||||
ref: function () { |
|
||||||
self.timeSelect = this; |
|
||||||
}, |
|
||||||
height: 40 |
|
||||||
} |
|
||||||
}] |
|
||||||
}; |
|
||||||
} |
} |
||||||
}, |
}, |
||||||
listeners: [{ |
listeners: [{ |
||||||
eventName: BI.Tab.EVENT_CHANGE, |
eventName: Tab.EVENT_CHANGE, |
||||||
action: function () { |
action: () => { |
||||||
var v = self.dateTab.getSelect(); |
const v = this.dateTab.getSelect(); |
||||||
|
const date = DynamicDateHelper.getCalculation(this.dynamicPane.getValue()); |
||||||
switch (v) { |
switch (v) { |
||||||
case BI.DynamicDateCombo.Static: |
case DynamicDateCombo.Static: |
||||||
var date = BI.DynamicDateHelper.getCalculation(self.dynamicPane.getValue()); |
this.ymd.setValue({ |
||||||
self.ymd.setValue({ |
year: date.getFullYear(), |
||||||
year: date.getFullYear(), |
month: date.getMonth() + 1, |
||||||
month: date.getMonth() + 1, |
day: date.getDate(), |
||||||
day: date.getDate() |
}); |
||||||
|
this.timeSelect.setValue(); |
||||||
|
this._setInnerValue(); |
||||||
|
break; |
||||||
|
case DynamicDateCombo.Dynamic: |
||||||
|
default: |
||||||
|
if (this.storeValue && this.storeValue.type === DynamicDateCombo.Dynamic) { |
||||||
|
this.dynamicPane.setValue(this.storeValue.value); |
||||||
|
} else { |
||||||
|
this.dynamicPane.setValue({ |
||||||
|
year: 0, |
||||||
}); |
}); |
||||||
self.timeSelect.setValue(); |
} |
||||||
self._setInnerValue(); |
this._setInnerValue(); |
||||||
break; |
break; |
||||||
case BI.DynamicDateCombo.Dynamic: |
|
||||||
default: |
|
||||||
if(self.storeValue && self.storeValue.type === BI.DynamicDateCombo.Dynamic) { |
|
||||||
self.dynamicPane.setValue(self.storeValue.value); |
|
||||||
}else{ |
|
||||||
self.dynamicPane.setValue({ |
|
||||||
year: 0 |
|
||||||
}); |
|
||||||
} |
|
||||||
self._setInnerValue(); |
|
||||||
break; |
|
||||||
} |
} |
||||||
} |
}, |
||||||
}] |
}], |
||||||
}; |
}; |
||||||
}, |
} |
||||||
|
|
||||||
_setInnerValue: function () { |
_setInnerValue() { |
||||||
if (this.dateTab.getSelect() === BI.DynamicDateCombo.Static) { |
if (this.dateTab.getSelect() === DynamicDateCombo.Static) { |
||||||
this.todayButton.setValue(BI.i18nText("BI-Multi_Date_Today")); |
this.todayButton.setValue(i18nText("BI-Multi_Date_Today")); |
||||||
this.todayButton.setEnable(!this._checkTodayValid()); |
this.todayButton.setEnable(!this._checkTodayValid()); |
||||||
} else { |
} else { |
||||||
var date = BI.DynamicDateHelper.getCalculation(this.dynamicPane.getInputValue()); |
let date = DynamicDateHelper.getCalculation(this.dynamicPane.getInputValue()); |
||||||
date = BI.print(date, "%Y-%X-%d"); |
date = print(date, "%Y-%X-%d"); |
||||||
this.todayButton.setValue(date); |
this.todayButton.setValue(date); |
||||||
this.todayButton.setEnable(false); |
this.todayButton.setEnable(false); |
||||||
} |
} |
||||||
}, |
} |
||||||
|
|
||||||
_checkValueValid: function (value) { |
_checkValueValid(value) { |
||||||
return BI.isNull(value) || BI.isEmptyObject(value) || BI.isEmptyString(value); |
return isNull(value) || isEmptyObject(value) || isEmptyString(value); |
||||||
}, |
} |
||||||
|
|
||||||
_checkTodayValid: function () { |
_checkTodayValid() { |
||||||
var o = this.options; |
const o = this.options; |
||||||
var today = BI.getDate(); |
const today = getDate(); |
||||||
return !!BI.checkDateVoid(today.getFullYear(), today.getMonth() + 1, today.getDate(), o.min, o.max)[0]; |
|
||||||
}, |
return !!checkDateVoid(today.getFullYear(), today.getMonth() + 1, today.getDate(), o.min, o.max)[0]; |
||||||
|
} |
||||||
|
|
||||||
setMinDate: function (minDate) { |
setMinDate(minDate) { |
||||||
if (this.options.min !== minDate) { |
if (this.options.min !== minDate) { |
||||||
this.options.min = minDate; |
this.options.min = minDate; |
||||||
this.ymd.setMinDate(minDate); |
this.ymd.setMinDate(minDate); |
||||||
} |
} |
||||||
}, |
} |
||||||
|
|
||||||
setMaxDate: function (maxDate) { |
setMaxDate(maxDate) { |
||||||
if (this.options.max !== maxDate) { |
if (this.options.max !== maxDate) { |
||||||
this.options.max = maxDate; |
this.options.max = maxDate; |
||||||
this.ymd.setMaxDate(maxDate); |
this.ymd.setMaxDate(maxDate); |
||||||
} |
} |
||||||
}, |
} |
||||||
|
|
||||||
setValue: function (v) { |
setValue(v) { |
||||||
this.storeValue = v; |
this.storeValue = v; |
||||||
var self = this; |
|
||||||
var type, value; |
|
||||||
v = v || {}; |
v = v || {}; |
||||||
type = v.type || BI.DynamicDateCombo.Static; |
const type = v.type || DynamicDateCombo.Static; |
||||||
value = v.value || v; |
const value = v.value || v; |
||||||
this.dateTab.setSelect(type); |
this.dateTab.setSelect(type); |
||||||
switch (type) { |
switch (type) { |
||||||
case BI.DynamicDateCombo.Dynamic: |
case DynamicDateCombo.Dynamic: |
||||||
this.dynamicPane.setValue(value); |
this.dynamicPane.setValue(value); |
||||||
self._setInnerValue(); |
this._setInnerValue(); |
||||||
break; |
break; |
||||||
case BI.DynamicDateCombo.Static: |
case DynamicDateCombo.Static: |
||||||
default: |
default: |
||||||
if (this._checkValueValid(value)) { |
if (this._checkValueValid(value)) { |
||||||
var date = BI.getDate(); |
const date = getDate(); |
||||||
this.ymd.setValue({ |
this.ymd.setValue({ |
||||||
year: date.getFullYear(), |
year: date.getFullYear(), |
||||||
month: date.getMonth() + 1, |
month: date.getMonth() + 1, |
||||||
day: date.getDate() |
day: date.getDate(), |
||||||
}); |
}); |
||||||
this.timeSelect.setValue(); |
this.timeSelect.setValue(); |
||||||
this.todayButton.setValue(BI.i18nText("BI-Multi_Date_Today")); |
this.todayButton.setValue(i18nText("BI-Multi_Date_Today")); |
||||||
} else { |
} else { |
||||||
this.ymd.setValue(value); |
this.ymd.setValue(value); |
||||||
this.timeSelect.setValue({ |
this.timeSelect.setValue({ |
||||||
hour: value.hour, |
hour: value.hour, |
||||||
minute: value.minute, |
minute: value.minute, |
||||||
second: value.second |
second: value.second, |
||||||
}); |
}); |
||||||
this.todayButton.setValue(BI.i18nText("BI-Multi_Date_Today")); |
this.todayButton.setValue(i18nText("BI-Multi_Date_Today")); |
||||||
} |
} |
||||||
this.todayButton.setEnable(!this._checkTodayValid()); |
this.todayButton.setEnable(!this._checkTodayValid()); |
||||||
break; |
break; |
||||||
} |
} |
||||||
}, |
} |
||||||
|
|
||||||
getValue: function () { |
getValue() { |
||||||
var type = this.dateTab.getSelect(); |
const type = this.dateTab.getSelect(); |
||||||
|
|
||||||
return { |
return { |
||||||
type: type, |
type, |
||||||
value: type === BI.DynamicDateTimeCombo.Static ? BI.extend(this.ymd.getValue(), this.timeSelect.getValue()) : this.dynamicPane.getValue() |
value: type === DynamicDateTimeCombo.Static ? extend(this.ymd.getValue(), this.timeSelect.getValue()) : this.dynamicPane.getValue(), |
||||||
}; |
}; |
||||||
} |
} |
||||||
}); |
} |
||||||
BI.DynamicDateTimePopup.EVENT_CHANGE = "EVENT_CHANGE"; |
|
||||||
BI.DynamicDateTimePopup.BUTTON_OK_EVENT_CHANGE = "BUTTON_OK_EVENT_CHANGE"; |
|
||||||
BI.DynamicDateTimePopup.BUTTON_lABEL_EVENT_CHANGE = "BUTTON_lABEL_EVENT_CHANGE"; |
|
||||||
BI.DynamicDateTimePopup.BUTTON_CLEAR_EVENT_CHANGE = "BUTTON_CLEAR_EVENT_CHANGE"; |
|
||||||
BI.DynamicDateTimePopup.EVENT_BEFORE_YEAR_MONTH_POPUPVIEW = "EVENT_BEFORE_YEAR_MONTH_POPUPVIEW"; |
|
||||||
BI.shortcut("bi.dynamic_date_time_popup", BI.DynamicDateTimePopup); |
|
||||||
|
@ -0,0 +1,4 @@ |
|||||||
|
export { DynamicDateTimeSelect } from "./dynamicdatetime.timeselect"; |
||||||
|
export { DynamicDateTimeCombo } from "./dynamicdatetime.combo"; |
||||||
|
export { DynamicDateTimePopup } from "./dynamicdatetime.popup"; |
||||||
|
export { DynamicDateTimeTrigger } from "./dynamicdatetime.trigger"; |
@ -1,12 +1,30 @@ |
|||||||
import { Collapse } from "./collapse/collapse"; |
import { Collapse } from "./collapse/collapse"; |
||||||
import * as calendar from "./date/calendar"; |
import * as calendar from "./date/calendar"; |
||||||
|
import * as dynamicdate from "./dynamicdate"; |
||||||
|
import * as datepane from "./datepane"; |
||||||
|
import * as datetime from "./datetime"; |
||||||
|
import * as datetimepane from "./datetimepane"; |
||||||
|
import * as dynamicdatetime from "./dynamicdatetime"; |
||||||
|
import * as time from "./time"; |
||||||
|
|
||||||
Object.assign(BI, { |
Object.assign(BI, { |
||||||
Collapse, |
Collapse, |
||||||
...calendar, |
...calendar, |
||||||
|
...dynamicdate, |
||||||
|
...datepane, |
||||||
|
...datetime, |
||||||
|
...datetimepane, |
||||||
|
...dynamicdatetime, |
||||||
|
...time, |
||||||
}); |
}); |
||||||
|
|
||||||
export * from "./date/calendar"; |
export * from "./date/calendar"; |
||||||
|
export * from "./dynamicdate"; |
||||||
|
export * from "./datepane"; |
||||||
|
export * from "./datetime"; |
||||||
|
export * from "./datetimepane"; |
||||||
|
export * from "./dynamicdatetime"; |
||||||
|
export * from "./time"; |
||||||
export { |
export { |
||||||
Collapse |
Collapse |
||||||
}; |
}; |
||||||
|
@ -1,94 +1,102 @@ |
|||||||
!(function () { |
import { shortcut, Widget, i18nText, CenterAdaptLayout, GridLayout, isNull, isEmptyObject, isEmptyString } from "@/core"; |
||||||
BI.TimePopup = BI.inherit(BI.Widget, { |
import { TextButton } from "@/base"; |
||||||
props: { |
import { DynamicDateTimeSelect } from "../dynamicdatetime"; |
||||||
baseCls: "bi-date-time-popup", |
|
||||||
height: 68 |
|
||||||
}, |
|
||||||
render: function () { |
|
||||||
var self = this, o = this.options; |
|
||||||
|
|
||||||
return { |
@shortcut() |
||||||
type: "bi.vtape", |
export class TimePopup extends Widget { |
||||||
items: [{ |
static xtype = "bi.time_popup" |
||||||
el: { |
|
||||||
type: "bi.center_adapt", |
props = { |
||||||
cls: "bi-split-top", |
baseCls: "bi-date-time-popup", |
||||||
items: [{ |
height: 68, |
||||||
type: "bi.dynamic_date_time_select", |
}; |
||||||
value: o.value, |
|
||||||
ref: function (_ref) { |
static BUTTON_OK_EVENT_CHANGE = "BUTTON_OK_EVENT_CHANGE" |
||||||
self.timeSelect = _ref; |
static BUTTON_CLEAR_EVENT_CHANGE = "BUTTON_CLEAR_EVENT_CHANGE" |
||||||
} |
static BUTTON_NOW_EVENT_CHANGE = "BUTTON_NOW_EVENT_CHANGE" |
||||||
}] |
static CALENDAR_EVENT_CHANGE = "CALENDAR_EVENT_CHANGE" |
||||||
}, |
|
||||||
hgap: 10, |
render() { |
||||||
height: 44 |
const o = this.options; |
||||||
}, { |
|
||||||
el: { |
return { |
||||||
type: "bi.grid", |
type: "bi.vtape", |
||||||
items: [[{ |
items: [{ |
||||||
type: "bi.text_button", |
el: { |
||||||
|
type: CenterAdaptLayout.xtype, |
||||||
|
cls: "bi-split-top", |
||||||
|
items: [{ |
||||||
|
type: DynamicDateTimeSelect.xtype, |
||||||
|
value: o.value, |
||||||
|
ref: _ref => { |
||||||
|
this.timeSelect = _ref; |
||||||
|
}, |
||||||
|
}], |
||||||
|
}, |
||||||
|
hgap: 10, |
||||||
|
height: 44, |
||||||
|
}, { |
||||||
|
el: { |
||||||
|
type: GridLayout.xtype, |
||||||
|
items: [ |
||||||
|
[{ |
||||||
|
type: TextButton.xtype, |
||||||
cls: "bi-high-light bi-split-top", |
cls: "bi-high-light bi-split-top", |
||||||
shadow: true, |
shadow: true, |
||||||
text: BI.i18nText("BI-Basic_Clears"), |
text: i18nText("BI-Basic_Clears"), |
||||||
listeners: [{ |
listeners: [{ |
||||||
eventName: BI.TextButton.EVENT_CHANGE, |
eventName: TextButton.EVENT_CHANGE, |
||||||
action: function () { |
action: () => { |
||||||
self.fireEvent(BI.TimePopup.BUTTON_CLEAR_EVENT_CHANGE); |
this.fireEvent(TimePopup.BUTTON_CLEAR_EVENT_CHANGE); |
||||||
} |
}, |
||||||
}] |
}], |
||||||
}, { |
}, { |
||||||
type: "bi.text_button", |
type: TextButton.xtype, |
||||||
cls: "bi-split-left bi-split-right bi-high-light bi-split-top", |
cls: "bi-split-left bi-split-right bi-high-light bi-split-top", |
||||||
shadow: true, |
shadow: true, |
||||||
text: BI.i18nText("BI-Basic_Now"), |
text: i18nText("BI-Basic_Now"), |
||||||
listeners: [{ |
listeners: [{ |
||||||
eventName: BI.TextButton.EVENT_CHANGE, |
eventName: TextButton.EVENT_CHANGE, |
||||||
action: function () { |
action: () => { |
||||||
self.fireEvent(BI.TimePopup.BUTTON_NOW_EVENT_CHANGE); |
this.fireEvent(TimePopup.BUTTON_NOW_EVENT_CHANGE); |
||||||
} |
}, |
||||||
}] |
}], |
||||||
}, { |
}, { |
||||||
type: "bi.text_button", |
type: TextButton.xtype, |
||||||
cls: "bi-high-light bi-split-top", |
cls: "bi-high-light bi-split-top", |
||||||
shadow: true, |
shadow: true, |
||||||
text: BI.i18nText("BI-Basic_OK"), |
text: i18nText("BI-Basic_OK"), |
||||||
listeners: [{ |
listeners: [{ |
||||||
eventName: BI.TextButton.EVENT_CHANGE, |
eventName: TextButton.EVENT_CHANGE, |
||||||
action: function () { |
action: () => { |
||||||
self.fireEvent(BI.TimePopup.BUTTON_OK_EVENT_CHANGE); |
this.fireEvent(TimePopup.BUTTON_OK_EVENT_CHANGE); |
||||||
} |
}, |
||||||
}] |
}], |
||||||
}]] |
}] |
||||||
}, |
], |
||||||
height: 24 |
}, |
||||||
}] |
height: 24, |
||||||
}; |
}], |
||||||
}, |
}; |
||||||
|
} |
||||||
|
|
||||||
setValue: function (value) { |
setValue(value) { |
||||||
if (this._checkValueValid(value)) { |
if (this._checkValueValid(value)) { |
||||||
this.timeSelect.setValue(); |
this.timeSelect.setValue(); |
||||||
} else { |
} else { |
||||||
this.timeSelect.setValue({ |
this.timeSelect.setValue({ |
||||||
hour: value.hour, |
hour: value.hour, |
||||||
minute: value.minute, |
minute: value.minute, |
||||||
second: value.second |
second: value.second, |
||||||
}); |
}); |
||||||
} |
} |
||||||
}, |
} |
||||||
|
|
||||||
getValue: function () { |
getValue() { |
||||||
return this.timeSelect.getValue(); |
return this.timeSelect.getValue(); |
||||||
}, |
} |
||||||
|
|
||||||
_checkValueValid: function (value) { |
_checkValueValid(value) { |
||||||
return BI.isNull(value) || BI.isEmptyObject(value) || BI.isEmptyString(value); |
return isNull(value) || isEmptyObject(value) || isEmptyString(value); |
||||||
} |
} |
||||||
}); |
} |
||||||
BI.TimePopup.BUTTON_OK_EVENT_CHANGE = "BUTTON_OK_EVENT_CHANGE"; |
|
||||||
BI.TimePopup.BUTTON_CLEAR_EVENT_CHANGE = "BUTTON_CLEAR_EVENT_CHANGE"; |
|
||||||
BI.TimePopup.BUTTON_NOW_EVENT_CHANGE = "BUTTON_NOW_EVENT_CHANGE"; |
|
||||||
BI.TimePopup.CALENDAR_EVENT_CHANGE = "CALENDAR_EVENT_CHANGE"; |
|
||||||
BI.shortcut("bi.time_popup", BI.TimePopup); |
|
||||||
})(); |
|
||||||
|
@ -0,0 +1,3 @@ |
|||||||
|
export { TimePopup } from "./datetime.popup"; |
||||||
|
export { TimeCombo } from "./time.combo"; |
||||||
|
export { TimeTrigger } from "./time.trigger"; |
@ -1,247 +1,245 @@ |
|||||||
/** |
import { shortcut, toPix, getDate, isNotEmptyString, isEqual, isEmptyString, AbsoluteLayout } from "@/core"; |
||||||
* 时间选择 |
import { Single, IconButton, Combo } from "@/base"; |
||||||
* qcc |
import { TimePopup } from "./datetime.popup"; |
||||||
* 2019/2/28 |
|
||||||
*/ |
|
||||||
|
|
||||||
!(function () { |
@shortcut() |
||||||
BI.TimeCombo = BI.inherit(BI.Single, { |
export class TimeCombo extends Single { |
||||||
constants: { |
static xtype = "bi.time_combo" |
||||||
popupHeight: 80, |
|
||||||
popupWidth: 240, |
|
||||||
comboAdjustHeight: 1, |
|
||||||
border: 1, |
|
||||||
iconWidth: 24 |
|
||||||
}, |
|
||||||
props: { |
|
||||||
baseCls: "bi-time-combo", |
|
||||||
height: 24, |
|
||||||
format: "", |
|
||||||
allowEdit: false, |
|
||||||
isNeedAdjustHeight: false, |
|
||||||
isNeedAdjustWidth: false |
|
||||||
}, |
|
||||||
|
|
||||||
_init: function () { |
static EVENT_KEY_DOWN = "EVENT_KEY_DOWN" |
||||||
var o = this.options; |
static EVENT_CONFIRM = "EVENT_CONFIRM" |
||||||
BI.TimeCombo.superclass._init.apply(this, arguments); |
static EVENT_CHANGE = "EVENT_CHANGE" |
||||||
}, |
static EVENT_VALID = "EVENT_VALID" |
||||||
|
static EVENT_ERROR = "EVENT_ERROR" |
||||||
|
static EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW" |
||||||
|
|
||||||
render: function () { |
constants = { |
||||||
var self = this, opts = this.options; |
popupHeight: 80, |
||||||
this.storeTriggerValue = ""; |
popupWidth: 240, |
||||||
this.storeValue = opts.value; |
comboAdjustHeight: 1, |
||||||
|
border: 1, |
||||||
|
iconWidth: 24, |
||||||
|
} |
||||||
|
|
||||||
var popup = { |
props = { |
||||||
type: "bi.time_popup", |
baseCls: "bi-time-combo", |
||||||
value: opts.value, |
height: 24, |
||||||
listeners: [{ |
format: "", |
||||||
eventName: BI.TimePopup.BUTTON_CLEAR_EVENT_CHANGE, |
allowEdit: false, |
||||||
action: function () { |
isNeedAdjustHeight: false, |
||||||
self.setValue(); |
isNeedAdjustWidth: false, |
||||||
self.hidePopupView(); |
}; |
||||||
self.fireEvent(BI.TimeCombo.EVENT_CONFIRM); |
|
||||||
} |
_init() { |
||||||
}, { |
super._init(...arguments); |
||||||
eventName: BI.TimePopup.BUTTON_OK_EVENT_CHANGE, |
} |
||||||
action: function () { |
|
||||||
self.setValue(self.popup.getValue()); |
render() { |
||||||
self.hidePopupView(); |
const opts = this.options; |
||||||
self.fireEvent(BI.TimeCombo.EVENT_CONFIRM); |
this.storeTriggerValue = ""; |
||||||
} |
this.storeValue = opts.value; |
||||||
}, { |
|
||||||
eventName: BI.TimePopup.BUTTON_NOW_EVENT_CHANGE, |
const popup = { |
||||||
action: function () { |
type: "bi.time_popup", |
||||||
self._setNowTime(); |
value: opts.value, |
||||||
} |
listeners: [{ |
||||||
}], |
eventName: TimePopup.BUTTON_CLEAR_EVENT_CHANGE, |
||||||
ref: function (_ref) { |
action: () => { |
||||||
self.popup = _ref; |
this.setValue(); |
||||||
} |
this.hidePopupView(); |
||||||
}; |
this.fireEvent(TimeCombo.EVENT_CONFIRM); |
||||||
return { |
}, |
||||||
type: "bi.absolute", |
}, { |
||||||
items: [{ |
eventName: TimePopup.BUTTON_OK_EVENT_CHANGE, |
||||||
|
action: () => { |
||||||
|
this.setValue(this.popup.getValue()); |
||||||
|
this.hidePopupView(); |
||||||
|
this.fireEvent(TimeCombo.EVENT_CONFIRM); |
||||||
|
}, |
||||||
|
}, { |
||||||
|
eventName: TimePopup.BUTTON_NOW_EVENT_CHANGE, |
||||||
|
action: () => { |
||||||
|
this._setNowTime(); |
||||||
|
}, |
||||||
|
}], |
||||||
|
ref: _ref => { |
||||||
|
this.popup = _ref; |
||||||
|
}, |
||||||
|
}; |
||||||
|
|
||||||
|
return { |
||||||
|
type: AbsoluteLayout.xtype, |
||||||
|
items: [{ |
||||||
|
el: { |
||||||
|
type: Combo.xtype, |
||||||
|
cls: "bi-border bi-border-radius", |
||||||
|
container: opts.container, |
||||||
|
toggle: false, |
||||||
|
isNeedAdjustHeight: opts.isNeedAdjustHeight, |
||||||
|
isNeedAdjustWidth: opts.isNeedAdjustWidth, |
||||||
el: { |
el: { |
||||||
type: "bi.combo", |
type: "bi.horizontal_fill", |
||||||
cls: "bi-border bi-border-radius", |
columnSize: ["fill", this.constants.iconWidth], |
||||||
container: opts.container, |
height: toPix(opts.height, 2), |
||||||
toggle: false, |
items: [{ |
||||||
isNeedAdjustHeight: opts.isNeedAdjustHeight, |
type: "bi.time_trigger", |
||||||
isNeedAdjustWidth: opts.isNeedAdjustWidth, |
height: toPix(opts.height, 2), |
||||||
el: { |
allowEdit: opts.allowEdit, |
||||||
type: "bi.horizontal_fill", |
watermark: opts.watermark, |
||||||
columnSize: ["fill", this.constants.iconWidth], |
format: opts.format, |
||||||
height: BI.toPix(opts.height, 2), |
value: opts.value, |
||||||
items: [{ |
ref: _ref => { |
||||||
type: "bi.time_trigger", |
this.trigger = _ref; |
||||||
height: BI.toPix(opts.height, 2), |
}, |
||||||
allowEdit: opts.allowEdit, |
listeners: [{ |
||||||
watermark: opts.watermark, |
eventName: "EVENT_KEY_DOWN", |
||||||
format: opts.format, |
action: () => { |
||||||
value: opts.value, |
if (this.combo.isViewVisible()) { |
||||||
ref: function (_ref) { |
this.combo.hideView(); |
||||||
self.trigger = _ref; |
|
||||||
}, |
|
||||||
listeners: [{ |
|
||||||
eventName: "EVENT_KEY_DOWN", |
|
||||||
action: function () { |
|
||||||
if (self.combo.isViewVisible()) { |
|
||||||
self.combo.hideView(); |
|
||||||
} |
|
||||||
self.fireEvent(BI.TimeCombo.EVENT_KEY_DOWN, arguments); |
|
||||||
} |
|
||||||
}, { |
|
||||||
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"); |
|
||||||
} |
} |
||||||
}, { |
this.fireEvent(TimeCombo.EVENT_KEY_DOWN, arguments); |
||||||
eventName: "EVENT_BLUR", |
}, |
||||||
action: function () { |
}, { |
||||||
self.fireEvent("EVENT_BLUR"); |
eventName: "EVENT_STOP", |
||||||
} |
action: () => { |
||||||
}, { |
if (!this.combo.isViewVisible()) { |
||||||
eventName: "EVENT_ERROR", |
this.combo.showView(); |
||||||
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 () { |
eventName: "EVENT_FOCUS", |
||||||
if (self.combo.isViewVisible()) { |
action: () => { |
||||||
return; |
this.storeTriggerValue = this.trigger.getKey(); |
||||||
} |
if (!this.combo.isViewVisible()) { |
||||||
var dateStore = self.storeTriggerValue; |
this.combo.showView(); |
||||||
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"); |
|
||||||
} |
} |
||||||
}] |
this.fireEvent("EVENT_FOCUS"); |
||||||
|
}, |
||||||
}, { |
}, { |
||||||
el: { |
eventName: "EVENT_BLUR", |
||||||
type: "bi.icon_button", |
action: () => { |
||||||
cls: "bi-trigger-icon-button time-font", |
this.fireEvent("EVENT_BLUR"); |
||||||
width: this.constants.iconWidth, |
}, |
||||||
listeners: [{ |
}, { |
||||||
eventName: BI.IconButton.EVENT_CHANGE, |
eventName: "EVENT_ERROR", |
||||||
action: function () { |
action: () => { |
||||||
if (self.combo.isViewVisible()) { |
const date = getDate(); |
||||||
// self.combo.hideView();
|
this.storeValue = { |
||||||
} else { |
hour: date.getHours(), |
||||||
self.combo.showView(); |
minute: date.getMinutes(), |
||||||
} |
second: date.getSeconds(), |
||||||
} |
}; |
||||||
}], |
this.fireEvent("EVENT_ERROR"); |
||||||
ref: function (_ref) { |
}, |
||||||
self.triggerBtn = _ref; |
}, { |
||||||
|
eventName: "EVENT_VALID", |
||||||
|
action: () => { |
||||||
|
this.fireEvent("EVENT_VALID"); |
||||||
|
}, |
||||||
|
}, { |
||||||
|
eventName: "EVENT_CHANGE", |
||||||
|
action: () => { |
||||||
|
this.fireEvent("EVENT_CHANGE"); |
||||||
|
}, |
||||||
|
}, { |
||||||
|
eventName: "EVENT_CONFIRM", |
||||||
|
action: () => { |
||||||
|
if (this.combo.isViewVisible()) { |
||||||
|
return; |
||||||
|
} |
||||||
|
const dateStore = this.storeTriggerValue; |
||||||
|
const dateObj = this.trigger.getKey(); |
||||||
|
if (isNotEmptyString(dateObj) && !isEqual(dateObj, dateStore)) { |
||||||
|
this.storeValue = this.trigger.getValue(); |
||||||
|
this.setValue(this.trigger.getValue()); |
||||||
|
} else if (isEmptyString(dateObj)) { |
||||||
|
this.storeValue = null; |
||||||
|
this.trigger.setValue(); |
||||||
} |
} |
||||||
|
this.fireEvent("EVENT_CONFIRM"); |
||||||
}, |
}, |
||||||
}], |
}], |
||||||
}, |
}, { |
||||||
adjustLength: this.constants.comboAdjustHeight, |
el: { |
||||||
popup: { |
type: IconButton.xtype, |
||||||
el: popup, |
cls: "bi-trigger-icon-button time-font", |
||||||
width: opts.isNeedAdjustWidth ? opts.width : this.constants.popupWidth, |
width: this.constants.iconWidth, |
||||||
stopPropagation: false |
listeners: [{ |
||||||
}, |
eventName: IconButton.EVENT_CHANGE, |
||||||
hideChecker: function (e) { |
action: () => { |
||||||
return self.triggerBtn.element.find(e.target).length === 0; |
if (this.combo.isViewVisible()) { |
||||||
}, |
// this.combo.hideView();
|
||||||
listeners: [{ |
} else { |
||||||
eventName: BI.Combo.EVENT_BEFORE_POPUPVIEW, |
this.combo.showView(); |
||||||
action: function () { |
} |
||||||
self.popup.setValue(self.storeValue); |
}, |
||||||
self.fireEvent(BI.TimeCombo.EVENT_BEFORE_POPUPVIEW); |
}], |
||||||
} |
ref: _ref => { |
||||||
|
this.triggerBtn = _ref; |
||||||
|
}, |
||||||
|
}, |
||||||
}], |
}], |
||||||
ref: function (_ref) { |
|
||||||
self.combo = _ref; |
|
||||||
} |
|
||||||
}, |
}, |
||||||
top: 0, |
adjustLength: this.constants.comboAdjustHeight, |
||||||
left: 0, |
popup: { |
||||||
right: 0, |
el: popup, |
||||||
bottom: 0 |
width: opts.isNeedAdjustWidth ? opts.width : this.constants.popupWidth, |
||||||
}] |
stopPropagation: false, |
||||||
}; |
}, |
||||||
}, |
hideChecker: e => this.triggerBtn.element.find(e.target).length === 0, |
||||||
|
listeners: [{ |
||||||
|
eventName: Combo.EVENT_BEFORE_POPUPVIEW, |
||||||
|
action: () => { |
||||||
|
this.popup.setValue(this.storeValue); |
||||||
|
this.fireEvent(TimeCombo.EVENT_BEFORE_POPUPVIEW); |
||||||
|
}, |
||||||
|
}], |
||||||
|
ref: _ref => { |
||||||
|
this.combo = _ref; |
||||||
|
}, |
||||||
|
}, |
||||||
|
top: 0, |
||||||
|
left: 0, |
||||||
|
right: 0, |
||||||
|
bottom: 0, |
||||||
|
}], |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
setValue: function (v) { |
setValue(v) { |
||||||
this.storeValue = v; |
this.storeValue = v; |
||||||
this.trigger.setValue(v); |
this.trigger.setValue(v); |
||||||
}, |
} |
||||||
getValue: function () { |
|
||||||
return this.storeValue; |
|
||||||
}, |
|
||||||
|
|
||||||
hidePopupView: function () { |
getValue() { |
||||||
this.combo.hideView(); |
return this.storeValue; |
||||||
}, |
} |
||||||
|
|
||||||
_setNowTime: function () { |
hidePopupView() { |
||||||
var date = BI.getDate(); |
this.combo.hideView(); |
||||||
var nowTome = { |
} |
||||||
hour: date.getHours(), |
|
||||||
minute: date.getMinutes(), |
|
||||||
second: date.getSeconds() |
|
||||||
}; |
|
||||||
this.setValue(nowTome); |
|
||||||
this.hidePopupView(); |
|
||||||
this.fireEvent(BI.TimeCombo.EVENT_CONFIRM); |
|
||||||
}, |
|
||||||
|
|
||||||
focus: function () { |
_setNowTime() { |
||||||
this.trigger.focus(); |
const date = getDate(); |
||||||
}, |
const nowTome = { |
||||||
|
hour: date.getHours(), |
||||||
|
minute: date.getMinutes(), |
||||||
|
second: date.getSeconds(), |
||||||
|
}; |
||||||
|
this.setValue(nowTome); |
||||||
|
this.hidePopupView(); |
||||||
|
this.fireEvent(TimeCombo.EVENT_CONFIRM); |
||||||
|
} |
||||||
|
|
||||||
blur: function () { |
focus() { |
||||||
this.trigger.blur(); |
this.trigger.focus(); |
||||||
}, |
} |
||||||
|
|
||||||
setWaterMark: function (v) { |
blur() { |
||||||
this.trigger.setWaterMark(v); |
this.trigger.blur(); |
||||||
} |
} |
||||||
}); |
|
||||||
|
|
||||||
BI.TimeCombo.EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; |
setWaterMark(v) { |
||||||
BI.TimeCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; |
this.trigger.setWaterMark(v); |
||||||
BI.TimeCombo.EVENT_CHANGE = "EVENT_CHANGE"; |
} |
||||||
BI.TimeCombo.EVENT_VALID = "EVENT_VALID"; |
} |
||||||
BI.TimeCombo.EVENT_ERROR = "EVENT_ERROR"; |
|
||||||
BI.TimeCombo.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; |
|
||||||
BI.shortcut("bi.time_combo", BI.TimeCombo); |
|
||||||
})(); |
|
||||||
|
@ -1,202 +1,193 @@ |
|||||||
!(function () { |
import { shortcut, i18nText, bind, isNotNull, isNotEmptyString, isEqual, AbsoluteLayout, any, print, parseDateTime, isEmptyObject, getDate, isNotEmptyObject } from "@/core"; |
||||||
BI.TimeTrigger = BI.inherit(BI.Trigger, { |
import { Trigger, Text } from "@/base"; |
||||||
|
import { SignEditor } from "@/case"; |
||||||
|
|
||||||
_const: { |
@shortcut() |
||||||
COMPARE_FORMAT: "%H:%M:%S", |
export class TimeTrigger extends Trigger { |
||||||
COMPLETE_COMPARE_FORMAT: "%Y-%M-%d %H:%M:%S %P", |
static xtype = "bi.time_trigger" |
||||||
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
|
|
||||||
"%H:%M:%S %p", // HH:mm:ss a
|
|
||||||
"%H:%M:%S %P", // HH: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", |
|
||||||
DEFAULT_HOUR: "00" |
|
||||||
}, |
|
||||||
|
|
||||||
props: () => ({ |
_const = { |
||||||
|
COMPARE_FORMAT: "%H:%M:%S", |
||||||
|
COMPLETE_COMPARE_FORMAT: "%Y-%M-%d %H:%M:%S %P", |
||||||
|
FORMAT_ARRAY: ["%H:%M:%S", "%I:%M:%S", "%l:%M:%S", "%k:%M:%S", "%l:%M:%S %p", "%l:%M:%S %P", "%H:%M:%S %p", "%H:%M:%S %P", "%l:%M", "%k:%M", "%I:%M", "%H:%M", "%M:%S"], |
||||||
|
DEFAULT_DATE_STRING: "2000-01-01", |
||||||
|
DEFAULT_HOUR: "00", |
||||||
|
}; |
||||||
|
|
||||||
|
props() { |
||||||
|
return { |
||||||
extraCls: "bi-time-trigger", |
extraCls: "bi-time-trigger", |
||||||
value: {}, |
value: {}, |
||||||
format: "", |
format: "", |
||||||
allowEdit: false, |
allowEdit: false, |
||||||
watermark: BI.i18nText("BI-Basic_Unrestricted"), |
watermark: i18nText("BI-Basic_Unrestricted"), |
||||||
}), |
}; |
||||||
|
} |
||||||
|
|
||||||
render: function () { |
render() { |
||||||
var self = this, o = this.options; |
const o = this.options; |
||||||
this.storeTriggerValue = ""; |
this.storeTriggerValue = ""; |
||||||
this.storeValue = o.value; |
this.storeValue = o.value; |
||||||
return { |
|
||||||
type: "bi.absolute", |
return { |
||||||
items: [{ |
type: AbsoluteLayout.xtype, |
||||||
el: { |
items: [{ |
||||||
type: "bi.sign_editor", |
el: { |
||||||
height: o.height, |
type: SignEditor.xtype, |
||||||
validationChecker: function (v) { |
height: o.height, |
||||||
return self._dateCheck(v); |
validationChecker: v => this._dateCheck(v), |
||||||
|
quitChecker () { |
||||||
|
return false; |
||||||
|
}, |
||||||
|
ref: _ref => { |
||||||
|
this.editor = _ref; |
||||||
|
}, |
||||||
|
value: this._formatValue(o.value), |
||||||
|
hgap: 4, |
||||||
|
allowBlank: true, |
||||||
|
watermark: o.watermark, |
||||||
|
title: bind(this._getTitle, this), |
||||||
|
listeners: [{ |
||||||
|
eventName: "EVENT_KEY_DOWN", |
||||||
|
action: (...args) => { |
||||||
|
this.fireEvent("EVENT_KEY_DOWN", ...args); |
||||||
}, |
}, |
||||||
quitChecker: function () { |
}, { |
||||||
return false; |
eventName: "EVENT_FOCUS", |
||||||
|
action: () => { |
||||||
|
this.storeTriggerValue = this.getKey(); |
||||||
|
this.fireEvent("EVENT_FOCUS"); |
||||||
}, |
}, |
||||||
ref: function (_ref) { |
}, { |
||||||
self.editor = _ref; |
eventName: "EVENT_BLUR", |
||||||
|
action: () => { |
||||||
|
this.fireEvent("EVENT_BLUR"); |
||||||
}, |
}, |
||||||
value: this._formatValue(o.value), |
}, { |
||||||
hgap: 4, |
eventName: "EVENT_STOP", |
||||||
allowBlank: true, |
action: () => { |
||||||
watermark: o.watermark, |
this.fireEvent("EVENT_STOP"); |
||||||
title: BI.bind(this._getTitle, this), |
}, |
||||||
listeners: [{ |
}, { |
||||||
eventName: "EVENT_KEY_DOWN", |
eventName: "EVENT_VALID", |
||||||
action: function () { |
action: () => { |
||||||
self.fireEvent("EVENT_KEY_DOWN", arguments); |
this.fireEvent("EVENT_VALID"); |
||||||
} |
}, |
||||||
}, { |
}, { |
||||||
eventName: "EVENT_FOCUS", |
eventName: "EVENT_ERROR", |
||||||
action: function () { |
action: () => { |
||||||
self.storeTriggerValue = self.getKey(); |
this.fireEvent("EVENT_ERROR"); |
||||||
self.fireEvent("EVENT_FOCUS"); |
}, |
||||||
} |
}, { |
||||||
}, { |
eventName: "EVENT_CONFIRM", |
||||||
eventName: "EVENT_BLUR", |
action: () => { |
||||||
action: function () { |
const value = this.editor.getValue(); |
||||||
self.fireEvent("EVENT_BLUR"); |
if (isNotNull(value)) { |
||||||
} |
this.editor.setState(value); |
||||||
}, { |
|
||||||
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"); |
|
||||||
} |
} |
||||||
}, { |
if (isNotEmptyString(value) && !isEqual(this.storeTriggerValue, this.getKey())) { |
||||||
eventName: "EVENT_CHANGE", |
const date = value.match(/\d+/g); |
||||||
action: function () { |
this.storeValue = { |
||||||
self.fireEvent("EVENT_CHANGE"); |
hour: date[0] | 0, |
||||||
|
minute: date[1] | 0, |
||||||
|
second: date[2] | 0, |
||||||
|
}; |
||||||
} |
} |
||||||
}] |
this.fireEvent("EVENT_CONFIRM"); |
||||||
}, |
}, |
||||||
left: 0, |
}, { |
||||||
right: 0, |
eventName: "EVENT_START", |
||||||
top: 0, |
action: () => { |
||||||
bottom: 0 |
this.fireEvent("EVENT_START"); |
||||||
}, { |
}, |
||||||
el: { |
}, { |
||||||
type: "bi.text", |
eventName: "EVENT_CHANGE", |
||||||
invisible: o.allowEdit, |
action: () => { |
||||||
cls: "show-text", |
this.fireEvent("EVENT_CHANGE"); |
||||||
title: BI.bind(this._getTitle, this), |
}, |
||||||
hgap: 4 |
}], |
||||||
}, |
}, |
||||||
left: 0, |
left: 0, |
||||||
right: 0, |
right: 0, |
||||||
top: 0, |
top: 0, |
||||||
bottom: 0 |
bottom: 0, |
||||||
}] |
}, { |
||||||
}; |
el: { |
||||||
}, |
type: Text.xtype, |
||||||
|
invisible: o.allowEdit, |
||||||
|
cls: "show-text", |
||||||
|
title: bind(this._getTitle, this), |
||||||
|
hgap: 4, |
||||||
|
}, |
||||||
|
left: 0, |
||||||
|
right: 0, |
||||||
|
top: 0, |
||||||
|
bottom: 0, |
||||||
|
}], |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
_dateCheck: function (date) { |
_dateCheck(date) { |
||||||
var c = this._const; |
const c = this._const; |
||||||
var self = this; |
|
||||||
return BI.any(c.FORMAT_ARRAY, function (idx, format) { |
return any(c.FORMAT_ARRAY, (idx, format) => print(parseDateTime(`${c.DEFAULT_DATE_STRING} ${this._getCompleteHMS(date, format)}`, c.COMPLETE_COMPARE_FORMAT), format) === date); |
||||||
return BI.print(BI.parseDateTime(c.DEFAULT_DATE_STRING + " " + self._getCompleteHMS(date, format), c.COMPLETE_COMPARE_FORMAT), format) === date; |
} |
||||||
}); |
|
||||||
}, |
|
||||||
|
|
||||||
_getCompleteHMS: function (str, format) { |
_getCompleteHMS(str, format) { |
||||||
var c = this._const; |
const c = this._const; |
||||||
switch (format) { |
switch (format) { |
||||||
case "%M:%S": |
case "%M:%S": |
||||||
str = c.DEFAULT_HOUR + ":" + str; |
str = `${c.DEFAULT_HOUR}:${str}`; |
||||||
break; |
break; |
||||||
default: |
default: |
||||||
break; |
break; |
||||||
} |
} |
||||||
return str; |
|
||||||
}, |
return str; |
||||||
|
} |
||||||
|
|
||||||
_getTitle: function () { |
_getTitle() { |
||||||
var storeValue = this.storeValue || {}; |
const storeValue = this.storeValue || {}; |
||||||
if (BI.isEmptyObject(storeValue)) { |
if (isEmptyObject(storeValue)) { |
||||||
return this.options.watermark; |
return this.options.watermark; |
||||||
} |
} |
||||||
var date = BI.getDate(); |
const date = getDate(); |
||||||
return BI.print(BI.getDate(date.getFullYear(), 0, 1, storeValue.hour, storeValue.minute, storeValue.second), this._getFormatString()); |
|
||||||
}, |
return print(getDate(date.getFullYear(), 0, 1, storeValue.hour, storeValue.minute, storeValue.second), this._getFormatString()); |
||||||
|
} |
||||||
|
|
||||||
_getFormatString: function () { |
_getFormatString() { |
||||||
return this.options.format || this._const.COMPARE_FORMAT; |
return this.options.format || this._const.COMPARE_FORMAT; |
||||||
}, |
} |
||||||
|
|
||||||
_formatValue: function (v) { |
_formatValue(v) { |
||||||
var now = BI.getDate(); |
const now = getDate(); |
||||||
return BI.isNotEmptyObject(v) ? BI.print(BI.getDate(now.getFullYear(), now.getMonth(), now.getDay(), v.hour, v.minute, v.second), this._getFormatString()) : ""; |
|
||||||
}, |
return isNotEmptyObject(v) ? print(getDate(now.getFullYear(), now.getMonth(), now.getDay(), v.hour, v.minute, v.second), this._getFormatString()) : ""; |
||||||
|
} |
||||||
|
|
||||||
getKey: function () { |
getKey() { |
||||||
return this.editor.getValue(); |
return this.editor.getValue(); |
||||||
}, |
} |
||||||
|
|
||||||
setValue: function (v) { |
setValue(v) { |
||||||
this.storeValue = v; |
this.storeValue = v; |
||||||
this.editor.setValue(this._formatValue(v)); |
this.editor.setValue(this._formatValue(v)); |
||||||
}, |
} |
||||||
|
|
||||||
getValue: function () { |
getValue() { |
||||||
return this.storeValue; |
return this.storeValue; |
||||||
}, |
} |
||||||
|
|
||||||
focus: function () { |
focus() { |
||||||
this.editor.focus(); |
this.editor.focus(); |
||||||
}, |
} |
||||||
|
|
||||||
blur: function () { |
blur() { |
||||||
this.editor.blur(); |
this.editor.blur(); |
||||||
}, |
} |
||||||
|
|
||||||
setWaterMark: function (v) { |
setWaterMark(v) { |
||||||
this.editor.setWaterMark(v); |
this.editor.setWaterMark(v); |
||||||
} |
} |
||||||
}); |
} |
||||||
BI.shortcut("bi.time_trigger", BI.TimeTrigger); |
|
||||||
})(); |
|
||||||
|
Loading…
Reference in new issue