forked from fanruan/fineui
Guyi
5 years ago
42 changed files with 6514 additions and 2920 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy" |
||||
lodash core plus="debounce,throttle,get,findIndex,findLastIndex,findKey,findLastKey,isArrayLike,invert,invertBy,uniq,uniqBy,omit,omitBy,zip,unzip,rest,range,random,reject,intersection,drop,countBy,union,zipObject,initial,cloneDeep,clamp,isPlainObject,take,takeRight,without,difference,defaultsDeep,trim,merge,groupBy,uniqBy" |
@ -0,0 +1,91 @@
|
||||
/** |
||||
* 简单的复选下拉框控件, 适用于数据量少的情况 |
||||
* 封装了字段处理逻辑 |
||||
*/ |
||||
BI.ValueChooserInsertCombo = BI.inherit(BI.AbstractValueChooser, { |
||||
|
||||
_defaultConfig: function () { |
||||
return BI.extend(BI.ValueChooserInsertCombo.superclass._defaultConfig.apply(this, arguments), { |
||||
baseCls: "bi-value-chooser-insert-combo", |
||||
width: 200, |
||||
height: 24, |
||||
items: null, |
||||
itemsCreator: BI.emptyFn, |
||||
cache: true |
||||
}); |
||||
}, |
||||
|
||||
_init: function () { |
||||
BI.ValueChooserInsertCombo.superclass._init.apply(this, arguments); |
||||
var self = this, o = this.options; |
||||
if (BI.isNotNull(o.items)) { |
||||
this.items = o.items; |
||||
} |
||||
this.combo = BI.createWidget({ |
||||
type: "bi.multi_select_insert_combo", |
||||
element: this, |
||||
text: o.text, |
||||
itemsCreator: BI.bind(this._itemsCreator, this), |
||||
valueFormatter: BI.bind(this._valueFormatter, this), |
||||
width: o.width, |
||||
height: o.height, |
||||
listeners: [{ |
||||
eventName: BI.MultiSelectCombo.EVENT_FOCUS, |
||||
action: function () { |
||||
self.fireEvent(BI.ValueChooserInsertCombo.EVENT_FOCUS); |
||||
} |
||||
}, { |
||||
eventName: BI.MultiSelectCombo.EVENT_BLUR, |
||||
action: function () { |
||||
self.fireEvent(BI.ValueChooserInsertCombo.EVENT_BLUR); |
||||
} |
||||
}, { |
||||
eventName: BI.MultiSelectCombo.EVENT_STOP, |
||||
action: function () { |
||||
self.fireEvent(BI.ValueChooserInsertCombo.EVENT_STOP); |
||||
} |
||||
}, { |
||||
eventName: BI.MultiSelectCombo.EVENT_CLICK_ITEM, |
||||
action: function () { |
||||
self.fireEvent(BI.ValueChooserInsertCombo.EVENT_CLICK_ITEM); |
||||
} |
||||
}, { |
||||
eventName: BI.MultiSelectCombo.EVENT_SEARCHING, |
||||
action: function () { |
||||
self.fireEvent(BI.ValueChooserInsertCombo.EVENT_SEARCHING); |
||||
} |
||||
}, { |
||||
eventName: BI.MultiSelectCombo.EVENT_CONFIRM, |
||||
action: function () { |
||||
self.fireEvent(BI.ValueChooserInsertCombo.EVENT_CONFIRM); |
||||
} |
||||
}] |
||||
}); |
||||
}, |
||||
|
||||
setValue: function (v) { |
||||
this.combo.setValue(v); |
||||
}, |
||||
|
||||
getValue: function () { |
||||
var val = this.combo.getValue() || {}; |
||||
return { |
||||
type: val.type, |
||||
value: val.value |
||||
}; |
||||
}, |
||||
|
||||
populate: function (items) { |
||||
// 直接用combo的populate不会作用到AbstractValueChooser上
|
||||
this.items = items; |
||||
this.combo.populate.apply(this, arguments); |
||||
} |
||||
}); |
||||
|
||||
BI.ValueChooserInsertCombo.EVENT_BLUR = "EVENT_BLUR"; |
||||
BI.ValueChooserInsertCombo.EVENT_FOCUS = "EVENT_FOCUS"; |
||||
BI.ValueChooserInsertCombo.EVENT_STOP = "EVENT_STOP"; |
||||
BI.ValueChooserInsertCombo.EVENT_SEARCHING = "EVENT_SEARCHING"; |
||||
BI.ValueChooserInsertCombo.EVENT_CLICK_ITEM = "EVENT_CLICK_ITEM"; |
||||
BI.ValueChooserInsertCombo.EVENT_CONFIRM = "EVENT_CONFIRM"; |
||||
BI.shortcut("bi.value_chooser_insert_combo", BI.ValueChooserInsertCombo); |
@ -0,0 +1,92 @@
|
||||
/** |
||||
* Created by GUY on 2016/1/26. |
||||
* |
||||
* @class BI.MultiLayerSelectTreeInsertSearchPane |
||||
* @extends BI.Pane |
||||
*/ |
||||
|
||||
BI.MultiLayerSelectTreeInsertSearchPane = BI.inherit(BI.Widget, { |
||||
|
||||
props: function() { |
||||
return { |
||||
baseCls: "bi-multilayer-select-tree-popup", |
||||
tipText: BI.i18nText("BI-No_Selected_Item"), |
||||
isDefaultInit: false, |
||||
itemsCreator: BI.emptyFn, |
||||
items: [], |
||||
value: "" |
||||
}; |
||||
}, |
||||
|
||||
render: function() { |
||||
var self = this, o = this.options; |
||||
this.tree = BI.createWidget({ |
||||
type: "bi.multilayer_select_level_tree", |
||||
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()); |
||||
}); |
||||
}, |
||||
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); |
||||
} |
||||
}] |
||||
}); |
||||
return { |
||||
type: "bi.vertical", |
||||
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; |
||||
}, |
||||
handler: function () { |
||||
self.fireEvent(BI.MultiLayerSelectTreeInsertSearchPane.EVENT_ADD_ITEM, o.keywordGetter()); |
||||
} |
||||
}, this.tree] |
||||
}; |
||||
}, |
||||
|
||||
setKeyword: function (keyword) { |
||||
var showTip = BI.isEmptyArray(this.tree.getAllLeaves()); |
||||
this.addNotMatchTip.setVisible(showTip); |
||||
showTip && this.addNotMatchTip.setText(BI.i18nText("BI-Basic_Click_To_Add_Text", keyword)); |
||||
}, |
||||
|
||||
getValue: function () { |
||||
return this.tree.getValue(); |
||||
}, |
||||
|
||||
setValue: function (v) { |
||||
v = BI.isArray(v) ? v : [v]; |
||||
this.tree.setValue(v); |
||||
}, |
||||
|
||||
populate: function (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); |
@ -0,0 +1,92 @@
|
||||
/** |
||||
* Created by GUY on 2016/1/26. |
||||
* |
||||
* @class BI.MultiLayerSingleTreeInsertSearchPane |
||||
* @extends BI.Pane |
||||
*/ |
||||
|
||||
BI.MultiLayerSingleTreeInsertSearchPane = BI.inherit(BI.Widget, { |
||||
|
||||
props: function() { |
||||
return { |
||||
baseCls: "bi-multilayer-single-tree-popup", |
||||
tipText: BI.i18nText("BI-No_Selected_Item"), |
||||
isDefaultInit: false, |
||||
itemsCreator: BI.emptyFn, |
||||
items: [], |
||||
value: "" |
||||
}; |
||||
}, |
||||
|
||||
render: function() { |
||||
var self = this, o = this.options; |
||||
this.tree = BI.createWidget({ |
||||
type: "bi.multilayer_select_level_tree", |
||||
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()); |
||||
}); |
||||
}, |
||||
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.MultiLayerSingleTreeInsertSearchPane.EVENT_CHANGE); |
||||
} |
||||
}] |
||||
}); |
||||
return { |
||||
type: "bi.vertical", |
||||
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; |
||||
}, |
||||
handler: function () { |
||||
self.fireEvent(BI.MultiLayerSingleTreeInsertSearchPane.EVENT_ADD_ITEM, o.keywordGetter()); |
||||
} |
||||
}, this.tree] |
||||
}; |
||||
}, |
||||
|
||||
setKeyword: function (keyword) { |
||||
var showTip = BI.isEmptyArray(this.tree.getAllLeaves()); |
||||
this.addNotMatchTip.setVisible(showTip); |
||||
showTip && this.addNotMatchTip.setText(BI.i18nText("BI-Basic_Click_To_Add_Text", keyword)); |
||||
}, |
||||
|
||||
getValue: function () { |
||||
return this.tree.getValue(); |
||||
}, |
||||
|
||||
setValue: function (v) { |
||||
v = BI.isArray(v) ? v : [v]; |
||||
this.tree.setValue(v); |
||||
}, |
||||
|
||||
populate: function (items) { |
||||
this.tree.populate(items); |
||||
} |
||||
}); |
||||
|
||||
BI.MultiLayerSingleTreeInsertSearchPane.EVENT_ADD_ITEM = "EVENT_ADD_ITEM"; |
||||
BI.MultiLayerSingleTreeInsertSearchPane.EVENT_CHANGE = "EVENT_CHANGE"; |
||||
BI.shortcut("bi.multilayer_single_tree_insert_search_pane", BI.MultiLayerSingleTreeInsertSearchPane); |
Loading…
Reference in new issue