forked from fanruan/fineui
Browse Source
# Conflicts: # src/case/button/index.js # src/case/button/node/node.first.plus.js # src/case/button/node/node.last.plus.js # src/case/button/node/node.mid.plus.js # src/case/button/node/treenode.js # src/case/button/treeitem/treeitem.jses6
Treecat
2 years ago
61 changed files with 3498 additions and 4383 deletions
@ -1,31 +1,27 @@
|
||||
export { MultiSelectItem } from "./item.multiselect"; |
||||
export { SingleSelectIconTextItem } from "./item.singleselect.icontext"; |
||||
export { SingleSelectItem } from "./item.singleselect"; |
||||
export { SingleSelectRadioItem } from "./item.singleselect.radio"; |
||||
export { Switch } from "./switch"; |
||||
|
||||
export { IconChangeButton } from "./icon/icon.change"; |
||||
export { TriggerIconButton } from "./icon/icon.trigger"; |
||||
export { HalfIconButton } from "./icon/iconhalf/icon.half.image"; |
||||
export { HalfButton } from "./icon/iconhalf/icon.half"; |
||||
|
||||
export { ArrowNode } from "./node/node.arrow"; |
||||
export { FirstPlusGroupNode } from "./node/node.first.plus"; |
||||
export { IconArrowNode } from "./node/node.icon.arrow"; |
||||
export { LastPlusGroupNode } from "./node/node.last.plus"; |
||||
export { MidPlusGroupNode } from "./node/node.mid.plus"; |
||||
export { MultiLayerIconArrowNode } from "./node/node.multilayer.icon.arrow"; |
||||
export { PlusGroupNode } from "./node/node.plus"; |
||||
export { TreeNodeSwitcher } from "./node/siwtcher.tree.node"; |
||||
export { BasicTreeNode } from "./node/treenode"; |
||||
|
||||
export { IconTreeLeafItem } from "./treeitem/item.icon.treeleaf"; |
||||
export { MultiLayerIconTreeLeafItem } from "./treeitem/item.multilayer.icon.treeleaf"; |
||||
|
||||
export { |
||||
BasicTreeItem, |
||||
FirstTreeLeafItem, |
||||
MidTreeLeafItem, |
||||
LastTreeLeafItem, |
||||
RootTreeLeafItem |
||||
} from "./treeitem/treeitem"; |
||||
export { MultiSelectItem } from "./item.multiselect"; |
||||
export { SingleSelectIconTextItem } from "./item.singleselect.icontext"; |
||||
export { SingleSelectItem } from "./item.singleselect"; |
||||
export { SingleSelectRadioItem } from "./item.singleselect.radio"; |
||||
export { Switch } from "./switch"; |
||||
|
||||
export { IconChangeButton } from "./icon/icon.change"; |
||||
export { TriggerIconButton } from "./icon/icon.trigger"; |
||||
export { HalfIconButton } from "./icon/iconhalf/icon.half.image"; |
||||
export { HalfButton } from "./icon/iconhalf/icon.half"; |
||||
|
||||
export { ArrowNode } from "./node/node.arrow"; |
||||
export { IconArrowNode } from "./node/node.icon.arrow"; |
||||
export { MultiLayerIconArrowNode } from "./node/node.multilayer.icon.arrow"; |
||||
export { PlusGroupNode } from "./node/node.plus"; |
||||
export { TreeNodeSwitcher } from "./node/siwtcher.tree.node"; |
||||
export { BasicTreeNode } from "./node/treenode"; |
||||
|
||||
export { IconTreeLeafItem } from "./treeitem/item.icon.treeleaf"; |
||||
export { MultiLayerIconTreeLeafItem } from "./treeitem/item.multilayer.icon.treeleaf"; |
||||
|
||||
|
||||
export { |
||||
BasicTreeItem, FirstTreeLeafItem, MidTreeLeafItem, LastTreeLeafItem, RootTreeLeafItem |
||||
} from "./treeitem/treeitem"; |
||||
|
||||
export * from "./node/treenode"; |
||||
|
@ -1,103 +0,0 @@
|
||||
import { FirstTreeNodeCheckbox } from "../../checkbox"; |
||||
import { Label, NodeButton } from "@/base"; |
||||
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: FirstTreeNodeCheckbox.xtype, |
||||
stopPropagation: true, |
||||
iconHeight: o.height, |
||||
iconWidth: o.height, |
||||
}); |
||||
this.text = createWidget({ |
||||
type: Label.xtype, |
||||
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,102 +0,0 @@
|
||||
import { LastTreeNodeCheckbox } from "../../checkbox"; |
||||
import { Label, NodeButton } from "@/base"; |
||||
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: LastTreeNodeCheckbox.xtype, |
||||
stopPropagation: true, |
||||
iconHeight: o.height, |
||||
iconWidth: o.height, |
||||
}); |
||||
this.text = createWidget({ |
||||
type: Label.xtype, |
||||
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,103 +0,0 @@
|
||||
import { MidTreeNodeCheckbox } from "../../checkbox"; |
||||
import { Label, NodeButton } from "@/base"; |
||||
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: MidTreeNodeCheckbox.xtype, |
||||
stopPropagation: true, |
||||
iconHeight: o.height, |
||||
iconWidth: o.height, |
||||
}); |
||||
this.text = createWidget({ |
||||
type: Label.xtype, |
||||
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); |
||||
} |
||||
} |
||||
} |
@ -1,77 +1,77 @@
|
||||
/** |
||||
* 简单的复选下拉框控件, 适用于数据量少的情况, 与valuechooser的区别是allvaluechooser setValue和getValue返回的是所有值 |
||||
* 封装了字段处理逻辑 |
||||
* |
||||
* Created by GUY on 2015/10/29. |
||||
* @class BI.AllValueChooserCombo |
||||
* @extends BI.AbstractAllValueChooser |
||||
*/ |
||||
BI.AllValueChooserCombo = BI.inherit(BI.AbstractAllValueChooser, { |
||||
import { shortcut, extend, emptyFn, isNotNull, createWidget, bind, Selection, difference, map } from "@/core"; |
||||
import { AbstractAllValueChooser } from "./abstract.allvaluechooser"; |
||||
import { MultiSelectCombo } from "@/widget"; |
||||
|
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.AllValueChooserCombo.superclass._defaultConfig.apply(this, arguments), { |
||||
@shortcut() |
||||
export class AllValueChooserCombo extends AbstractAllValueChooser { |
||||
static xtype = "bi.all_value_chooser_combo"; |
||||
|
||||
static EVENT_CONFIRM = "EVENT_CONFIRM"; |
||||
|
||||
_defaultConfig() { |
||||
return extend(super._defaultConfig(...arguments), { |
||||
baseCls: "bi-all-value-chooser-combo", |
||||
width: 200, |
||||
height: 24, |
||||
items: null, |
||||
itemsCreator: BI.emptyFn, |
||||
cache: true |
||||
itemsCreator: emptyFn, |
||||
cache: true, |
||||
}); |
||||
}, |
||||
} |
||||
|
||||
_init: function () { |
||||
BI.AllValueChooserCombo.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
if (BI.isNotNull(o.items)) { |
||||
_init() { |
||||
super._init(...arguments); |
||||
const o = this.options; |
||||
if (isNotNull(o.items)) { |
||||
this.items = o.items; |
||||
} |
||||
this.combo = BI.createWidget({ |
||||
type: "bi.multi_select_combo", |
||||
this.combo = createWidget({ |
||||
type: MultiSelectCombo.xtype, |
||||
simple: o.simple, |
||||
text: o.text, |
||||
element: this, |
||||
itemsCreator: BI.bind(this._itemsCreator, this), |
||||
valueFormatter: BI.bind(this._valueFormatter, this), |
||||
itemsCreator: bind(this._itemsCreator, this), |
||||
valueFormatter: bind(this._valueFormatter, this), |
||||
width: o.width, |
||||
height: o.height, |
||||
value: this._assertValue({ |
||||
type: BI.Selection.Multi, |
||||
value: o.value || [] |
||||
}) |
||||
type: Selection.Multi, |
||||
value: o.value || [], |
||||
}), |
||||
}); |
||||
|
||||
this.combo.on(BI.MultiSelectCombo.EVENT_CONFIRM, function () { |
||||
self.fireEvent(BI.AllValueChooserCombo.EVENT_CONFIRM); |
||||
this.combo.on(MultiSelectCombo.EVENT_CONFIRM, () => { |
||||
this.fireEvent(AllValueChooserCombo.EVENT_CONFIRM); |
||||
}); |
||||
}, |
||||
} |
||||
|
||||
setValue: function (v) { |
||||
this.combo.setValue(this._assertValue({ |
||||
type: BI.Selection.Multi, |
||||
value: v || [] |
||||
})); |
||||
}, |
||||
setValue(v) { |
||||
this.combo.setValue( |
||||
this._assertValue({ |
||||
type: Selection.Multi, |
||||
value: v || [], |
||||
}) |
||||
); |
||||
} |
||||
|
||||
getValue: function () { |
||||
getValue() { |
||||
return this.getAllValue(); |
||||
}, |
||||
} |
||||
|
||||
getAllValue: function () { |
||||
var val = this.combo.getValue() || {}; |
||||
if (val.type === BI.Selection.Multi) { |
||||
getAllValue() { |
||||
const val = this.combo.getValue() || {}; |
||||
if (val.type === Selection.Multi) { |
||||
return val.value || []; |
||||
} |
||||
|
||||
return BI.difference(BI.map(this.items, "value"), val.value || []); |
||||
}, |
||||
return difference(map(this.items, "value"), val.value || []); |
||||
} |
||||
|
||||
populate: function (items) { |
||||
populate(items) { |
||||
// 直接用combo的populate不会作用到AbstractValueChooser上
|
||||
if (BI.isNotNull(items)) { |
||||
if (isNotNull(items)) { |
||||
this.items = items; |
||||
} |
||||
this.combo.populate(); |
||||
} |
||||
}); |
||||
BI.AllValueChooserCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; |
||||
BI.shortcut("bi.all_value_chooser_combo", BI.AllValueChooserCombo); |
||||
} |
||||
|
@ -0,0 +1,3 @@
|
||||
export { AbstractAllValueChooser } from "./abstract.allvaluechooser"; |
||||
export { AllValueChooserCombo } from "./combo.allvaluechooser"; |
||||
export { AllValueChooserPane } from "./pane.allvaluechooser"; |
@ -1,69 +1,67 @@
|
||||
/** |
||||
* 简单的复选面板, 适用于数据量少的情况, 与valuechooser的区别是allvaluechooser setValue和getValue返回的是所有值 |
||||
* 封装了字段处理逻辑 |
||||
* |
||||
* Created by GUY on 2015/10/29. |
||||
* @class BI.AllValueChooserPane |
||||
* @extends BI.AbstractAllValueChooser |
||||
*/ |
||||
BI.AllValueChooserPane = BI.inherit(BI.AbstractAllValueChooser, { |
||||
import { shortcut, extend, emptyFn, createWidget, bind, isNotNull, Selection, difference, map } from "@/core"; |
||||
import { AbstractAllValueChooser } from "./abstract.allvaluechooser"; |
||||
import { MultiSelectList } from "@/widget"; |
||||
|
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.AllValueChooserPane.superclass._defaultConfig.apply(this, arguments), { |
||||
@shortcut() |
||||
export class AllValueChooserPane extends AbstractAllValueChooser { |
||||
static xtype = "bi.all_value_chooser_pane"; |
||||
|
||||
static EVENT_CHANGE = "EVENT_CHANGE"; |
||||
|
||||
_defaultConfig() { |
||||
return extend(super._defaultConfig(...arguments), { |
||||
baseCls: "bi-all-value-chooser-pane", |
||||
width: 200, |
||||
height: 30, |
||||
items: null, |
||||
itemsCreator: BI.emptyFn, |
||||
cache: true |
||||
itemsCreator: emptyFn, |
||||
cache: true, |
||||
}); |
||||
}, |
||||
} |
||||
|
||||
_init: function () { |
||||
BI.AllValueChooserPane.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
this.list = BI.createWidget({ |
||||
type: "bi.multi_select_list", |
||||
_init() { |
||||
super._init(...arguments); |
||||
const o = this.options; |
||||
this.list = createWidget({ |
||||
type: MultiSelectList.xtype, |
||||
element: this, |
||||
itemsCreator: BI.bind(this._itemsCreator, this), |
||||
valueFormatter: BI.bind(this._valueFormatter, this), |
||||
itemsCreator: bind(this._itemsCreator, this), |
||||
valueFormatter: bind(this._valueFormatter, this), |
||||
width: o.width, |
||||
height: o.height |
||||
height: o.height, |
||||
}); |
||||
|
||||
this.list.on(BI.MultiSelectList.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.AllValueChooserPane.EVENT_CHANGE); |
||||
this.list.on(MultiSelectList.EVENT_CHANGE, () => { |
||||
this.fireEvent(AllValueChooserPane.EVENT_CHANGE); |
||||
}); |
||||
|
||||
if (BI.isNotNull(o.items)) { |
||||
if (isNotNull(o.items)) { |
||||
this.items = o.items; |
||||
this.list.populate(); |
||||
} |
||||
}, |
||||
} |
||||
|
||||
setValue: function (v) { |
||||
setValue(v) { |
||||
this.list.setValue({ |
||||
type: BI.Selection.Multi, |
||||
value: v || [] |
||||
type: Selection.Multi, |
||||
value: v || [], |
||||
}); |
||||
}, |
||||
} |
||||
|
||||
getValue: function () { |
||||
var val = this.list.getValue() || {}; |
||||
if (val.type === BI.Selection.Multi) { |
||||
getValue() { |
||||
const val = this.list.getValue() || {}; |
||||
if (val.type === Selection.Multi) { |
||||
return val.value || []; |
||||
} |
||||
|
||||
return BI.difference(BI.map(this.items, "value"), val.value || []); |
||||
}, |
||||
return difference(map(this.items, "value"), val.value || []); |
||||
} |
||||
|
||||
populate: function (items) { |
||||
populate(items) { |
||||
// 直接用combo的populate不会作用到AbstractValueChooser上
|
||||
if (BI.isNotNull(items)) { |
||||
if (isNotNull(items)) { |
||||
this.items = items; |
||||
} |
||||
this.list.populate(); |
||||
} |
||||
}); |
||||
BI.AllValueChooserPane.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.shortcut("bi.all_value_chooser_pane", BI.AllValueChooserPane); |
||||
} |
||||
|
@ -1,66 +1,72 @@
|
||||
BI.AllValueMultiTextValueCombo = BI.inherit(BI.Widget, { |
||||
import { shortcut, Widget, Selection, each, contains } from "@/core"; |
||||
import { SearchMultiTextValueCombo } from "@/widget"; |
||||
|
||||
props: { |
||||
baseCls: "bi-all-value-multi-text-value-combo", |
||||
width: 200, |
||||
height: 24, |
||||
items: [] |
||||
}, |
||||
@shortcut() |
||||
export class AllValueMultiTextValueCombo extends Widget { |
||||
static xtype = "bi.all_value_multi_text_value_combo"; |
||||
|
||||
render: function () { |
||||
var self = this, o = this.options; |
||||
var value = this._digestValue(o.value); |
||||
props = { baseCls: "bi-all-value-multi-text-value-combo", width: 200, height: 24, items: [] }; |
||||
|
||||
static EVENT_CONFIRM = "EVENT_CONFIRM"; |
||||
|
||||
render() { |
||||
const self = this, |
||||
o = this.options; |
||||
const value = this._digestValue(o.value); |
||||
|
||||
return { |
||||
type: "bi.search_multi_text_value_combo", |
||||
simple: o.simple, |
||||
text: o.text, |
||||
height: o.height, |
||||
items: o.items, |
||||
value: value, |
||||
value, |
||||
numOfPage: 100, |
||||
valueFormatter: o.valueFormatter, |
||||
warningTitle: o.warningTitle, |
||||
listeners: [{ |
||||
eventName: BI.SearchMultiTextValueCombo.EVENT_CONFIRM, |
||||
action: function () { |
||||
self.fireEvent(BI.AllValueMultiTextValueCombo.EVENT_CONFIRM); |
||||
listeners: [ |
||||
{ |
||||
eventName: SearchMultiTextValueCombo.EVENT_CONFIRM, |
||||
action () { |
||||
self.fireEvent(AllValueMultiTextValueCombo.EVENT_CONFIRM); |
||||
}, |
||||
} |
||||
}], |
||||
ref: function () { |
||||
], |
||||
ref () { |
||||
self.combo = this; |
||||
} |
||||
}, |
||||
}; |
||||
}, |
||||
} |
||||
|
||||
setValue: function (v) { |
||||
var value = this._digestValue(v); |
||||
setValue(v) { |
||||
const value = this._digestValue(v); |
||||
this.combo.setValue(value); |
||||
}, |
||||
} |
||||
|
||||
getValue: function () { |
||||
var obj = this.combo.getValue() || {}; |
||||
getValue() { |
||||
const obj = this.combo.getValue() || {}; |
||||
obj.value = obj.value || []; |
||||
if(obj.type === BI.Selection.All) { |
||||
var values = []; |
||||
BI.each(this.options.items, function (idx, item) { |
||||
!BI.contains(obj.value, item.value) && values.push(item.value); |
||||
if (obj.type === Selection.All) { |
||||
const values = []; |
||||
each(this.options.items, (idx, item) => { |
||||
!contains(obj.value, item.value) && values.push(item.value); |
||||
}); |
||||
|
||||
return values; |
||||
} |
||||
|
||||
return obj.value || []; |
||||
}, |
||||
} |
||||
|
||||
populate: function (items) { |
||||
populate(items) { |
||||
this.options.items = items; |
||||
this.combo.populate.apply(this.combo, arguments); |
||||
}, |
||||
this.combo.populate(...arguments); |
||||
} |
||||
|
||||
_digestValue: function (v) { |
||||
_digestValue(v) { |
||||
return { |
||||
type: BI.Selection.Multi, |
||||
value: v || [] |
||||
type: Selection.Multi, |
||||
value: v || [], |
||||
}; |
||||
} |
||||
}); |
||||
BI.AllValueMultiTextValueCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; |
||||
BI.shortcut("bi.all_value_multi_text_value_combo", BI.AllValueMultiTextValueCombo); |
||||
} |
||||
|
@ -1,98 +1,111 @@
|
||||
/** |
||||
* @author windy |
||||
* @version 2.0 |
||||
* Created by windy on 2022/1/11 |
||||
*/ |
||||
BI.FormField = BI.inherit(BI.Widget, { |
||||
|
||||
props: { |
||||
import { shortcut, Widget, extend, concat, isKey, VerticalAlign } from "@/core"; |
||||
|
||||
@shortcut() |
||||
export class FormField extends Widget { |
||||
static xtype = "bi.form_field"; |
||||
|
||||
props = { |
||||
baseCls: "bi-form-field", |
||||
label: "", |
||||
el: {}, |
||||
headerCls: "", |
||||
labelAlign: "right", // 文字默认右对齐
|
||||
validate: function () { |
||||
validate () { |
||||
return true; |
||||
} // 默认返回true
|
||||
}, |
||||
}, // 默认返回true
|
||||
} |
||||
|
||||
render: function () { |
||||
var self = this, o = this.options; |
||||
render () { |
||||
const self = this, |
||||
o = this.options; |
||||
|
||||
var field = { |
||||
const field = { |
||||
type: "bi.absolute", |
||||
items: [{ |
||||
el: BI.extend({}, o.el, { |
||||
ref: function (_ref) { |
||||
self.field = _ref; |
||||
o.el.ref && o.el.ref.call(this, _ref); |
||||
}, |
||||
height: o.el.height || 28, |
||||
listeners: BI.concat(o.el.listeners, [{ |
||||
eventName: "EVENT_CHANGE", |
||||
action: function () { |
||||
self.fireEvent("EVENT_CHANGE"); |
||||
} |
||||
}, { |
||||
eventName: "EVENT_CONFIRM", |
||||
action: function () { |
||||
self.fireEvent("EVENT_CONFIRM"); |
||||
} |
||||
}]) |
||||
}), |
||||
left: 0, |
||||
bottom: 0, |
||||
right: 0, |
||||
top: 0 |
||||
}, { |
||||
el: { |
||||
type: "bi.label", |
||||
cls: "error-tip bi-error", |
||||
ref: function (_ref) { |
||||
self.error = _ref; |
||||
}, |
||||
invisible: true |
||||
items: [ |
||||
{ |
||||
el: extend({}, o.el, { |
||||
ref (_ref) { |
||||
self.field = _ref; |
||||
o.el.ref && o.el.ref.call(this, _ref); |
||||
}, |
||||
height: o.el.height || 28, |
||||
listeners: concat(o.el.listeners, [ |
||||
{ |
||||
eventName: "EVENT_CHANGE", |
||||
action () { |
||||
self.fireEvent("EVENT_CHANGE"); |
||||
}, |
||||
}, |
||||
{ |
||||
eventName: "EVENT_CONFIRM", |
||||
action () { |
||||
self.fireEvent("EVENT_CONFIRM"); |
||||
}, |
||||
} |
||||
]), |
||||
}), |
||||
left: 0, |
||||
bottom: 0, |
||||
right: 0, |
||||
top: 0, |
||||
}, |
||||
bottom: -20, |
||||
left: 0, |
||||
right: 0, |
||||
height: 20 |
||||
}] |
||||
{ |
||||
el: { |
||||
type: "bi.label", |
||||
cls: "error-tip bi-error", |
||||
ref (_ref) { |
||||
self.error = _ref; |
||||
}, |
||||
invisible: true, |
||||
}, |
||||
bottom: -20, |
||||
left: 0, |
||||
right: 0, |
||||
height: 20, |
||||
} |
||||
], |
||||
}; |
||||
|
||||
return { |
||||
type: "bi.vertical_adapt", |
||||
columnSize: ["auto", "fill"], |
||||
verticalAlign: BI.VerticalAlign.Stretch, |
||||
items: BI.isKey(o.label) ? [{ |
||||
el: { |
||||
type: "bi.label", |
||||
textAlign: o.labelAlign, |
||||
text: o.label, |
||||
width: o.labelWidth, |
||||
cls: o.headerCls, |
||||
rgap: 20 // 表单文字与右侧输入间距均为20px
|
||||
} |
||||
}, field] : [field] |
||||
verticalAlign: VerticalAlign.Stretch, |
||||
items: isKey(o.label) |
||||
? [ |
||||
{ |
||||
el: { |
||||
type: "bi.label", |
||||
textAlign: o.labelAlign, |
||||
text: o.label, |
||||
width: o.labelWidth, |
||||
cls: o.headerCls, |
||||
rgap: 20, // 表单文字与右侧输入间距均为20px
|
||||
}, |
||||
}, |
||||
field |
||||
] |
||||
: [field], |
||||
}; |
||||
}, |
||||
} |
||||
|
||||
getValue: function () { |
||||
getValue () { |
||||
return this.field.getValue(); |
||||
}, |
||||
} |
||||
|
||||
validate: function () { |
||||
var isValid = this.validateWithNoTip(); |
||||
!isValid && this.error.setText(this.options.tip(this.field.getValue(), this.field)); |
||||
validate () { |
||||
const isValid = this.validateWithNoTip(); |
||||
!isValid && |
||||
this.error.setText( |
||||
this.options.tip(this.field.getValue(), this.field) |
||||
); |
||||
this.error.setVisible(!isValid); |
||||
this.field.element[isValid ? "removeClass" : "addClass"]("bi-error"); |
||||
|
||||
return isValid; |
||||
}, |
||||
} |
||||
|
||||
validateWithNoTip: function () { |
||||
validateWithNoTip () { |
||||
return this.options.validate(this.field.getValue(), this.field); |
||||
} |
||||
}); |
||||
|
||||
BI.shortcut("bi.form_field", BI.FormField); |
||||
} |
||||
|
@ -0,0 +1,2 @@
|
||||
export { Form } from "./form"; |
||||
export { FormField } from "./form.field"; |
@ -0,0 +1,15 @@
|
||||
import * as allvaluechooser from "./allvaluechooser"; |
||||
import * as form from "./form"; |
||||
import { AllValueMultiTextValueCombo } from "./allvaluemultitextvaluecombo/allvalue.multitextvalue.combo"; |
||||
|
||||
Object.assign(BI, { |
||||
...allvaluechooser, |
||||
...form, |
||||
AllValueMultiTextValueCombo, |
||||
}); |
||||
|
||||
export * from "./allvaluechooser"; |
||||
export * from "./form"; |
||||
export { |
||||
AllValueMultiTextValueCombo |
||||
}; |
@ -0,0 +1,2 @@
|
||||
export { MultiLayerSelectTreeCombo } from "./multilayerselecttree.combo"; |
||||
export { MultiLayerSelectLevelTree } from "./multilayerselecttree.leveltree"; |
@ -1,92 +1,119 @@
|
||||
/** |
||||
* Created by GUY on 2016/1/26. |
||||
* |
||||
* @class BI.MultiLayerSelectTreeInsertSearchPane |
||||
* @extends BI.Pane |
||||
*/ |
||||
import { |
||||
shortcut, |
||||
Widget, |
||||
i18nText, |
||||
emptyFn, |
||||
createWidget, |
||||
Controller, |
||||
VerticalLayout, |
||||
isEmptyArray, |
||||
isArray |
||||
} from "@/core"; |
||||
import { MultiLayerSelectLevelTree } from "./multilayerselecttree.leveltree"; |
||||
import { TextButton } from "@/base"; |
||||
|
||||
BI.MultiLayerSelectTreeInsertSearchPane = BI.inherit(BI.Widget, { |
||||
@shortcut() |
||||
export class MultiLayerSelectTreeInsertSearchPane extends Widget { |
||||
static xtype = "bi.multilayer_select_tree_insert_search_pane"; |
||||
|
||||
props: function() { |
||||
static EVENT_ADD_ITEM = "EVENT_ADD_ITEM"; |
||||
static EVENT_CHANGE = "EVENT_CHANGE"; |
||||
|
||||
props() { |
||||
return { |
||||
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: "" |
||||
value: "", |
||||
}; |
||||
}, |
||||
} |
||||
|
||||
render: function() { |
||||
var self = this, o = this.options; |
||||
this.tree = BI.createWidget({ |
||||
type: "bi.multilayer_select_level_tree", |
||||
render() { |
||||
const self = this, |
||||
o = this.options; |
||||
this.tree = createWidget({ |
||||
type: MultiLayerSelectLevelTree.xtype, |
||||
isDefaultInit: o.isDefaultInit, |
||||
items: o.items, |
||||
itemsCreator: o.itemsCreator === BI.emptyFn ? BI.emptyFn : function (op, callback) { |
||||
o.itemsCreator(op, function (res) { |
||||
callback(res); |
||||
self.setKeyword(o.keywordGetter()); |
||||
}); |
||||
}, |
||||
itemsCreator: |
||||
o.itemsCreator === emptyFn |
||||
? emptyFn |
||||
: function (op, callback) { |
||||
o.itemsCreator(op, res => { |
||||
callback(res); |
||||
self.setKeyword(o.keywordGetter()); |
||||
}); |
||||
}, |
||||
keywordGetter: o.keywordGetter, |
||||
value: o.value, |
||||
scrollable: null, |
||||
listeners: [{ |
||||
eventName: BI.Controller.EVENT_CHANGE, |
||||
action: function () { |
||||
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
||||
} |
||||
}, { |
||||
eventName: BI.MultiLayerSelectLevelTree.EVENT_CHANGE, |
||||
action: function () { |
||||
self.fireEvent(BI.MultiLayerSelectTreeInsertSearchPane.EVENT_CHANGE); |
||||
listeners: [ |
||||
{ |
||||
eventName: Controller.EVENT_CHANGE, |
||||
action() { |
||||
self.fireEvent(Controller.EVENT_CHANGE, arguments); |
||||
}, |
||||
}, |
||||
{ |
||||
eventName: MultiLayerSelectLevelTree.EVENT_CHANGE, |
||||
action() { |
||||
self.fireEvent( |
||||
MultiLayerSelectTreeInsertSearchPane.EVENT_CHANGE |
||||
); |
||||
}, |
||||
} |
||||
}] |
||||
], |
||||
}); |
||||
|
||||
return { |
||||
type: "bi.vertical", |
||||
type: VerticalLayout.xtype, |
||||
scrolly: false, |
||||
scrollable: true, |
||||
vgap: 5, |
||||
items: [{ |
||||
type: "bi.text_button", |
||||
invisible: true, |
||||
text: BI.i18nText("BI-Basic_Click_To_Add_Text", ""), |
||||
height: 24, |
||||
cls: "bi-high-light", |
||||
hgap: 5, |
||||
ref: function (_ref) { |
||||
self.addNotMatchTip = _ref; |
||||
items: [ |
||||
{ |
||||
type: TextButton.xtype, |
||||
invisible: true, |
||||
text: i18nText("BI-Basic_Click_To_Add_Text", ""), |
||||
height: 24, |
||||
cls: "bi-high-light", |
||||
hgap: 5, |
||||
ref(_ref) { |
||||
self.addNotMatchTip = _ref; |
||||
}, |
||||
handler() { |
||||
self.fireEvent( |
||||
MultiLayerSelectTreeInsertSearchPane.EVENT_ADD_ITEM, |
||||
o.keywordGetter() |
||||
); |
||||
}, |
||||
}, |
||||
handler: function () { |
||||
self.fireEvent(BI.MultiLayerSelectTreeInsertSearchPane.EVENT_ADD_ITEM, o.keywordGetter()); |
||||
} |
||||
}, this.tree] |
||||
this.tree |
||||
], |
||||
}; |
||||
}, |
||||
} |
||||
|
||||
setKeyword: function (keyword) { |
||||
var showTip = BI.isEmptyArray(this.tree.getAllLeaves()); |
||||
setKeyword(keyword) { |
||||
const showTip = isEmptyArray(this.tree.getAllLeaves()); |
||||
this.addNotMatchTip.setVisible(showTip); |
||||
showTip && this.addNotMatchTip.setText(BI.i18nText("BI-Basic_Click_To_Add_Text", keyword)); |
||||
}, |
||||
showTip && |
||||
this.addNotMatchTip.setText( |
||||
i18nText("BI-Basic_Click_To_Add_Text", keyword) |
||||
); |
||||
} |
||||
|
||||
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.MultiLayerSelectTreeInsertSearchPane.EVENT_ADD_ITEM = "EVENT_ADD_ITEM"; |
||||
BI.MultiLayerSelectTreeInsertSearchPane.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.shortcut("bi.multilayer_select_tree_insert_search_pane", BI.MultiLayerSelectTreeInsertSearchPane); |
||||
} |
||||
|
@ -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) ? { |
||||
offset: {}, |
||||
container: o.container |
||||
} : { |
||||
offset: {} |
||||
}, |
||||
masker: isNotNull(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); |
||||
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 |
||||
); |
||||
}, |
||||
} |
||||
}, { |
||||
eventName: BI.StateEditor.EVENT_CHANGE, |
||||
action: function () { |
||||
self.fireEvent(BI.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) { |
||||
op.keyword = self.editor.getValue(); |
||||
o.itemsCreator(op, callback); |
||||
}, |
||||
keywordGetter: function () { |
||||
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() { |
||||
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); |
||||
listeners: [ |
||||
{ |
||||
eventName: |
||||
MultiLayerSelectTreeInsertSearchPane.EVENT_ADD_ITEM, |
||||
action() { |
||||
self.options.text = self |
||||
.getSearcher() |
||||
.getKeyword(); |
||||
self.fireEvent( |
||||
MultiLayerSelectTreeTrigger.EVENT_ADD_ITEM |
||||
); |
||||
}, |
||||
} |
||||
}], |
||||
ref: function (_ref) { |
||||
], |
||||
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); |
||||
} |
||||
} |
@ -0,0 +1,5 @@
|
||||
export { SearchMultiTextValueCombo } from "./multitextvalue.combo.search"; |
||||
export { SearchMultiSelectPopupView } from "./multitextvalue.popup.view.search"; |
||||
export { SearchMultiSelectTrigger } from "./multitextvalue.combo.trigger.search"; |
||||
export { SearchMultiSelectLoader } from "./multitextvalue.loader.search"; |
||||
export { SearchMultiSelectSearcher } from "./trigger/searcher.multitextvalue"; |
@ -1,184 +1,202 @@
|
||||
/** |
||||
* 多选加载数据面板 |
||||
* Created by guy on 15/11/2. |
||||
* @class BI.SearchMultiSelectLoader |
||||
* @extends Widget |
||||
*/ |
||||
BI.SearchMultiSelectLoader = BI.inherit(BI.Widget, { |
||||
|
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.SearchMultiSelectLoader.superclass._defaultConfig.apply(this, arguments), { |
||||
import { shortcut, Widget, extend, emptyFn, createWidget, isKey, Selection, map, contains, remove, pushDistinct, Controller, VerticalLayout, createItems, delay, isNotNull } from "@/core"; |
||||
import { ButtonGroup, Loader } from "@/base"; |
||||
import { SelectList, MultiSelectBar, MultiSelectItem } from "@/case"; |
||||
|
||||
@shortcut() |
||||
export class SearchMultiSelectLoader extends Widget { |
||||
static xtype = "bi.search_multi_select_loader"; |
||||
|
||||
static EVENT_CHANGE = "EVENT_CHANGE"; |
||||
|
||||
_defaultConfig() { |
||||
return extend(super._defaultConfig(...arguments), { |
||||
baseCls: "bi-multi-select-loader", |
||||
logic: { |
||||
dynamic: true |
||||
dynamic: true, |
||||
}, |
||||
el: { |
||||
height: 400 |
||||
height: 400, |
||||
}, |
||||
valueFormatter: BI.emptyFn, |
||||
itemsCreator: BI.emptyFn, |
||||
valueFormatter: emptyFn, |
||||
itemsCreator: emptyFn, |
||||
itemHeight: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, |
||||
onLoaded: BI.emptyFn |
||||
onLoaded: emptyFn, |
||||
}); |
||||
}, |
||||
} |
||||
|
||||
_init: function () { |
||||
BI.SearchMultiSelectLoader.superclass._init.apply(this, arguments); |
||||
_init() { |
||||
super._init(...arguments); |
||||
|
||||
var self = this, opts = this.options; |
||||
var hasNext = false; |
||||
const opts = this.options; |
||||
let hasNext = false; |
||||
|
||||
this.storeValue = opts.value || {}; |
||||
this._assertValue(this.storeValue); |
||||
|
||||
this.button_group = BI.createWidget({ |
||||
type: "bi.select_list", |
||||
this.button_group = createWidget({ |
||||
type: SelectList.xtype, |
||||
element: this, |
||||
logic: opts.logic, |
||||
toolbar: { |
||||
type: "bi.multi_select_bar", |
||||
type: MultiSelectBar.xtype, |
||||
cls: "bi-list-item-active", |
||||
height: this.options.itemHeight, |
||||
iconWrapperWidth: 36 |
||||
iconWrapperWidth: 36, |
||||
}, |
||||
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_MULTI, |
||||
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; |
||||
self.storeValue && (op = BI.extend(op || {}, { |
||||
selectedValues: BI.isKey(startValue) && self.storeValue.type === BI.Selection.Multi |
||||
? self.storeValue.value.concat(startValue) : self.storeValue.value |
||||
})); |
||||
opts.itemsCreator(op, function (ob) { |
||||
el: { |
||||
chooseType: ButtonGroup.CHOOSE_TYPE_MULTI, |
||||
behaviors: { |
||||
redmark: () => true, |
||||
}, |
||||
layouts: [ |
||||
{ |
||||
type: VerticalLayout.xtype, |
||||
} |
||||
], |
||||
}, |
||||
}, |
||||
}, |
||||
opts.el |
||||
), |
||||
itemsCreator: (op, callback) => { |
||||
const startValue = this._startValue; |
||||
this.storeValue && |
||||
(op = extend(op || {}, { |
||||
selectedValues: |
||||
isKey(startValue) && |
||||
this.storeValue.type === Selection.Multi |
||||
? this.storeValue.value.concat(startValue) |
||||
: this.storeValue.value, |
||||
})); |
||||
opts.itemsCreator(op, ob => { |
||||
hasNext = ob.hasNext; |
||||
var firstItems = []; |
||||
if (op.times === 1 && self.storeValue) { |
||||
var json = BI.map(self.storeValue.value, function (i, v) { |
||||
var txt = opts.valueFormatter(v) || v; |
||||
let firstItems = []; |
||||
if (op.times === 1 && this.storeValue) { |
||||
const json = map(this.storeValue.value, (i, v) => { |
||||
const txt = opts.valueFormatter(v) || v; |
||||
|
||||
return { |
||||
text: txt, |
||||
value: v, |
||||
title: txt, |
||||
selected: self.storeValue.type === BI.Selection.Multi |
||||
selected: |
||||
this.storeValue.type === Selection.Multi, |
||||
}; |
||||
}); |
||||
if (BI.isKey(self._startValue) && !BI.contains(self.storeValue.value, self._startValue)) { |
||||
var txt = opts.valueFormatter(startValue) || startValue; |
||||
if ( |
||||
isKey(this._startValue) && |
||||
!contains(this.storeValue.value, this._startValue) |
||||
) { |
||||
const txt = |
||||
opts.valueFormatter(startValue) || startValue; |
||||
json.unshift({ |
||||
text: txt, |
||||
value: startValue, |
||||
title: txt, |
||||
selected: true |
||||
selected: true, |
||||
}); |
||||
} |
||||
firstItems = self._createItems(json); |
||||
firstItems = this._createItems(json); |
||||
} |
||||
callback(firstItems.concat(self._createItems(ob.items)), ob.keyword || ""); |
||||
if (op.times === 1 && self.storeValue) { |
||||
BI.isKey(startValue) && (self.storeValue.type === BI.Selection.All ? BI.remove(self.storeValue.value, startValue) : BI.pushDistinct(self.storeValue.value, startValue)); |
||||
self.setValue(self.storeValue); |
||||
callback( |
||||
firstItems.concat(this._createItems(ob.items)), |
||||
ob.keyword || "" |
||||
); |
||||
if (op.times === 1 && this.storeValue) { |
||||
isKey(startValue) && |
||||
(this.storeValue.type === Selection.All |
||||
? remove(this.storeValue.value, startValue) |
||||
: pushDistinct( |
||||
this.storeValue.value, |
||||
startValue |
||||
)); |
||||
this.setValue(this.storeValue); |
||||
} |
||||
(op.times === 1) && self._scrollToTop(); |
||||
op.times === 1 && this._scrollToTop(); |
||||
}); |
||||
}, |
||||
hasNext: function () { |
||||
return hasNext; |
||||
}, |
||||
value: this.storeValue |
||||
hasNext: () => hasNext, |
||||
value: this.storeValue, |
||||
}); |
||||
this.button_group.on(BI.Controller.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); |
||||
this.button_group.on(Controller.EVENT_CHANGE, () => { |
||||
this.fireEvent(Controller.EVENT_CHANGE, arguments); |
||||
}); |
||||
this.button_group.on(BI.SelectList.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.SearchMultiSelectLoader.EVENT_CHANGE, arguments); |
||||
this.button_group.on(SelectList.EVENT_CHANGE, () => { |
||||
this.fireEvent(SearchMultiSelectLoader.EVENT_CHANGE, ...arguments); |
||||
}); |
||||
}, |
||||
} |
||||
|
||||
_createItems: function (items) { |
||||
return BI.createItems(items, { |
||||
type: "bi.multi_select_item", |
||||
_createItems(items) { |
||||
return createItems(items, { |
||||
type: MultiSelectItem.xtype, |
||||
logic: this.options.logic, |
||||
cls: "bi-list-item-active", |
||||
height: this.options.itemHeight, |
||||
selected: this.isAllSelected(), |
||||
iconWrapperWidth: 36 |
||||
iconWrapperWidth: 36, |
||||
}); |
||||
}, |
||||
} |
||||
|
||||
_scrollToTop: function () { |
||||
var self = this; |
||||
BI.delay(function () { |
||||
self.button_group.element.scrollTop(0); |
||||
_scrollToTop() { |
||||
delay(() => { |
||||
this.button_group.element.scrollTop(0); |
||||
}, 30); |
||||
}, |
||||
} |
||||
|
||||
isAllSelected: function () { |
||||
isAllSelected() { |
||||
return this.button_group.isAllSelected(); |
||||
}, |
||||
} |
||||
|
||||
_assertValue: function (val) { |
||||
_assertValue(val) { |
||||
val || (val = {}); |
||||
val.type || (val.type = BI.Selection.Multi); |
||||
val.type || (val.type = Selection.Multi); |
||||
val.value || (val.value = []); |
||||
}, |
||||
} |
||||
|
||||
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) { |
||||
if (BI.isNotNull(items)) { |
||||
populate(items) { |
||||
if (isNotNull(items)) { |
||||
arguments[0] = this._createItems(items); |
||||
} |
||||
this.button_group.populate.apply(this.button_group, arguments); |
||||
}, |
||||
this.button_group.populate(...arguments); |
||||
} |
||||
|
||||
resetHeight: function (h) { |
||||
resetHeight(h) { |
||||
this.button_group.resetHeight(h); |
||||
}, |
||||
} |
||||
|
||||
resetWidth: function (w) { |
||||
resetWidth(w) { |
||||
this.button_group.resetWidth(w); |
||||
} |
||||
}); |
||||
|
||||
BI.SearchMultiSelectLoader.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.shortcut("bi.search_multi_select_loader", BI.SearchMultiSelectLoader); |
||||
} |
||||
|
@ -1,92 +1,104 @@
|
||||
BI.SearchMultiSelectPopupView = BI.inherit(BI.Widget, { |
||||
import { shortcut, Widget, extend, emptyFn, createWidget, i18nText } from "@/core"; |
||||
import { MultiPopupView } from "@/case"; |
||||
import { SearchMultiSelectLoader } from "@/widget"; |
||||
|
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.SearchMultiSelectPopupView.superclass._defaultConfig.apply(this, arguments), { |
||||
@shortcut() |
||||
export class SearchMultiSelectPopupView extends Widget { |
||||
static xtype = "bi.search_multi_select_popup_view"; |
||||
|
||||
static EVENT_CHANGE = "EVENT_CHANGE"; |
||||
static EVENT_CLICK_CONFIRM = "EVENT_CLICK_CONFIRM"; |
||||
static EVENT_CLICK_CLEAR = "EVENT_CLICK_CLEAR"; |
||||
|
||||
_defaultConfig() { |
||||
return extend(super._defaultConfig(...arguments), { |
||||
baseCls: "bi-multi-select-popup-view", |
||||
maxWidth: "auto", |
||||
minWidth: 135, |
||||
maxHeight: 400, |
||||
valueFormatter: BI.emptyFn, |
||||
itemsCreator: BI.emptyFn, |
||||
onLoaded: BI.emptyFn |
||||
valueFormatter: emptyFn, |
||||
itemsCreator: emptyFn, |
||||
onLoaded: emptyFn, |
||||
}); |
||||
}, |
||||
} |
||||
|
||||
_init: function () { |
||||
BI.SearchMultiSelectPopupView.superclass._init.apply(this, arguments); |
||||
var self = this, opts = this.options; |
||||
_init() { |
||||
super._init(...arguments); |
||||
const opts = this.options; |
||||
|
||||
this.loader = BI.createWidget({ |
||||
type: "bi.search_multi_select_loader", |
||||
this.loader = createWidget({ |
||||
type: SearchMultiSelectLoader.xtype, |
||||
itemsCreator: opts.itemsCreator, |
||||
valueFormatter: opts.valueFormatter, |
||||
onLoaded: opts.onLoaded, |
||||
value: opts.value |
||||
value: opts.value, |
||||
}); |
||||
|
||||
this.popupView = BI.createWidget({ |
||||
type: "bi.multi_popup_view", |
||||
this.popupView = createWidget({ |
||||
type: MultiPopupView.xtype, |
||||
stopPropagation: false, |
||||
maxWidth: opts.maxWidth, |
||||
minWidth: opts.minWidth, |
||||
maxHeight: opts.maxHeight, |
||||
element: this, |
||||
buttons: [BI.i18nText("BI-Basic_Clears"), BI.i18nText("BI-Basic_OK")], |
||||
buttons: [i18nText("BI-Basic_Clears"), i18nText("BI-Basic_OK")], |
||||
el: this.loader, |
||||
value: opts.value |
||||
value: opts.value, |
||||
}); |
||||
|
||||
this.popupView.on(BI.MultiPopupView.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.SearchMultiSelectPopupView.EVENT_CHANGE); |
||||
this.popupView.on(MultiPopupView.EVENT_CHANGE, () => { |
||||
this.fireEvent(SearchMultiSelectPopupView.EVENT_CHANGE); |
||||
}); |
||||
this.popupView.on(BI.MultiPopupView.EVENT_CLICK_TOOLBAR_BUTTON, function (index) { |
||||
switch (index) { |
||||
this.popupView.on( |
||||
MultiPopupView.EVENT_CLICK_TOOLBAR_BUTTON, |
||||
index => { |
||||
switch (index) { |
||||
case 0: |
||||
self.fireEvent(BI.SearchMultiSelectPopupView.EVENT_CLICK_CLEAR); |
||||
this.fireEvent( |
||||
SearchMultiSelectPopupView.EVENT_CLICK_CLEAR |
||||
); |
||||
break; |
||||
case 1: |
||||
self.fireEvent(BI.SearchMultiSelectPopupView.EVENT_CLICK_CONFIRM); |
||||
this.fireEvent( |
||||
SearchMultiSelectPopupView.EVENT_CLICK_CONFIRM |
||||
); |
||||
break; |
||||
default: |
||||
break; |
||||
} |
||||
} |
||||
}); |
||||
}, |
||||
); |
||||
} |
||||
|
||||
isAllSelected: function () { |
||||
isAllSelected() { |
||||
return this.loader.isAllSelected(); |
||||
}, |
||||
} |
||||
|
||||
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.SearchMultiSelectPopupView.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.SearchMultiSelectPopupView.EVENT_CLICK_CONFIRM = "EVENT_CLICK_CONFIRM"; |
||||
BI.SearchMultiSelectPopupView.EVENT_CLICK_CLEAR = "EVENT_CLICK_CLEAR"; |
||||
|
||||
|
||||
BI.shortcut("bi.search_multi_select_popup_view", BI.SearchMultiSelectPopupView); |
||||
} |
||||
} |
||||
|
@ -1,175 +1,179 @@
|
||||
BI.SearchMultiSelectSearcher = BI.inherit(BI.Widget, { |
||||
|
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.SearchMultiSelectSearcher.superclass._defaultConfig.apply(this, arguments), { |
||||
import { shortcut, Widget, extend, emptyFn, createWidget, isNotNull, Selection, size, each } from "@/core"; |
||||
import { Searcher } from "@/base"; |
||||
import { MultiSelectEditor, MultiSelectSearchPane } from "@/widget"; |
||||
|
||||
@shortcut() |
||||
export class SearchMultiSelectSearcher extends Widget { |
||||
static xtype = "bi.search_multi_select_searcher"; |
||||
|
||||
static EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; |
||||
static EVENT_CHANGE = "EVENT_CHANGE"; |
||||
static EVENT_START = "EVENT_START"; |
||||
static EVENT_STOP = "EVENT_STOP"; |
||||
static EVENT_PAUSE = "EVENT_PAUSE"; |
||||
static EVENT_SEARCHING = "EVENT_SEARCHING"; |
||||
|
||||
_defaultConfig() { |
||||
return extend(super._defaultConfig(...arguments), { |
||||
baseCls: "bi-multi-select-searcher", |
||||
itemsCreator: BI.emptyFn, |
||||
itemsCreator: emptyFn, |
||||
el: {}, |
||||
popup: {}, |
||||
valueFormatter: BI.emptyFn, |
||||
valueFormatter: emptyFn, |
||||
adapter: null, |
||||
masker: {} |
||||
masker: {}, |
||||
}); |
||||
}, |
||||
} |
||||
|
||||
_init: function () { |
||||
BI.SearchMultiSelectSearcher.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
this.editor = BI.createWidget(o.el, { |
||||
type: "bi.multi_select_editor", |
||||
_init() { |
||||
super._init(...arguments); |
||||
const o = this.options; |
||||
this.editor = createWidget(o.el, { |
||||
type: MultiSelectEditor.xtype, |
||||
height: o.height, |
||||
text: o.text, |
||||
tipType: o.tipType, |
||||
warningTitle: o.warningTitle |
||||
warningTitle: o.warningTitle, |
||||
}); |
||||
|
||||
this.searcher = BI.createWidget({ |
||||
type: "bi.searcher", |
||||
this.searcher = createWidget({ |
||||
type: Searcher.xtype, |
||||
element: this, |
||||
height: o.height, |
||||
isAutoSearch: false, |
||||
isAutoSync: false, |
||||
onSearch: function (op, callback) { |
||||
onSearch: (op, callback) => { |
||||
callback(); |
||||
}, |
||||
el: this.editor, |
||||
|
||||
popup: BI.extend({ |
||||
type: "bi.multi_select_search_pane", |
||||
valueFormatter: o.valueFormatter, |
||||
keywordGetter: function () { |
||||
return self.editor.getValue(); |
||||
}, |
||||
itemsCreator: function (op, callback) { |
||||
var keyword = self.editor.getValue(); |
||||
op.keywords = [keyword]; |
||||
o.itemsCreator(op, callback); |
||||
popup: extend( |
||||
{ |
||||
type: MultiSelectSearchPane.xtype, |
||||
valueFormatter: o.valueFormatter, |
||||
keywordGetter: () => this.editor.getValue(), |
||||
itemsCreator: (op, callback) => { |
||||
const keyword = this.editor.getValue(); |
||||
op.keywords = [keyword]; |
||||
o.itemsCreator(op, callback); |
||||
}, |
||||
value: o.value, |
||||
}, |
||||
value: o.value |
||||
}, o.popup), |
||||
o.popup |
||||
), |
||||
|
||||
adapter: o.adapter, |
||||
masker: o.masker |
||||
masker: o.masker, |
||||
}); |
||||
this.searcher.on(BI.Searcher.EVENT_START, function () { |
||||
self.fireEvent(BI.SearchMultiSelectSearcher.EVENT_START); |
||||
this.searcher.on(Searcher.EVENT_START, () => { |
||||
this.fireEvent(SearchMultiSelectSearcher.EVENT_START); |
||||
}); |
||||
this.searcher.on(BI.Searcher.EVENT_PAUSE, function () { |
||||
if (this.hasMatched()) { |
||||
|
||||
} |
||||
self.fireEvent(BI.SearchMultiSelectSearcher.EVENT_PAUSE); |
||||
this.searcher.on(Searcher.EVENT_PAUSE, () => { |
||||
this.fireEvent(SearchMultiSelectSearcher.EVENT_PAUSE); |
||||
}); |
||||
this.searcher.on(BI.Searcher.EVENT_STOP, function () { |
||||
self.fireEvent(BI.SearchMultiSelectSearcher.EVENT_STOP); |
||||
this.searcher.on(Searcher.EVENT_STOP, () => { |
||||
this.fireEvent(SearchMultiSelectSearcher.EVENT_STOP); |
||||
}); |
||||
this.searcher.on(BI.Searcher.EVENT_CHANGE, function () { |
||||
self.fireEvent(BI.SearchMultiSelectSearcher.EVENT_CHANGE, arguments); |
||||
this.searcher.on(Searcher.EVENT_CHANGE, () => { |
||||
this.fireEvent(SearchMultiSelectSearcher.EVENT_CHANGE, ...arguments); |
||||
}); |
||||
this.searcher.on(BI.Searcher.EVENT_SEARCHING, function () { |
||||
var keywords = this.getKeywords(); |
||||
self.fireEvent(BI.SearchMultiSelectSearcher.EVENT_SEARCHING, keywords); |
||||
this.searcher.on(Searcher.EVENT_SEARCHING, () => { |
||||
const keywords = this.getKeywords(); |
||||
this.fireEvent(SearchMultiSelectSearcher.EVENT_SEARCHING, keywords); |
||||
}); |
||||
if(BI.isNotNull(o.value)) { |
||||
if (isNotNull(o.value)) { |
||||
this.setState(o.value); |
||||
} |
||||
}, |
||||
} |
||||
|
||||
adjustView: function () { |
||||
adjustView() { |
||||
this.searcher.adjustView(); |
||||
}, |
||||
} |
||||
|
||||
isSearching: function () { |
||||
isSearching() { |
||||
return this.searcher.isSearching(); |
||||
}, |
||||
} |
||||
|
||||
stopSearch: function () { |
||||
stopSearch() { |
||||
this.searcher.stopSearch(); |
||||
}, |
||||
} |
||||
|
||||
getKeyword: function () { |
||||
getKeyword() { |
||||
return this.editor.getValue(); |
||||
}, |
||||
} |
||||
|
||||
hasMatched: function () { |
||||
hasMatched() { |
||||
return this.searcher.hasMatched(); |
||||
}, |
||||
} |
||||
|
||||
hasChecked: function () { |
||||
hasChecked() { |
||||
return this.searcher.getView() && this.searcher.getView().hasChecked(); |
||||
}, |
||||
} |
||||
|
||||
setAdapter: function (adapter) { |
||||
setAdapter(adapter) { |
||||
this.searcher.setAdapter(adapter); |
||||
}, |
||||
} |
||||
|
||||
setState: function (obj) { |
||||
var o = this.options; |
||||
var ob = {}; |
||||
setState(obj) { |
||||
let state; |
||||
const o = this.options; |
||||
const ob = {}; |
||||
ob.type = obj.type; |
||||
ob.value = o.allValueGetter() || []; |
||||
ob.assist = obj.assist; |
||||
if (ob.type === BI.Selection.All) { |
||||
if (ob.type === Selection.All) { |
||||
if (ob.value.length === 0) { |
||||
this.editor.setState(BI.Selection.All); |
||||
} else if (BI.size(ob.assist) <= 20) { |
||||
var state = ""; |
||||
BI.each(ob.assist, function (i, v) { |
||||
this.editor.setState(Selection.All); |
||||
} else if (size(ob.assist) <= 20) { |
||||
state = ""; |
||||
each(ob.assist, (i, v) => { |
||||
if (i === 0) { |
||||
state += "" + (o.valueFormatter(v + "") || v); |
||||
state += `${o.valueFormatter(`${v}`) || v}`; |
||||
} else { |
||||
state += "," + (o.valueFormatter(v + "") || v); |
||||
state += `,${o.valueFormatter(`${v}`) || v}`; |
||||
} |
||||
}); |
||||
this.editor.setState(state); |
||||
} else { |
||||
this.editor.setState(BI.Selection.Multi); |
||||
this.editor.setState(Selection.Multi); |
||||
} |
||||
} else { |
||||
if (ob.value.length === 0) { |
||||
this.editor.setState(BI.Selection.None); |
||||
} else if (BI.size(ob.value) <= 20) { |
||||
var state = ""; |
||||
BI.each(ob.value, function (i, v) { |
||||
this.editor.setState(Selection.None); |
||||
} else if (size(ob.value) <= 20) { |
||||
state = ""; |
||||
each(ob.value, (i, v) => { |
||||
if (i === 0) { |
||||
state += "" + (o.valueFormatter(v + "") || v); |
||||
state += `${o.valueFormatter(`${v}`) || v}`; |
||||
} else { |
||||
state += "," + (o.valueFormatter(v + "") || v); |
||||
state += `,${o.valueFormatter(`${v}`) || v}`; |
||||
} |
||||
}); |
||||
this.editor.setState(state); |
||||
} else { |
||||
this.editor.setState(BI.Selection.Multi); |
||||
this.editor.setState(Selection.Multi); |
||||
} |
||||
} |
||||
}, |
||||
} |
||||
|
||||
setTipType: function (v) { |
||||
setTipType(v) { |
||||
this.editor.setTipType(v); |
||||
}, |
||||
} |
||||
|
||||
setValue: function (ob) { |
||||
setValue(ob) { |
||||
this.setState(ob); |
||||
this.searcher.setValue(ob); |
||||
}, |
||||
} |
||||
|
||||
getKey: function () { |
||||
getKey() { |
||||
return this.editor.getValue(); |
||||
}, |
||||
} |
||||
|
||||
getValue: function () { |
||||
getValue() { |
||||
return this.searcher.getValue(); |
||||
}, |
||||
} |
||||
|
||||
populate: function (items) { |
||||
this.searcher.populate.apply(this.searcher, arguments); |
||||
populate(items) { |
||||
this.searcher.populate(...arguments); |
||||
} |
||||
}); |
||||
|
||||
BI.SearchMultiSelectSearcher.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; |
||||
BI.SearchMultiSelectSearcher.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.SearchMultiSelectSearcher.EVENT_START = "EVENT_START"; |
||||
BI.SearchMultiSelectSearcher.EVENT_STOP = "EVENT_STOP"; |
||||
BI.SearchMultiSelectSearcher.EVENT_PAUSE = "EVENT_PAUSE"; |
||||
BI.SearchMultiSelectSearcher.EVENT_SEARCHING = "EVENT_SEARCHING"; |
||||
BI.shortcut("bi.search_multi_select_searcher", BI.SearchMultiSelectSearcher); |
||||
} |
||||
|
@ -1,109 +0,0 @@
|
||||
import { |
||||
shortcut, |
||||
extend, |
||||
createWidget, |
||||
Controller, |
||||
Events, |
||||
isNotNull, LogicFactory, Direction |
||||
} from "@/core"; |
||||
import { NodeButton, Label } from "@/base"; |
||||
import { FirstTreeNodeCheckbox } from "@/case"; |
||||
|
||||
@shortcut() |
||||
export class SelectTreeFirstPlusGroupNode extends NodeButton { |
||||
static xtype = "bi.select_tree_first_plus_group_node"; |
||||
|
||||
_defaultConfig() { |
||||
const conf = super._defaultConfig(...arguments); |
||||
|
||||
return extend(conf, { |
||||
baseCls: |
||||
`${conf.baseCls || "" |
||||
} bi-select-tree-first-plus-group-node bi-list-item-active`,
|
||||
logic: { |
||||
dynamic: false, |
||||
}, |
||||
id: "", |
||||
pId: "", |
||||
readonly: true, |
||||
open: false, |
||||
height: 24, |
||||
}); |
||||
} |
||||
|
||||
_init() { |
||||
super._init(...arguments); |
||||
const self = this, |
||||
o = this.options; |
||||
this.checkbox = createWidget({ |
||||
type: FirstTreeNodeCheckbox.xtype, |
||||
stopPropagation: true, |
||||
iconHeight: o.height, |
||||
iconWidth: o.height, |
||||
}); |
||||
this.text = createWidget({ |
||||
type: Label.xtype, |
||||
textAlign: "left", |
||||
whiteSpace: "nowrap", |
||||
textHeight: o.height, |
||||
height: o.height, |
||||
hgap: o.hgap, |
||||
text: o.text, |
||||
value: o.value, |
||||
keyword: o.keyword, |
||||
py: o.py, |
||||
}); |
||||
this.checkbox.on(Controller.EVENT_CHANGE, function (type) { |
||||
if (type === Events.CLICK) { |
||||
if (this.isSelected()) { |
||||
self.triggerExpand(); |
||||
} else { |
||||
self.triggerCollapse(); |
||||
} |
||||
} |
||||
}); |
||||
const type = LogicFactory.createLogicTypeByDirection( |
||||
Direction.Left |
||||
); |
||||
const items = LogicFactory.createLogicItemsByDirection( |
||||
Direction.Left, |
||||
{ |
||||
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, |
||||
el: this.checkbox, |
||||
}, |
||||
this.text |
||||
); |
||||
createWidget( |
||||
extend( |
||||
{ |
||||
element: this, |
||||
}, |
||||
LogicFactory.createLogic( |
||||
type, |
||||
extend(o.logic, { |
||||
items, |
||||
}) |
||||
) |
||||
) |
||||
); |
||||
} |
||||
|
||||
isOnce() { |
||||
return true; |
||||
} |
||||
|
||||
doRedMark() { |
||||
this.text.doRedMark(...arguments); |
||||
} |
||||
|
||||
unRedMark() { |
||||
this.text.unRedMark(...arguments); |
||||
} |
||||
|
||||
setOpened(v) { |
||||
super.setOpened(...arguments); |
||||
if (isNotNull(this.checkbox)) { |
||||
this.checkbox.setSelected(v); |
||||
} |
||||
} |
||||
} |
@ -1,109 +0,0 @@
|
||||
import { |
||||
shortcut, |
||||
extend, |
||||
createWidget, |
||||
Controller, |
||||
Events, |
||||
isNotNull, LogicFactory, Direction |
||||
} from "@/core"; |
||||
import { NodeButton, Label } from "@/base"; |
||||
import { LastTreeNodeCheckbox } from "@/case"; |
||||
|
||||
@shortcut() |
||||
export class SelectTreeLastPlusGroupNode extends NodeButton { |
||||
static xtype = "bi.select_tree_last_plus_group_node"; |
||||
|
||||
_defaultConfig() { |
||||
const conf = super._defaultConfig(...arguments); |
||||
|
||||
return extend(conf, { |
||||
baseCls: |
||||
`${conf.baseCls || "" |
||||
} bi-select-tree-last-plus-group-node bi-list-item-active`,
|
||||
logic: { |
||||
dynamic: false, |
||||
}, |
||||
id: "", |
||||
pId: "", |
||||
readonly: true, |
||||
open: false, |
||||
height: 24, |
||||
}); |
||||
} |
||||
|
||||
_init() { |
||||
super._init(...arguments); |
||||
const self = this, |
||||
o = this.options; |
||||
this.checkbox = createWidget({ |
||||
type: LastTreeNodeCheckbox.xtype, |
||||
stopPropagation: true, |
||||
iconHeight: o.height, |
||||
iconWidth: o.height, |
||||
}); |
||||
this.text = createWidget({ |
||||
type: Label.xtype, |
||||
textAlign: "left", |
||||
whiteSpace: "nowrap", |
||||
textHeight: o.height, |
||||
height: o.height, |
||||
hgap: o.hgap, |
||||
text: o.text, |
||||
value: o.value, |
||||
keyword: o.keyword, |
||||
py: o.py, |
||||
}); |
||||
this.checkbox.on(Controller.EVENT_CHANGE, function (type) { |
||||
if (type === Events.CLICK) { |
||||
if (this.isSelected()) { |
||||
self.triggerExpand(); |
||||
} else { |
||||
self.triggerCollapse(); |
||||
} |
||||
} |
||||
}); |
||||
const type = LogicFactory.createLogicTypeByDirection( |
||||
Direction.Left |
||||
); |
||||
const items = LogicFactory.createLogicItemsByDirection( |
||||
Direction.Left, |
||||
{ |
||||
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, |
||||
el: this.checkbox, |
||||
}, |
||||
this.text |
||||
); |
||||
createWidget( |
||||
extend( |
||||
{ |
||||
element: this, |
||||
}, |
||||
LogicFactory.createLogic( |
||||
type, |
||||
extend(o.logic, { |
||||
items, |
||||
}) |
||||
) |
||||
) |
||||
); |
||||
} |
||||
|
||||
isOnce() { |
||||
return true; |
||||
} |
||||
|
||||
doRedMark() { |
||||
this.text.doRedMark(...arguments); |
||||
} |
||||
|
||||
unRedMark() { |
||||
this.text.unRedMark(...arguments); |
||||
} |
||||
|
||||
setOpened(v) { |
||||
super.setOpened(...arguments); |
||||
if (isNotNull(this.checkbox)) { |
||||
this.checkbox.setSelected(v); |
||||
} |
||||
} |
||||
} |
@ -1,109 +0,0 @@
|
||||
import { |
||||
shortcut, |
||||
extend, |
||||
createWidget, |
||||
Controller, |
||||
Events, |
||||
isNotNull, Direction, LogicFactory |
||||
} from "@/core"; |
||||
import { NodeButton, Label } from "@/base"; |
||||
import { MidTreeNodeCheckbox } from "@/case"; |
||||
|
||||
@shortcut() |
||||
export class SelectTreeMidPlusGroupNode extends NodeButton { |
||||
static xtype = "bi.select_tree_mid_plus_group_node"; |
||||
|
||||
_defaultConfig() { |
||||
const conf = super._defaultConfig(...arguments); |
||||
|
||||
return extend(conf, { |
||||
baseCls: |
||||
`${conf.baseCls || "" |
||||
} bi-select-tree-mid-plus-group-node bi-list-item-active`,
|
||||
logic: { |
||||
dynamic: false, |
||||
}, |
||||
id: "", |
||||
pId: "", |
||||
readonly: true, |
||||
open: false, |
||||
height: 24, |
||||
}); |
||||
} |
||||
|
||||
_init() { |
||||
super._init(...arguments); |
||||
const self = this, |
||||
o = this.options; |
||||
this.checkbox = createWidget({ |
||||
type: MidTreeNodeCheckbox.xtype, |
||||
stopPropagation: true, |
||||
iconHeight: o.height, |
||||
iconWidth: o.height, |
||||
}); |
||||
this.text = createWidget({ |
||||
type: Label.xtype, |
||||
textAlign: "left", |
||||
whiteSpace: "nowrap", |
||||
textHeight: o.height, |
||||
height: o.height, |
||||
hgap: o.hgap, |
||||
text: o.text, |
||||
value: o.value, |
||||
keyword: o.keyword, |
||||
py: o.py, |
||||
}); |
||||
this.checkbox.on(Controller.EVENT_CHANGE, function (type) { |
||||
if (type === Events.CLICK) { |
||||
if (this.isSelected()) { |
||||
self.triggerExpand(); |
||||
} else { |
||||
self.triggerCollapse(); |
||||
} |
||||
} |
||||
}); |
||||
const type = LogicFactory.createLogicTypeByDirection( |
||||
Direction.Left |
||||
); |
||||
const items = LogicFactory.createLogicItemsByDirection( |
||||
Direction.Left, |
||||
{ |
||||
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, |
||||
el: this.checkbox, |
||||
}, |
||||
this.text |
||||
); |
||||
createWidget( |
||||
extend( |
||||
{ |
||||
element: this, |
||||
}, |
||||
LogicFactory.createLogic( |
||||
type, |
||||
extend(o.logic, { |
||||
items, |
||||
}) |
||||
) |
||||
) |
||||
); |
||||
} |
||||
|
||||
isOnce() { |
||||
return true; |
||||
} |
||||
|
||||
doRedMark() { |
||||
this.text.doRedMark(...arguments); |
||||
} |
||||
|
||||
unRedMark() { |
||||
this.text.unRedMark(...arguments); |
||||
} |
||||
|
||||
setOpened(v) { |
||||
super.setOpened(...arguments); |
||||
if (isNotNull(this.checkbox)) { |
||||
this.checkbox.setSelected(v); |
||||
} |
||||
} |
||||
} |
@ -1,109 +0,0 @@
|
||||
import { |
||||
shortcut, |
||||
extend, |
||||
createWidget, |
||||
Controller, |
||||
Events, |
||||
isNotNull, LogicFactory |
||||
} from "@/core"; |
||||
import { NodeButton, Label } from "@/base"; |
||||
import { TreeNodeCheckbox } from "@/case"; |
||||
|
||||
@shortcut() |
||||
export class SelectTreePlusGroupNode extends NodeButton { |
||||
static xtype = "bi.select_tree_plus_group_node"; |
||||
|
||||
_defaultConfig() { |
||||
const conf = super._defaultConfig(...arguments); |
||||
|
||||
return extend(conf, { |
||||
baseCls: |
||||
`${conf.baseCls || "" |
||||
} bi-select-tree-plus-group-node bi-list-item-active`,
|
||||
logic: { |
||||
dynamic: false, |
||||
}, |
||||
id: "", |
||||
pId: "", |
||||
readonly: true, |
||||
open: false, |
||||
height: 24, |
||||
}); |
||||
} |
||||
|
||||
_init() { |
||||
super._init(...arguments); |
||||
const self = this, |
||||
o = this.options; |
||||
this.checkbox = createWidget({ |
||||
type: TreeNodeCheckbox.xtype, |
||||
stopPropagation: true, |
||||
iconHeight: o.height, |
||||
iconWidth: o.iconWrapperWidth || o.height, |
||||
}); |
||||
this.text = createWidget({ |
||||
type: Label.xtype, |
||||
textAlign: "left", |
||||
whiteSpace: "nowrap", |
||||
textHeight: o.height, |
||||
height: o.height, |
||||
hgap: o.hgap, |
||||
text: o.text, |
||||
value: o.value, |
||||
keyword: o.keyword, |
||||
py: o.py, |
||||
}); |
||||
this.checkbox.on(Controller.EVENT_CHANGE, function (type) { |
||||
if (type === Events.CLICK) { |
||||
if (this.isSelected()) { |
||||
self.triggerExpand(); |
||||
} else { |
||||
self.triggerCollapse(); |
||||
} |
||||
} |
||||
}); |
||||
const type = LogicFactory.createLogicTypeByDirection( |
||||
BI.Direction.Left |
||||
); |
||||
const items = LogicFactory.createLogicItemsByDirection( |
||||
BI.Direction.Left, |
||||
{ |
||||
width: 24, |
||||
el: this.checkbox, |
||||
}, |
||||
this.text |
||||
); |
||||
createWidget( |
||||
extend( |
||||
{ |
||||
element: this, |
||||
}, |
||||
LogicFactory.createLogic( |
||||
type, |
||||
extend(o.logic, { |
||||
items, |
||||
}) |
||||
) |
||||
) |
||||
); |
||||
} |
||||
|
||||
isOnce() { |
||||
return true; |
||||
} |
||||
|
||||
doRedMark() { |
||||
this.text.doRedMark(...arguments); |
||||
} |
||||
|
||||
unRedMark() { |
||||
this.text.unRedMark(...arguments); |
||||
} |
||||
|
||||
setOpened(v) { |
||||
super.setOpened(...arguments); |
||||
if (isNotNull(this.checkbox)) { |
||||
this.checkbox.setSelected(v); |
||||
} |
||||
} |
||||
} |
@ -1,166 +1,213 @@
|
||||
/** |
||||
* 年季度展示面板 |
||||
* |
||||
* Created by GUY on 2015/9/2. |
||||
* @class BI.YearCard |
||||
* @extends BI.Trigger |
||||
*/ |
||||
BI.DynamicYearQuarterCard = BI.inherit(BI.Widget, { |
||||
|
||||
props: { |
||||
baseCls: "bi-year-quarter-card" |
||||
}, |
||||
|
||||
render: function () { |
||||
var self = this; |
||||
import { |
||||
shortcut, |
||||
Widget, |
||||
i18nText, |
||||
bind, |
||||
VerticalLayout, |
||||
parseDateTime, |
||||
extend, |
||||
checkDateVoid, |
||||
isNotEmptyString, |
||||
getQuarter |
||||
} from "@/core"; |
||||
import { DynamicDateCard, DynamicDateParamItem, DynamicDateHelper } from "../dynamicdate"; |
||||
import { Label, Bubbles } from "@/base"; |
||||
|
||||
@shortcut() |
||||
export class DynamicYearQuarterCard extends Widget { |
||||
static xtype = "bi.dynamic_year_quarter_card"; |
||||
|
||||
props = { baseCls: "bi-year-quarter-card" }; |
||||
|
||||
static EVENT_CHANGE = "EVENT_CHANGE"; |
||||
|
||||
render() { |
||||
return { |
||||
type: "bi.vertical", |
||||
items: [{ |
||||
type: "bi.label", |
||||
text: BI.i18nText("BI-Multi_Date_Relative_Current_Time"), |
||||
textAlign: "left", |
||||
height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, |
||||
}, { |
||||
type: "bi.vertical", |
||||
ref: function (_ref) { |
||||
self.wrapper = _ref; |
||||
type: VerticalLayout.xtype, |
||||
items: [ |
||||
{ |
||||
type: Label.xtype, |
||||
text: i18nText("BI-Multi_Date_Relative_Current_Time"), |
||||
textAlign: "left", |
||||
height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, |
||||
}, |
||||
items: [{ |
||||
el: { |
||||
type: "bi.dynamic_date_param_item", |
||||
validationChecker: BI.bind(self._checkDate, self), |
||||
ref: function () { |
||||
self.year = this; |
||||
}, |
||||
listeners: [{ |
||||
eventName: "EVENT_CHANGE", |
||||
action: function () { |
||||
self.fireEvent("EVENT_CHANGE"); |
||||
} |
||||
}, { |
||||
eventName: "EVENT_INPUT_CHANGE", |
||||
action: function () { |
||||
BI.Bubbles.hide("dynamic-year-quarter-error"); |
||||
} |
||||
}] |
||||
}, |
||||
bgap: 10 |
||||
}, { |
||||
type: "bi.dynamic_date_param_item", |
||||
dateType: BI.DynamicDateCard.TYPE.QUARTER, |
||||
ref: function () { |
||||
self.quarter = this; |
||||
{ |
||||
type: VerticalLayout.xtype, |
||||
ref: _ref => { |
||||
this.wrapper = _ref; |
||||
}, |
||||
listeners: [{ |
||||
eventName: "EVENT_CHANGE", |
||||
action: function () { |
||||
self.fireEvent("EVENT_CHANGE"); |
||||
} |
||||
}, { |
||||
eventName: "EVENT_INPUT_CHANGE", |
||||
action: function () { |
||||
BI.Bubbles.hide("dynamic-year-quarter-error"); |
||||
items: [ |
||||
{ |
||||
el: { |
||||
type: DynamicDateParamItem.xtype, |
||||
validationChecker: bind(this._checkDate, this), |
||||
ref: _ref => { |
||||
this.year = _ref; |
||||
}, |
||||
listeners: [ |
||||
{ |
||||
eventName: "EVENT_CHANGE", |
||||
action: () => { |
||||
this.fireEvent("EVENT_CHANGE"); |
||||
}, |
||||
}, |
||||
{ |
||||
eventName: "EVENT_INPUT_CHANGE", |
||||
action: () => { |
||||
Bubbles.hide( |
||||
"dynamic-year-quarter-error" |
||||
); |
||||
}, |
||||
} |
||||
], |
||||
}, |
||||
bgap: 10, |
||||
}, |
||||
{ |
||||
type: DynamicDateParamItem.xtype, |
||||
dateType: DynamicDateCard.TYPE.QUARTER, |
||||
ref: _ref => { |
||||
this.quarter = _ref; |
||||
}, |
||||
listeners: [ |
||||
{ |
||||
eventName: "EVENT_CHANGE", |
||||
action: () => { |
||||
this.fireEvent("EVENT_CHANGE"); |
||||
}, |
||||
}, |
||||
{ |
||||
eventName: "EVENT_INPUT_CHANGE", |
||||
action: () => { |
||||
Bubbles.hide( |
||||
"dynamic-year-quarter-error" |
||||
); |
||||
}, |
||||
} |
||||
], |
||||
} |
||||
}] |
||||
}] |
||||
}], |
||||
], |
||||
} |
||||
], |
||||
vgap: 10, |
||||
hgap: 10 |
||||
hgap: 10, |
||||
}; |
||||
}, |
||||
} |
||||
|
||||
_getErrorText: function () { |
||||
var o = this.options; |
||||
var start = BI.parseDateTime(o.min, "%Y-%X-%d"); |
||||
var end = BI.parseDateTime(o.max, "%Y-%X-%d"); |
||||
return BI.i18nText("BI-Basic_Year_Quarter_Range_Error", |
||||
_getErrorText() { |
||||
const o = this.options; |
||||
const start = parseDateTime(o.min, "%Y-%X-%d"); |
||||
const end = parseDateTime(o.max, "%Y-%X-%d"); |
||||
|
||||
return i18nText( |
||||
"BI-Basic_Year_Quarter_Range_Error", |
||||
start.getFullYear(), |
||||
BI.getQuarter(start), |
||||
getQuarter(start), |
||||
end.getFullYear(), |
||||
BI.getQuarter(end) |
||||
getQuarter(end) |
||||
); |
||||
}, |
||||
} |
||||
|
||||
_checkDate: function (obj) { |
||||
var o = this.options; |
||||
var date = BI.DynamicDateHelper.getCalculation(BI.extend(this._getValue(), this._digestDateTypeValue(obj))); |
||||
_checkDate(obj) { |
||||
const o = this.options; |
||||
const date = DynamicDateHelper.getCalculation( |
||||
extend(this._getValue(), this._digestDateTypeValue(obj)) |
||||
); |
||||
|
||||
return !BI.checkDateVoid(date.getFullYear(), date.getMonth() + 1, date.getDate(), o.min, o.max)[0]; |
||||
}, |
||||
return !checkDateVoid( |
||||
date.getFullYear(), |
||||
date.getMonth() + 1, |
||||
date.getDate(), |
||||
o.min, |
||||
o.max |
||||
)[0]; |
||||
} |
||||
|
||||
_digestDateTypeValue: function (value) { |
||||
var valueMap = {}; |
||||
_digestDateTypeValue(value) { |
||||
const valueMap = {}; |
||||
switch (value.dateType) { |
||||
case BI.DynamicDateCard.TYPE.YEAR: |
||||
valueMap.year = (value.offset === 0 ? -value.value : +value.value); |
||||
break; |
||||
case BI.DynamicDateCard.TYPE.QUARTER: |
||||
valueMap.quarter = (value.offset === 0 ? -value.value : +value.value); |
||||
break; |
||||
default: |
||||
break; |
||||
case DynamicDateCard.TYPE.YEAR: |
||||
valueMap.year = |
||||
value.offset === 0 ? -value.value : +value.value; |
||||
break; |
||||
case DynamicDateCard.TYPE.QUARTER: |
||||
valueMap.quarter = |
||||
value.offset === 0 ? -value.value : +value.value; |
||||
break; |
||||
default: |
||||
break; |
||||
} |
||||
|
||||
return valueMap; |
||||
}, |
||||
} |
||||
|
||||
_createValue: function (type, v) { |
||||
_createValue(type, v) { |
||||
return { |
||||
dateType: type, |
||||
value: Math.abs(v), |
||||
offset: v > 0 ? 1 : 0 |
||||
offset: v > 0 ? 1 : 0, |
||||
}; |
||||
}, |
||||
} |
||||
|
||||
setMinDate: function(minDate) { |
||||
if (BI.isNotEmptyString(this.options.min)) { |
||||
setMinDate(minDate) { |
||||
if (isNotEmptyString(this.options.min)) { |
||||
this.options.min = minDate; |
||||
} |
||||
}, |
||||
} |
||||
|
||||
setMaxDate: function (maxDate) { |
||||
if (BI.isNotEmptyString(this.options.max)) { |
||||
setMaxDate(maxDate) { |
||||
if (isNotEmptyString(this.options.max)) { |
||||
this.options.max = maxDate; |
||||
} |
||||
}, |
||||
} |
||||
|
||||
setValue: function (v) { |
||||
v = v || {year: 0, quarter: 0}; |
||||
this.year.setValue(this._createValue(BI.DynamicDateCard.TYPE.YEAR, v.year)); |
||||
this.quarter.setValue(this._createValue(BI.DynamicDateCard.TYPE.QUARTER, v.quarter)); |
||||
}, |
||||
setValue(v) { |
||||
v = v || { year: 0, quarter: 0 }; |
||||
this.year.setValue( |
||||
this._createValue(DynamicDateCard.TYPE.YEAR, v.year) |
||||
); |
||||
this.quarter.setValue( |
||||
this._createValue(DynamicDateCard.TYPE.QUARTER, v.quarter) |
||||
); |
||||
} |
||||
|
||||
_getValue: function () { |
||||
var year = this.year.getValue(); |
||||
var quarter = this.quarter.getValue(); |
||||
_getValue() { |
||||
const year = this.year.getValue(); |
||||
const quarter = this.quarter.getValue(); |
||||
|
||||
return { |
||||
year: (year.offset === 0 ? -year.value : year.value), |
||||
quarter: (quarter.offset === 0 ? -quarter.value : quarter.value) |
||||
year: year.offset === 0 ? -year.value : year.value, |
||||
quarter: quarter.offset === 0 ? -quarter.value : quarter.value, |
||||
}; |
||||
}, |
||||
} |
||||
|
||||
getInputValue: function () { |
||||
getInputValue() { |
||||
return this._getValue(); |
||||
}, |
||||
} |
||||
|
||||
getValue: function () { |
||||
getValue() { |
||||
return this.checkValidation() ? this._getValue() : {}; |
||||
}, |
||||
} |
||||
|
||||
checkValidation: function (show) { |
||||
var errorText; |
||||
var yearInvalid = !this.year.checkValidation(); |
||||
var quarterInvalid = !this.quarter.checkValidation(); |
||||
var invalid = yearInvalid || quarterInvalid; |
||||
checkValidation(show) { |
||||
let errorText; |
||||
const yearInvalid = !this.year.checkValidation(); |
||||
const quarterInvalid = !this.quarter.checkValidation(); |
||||
let invalid = yearInvalid || quarterInvalid; |
||||
if (invalid) { |
||||
errorText = BI.i18nText("BI-Please_Input_Natural_Number"); |
||||
errorText = i18nText("BI-Please_Input_Natural_Number"); |
||||
} else { |
||||
invalid = !this._checkDate(this._getValue()); |
||||
errorText = this._getErrorText(); |
||||
} |
||||
invalid && show && BI.Bubbles.show("dynamic-year-quarter-error", errorText, this.wrapper); |
||||
invalid && |
||||
show && |
||||
Bubbles.show( |
||||
"dynamic-year-quarter-error", |
||||
errorText, |
||||
this.wrapper |
||||
); |
||||
|
||||
return !invalid; |
||||
}, |
||||
}); |
||||
BI.DynamicYearQuarterCard.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.shortcut("bi.dynamic_year_quarter_card", BI.DynamicYearQuarterCard); |
||||
} |
||||
} |
||||
|
@ -1,152 +1,190 @@
|
||||
BI.StaticYearQuarterCard = BI.inherit(BI.Widget, { |
||||
import { |
||||
shortcut, |
||||
Widget, |
||||
map, |
||||
extend, |
||||
VerticalLayout, |
||||
parseDateTime, |
||||
parseInt, |
||||
each, |
||||
checkDateVoid, |
||||
getDate, |
||||
getQuarterName, |
||||
getQuarter |
||||
} from "@/core"; |
||||
import { TextItem, ButtonGroup } from "@/base"; |
||||
import { YearPicker } from "../date/calendar"; |
||||
|
||||
props: { |
||||
baseCls: "bi-static-year-quarter-card", |
||||
behaviors: {} |
||||
}, |
||||
@shortcut() |
||||
export class StaticYearQuarterCard extends Widget { |
||||
static xtype = "bi.static_year_quarter_card"; |
||||
|
||||
_createQuarter: function () { |
||||
var self = this; |
||||
var items = [{ |
||||
text: BI.getQuarterName(1), |
||||
value: 1 |
||||
}, { |
||||
text: BI.getQuarterName(2), |
||||
value: 2 |
||||
}, { |
||||
text: BI.getQuarterName(3), |
||||
value: 3 |
||||
}, { |
||||
text: BI.getQuarterName(4), |
||||
value: 4 |
||||
}]; |
||||
return BI.map(items, function (j, item) { |
||||
return BI.extend(item, { |
||||
type: "bi.text_item", |
||||
cls: "bi-border-radius bi-list-item-select", |
||||
textAlign: "center", |
||||
whiteSpace: "nowrap", |
||||
once: false, |
||||
forceSelected: true, |
||||
height: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, |
||||
ref: function (_ref) { |
||||
self.quarterMap[j + 1] = _ref; |
||||
} |
||||
}); |
||||
}); |
||||
}, |
||||
props = { baseCls: "bi-static-year-quarter-card", behaviors: {} }; |
||||
|
||||
static EVENT_CHANGE = "EVENT_CHANGE"; |
||||
|
||||
_createQuarter() { |
||||
const items = [ |
||||
{ |
||||
text: getQuarterName(1), |
||||
value: 1, |
||||
}, |
||||
{ |
||||
text: getQuarterName(2), |
||||
value: 2, |
||||
}, |
||||
{ |
||||
text: getQuarterName(3), |
||||
value: 3, |
||||
}, |
||||
{ |
||||
text: getQuarterName(4), |
||||
value: 4, |
||||
} |
||||
]; |
||||
|
||||
return map(items, (j, item) => extend(item, { |
||||
type: TextItem.xtype, |
||||
cls: "bi-border-radius bi-list-item-select", |
||||
textAlign: "center", |
||||
whiteSpace: "nowrap", |
||||
once: false, |
||||
forceSelected: true, |
||||
height: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, |
||||
ref: _ref => { |
||||
this.quarterMap[j + 1] = _ref; |
||||
}, |
||||
})); |
||||
} |
||||
|
||||
render: function () { |
||||
var self = this, o = this.options; |
||||
render() { |
||||
const o = this.options; |
||||
this.quarterMap = {}; |
||||
|
||||
return { |
||||
type: "bi.vertical", |
||||
items: [{ |
||||
type: "bi.year_picker", |
||||
cls: "bi-split-bottom", |
||||
ref: function () { |
||||
self.yearPicker = this; |
||||
}, |
||||
min: o.min, |
||||
max: o.max, |
||||
behaviors: o.behaviors, |
||||
height: 30, |
||||
listeners: [{ |
||||
eventName: BI.YearPicker.EVENT_CHANGE, |
||||
action: function () { |
||||
var value = this.getValue(); |
||||
self._checkQuarterStatus(value); |
||||
self.setValue({ |
||||
year: value, |
||||
quarter: self.selectedQuarter |
||||
}); |
||||
} |
||||
}] |
||||
}, { |
||||
el: { |
||||
type: "bi.button_group", |
||||
behaviors: o.behaviors, |
||||
ref: function () { |
||||
self.quarter = this; |
||||
type: VerticalLayout.xtype, |
||||
items: [ |
||||
{ |
||||
type: YearPicker.xtype, |
||||
cls: "bi-split-bottom", |
||||
ref: _ref => { |
||||
this.yearPicker = _ref; |
||||
}, |
||||
items: this._createQuarter(), |
||||
layouts: [{ |
||||
type: "bi.vertical", |
||||
vgap: 10, |
||||
hgap: 12, |
||||
}], |
||||
value: o.value, |
||||
listeners: [{ |
||||
eventName: BI.ButtonGroup.EVENT_CHANGE, |
||||
action: function () { |
||||
self.selectedYear = self.yearPicker.getValue(); |
||||
self.selectedQuarter = this.getValue()[0]; |
||||
self.fireEvent(BI.StaticYearQuarterCard.EVENT_CHANGE); |
||||
min: o.min, |
||||
max: o.max, |
||||
behaviors: o.behaviors, |
||||
height: 30, |
||||
listeners: [ |
||||
{ |
||||
eventName: YearPicker.EVENT_CHANGE, |
||||
action: () => { |
||||
const value = this.yearPicker.getValue(); |
||||
this._checkQuarterStatus(value); |
||||
this.setValue({ |
||||
year: value, |
||||
quarter: this.selectedQuarter, |
||||
}); |
||||
}, |
||||
} |
||||
}] |
||||
], |
||||
}, |
||||
vgap: 5 |
||||
}] |
||||
{ |
||||
el: { |
||||
type: ButtonGroup.xtype, |
||||
behaviors: o.behaviors, |
||||
ref: _ref => { |
||||
this.quarter = _ref; |
||||
}, |
||||
items: this._createQuarter(), |
||||
layouts: [ |
||||
{ |
||||
type: VerticalLayout.xtype, |
||||
vgap: 10, |
||||
hgap: 12, |
||||
} |
||||
], |
||||
value: o.value, |
||||
listeners: [ |
||||
{ |
||||
eventName: ButtonGroup.EVENT_CHANGE, |
||||
action: () => { |
||||
this.selectedYear = |
||||
this.yearPicker.getValue(); |
||||
this.selectedQuarter = this.quarter.getValue()[0]; |
||||
this.fireEvent( |
||||
StaticYearQuarterCard.EVENT_CHANGE |
||||
); |
||||
}, |
||||
} |
||||
], |
||||
}, |
||||
vgap: 5, |
||||
} |
||||
], |
||||
}; |
||||
}, |
||||
} |
||||
|
||||
_checkQuarterStatus: function (year) { |
||||
var o = this.options; |
||||
var minDate = BI.parseDateTime(o.min, "%Y-%X-%d"), maxDate = BI.parseDateTime(o.max, "%Y-%X-%d"); |
||||
var minYear = minDate.getFullYear(), maxYear = maxDate.getFullYear(); |
||||
var minQuarter = 1; var maxQuarter = 4; |
||||
minYear === year && (minQuarter = BI.parseInt(BI.getQuarter(minDate))); |
||||
maxYear === year && (maxQuarter = BI.parseInt(BI.getQuarter(maxDate))); |
||||
var yearInvalid = year < minYear || year > maxYear; |
||||
BI.each(this.quarterMap, function (quarter, obj) { |
||||
var quarterInvalid = quarter < minQuarter || quarter > maxQuarter; |
||||
_checkQuarterStatus(year) { |
||||
const o = this.options; |
||||
const minDate = parseDateTime(o.min, "%Y-%X-%d"), |
||||
maxDate = parseDateTime(o.max, "%Y-%X-%d"); |
||||
const minYear = minDate.getFullYear(), |
||||
maxYear = maxDate.getFullYear(); |
||||
let minQuarter = 1; |
||||
let maxQuarter = 4; |
||||
minYear === year && (minQuarter = parseInt(getQuarter(minDate))); |
||||
maxYear === year && (maxQuarter = parseInt(getQuarter(maxDate))); |
||||
const yearInvalid = year < minYear || year > maxYear; |
||||
each(this.quarterMap, (quarter, obj) => { |
||||
const quarterInvalid = quarter < minQuarter || quarter > maxQuarter; |
||||
obj.setEnable(!yearInvalid && !quarterInvalid); |
||||
}); |
||||
}, |
||||
} |
||||
|
||||
setMinDate: function (minDate) { |
||||
setMinDate(minDate) { |
||||
if (this.options.min !== minDate) { |
||||
this.options.min = minDate; |
||||
this.yearPicker.setMinDate(minDate); |
||||
this._checkQuarterStatus(this.selectedYear); |
||||
} |
||||
}, |
||||
} |
||||
|
||||
setMaxDate: function (maxDate) { |
||||
setMaxDate(maxDate) { |
||||
if (this.options.max !== maxDate) { |
||||
this.options.max = maxDate; |
||||
this.yearPicker.setMaxDate(maxDate); |
||||
this._checkQuarterStatus(this.selectedYear); |
||||
} |
||||
}, |
||||
|
||||
} |
||||
|
||||
getValue: function () { |
||||
getValue() { |
||||
return { |
||||
year: this.selectedYear, |
||||
quarter: this.selectedQuarter |
||||
quarter: this.selectedQuarter, |
||||
}; |
||||
}, |
||||
} |
||||
|
||||
setValue: function (obj) { |
||||
var o = this.options; |
||||
var newObj = {}; |
||||
setValue(obj) { |
||||
const o = this.options; |
||||
const newObj = {}; |
||||
newObj.year = obj.year || 0; |
||||
newObj.quarter = obj.quarter || 0; |
||||
if (newObj.quarter === 0 || newObj.year === 0 || BI.checkDateVoid(newObj.year, newObj.quarter, 1, o.min, o.max)[0]) { |
||||
var year = newObj.year || BI.getDate().getFullYear(); |
||||
if ( |
||||
newObj.quarter === 0 || |
||||
newObj.year === 0 || |
||||
checkDateVoid(newObj.year, newObj.quarter, 1, o.min, o.max)[0] |
||||
) { |
||||
const year = newObj.year || getDate().getFullYear(); |
||||
this.selectedYear = year; |
||||
this.selectedQuarter = ""; |
||||
this.yearPicker.setValue(year); |
||||
this.quarter.setValue(); |
||||
} else { |
||||
this.selectedYear = BI.parseInt(newObj.year); |
||||
this.selectedQuarter = BI.parseInt(newObj.quarter); |
||||
this.selectedYear = parseInt(newObj.year); |
||||
this.selectedQuarter = parseInt(newObj.quarter); |
||||
this.yearPicker.setValue(this.selectedYear); |
||||
this.quarter.setValue(this.selectedQuarter); |
||||
} |
||||
this._checkQuarterStatus(this.selectedYear); |
||||
} |
||||
}); |
||||
BI.StaticYearQuarterCard.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.shortcut("bi.static_year_quarter_card", BI.StaticYearQuarterCard); |
||||
} |
||||
|
@ -0,0 +1,6 @@
|
||||
export { DynamicYearQuarterCard } from "./card.dynamic.yearquarter"; |
||||
export { StaticYearQuarterCard } from "./card.static.yearquarter"; |
||||
export { DynamicYearQuarterCombo } from "./combo.yearquarter"; |
||||
export { DynamicYearQuarterPopup } from "./popup.yearquarter"; |
||||
export { DynamicYearQuarterTrigger } from "./trigger.yearquarter"; |
||||
|
@ -1,235 +1,328 @@
|
||||
BI.DynamicYearQuarterPopup = BI.inherit(BI.Widget, { |
||||
constants: { |
||||
tabHeight: 40, |
||||
buttonHeight: 24 |
||||
}, |
||||
import { |
||||
shortcut, |
||||
Widget, |
||||
toPix, |
||||
i18nText, |
||||
VerticalLayout, |
||||
GridLayout, |
||||
print, |
||||
getDate, |
||||
checkDateVoid, |
||||
createItems, |
||||
getQuarter |
||||
} from "@/core"; |
||||
import { DynamicYearQuarterCombo } from "./combo.yearquarter"; |
||||
import { TextButton, Tab } from "@/base"; |
||||
import { DynamicDateCombo, DynamicDatePopup, DynamicDateHelper } from "../dynamicdate"; |
||||
// TODO:需要等待year完成才能将BI.DynamicYearCard替换
|
||||
// import { DynamicYearCard } from "../year/card.dynamic.year";
|
||||
import { LinearSegment } from "@/case"; |
||||
import { DynamicYearQuarterCard } from "./card.dynamic.yearquarter"; |
||||
import { StaticYearQuarterCard } from "./card.static.yearquarter"; |
||||
|
||||
props: { |
||||
@shortcut() |
||||
export class DynamicYearQuarterPopup extends Widget { |
||||
static xtype = "bi.dynamic_year_quarter_popup"; |
||||
|
||||
constants = { tabHeight: 40, buttonHeight: 24 }; |
||||
props = { |
||||
baseCls: "bi-year-quarter-popup", |
||||
behaviors: {}, |
||||
min: "1900-01-01", // 最小日期
|
||||
max: "2099-12-31", // 最大日期,
|
||||
min: "1900-01-01", |
||||
max: "2099-12-31", |
||||
width: 180, |
||||
supportDynamic: true, |
||||
}, |
||||
}; |
||||
|
||||
static BUTTON_CLEAR_EVENT_CHANGE = "BUTTON_CLEAR_EVENT_CHANGE"; |
||||
static BUTTON_lABEL_EVENT_CHANGE = "BUTTON_lABEL_EVENT_CHANGE"; |
||||
static BUTTON_OK_EVENT_CHANGE = "BUTTON_OK_EVENT_CHANGE"; |
||||
static EVENT_CHANGE = "EVENT_CHANGE"; |
||||
|
||||
render: function () { |
||||
var self = this, opts = this.options, c = this.constants; |
||||
this.storeValue = {type: BI.DynamicYearQuarterCombo.Static}; |
||||
render() { |
||||
this.storeValue = { type: DynamicYearQuarterCombo.Static }; |
||||
|
||||
return { |
||||
type: "bi.vertical", |
||||
items: [{ |
||||
el: this._getTabJson() |
||||
}, { |
||||
el: { |
||||
type: "bi.grid", |
||||
items: [[{ |
||||
type: "bi.text_button", |
||||
cls: "bi-split-top bi-high-light", |
||||
shadow: true, |
||||
textHeight: BI.toPix(BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, 1), |
||||
text: BI.i18nText("BI-Basic_Clear"), |
||||
listeners: [{ |
||||
eventName: BI.TextButton.EVENT_CHANGE, |
||||
action: function () { |
||||
self.fireEvent(BI.DynamicYearQuarterPopup.BUTTON_CLEAR_EVENT_CHANGE); |
||||
} |
||||
}] |
||||
}, { |
||||
type: "bi.text_button", |
||||
cls: "bi-split-left bi-split-right bi-high-light bi-split-top", |
||||
textHeight: BI.toPix(BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, 1), |
||||
shadow: true, |
||||
text: BI.i18nText("BI-Basic_Current_Quarter"), |
||||
disabled: this._checkTodayValid(), |
||||
ref: function () { |
||||
self.textButton = this; |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.TextButton.EVENT_CHANGE, |
||||
action: function () { |
||||
self.fireEvent(BI.DynamicYearQuarterPopup.BUTTON_lABEL_EVENT_CHANGE); |
||||
} |
||||
}] |
||||
}, { |
||||
type: "bi.text_button", |
||||
cls: "bi-split-top bi-high-light", |
||||
shadow: true, |
||||
textHeight: BI.toPix(BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, 1), |
||||
text: BI.i18nText("BI-Basic_OK"), |
||||
listeners: [{ |
||||
eventName: BI.TextButton.EVENT_CHANGE, |
||||
action: function () { |
||||
var type = self.dateTab.getSelect(); |
||||
if (type === BI.DynamicDateCombo.Dynamic) { |
||||
self.dynamicPane.checkValidation(true) && self.fireEvent(BI.DynamicDatePopup.BUTTON_OK_EVENT_CHANGE); |
||||
} else { |
||||
self.fireEvent(BI.DynamicYearQuarterPopup.BUTTON_OK_EVENT_CHANGE); |
||||
} |
||||
} |
||||
}] |
||||
}]], |
||||
height: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT |
||||
type: VerticalLayout.xtype, |
||||
items: [ |
||||
{ |
||||
el: this._getTabJson(), |
||||
}, |
||||
}] |
||||
{ |
||||
el: { |
||||
type: GridLayout.xtype, |
||||
items: [ |
||||
[ |
||||
{ |
||||
type: TextButton.xtype, |
||||
cls: "bi-split-top bi-high-light", |
||||
shadow: true, |
||||
textHeight: toPix( |
||||
BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, |
||||
1 |
||||
), |
||||
text: i18nText("BI-Basic_Clear"), |
||||
listeners: [ |
||||
{ |
||||
eventName: TextButton.EVENT_CHANGE, |
||||
action: () => { |
||||
this.fireEvent( |
||||
DynamicYearQuarterPopup.BUTTON_CLEAR_EVENT_CHANGE |
||||
); |
||||
}, |
||||
} |
||||
], |
||||
}, |
||||
{ |
||||
type: TextButton.xtype, |
||||
cls: "bi-split-left bi-split-right bi-high-light bi-split-top", |
||||
textHeight: toPix( |
||||
BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, |
||||
1 |
||||
), |
||||
shadow: true, |
||||
text: i18nText("BI-Basic_Current_Quarter"), |
||||
disabled: this._checkTodayValid(), |
||||
ref: _ref => { |
||||
this.textButton = _ref; |
||||
}, |
||||
listeners: [ |
||||
{ |
||||
eventName: TextButton.EVENT_CHANGE, |
||||
action: () => { |
||||
this.fireEvent( |
||||
DynamicYearQuarterPopup.BUTTON_lABEL_EVENT_CHANGE |
||||
); |
||||
}, |
||||
} |
||||
], |
||||
}, |
||||
{ |
||||
type: TextButton.xtype, |
||||
cls: "bi-split-top bi-high-light", |
||||
shadow: true, |
||||
textHeight: toPix( |
||||
BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, |
||||
1 |
||||
), |
||||
text: i18nText("BI-Basic_OK"), |
||||
listeners: [ |
||||
{ |
||||
eventName: TextButton.EVENT_CHANGE, |
||||
action: () => { |
||||
const type = |
||||
this.dateTab.getSelect(); |
||||
if ( |
||||
type === |
||||
DynamicDateCombo.Dynamic |
||||
) { |
||||
this.dynamicPane.checkValidation( |
||||
true |
||||
) && |
||||
this.fireEvent( |
||||
DynamicDatePopup.BUTTON_OK_EVENT_CHANGE |
||||
); |
||||
} else { |
||||
this.fireEvent(DynamicYearQuarterPopup |
||||
.BUTTON_OK_EVENT_CHANGE |
||||
); |
||||
} |
||||
}, |
||||
} |
||||
], |
||||
} |
||||
] |
||||
], |
||||
height: BI.SIZE_CONSANTS.TOOL_BAR_HEIGHT, |
||||
}, |
||||
} |
||||
], |
||||
}; |
||||
}, |
||||
} |
||||
|
||||
_setInnerValue: function () { |
||||
if (this.dateTab.getSelect() === BI.DynamicYearQuarterCombo.Static) { |
||||
this.textButton.setValue(BI.i18nText("BI-Basic_Current_Quarter")); |
||||
_setInnerValue() { |
||||
if (this.dateTab.getSelect() === DynamicYearQuarterCombo.Static) { |
||||
this.textButton.setValue(i18nText("BI-Basic_Current_Quarter")); |
||||
this.textButton.setEnable(!this._checkTodayValid()); |
||||
} else { |
||||
var date = BI.DynamicDateHelper.getCalculation(this.dynamicPane.getInputValue()); |
||||
date = BI.print(date, "%Y-%Q"); |
||||
let date = DynamicDateHelper.getCalculation( |
||||
this.dynamicPane.getInputValue() |
||||
); |
||||
date = print(date, "%Y-%Q"); |
||||
this.textButton.setValue(date); |
||||
this.textButton.setEnable(false); |
||||
} |
||||
}, |
||||
} |
||||
|
||||
_checkTodayValid: function () { |
||||
var o = this.options; |
||||
var today = BI.getDate(); |
||||
return !!BI.checkDateVoid(today.getFullYear(), today.getMonth() + 1, today.getDate(), o.min, o.max)[0]; |
||||
}, |
||||
_checkTodayValid() { |
||||
const o = this.options; |
||||
const today = getDate(); |
||||
|
||||
return !!checkDateVoid( |
||||
today.getFullYear(), |
||||
today.getMonth() + 1, |
||||
today.getDate(), |
||||
o.min, |
||||
o.max |
||||
)[0]; |
||||
} |
||||
|
||||
_getTabJson: function () { |
||||
var self = this, o = this.options; |
||||
_getTabJson() { |
||||
const o = this.options; |
||||
|
||||
return { |
||||
type: "bi.tab", |
||||
type: Tab.xtype, |
||||
logic: { |
||||
dynamic: true |
||||
dynamic: true, |
||||
}, |
||||
ref: function () { |
||||
self.dateTab = this; |
||||
ref: _ref => { |
||||
this.dateTab = _ref; |
||||
}, |
||||
tab: { |
||||
type: "bi.linear_segment", |
||||
type: LinearSegment.xtype, |
||||
cls: "bi-split-bottom", |
||||
invisible: !o.supportDynamic, |
||||
height: this.constants.tabHeight, |
||||
items: BI.createItems([{ |
||||
text: BI.i18nText("BI-Basic_Year_Quarter"), |
||||
value: BI.DynamicYearQuarterCombo.Static |
||||
}, { |
||||
text: BI.i18nText("BI-Basic_Dynamic_Title"), |
||||
value: BI.DynamicYearQuarterCombo.Dynamic |
||||
}], { |
||||
textAlign: "center" |
||||
}) |
||||
items: createItems( |
||||
[ |
||||
{ |
||||
text: i18nText("BI-Basic_Year_Quarter"), |
||||
value: DynamicYearQuarterCombo.Static, |
||||
}, |
||||
{ |
||||
text: i18nText("BI-Basic_Dynamic_Title"), |
||||
value: DynamicYearQuarterCombo.Dynamic, |
||||
} |
||||
], |
||||
{ |
||||
textAlign: "center", |
||||
} |
||||
), |
||||
}, |
||||
cardCreator: function (v) { |
||||
cardCreator: v => { |
||||
switch (v) { |
||||
case BI.DynamicYearQuarterCombo.Dynamic: |
||||
return { |
||||
type: "bi.dynamic_year_quarter_card", |
||||
cls: "dynamic-year-quarter-pane", |
||||
min: self.options.min, |
||||
max: self.options.max, |
||||
listeners: [{ |
||||
case DynamicYearQuarterCombo.Dynamic: |
||||
return { |
||||
type: DynamicYearQuarterCard.xtype, |
||||
cls: "dynamic-year-quarter-pane", |
||||
min: this.options.min, |
||||
max: this.options.max, |
||||
listeners: [ |
||||
{ |
||||
eventName: "EVENT_CHANGE", |
||||
action: function () { |
||||
self._setInnerValue(self.year, v); |
||||
} |
||||
}], |
||||
ref: function () { |
||||
self.dynamicPane = this; |
||||
action: () => { |
||||
this._setInnerValue(this.year, v); |
||||
}, |
||||
} |
||||
}; |
||||
case BI.DynamicYearQuarterCombo.Static: |
||||
default: |
||||
return { |
||||
type: "bi.static_year_quarter_card", |
||||
behaviors: o.behaviors, |
||||
min: self.options.min, |
||||
max: self.options.max, |
||||
listeners: [{ |
||||
], |
||||
ref: _ref => { |
||||
this.dynamicPane = _ref; |
||||
}, |
||||
}; |
||||
case DynamicYearQuarterCombo.Static: |
||||
default: |
||||
return { |
||||
type: StaticYearQuarterCard.xtype, |
||||
behaviors: o.behaviors, |
||||
min: this.options.min, |
||||
max: this.options.max, |
||||
listeners: [ |
||||
{ |
||||
eventName: BI.DynamicYearCard.EVENT_CHANGE, |
||||
action: function () { |
||||
self.fireEvent(BI.DynamicYearQuarterPopup.EVENT_CHANGE); |
||||
} |
||||
}], |
||||
ref: function () { |
||||
self.year = this; |
||||
action: () => { |
||||
this.fireEvent( |
||||
DynamicYearQuarterPopup.EVENT_CHANGE |
||||
); |
||||
}, |
||||
} |
||||
}; |
||||
], |
||||
ref: _ref => { |
||||
this.year = _ref; |
||||
}, |
||||
}; |
||||
} |
||||
}, |
||||
listeners: [{ |
||||
eventName: BI.Tab.EVENT_CHANGE, |
||||
action: function () { |
||||
var v = self.dateTab.getSelect(); |
||||
switch (v) { |
||||
case BI.DynamicYearQuarterCombo.Static: |
||||
var date = BI.DynamicDateHelper.getCalculation(self.dynamicPane.getValue()); |
||||
self.year.setValue({year: date.getFullYear(), quarter: BI.getQuarter(date)}); |
||||
self._setInnerValue(); |
||||
listeners: [ |
||||
{ |
||||
eventName: Tab.EVENT_CHANGE, |
||||
action: () => { |
||||
const v = this.dateTab.getSelect(); |
||||
let date; |
||||
switch (v) { |
||||
case DynamicYearQuarterCombo.Static: |
||||
date = DynamicDateHelper.getCalculation( |
||||
this.dynamicPane.getValue() |
||||
); |
||||
this.year.setValue({ |
||||
year: date.getFullYear(), |
||||
quarter: getQuarter(date), |
||||
}); |
||||
this._setInnerValue(); |
||||
break; |
||||
case BI.DynamicYearQuarterCombo.Dynamic: |
||||
case DynamicYearQuarterCombo.Dynamic: |
||||
default: |
||||
if(self.storeValue && self.storeValue.type === BI.DynamicYearQuarterCombo.Dynamic) { |
||||
self.dynamicPane.setValue(self.storeValue.value); |
||||
}else{ |
||||
self.dynamicPane.setValue({ |
||||
year: 0 |
||||
if ( |
||||
this.storeValue && |
||||
this.storeValue.type === |
||||
DynamicYearQuarterCombo.Dynamic |
||||
) { |
||||
this.dynamicPane.setValue( |
||||
this.storeValue.value |
||||
); |
||||
} else { |
||||
this.dynamicPane.setValue({ |
||||
year: 0, |
||||
}); |
||||
} |
||||
self._setInnerValue(); |
||||
this._setInnerValue(); |
||||
break; |
||||
} |
||||
} |
||||
}, |
||||
} |
||||
}] |
||||
], |
||||
}; |
||||
}, |
||||
} |
||||
|
||||
setMinDate: function (minDate) { |
||||
setMinDate(minDate) { |
||||
if (this.options.min !== minDate) { |
||||
this.options.min = minDate; |
||||
this.year && this.year.setMinDate(minDate); |
||||
this.dynamicPane && this.dynamicPane.setMinDate(minDate); |
||||
} |
||||
}, |
||||
} |
||||
|
||||
setMaxDate: function (maxDate) { |
||||
setMaxDate(maxDate) { |
||||
if (this.options.max !== maxDate) { |
||||
this.options.max = maxDate; |
||||
this.year && this.year.setMaxDate(maxDate); |
||||
this.dynamicPane && this.dynamicPane.setMaxDate(maxDate); |
||||
} |
||||
}, |
||||
} |
||||
|
||||
setValue: function (v) { |
||||
setValue(v) { |
||||
this.storeValue = v; |
||||
var self = this; |
||||
var type, value; |
||||
v = v || {}; |
||||
type = v.type || BI.DynamicDateCombo.Static; |
||||
value = v.value || v; |
||||
const type = v.type || DynamicDateCombo.Static; |
||||
const value = v.value || v; |
||||
this.dateTab.setSelect(type); |
||||
switch (type) { |
||||
case BI.DynamicDateCombo.Dynamic: |
||||
this.dynamicPane.setValue(value); |
||||
self._setInnerValue(); |
||||
break; |
||||
case BI.DynamicDateCombo.Static: |
||||
default: |
||||
this.year.setValue(value); |
||||
this.textButton.setValue(BI.i18nText("BI-Basic_Current_Quarter")); |
||||
this.textButton.setEnable(!this._checkTodayValid()); |
||||
break; |
||||
case DynamicDateCombo.Dynamic: |
||||
this.dynamicPane.setValue(value); |
||||
this._setInnerValue(); |
||||
break; |
||||
case DynamicDateCombo.Static: |
||||
default: |
||||
this.year.setValue(value); |
||||
this.textButton.setValue(i18nText("BI-Basic_Current_Quarter")); |
||||
this.textButton.setEnable(!this._checkTodayValid()); |
||||
break; |
||||
} |
||||
}, |
||||
} |
||||
|
||||
getValue: function () { |
||||
getValue() { |
||||
return { |
||||
type: this.dateTab.getSelect(), |
||||
value: this.dateTab.getValue() |
||||
value: this.dateTab.getValue(), |
||||
}; |
||||
} |
||||
|
||||
}); |
||||
BI.DynamicYearQuarterPopup.BUTTON_CLEAR_EVENT_CHANGE = "BUTTON_CLEAR_EVENT_CHANGE"; |
||||
BI.DynamicYearQuarterPopup.BUTTON_lABEL_EVENT_CHANGE = "BUTTON_lABEL_EVENT_CHANGE"; |
||||
BI.DynamicYearQuarterPopup.BUTTON_OK_EVENT_CHANGE = "BUTTON_OK_EVENT_CHANGE"; |
||||
BI.DynamicYearQuarterPopup.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.shortcut("bi.dynamic_year_quarter_popup", BI.DynamicYearQuarterPopup); |
||||
} |
||||
|
@ -1,277 +1,374 @@
|
||||
BI.DynamicYearQuarterTrigger = BI.inherit(BI.Trigger, { |
||||
_const: { |
||||
hgap: 4, |
||||
vgap: 2, |
||||
iconWidth: 24 |
||||
}, |
||||
import { |
||||
shortcut, |
||||
i18nText, |
||||
createWidget, |
||||
HTapeLayout, |
||||
CenterLayout, |
||||
HorizontalFillLayout, |
||||
isEmptyString, |
||||
parseDateTime, |
||||
isPositiveInteger, |
||||
checkDateVoid, |
||||
isNotEmptyString, |
||||
isNotNull, |
||||
print, |
||||
checkDateLegal, |
||||
isNull, |
||||
parseInt, |
||||
getDate, |
||||
getQuarter |
||||
} from "@/core"; |
||||
import { Trigger, TextButton } from "@/base"; |
||||
import { TriggerIconButton, SignEditor } from "@/case"; |
||||
import { DynamicDateHelper } from "../dynamicdate"; |
||||
// TODO:需要等待yearmonth完成才能将BI.DynamicYearMonthTrigger替换
|
||||
// import { DynamicYearMonthTrigger } from "../yearmonth/trigger.yearmonth";
|
||||
import { DynamicYearQuarterCombo } from "./combo.yearquarter"; |
||||
|
||||
props: () => ({ |
||||
extraCls: "bi-year-quarter-trigger", |
||||
min: "1900-01-01", // 最小日期
|
||||
max: "2099-12-31", // 最大日期
|
||||
height: 24, |
||||
watermark: { |
||||
year: BI.i18nText("BI-Basic_Unrestricted"), |
||||
quarter: BI.i18nText("BI-Basic_Unrestricted"), |
||||
}, |
||||
}), |
||||
@shortcut() |
||||
export class DynamicYearQuarterTrigger extends Trigger { |
||||
static xtype = "bi.dynamic_year_quarter_trigger"; |
||||
|
||||
_init: function () { |
||||
BI.DynamicYearQuarterTrigger.superclass._init.apply(this, arguments); |
||||
var o = this.options; |
||||
_const = { hgap: 4, vgap: 2, iconWidth: 24 }; |
||||
|
||||
static EVENT_FOCUS = "EVENT_FOCUS"; |
||||
static EVENT_ERROR = "EVENT_ERROR"; |
||||
static EVENT_START = "EVENT_START"; |
||||
static EVENT_CONFIRM = "EVENT_CONFIRM"; |
||||
static EVENT_STOP = "EVENT_STOP"; |
||||
static EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; |
||||
static EVENT_VALID = "EVENT_VALID"; |
||||
|
||||
props() { |
||||
return { |
||||
extraCls: "bi-year-quarter-trigger", |
||||
min: "1900-01-01", // 最小日期
|
||||
max: "2099-12-31", // 最大日期
|
||||
height: 24, |
||||
watermark: { |
||||
year: i18nText("BI-Basic_Unrestricted"), |
||||
quarter: i18nText("BI-Basic_Unrestricted"), |
||||
}, |
||||
}; |
||||
} |
||||
|
||||
_init() { |
||||
super._init(...arguments); |
||||
const o = this.options; |
||||
this.yearEditor = this._createEditor(true); |
||||
this.quarterEditor = this._createEditor(false); |
||||
|
||||
// 暂时的解决方法
|
||||
var height = o.height + 2; |
||||
// const height = o.height + 2;
|
||||
|
||||
BI.createWidget({ |
||||
createWidget({ |
||||
element: this, |
||||
type: "bi.htape", |
||||
items: [{ |
||||
type: "bi.center", |
||||
items: [{ |
||||
type: "bi.horizontal_fill", |
||||
columnSize: ["fill", ""], |
||||
items: [this.yearEditor, { |
||||
el: { |
||||
type: "bi.text_button", |
||||
text: BI.i18nText("BI-Multi_Date_Year"), |
||||
}, |
||||
}] |
||||
}, { |
||||
type: "bi.horizontal_fill", |
||||
columnSize: ["fill", ""], |
||||
items: [this.quarterEditor, { |
||||
el: { |
||||
type: "bi.text_button", |
||||
text: BI.i18nText("BI-Multi_Date_Quarter"), |
||||
type: HTapeLayout.xtype, |
||||
items: [ |
||||
{ |
||||
type: CenterLayout.xtype, |
||||
items: [ |
||||
{ |
||||
type: HorizontalFillLayout.xtype, |
||||
columnSize: ["fill", ""], |
||||
items: [ |
||||
this.yearEditor, |
||||
{ |
||||
el: { |
||||
type: TextButton.xtype, |
||||
text: i18nText("BI-Multi_Date_Year"), |
||||
}, |
||||
} |
||||
], |
||||
}, |
||||
}] |
||||
}] |
||||
}, { |
||||
el: { |
||||
type: "bi.trigger_icon_button", |
||||
width: this._const.iconWidth, |
||||
{ |
||||
type: HorizontalFillLayout.xtype, |
||||
columnSize: ["fill", ""], |
||||
items: [ |
||||
this.quarterEditor, |
||||
{ |
||||
el: { |
||||
type: TextButton.xtype, |
||||
text: i18nText("BI-Multi_Date_Quarter"), |
||||
}, |
||||
} |
||||
], |
||||
} |
||||
], |
||||
}, |
||||
width: this._const.iconWidth, |
||||
}] |
||||
{ |
||||
el: { |
||||
type: TriggerIconButton.xtype, |
||||
width: this._const.iconWidth, |
||||
}, |
||||
width: this._const.iconWidth, |
||||
} |
||||
], |
||||
}); |
||||
this.setValue(o.value); |
||||
}, |
||||
} |
||||
|
||||
_createEditor: function (isYear) { |
||||
var self = this, o = this.options, c = this._const; |
||||
var editor = BI.createWidget({ |
||||
type: "bi.sign_editor", |
||||
_createEditor(isYear) { |
||||
const o = this.options, |
||||
c = this._const; |
||||
const editor = createWidget({ |
||||
type: SignEditor.xtype, |
||||
simple: o.simple, |
||||
height: o.height, |
||||
validationChecker: function (v) { |
||||
if(isYear) { |
||||
var month = self.quarterEditor.getValue(); |
||||
if(BI.isEmptyString(month)) { |
||||
month = parseInt(v, 10) === BI.parseDateTime(o.min, "%Y-%X-%d").getFullYear() ? BI.parseDateTime(o.min, "%Y-%X-%d").getMonth() + 1 : 1; |
||||
validationChecker: v => { |
||||
if (isYear) { |
||||
let month = this.quarterEditor.getValue(); |
||||
if (isEmptyString(month)) { |
||||
month = |
||||
parseInt(v, 10) === |
||||
parseDateTime(o.min, "%Y-%X-%d").getFullYear() |
||||
? parseDateTime(o.min, "%Y-%X-%d").getMonth() + |
||||
1 |
||||
: 1; |
||||
} else { |
||||
month = (parseInt(month, 10) - 1) * 3 + 1; |
||||
} |
||||
return v === "" || (BI.isPositiveInteger(v) && !BI.checkDateVoid(v, month, 1, o.min, o.max)[0]); |
||||
|
||||
return ( |
||||
v === "" || |
||||
(isPositiveInteger(v) && |
||||
!checkDateVoid(v, month, 1, o.min, o.max)[0]) |
||||
); |
||||
} |
||||
var year = self.yearEditor.getValue(); |
||||
const year = this.yearEditor.getValue(); |
||||
|
||||
return v === "" || ((BI.isPositiveInteger(v) && v >= 1 && v <= 4) && (BI.isEmptyString(year) ? true : !BI.checkDateVoid(self.yearEditor.getValue(), (v - 1) * 3 + 1, 1, o.min, o.max)[0])); |
||||
}, |
||||
quitChecker: function () { |
||||
return false; |
||||
return ( |
||||
v === "" || |
||||
(isPositiveInteger(v) && |
||||
v >= 1 && |
||||
v <= 4 && |
||||
(isEmptyString(year) |
||||
? true |
||||
: !checkDateVoid( |
||||
this.yearEditor.getValue(), |
||||
(v - 1) * 3 + 1, |
||||
1, |
||||
o.min, |
||||
o.max |
||||
)[0])) |
||||
); |
||||
}, |
||||
errorText: function (v) { |
||||
var year = isYear ? v : self.yearEditor.getValue(); |
||||
var quarter = isYear ? self.quarterEditor.getValue() : v; |
||||
if (!BI.isPositiveInteger(year) || !BI.isPositiveInteger(quarter) || quarter > 4) { |
||||
return BI.i18nText("BI-Year_Trigger_Invalid_Text"); |
||||
quitChecker: () => false, |
||||
errorText: v => { |
||||
const year = isYear ? v : this.yearEditor.getValue(); |
||||
const quarter = isYear ? this.quarterEditor.getValue() : v; |
||||
if ( |
||||
!isPositiveInteger(year) || |
||||
!isPositiveInteger(quarter) || |
||||
quarter > 4 |
||||
) { |
||||
return i18nText("BI-Year_Trigger_Invalid_Text"); |
||||
} |
||||
|
||||
var start = BI.parseDateTime(o.min, "%Y-%X-%d"); |
||||
var end = BI.parseDateTime(o.max, "%Y-%X-%d"); |
||||
const start = parseDateTime(o.min, "%Y-%X-%d"); |
||||
const end = parseDateTime(o.max, "%Y-%X-%d"); |
||||
|
||||
return BI.i18nText("BI-Basic_Year_Quarter_Range_Error", |
||||
return i18nText( |
||||
"BI-Basic_Year_Quarter_Range_Error", |
||||
start.getFullYear(), |
||||
BI.getQuarter(start), |
||||
getQuarter(start), |
||||
end.getFullYear(), |
||||
BI.getQuarter(end) |
||||
getQuarter(end) |
||||
); |
||||
}, |
||||
watermark: isYear ? o.watermark?.year : o.watermark?.quarter, |
||||
hgap: c.hgap, |
||||
vgap: c.vgap, |
||||
allowBlank: true |
||||
allowBlank: true, |
||||
}); |
||||
editor.on(BI.SignEditor.EVENT_KEY_DOWN, function () { |
||||
self.fireEvent(BI.DynamicYearQuarterTrigger.EVENT_KEY_DOWN); |
||||
editor.on(SignEditor.EVENT_KEY_DOWN, () => { |
||||
this.fireEvent(DynamicYearQuarterTrigger.EVENT_KEY_DOWN); |
||||
}); |
||||
editor.on(BI.SignEditor.EVENT_FOCUS, function () { |
||||
self.fireEvent(BI.DynamicYearQuarterTrigger.EVENT_FOCUS); |
||||
editor.on(SignEditor.EVENT_FOCUS, () => { |
||||
this.fireEvent(DynamicYearQuarterTrigger.EVENT_FOCUS); |
||||
}); |
||||
editor.on(BI.SignEditor.EVENT_STOP, function () { |
||||
self.fireEvent(BI.DynamicYearQuarterTrigger.EVENT_STOP); |
||||
editor.on(SignEditor.EVENT_STOP, () => { |
||||
this.fireEvent(DynamicYearQuarterTrigger.EVENT_STOP); |
||||
}); |
||||
editor.on(BI.SignEditor.EVENT_CONFIRM, function () { |
||||
self._doEditorConfirm(editor); |
||||
self.fireEvent(BI.DynamicYearQuarterTrigger.EVENT_CONFIRM); |
||||
editor.on(SignEditor.EVENT_CONFIRM, () => { |
||||
this._doEditorConfirm(editor); |
||||
this.fireEvent(DynamicYearQuarterTrigger.EVENT_CONFIRM); |
||||
}); |
||||
editor.on(BI.SignEditor.EVENT_SPACE, function () { |
||||
editor.on(SignEditor.EVENT_SPACE, () => { |
||||
if (editor.isValid()) { |
||||
editor.blur(); |
||||
} |
||||
}); |
||||
editor.on(BI.SignEditor.EVENT_START, function () { |
||||
self.fireEvent(BI.DynamicYearQuarterTrigger.EVENT_START); |
||||
editor.on(SignEditor.EVENT_START, () => { |
||||
this.fireEvent(DynamicYearQuarterTrigger.EVENT_START); |
||||
}); |
||||
editor.on(BI.SignEditor.EVENT_ERROR, function () { |
||||
self.fireEvent(BI.DynamicYearQuarterTrigger.EVENT_ERROR); |
||||
editor.on(SignEditor.EVENT_ERROR, () => { |
||||
this.fireEvent(DynamicYearQuarterTrigger.EVENT_ERROR); |
||||
}); |
||||
editor.on(BI.SignEditor.EVENT_VALID, function () { |
||||
var year = self.yearEditor.getValue(); |
||||
var quarter = self.quarterEditor.getValue(); |
||||
if(BI.isNotEmptyString(year) && BI.isNotEmptyString(quarter)) { |
||||
if(BI.isPositiveInteger(year) && quarter >= 1 && quarter <= 4 && !BI.checkDateVoid(year, (quarter - 1) * 3 + 1, 1, o.min, o.max)[0]) { |
||||
self.fireEvent(BI.DynamicYearMonthTrigger.EVENT_VALID); |
||||
editor.on(SignEditor.EVENT_VALID, () => { |
||||
const year = this.yearEditor.getValue(); |
||||
const quarter = this.quarterEditor.getValue(); |
||||
if (isNotEmptyString(year) && isNotEmptyString(quarter)) { |
||||
if ( |
||||
isPositiveInteger(year) && |
||||
quarter >= 1 && |
||||
quarter <= 4 && |
||||
!checkDateVoid( |
||||
year, |
||||
(quarter - 1) * 3 + 1, |
||||
1, |
||||
o.min, |
||||
o.max |
||||
)[0] |
||||
) { |
||||
this.fireEvent(BI.DynamicYearMonthTrigger.EVENT_VALID); |
||||
} |
||||
} |
||||
}); |
||||
editor.on(BI.SignEditor.EVENT_CHANGE, function () { |
||||
if(isYear) { |
||||
self._autoSwitch(editor); |
||||
editor.on(SignEditor.EVENT_CHANGE, () => { |
||||
if (isYear) { |
||||
this._autoSwitch(editor); |
||||
} |
||||
}); |
||||
|
||||
return editor; |
||||
}, |
||||
} |
||||
|
||||
_doEditorConfirm: function (editor) { |
||||
var value = editor.getValue(); |
||||
if (BI.isNotNull(value)) { |
||||
_doEditorConfirm(editor) { |
||||
const value = editor.getValue(); |
||||
if (isNotNull(value)) { |
||||
editor.setValue(value); |
||||
} |
||||
var quarterValue = this.quarterEditor.getValue(); |
||||
const quarterValue = this.quarterEditor.getValue(); |
||||
this.storeValue = { |
||||
type: BI.DynamicYearQuarterCombo.Static, |
||||
type: DynamicYearQuarterCombo.Static, |
||||
value: { |
||||
year: this.yearEditor.getValue(), |
||||
quarter: BI.isEmptyString(this.quarterEditor.getValue()) ? "" : quarterValue |
||||
} |
||||
quarter: isEmptyString(this.quarterEditor.getValue()) |
||||
? "" |
||||
: quarterValue, |
||||
}, |
||||
}; |
||||
this.setTitle(this._getStaticTitle(this.storeValue.value)); |
||||
}, |
||||
} |
||||
|
||||
_yearCheck: function (v) { |
||||
var date = BI.print(BI.parseDateTime(v, "%Y-%X-%d"), "%Y-%X-%d"); |
||||
return BI.print(BI.parseDateTime(v, "%Y"), "%Y") === v && date >= this.options.min && date <= this.options.max; |
||||
}, |
||||
_yearCheck(v) { |
||||
const date = print(parseDateTime(v, "%Y-%X-%d"), "%Y-%X-%d"); |
||||
|
||||
return ( |
||||
print(parseDateTime(v, "%Y"), "%Y") === v && |
||||
date >= this.options.min && |
||||
date <= this.options.max |
||||
); |
||||
} |
||||
|
||||
_autoSwitch: function (editor) { |
||||
var v = editor.getValue(); |
||||
if (BI.isNotEmptyString(v) && BI.checkDateLegal(v)) { |
||||
_autoSwitch(editor) { |
||||
const v = editor.getValue(); |
||||
if (isNotEmptyString(v) && checkDateLegal(v)) { |
||||
if (v.length === 4 && this._yearCheck(v)) { |
||||
this._doEditorConfirm(editor); |
||||
this.fireEvent(BI.DynamicYearQuarterTrigger.EVENT_CONFIRM); |
||||
this.fireEvent(DynamicYearQuarterTrigger.EVENT_CONFIRM); |
||||
this.quarterEditor.focus(); |
||||
} |
||||
} |
||||
}, |
||||
} |
||||
|
||||
_getStaticTitle: function (value) { |
||||
_getStaticTitle(value) { |
||||
value = value || {}; |
||||
var hasYear = !(BI.isNull(value.year) || BI.isEmptyString(value.year)); |
||||
var hasMonth = !(BI.isNull(value.quarter) || BI.isEmptyString(value.quarter)); |
||||
const hasYear = !(isNull(value.year) || isEmptyString(value.year)); |
||||
const hasMonth = !(isNull(value.quarter) || isEmptyString(value.quarter)); |
||||
switch ((hasYear << 1) | hasMonth) { |
||||
// !hasYear && !hasMonth
|
||||
case 0: |
||||
return ""; |
||||
// !hasYear && !hasMonth
|
||||
case 0: |
||||
return ""; |
||||
// !hasYear && hasMonth
|
||||
case 1: |
||||
return value.quarter; |
||||
case 1: |
||||
return value.quarter; |
||||
// hasYear && !hasMonth
|
||||
case 2: |
||||
return value.year; |
||||
case 2: |
||||
return value.year; |
||||
// hasYear && hasMonth
|
||||
case 3: |
||||
default: |
||||
return value.year + "-" + value.quarter; |
||||
case 3: |
||||
default: |
||||
return `${value.year}-${value.quarter}`; |
||||
} |
||||
}, |
||||
} |
||||
|
||||
_getText: function (obj) { |
||||
var value = ""; |
||||
if(BI.isNotNull(obj.year) && BI.parseInt(obj.year) !== 0) { |
||||
value += Math.abs(obj.year) + BI.i18nText("BI-Basic_Year") + (obj.year < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); |
||||
_getText(obj) { |
||||
let value = ""; |
||||
if (isNotNull(obj.year) && parseInt(obj.year) !== 0) { |
||||
value += |
||||
Math.abs(obj.year) + |
||||
i18nText("BI-Basic_Year") + |
||||
(obj.year < 0 |
||||
? i18nText("BI-Basic_Front") |
||||
: i18nText("BI-Basic_Behind")); |
||||
} |
||||
if(BI.isNotNull(obj.quarter) && BI.parseInt(obj.quarter) !== 0) { |
||||
value += Math.abs(obj.quarter) + BI.i18nText("BI-Basic_Single_Quarter") + (obj.quarter < 0 ? BI.i18nText("BI-Basic_Front") : BI.i18nText("BI-Basic_Behind")); |
||||
if (isNotNull(obj.quarter) && parseInt(obj.quarter) !== 0) { |
||||
value += |
||||
Math.abs(obj.quarter) + |
||||
i18nText("BI-Basic_Single_Quarter") + |
||||
(obj.quarter < 0 |
||||
? i18nText("BI-Basic_Front") |
||||
: i18nText("BI-Basic_Behind")); |
||||
} |
||||
|
||||
return value; |
||||
}, |
||||
} |
||||
|
||||
_setInnerValue: function (date, text) { |
||||
var dateStr = BI.print(date, "%Y-%Q"); |
||||
_setInnerValue(date, text) { |
||||
const dateStr = print(date, "%Y-%Q"); |
||||
this.yearEditor.setValue(date.getFullYear()); |
||||
this.quarterEditor.setValue(BI.getQuarter(date)); |
||||
this.setTitle(BI.isEmptyString(text) ? dateStr : (text + ":" + dateStr)); |
||||
}, |
||||
this.quarterEditor.setValue(getQuarter(date)); |
||||
this.setTitle(isEmptyString(text) ? dateStr : `${text}:${dateStr}`); |
||||
} |
||||
|
||||
setMinDate: function (minDate) { |
||||
if (BI.isNotEmptyString(this.options.min)) { |
||||
setMinDate(minDate) { |
||||
if (isNotEmptyString(this.options.min)) { |
||||
this.options.min = minDate; |
||||
} |
||||
}, |
||||
} |
||||
|
||||
setMaxDate: function (maxDate) { |
||||
if (BI.isNotEmptyString(this.options.max)) { |
||||
setMaxDate(maxDate) { |
||||
if (isNotEmptyString(this.options.max)) { |
||||
this.options.max = maxDate; |
||||
} |
||||
}, |
||||
} |
||||
|
||||
setValue: function (v) { |
||||
var type, value; |
||||
var date = BI.getDate(); |
||||
setValue(v) { |
||||
let type, value, text, quarter; |
||||
let date = getDate(); |
||||
this.storeValue = v; |
||||
if (BI.isNotNull(v)) { |
||||
type = v.type || BI.DynamicYearQuarterCombo.Static; |
||||
if (isNotNull(v)) { |
||||
type = v.type || DynamicYearQuarterCombo.Static; |
||||
value = v.value || v; |
||||
} |
||||
switch (type) { |
||||
case BI.DynamicYearQuarterCombo.Dynamic: |
||||
var text = this._getText(value); |
||||
date = BI.DynamicDateHelper.getCalculation(value); |
||||
this._setInnerValue(date, text); |
||||
break; |
||||
case BI.DynamicYearQuarterCombo.Static: |
||||
default: |
||||
value = value || {}; |
||||
var quarter = BI.isNull(value.quarter) ? null : value.quarter; |
||||
this.yearEditor.setValue(value.year); |
||||
this.quarterEditor.setValue(quarter); |
||||
this.setTitle(this._getStaticTitle(value)); |
||||
break; |
||||
case DynamicYearQuarterCombo.Dynamic: |
||||
text = this._getText(value); |
||||
date = DynamicDateHelper.getCalculation(value); |
||||
this._setInnerValue(date, text); |
||||
break; |
||||
case DynamicYearQuarterCombo.Static: |
||||
default: |
||||
value = value || {}; |
||||
quarter = isNull(value.quarter) ? null : value.quarter; |
||||
this.yearEditor.setValue(value.year); |
||||
this.quarterEditor.setValue(quarter); |
||||
this.setTitle(this._getStaticTitle(value)); |
||||
break; |
||||
} |
||||
}, |
||||
} |
||||
|
||||
getValue: function () { |
||||
getValue() { |
||||
return this.storeValue; |
||||
}, |
||||
} |
||||
|
||||
getKey: function () { |
||||
return this.yearEditor.getValue() + "-" + this.quarterEditor.getValue(); |
||||
}, |
||||
getKey() { |
||||
return `${this.yearEditor.getValue()}-${this.quarterEditor.getValue()}`; |
||||
} |
||||
|
||||
isStateValid: function () { |
||||
isStateValid() { |
||||
return this.yearEditor.isValid() && this.quarterEditor.isValid(); |
||||
} |
||||
}); |
||||
BI.DynamicYearQuarterTrigger.EVENT_FOCUS = "EVENT_FOCUS"; |
||||
BI.DynamicYearQuarterTrigger.EVENT_ERROR = "EVENT_ERROR"; |
||||
BI.DynamicYearQuarterTrigger.EVENT_START = "EVENT_START"; |
||||
BI.DynamicYearQuarterTrigger.EVENT_CONFIRM = "EVENT_CONFIRM"; |
||||
BI.DynamicYearQuarterTrigger.EVENT_STOP = "EVENT_STOP"; |
||||
BI.DynamicYearQuarterTrigger.EVENT_KEY_DOWN = "EVENT_KEY_DOWN"; |
||||
BI.DynamicYearQuarterTrigger.EVENT_VALID = "EVENT_VALID"; |
||||
BI.shortcut("bi.dynamic_year_quarter_trigger", BI.DynamicYearQuarterTrigger); |
||||
} |
||||
|
@ -1,193 +1,248 @@
|
||||
/** |
||||
* @author windy |
||||
* @version 2.0 |
||||
* Created by windy on 2021/1/25 |
||||
*/ |
||||
BI.YearQuarterInterval = BI.inherit(BI.Single, { |
||||
constants: { |
||||
import { |
||||
shortcut, |
||||
HorizontalFillLayout, |
||||
createWidget, |
||||
i18nText, |
||||
print, |
||||
parseDateTime, |
||||
checkDateVoid, |
||||
isNotNull, |
||||
checkDateLegal |
||||
} from "@/core"; |
||||
import { Single, Label, Bubbles } from "@/base"; |
||||
import { DynamicYearQuarterCombo } from "../yearquarter"; |
||||
|
||||
@shortcut() |
||||
export class YearQuarterInterval extends Single { |
||||
static xtype = "bi.year_quarter_interval"; |
||||
|
||||
constants = { |
||||
height: 24, |
||||
width: 25, |
||||
lgap: 15, |
||||
offset: -15, |
||||
timeErrorCls: "time-error" |
||||
}, |
||||
|
||||
props: { |
||||
timeErrorCls: "time-error", |
||||
}; |
||||
props = { |
||||
extraCls: "bi-year-quarter-interval", |
||||
minDate: "1900-01-01", |
||||
maxDate: "2099-12-31", |
||||
supportDynamic: true, |
||||
}, |
||||
}; |
||||
|
||||
static EVENT_VALID = "EVENT_VALID"; |
||||
static EVENT_ERROR = "EVENT_ERROR"; |
||||
static EVENT_CHANGE = "EVENT_CHANGE"; |
||||
static EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; |
||||
|
||||
render: function () { |
||||
var self = this, o = this.options; |
||||
render() { |
||||
const o = this.options; |
||||
|
||||
o.value = o.value || {}; |
||||
this.left = this._createCombo(o.value.start, o.watermark?.start); |
||||
this.right = this._createCombo(o.value.end, o.watermark?.end); |
||||
|
||||
|
||||
return { |
||||
type: "bi.horizontal_fill", |
||||
type: HorizontalFillLayout.xtype, |
||||
columnSize: ["fill", "", "fill"], |
||||
items: [{ |
||||
el: self.left |
||||
}, { |
||||
el: { |
||||
type: "bi.label", |
||||
height: o.height, |
||||
hgap: 5, |
||||
text: "-", |
||||
ref: function (_ref) { |
||||
self.label = _ref; |
||||
} |
||||
items: [ |
||||
{ |
||||
el: this.left, |
||||
}, |
||||
{ |
||||
el: { |
||||
type: Label.xtype, |
||||
height: o.height, |
||||
hgap: 5, |
||||
text: "-", |
||||
ref: _ref => { |
||||
this.label = _ref; |
||||
}, |
||||
}, |
||||
}, |
||||
{ |
||||
el: this.right, |
||||
} |
||||
}, { |
||||
el: self.right |
||||
}] |
||||
], |
||||
}; |
||||
}, |
||||
} |
||||
|
||||
_createCombo: function (v, watermark) { |
||||
var self = this, o = this.options; |
||||
var combo = BI.createWidget({ |
||||
type: "bi.dynamic_year_quarter_combo", |
||||
_createCombo(v, watermark) { |
||||
const o = this.options; |
||||
const combo = createWidget({ |
||||
type: DynamicYearQuarterCombo.xtype, |
||||
supportDynamic: o.supportDynamic, |
||||
minDate: o.minDate, |
||||
maxDate: o.maxDate, |
||||
behaviors: o.behaviors, |
||||
value: v, |
||||
height: o.height, |
||||
watermark: watermark, |
||||
listeners: [{ |
||||
eventName: BI.DynamicYearQuarterCombo.EVENT_BEFORE_POPUPVIEW, |
||||
action: function () { |
||||
self.fireEvent(BI.YearQuarterInterval.EVENT_BEFORE_POPUPVIEW); |
||||
watermark, |
||||
listeners: [ |
||||
{ |
||||
eventName: DynamicYearQuarterCombo.EVENT_BEFORE_POPUPVIEW, |
||||
action: () => { |
||||
this.fireEvent( |
||||
YearQuarterInterval.EVENT_BEFORE_POPUPVIEW |
||||
); |
||||
}, |
||||
} |
||||
}] |
||||
], |
||||
}); |
||||
combo.on(BI.DynamicYearQuarterCombo.EVENT_ERROR, function () { |
||||
self._clearTitle(); |
||||
BI.Bubbles.hide("error"); |
||||
self.element.removeClass(self.constants.timeErrorCls); |
||||
self.fireEvent(BI.YearQuarterInterval.EVENT_ERROR); |
||||
combo.on(DynamicYearQuarterCombo.EVENT_ERROR, () => { |
||||
this._clearTitle(); |
||||
Bubbles.hide("error"); |
||||
this.element.removeClass(this.constants.timeErrorCls); |
||||
this.fireEvent(YearQuarterInterval.EVENT_ERROR); |
||||
}); |
||||
|
||||
combo.on(BI.DynamicYearQuarterCombo.EVENT_VALID, function () { |
||||
self._checkValid(); |
||||
combo.on(DynamicYearQuarterCombo.EVENT_VALID, () => { |
||||
this._checkValid(); |
||||
}); |
||||
|
||||
combo.on(BI.DynamicYearQuarterCombo.EVENT_FOCUS, function () { |
||||
self._checkValid(); |
||||
combo.on(DynamicYearQuarterCombo.EVENT_FOCUS, () => { |
||||
this._checkValid(); |
||||
}); |
||||
|
||||
combo.on(BI.DynamicYearQuarterCombo.EVENT_CONFIRM, function () { |
||||
BI.Bubbles.hide("error"); |
||||
var smallDate = self.left.getKey(), bigDate = self.right.getKey(); |
||||
if (self.left.isStateValid() && self.right.isStateValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) { |
||||
self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text")); |
||||
self.element.addClass(self.constants.timeErrorCls); |
||||
self.fireEvent(BI.YearQuarterInterval.EVENT_ERROR); |
||||
}else{ |
||||
self._clearTitle(); |
||||
self.element.removeClass(self.constants.timeErrorCls); |
||||
self.fireEvent(BI.YearQuarterInterval.EVENT_CHANGE); |
||||
combo.on(DynamicYearQuarterCombo.EVENT_CONFIRM, () => { |
||||
Bubbles.hide("error"); |
||||
const smallDate = this.left.getKey(), |
||||
bigDate = this.right.getKey(); |
||||
if ( |
||||
this.left.isStateValid() && |
||||
this.right.isStateValid() && |
||||
this._check(smallDate, bigDate) && |
||||
this._compare(smallDate, bigDate) |
||||
) { |
||||
this._setTitle(i18nText("BI-Time_Interval_Error_Text")); |
||||
this.element.addClass(this.constants.timeErrorCls); |
||||
this.fireEvent(YearQuarterInterval.EVENT_ERROR); |
||||
} else { |
||||
this._clearTitle(); |
||||
this.element.removeClass(this.constants.timeErrorCls); |
||||
this.fireEvent(YearQuarterInterval.EVENT_CHANGE); |
||||
} |
||||
}); |
||||
|
||||
return combo; |
||||
}, |
||||
|
||||
|
||||
_dateCheck: function (date) { |
||||
return BI.print(BI.parseDateTime(date, "%Y-%Q"), "%Y-%Q") === date || BI.print(BI.parseDateTime(date, "%Y-%q"), "%Y-%q") === date; |
||||
}, |
||||
} |
||||
|
||||
_dateCheck(date) { |
||||
return ( |
||||
print(parseDateTime(date, "%Y-%Q"), "%Y-%Q") === date || |
||||
print(parseDateTime(date, "%Y-%q"), "%Y-%q") === date |
||||
); |
||||
} |
||||
|
||||
// 判是否在最大最小之间
|
||||
_checkVoid: function (obj) { |
||||
var o = this.options; |
||||
return !BI.checkDateVoid(obj.year, (obj.quarter - 1) * 3 + 1, 1, o.minDate, o.maxDate)[0]; |
||||
}, |
||||
_checkVoid(obj) { |
||||
const o = this.options; |
||||
|
||||
return !checkDateVoid( |
||||
obj.year, |
||||
(obj.quarter - 1) * 3 + 1, |
||||
1, |
||||
o.minDate, |
||||
o.maxDate |
||||
)[0]; |
||||
} |
||||
|
||||
// 判格式合法
|
||||
_check: function (smallDate, bigDate) { |
||||
var smallObj = smallDate.match(/\d+/g), bigObj = bigDate.match(/\d+/g); |
||||
_check(smallDate, bigDate) { |
||||
const smallObj = smallDate.match(/\d+/g), |
||||
bigObj = bigDate.match(/\d+/g); |
||||
|
||||
var smallDate4Check = ""; |
||||
if (BI.isNotNull(smallObj)) { |
||||
smallDate4Check = (smallObj[0] || "") + "-" + (smallObj[1] || 1); |
||||
let smallDate4Check = ""; |
||||
if (isNotNull(smallObj)) { |
||||
smallDate4Check = `${smallObj[0] || ""}-${smallObj[1] || 1}`; |
||||
} |
||||
|
||||
var bigDate4Check = ""; |
||||
if (BI.isNotNull(bigObj)) { |
||||
bigDate4Check = (bigObj[0] || "") + "-" + (bigObj[1] || 1); |
||||
let bigDate4Check = ""; |
||||
if (isNotNull(bigObj)) { |
||||
bigDate4Check = `${bigObj[0] || ""}-${bigObj[1] || 1}`; |
||||
} |
||||
|
||||
return this._dateCheck(smallDate4Check) && BI.checkDateLegal(smallDate4Check) && this._checkVoid({ |
||||
year: smallObj[0], |
||||
quarter: smallObj[1] || 1 |
||||
}) && this._dateCheck(bigDate4Check) && BI.checkDateLegal(bigDate4Check) && this._checkVoid({ |
||||
year: bigObj[0], |
||||
quarter: bigObj[1] || 1 |
||||
}); |
||||
}, |
||||
|
||||
_compare: function (smallDate, bigDate) { |
||||
smallDate = BI.print(BI.parseDateTime(smallDate, "%Y-%Q"), "%Y-%Q"); |
||||
bigDate = BI.print(BI.parseDateTime(bigDate, "%Y-%Q"), "%Y-%Q"); |
||||
return BI.isNotNull(smallDate) && BI.isNotNull(bigDate) && smallDate > bigDate; |
||||
}, |
||||
_setTitle: function (v) { |
||||
return ( |
||||
this._dateCheck(smallDate4Check) && |
||||
checkDateLegal(smallDate4Check) && |
||||
this._checkVoid({ |
||||
year: smallObj[0], |
||||
quarter: smallObj[1] || 1, |
||||
}) && |
||||
this._dateCheck(bigDate4Check) && |
||||
checkDateLegal(bigDate4Check) && |
||||
this._checkVoid({ |
||||
year: bigObj[0], |
||||
quarter: bigObj[1] || 1, |
||||
}) |
||||
); |
||||
} |
||||
|
||||
_compare(smallDate, bigDate) { |
||||
smallDate = print(parseDateTime(smallDate, "%Y-%Q"), "%Y-%Q"); |
||||
bigDate = print(parseDateTime(bigDate, "%Y-%Q"), "%Y-%Q"); |
||||
|
||||
return ( |
||||
isNotNull(smallDate) && isNotNull(bigDate) && smallDate > bigDate |
||||
); |
||||
} |
||||
|
||||
_setTitle(v) { |
||||
this.setTitle(v); |
||||
}, |
||||
_clearTitle: function () { |
||||
} |
||||
|
||||
_clearTitle() { |
||||
this.setTitle(""); |
||||
}, |
||||
_checkValid: function () { |
||||
var self = this; |
||||
|
||||
BI.Bubbles.hide("error"); |
||||
var smallDate = self.left.getKey(), bigDate = self.right.getKey(); |
||||
if (self.left.isValid() && self.right.isValid() && self._check(smallDate, bigDate) && self._compare(smallDate, bigDate)) { |
||||
self._setTitle(BI.i18nText("BI-Time_Interval_Error_Text")); |
||||
self.element.addClass(self.constants.timeErrorCls); |
||||
BI.Bubbles.show("error", BI.i18nText("BI-Time_Interval_Error_Text"), self, { |
||||
offsetStyle: "center" |
||||
}); |
||||
self.fireEvent(BI.YearQuarterInterval.EVENT_ERROR); |
||||
} |
||||
|
||||
_checkValid() { |
||||
Bubbles.hide("error"); |
||||
const smallDate = this.left.getKey(), |
||||
bigDate = this.right.getKey(); |
||||
if ( |
||||
this.left.isValid() && |
||||
this.right.isValid() && |
||||
this._check(smallDate, bigDate) && |
||||
this._compare(smallDate, bigDate) |
||||
) { |
||||
this._setTitle(i18nText("BI-Time_Interval_Error_Text")); |
||||
this.element.addClass(this.constants.timeErrorCls); |
||||
Bubbles.show( |
||||
"error", |
||||
i18nText("BI-Time_Interval_Error_Text"), |
||||
this, |
||||
{ |
||||
offsetStyle: "center", |
||||
} |
||||
); |
||||
this.fireEvent(YearQuarterInterval.EVENT_ERROR); |
||||
} else { |
||||
self._clearTitle(); |
||||
self.element.removeClass(self.constants.timeErrorCls); |
||||
this._clearTitle(); |
||||
this.element.removeClass(this.constants.timeErrorCls); |
||||
} |
||||
}, |
||||
} |
||||
|
||||
setMinDate: function (minDate) { |
||||
var o = this.options; |
||||
setMinDate(minDate) { |
||||
const o = this.options; |
||||
o.minDate = minDate; |
||||
this.left.setMinDate(minDate); |
||||
this.right.setMinDate(minDate); |
||||
}, |
||||
} |
||||
|
||||
setMaxDate: function (maxDate) { |
||||
var o = this.options; |
||||
setMaxDate(maxDate) { |
||||
const o = this.options; |
||||
o.maxDate = maxDate; |
||||
this.left.setMaxDate(maxDate); |
||||
this.right.setMaxDate(maxDate); |
||||
}, |
||||
} |
||||
|
||||
setValue: function (date) { |
||||
setValue(date) { |
||||
date = date || {}; |
||||
this.left.setValue(date.start); |
||||
this.right.setValue(date.end); |
||||
|
||||
this._checkValid(); |
||||
}, |
||||
getValue: function () { |
||||
return {start: this.left.getValue(), end: this.right.getValue()}; |
||||
} |
||||
}); |
||||
BI.YearQuarterInterval.EVENT_VALID = "EVENT_VALID"; |
||||
BI.YearQuarterInterval.EVENT_ERROR = "EVENT_ERROR"; |
||||
BI.YearQuarterInterval.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.YearQuarterInterval.EVENT_BEFORE_POPUPVIEW = "EVENT_BEFORE_POPUPVIEW"; |
||||
BI.shortcut("bi.year_quarter_interval", BI.YearQuarterInterval); |
||||
|
||||
getValue() { |
||||
return { start: this.left.getValue(), end: this.right.getValue() }; |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue