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.
111 lines
2.7 KiB
111 lines
2.7 KiB
import { VerticalAdaptLayout, extend, shortcut, Direction } from "@/core"; |
|
import { IconLabel, Label } from "../../label"; |
|
import { BasicButton } from "../button.basic"; |
|
|
|
/** |
|
* guy |
|
* |
|
* Created by GUY on 2015/9/9. |
|
* @class IconTextItem |
|
* @extends BasicButton |
|
*/ |
|
@shortcut() |
|
export class IconTextItem extends BasicButton { |
|
static EVENT_CHANGE = "EVENT_CHANGE"; |
|
static xtype = "bi.icon_text_item"; |
|
|
|
_defaultConfig() { |
|
const conf = super._defaultConfig(...arguments); |
|
|
|
return extend(conf, { |
|
baseCls: `${conf.baseCls || ""} bi-icon-text-item`, |
|
direction: Direction.Left, |
|
iconWrapperWidth: null, |
|
iconHeight: null, |
|
iconWidth: null, |
|
iconCls: "", |
|
textHgap: 0, |
|
textVgap: 0, |
|
textLgap: 0, |
|
textRgap: 0, |
|
}); |
|
} |
|
|
|
render() { |
|
const o = this.options; |
|
|
|
return { |
|
type: VerticalAdaptLayout.xtype, |
|
columnSize: [o.iconWrapperWidth || o.height, "fill"], |
|
items: [ |
|
{ |
|
type: IconLabel.xtype, |
|
cls: o.iconCls, |
|
width: o.iconWrapperWidth || o.height, |
|
height: o.height, |
|
iconWidth: o.iconWidth, |
|
iconHeight: o.iconHeight, |
|
}, |
|
{ |
|
el: { |
|
type: Label.xtype, |
|
ref: _ref => { |
|
this.text = _ref; |
|
}, |
|
cls: "list-item-text", |
|
textAlign: "left", |
|
hgap: o.textHgap, |
|
vgap: o.textVgap, |
|
lgap: o.textLgap, |
|
rgap: o.textRgap, |
|
text: o.text, |
|
value: o.value, |
|
keyword: o.keyword, |
|
height: o.height, |
|
}, |
|
} |
|
], |
|
}; |
|
} |
|
|
|
doClick() { |
|
super.doClick(...arguments); |
|
if (this.isValid()) { |
|
this.fireEvent(IconTextItem.EVENT_CHANGE, this.getValue(), this); |
|
} |
|
} |
|
|
|
setValue() { |
|
if (!this.isReadOnly()) { |
|
this.text.setValue(...arguments); |
|
} |
|
} |
|
|
|
getValue() { |
|
return this.text.getValue(); |
|
} |
|
|
|
setText() { |
|
this.text.setText(...arguments); |
|
} |
|
|
|
getText() { |
|
return this.text.getText(); |
|
} |
|
|
|
doRedMark() { |
|
this.text.doRedMark(...arguments); |
|
} |
|
|
|
unRedMark() { |
|
this.text.unRedMark(...arguments); |
|
} |
|
|
|
doHighLight() { |
|
this.text.doHighLight(...arguments); |
|
} |
|
|
|
unHighLight() { |
|
this.text.unHighLight(...arguments); |
|
} |
|
}
|
|
|