Browse Source

Merge pull request #684 in VISUAL/fineui from ~GUY/fineui:master to master

* commit '2aac05b82f83bf2e72fcd3ba77d290cfce4b9a2a':
  update
master
guy 6 years ago
parent
commit
d9db8153f2
  1. 4
      Gruntfile.js
  2. 22096
      dist/base.js
  3. 164820
      dist/bundle.js
  4. 56
      dist/bundle.min.js
  5. 19524
      dist/case.js
  6. 164992
      dist/fineui.js
  7. 56
      dist/fineui.min.js
  8. 274
      dist/fineui_without_jquery_polyfill.js
  9. 2
      dist/utils.min.js
  10. 45986
      dist/widget.js
  11. 0
      src/base/tree/ztree/asynctree.js
  12. 0
      src/base/tree/ztree/parttree.js
  13. 0
      src/base/tree/ztree/treeview.js
  14. 0
      src/case/tree/ztree/tree.display.js
  15. 0
      src/case/tree/ztree/tree.simple.js

4
Gruntfile.js

@ -142,13 +142,13 @@ module.exports = function (grunt) {
"src/base/combination/tree.button.js",
"src/base/combination/map.button.js",
"src/base/**/*.js",
"!src/base/tree/**/*.js",
"!src/base/tree/ztree/**/*.js",
"!src/base/single/input/file.js",
"src/case/combo/popup.bubble.js",
"src/case/**/*.js",
"!src/case/colorchooser/**/*.js",
"!src/case/tree/tree.display.js",
"!src/case/tree/ztree/**/*.js",
"dist/widget.js", "dist/fix/fix.compact.js", "ui/js/**/*.js"],
dest: "dist/fineui_without_jquery_polyfill.js"

22096
dist/base.js vendored

File diff suppressed because it is too large Load Diff

164820
dist/bundle.js vendored

File diff suppressed because one or more lines are too long

56
dist/bundle.min.js vendored

File diff suppressed because one or more lines are too long

19524
dist/case.js vendored

File diff suppressed because it is too large Load Diff

164992
dist/fineui.js vendored

File diff suppressed because one or more lines are too long

56
dist/fineui.min.js vendored

File diff suppressed because one or more lines are too long

274
dist/fineui_without_jquery_polyfill.js vendored

