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.
105 lines
3.5 KiB
105 lines
3.5 KiB
import { shortcut, VerticalLayout } from "@/core"; |
|
import { Single, Editor } from "@/base"; |
|
|
|
@shortcut() |
|
export class NumberIntervalSingleEidtor extends Single { |
|
static xtype = "bi.number_interval_single_editor"; |
|
|
|
static EVENT_FOCUS = "EVENT_FOCUS"; |
|
static EVENT_BLUR = "EVENT_BLUR"; |
|
static EVENT_ERROR = "EVENT_ERROR"; |
|
static EVENT_VALID = "EVENT_VALID"; |
|
static EVENT_CHANGE = "EVENT_CHANGE"; |
|
static EVENT_CHANGE_CONFIRM = "EVENT_CHANGE_CONFIRM"; |
|
static EVENT_CONFIRM = "EVENT_CONFIRM"; |
|
|
|
props = { |
|
baseCls: "bi-number-interval-single-editor", |
|
tipType: "success", |
|
title: "", |
|
}; |
|
|
|
render() { |
|
const self = this, |
|
o = this.options; |
|
|
|
return { |
|
type: VerticalLayout.xtype, |
|
items: [ |
|
{ |
|
type: Editor.xtype, |
|
simple: o.simple, |
|
ref(_ref) { |
|
self.editor = _ref; |
|
}, |
|
height: o.height, |
|
watermark: o.watermark, |
|
allowBlank: o.allowBlank, |
|
value: o.value, |
|
quitChecker: o.quitChecker, |
|
validationChecker: o.validationChecker, |
|
listeners: [ |
|
{ |
|
eventName: Editor.EVENT_ERROR, |
|
action() { |
|
self.fireEvent(NumberIntervalSingleEidtor.EVENT_ERROR, arguments); |
|
}, |
|
}, |
|
{ |
|
eventName: Editor.EVENT_FOCUS, |
|
action() { |
|
self.fireEvent(NumberIntervalSingleEidtor.EVENT_FOCUS, arguments); |
|
}, |
|
}, |
|
{ |
|
eventName: Editor.EVENT_BLUR, |
|
action() { |
|
self.fireEvent(NumberIntervalSingleEidtor.EVENT_BLUR, arguments); |
|
}, |
|
}, |
|
{ |
|
eventName: Editor.EVENT_VALID, |
|
action() { |
|
self.fireEvent(NumberIntervalSingleEidtor.EVENT_VALID, arguments); |
|
}, |
|
}, |
|
{ |
|
eventName: Editor.EVENT_CHANGE, |
|
action() { |
|
self.fireEvent(NumberIntervalSingleEidtor.EVENT_CHANGE, arguments); |
|
}, |
|
}, |
|
{ |
|
eventName: Editor.EVENT_CONFIRM, |
|
action() { |
|
self.fireEvent(NumberIntervalSingleEidtor.EVENT_CONFIRM, arguments); |
|
}, |
|
}, |
|
{ |
|
eventName: Editor.EVENT_CHANGE_CONFIRM, |
|
action() { |
|
self.fireEvent(NumberIntervalSingleEidtor.EVENT_CHANGE_CONFIRM, arguments); |
|
}, |
|
} |
|
], |
|
} |
|
], |
|
}; |
|
} |
|
|
|
isValid() { |
|
return this.editor.isValid(); |
|
} |
|
|
|
getValue() { |
|
return this.editor.getValue(); |
|
} |
|
|
|
setValue(v) { |
|
return this.editor.setValue(v); |
|
} |
|
|
|
focus() { |
|
this.editor.focus(); |
|
} |
|
}
|
|
|