Zhenfei.Li
2 years ago
9 changed files with 442 additions and 395 deletions
@ -0,0 +1,3 @@ |
|||||||
|
export { DateInterval } from "./dateinterval"; |
||||||
|
export { TimeInterval } from "./timeinterval"; |
||||||
|
export { TimePeriods } from "./timeperiods"; |
@ -1,92 +1,90 @@ |
|||||||
/** |
import { shortcut, extend } from "@/core"; |
||||||
* 时间区间 |
import { Single, Label } from "@/base"; |
||||||
* qcc |
import { TimeCombo } from "../time"; |
||||||
* 2019/2/28 |
|
||||||
*/ |
|
||||||
|
|
||||||
!(function () { |
@shortcut() |
||||||
BI.TimePeriods = BI.inherit(BI.Single, { |
export class TimePeriods extends Single { |
||||||
constants: { |
static xtype = "bi.time_periods" |
||||||
height: 24, |
|
||||||
width: 24, |
props = { |
||||||
hgap: 15, |
|
||||||
offset: -15 |
|
||||||
}, |
|
||||||
props: { |
|
||||||
extraCls: "bi-time-interval", |
extraCls: "bi-time-interval", |
||||||
value: {} |
value: {}, |
||||||
}, |
}; |
||||||
|
|
||||||
render: function () { |
static EVENT_CONFIRM = "EVENT_CONFIRM" |
||||||
var self = this, o = this.options; |
static EVENT_CHANGE = "EVENT_CHANGE" |
||||||
|
|
||||||
|
|
||||||
|
render() { |
||||||
|
const o = this.options; |
||||||
|
|
||||||
return { |
return { |
||||||
type: "bi.horizontal_fill", |
type: "bi.horizontal_fill", |
||||||
columnSize: ["fill", "", "fill"], |
columnSize: ["fill", "", "fill"], |
||||||
items: [{ |
items: [{ |
||||||
el: BI.extend({ |
el: extend({ |
||||||
ref: function (_ref) { |
ref: _ref => { |
||||||
self.left = _ref; |
this.left = _ref; |
||||||
} |
}, |
||||||
}, this._createCombo(o.value.start, o.watermark?.start)) |
}, this._createCombo(o.value.start, o.watermark?.start)), |
||||||
}, { |
}, { |
||||||
el: { |
el: { |
||||||
type: "bi.label", |
type: Label.xtype, |
||||||
height: o.height, |
height: o.height, |
||||||
hgap: 5, |
hgap: 5, |
||||||
text: "-", |
text: "-", |
||||||
ref: function (_ref) { |
ref: _ref => { |
||||||
self.label = _ref; |
this.label = _ref; |
||||||
} |
}, |
||||||
} |
}, |
||||||
}, { |
}, { |
||||||
el: BI.extend({ |
el: extend({ |
||||||
ref: function (_ref) { |
ref: _ref => { |
||||||
self.right = _ref; |
this.right = _ref; |
||||||
} |
|
||||||
}, this._createCombo(o.value.end, o.watermark?.end)) |
|
||||||
}] |
|
||||||
}; |
|
||||||
}, |
}, |
||||||
|
}, this._createCombo(o.value.end, o.watermark?.end)), |
||||||
|
}], |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
|
_createCombo(v, watermark) { |
||||||
|
const o = this.options; |
||||||
|
|
||||||
_createCombo: function (v, watermark) { |
|
||||||
var self = this; |
|
||||||
var o = this.options; |
|
||||||
return { |
return { |
||||||
type: "bi.time_combo", |
type: TimeCombo.xtype, |
||||||
value: v, |
value: v, |
||||||
height: o.height, |
height: o.height, |
||||||
watermark: watermark, |
watermark, |
||||||
listeners: [{ |
listeners: [{ |
||||||
eventName: BI.TimeCombo.EVENT_BEFORE_POPUPVIEW, |
eventName: TimeCombo.EVENT_BEFORE_POPUPVIEW, |
||||||
action: function () { |
action: () => { |
||||||
self.left.hidePopupView(); |
this.left.hidePopupView(); |
||||||
self.right.hidePopupView(); |
this.right.hidePopupView(); |
||||||
} |
}, |
||||||
}, { |
}, { |
||||||
eventName: BI.TimeCombo.EVENT_CHANGE, |
eventName: TimeCombo.EVENT_CHANGE, |
||||||
action: function () { |
action: () => { |
||||||
self.fireEvent(BI.TimePeriods.EVENT_CHANGE); |
this.fireEvent(TimePeriods.EVENT_CHANGE); |
||||||
} |
}, |
||||||
}, { |
}, { |
||||||
eventName: BI.TimeCombo.EVENT_CONFIRM, |
eventName: TimeCombo.EVENT_CONFIRM, |
||||||
action: function () { |
action: () => { |
||||||
self.fireEvent(BI.TimePeriods.EVENT_CONFIRM); |
this.fireEvent(TimePeriods.EVENT_CONFIRM); |
||||||
} |
|
||||||
}] |
|
||||||
}; |
|
||||||
}, |
}, |
||||||
|
}], |
||||||
|
}; |
||||||
|
} |
||||||
|
|
||||||
setValue: function (date) { |
setValue(date) { |
||||||
date = date || {}; |
date = date || {}; |
||||||
this.left.setValue(date.start); |
this.left.setValue(date.start); |
||||||
this.right.setValue(date.end); |
this.right.setValue(date.end); |
||||||
}, |
|
||||||
getValue: function () { |
|
||||||
return {start: this.left.getValue(), end: this.right.getValue()}; |
|
||||||
} |
} |
||||||
}); |
|
||||||
BI.TimePeriods.EVENT_CONFIRM = "EVENT_CONFIRM"; |
getValue() { |
||||||
BI.TimePeriods.EVENT_CHANGE = "EVENT_CHANGE"; |
return { |
||||||
BI.shortcut("bi.time_periods", BI.TimePeriods); |
start: this.left.getValue(), |
||||||
})(); |
end: this.right.getValue(), |
||||||
|
}; |
||||||
|
} |
||||||
|
} |
||||||
|
Loading…
Reference in new issue