Zhenfei.Li
2 years ago
12 changed files with 374 additions and 326 deletions
@ -0,0 +1,8 @@
|
||||
export { EditorTrigger } from "./trigger.editor"; |
||||
export { IconTrigger } from "./trigger.icon"; |
||||
export { IconTextTrigger } from "./trigger.icon.text"; |
||||
export { SelectIconTextTrigger } from "./trigger.icon.text.select"; |
||||
export { TextTrigger } from "./trigger.text"; |
||||
export { SelectTextTrigger } from "./trigger.text.select"; |
||||
export { SmallSelectTextTrigger } from "./trigger.text.select.small"; |
||||
export { SmallTextTrigger } from "./trigger.text.small"; |
@ -1,93 +1,98 @@
|
||||
import { shortcut, extend, emptyFn, createWidget, toPix, Controller } from "@/core"; |
||||
import { Trigger } from "@/base"; |
||||
import { SignEditor } from "../editor"; |
||||
|
||||
/** |
||||
* 文本输入框trigger |
||||
* |
||||
* Created by GUY on 2015/9/15. |
||||
* @class BI.EditorTrigger |
||||
* @extends BI.Trigger |
||||
* @class EditorTrigger |
||||
* @extends Trigger |
||||
*/ |
||||
BI.EditorTrigger = BI.inherit(BI.Trigger, { |
||||
_defaultConfig: function (config) { |
||||
var conf = BI.EditorTrigger.superclass._defaultConfig.apply(this, arguments); |
||||
return BI.extend(conf, { |
||||
baseCls: (conf.baseCls || "") + " bi-editor-trigger bi-border-radius " + (config.simple ? "bi-border-bottom" : "bi-border"), |
||||
@shortcut() |
||||
export class EditorTrigger extends Trigger { |
||||
static xtype = "bi.editor_trigger"; |
||||
static EVENT_CHANGE = "EVENT_CHANGE"; |
||||
static EVENT_FOCUS = "EVENT_FOCUS"; |
||||
static EVENT_EMPTY = "EVENT_EMPTY"; |
||||
static EVENT_VALID = "EVENT_VALID"; |
||||
static EVENT_ERROR = "EVENT_ERROR"; |
||||
|
||||
_defaultConfig(config) { |
||||
const conf = super._defaultConfig(...arguments); |
||||
|
||||
return extend(conf, { |
||||
baseCls: `${conf.baseCls || ""} bi-editor-trigger bi-border-radius ${config.simple ? "bi-border-bottom" : "bi-border"}`, |
||||
height: 24, |
||||
validationChecker: BI.emptyFn, |
||||
quitChecker: BI.emptyFn, |
||||
validationChecker: emptyFn, |
||||
quitChecker: emptyFn, |
||||
allowBlank: false, |
||||
watermark: "", |
||||
errorText: "" |
||||
errorText: "", |
||||
}); |
||||
}, |
||||
} |
||||
|
||||
_init: function () { |
||||
BI.EditorTrigger.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options, c = this._const; |
||||
this.editor = BI.createWidget({ |
||||
_init() { |
||||
super._init(...arguments); |
||||
const o = this.options; |
||||
this.editor = createWidget({ |
||||
type: "bi.sign_editor", |
||||
height: BI.toPix(o.height, 2), |
||||
height: toPix(o.height, 2), |
||||
value: o.value, |
||||
validationChecker: o.validationChecker, |
||||
quitChecker: o.quitChecker, |
||||
allowBlank: o.allowBlank, |
||||
watermark: o.watermark, |
||||
errorText: o.errorText, |
||||
title: function () { |
||||
return self.getValue(); |
||||
} |
||||
title: () => this.getValue(), |
||||
}); |
||||
this.editor.on(BI.Controller.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
||||
this.editor.on(Controller.EVENT_CHANGE, (...args) => { |
||||
this.fireEvent(Controller.EVENT_CHANGE, ...args); |
||||
}); |
||||
this.editor.on(BI.SignEditor.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.EditorTrigger.EVENT_CHANGE, arguments); |
||||
this.editor.on(SignEditor.EVENT_CHANGE, (...args) => { |
||||
this.fireEvent(EditorTrigger.EVENT_CHANGE, ...args); |
||||
}); |
||||
this.editor.on(BI.SignEditor.EVENT_FOCUS, function () { |
||||
self.fireEvent(BI.EditorTrigger.EVENT_FOCUS, arguments); |
||||
this.editor.on(SignEditor.EVENT_FOCUS, (...args) => { |
||||
this.fireEvent(EditorTrigger.EVENT_FOCUS, ...args); |
||||
}); |
||||
this.editor.on(BI.SignEditor.EVENT_EMPTY, function () { |
||||
self.fireEvent(BI.EditorTrigger.EVENT_EMPTY, arguments); |
||||
this.editor.on(SignEditor.EVENT_EMPTY, (...args) => { |
||||
this.fireEvent(EditorTrigger.EVENT_EMPTY, ...args); |
||||
}); |
||||
this.editor.on(BI.SignEditor.EVENT_VALID, function () { |
||||
self.fireEvent(BI.EditorTrigger.EVENT_VALID, arguments); |
||||
this.editor.on(SignEditor.EVENT_VALID, (...args) => { |
||||
this.fireEvent(EditorTrigger.EVENT_VALID, ...args); |
||||
}); |
||||
this.editor.on(BI.SignEditor.EVENT_ERROR, function () { |
||||
self.fireEvent(BI.EditorTrigger.EVENT_ERROR, arguments); |
||||
this.editor.on(SignEditor.EVENT_ERROR, (...args) => { |
||||
this.fireEvent(EditorTrigger.EVENT_ERROR, ...args); |
||||
}); |
||||
|
||||
BI.createWidget({ |
||||
createWidget({ |
||||
element: this, |
||||
type: "bi.horizontal_fill", |
||||
height: BI.toPix(o.height, 2), |
||||
height: toPix(o.height, 2), |
||||
items: [ |
||||
{ |
||||
el: this.editor, |
||||
width: "fill" |
||||
width: "fill", |
||||
}, { |
||||
el: { |
||||
type: "bi.trigger_icon_button", |
||||
width: o.triggerWidth || BI.toPix(o.height, 2) |
||||
width: o.triggerWidth || toPix(o.height, 2), |
||||
}, |
||||
width: "" |
||||
width: "", |
||||
} |
||||
] |
||||
], |
||||
}); |
||||
}, |
||||
} |
||||
|
||||
getValue: function () { |
||||
getValue() { |
||||
return this.editor.getValue(); |
||||
}, |
||||
} |
||||
|
||||
setValue: function (value) { |
||||
setValue(value) { |
||||
this.editor.setValue(value); |
||||
}, |
||||
} |
||||
|
||||
setText: function (text) { |
||||
setText(text) { |
||||
this.editor.setState(text); |
||||
} |
||||
}); |
||||
BI.EditorTrigger.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.EditorTrigger.EVENT_FOCUS = "EVENT_FOCUS"; |
||||
BI.EditorTrigger.EVENT_EMPTY = "EVENT_EMPTY"; |
||||
BI.EditorTrigger.EVENT_VALID = "EVENT_VALID"; |
||||
BI.EditorTrigger.EVENT_ERROR = "EVENT_ERROR"; |
||||
BI.shortcut("bi.editor_trigger", BI.EditorTrigger); |
||||
} |
||||
|
@ -1,30 +1,35 @@
|
||||
import { shortcut, extend, createWidget } from "@/core"; |
||||
import { Trigger } from "@/base"; |
||||
|
||||
/** |
||||
* 图标按钮trigger |
||||
* |
||||
* Created by GUY on 2015/10/8. |
||||
* @class BI.IconTrigger |
||||
* @extends BI.Trigger |
||||
* @class IconTrigger |
||||
* @extends Trigger |
||||
*/ |
||||
BI.IconTrigger = BI.inherit(BI.Trigger, { |
||||
@shortcut() |
||||
export class IconTrigger extends Trigger { |
||||
static xtype = "bi.icon_trigger" |
||||
|
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.IconTrigger.superclass._defaultConfig.apply(this, arguments), { |
||||
_defaultConfig() { |
||||
return extend(super._defaultConfig(...arguments), { |
||||
baseCls: "bi-icon-trigger", |
||||
extraCls: "pull-down-font", |
||||
el: {}, |
||||
height: 24 |
||||
height: 24, |
||||
}); |
||||
}, |
||||
_init: function () { |
||||
var o = this.options; |
||||
BI.IconTrigger.superclass._init.apply(this, arguments); |
||||
this.iconButton = BI.createWidget(o.el, { |
||||
} |
||||
|
||||
_init() { |
||||
const o = this.options; |
||||
super._init(...arguments); |
||||
this.iconButton = createWidget(o.el, { |
||||
type: "bi.trigger_icon_button", |
||||
element: this, |
||||
width: o.width, |
||||
height: o.height, |
||||
extraCls: o.extraCls |
||||
extraCls: o.extraCls, |
||||
}); |
||||
} |
||||
}); |
||||
BI.shortcut("bi.icon_trigger", BI.IconTrigger); |
||||
} |
||||
|
Loading…
Reference in new issue