|
|
@ -3,23 +3,42 @@ Demo = { |
|
|
|
}; |
|
|
|
}; |
|
|
|
$(function () { |
|
|
|
$(function () { |
|
|
|
var ref; |
|
|
|
var ref; |
|
|
|
var AppRouter = BI.inherit(BI.Router, { |
|
|
|
|
|
|
|
|
|
|
|
BI.each(Demo.CONFIG, function (index, item) { |
|
|
|
|
|
|
|
!item.id && (item.id = item.value || item.text); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
var tree = BI.Tree.transformToTreeFormat(Demo.CONFIG); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var obj = { |
|
|
|
routes: { |
|
|
|
routes: { |
|
|
|
"": "index" |
|
|
|
"": "index" |
|
|
|
}, |
|
|
|
}, |
|
|
|
index: function () { |
|
|
|
index: function () { |
|
|
|
BI.createWidget({ |
|
|
|
Demo.showIndex = "demo.face"; |
|
|
|
type: "demo.main", |
|
|
|
} |
|
|
|
ref: function (_ref) { |
|
|
|
}; |
|
|
|
console.log(_ref); |
|
|
|
|
|
|
|
ref = _ref; |
|
|
|
BI.Tree.traversal(tree, function (index, node) { |
|
|
|
}, |
|
|
|
if (!node.children || BI.isEmptyArray(node.children)) { |
|
|
|
element: "#wrapper" |
|
|
|
obj.routes[node.text] = node.text; |
|
|
|
}); |
|
|
|
obj[node.text] = function () { |
|
|
|
|
|
|
|
Demo.showIndex = node.value; |
|
|
|
|
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var AppRouter = BI.inherit(BI.Router, obj); |
|
|
|
new AppRouter; |
|
|
|
new AppRouter; |
|
|
|
BI.history.start(); |
|
|
|
BI.history.start(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BI.createWidget({ |
|
|
|
|
|
|
|
type: "demo.main", |
|
|
|
|
|
|
|
ref: function (_ref) { |
|
|
|
|
|
|
|
console.log(_ref); |
|
|
|
|
|
|
|
ref = _ref; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
element: "#wrapper" |
|
|
|
|
|
|
|
}); |
|
|
|
});Demo.Button = BI.inherit(BI.Widget, { |
|
|
|
});Demo.Button = BI.inherit(BI.Widget, { |
|
|
|
props: { |
|
|
|
props: { |
|
|
|
baseCls: "demo-button" |
|
|
|
baseCls: "demo-button" |
|
|
@ -2661,7 +2680,7 @@ BI.shortcut("demo.text_trigger", Demo.Func);Demo.Center = BI.inherit(BI.Widget, |
|
|
|
self.tab = this; |
|
|
|
self.tab = this; |
|
|
|
}, |
|
|
|
}, |
|
|
|
single: true, |
|
|
|
single: true, |
|
|
|
showIndex: "demo.face", |
|
|
|
showIndex: Demo.showIndex, |
|
|
|
cardCreator: function (v) { |
|
|
|
cardCreator: function (v) { |
|
|
|
return BI.createWidget({ |
|
|
|
return BI.createWidget({ |
|
|
|
type: v |
|
|
|
type: v |
|
|
@ -8101,8 +8120,23 @@ BI.shortcut("demo.face", Demo.Face);(function () { |
|
|
|
props: { |
|
|
|
props: { |
|
|
|
baseCls: "demo-main bi-background" |
|
|
|
baseCls: "demo-main bi-background" |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_store: function () { |
|
|
|
|
|
|
|
return BI.Stores.getStore("demo.store.main"); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
watch: { |
|
|
|
|
|
|
|
activeCard: function (v) { |
|
|
|
|
|
|
|
this.center.setValue(v); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
beforeInit: function (cb) { |
|
|
|
|
|
|
|
this.store.init(cb); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
render: function () { |
|
|
|
render: function () { |
|
|
|
var center; |
|
|
|
var self = this; |
|
|
|
return { |
|
|
|
return { |
|
|
|
type: "bi.border", |
|
|
|
type: "bi.border", |
|
|
|
items: { |
|
|
|
items: { |
|
|
@ -8113,7 +8147,7 @@ BI.shortcut("demo.face", Demo.Face);(function () { |
|
|
|
listeners: [{ |
|
|
|
listeners: [{ |
|
|
|
eventName: Demo.North.EVENT_VALUE_CHANGE, |
|
|
|
eventName: Demo.North.EVENT_VALUE_CHANGE, |
|
|
|
action: function (v) { |
|
|
|
action: function (v) { |
|
|
|
center.setValue(v); |
|
|
|
self.store.handleTreeSelectChange(v); |
|
|
|
} |
|
|
|
} |
|
|
|
}] |
|
|
|
}] |
|
|
|
} |
|
|
|
} |
|
|
@ -8125,7 +8159,7 @@ BI.shortcut("demo.face", Demo.Face);(function () { |
|
|
|
listeners: [{ |
|
|
|
listeners: [{ |
|
|
|
eventName: Demo.West.EVENT_VALUE_CHANGE, |
|
|
|
eventName: Demo.West.EVENT_VALUE_CHANGE, |
|
|
|
action: function (v) { |
|
|
|
action: function (v) { |
|
|
|
center.setValue(v); |
|
|
|
self.store.handleTreeSelectChange(v); |
|
|
|
} |
|
|
|
} |
|
|
|
}] |
|
|
|
}] |
|
|
|
} |
|
|
|
} |
|
|
@ -8134,7 +8168,7 @@ BI.shortcut("demo.face", Demo.Face);(function () { |
|
|
|
el: { |
|
|
|
el: { |
|
|
|
type: "demo.center", |
|
|
|
type: "demo.center", |
|
|
|
ref: function (_ref) { |
|
|
|
ref: function (_ref) { |
|
|
|
center = _ref; |
|
|
|
self.center = _ref; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -8142,7 +8176,71 @@ BI.shortcut("demo.face", Demo.Face);(function () { |
|
|
|
}; |
|
|
|
}; |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
}); |
|
|
|
BI.shortcut("demo.main", Demo.Main);Demo.North = BI.inherit(BI.Widget, { |
|
|
|
BI.shortcut("demo.main", Demo.Main);!(function () { |
|
|
|
|
|
|
|
var Store = BI.inherit(Fix.Model, { |
|
|
|
|
|
|
|
_init: function () { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
state: function () { |
|
|
|
|
|
|
|
return { |
|
|
|
|
|
|
|
activeCard: Demo.showIndex |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
computed: {}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
watch: {}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
actions: { |
|
|
|
|
|
|
|
init: function (cb) { |
|
|
|
|
|
|
|
var tree = BI.Tree.transformToTreeFormat(Demo.CONFIG); |
|
|
|
|
|
|
|
var traversal = function (array, callback) { |
|
|
|
|
|
|
|
var t = []; |
|
|
|
|
|
|
|
BI.some(array, function (i, item) { |
|
|
|
|
|
|
|
var match = callback(i, item); |
|
|
|
|
|
|
|
if (match) { |
|
|
|
|
|
|
|
t.push(item.id); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
var b = traversal(item.children, callback); |
|
|
|
|
|
|
|
if (BI.isNotEmptyArray(b)) { |
|
|
|
|
|
|
|
t = BI.concat([item.id], b); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
return t; |
|
|
|
|
|
|
|
}; |
|
|
|
|
|
|
|
var paths = traversal(tree, function (index, node) { |
|
|
|
|
|
|
|
if (!node.children || BI.isEmptyArray(node.children)) { |
|
|
|
|
|
|
|
if (node.value === Demo.showIndex) { |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
BI.each(Demo.CONFIG, function (index, item) { |
|
|
|
|
|
|
|
if (BI.contains(paths, item.id)) { |
|
|
|
|
|
|
|
item.open = true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
cb(); |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
handleTreeSelectChange: function (v) { |
|
|
|
|
|
|
|
this.model.activeCard = v; |
|
|
|
|
|
|
|
var matched = BI.some(Demo.CONFIG, function (index, item) { |
|
|
|
|
|
|
|
if (item.value === v) { |
|
|
|
|
|
|
|
BI.history.navigate(item.text, {trigger: true}); |
|
|
|
|
|
|
|
return true; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
if (!matched) { |
|
|
|
|
|
|
|
BI.history.navigate("", {trigger: true}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
BI.store("demo.store.main", Store); |
|
|
|
|
|
|
|
})();Demo.North = BI.inherit(BI.Widget, { |
|
|
|
props: { |
|
|
|
props: { |
|
|
|
baseCls: "demo-north" |
|
|
|
baseCls: "demo-north" |
|
|
|
}, |
|
|
|
}, |
|
|
@ -8271,9 +8369,11 @@ BI.shortcut("demo.preview", Demo.Preview);Demo.West = BI.inherit(BI.Widget, { |
|
|
|
props: { |
|
|
|
props: { |
|
|
|
baseCls: "demo-west bi-border-right bi-card" |
|
|
|
baseCls: "demo-west bi-border-right bi-card" |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
mounted: function () { |
|
|
|
mounted: function () { |
|
|
|
this.searcher.setAdapter(this.tree); |
|
|
|
this.searcher.setAdapter(this.tree); |
|
|
|
}, |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
render: function () { |
|
|
|
render: function () { |
|
|
|
var self = this; |
|
|
|
var self = this; |
|
|
|
return { |
|
|
|
return { |
|
|
@ -8317,6 +8417,7 @@ BI.shortcut("demo.preview", Demo.Preview);Demo.West = BI.inherit(BI.Widget, { |
|
|
|
self.fireEvent(Demo.West.EVENT_VALUE_CHANGE, v); |
|
|
|
self.fireEvent(Demo.West.EVENT_VALUE_CHANGE, v); |
|
|
|
} |
|
|
|
} |
|
|
|
}], |
|
|
|
}], |
|
|
|
|
|
|
|
value: Demo.showIndex, |
|
|
|
items: Demo.CONFIG, |
|
|
|
items: Demo.CONFIG, |
|
|
|
ref: function (ref) { |
|
|
|
ref: function (ref) { |
|
|
|
self.tree = ref; |
|
|
|
self.tree = ref; |
|
|
|