Browse Source
Merge in VISUAL/fineui from ~DAILER/fineui:es6 to es6 * commit '13582d01da4d51209121845c6bd73e9d3a441d93': update updatees6
Dailer-刘荣歆
2 years ago
33 changed files with 1108 additions and 2027 deletions
@ -1,92 +0,0 @@
|
||||
import { NodeButton } from "../../../base/single/button/button.node"; |
||||
import { shortcut, extend, createWidget, Controller } from "../../../core"; |
||||
|
||||
|
||||
/** |
||||
* 加号表示的组节点 |
||||
* Created by GUY on 2015/9/6. |
||||
* @class FirstPlusGroupNode |
||||
* @extends NodeButton |
||||
*/ |
||||
@shortcut() |
||||
export class FirstPlusGroupNode extends NodeButton { |
||||
static xtype = "bi.first_plus_group_node"; |
||||
|
||||
_defaultConfig() { |
||||
const conf = super._defaultConfig(...arguments); |
||||
|
||||
return extend(conf, { |
||||
baseCls: `${conf.baseCls || ""} bi-first-plus-group-node bi-list-item`, |
||||
logic: { |
||||
dynamic: false, |
||||
}, |
||||
id: "", |
||||
pId: "", |
||||
open: false, |
||||
height: 24, |
||||
}); |
||||
} |
||||
|
||||
_init() { |
||||
super._init.apply(this, arguments); |
||||
const o = this.options; |
||||
this.checkbox = createWidget({ |
||||
type: "bi.first_tree_node_checkbox", |
||||
stopPropagation: true, |
||||
iconHeight: o.height, |
||||
iconWidth: o.height, |
||||
}); |
||||
this.text = createWidget({ |
||||
type: "bi.label", |
||||
textAlign: "left", |
||||
whiteSpace: "nowrap", |
||||
textHeight: o.height, |
||||
height: o.height, |
||||
hgap: o.hgap, |
||||
text: o.text, |
||||
value: o.value, |
||||
py: o.py, |
||||
keyword: o.keyword, |
||||
}); |
||||
this.checkbox.on(Controller.EVENT_CHANGE, function (type) { |
||||
if (type === BI.Events.CLICK) { |
||||
if (this.isSelected()) { |
||||
self.triggerExpand(); |
||||
} else { |
||||
self.triggerCollapse(); |
||||
} |
||||
} |
||||
}); |
||||
const type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); |
||||
const items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { |
||||
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, |
||||
el: this.checkbox, |
||||
}, this.text); |
||||
BI.createWidget(BI.extend({ |
||||
element: this, |
||||
}, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { |
||||
items, |
||||
})))); |
||||
} |
||||
|
||||
doRedMark() { |
||||
this.text.doRedMark(...arguments); |
||||
} |
||||
|
||||
unRedMark() { |
||||
this.text.unRedMark(...arguments); |
||||
} |
||||
|
||||
doClick() { |
||||
super.doClick(...arguments); |
||||
this.checkbox.setSelected(this.isSelected()); |
||||
} |
||||
|
||||
setOpened(v) { |
||||
super.setOpened(...arguments); |
||||
if (BI.isNotNull(this.checkbox)) { |
||||
this.checkbox.setSelected(v); |
||||
} |
||||
} |
||||
} |
||||
|
@ -1,89 +0,0 @@
|
||||
import { NodeButton } from "../../../base/single/button/button.node"; |
||||
import { shortcut, extend, createWidget, isNotNull, Controller } from "../../../core"; |
||||
|
||||
/** |
||||
* 加号表示的组节点 |
||||
* Created by GUY on 2015/9/6. |
||||
* @class LastPlusGroupNode |
||||
* @extends NodeButton |
||||
*/ |
||||
@shortcut() |
||||
export class LastPlusGroupNode extends NodeButton { |
||||
static xtype = "bi.last_plus_group_node"; |
||||
|
||||
_defaultConfig() { |
||||
const conf = super._defaultConfig(...arguments); |
||||
|
||||
return extend(conf, { |
||||
baseCls: `${conf.baseCls || ""} bi-last-plus-group-node bi-list-item`, |
||||
logic: { |
||||
dynamic: false, |
||||
}, |
||||
id: "", |
||||
pId: "", |
||||
open: false, |
||||
height: 24, |
||||
}); |
||||
} |
||||
_init() { |
||||
BI.LastPlusGroupNode.superclass._init.apply(this, arguments); |
||||
const o = this.options; |
||||
this.checkbox = createWidget({ |
||||
type: "bi.last_tree_node_checkbox", |
||||
stopPropagation: true, |
||||
iconHeight: o.height, |
||||
iconWidth: o.height, |
||||
}); |
||||
this.text = createWidget({ |
||||
type: "bi.label", |
||||
textAlign: "left", |
||||
whiteSpace: "nowrap", |
||||
textHeight: o.height, |
||||
height: o.height, |
||||
hgap: o.hgap, |
||||
text: o.text, |
||||
value: o.value, |
||||
py: o.py, |
||||
keyword: o.keyword, |
||||
}); |
||||
this.checkbox.on(Controller.EVENT_CHANGE, type => { |
||||
if (type === BI.Events.CLICK) { |
||||
if (this.checkbox.isSelected()) { |
||||
this.triggerExpand(); |
||||
} else { |
||||
this.triggerCollapse(); |
||||
} |
||||
} |
||||
}); |
||||
const type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); |
||||
const items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { |
||||
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, |
||||
el: this.checkbox, |
||||
}, this.text); |
||||
createWidget(extend({ |
||||
element: this, |
||||
}, BI.LogicFactory.createLogic(type, extend(o.logic, { |
||||
items, |
||||
})))); |
||||
} |
||||
|
||||
doRedMark() { |
||||
this.text.doRedMark(...arguments); |
||||
} |
||||
|
||||
unRedMark() { |
||||
this.text.unRedMark(...arguments); |
||||
} |
||||
|
||||
doClick() { |
||||
super.doClick(...arguments); |
||||
this.checkbox.setSelected(this.isSelected()); |
||||
} |
||||
|
||||
setOpened(v) { |
||||
super.setOpened(...arguments); |
||||
if (isNotNull(this.checkbox)) { |
||||
this.checkbox.setSelected(v); |
||||
} |
||||
} |
||||
} |
@ -1,91 +0,0 @@
|
||||
import { NodeButton } from "../../../base/single/button/button.node"; |
||||
import { shortcut, extend, createWidget, Controller } from "../../../core"; |
||||
|
||||
/** |
||||
* 加号表示的组节点 |
||||
* Created by GUY on 2015/9/6. |
||||
* @class BI.MidPlusGroupNode |
||||
* @extends BI.NodeButton |
||||
*/ |
||||
@shortcut |
||||
export class MidPlusGroupNode extends NodeButton { |
||||
static xtype = "bi.mid_plus_group_node"; |
||||
|
||||
_defaultConfig() { |
||||
const conf = super._defaultConfig(...arguments); |
||||
|
||||
return extend(conf, { |
||||
baseCls: `${conf.baseCls || ""} bi-mid-plus-group-node bi-list-item`, |
||||
logic: { |
||||
dynamic: false, |
||||
}, |
||||
id: "", |
||||
pId: "", |
||||
open: false, |
||||
height: 24, |
||||
}); |
||||
} |
||||
|
||||
_init() { |
||||
super._init(...arguments); |
||||
const o = this.options; |
||||
this.checkbox = createWidget({ |
||||
type: "bi.mid_tree_node_checkbox", |
||||
stopPropagation: true, |
||||
iconHeight: o.height, |
||||
iconWidth: o.height, |
||||
}); |
||||
this.text = createWidget({ |
||||
type: "bi.label", |
||||
textAlign: "left", |
||||
whiteSpace: "nowrap", |
||||
textHeight: o.height, |
||||
height: o.height, |
||||
hgap: o.hgap, |
||||
text: o.text, |
||||
value: o.value, |
||||
py: o.py, |
||||
keyword: o.keyword, |
||||
}); |
||||
this.checkbox.on(Controller.EVENT_CHANGE, type => { |
||||
if (type === BI.Events.CLICK) { |
||||
if (this.checkbox.isSelected()) { |
||||
this.triggerExpand(); |
||||
} else { |
||||
this.triggerCollapse(); |
||||
} |
||||
} |
||||
}); |
||||
const type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); |
||||
const items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { |
||||
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, |
||||
el: this.checkbox, |
||||
}, this.text); |
||||
createWidget(extend({ |
||||
element: this, |
||||
}, BI.LogicFactory.createLogic(type, extend(o.logic, { |
||||
items, |
||||
})))); |
||||
} |
||||
|
||||
doRedMark() { |
||||
this.text.doRedMark(...arguments); |
||||
} |
||||
|
||||
unRedMark() { |
||||
this.text.unRedMark(...arguments); |
||||
} |
||||
|
||||
doClick() { |
||||
super.doClick(...arguments); |
||||
this.checkbox.setSelected(this.isSelected()); |
||||
} |
||||
|
||||
setOpened(v) { |
||||
super.setOpened(...arguments); |
||||
if (BI.isNotNull(this.checkbox)) { |
||||
this.checkbox.setSelected(v); |
||||
} |
||||
} |
||||
} |
||||
|
@ -0,0 +1,2 @@
|
||||
export { MultiLayerSelectTreeCombo } from "./multilayerselecttree.combo"; |
||||
export { MultiLayerSelectLevelTree } from "./multilayerselecttree.leveltree"; |
@ -1,77 +1,85 @@
|
||||
/** |
||||
* Created by GUY on 2016/1/26. |
||||
* |
||||
* @class BI.MultiLayerSelectTreePopup |
||||
* @extends BI.Pane |
||||
*/ |
||||
import { |
||||
shortcut, |
||||
Widget, |
||||
extend, |
||||
i18nText, |
||||
emptyFn, |
||||
createWidget, |
||||
Controller, |
||||
VerticalLayout, |
||||
isArray |
||||
} from "@/core"; |
||||
import { MultiLayerSelectLevelTree } from "./multilayerselecttree.leveltree"; |
||||
|
||||
BI.MultiLayerSelectTreePopup = BI.inherit(BI.Widget, { |
||||
@shortcut() |
||||
export class MultiLayerSelectTreePopup extends Widget { |
||||
static xtype = "bi.multilayer_select_tree_popup"; |
||||
|
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.MultiLayerSelectTreePopup.superclass._defaultConfig.apply(this, arguments), { |
||||
static EVENT_CHANGE = "EVENT_CHANGE"; |
||||
|
||||
_defaultConfig() { |
||||
return extend(super._defaultConfig(...arguments), { |
||||
baseCls: "bi-multilayer-select-tree-popup", |
||||
tipText: BI.i18nText("BI-No_Selected_Item"), |
||||
tipText: i18nText("BI-No_Selected_Item"), |
||||
isDefaultInit: false, |
||||
itemsCreator: BI.emptyFn, |
||||
itemsCreator: emptyFn, |
||||
items: [], |
||||
value: "", |
||||
onLoaded: BI.emptyFn, |
||||
minHeight: 240 |
||||
onLoaded: emptyFn, |
||||
minHeight: 240, |
||||
}); |
||||
}, |
||||
} |
||||
|
||||
_init: function () { |
||||
BI.MultiLayerSelectTreePopup.superclass._init.apply(this, arguments); |
||||
_init() { |
||||
super._init(...arguments); |
||||
|
||||
var self = this, o = this.options; |
||||
const self = this, |
||||
o = this.options; |
||||
|
||||
this.tree = BI.createWidget({ |
||||
type: "bi.multilayer_select_level_tree", |
||||
this.tree = createWidget({ |
||||
type: MultiLayerSelectLevelTree.xtype, |
||||
isDefaultInit: o.isDefaultInit, |
||||
items: o.items, |
||||
itemsCreator: o.itemsCreator, |
||||
keywordGetter: o.keywordGetter, |
||||
value: o.value, |
||||
scrollable: null, |
||||
onLoaded: function () { |
||||
onLoaded() { |
||||
self.tree.check(); |
||||
o.onLoaded(); |
||||
} |
||||
}, |
||||
}); |
||||
|
||||
BI.createWidget({ |
||||
type: "bi.vertical", |
||||
createWidget({ |
||||
type: VerticalLayout.xtype, |
||||
scrolly: false, |
||||
scrollable: true, |
||||
element: this, |
||||
vgap: 5, |
||||
items: [this.tree] |
||||
items: [this.tree], |
||||
}); |
||||
|
||||
this.tree.on(BI.Controller.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
||||
this.tree.on(Controller.EVENT_CHANGE, function () { |
||||
self.fireEvent(Controller.EVENT_CHANGE, arguments); |
||||
}); |
||||
|
||||
this.tree.on(BI.MultiLayerSelectLevelTree.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.MultiLayerSelectTreePopup.EVENT_CHANGE); |
||||
this.tree.on(MultiLayerSelectLevelTree.EVENT_CHANGE, () => { |
||||
self.fireEvent(MultiLayerSelectTreePopup.EVENT_CHANGE); |
||||
}); |
||||
|
||||
this.tree.css("min-height", BI.pixFormat(o.minHeight - 10)); |
||||
}, |
||||
} |
||||
|
||||
getValue: function () { |
||||
getValue() { |
||||
return this.tree.getValue(); |
||||
}, |
||||
} |
||||
|
||||
setValue: function (v) { |
||||
v = BI.isArray(v) ? v : [v]; |
||||
setValue(v) { |
||||
v = isArray(v) ? v : [v]; |
||||
this.tree.setValue(v); |
||||
}, |
||||
} |
||||
|
||||
populate: function (items) { |
||||
populate(items) { |
||||
this.tree.populate(items); |
||||
} |
||||
}); |
||||
|
||||
BI.MultiLayerSelectTreePopup.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.shortcut("bi.multilayer_select_tree_popup", BI.MultiLayerSelectTreePopup); |
||||
} |
||||
|
@ -1,237 +1,301 @@
|
||||
/** |
||||
* Created by Windy on 2018/2/2. |
||||
*/ |
||||
BI.MultiLayerSelectTreeTrigger = BI.inherit(BI.Trigger, { |
||||
import { |
||||
shortcut, |
||||
emptyFn, |
||||
i18nText, |
||||
isNotNull, |
||||
isKey, |
||||
HorizontalFillLayout, |
||||
Tree, |
||||
deepClone, |
||||
Func, |
||||
concat, |
||||
isNotEmptyArray, |
||||
each, |
||||
uniqBy, |
||||
map, |
||||
isFunction, |
||||
find |
||||
} from "@/core"; |
||||
import { Trigger, Searcher } from "@/base"; |
||||
import { StateEditor, DefaultTextEditor } from "@/case"; |
||||
import { MultiLayerSelectTreeInsertSearchPane } from "./multilayerselecttree.insert.search.pane"; |
||||
import { MultiLayerSelectTreePopup } from "./multilayerselecttree.popup"; |
||||
|
||||
props: function () { |
||||
@shortcut() |
||||
export class MultiLayerSelectTreeTrigger extends Trigger { |
||||
static xtype = "bi.multilayer_select_tree_trigger"; |
||||
|
||||
static EVENT_FOCUS = "EVENT_FOCUS"; |
||||
static EVENT_BLUR = "EVENT_BLUR"; |
||||
static EVENT_SEARCHING = "EVENT_SEARCHING"; |
||||
static EVENT_STOP = "EVENT_STOP"; |
||||
static EVENT_START = "EVENT_START"; |
||||
static EVENT_CHANGE = "EVENT_CHANGE"; |
||||
static EVENT_ADD_ITEM = "EVENT_ADD_ITEM"; |
||||
|
||||
props() { |
||||
return { |
||||
extraCls: "bi-multi-layer-select-tree-trigger", |
||||
height: 24, |
||||
itemsCreator: BI.emptyFn, |
||||
watermark: BI.i18nText("BI-Basic_Search"), |
||||
itemsCreator: emptyFn, |
||||
watermark: i18nText("BI-Basic_Search"), |
||||
allowSearchValue: false, |
||||
title: BI.bind(this._getShowText, this) |
||||
title: () => this._getShowText(), |
||||
}; |
||||
}, |
||||
} |
||||
|
||||
render: function () { |
||||
var self = this, o = this.options; |
||||
render() { |
||||
const self = this, |
||||
o = this.options; |
||||
if (o.itemsCreator === BI.emptyFn) { |
||||
this._initData(); |
||||
} |
||||
|
||||
return { |
||||
type: "bi.horizontal_fill", |
||||
type: HorizontalFillLayout.xtype, |
||||
items: [ |
||||
{ |
||||
el: { |
||||
type: "bi.searcher", |
||||
ref: function () { |
||||
type: Searcher.xtype, |
||||
ref() { |
||||
self.searcher = this; |
||||
}, |
||||
masker: BI.isNotNull(o.container) ? { |
||||
masker: isNotNull(o.container) |
||||
? { |
||||
offset: {}, |
||||
container: o.container, |
||||
} |
||||
: { |
||||
offset: {}, |
||||
container: o.container |
||||
} : { |
||||
offset: {} |
||||
}, |
||||
isAutoSearch: false, |
||||
el: { |
||||
type: "bi.default_text_editor", |
||||
ref: function () { |
||||
type: DefaultTextEditor.xtype, |
||||
ref() { |
||||
self.editor = this; |
||||
}, |
||||
defaultText: o.defaultText, |
||||
text: BI.isKey(o.value) ? this._digest(o.value) : o.text, |
||||
text: isKey(o.value) |
||||
? this._digest(o.value) |
||||
: o.text, |
||||
value: o.value, |
||||
height: o.height, |
||||
tipText: "", |
||||
watermark: o.watermark, |
||||
listeners: [{ |
||||
eventName: BI.StateEditor.EVENT_FOCUS, |
||||
action: function () { |
||||
self.fireEvent(BI.MultiLayerSelectTreeTrigger.EVENT_FOCUS); |
||||
} |
||||
}, { |
||||
eventName: BI.StateEditor.EVENT_BLUR, |
||||
action: function () { |
||||
self.fireEvent(BI.MultiLayerSelectTreeTrigger.EVENT_BLUR); |
||||
} |
||||
}, { |
||||
eventName: BI.StateEditor.EVENT_CHANGE, |
||||
action: function () { |
||||
self.fireEvent(BI.MultiLayerSelectTreeTrigger.EVENT_SEARCHING); |
||||
listeners: [ |
||||
{ |
||||
eventName: StateEditor.EVENT_FOCUS, |
||||
action() { |
||||
self.fireEvent( |
||||
MultiLayerSelectTreeTrigger.EVENT_FOCUS |
||||
); |
||||
}, |
||||
}, |
||||
{ |
||||
eventName: StateEditor.EVENT_BLUR, |
||||
action() { |
||||
self.fireEvent( |
||||
MultiLayerSelectTreeTrigger.EVENT_BLUR |
||||
); |
||||
}, |
||||
}, |
||||
{ |
||||
eventName: StateEditor.EVENT_CHANGE, |
||||
action() { |
||||
self.fireEvent( |
||||
MultiLayerSelectTreeTrigger.EVENT_SEARCHING |
||||
); |
||||
}, |
||||
} |
||||
}] |
||||
], |
||||
}, |
||||
popup: { |
||||
type: o.allowInsertValue ? "bi.multilayer_select_tree_insert_search_pane" : "bi.multilayer_select_tree_popup", |
||||
itemsCreator: o.itemsCreator === BI.emptyFn ? BI.emptyFn : function (op, callback) { |
||||
type: o.allowInsertValue |
||||
? MultiLayerSelectTreeInsertSearchPane.xtype |
||||
: MultiLayerSelectTreePopup.xtype, |
||||
itemsCreator: |
||||
o.itemsCreator === emptyFn |
||||
? emptyFn |
||||
: function (op, callback) { |
||||
op.keyword = self.editor.getValue(); |
||||
o.itemsCreator(op, callback); |
||||
}, |
||||
keywordGetter: function () { |
||||
keywordGetter() { |
||||
return self.editor.getValue(); |
||||
}, |
||||
cls: "bi-card", |
||||
listeners: [{ |
||||
eventName: BI.MultiLayerSelectTreeInsertSearchPane.EVENT_ADD_ITEM, |
||||
action: function () { |
||||
self.options.text = self.getSearcher().getKeyword(); |
||||
self.fireEvent(BI.MultiLayerSelectTreeTrigger.EVENT_ADD_ITEM); |
||||
} |
||||
}], |
||||
ref: function (_ref) { |
||||
self.popup = _ref; |
||||
listeners: [ |
||||
{ |
||||
eventName: |
||||
MultiLayerSelectTreeInsertSearchPane.EVENT_ADD_ITEM, |
||||
action() { |
||||
self.options.text = self |
||||
.getSearcher() |
||||
.getKeyword(); |
||||
self.fireEvent( |
||||
MultiLayerSelectTreeTrigger.EVENT_ADD_ITEM |
||||
); |
||||
}, |
||||
} |
||||
], |
||||
ref(_ref) { |
||||
self.popup = _ref; |
||||
}, |
||||
onSearch: function (obj, callback) { |
||||
var keyword = obj.keyword; |
||||
}, |
||||
onSearch(obj, callback) { |
||||
const keyword = obj.keyword; |
||||
if (o.itemsCreator === BI.emptyFn) { |
||||
callback(self._getSearchItems(keyword)); |
||||
o.allowInsertValue && self.popup.setKeyword(keyword); |
||||
o.allowInsertValue && |
||||
self.popup.setKeyword(keyword); |
||||
} else { |
||||
callback(); |
||||
} |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.Searcher.EVENT_CHANGE, |
||||
action: function () { |
||||
self.fireEvent(BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE); |
||||
listeners: [ |
||||
{ |
||||
eventName: Searcher.EVENT_CHANGE, |
||||
action() { |
||||
self.fireEvent( |
||||
MultiLayerSelectTreeTrigger.EVENT_CHANGE |
||||
); |
||||
}, |
||||
} |
||||
}] |
||||
], |
||||
}, |
||||
width: "fill", |
||||
rgap: 24 |
||||
}, |
||||
] |
||||
rgap: 24, |
||||
} |
||||
], |
||||
}; |
||||
}, |
||||
} |
||||
|
||||
_initData: function () { |
||||
var o = this.options; |
||||
this.tree = new BI.Tree(); |
||||
this.nodes = BI.Tree.treeFormat(BI.deepClone(o.items)); |
||||
_initData() { |
||||
const o = this.options; |
||||
this.tree = new Tree(); |
||||
this.nodes = Tree.treeFormat(deepClone(o.items)); |
||||
this.tree.initTree(this.nodes); |
||||
}, |
||||
} |
||||
|
||||
_getSearchItems: function (keyword) { |
||||
var self = this, o = this.options; |
||||
_getSearchItems(keyword) { |
||||
const self = this, |
||||
o = this.options; |
||||
// 把数组搜索换成用BI.tree搜索节点, 搜到了就不再往下搜索
|
||||
var items = []; |
||||
this.tree.traverse(function (node) { |
||||
var find = BI.Func.getSearchResult(self.tree.isRoot(node) ? [] : BI.concat([node.text], (o.allowSearchValue ? [node.value] : [])), keyword); |
||||
const items = []; |
||||
this.tree.traverse(node => { |
||||
const find = Func.getSearchResult( |
||||
self.tree.isRoot(node) |
||||
? [] |
||||
: concat( |
||||
[node.text], |
||||
o.allowSearchValue ? [node.value] : [] |
||||
), |
||||
keyword |
||||
); |
||||
if (find.find.length > 0 || find.match.length > 0) { |
||||
items.push(node); |
||||
|
||||
return true; |
||||
} |
||||
}); |
||||
|
||||
return this._fillTreeStructure4Search(items, "id"); |
||||
}, |
||||
} |
||||
|
||||
_createJson: function (node, open) { |
||||
_createJson(node, open) { |
||||
return { |
||||
id: node.id, |
||||
pId: node.pId, |
||||
text: node.text, |
||||
value: node.value, |
||||
isParent: BI.isNotEmptyArray(node.children), |
||||
open: open |
||||
isParent: isNotEmptyArray(node.children), |
||||
open, |
||||
}; |
||||
}, |
||||
} |
||||
|
||||
_getChildren: function (node) { |
||||
var self = this; |
||||
_getChildren(node) { |
||||
const self = this; |
||||
node.children = node.children || []; |
||||
var nodes = []; |
||||
BI.each(node.children, function (idx, child) { |
||||
var children = self._getChildren(child); |
||||
let nodes = []; |
||||
each(node.children, (idx, child) => { |
||||
const children = self._getChildren(child); |
||||
nodes = nodes.concat(children); |
||||
}); |
||||
|
||||
return node.children.concat(nodes); |
||||
}, |
||||
} |
||||
|
||||
// 将搜索到的节点进行补充,构造成一棵完整的树
|
||||
_fillTreeStructure4Search: function (leaves) { |
||||
var self = this; |
||||
var result = []; |
||||
var queue = []; |
||||
BI.each(leaves, function (idx, node) { |
||||
_fillTreeStructure4Search(leaves) { |
||||
const self = this; |
||||
let result = []; |
||||
const queue = []; |
||||
each(leaves, (idx, node) => { |
||||
queue.push({ pId: node.pId }); |
||||
result.push(node); |
||||
result = result.concat(self._getChildren(node)); |
||||
}); |
||||
queue.reverse(); |
||||
while (BI.isNotEmptyArray(queue)) { |
||||
var node = queue.pop(); |
||||
var pNode = this.tree.search(this.tree.getRoot(), node.pId, "id"); |
||||
while (isNotEmptyArray(queue)) { |
||||
const node = queue.pop(); |
||||
const pNode = this.tree.search(this.tree.getRoot(), node.pId, "id"); |
||||
if (pNode != null) { |
||||
pNode.open = true; |
||||
queue.push({ pId: pNode.pId }); |
||||
result.push(pNode); |
||||
} |
||||
} |
||||
return BI.uniqBy(BI.map(result, function (idx, node) { |
||||
return self._createJson(node, node.open); |
||||
}), "id"); |
||||
}, |
||||
|
||||
_digest: function (v) { |
||||
var o = this.options; |
||||
if (BI.isFunction(o.valueFormatter)) { |
||||
return uniqBy( |
||||
map(result, (idx, node) => self._createJson(node, node.open)), |
||||
"id" |
||||
); |
||||
} |
||||
|
||||
_digest(v) { |
||||
const o = this.options; |
||||
if (isFunction(o.valueFormatter)) { |
||||
return o.valueFormatter(v); |
||||
} |
||||
|
||||
var result = BI.find(o.items, function (i, item) { |
||||
return item.value === v; |
||||
}); |
||||
const result = find(o.items, (i, item) => item.value === v); |
||||
|
||||
return BI.isNotNull(result) ? result.text : (o.text ?? v); |
||||
}, |
||||
return isNotNull(result) ? result.text : o.text ?? v; |
||||
} |
||||
|
||||
_getShowText: function () { |
||||
_getShowText() { |
||||
return this.editor.getText(); |
||||
}, |
||||
} |
||||
|
||||
stopEditing: function () { |
||||
stopEditing() { |
||||
this.searcher.stopSearch(); |
||||
}, |
||||
} |
||||
|
||||
getSearcher: function () { |
||||
getSearcher() { |
||||
return this.searcher; |
||||
}, |
||||
} |
||||
|
||||
populate: function (items) { |
||||
populate(items) { |
||||
this.options.items = items; |
||||
this._initData(items); |
||||
}, |
||||
} |
||||
|
||||
setValue: function (v) { |
||||
setValue(v) { |
||||
this.editor.setState(this._digest(v[0])); |
||||
}, |
||||
} |
||||
|
||||
getValue: function () { |
||||
getValue() { |
||||
return this.searcher.getValue(); |
||||
}, |
||||
} |
||||
|
||||
focus: function () { |
||||
focus() { |
||||
this.searcher.focus(); |
||||
}, |
||||
} |
||||
|
||||
blur: function () { |
||||
blur() { |
||||
this.searcher.blur(); |
||||
}, |
||||
} |
||||
|
||||
setWaterMark: function (v) { |
||||
setWaterMark(v) { |
||||
this.searcher.setWaterMark(v); |
||||
} |
||||
}); |
||||
|
||||
BI.MultiLayerSelectTreeTrigger.EVENT_FOCUS = "EVENT_FOCUS"; |
||||
BI.MultiLayerSelectTreeTrigger.EVENT_BLUR = "EVENT_BLUR"; |
||||
BI.MultiLayerSelectTreeTrigger.EVENT_SEARCHING = "EVENT_SEARCHING"; |
||||
BI.MultiLayerSelectTreeTrigger.EVENT_STOP = "EVENT_STOP"; |
||||
BI.MultiLayerSelectTreeTrigger.EVENT_START = "EVENT_START"; |
||||
BI.MultiLayerSelectTreeTrigger.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.MultiLayerSelectTreeTrigger.EVENT_ADD_ITEM = "EVENT_ADD_ITEM"; |
||||
BI.shortcut("bi.multilayer_select_tree_trigger", BI.MultiLayerSelectTreeTrigger); |
||||
} |
||||
|
@ -1,99 +0,0 @@
|
||||
/** |
||||
* 加号表示的组节点 |
||||
* |
||||
* Created by GUY on 2016/1/27. |
||||
* @class BI.MultiLayerSelectTreeFirstPlusGroupNode |
||||
* @extends BI.NodeButton |
||||
*/ |
||||
BI.MultiLayerSelectTreeFirstPlusGroupNode = BI.inherit(BI.NodeButton, { |
||||
_defaultConfig: function () { |
||||
var conf = BI.MultiLayerSelectTreeFirstPlusGroupNode.superclass._defaultConfig.apply(this, arguments); |
||||
return BI.extend(conf, { |
||||
extraCls: "bi-multilayer-select-tree-first-plus-group-node bi-list-item-active", |
||||
layer: 0, // 第几层级
|
||||
id: "", |
||||
pId: "", |
||||
readonly: true, |
||||
open: false, |
||||
height: 24 |
||||
}); |
||||
}, |
||||
_init: function () { |
||||
BI.MultiLayerSelectTreeFirstPlusGroupNode.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
this.node = BI.createWidget({ |
||||
type: "bi.select_tree_first_plus_group_node", |
||||
cls: "bi-list-item-none", |
||||
stopPropagation: true, |
||||
logic: { |
||||
dynamic: true |
||||
}, |
||||
id: o.id, |
||||
pId: o.pId, |
||||
keyword: o.keyword, |
||||
open: o.open, |
||||
height: o.height, |
||||
hgap: o.hgap, |
||||
text: o.text, |
||||
value: o.value, |
||||
py: o.py |
||||
}); |
||||
this.node.on(BI.Controller.EVENT_CHANGE, function (type) { |
||||
self.setSelected(self.isSelected()); |
||||
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
||||
}); |
||||
|
||||
var items = []; |
||||
// BI.count(0, o.layer, function (index) {
|
||||
// items.push({
|
||||
// type: "bi.layout",
|
||||
// cls: BI.contains(needBlankLayers, index) ? "" : "base-line-conn-background",
|
||||
// width: 12,
|
||||
// height: o.height
|
||||
// });
|
||||
// });
|
||||
items.push({ |
||||
el: this.node, |
||||
lgap: o.layer * BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2 |
||||
}); |
||||
BI.createWidget({ |
||||
type: "bi.horizontal_adapt", |
||||
element: this, |
||||
columnSize: BI.makeArray(o.layer, BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2), |
||||
items: items |
||||
}); |
||||
}, |
||||
|
||||
isOnce: function () { |
||||
return true; |
||||
}, |
||||
|
||||
doRedMark: function () { |
||||
this.node.doRedMark.apply(this.node, arguments); |
||||
}, |
||||
|
||||
unRedMark: function () { |
||||
this.node.unRedMark.apply(this.node, arguments); |
||||
}, |
||||
|
||||
isSelected: function () { |
||||
return this.node.isSelected(); |
||||
}, |
||||
|
||||
setSelected: function (b) { |
||||
BI.MultiLayerSelectTreeFirstPlusGroupNode.superclass.setSelected.apply(this, arguments); |
||||
this.node.setSelected(b); |
||||
}, |
||||
|
||||
doClick: function () { |
||||
BI.NodeButton.superclass.doClick.apply(this, arguments); |
||||
this.node.setSelected(this.isSelected()); |
||||
}, |
||||
|
||||
setOpened: function (v) { |
||||
BI.MultiLayerSelectTreeFirstPlusGroupNode.superclass.setOpened.apply(this, arguments); |
||||
this.node.setOpened(v); |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut("bi.multilayer_select_tree_first_plus_group_node", BI.MultiLayerSelectTreeFirstPlusGroupNode); |
@ -1,88 +0,0 @@
|
||||
/** |
||||
* 加号表示的组节点 |
||||
* |
||||
* Created by GUY on 2016/1/27. |
||||
* @class BI.MultiLayerSelectTreeLastPlusGroupNode |
||||
* @extends BI.NodeButton |
||||
*/ |
||||
BI.MultiLayerSelectTreeLastPlusGroupNode = BI.inherit(BI.NodeButton, { |
||||
_defaultConfig: function () { |
||||
var conf = BI.MultiLayerSelectTreeLastPlusGroupNode.superclass._defaultConfig.apply(this, arguments); |
||||
return BI.extend(conf, { |
||||
extraCls: "bi-multilayer-select-tree-last-plus-group-node bi-list-item-active", |
||||
layer: 0, // 第几层级
|
||||
id: "", |
||||
pId: "", |
||||
readonly: true, |
||||
open: false, |
||||
height: 24 |
||||
}); |
||||
}, |
||||
_init: function () { |
||||
BI.MultiLayerSelectTreeLastPlusGroupNode.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
this.node = BI.createWidget({ |
||||
type: "bi.select_tree_last_plus_group_node", |
||||
cls: "bi-list-item-none", |
||||
stopPropagation: true, |
||||
logic: { |
||||
dynamic: true |
||||
}, |
||||
id: o.id, |
||||
pId: o.pId, |
||||
keyword: o.keyword, |
||||
open: o.open, |
||||
height: o.height, |
||||
hgap: o.hgap, |
||||
text: o.text, |
||||
value: o.value, |
||||
py: o.py |
||||
}); |
||||
this.node.on(BI.Controller.EVENT_CHANGE, function (type) { |
||||
self.setSelected(self.isSelected()); |
||||
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
||||
}); |
||||
|
||||
var items = []; |
||||
|
||||
items.push({ |
||||
el: this.node, |
||||
lgap: o.layer * BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2 |
||||
}); |
||||
BI.createWidget({ |
||||
type: "bi.horizontal_adapt", |
||||
element: this, |
||||
columnSize: BI.makeArray(o.layer, BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2), |
||||
items: items |
||||
}); |
||||
}, |
||||
|
||||
doRedMark: function () { |
||||
this.node.doRedMark.apply(this.node, arguments); |
||||
}, |
||||
|
||||
unRedMark: function () { |
||||
this.node.unRedMark.apply(this.node, arguments); |
||||
}, |
||||
|
||||
isSelected: function () { |
||||
return this.node.isSelected(); |
||||
}, |
||||
|
||||
setSelected: function (b) { |
||||
BI.MultiLayerSelectTreeLastPlusGroupNode.superclass.setSelected.apply(this, arguments); |
||||
this.node.setSelected(b); |
||||
}, |
||||
|
||||
doClick: function () { |
||||
BI.MultiLayerSelectTreeLastPlusGroupNode.superclass.doClick.apply(this, arguments); |
||||
this.node.setSelected(this.isSelected()); |
||||
}, |
||||
|
||||
setOpened: function (v) { |
||||
BI.MultiLayerSelectTreeLastPlusGroupNode.superclass.setOpened.apply(this, arguments); |
||||
this.node.setOpened(v); |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut("bi.multilayer_select_tree_last_plus_group_node", BI.MultiLayerSelectTreeLastPlusGroupNode); |
@ -1,88 +0,0 @@
|
||||
/** |
||||
* 加号表示的组节点 |
||||
* |
||||
* Created by GUY on 2016/1/27. |
||||
* @class BI.MultiLayerSelectTreeMidPlusGroupNode |
||||
* @extends BI.NodeButton |
||||
*/ |
||||
BI.MultiLayerSelectTreeMidPlusGroupNode = BI.inherit(BI.NodeButton, { |
||||
_defaultConfig: function () { |
||||
var conf = BI.MultiLayerSelectTreeMidPlusGroupNode.superclass._defaultConfig.apply(this, arguments); |
||||
return BI.extend(conf, { |
||||
extraCls: "bi-multilayer-select-tree-mid-plus-group-node bi-list-item-active", |
||||
layer: 0, // 第几层级
|
||||
id: "", |
||||
pId: "", |
||||
readonly: true, |
||||
open: false, |
||||
height: 24 |
||||
}); |
||||
}, |
||||
_init: function () { |
||||
BI.MultiLayerSelectTreeMidPlusGroupNode.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
this.node = BI.createWidget({ |
||||
type: "bi.select_tree_mid_plus_group_node", |
||||
cls: "bi-list-item-none", |
||||
stopPropagation: true, |
||||
logic: { |
||||
dynamic: true |
||||
}, |
||||
id: o.id, |
||||
pId: o.pId, |
||||
keyword: o.keyword, |
||||
open: o.open, |
||||
height: o.height, |
||||
hgap: o.hgap, |
||||
text: o.text, |
||||
value: o.value, |
||||
py: o.py |
||||
}); |
||||
this.node.on(BI.Controller.EVENT_CHANGE, function (type) { |
||||
self.setSelected(self.isSelected()); |
||||
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
||||
}); |
||||
|
||||
var items = []; |
||||
|
||||
items.push({ |
||||
el: this.node, |
||||
lgap: o.layer * BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2 |
||||
}); |
||||
BI.createWidget({ |
||||
type: "bi.horizontal_adapt", |
||||
element: this, |
||||
columnSize: BI.makeArray(o.layer, BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2), |
||||
items: items |
||||
}); |
||||
}, |
||||
|
||||
doRedMark: function () { |
||||
this.node.doRedMark.apply(this.node, arguments); |
||||
}, |
||||
|
||||
unRedMark: function () { |
||||
this.node.unRedMark.apply(this.node, arguments); |
||||
}, |
||||
|
||||
isSelected: function () { |
||||
return this.node.isSelected(); |
||||
}, |
||||
|
||||
setSelected: function (b) { |
||||
BI.MultiLayerSelectTreeMidPlusGroupNode.superclass.setSelected.apply(this, arguments); |
||||
this.node.setSelected(b); |
||||
}, |
||||
|
||||
doClick: function () { |
||||
BI.MultiLayerSelectTreeMidPlusGroupNode.superclass.doClick.apply(this, arguments); |
||||
this.node.setSelected(this.isSelected()); |
||||
}, |
||||
|
||||
setOpened: function (v) { |
||||
BI.MultiLayerSelectTreeMidPlusGroupNode.superclass.setOpened.apply(this, arguments); |
||||
this.node.setOpened(v); |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut("bi.multilayer_select_tree_mid_plus_group_node", BI.MultiLayerSelectTreeMidPlusGroupNode); |
@ -1,92 +0,0 @@
|
||||
/** |
||||
* 加号表示的组节点 |
||||
* |
||||
* Created by GUY on 2016/1/27. |
||||
* @class BI.MultiLayerSelectTreePlusGroupNode |
||||
* @extends BI.NodeButton |
||||
*/ |
||||
BI.MultiLayerSelectTreePlusGroupNode = BI.inherit(BI.NodeButton, { |
||||
_defaultConfig: function () { |
||||
var conf = BI.MultiLayerSelectTreePlusGroupNode.superclass._defaultConfig.apply(this, arguments); |
||||
return BI.extend(conf, { |
||||
extraCls: "bi-multilayer-select-tree-first-plus-group-node bi-list-item-active", |
||||
layer: 0, // 第几层级
|
||||
id: "", |
||||
pId: "", |
||||
readonly: true, |
||||
open: false, |
||||
height: 24 |
||||
}); |
||||
}, |
||||
_init: function () { |
||||
BI.MultiLayerSelectTreePlusGroupNode.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
this.node = BI.createWidget({ |
||||
type: "bi.select_tree_plus_group_node", |
||||
cls: "bi-list-item-none", |
||||
stopPropagation: true, |
||||
logic: { |
||||
dynamic: true |
||||
}, |
||||
id: o.id, |
||||
pId: o.pId, |
||||
keyword: o.keyword, |
||||
open: o.open, |
||||
height: o.height, |
||||
hgap: o.hgap, |
||||
text: o.text, |
||||
value: o.value, |
||||
py: o.py |
||||
}); |
||||
this.node.on(BI.Controller.EVENT_CHANGE, function (type) { |
||||
self.setSelected(self.isSelected()); |
||||
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
||||
}); |
||||
|
||||
var items = []; |
||||
|
||||
items.push({ |
||||
el: this.node, |
||||
lgap: o.layer * BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2 |
||||
}); |
||||
BI.createWidget({ |
||||
type: "bi.horizontal_adapt", |
||||
element: this, |
||||
columnSize: BI.makeArray(o.layer, BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2), |
||||
items: items |
||||
}); |
||||
}, |
||||
|
||||
isOnce: function () { |
||||
return true; |
||||
}, |
||||
|
||||
doRedMark: function () { |
||||
this.node.doRedMark.apply(this.node, arguments); |
||||
}, |
||||
|
||||
unRedMark: function () { |
||||
this.node.unRedMark.apply(this.node, arguments); |
||||
}, |
||||
|
||||
isSelected: function () { |
||||
return this.node.isSelected(); |
||||
}, |
||||
|
||||
setSelected: function (b) { |
||||
BI.MultiLayerSelectTreePlusGroupNode.superclass.setSelected.apply(this, arguments); |
||||
this.node.setSelected(b); |
||||
}, |
||||
|
||||
doClick: function () { |
||||
BI.NodeButton.superclass.doClick.apply(this, arguments); |
||||
this.node.setSelected(this.isSelected()); |
||||
}, |
||||
|
||||
setOpened: function (v) { |
||||
BI.MultiLayerSelectTreePlusGroupNode.superclass.setOpened.apply(this, arguments); |
||||
this.node.setOpened(v); |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut("bi.multilayer_select_tree_plus_group_node", BI.MultiLayerSelectTreePlusGroupNode); |
@ -1,4 +0,0 @@
|
||||
export { MultiLayerSingleTreeFirstPlusGroupNode } from "./node.first.plus"; |
||||
export { MultiLayerSingleTreeLastPlusGroupNode } from "./node.last.plus"; |
||||
export { MultiLayerSingleTreeMidPlusGroupNode } from "./node.mid.plus"; |
||||
export { MultiLayerSingleTreePlusGroupNode } from "./node.plus"; |
@ -1,104 +0,0 @@
|
||||
import { |
||||
shortcut, |
||||
extend, |
||||
createWidget, |
||||
makeArray, |
||||
HorizontalAdaptLayout, |
||||
isNotNull, |
||||
Controller, |
||||
Events |
||||
} from "@/core"; |
||||
import { NodeButton } from "@/base"; |
||||
import { FirstPlusGroupNode } from "@/case"; |
||||
|
||||
@shortcut() |
||||
export class MultiLayerSingleTreeFirstPlusGroupNode extends NodeButton { |
||||
static xtype = "bi.multilayer_single_tree_first_plus_group_node"; |
||||
|
||||
_defaultConfig() { |
||||
const conf = super._defaultConfig(...arguments); |
||||
|
||||
return extend(conf, { |
||||
extraCls: "bi-multilayer-single-tree-first-plus-group-node bi-list-item", |
||||
layer: 0, // 第几层级
|
||||
id: "", |
||||
pId: "", |
||||
open: false, |
||||
height: 24, |
||||
}); |
||||
} |
||||
|
||||
_init() { |
||||
super._init(...arguments); |
||||
const o = this.options; |
||||
this.node = this._createNode(); |
||||
|
||||
const items = []; |
||||
|
||||
items.push({ |
||||
el: this.node, |
||||
lgap: (o.layer * BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT) / 2, |
||||
}); |
||||
createWidget({ |
||||
type: HorizontalAdaptLayout.xtype, |
||||
element: this, |
||||
columnSize: makeArray(o.layer, BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2), |
||||
items, |
||||
}); |
||||
} |
||||
|
||||
doRedMark() { |
||||
this.node.doRedMark(...arguments); |
||||
} |
||||
|
||||
unRedMark() { |
||||
this.node.unRedMark(...arguments); |
||||
} |
||||
|
||||
doClick() { |
||||
super.doClick(...arguments); |
||||
this.node.setSelected(this.isSelected()); |
||||
} |
||||
|
||||
setOpened(v) { |
||||
super.setOpened(...arguments); |
||||
if (isNotNull(this.node)) { |
||||
this.node.setOpened(v); |
||||
} |
||||
} |
||||
|
||||
_createNode() { |
||||
const o = this.options; |
||||
|
||||
return createWidget({ |
||||
type: FirstPlusGroupNode.xtype, |
||||
cls: "bi-list-item-none", |
||||
logic: { |
||||
dynamic: true, |
||||
}, |
||||
id: o.id, |
||||
pId: o.pId, |
||||
open: o.open, |
||||
isLastNode: o.isLastNode, |
||||
height: o.height, |
||||
hgap: o.hgap, |
||||
text: o.text, |
||||
value: o.value, |
||||
py: o.py, |
||||
keyword: o.keyword, |
||||
listeners: [ |
||||
{ |
||||
eventName: Controller.EVENT_CHANGE, |
||||
action: (...args) => { |
||||
const [type] = args; |
||||
if (type === Events.CLICK) { |
||||
// 本身实现click功能
|
||||
return; |
||||
} |
||||
this.fireEvent(Controller.EVENT_CHANGE, ...args); |
||||
}, |
||||
} |
||||
], |
||||
}); |
||||
} |
||||
} |
@ -1,103 +0,0 @@
|
||||
import { |
||||
shortcut, |
||||
extend, |
||||
createWidget, |
||||
makeArray, |
||||
HorizontalAdaptLayout, |
||||
isNotNull, |
||||
Controller, |
||||
Events |
||||
} from "@/core"; |
||||
import { NodeButton } from "@/base"; |
||||
import { LastPlusGroupNode } from "@/case"; |
||||
|
||||
@shortcut() |
||||
export class MultiLayerSingleTreeLastPlusGroupNode extends NodeButton { |
||||
static xtype = "bi.multilayer_single_tree_last_plus_group_node"; |
||||
|
||||
_defaultConfig() { |
||||
const conf = super._defaultConfig(...arguments); |
||||
|
||||
return extend(conf, { |
||||
extraCls: "bi-multilayer-single-tree-last-plus-group-node bi-list-item", |
||||
layer: 0, // 第几层级
|
||||
id: "", |
||||
pId: "", |
||||
open: false, |
||||
height: 24, |
||||
}); |
||||
} |
||||
|
||||
_init() { |
||||
super._init(...arguments); |
||||
const o = this.options; |
||||
this.node = this._createNode(); |
||||
|
||||
const items = []; |
||||
|
||||
items.push({ |
||||
el: this.node, |
||||
lgap: (o.layer * BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT) / 2, |
||||
}); |
||||
createWidget({ |
||||
type: HorizontalAdaptLayout.xtype, |
||||
element: this, |
||||
columnSize: makeArray(o.layer, BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2), |
||||
items, |
||||
}); |
||||
} |
||||
|
||||
doRedMark() { |
||||
this.node.doRedMark(...arguments); |
||||
} |
||||
|
||||
unRedMark() { |
||||
this.node.unRedMark(...arguments); |
||||
} |
||||
|
||||
doClick() { |
||||
super.doClick(...arguments); |
||||
this.node.setSelected(this.isSelected()); |
||||
} |
||||
|
||||
setOpened(v) { |
||||
super.setOpened(...arguments); |
||||
if (isNotNull(this.node)) { |
||||
this.node.setOpened(v); |
||||
} |
||||
} |
||||
|
||||
_createNode() { |
||||
const o = this.options; |
||||
|
||||
return createWidget({ |
||||
type: LastPlusGroupNode.xtype, |
||||
cls: "bi-list-item-none", |
||||
logic: { |
||||
dynamic: true, |
||||
}, |
||||
id: o.id, |
||||
pId: o.pId, |
||||
open: o.open, |
||||
height: o.height, |
||||
hgap: o.hgap, |
||||
text: o.text, |
||||
value: o.value, |
||||
py: o.py, |
||||
keyword: o.keyword, |
||||
listeners: [ |
||||
{ |
||||
eventName: Controller.EVENT_CHANGE, |
||||
action: (...args) => { |
||||
const [type] = args; |
||||
if (type === Events.CLICK) { |
||||
// 本身实现click功能
|
||||
return; |
||||
} |
||||
this.fireEvent(Controller.EVENT_CHANGE, ...args); |
||||
}, |
||||
} |
||||
], |
||||
}); |
||||
} |
||||
} |
@ -1,103 +0,0 @@
|
||||
import { |
||||
shortcut, |
||||
extend, |
||||
createWidget, |
||||
makeArray, |
||||
HorizontalAdaptLayout, |
||||
isNotNull, |
||||
Controller, |
||||
Events |
||||
} from "@/core"; |
||||
import { NodeButton } from "@/base"; |
||||
import { MidPlusGroupNode } from "@/case"; |
||||
|
||||
@shortcut() |
||||
export class MultiLayerSingleTreeMidPlusGroupNode extends NodeButton { |
||||
static xtype = "bi.multilayer_single_tree_mid_plus_group_node"; |
||||
|
||||
_defaultConfig() { |
||||
const conf = super._defaultConfig(...arguments); |
||||
|
||||
return extend(conf, { |
||||
extraCls: "bi-multilayer-single-tree-mid-plus-group-node bi-list-item", |
||||
layer: 0, // 第几层级
|
||||
id: "", |
||||
pId: "", |
||||
open: false, |
||||
height: 24, |
||||
}); |
||||
} |
||||
|
||||
_init() { |
||||
super._init(...arguments); |
||||
const o = this.options; |
||||
this.node = this._createNode(); |
||||
|
||||
const items = []; |
||||
|
||||
items.push({ |
||||
el: this.node, |
||||
lgap: (o.layer * BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT) / 2, |
||||
}); |
||||
createWidget({ |
||||
type: HorizontalAdaptLayout.xtype, |
||||
element: this, |
||||
columnSize: makeArray(o.layer, 12), |
||||
items, |
||||
}); |
||||
} |
||||
|
||||
doRedMark() { |
||||
this.node.doRedMark(...arguments); |
||||
} |
||||
|
||||
unRedMark() { |
||||
this.node.unRedMark(...arguments); |
||||
} |
||||
|
||||
doClick() { |
||||
super.doClick(...arguments); |
||||
this.node.setSelected(this.isSelected()); |
||||
} |
||||
|
||||
setOpened(v) { |
||||
super.setOpened(...arguments); |
||||
if (isNotNull(this.node)) { |
||||
this.node.setOpened(v); |
||||
} |
||||
} |
||||
|
||||
_createNode() { |
||||
const o = this.options; |
||||
|
||||
return createWidget({ |
||||
type: MidPlusGroupNode.xtype, |
||||
cls: "bi-list-item-none", |
||||
logic: { |
||||
dynamic: true, |
||||
}, |
||||
id: o.id, |
||||
pId: o.pId, |
||||
open: o.open, |
||||
height: o.height, |
||||
hgap: o.hgap, |
||||
text: o.text, |
||||
value: o.value, |
||||
py: o.py, |
||||
keyword: o.keyword, |
||||
listeners: [ |
||||
{ |
||||
eventName: Controller.EVENT_CHANGE, |
||||
action: (...args) => { |
||||
const [type] = args; |
||||
if (type === Events.CLICK) { |
||||
// 本身实现click功能
|
||||
return; |
||||
} |
||||
this.fireEvent(Controller.EVENT_CHANGE, ...args); |
||||
}, |
||||
} |
||||
], |
||||
}); |
||||
} |
||||
} |
@ -1,120 +0,0 @@
|
||||
import { |
||||
shortcut, |
||||
extend, |
||||
count, |
||||
contains, |
||||
createWidget, |
||||
makeArray, |
||||
Layout, |
||||
HorizontalAdaptLayout, |
||||
isNotNull, |
||||
Controller, |
||||
Events |
||||
} from "@/core"; |
||||
import { NodeButton } from "@/base"; |
||||
import { PlusGroupNode } from "@/case"; |
||||
|
||||
@shortcut() |
||||
export class MultiLayerSingleTreePlusGroupNode extends NodeButton { |
||||
static xtype = "bi.multilayer_single_tree_plus_group_node"; |
||||
|
||||
_defaultConfig() { |
||||
const conf = super._defaultConfig(...arguments); |
||||
|
||||
return extend(conf, { |
||||
extraCls: "bi-multilayer-single-tree-plus-group-node bi-list-item", |
||||
layer: 0, // 第几层级
|
||||
id: "", |
||||
pId: "", |
||||
open: false, |
||||
height: 24, |
||||
}); |
||||
} |
||||
|
||||
_init() { |
||||
super._init(...arguments); |
||||
const o = this.options; |
||||
this.node = this._createNode(); |
||||
|
||||
const needBlankLayers = []; |
||||
let pNode = o.pNode; |
||||
while (pNode) { |
||||
if (pNode.isLastNode) { |
||||
needBlankLayers.push(pNode.layer); |
||||
} |
||||
pNode = pNode.pNode; |
||||
} |
||||
|
||||
const items = []; |
||||
count(0, o.layer, index => { |
||||
items.push({ |
||||
type: Layout.xtype, |
||||
cls: contains(needBlankLayers, index) ? "" : "base-line-conn-background", |
||||
width: 12, |
||||
height: o.height, |
||||
}); |
||||
}); |
||||
items.push(this.node); |
||||
createWidget({ |
||||
type: HorizontalAdaptLayout.xtype, |
||||
element: this, |
||||
columnSize: makeArray(o.layer, 12), |
||||
items, |
||||
}); |
||||
} |
||||
|
||||
doRedMark() { |
||||
this.node.doRedMark(...arguments); |
||||
} |
||||
|
||||
unRedMark() { |
||||
this.node.unRedMark(...arguments); |
||||
} |
||||
|
||||
doClick() { |
||||
super.doClick(...arguments); |
||||
this.node.setSelected(this.isSelected()); |
||||
} |
||||
|
||||
setOpened(v) { |
||||
super.setOpened(...arguments); |
||||
if (isNotNull(this.node)) { |
||||
this.node.setOpened(v); |
||||
} |
||||
} |
||||
|
||||
_createNode() { |
||||
const o = this.options; |
||||
|
||||
return createWidget({ |
||||
type: PlusGroupNode.xtype, |
||||
cls: "bi-list-item-none", |
||||
logic: { |
||||
dynamic: true, |
||||
}, |
||||
id: o.id, |
||||
pId: o.pId, |
||||
open: o.open, |
||||
isLastNode: o.isLastNode, |
||||
height: o.height, |
||||
hgap: o.hgap, |
||||
text: o.text, |
||||
value: o.value, |
||||
py: o.py, |
||||
keyword: o.keyword, |
||||
listeners: [ |
||||
{ |
||||
eventName: Controller.EVENT_CHANGE, |
||||
action: (...args) => { |
||||
const [type] = args; |
||||
if (type === Events.CLICK) { |
||||
// 本身实现click功能
|
||||
return; |
||||
} |
||||
this.fireEvent(Controller.EVENT_CHANGE, ...args); |
||||
}, |
||||
} |
||||
], |
||||
}); |
||||
} |
||||
} |
@ -1,3 +0,0 @@
|
||||
export { MultiLayerSingleTreeFirstTreeLeafItem } from "./item.first.treeleaf"; |
||||
export { MultiLayerSingleTreeLastTreeLeafItem } from "./item.last.treeleaf"; |
||||
export { MultiLayerSingleTreeMidTreeLeafItem } from "./item.mid.treeleaf"; |
@ -1,87 +0,0 @@
|
||||
import { shortcut, extend, createWidget, Controller, Events, makeArray, HorizontalAdaptLayout } from "@/core"; |
||||
import { BasicButton } from "@/base"; |
||||
|
||||
@shortcut() |
||||
export class MultiLayerSingleTreeFirstTreeLeafItem extends BasicButton { |
||||
static xtype = "bi.multilayer_single_tree_first_tree_leaf_item"; |
||||
|
||||
_defaultConfig() { |
||||
return extend(super._defaultConfig(...arguments), { |
||||
extraCls: "bi-multilayer-single-tree-first-tree-leaf-item bi-list-item-active", |
||||
logic: { |
||||
dynamic: false, |
||||
}, |
||||
layer: 0, |
||||
id: "", |
||||
pId: "", |
||||
height: 24, |
||||
}); |
||||
} |
||||
|
||||
_init() { |
||||
super._init(...arguments); |
||||
const self = this, |
||||
o = this.options; |
||||
this.item = createWidget({ |
||||
type: "bi.first_tree_leaf_item", |
||||
cls: "bi-list-item-none", |
||||
logic: { |
||||
dynamic: true, |
||||
}, |
||||
id: o.id, |
||||
pId: o.pId, |
||||
height: o.height, |
||||
hgap: o.hgap, |
||||
text: o.text, |
||||
value: o.value, |
||||
py: o.py, |
||||
keyword: o.keyword, |
||||
}); |
||||
this.item.on(Controller.EVENT_CHANGE, function (type) { |
||||
if (type === Events.CLICK) { |
||||
// 本身实现click功能
|
||||
return; |
||||
} |
||||
self.fireEvent(Controller.EVENT_CHANGE, arguments); |
||||
}); |
||||
|
||||
const items = []; |
||||
|
||||
items.push({ |
||||
el: this.item, |
||||
lgap: (o.layer * BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT) / 2, |
||||
}); |
||||
createWidget({ |
||||
type: HorizontalAdaptLayout.xtype, |
||||
element: this, |
||||
columnSize: makeArray(o.layer, BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2), |
||||
items, |
||||
}); |
||||
} |
||||
|
||||
doHighLight() { |
||||
this.item.doHighLight(...arguments); |
||||
} |
||||
|
||||
unHighLight() { |
||||
this.item.unHighLight(...arguments); |
||||
} |
||||
|
||||
getId() { |
||||
return this.options.id; |
||||
} |
||||
|
||||
getPId() { |
||||
return this.options.pId; |
||||
} |
||||
|
||||
doClick() { |
||||
super.doClick(...arguments); |
||||
this.item.setSelected(this.isSelected()); |
||||
} |
||||
|
||||
setSelected(v) { |
||||
super.setSelected(...arguments); |
||||
this.item.setSelected(v); |
||||
} |
||||
} |
@ -1,87 +0,0 @@
|
||||
import { shortcut, extend, createWidget, Controller, Events, makeArray, HorizontalAdaptLayout } from "@/core"; |
||||
import { BasicButton } from "@/base"; |
||||
|
||||
@shortcut() |
||||
export class MultiLayerSingleTreeLastTreeLeafItem extends BasicButton { |
||||
static xtype = "bi.multilayer_single_tree_last_tree_leaf_item"; |
||||
|
||||
_defaultConfig() { |
||||
return extend(super._defaultConfig(...arguments), { |
||||
extraCls: "bi-multilayer-single-tree-last-tree-leaf-item bi-list-item-active", |
||||
logic: { |
||||
dynamic: false, |
||||
}, |
||||
layer: 0, |
||||
id: "", |
||||
pId: "", |
||||
height: 24, |
||||
}); |
||||
} |
||||
|
||||
_init() { |
||||
super._init(...arguments); |
||||
const self = this, |
||||
o = this.options; |
||||
this.item = createWidget({ |
||||
type: "bi.last_tree_leaf_item", |
||||
cls: "bi-list-item-none", |
||||
logic: { |
||||
dynamic: true, |
||||
}, |
||||
id: o.id, |
||||
pId: o.pId, |
||||
height: o.height, |
||||
hgap: o.hgap, |
||||
text: o.text, |
||||
value: o.value, |
||||
py: o.py, |
||||
keyword: o.keyword, |
||||
}); |
||||
this.item.on(Controller.EVENT_CHANGE, function (type) { |
||||
if (type === Events.CLICK) { |
||||
// 本身实现click功能
|
||||
return; |
||||
} |
||||
self.fireEvent(Controller.EVENT_CHANGE, arguments); |
||||
}); |
||||
|
||||
const items = []; |
||||
|
||||
items.push({ |
||||
el: this.item, |
||||
lgap: (o.layer * BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT) / 2, |
||||
}); |
||||
createWidget({ |
||||
type: HorizontalAdaptLayout.xtype, |
||||
element: this, |
||||
columnSize: makeArray(o.layer, BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2), |
||||
items, |
||||
}); |
||||
} |
||||
|
||||
doHighLight() { |
||||
this.item.doHighLight(...arguments); |
||||
} |
||||
|
||||
unHighLight() { |
||||
this.item.unHighLight(...arguments); |
||||
} |
||||
|
||||
getId() { |
||||
return this.options.id; |
||||
} |
||||
|
||||
getPId() { |
||||
return this.options.pId; |
||||
} |
||||
|
||||
doClick() { |
||||
super.doClick(...arguments); |
||||
this.item.setSelected(this.isSelected()); |
||||
} |
||||
|
||||
setSelected(v) { |
||||
super.setSelected(...arguments); |
||||
this.item.setSelected(v); |
||||
} |
||||
} |
@ -1,87 +0,0 @@
|
||||
import { shortcut, extend, createWidget, Controller, Events, makeArray, HorizontalAdaptLayout } from "@/core"; |
||||
import { BasicButton } from "@/base"; |
||||
|
||||
@shortcut() |
||||
export class MultiLayerSingleTreeMidTreeLeafItem extends BasicButton { |
||||
static xtype = "bi.multilayer_single_tree_mid_tree_leaf_item"; |
||||
|
||||
_defaultConfig() { |
||||
return extend(super._defaultConfig(...arguments), { |
||||
extraCls: "bi-multilayer-single-tree-mid-tree-leaf-item bi-list-item-active", |
||||
logic: { |
||||
dynamic: false, |
||||
}, |
||||
layer: 0, |
||||
id: "", |
||||
pId: "", |
||||
height: 24, |
||||
}); |
||||
} |
||||
|
||||
_init() { |
||||
super._init(...arguments); |
||||
const self = this, |
||||
o = this.options; |
||||
this.item = createWidget({ |
||||
type: "bi.mid_tree_leaf_item", |
||||
cls: "bi-list-item-none", |
||||
logic: { |
||||
dynamic: true, |
||||
}, |
||||
id: o.id, |
||||
pId: o.pId, |
||||
height: o.height, |
||||
hgap: o.hgap, |
||||
text: o.text, |
||||
value: o.value, |
||||
py: o.py, |
||||
keyword: o.keyword, |
||||
}); |
||||
this.item.on(Controller.EVENT_CHANGE, function (type) { |
||||
if (type === Events.CLICK) { |
||||
// 本身实现click功能
|
||||
return; |
||||
} |
||||
self.fireEvent(Controller.EVENT_CHANGE, arguments); |
||||
}); |
||||
|
||||
const items = []; |
||||
|
||||
items.push({ |
||||
el: this.item, |
||||
lgap: (o.layer * BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT) / 2, |
||||
}); |
||||
createWidget({ |
||||
type: HorizontalAdaptLayout.xtype, |
||||
element: this, |
||||
columnSize: makeArray(o.layer, BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2), |
||||
items, |
||||
}); |
||||
} |
||||
|
||||
doHighLight() { |
||||
this.item.doHighLight(...arguments); |
||||
} |
||||
|
||||
unHighLight() { |
||||
this.item.unHighLight(...arguments); |
||||
} |
||||
|
||||
getId() { |
||||
return this.options.id; |
||||
} |
||||
|
||||
getPId() { |
||||
return this.options.pId; |
||||
} |
||||
|
||||
doClick() { |
||||
super.doClick(...arguments); |
||||
this.item.setSelected(this.isSelected()); |
||||
} |
||||
|
||||
setSelected(v) { |
||||
super.setSelected(...arguments); |
||||
this.item.setSelected(v); |
||||
} |
||||
} |
Loading…
Reference in new issue