forked from fanruan/fineui
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
112 lines
3.4 KiB
112 lines
3.4 KiB
import { shortcut, Widget, deepClone } from "@/core"; |
|
import { Msg } from "@/base"; |
|
|
|
@shortcut() |
|
export class TimeInterval extends Widget { |
|
static xtype = "demo.time_interval"; |
|
|
|
props = { baseCls: "" }; |
|
|
|
render() { |
|
const self = this; |
|
const items = deepClone(Demo.CONSTANTS.TREE); |
|
|
|
return { |
|
type: "bi.horizontal_auto", |
|
items: [ |
|
{ |
|
type: "bi.date_interval", |
|
ref(_ref) { |
|
self.dateInterval = _ref; |
|
}, |
|
value: { |
|
start: { |
|
type: 2, |
|
value: { |
|
year: -1, |
|
position: 2, |
|
}, |
|
}, |
|
end: { |
|
type: 1, |
|
value: { |
|
year: 2018, |
|
month: 1, |
|
day: 12, |
|
}, |
|
}, |
|
}, |
|
width: 300, |
|
}, |
|
{ |
|
type: "bi.button", |
|
text: "getValue", |
|
handler() { |
|
Msg.toast(JSON.stringify(self.dateInterval.getValue())); |
|
}, |
|
width: 300, |
|
}, |
|
{ |
|
type: "bi.time_interval", |
|
ref(_ref) { |
|
self.interval = _ref; |
|
}, |
|
value: { |
|
start: { |
|
type: 2, |
|
value: { |
|
year: -1, |
|
position: 2, |
|
}, |
|
}, |
|
end: { |
|
type: 1, |
|
value: { |
|
year: 2018, |
|
month: 1, |
|
day: 12, |
|
}, |
|
}, |
|
}, |
|
width: 400, |
|
}, |
|
{ |
|
type: "bi.button", |
|
text: "getValue", |
|
handler() { |
|
Msg.toast(JSON.stringify(self.interval.getValue())); |
|
}, |
|
width: 300, |
|
}, |
|
{ |
|
type: "bi.time_periods", |
|
value: { |
|
start: { |
|
hour: 7, |
|
minute: 23, |
|
second: 14, |
|
}, |
|
end: { |
|
hour: 23, |
|
minute: 34, |
|
second: 32, |
|
}, |
|
}, |
|
ref(_ref) { |
|
self.periods = _ref; |
|
}, |
|
width: 180, |
|
}, |
|
{ |
|
type: "bi.button", |
|
text: "getValue", |
|
handler() { |
|
Msg.toast(JSON.stringify(self.periods.getValue())); |
|
}, |
|
width: 300, |
|
} |
|
], |
|
vgap: 20, |
|
}; |
|
} |
|
}
|
|
|