Browse Source
# Conflicts: # src/widget/index.js # src/widget/multilayersingletree/index.js # src/widget/multilayersingletree/multilayersingletree.combo.js # src/widget/multilayersingletree/multilayersingletree.insert.search.pane.js # src/widget/multilayersingletree/multilayersingletree.leveltree.js # src/widget/multilayersingletree/multilayersingletree.popup.js # src/widget/multilayersingletree/multilayersingletree.trigger.js # src/widget/multilayersingletree/node/node.first.plus.js # src/widget/multilayersingletree/node/node.last.plus.js # src/widget/multilayersingletree/node/node.mid.plus.js # src/widget/multilayersingletree/node/node.plus.js # src/widget/multilayersingletree/treeitem/item.first.treeleaf.js # src/widget/multilayersingletree/treeitem/item.last.treeleaf.js # src/widget/multilayersingletree/treeitem/item.mid.treeleaf.jses6
zsmj
2 years ago
103 changed files with 6194 additions and 4721 deletions
@ -1,47 +1,40 @@
|
||||
/** |
||||
* 表示当前对象 |
||||
* |
||||
* Created by GUY on 2015/9/7. |
||||
* @class BI.EL |
||||
* @extends BI.Widget |
||||
*/ |
||||
BI.Context = BI.inherit(BI.Widget, { |
||||
props: { |
||||
context: "", |
||||
watch: {}, |
||||
el: {}, |
||||
items: [], |
||||
}, |
||||
import { shortcut, Widget, createWidget, Controller } from "@/core"; |
||||
|
||||
render: function () { |
||||
var self = this, o = this.options; |
||||
@shortcut() |
||||
export class Context extends Widget { |
||||
static xtype = "bi.context"; |
||||
|
||||
props = { context: "", watch: {}, el: {}, items: [] }; |
||||
|
||||
render() { |
||||
const self = this, |
||||
o = this.options; |
||||
if (o.context) { |
||||
this.context = BI.useContext(o.context); |
||||
} |
||||
this.widget = BI.createWidget((o.items[0] || o.el)(this.context), { |
||||
this.widget = createWidget((o.items[0] || o.el)(this.context), { |
||||
element: this, |
||||
}); |
||||
this.widget.on(BI.Controller.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
||||
this.widget.on(Controller.EVENT_CHANGE, function () { |
||||
self.fireEvent(Controller.EVENT_CHANGE, arguments); |
||||
}); |
||||
}, |
||||
} |
||||
|
||||
__initWatch: function () { |
||||
BI.Context.superclass.__initWatch.call(this); |
||||
var o = this.options; |
||||
__initWatch() { |
||||
super.__initWatch.call(this); |
||||
const o = this.options; |
||||
BI.watch(this.context, o.context, o.watch); |
||||
}, |
||||
} |
||||
|
||||
setValue: function (v) { |
||||
setValue(v) { |
||||
this.widget.setValue(v); |
||||
}, |
||||
} |
||||
|
||||
getValue: function () { |
||||
getValue() { |
||||
return this.widget.getValue(); |
||||
}, |
||||
} |
||||
|
||||
populate: function () { |
||||
populate() { |
||||
this.widget.populate.apply(this, arguments); |
||||
}, |
||||
}); |
||||
BI.shortcut("bi.context", BI.Context); |
||||
} |
||||
} |
||||
|
@ -1,38 +1,36 @@
|
||||
/** |
||||
* 表示当前对象 |
||||
* |
||||
* Created by GUY on 2015/9/7. |
||||
* @class BI.EL |
||||
* @extends BI.Widget |
||||
*/ |
||||
BI.EL = BI.inherit(BI.Widget, { |
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.EL.superclass._defaultConfig.apply(this, arguments), { |
||||
import { shortcut, Widget, extend, createWidget, Controller } from "@/core"; |
||||
|
||||
@shortcut() |
||||
export class EL extends Widget { |
||||
static xtype = "bi.el"; |
||||
|
||||
_defaultConfig() { |
||||
return extend(super._defaultConfig(...arguments), { |
||||
baseCls: "bi-el", |
||||
el: {}, |
||||
}); |
||||
}, |
||||
} |
||||
|
||||
render: function () { |
||||
var self = this, o = this.options; |
||||
this.ele = BI.createWidget(o.el, { |
||||
render() { |
||||
const self = this, |
||||
o = this.options; |
||||
this.ele = createWidget(o.el, { |
||||
element: this, |
||||
}); |
||||
this.ele.on(BI.Controller.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
||||
this.ele.on(Controller.EVENT_CHANGE, function () { |
||||
self.fireEvent(Controller.EVENT_CHANGE, arguments); |
||||
}); |
||||
}, |
||||
} |
||||
|
||||
setValue: function (v) { |
||||
setValue(v) { |
||||
this.ele.setValue(v); |
||||
}, |
||||
} |
||||
|
||||
getValue: function () { |
||||
getValue() { |
||||
return this.ele.getValue(); |
||||
}, |
||||
} |
||||
|
||||
populate: function () { |
||||
populate() { |
||||
this.ele.populate.apply(this, arguments); |
||||
}, |
||||
}); |
||||
BI.shortcut("bi.el", BI.EL); |
||||
} |
||||
} |
||||
|
@ -1,17 +1,17 @@
|
||||
export { BasicButton } from "./button.basic"; |
||||
export { NodeButton } from "./button.node"; |
||||
export { Button } from "./buttons/button"; |
||||
export { IconButton } from "./buttons/button.icon"; |
||||
export { ImageButton } from "./buttons/button.image"; |
||||
export { TextButton } from "./buttons/button.text"; |
||||
export { BlankIconIconTextItem } from "./listitem/blankiconicontextitem"; |
||||
export { BlankIconTextIconItem } from "./listitem/blankicontexticonitem"; |
||||
export { BlankIconTextItem } from "./listitem/blankicontextitem"; |
||||
export { IconTextIconItem } from "./listitem/icontexticonitem"; |
||||
export { IconTextItem } from "./listitem/icontextitem"; |
||||
export { TextIconItem } from "./listitem/texticonitem"; |
||||
export { TextItem } from "./listitem/textitem"; |
||||
export { IconTextIconNode } from "./node/icontexticonnode"; |
||||
export { IconTextNode } from "./node/icontextnode"; |
||||
export { TextIconNode } from "./node/texticonnode"; |
||||
export { TextNode } from "./node/textnode"; |
||||
export { BasicButton } from "./button.basic"; |
||||
export { NodeButton } from "./button.node"; |
||||
export { Button } from "./buttons/button"; |
||||
export { IconButton } from "./buttons/button.icon"; |
||||
export { ImageButton } from "./buttons/button.image"; |
||||
export { TextButton } from "./buttons/button.text"; |
||||
export { BlankIconIconTextItem } from "./listitem/blankiconicontextitem"; |
||||
export { BlankIconTextIconItem } from "./listitem/blankicontexticonitem"; |
||||
export { BlankIconTextItem } from "./listitem/blankicontextitem"; |
||||
export { IconTextIconItem } from "./listitem/icontexticonitem"; |
||||
export { IconTextItem } from "./listitem/icontextitem"; |
||||
export { TextIconItem } from "./listitem/texticonitem"; |
||||
export { TextItem } from "./listitem/textitem"; |
||||
export { IconTextIconNode } from "./node/icontexticonnode"; |
||||
export { IconTextNode } from "./node/icontextnode"; |
||||
export { TextIconNode } from "./node/texticonnode"; |
||||
export { TextNode } from "./node/textnode"; |
||||
|
@ -1,3 +1,3 @@
|
||||
export { Editor } from "./editor"; |
||||
export { MultifileEditor } from "./editor.multifile"; |
||||
export { TextAreaEditor } from "./editor.textarea"; |
||||
export { Editor } from "./editor"; |
||||
export { MultifileEditor } from "./editor.multifile"; |
||||
export { TextAreaEditor } from "./editor.textarea"; |
||||
|
@ -1,6 +1,6 @@
|
||||
export { Input } from "./input"; |
||||
export { File } from "./file"; |
||||
export { Checkbox } from "./checkbox/checkbox"; |
||||
export { ImageCheckbox } from "./checkbox/checkbox.image"; |
||||
export { Radio } from "./radio/radio"; |
||||
export { ImageRadio } from "./radio/radio.image"; |
||||
export { Input } from "./input"; |
||||
export { File } from "./file"; |
||||
export { Checkbox } from "./checkbox/checkbox"; |
||||
export { ImageCheckbox } from "./checkbox/checkbox.image"; |
||||
export { Radio } from "./radio/radio"; |
||||
export { ImageRadio } from "./radio/radio.image"; |
||||
|
@ -1,4 +1,4 @@
|
||||
export { AbstractLabel } from "./abstract.label"; |
||||
export { HtmlLabel } from "./html.label"; |
||||
export { IconLabel } from "./icon.label"; |
||||
export { Label } from "./label"; |
||||
export { AbstractLabel } from "./abstract.label"; |
||||
export { HtmlLabel } from "./html.label"; |
||||
export { IconLabel } from "./icon.label"; |
||||
export { Label } from "./label"; |
||||
|
@ -0,0 +1,2 @@
|
||||
export { MultiLayerDownListCombo } from "./combo.downlist"; |
||||
export { MultiLayerDownListPopup } from "./popup.downlist"; |
@ -1,2 +1,7 @@
|
||||
export { MultiLayerSingleTreeCombo } from "./multilayersingletree.combo"; |
||||
export { MultiLayerSingleTreeInsertSearchPane } from "./multilayersingletree.insert.search.pane"; |
||||
export { MultiLayerSingleLevelTree } from "./multilayersingletree.leveltree"; |
||||
export { MultiLayerSingleTreePopup } from "./multilayersingletree.popup"; |
||||
export { MultiLayerSingleTreeTrigger } from "./multilayersingletree.trigger"; |
||||
export * from "./node"; |
||||
export * from "./treeitem"; |
||||
|
@ -0,0 +1,9 @@
|
||||
export { SingleSelectCombo } from "./singleselect.combo"; |
||||
export { SingleSelectInsertCombo } from "./singleselect.insert.combo"; |
||||
export { SingleSelectList } from "./singleselect.list"; |
||||
export { SingleSelectLoader } from "./singleselect.loader"; |
||||
export { SingleSelectPopupView } from "./singleselect.popup.view"; |
||||
export { SingleSelectTrigger } from "./singleselect.trigger"; |
||||
export { SingleSelectInsertList } from "./singleselectlist.insert"; |
||||
export * from "./trigger"; |
||||
export * from "./search"; |
@ -0,0 +1,3 @@
|
||||
export { SingleSelectSearchLoader } from "./singleselect.search.loader"; |
||||
export { SingleSelectSearchPane } from "./singleselect.search.pane"; |
||||
export { SingleSelectSearchInsertPane } from "./singleselect.search.pane.insert"; |
@ -1,96 +1,96 @@
|
||||
/** |
||||
* |
||||
* 在搜索框中输入文本弹出的面板 |
||||
* @class BI.SingleSelectSearchInsertPane |
||||
* @extends Widget |
||||
*/ |
||||
import { shortcut, Widget, extend, emptyFn, createWidget, i18nText, Controller, VerticalFillLayout, VerticalLayout } from "@/core"; |
||||
import { Label } from "@/base"; |
||||
import { SingleSelectSearchLoader } from "./singleselect.search.loader"; |
||||
|
||||
BI.SingleSelectSearchInsertPane = BI.inherit(BI.Widget, { |
||||
@shortcut() |
||||
export class SingleSelectSearchInsertPane extends Widget { |
||||
static xtype = "bi.single_select_search_insert_pane"; |
||||
|
||||
constants: { |
||||
height: 25, |
||||
lgap: 10, |
||||
tgap: 5 |
||||
}, |
||||
constants = { height: 25, lgap: 10, tgap: 5 }; |
||||
|
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.SingleSelectSearchInsertPane.superclass._defaultConfig.apply(this, arguments), { |
||||
static EVENT_CHANGE = "EVENT_CHANGE"; |
||||
|
||||
_defaultConfig() { |
||||
return extend(super._defaultConfig(...arguments), { |
||||
baseCls: "bi-single-select-search-pane-insert bi-card", |
||||
allowNoSelect: false, |
||||
itemsCreator: BI.emptyFn, |
||||
valueFormatter: BI.emptyFn, |
||||
keywordGetter: BI.emptyFn |
||||
itemsCreator: emptyFn, |
||||
valueFormatter: emptyFn, |
||||
keywordGetter: emptyFn, |
||||
}); |
||||
}, |
||||
} |
||||
|
||||
_init: function () { |
||||
BI.SingleSelectSearchInsertPane.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
_init() { |
||||
super._init(...arguments); |
||||
const self = this, |
||||
o = this.options; |
||||
|
||||
this.addNotMatchTip = BI.createWidget({ |
||||
type: "bi.label", |
||||
text: BI.i18nText("BI-Basic_Press_Enter_To_Add_Text", ""), |
||||
this.addNotMatchTip = createWidget({ |
||||
type: Label.xtype, |
||||
text: i18nText("BI-Basic_Press_Enter_To_Add_Text", ""), |
||||
height: this.constants.height, |
||||
cls: "bi-keyword-red-mark", |
||||
hgap: 5, |
||||
}); |
||||
|
||||
this.loader = BI.createWidget({ |
||||
type: "bi.single_select_search_loader", |
||||
this.loader = createWidget({ |
||||
type: SingleSelectSearchLoader.xtype, |
||||
allowNoSelect: o.allowNoSelect, |
||||
keywordGetter: o.keywordGetter, |
||||
valueFormatter: o.valueFormatter, |
||||
itemsCreator: function (op, callback) { |
||||
o.itemsCreator.apply(self, [op, function (res) { |
||||
callback(res); |
||||
self.setKeyword(o.keywordGetter()); |
||||
}]); |
||||
itemsCreator (op, callback) { |
||||
o.itemsCreator.apply(self, [ |
||||
op, |
||||
function (res) { |
||||
callback(res); |
||||
self.setKeyword(o.keywordGetter()); |
||||
} |
||||
]); |
||||
}, |
||||
value: o.value |
||||
value: o.value, |
||||
}); |
||||
this.loader.on(BI.Controller.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
||||
this.loader.on(Controller.EVENT_CHANGE, function () { |
||||
self.fireEvent(Controller.EVENT_CHANGE, arguments); |
||||
}); |
||||
|
||||
this.resizer = BI.createWidget({ |
||||
type: "bi.vertical_fill", |
||||
this.resizer = createWidget({ |
||||
type: VerticalFillLayout.xtype, |
||||
rowSize: ["", "fill"], |
||||
element: this, |
||||
items: [{ |
||||
type: "bi.vertical", |
||||
items: [this.addNotMatchTip], |
||||
height: this.constants.height |
||||
}, { |
||||
el: this.loader |
||||
}] |
||||
items: [ |
||||
{ |
||||
type: VerticalLayout.xtype, |
||||
items: [this.addNotMatchTip], |
||||
height: this.constants.height, |
||||
}, |
||||
{ |
||||
el: this.loader, |
||||
} |
||||
], |
||||
}); |
||||
}, |
||||
} |
||||
|
||||
setKeyword: function (keyword) { |
||||
this.addNotMatchTip.setText(BI.i18nText("BI-Basic_Press_Enter_To_Add_Text", keyword)); |
||||
}, |
||||
setKeyword(keyword) { |
||||
this.addNotMatchTip.setText(i18nText("BI-Basic_Press_Enter_To_Add_Text", keyword)); |
||||
} |
||||
|
||||
hasMatched: function () { |
||||
hasMatched() { |
||||
return false; |
||||
}, |
||||
} |
||||
|
||||
setValue: function (v) { |
||||
setValue(v) { |
||||
this.loader.setValue(v); |
||||
}, |
||||
} |
||||
|
||||
getValue: function () { |
||||
getValue() { |
||||
return this.loader.getValue(); |
||||
}, |
||||
} |
||||
|
||||
empty: function () { |
||||
empty() { |
||||
this.loader.empty(); |
||||
}, |
||||
|
||||
populate: function (items) { |
||||
this.loader.populate.apply(this.loader, arguments); |
||||
} |
||||
}); |
||||
|
||||
BI.SingleSelectSearchInsertPane.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
|
||||
BI.shortcut("bi.single_select_search_insert_pane", BI.SingleSelectSearchInsertPane); |
||||
populate(items) { |
||||
this.loader.populate(...arguments); |
||||
} |
||||
} |
||||
|
@ -1,101 +1,105 @@
|
||||
/** |
||||
* |
||||
* 在搜索框中输入文本弹出的面板 |
||||
* @class BI.SingleSelectSearchPane |
||||
* @extends Widget |
||||
*/ |
||||
import { shortcut, Widget, extend, emptyFn, createWidget, i18nText, Controller, VerticalFillLayout } from "@/core"; |
||||
import { Label } from "@/base"; |
||||
import { SingleSelectSearchLoader } from "./singleselect.search.loader"; |
||||
|
||||
BI.SingleSelectSearchPane = BI.inherit(BI.Widget, { |
||||
@shortcut() |
||||
export class SingleSelectSearchPane extends Widget { |
||||
static xtype = "bi.single_select_search_pane"; |
||||
|
||||
constants: { |
||||
height: 25, |
||||
lgap: 10, |
||||
tgap: 5 |
||||
}, |
||||
constants = { height: 25, lgap: 10, tgap: 5 }; |
||||
|
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.SingleSelectSearchPane.superclass._defaultConfig.apply(this, arguments), { |
||||
static EVENT_CHANGE = "EVENT_CHANGE"; |
||||
|
||||
_defaultConfig() { |
||||
return extend(super._defaultConfig(...arguments), { |
||||
baseCls: "bi-single-select-search-pane bi-card", |
||||
allowNoSelect: false, |
||||
itemsCreator: BI.emptyFn, |
||||
valueFormatter: BI.emptyFn, |
||||
keywordGetter: BI.emptyFn |
||||
itemsCreator: emptyFn, |
||||
valueFormatter: emptyFn, |
||||
keywordGetter: emptyFn, |
||||
}); |
||||
}, |
||||
} |
||||
|
||||
_init: function () { |
||||
BI.SingleSelectSearchPane.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
_init() { |
||||
super._init(...arguments); |
||||
const self = this, |
||||
o = this.options; |
||||
|
||||
this.tooltipClick = BI.createWidget({ |
||||
type: "bi.label", |
||||
this.tooltipClick = createWidget({ |
||||
type: Label.xtype, |
||||
invisible: true, |
||||
text: BI.i18nText("BI-Click_Blank_To_Select"), |
||||
text: i18nText("BI-Click_Blank_To_Select"), |
||||
cls: "single-select-toolbar", |
||||
height: this.constants.height |
||||
height: this.constants.height, |
||||
}); |
||||
|
||||
this.loader = BI.createWidget({ |
||||
type: "bi.single_select_search_loader", |
||||
this.loader = createWidget({ |
||||
type: SingleSelectSearchLoader.xtype, |
||||
allowNoSelect: o.allowNoSelect, |
||||
keywordGetter: o.keywordGetter, |
||||
valueFormatter: o.valueFormatter, |
||||
itemsCreator: function (op, callback) { |
||||
o.itemsCreator.apply(self, [op, function (res) { |
||||
callback(res); |
||||
self.setKeyword(o.keywordGetter()); |
||||
}]); |
||||
itemsCreator (op, callback) { |
||||
o.itemsCreator.apply(self, [ |
||||
op, |
||||
function (res) { |
||||
callback(res); |
||||
self.setKeyword(o.keywordGetter()); |
||||
} |
||||
]); |
||||
}, |
||||
value: o.value |
||||
value: o.value, |
||||
}); |
||||
this.loader.on(BI.Controller.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
||||
this.loader.on(Controller.EVENT_CHANGE, function () { |
||||
self.fireEvent(Controller.EVENT_CHANGE, arguments); |
||||
}); |
||||
|
||||
this.resizer = BI.createWidget({ |
||||
type: "bi.vertical_fill", |
||||
this.resizer = createWidget({ |
||||
type: VerticalFillLayout.xtype, |
||||
rowSize: ["", "fill"], |
||||
element: this, |
||||
items: [{ |
||||
el: this.tooltipClick, |
||||
}, { |
||||
el: this.loader |
||||
}] |
||||
items: [ |
||||
{ |
||||
el: this.tooltipClick, |
||||
}, |
||||
{ |
||||
el: this.loader, |
||||
} |
||||
], |
||||
}); |
||||
this.tooltipClick.setVisible(false); |
||||
}, |
||||
} |
||||
|
||||
setKeyword: function (keyword) { |
||||
var btn, o = this.options; |
||||
var isVisible = this.loader.getAllButtons().length > 0 && (btn = this.loader.getAllButtons()[0]) && (keyword === (o.valueFormatter(btn.getValue()) || btn.getValue())); |
||||
setKeyword(keyword) { |
||||
let btn; |
||||
const o = this.options; |
||||
const isVisible = |
||||
this.loader.getAllButtons().length > 0 && |
||||
(btn = this.loader.getAllButtons()[0]) && |
||||
keyword === (o.valueFormatter(btn.getValue()) || btn.getValue()); |
||||
if (isVisible !== this.tooltipClick.isVisible()) { |
||||
this.tooltipClick.setVisible(isVisible); |
||||
this.resizer.attr("items")[0].height = (isVisible ? this.constants.height : 0); |
||||
this.resizer.attr("items")[0].height = isVisible ? this.constants.height : 0; |
||||
this.resizer.resize(); |
||||
} |
||||
}, |
||||
} |
||||
|
||||
hasMatched: function () { |
||||
hasMatched() { |
||||
return this.tooltipClick.isVisible(); |
||||
}, |
||||
} |
||||
|
||||
setValue: function (v) { |
||||
setValue(v) { |
||||
this.loader.setValue(v); |
||||
}, |
||||
} |
||||
|
||||
getValue: function () { |
||||
getValue() { |
||||
return this.loader.getValue(); |
||||
}, |
||||
} |
||||
|
||||
empty: function () { |
||||
empty() { |
||||
this.loader.empty(); |
||||
}, |
||||
|
||||
populate: function (items) { |
||||
this.loader.populate.apply(this.loader, arguments); |
||||
} |
||||
}); |
||||
|
||||
BI.SingleSelectSearchPane.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
|
||||
BI.shortcut("bi.single_select_search_pane", BI.SingleSelectSearchPane); |
||||
populate(items) { |
||||
this.loader.populate(...arguments); |
||||
} |
||||
} |
||||
|
@ -1,178 +1,187 @@
|
||||
/** |
||||
* 单选加载数据面板 |
||||
* Created by guy on 15/11/2. |
||||
* @class BI.SingleSelectLoader |
||||
* @extends Widget |
||||
*/ |
||||
BI.SingleSelectLoader = BI.inherit(BI.Widget, { |
||||
|
||||
_constants: { |
||||
itemVgap: 5 |
||||
}, |
||||
|
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.SingleSelectLoader.superclass._defaultConfig.apply(this, arguments), { |
||||
import { shortcut, Widget, extend, emptyFn, createWidget, isUndefined, map, isKey, Controller, VerticalLayout, delay } from "@/core"; |
||||
import { ButtonGroup, Loader } from "@/base"; |
||||
import { SingleSelectList } from "./singleselect.list"; |
||||
import { SingleSelectItem, SingleSelectRadioItem } from "@/case"; |
||||
|
||||
@shortcut() |
||||
export class SingleSelectLoader extends Widget { |
||||
static xtype = "bi.single_select_loader"; |
||||
|
||||
_constants = { itemVgap: 5 }; |
||||
|
||||
static EVENT_CHANGE = "EVENT_CHANGE"; |
||||
|
||||
_defaultConfig() { |
||||
return extend(super._defaultConfig(...arguments), { |
||||
baseCls: "bi-single-select-loader", |
||||
logic: { |
||||
dynamic: true |
||||
dynamic: true, |
||||
}, |
||||
el: { |
||||
height: 400 |
||||
height: 400, |
||||
}, |
||||
allowNoSelect: false, |
||||
valueFormatter: BI.emptyFn, |
||||
itemsCreator: BI.emptyFn, |
||||
itemWrapper: BI.emptyFn, |
||||
onLoaded: BI.emptyFn |
||||
valueFormatter: emptyFn, |
||||
itemsCreator: emptyFn, |
||||
itemWrapper: emptyFn, |
||||
onLoaded: emptyFn, |
||||
}); |
||||
}, |
||||
} |
||||
|
||||
_init: function () { |
||||
BI.SingleSelectLoader.superclass._init.apply(this, arguments); |
||||
_init() { |
||||
super._init(...arguments); |
||||
|
||||
var self = this, opts = this.options; |
||||
var hasNext = false; |
||||
const self = this, |
||||
opts = this.options; |
||||
let hasNext = false; |
||||
this.storeValue = opts.value; |
||||
this.button_group = BI.createWidget({ |
||||
type: "bi.single_select_list", |
||||
this.button_group = createWidget({ |
||||
type: SingleSelectList.xtype, |
||||
allowNoSelect: opts.allowNoSelect, |
||||
logic: opts.logic, |
||||
el: BI.extend({ |
||||
onLoaded: opts.onLoaded, |
||||
el: { |
||||
type: "bi.loader", |
||||
isDefaultInit: false, |
||||
logic: { |
||||
dynamic: true, |
||||
scrolly: true |
||||
}, |
||||
el: extend( |
||||
{ |
||||
onLoaded: opts.onLoaded, |
||||
el: { |
||||
chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, |
||||
behaviors: { |
||||
redmark: function () { |
||||
return true; |
||||
} |
||||
type: Loader.xtype, |
||||
isDefaultInit: false, |
||||
logic: { |
||||
dynamic: true, |
||||
scrolly: true, |
||||
}, |
||||
layouts: [{ |
||||
type: "bi.vertical" |
||||
}] |
||||
} |
||||
} |
||||
}, opts.el), |
||||
itemsCreator: function (op, callback) { |
||||
var startValue = self._startValue; |
||||
!BI.isUndefined(self.storeValue) && (op = BI.extend(op || {}, { |
||||
selectedValues: [self.storeValue] |
||||
})); |
||||
opts.itemsCreator(op, function (ob) { |
||||
el: { |
||||
chooseType: ButtonGroup.CHOOSE_TYPE_SINGLE, |
||||
behaviors: { |
||||
redmark () { |
||||
return true; |
||||
}, |
||||
}, |
||||
layouts: [ |
||||
{ |
||||
type: VerticalLayout.xtype, |
||||
} |
||||
], |
||||
}, |
||||
}, |
||||
}, |
||||
opts.el |
||||
), |
||||
itemsCreator (op, callback) { |
||||
const startValue = self._startValue; |
||||
!isUndefined(self.storeValue) && |
||||
(op = extend(op || {}, { |
||||
selectedValues: [self.storeValue], |
||||
})); |
||||
opts.itemsCreator(op, ob => { |
||||
hasNext = ob.hasNext; |
||||
var firstItems = []; |
||||
if (op.times === 1 && !BI.isUndefined(self.storeValue)) { |
||||
var json = BI.map([self.storeValue], function (i, v) { |
||||
var txt = opts.valueFormatter(v) || v; |
||||
return opts.itemWrapper({ |
||||
text: txt, |
||||
value: v, |
||||
title: txt, |
||||
selected: true |
||||
}) || { |
||||
text: txt, |
||||
value: v, |
||||
title: txt, |
||||
selected: true |
||||
}; |
||||
let firstItems = []; |
||||
if (op.times === 1 && !isUndefined(self.storeValue)) { |
||||
const json = map([self.storeValue], (i, v) => { |
||||
const txt = opts.valueFormatter(v) || v; |
||||
|
||||
return ( |
||||
opts.itemWrapper({ |
||||
text: txt, |
||||
value: v, |
||||
title: txt, |
||||
selected: true, |
||||
}) || { |
||||
text: txt, |
||||
value: v, |
||||
title: txt, |
||||
selected: true, |
||||
} |
||||
); |
||||
}); |
||||
firstItems = self._createItems(json); |
||||
} |
||||
callback(firstItems.concat(self._createItems(ob.items)), ob.keyword || ""); |
||||
if (op.times === 1 && self.storeValue) { |
||||
BI.isKey(startValue) && (self.storeValue = startValue); |
||||
isKey(startValue) && (self.storeValue = startValue); |
||||
self.setValue(self.storeValue); |
||||
} |
||||
(op.times === 1) && self._scrollToTop(); |
||||
op.times === 1 && self._scrollToTop(); |
||||
}); |
||||
}, |
||||
hasNext: function () { |
||||
hasNext () { |
||||
return hasNext; |
||||
}, |
||||
value: this.storeValue |
||||
value: this.storeValue, |
||||
}); |
||||
|
||||
BI.createWidget({ |
||||
type: "bi.vertical", |
||||
createWidget({ |
||||
type: VerticalLayout.xtype, |
||||
element: this, |
||||
items: [this.button_group], |
||||
vgap: this._constants.itemVgap |
||||
vgap: this._constants.itemVgap, |
||||
}); |
||||
|
||||
this.button_group.on(BI.Controller.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
||||
this.button_group.on(Controller.EVENT_CHANGE, function () { |
||||
self.fireEvent(Controller.EVENT_CHANGE, arguments); |
||||
}); |
||||
this.button_group.on(BI.SingleSelectList.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.SingleSelectLoader.EVENT_CHANGE, arguments); |
||||
this.button_group.on(SingleSelectList.EVENT_CHANGE, function () { |
||||
self.fireEvent(SingleSelectLoader.EVENT_CHANGE, arguments); |
||||
}); |
||||
}, |
||||
} |
||||
|
||||
_createItems: function (items) { |
||||
var o = this.options; |
||||
return BI.map(items, function (i, item) { |
||||
return BI.extend({ |
||||
type: o.allowNoSelect ? "bi.single_select_item" : "bi.single_select_radio_item", |
||||
_createItems(items) { |
||||
const o = this.options; |
||||
|
||||
return map(items, (i, item) => extend( |
||||
{ |
||||
type: o.allowNoSelect ? SingleSelectItem.xtype : SingleSelectRadioItem.xtype, |
||||
logic: o.logic, |
||||
cls: "bi-list-item-active", |
||||
height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, |
||||
selected: false, |
||||
iconWrapperWidth: 26, |
||||
textHgap: o.allowNoSelect ? 10 : 0, |
||||
title: item.title || item.text |
||||
}, item); |
||||
}); |
||||
}, |
||||
title: item.title || item.text, |
||||
}, |
||||
item |
||||
)); |
||||
} |
||||
|
||||
_scrollToTop: function () { |
||||
var self = this; |
||||
BI.delay(function () { |
||||
_scrollToTop() { |
||||
const self = this; |
||||
delay(() => { |
||||
self.button_group.element.scrollTop(0); |
||||
}, 30); |
||||
}, |
||||
} |
||||
|
||||
_assertValue: function (val) { |
||||
}, |
||||
_assertValue(val) {} |
||||
|
||||
setStartValue: function (v) { |
||||
setStartValue(v) { |
||||
this._startValue = v; |
||||
}, |
||||
} |
||||
|
||||
setValue: function (v) { |
||||
setValue(v) { |
||||
this.storeValue = v; |
||||
this._assertValue(this.storeValue); |
||||
this.button_group.setValue(this.storeValue); |
||||
}, |
||||
} |
||||
|
||||
getValue: function () { |
||||
getValue() { |
||||
return this.button_group.getValue(); |
||||
}, |
||||
} |
||||
|
||||
getAllButtons: function () { |
||||
getAllButtons() { |
||||
return this.button_group.getAllButtons(); |
||||
}, |
||||
} |
||||
|
||||
empty: function () { |
||||
empty() { |
||||
this.button_group.empty(); |
||||
}, |
||||
} |
||||
|
||||
populate: function (items) { |
||||
this.button_group.populate.apply(this.button_group, arguments); |
||||
}, |
||||
populate(items) { |
||||
this.button_group.populate(...arguments); |
||||
} |
||||
|
||||
resetHeight: function (h) { |
||||
resetHeight(h) { |
||||
this.button_group.resetHeight(h - this._constants.itemVgap * 2); |
||||
}, |
||||
} |
||||
|
||||
resetWidth: function (w) { |
||||
resetWidth(w) { |
||||
this.button_group.resetWidth(w); |
||||
} |
||||
}); |
||||
|
||||
BI.SingleSelectLoader.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.shortcut("bi.single_select_loader", BI.SingleSelectLoader); |
||||
} |
||||
|
@ -1,84 +1,82 @@
|
||||
/** |
||||
* 带加载的单选下拉面板 |
||||
* @class BI.SingleSelectPopupView |
||||
* @extends Widget |
||||
*/ |
||||
BI.SingleSelectPopupView = BI.inherit(BI.Widget, { |
||||
import { shortcut, Widget, extend, emptyFn, createWidget } from "@/core"; |
||||
import { MultiPopupView } from "@/case"; |
||||
import { PopupView } from "@/base"; |
||||
|
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.SingleSelectPopupView.superclass._defaultConfig.apply(this, arguments), { |
||||
@shortcut() |
||||
export class SingleSelectPopupView extends Widget { |
||||
static xtype = "bi.single_select_popup_view"; |
||||
|
||||
static EVENT_CHANGE = "EVENT_CHANGE"; |
||||
|
||||
_defaultConfig() { |
||||
return extend(super._defaultConfig(...arguments), { |
||||
baseCls: "bi-single-select-popup-view", |
||||
allowNoSelect: false, |
||||
maxWidth: "auto", |
||||
minWidth: 135, |
||||
maxHeight: 400, |
||||
valueFormatter: BI.emptyFn, |
||||
itemsCreator: BI.emptyFn, |
||||
itemWrapper: BI.emptyFn, |
||||
onLoaded: BI.emptyFn |
||||
valueFormatter: emptyFn, |
||||
itemsCreator: emptyFn, |
||||
itemWrapper: emptyFn, |
||||
onLoaded: emptyFn, |
||||
}); |
||||
}, |
||||
} |
||||
|
||||
_init: function () { |
||||
BI.SingleSelectPopupView.superclass._init.apply(this, arguments); |
||||
var self = this, opts = this.options; |
||||
_init() { |
||||
super._init(...arguments); |
||||
const opts = this.options; |
||||
|
||||
this.loader = BI.createWidget({ |
||||
this.loader = createWidget({ |
||||
type: "bi.single_select_loader", |
||||
allowNoSelect: opts.allowNoSelect, |
||||
itemsCreator: opts.itemsCreator, |
||||
itemWrapper: opts.itemWrapper, |
||||
valueFormatter: opts.valueFormatter, |
||||
onLoaded: opts.onLoaded, |
||||
value: opts.value |
||||
value: opts.value, |
||||
}); |
||||
|
||||
this.popupView = BI.createWidget({ |
||||
type: "bi.popup_view", |
||||
this.popupView = createWidget({ |
||||
type: PopupView.xtype, |
||||
stopPropagation: false, |
||||
maxWidth: opts.maxWidth, |
||||
minWidth: opts.minWidth, |
||||
maxHeight: opts.maxHeight, |
||||
element: this, |
||||
el: this.loader, |
||||
value: opts.value |
||||
value: opts.value, |
||||
}); |
||||
|
||||
this.popupView.on(BI.MultiPopupView.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.SingleSelectPopupView.EVENT_CHANGE); |
||||
this.popupView.on(MultiPopupView.EVENT_CHANGE, () => { |
||||
this.fireEvent(SingleSelectPopupView.EVENT_CHANGE); |
||||
}); |
||||
}, |
||||
} |
||||
|
||||
setStartValue: function (v) { |
||||
setStartValue(v) { |
||||
this.loader.setStartValue(v); |
||||
}, |
||||
} |
||||
|
||||
setValue: function (v) { |
||||
setValue(v) { |
||||
this.popupView.setValue(v); |
||||
}, |
||||
} |
||||
|
||||
getValue: function () { |
||||
getValue() { |
||||
return this.popupView.getValue(); |
||||
}, |
||||
} |
||||
|
||||
populate: function (items) { |
||||
this.popupView.populate.apply(this.popupView, arguments); |
||||
}, |
||||
populate(items) { |
||||
this.popupView.populate(...arguments); |
||||
} |
||||
|
||||
resetHeight: function (h) { |
||||
resetHeight(h) { |
||||
this.popupView.resetHeight(h); |
||||
}, |
||||
} |
||||
|
||||
resetWidth: function (w) { |
||||
resetWidth(w) { |
||||
this.popupView.resetWidth(w); |
||||
}, |
||||
} |
||||
|
||||
setDirection: function (direction, position) { |
||||
setDirection(direction, position) { |
||||
this.popupView.setDirection(direction, position); |
||||
}, |
||||
}); |
||||
|
||||
BI.SingleSelectPopupView.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
|
||||
|
||||
BI.shortcut("bi.single_select_popup_view", BI.SingleSelectPopupView); |
||||
} |
||||
} |
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue