Browse Source
Merge in VISUAL/fineui from ~TREECAT/fineui:es6 to es6 * commit 'de22cfdcf92113708d731f6708d20ebb2746d02c': 无jira refact:widget的xtype换下es6
78 changed files with 3783 additions and 3774 deletions
@ -1,62 +1,56 @@ |
|||||||
import { |
import { ButtonTree } from "@/base"; |
||||||
shortcut, |
import { VerticalLayout, shortcut, Widget, extend, createWidget, Controller, Events } from "@/core"; |
||||||
Widget, |
|
||||||
extend, |
|
||||||
createWidget, |
|
||||||
Controller, |
|
||||||
Events |
|
||||||
} from "@/core"; |
|
||||||
|
|
||||||
@shortcut() |
@shortcut() |
||||||
export class DownListGroup extends Widget { |
export class DownListGroup extends Widget { |
||||||
static xtype = "bi.down_list_group"; |
static xtype = "bi.down_list_group"; |
||||||
|
|
||||||
constants = { iconCls: "check-mark-ha-font" }; |
constants = { iconCls: "check-mark-ha-font" }; |
||||||
|
|
||||||
static EVENT_CHANGE = "EVENT_CHANGE"; |
static EVENT_CHANGE = "EVENT_CHANGE"; |
||||||
|
|
||||||
_defaultConfig() { |
_defaultConfig() { |
||||||
return extend(super._defaultConfig(...arguments), { |
return extend(super._defaultConfig(...arguments), { |
||||||
baseCls: "bi-down-list-group", |
baseCls: "bi-down-list-group", |
||||||
items: [ |
items: [ |
||||||
{ |
{ |
||||||
el: {}, |
el: {}, |
||||||
} |
} |
||||||
], |
], |
||||||
}); |
}); |
||||||
} |
} |
||||||
|
|
||||||
_init() { |
_init() { |
||||||
super._init(...arguments); |
super._init(...arguments); |
||||||
const o = this.options; |
const o = this.options; |
||||||
|
|
||||||
this.downlistgroup = createWidget({ |
this.downlistgroup = createWidget({ |
||||||
element: this, |
element: this, |
||||||
type: "bi.button_tree", |
type: ButtonTree.xtype, |
||||||
items: o.items, |
items: o.items, |
||||||
chooseType: 0, // 0单选,1多选
|
chooseType: 0, // 0单选,1多选
|
||||||
layouts: [ |
layouts: [ |
||||||
{ |
{ |
||||||
type: "bi.vertical", |
type: VerticalLayout.xtype, |
||||||
hgap: 0, |
hgap: 0, |
||||||
vgap: 0, |
vgap: 0, |
||||||
} |
} |
||||||
], |
], |
||||||
value: o.value, |
value: o.value, |
||||||
}); |
}); |
||||||
this.downlistgroup.on(Controller.EVENT_CHANGE, (type, ...args) => { |
this.downlistgroup.on(Controller.EVENT_CHANGE, (type, ...args) => { |
||||||
this.fireEvent(Controller.EVENT_CHANGE, type, ...args); |
this.fireEvent(Controller.EVENT_CHANGE, type, ...args); |
||||||
if (type === Events.CLICK) { |
if (type === Events.CLICK) { |
||||||
this.fireEvent(DownListGroup.EVENT_CHANGE, type, ...args); |
this.fireEvent(DownListGroup.EVENT_CHANGE, type, ...args); |
||||||
} |
} |
||||||
}); |
}); |
||||||
} |
} |
||||||
|
|
||||||
getValue() { |
getValue() { |
||||||
return this.downlistgroup.getValue(); |
return this.downlistgroup.getValue(); |
||||||
} |
} |
||||||
|
|
||||||
setValue(v) { |
setValue(v) { |
||||||
this.downlistgroup.setValue(v); |
this.downlistgroup.setValue(v); |
||||||
} |
} |
||||||
} |
} |
||||||
|
@ -1,125 +1,121 @@ |
|||||||
import { shortcut, extend, createWidget, isPlainObject, LogicFactory, Direction } from "@/core"; |
import { Label, Icon, BasicButton } from "@/base"; |
||||||
import { BasicButton } from "@/base"; |
import { CenterAdaptLayout, shortcut, extend, createWidget, isPlainObject, LogicFactory, Direction } from "@/core"; |
||||||
|
|
||||||
@shortcut() |
@shortcut() |
||||||
export class DownListItem extends BasicButton { |
export class DownListItem extends BasicButton { |
||||||
static xtype = "bi.down_list_item"; |
static xtype = "bi.down_list_item"; |
||||||
|
|
||||||
static EVENT_CHANGE = "EVENT_CHANGE"; |
static EVENT_CHANGE = "EVENT_CHANGE"; |
||||||
|
|
||||||
_defaultConfig() { |
_defaultConfig() { |
||||||
const conf = super._defaultConfig(...arguments); |
const conf = super._defaultConfig(...arguments); |
||||||
|
|
||||||
return extend(conf, { |
return extend(conf, { |
||||||
baseCls: "bi-down-list-item bi-list-item-active", |
baseCls: "bi-down-list-item bi-list-item-active", |
||||||
cls: "", |
cls: "", |
||||||
height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, |
height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, |
||||||
logic: { |
logic: { |
||||||
dynamic: true, |
dynamic: true, |
||||||
}, |
}, |
||||||
selected: false, |
selected: false, |
||||||
iconHeight: null, |
iconHeight: null, |
||||||
iconWidth: null, |
iconWidth: null, |
||||||
textHgap: 0, |
textHgap: 0, |
||||||
textVgap: 0, |
textVgap: 0, |
||||||
textLgap: 0, |
textLgap: 0, |
||||||
textRgap: 0, |
textRgap: 0, |
||||||
}); |
}); |
||||||
} |
} |
||||||
|
|
||||||
_init() { |
_init() { |
||||||
super._init(...arguments); |
super._init(...arguments); |
||||||
const o = this.options; |
const o = this.options; |
||||||
this.text = createWidget({ |
this.text = createWidget({ |
||||||
type: "bi.label", |
type: Label.xtype, |
||||||
cls: "list-item-text", |
cls: "list-item-text", |
||||||
textAlign: "left", |
textAlign: "left", |
||||||
hgap: o.textHgap, |
hgap: o.textHgap, |
||||||
vgap: o.textVgap, |
vgap: o.textVgap, |
||||||
lgap: o.textLgap, |
lgap: o.textLgap, |
||||||
rgap: o.textRgap, |
rgap: o.textRgap, |
||||||
text: o.text, |
text: o.text, |
||||||
value: o.value, |
value: o.value, |
||||||
keyword: o.keyword, |
keyword: o.keyword, |
||||||
height: o.height, |
height: o.height, |
||||||
}); |
}); |
||||||
|
|
||||||
const icon = isPlainObject(o.icon) |
const icon = isPlainObject(o.icon) |
||||||
? o.icon |
? o.icon |
||||||
: { |
: { |
||||||
type: "bi.icon", |
type: Icon.xtype, |
||||||
width: o.iconWidth, |
width: o.iconWidth, |
||||||
height: o.iconHeight, |
height: o.iconHeight, |
||||||
}; |
}; |
||||||
|
|
||||||
this.icon = createWidget({ |
this.icon = createWidget({ |
||||||
type: "bi.center_adapt", |
type: CenterAdaptLayout.xtype, |
||||||
width: 36, |
width: 36, |
||||||
height: o.height, |
height: o.height, |
||||||
items: [ |
items: [ |
||||||
{ |
{ |
||||||
el: icon, |
el: icon, |
||||||
} |
} |
||||||
], |
], |
||||||
}); |
}); |
||||||
|
|
||||||
createWidget( |
createWidget( |
||||||
extend( |
extend( |
||||||
{ |
{ |
||||||
element: this, |
element: this, |
||||||
}, |
}, |
||||||
LogicFactory.createLogic( |
LogicFactory.createLogic( |
||||||
LogicFactory.createLogicTypeByDirection(Direction.Left), |
LogicFactory.createLogicTypeByDirection(Direction.Left), |
||||||
extend(o.logic, { |
extend(o.logic, { |
||||||
items: LogicFactory.createLogicItemsByDirection( |
items: LogicFactory.createLogicItemsByDirection(Direction.Left, this.icon, this.text), |
||||||
Direction.Left, |
}) |
||||||
this.icon, |
) |
||||||
this.text |
) |
||||||
), |
); |
||||||
}) |
} |
||||||
) |
|
||||||
) |
setValue() { |
||||||
); |
if (!this.isReadOnly()) { |
||||||
} |
this.text.setValue(...arguments); |
||||||
|
} |
||||||
setValue() { |
} |
||||||
if (!this.isReadOnly()) { |
|
||||||
this.text.setValue(...arguments); |
getValue() { |
||||||
} |
return this.text.getValue(); |
||||||
} |
} |
||||||
|
|
||||||
getValue() { |
setText() { |
||||||
return this.text.getValue(); |
this.text.setText(...arguments); |
||||||
} |
} |
||||||
|
|
||||||
setText() { |
getText() { |
||||||
this.text.setText(...arguments); |
return this.text.getText(); |
||||||
} |
} |
||||||
|
|
||||||
getText() { |
doClick() { |
||||||
return this.text.getText(); |
super.doClick(...arguments); |
||||||
} |
if (this.isValid()) { |
||||||
|
this.fireEvent(DownListItem.EVENT_CHANGE, this.getValue(), this); |
||||||
doClick() { |
} |
||||||
super.doClick(...arguments); |
} |
||||||
if (this.isValid()) { |
|
||||||
this.fireEvent(DownListItem.EVENT_CHANGE, this.getValue(), this); |
doRedMark() { |
||||||
} |
this.text.doRedMark(...arguments); |
||||||
} |
} |
||||||
|
|
||||||
doRedMark() { |
unRedMark() { |
||||||
this.text.doRedMark(...arguments); |
this.text.unRedMark(...arguments); |
||||||
} |
} |
||||||
|
|
||||||
unRedMark() { |
doHighLight() { |
||||||
this.text.unRedMark(...arguments); |
this.text.doHighLight(...arguments); |
||||||
} |
} |
||||||
|
|
||||||
doHighLight() { |
unHighLight() { |
||||||
this.text.doHighLight(...arguments); |
this.text.unHighLight(...arguments); |
||||||
} |
} |
||||||
|
|
||||||
unHighLight() { |
|
||||||
this.text.unHighLight(...arguments); |
|
||||||
} |
|
||||||
} |
} |
||||||
|
Loading…
Reference in new issue