@ -33556,6 +33556,153 @@ BI.Trigger = BI.inherit(BI.Single, {
}
});/**
*
* 自定义树
*
* Created by GUY on 2015/9/7.
* @class BI.CustomTree
* @extends BI.Single
*/
BI.CustomTree = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.CustomTree.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-custom-tree",
expander: {
el: {},
popup: {
type: "bi.custom_tree"
}
},
items: [],
itemsCreator: BI.emptyFn,
el: {
type: "bi.button_tree",
chooseType: 0,
layouts: [{
type: "bi.vertical"
}]
}
});
},
_init: function () {
BI.CustomTree.superclass._init.apply(this, arguments);
this.initTree(this.options.items);
},
_formatItems: function (nodes) {
var self = this, o = this.options;
nodes = BI.Tree.transformToTreeFormat(nodes);
var items = [];
BI.each(nodes, function (i, node) {
if (BI.isNotEmptyArray(node.children) || node.isParent === true) {
var item = BI.extend({
type: "bi.expander",
el: {
value: node.value
},
popup: {type: "bi.custom_tree"}
}, BI.deepClone(o.expander), {
id: node.id,
pId: node.pId
});
var el = BI.stripEL(node);
if (!BI.isWidget(el)) {
el = BI.clone(el);
delete el.children;
BI.extend(item.el, el);
} else {
item.el = el;
}
item.popup.expander = BI.deepClone(o.expander);
item.items = item.popup.items = node.children;
item.itemsCreator = item.popup.itemsCreator = function (op) {
if (BI.isNotNull(op.node)) {// 从子节点传过来的itemsCreator直接向上传递
return o.itemsCreator.apply(self, arguments);
}
var args = Array.prototype.slice.call(arguments, 0);
args[0].node = node;
return o.itemsCreator.apply(self, args);
};
BI.isNull(item.popup.el) && (item.popup.el = BI.deepClone(o.el));
items.push(item);
} else {
items.push(node);
}
});
return items;
},
// 构造树结构,
initTree: function (nodes) {
var self = this, o = this.options;
this.tree = BI.createWidget(o.el, {
element: this,
items: this._formatItems(nodes),
itemsCreator: function (op, callback) {
o.itemsCreator.apply(this, [op, function (items) {
var args = Array.prototype.slice.call(arguments, 0);
args[0] = self._formatItems(items);
callback.apply(null, args);
}]);
},
value: o.value
});
this.tree.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
if (type === BI.Events.CLICK) {
self.fireEvent(BI.CustomTree.EVENT_CHANGE, val, obj);
}
});
},
// 生成树方法
stroke: function (nodes) {
this.populate.apply(this, arguments);
},
populate: function (nodes) {
var args = Array.prototype.slice.call(arguments, 0);
if (arguments.length > 0) {
args[0] = this._formatItems(nodes);
}
this.tree.populate.apply(this.tree, args);
},
setValue: function (v) {
this.tree && this.tree.setValue(v);
},
getValue: function () {
return this.tree ? this.tree.getValue() : [];
},
getAllButtons: function () {
return this.tree ? this.tree.getAllButtons() : [];
},
getAllLeaves: function () {
return this.tree ? this.tree.getAllLeaves() : [];
},
getNodeById: function (id) {
return this.tree && this.tree.getNodeById(id);
},
getNodeByValue: function (id) {
return this.tree && this.tree.getNodeByValue(id);
},
empty: function () {
this.tree.empty();
}
});
BI.CustomTree.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.custom_tree", BI.CustomTree);/**
* 可以改变图标的button
*
* Created by GUY on 2016/2/2.
@ -41019,133 +41166,6 @@ BI.LevelTree = BI.inherit(BI.Widget, {
BI.LevelTree.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.level_tree", BI.LevelTree);/**
* 简单的多选树
*
* Created by GUY on 2016/2/16.
* @class BI.SimpleTreeView
* @extends BI.Widget
*/
BI.SimpleTreeView = BI.inherit(BI.Widget, {
_defaultConfig: function () {
return BI.extend(BI.SimpleTreeView.superclass._defaultConfig.apply(this, arguments), {
baseCls: "bi-simple-tree",
itemsCreator: BI.emptyFn,
items: null
});
},
_init: function () {
BI.SimpleTreeView.superclass._init.apply(this, arguments);
var self = this, o = this.options;
this.structure = new BI.Tree();
this.tree = BI.createWidget({
type: "bi.tree_view",
element: this,
itemsCreator: function (op, callback) {
var fn = function (items) {
callback({
items: items
});
self.structure.initTree(BI.Tree.transformToTreeFormat(items));
};
if (BI.isNotNull(o.items)) {
fn(o.items);
} else {
o.itemsCreator(op, fn);
}
}
});
this.tree.on(BI.TreeView.EVENT_CHANGE, function () {
self.fireEvent(BI.SimpleTreeView.EVENT_CHANGE, arguments);
});
if (BI.isNotEmptyArray(o.items)) {
this.populate();
}
if (BI.isNotNull(o.value)) {
this.setValue(o.value);
}
},
populate: function (items, keyword) {
if (items) {
this.options.items = items;
}
this.tree.stroke({
keyword: keyword
});
},
_digest: function (v) {
v || (v = []);
var self = this, map = {};
var selected = [];
BI.each(v, function (i, val) {
var node = self.structure.search(val, "value");
if (node) {
var p = node;
p = p.getParent();
if (p) {
if (!map[p.value]) {
map[p.value] = 0;
}
map[p.value]++;
}
while (p && p.getChildrenLength() <= map[p.value]) {
selected.push(p.value);
p = p.getParent();
if (p) {
if (!map[p.value]) {
map[p.value] = 0;
}
map[p.value]++;
}
}
}
});
return BI.makeObject(v.concat(selected));
},
setValue: function (v) {
this.tree.setValue(this._digest(v));
},
_getValue: function () {
var self = this, result = [], val = this.tree.getValue();
var track = function (nodes) {
BI.each(nodes, function (key, node) {
if (BI.isEmpty(node)) {
result.push(key);
} else {
track(node);
}
});
};
track(val);
return result;
},
empty: function () {
this.tree.empty();
},
getValue: function () {
var self = this, result = [], val = this._getValue();
BI.each(val, function (i, key) {
var target = self.structure.search(key, "value");
if (target) {
self.structure._traverse(target, function (node) {
if (node.isLeaf()) {
result.push(node.value);
}
});
}
});
return result;
}
});
BI.SimpleTreeView.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.simple_tree", BI.SimpleTreeView);
/**
* 文本输入框trigger
*
* Created by GUY on 2015/9/15.

2
dist/utils.min.js vendored

File diff suppressed because one or more lines are too long

45986
dist/widget.js vendored

File diff suppressed because it is too large Load Diff

0
src/base/tree/asynctree.js → src/base/tree/ztree/asynctree.js

0
src/base/tree/parttree.js → src/base/tree/ztree/parttree.js

0
src/base/tree/treeview.js → src/base/tree/ztree/treeview.js

0
src/case/tree/tree.display.js → src/case/tree/ztree/tree.display.js

0
src/case/tree/tree.simple.js → src/case/tree/ztree/tree.simple.js

Loading…
Cancel
Save