26 changed files with 1359 additions and 573 deletions
@ -1,5 +1,5 @@ |
|||||||
# demo-theme-original |
# demo-theme-ngx |
||||||
|
|
||||||
主题插件示例效果图 |
主题插件示例效果图 |
||||||
|
|
||||||
![style](screenshots/theme.png) |
![style](screenshots/theme.gif) |
After Width: | Height: | Size: 929 KiB |
Before Width: | Height: | Size: 242 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
@ -0,0 +1,88 @@ |
|||||||
|
/** |
||||||
|
*@desc 自定义的header |
||||||
|
*@author dailer |
||||||
|
*@date 2018/12/25 |
||||||
|
*/ |
||||||
|
!(function () { |
||||||
|
var Widget = BI.inherit(BI.Widget, { |
||||||
|
|
||||||
|
props: { |
||||||
|
baseCls: "demo-favorite" |
||||||
|
}, |
||||||
|
|
||||||
|
beforeInit: function (render) { |
||||||
|
var self = this; |
||||||
|
Dec.Utils.getFavoritesList(function (res) { |
||||||
|
self.items = res.data; |
||||||
|
render(); |
||||||
|
}); |
||||||
|
}, |
||||||
|
|
||||||
|
render: function () { |
||||||
|
var self = this; |
||||||
|
|
||||||
|
var trigger = { |
||||||
|
type: "bi.icon_button", |
||||||
|
cls: "favorite-font", |
||||||
|
handler: function () { |
||||||
|
|
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
var popup = { |
||||||
|
type: "bi.button_group", |
||||||
|
layouts: [ |
||||||
|
{ |
||||||
|
type: "bi.vertical", |
||||||
|
vgap: 5 |
||||||
|
} |
||||||
|
], |
||||||
|
ref: function (_ref) { |
||||||
|
self.popup = _ref; |
||||||
|
}, |
||||||
|
items: this._createItems() |
||||||
|
}; |
||||||
|
|
||||||
|
return { |
||||||
|
type: "bi.combo", |
||||||
|
trigger: "click-hover", |
||||||
|
el: trigger, |
||||||
|
popup: { |
||||||
|
el: popup, |
||||||
|
cls: "demo-background", |
||||||
|
minWidth: 200 |
||||||
|
} |
||||||
|
}; |
||||||
|
}, |
||||||
|
|
||||||
|
_createItems: function () { |
||||||
|
var self = this; |
||||||
|
return BI.map(this.items, function (index, item) { |
||||||
|
return BI.extend(item, { |
||||||
|
type: "dec.workbench.panel.favorite.item", |
||||||
|
closeable: true, |
||||||
|
onClose: function () { |
||||||
|
self._unFavorite(item.id); |
||||||
|
}, |
||||||
|
handler: function () { |
||||||
|
self._openFavorite(item); |
||||||
|
} |
||||||
|
}); |
||||||
|
}); |
||||||
|
}, |
||||||
|
|
||||||
|
_openFavorite: function (item) { |
||||||
|
BI.Services.getService("dec.service.tabs").addItem(item); |
||||||
|
}, |
||||||
|
|
||||||
|
_unFavorite: function (id) { |
||||||
|
this.items = BI.filter(this.items, function (index, fav) { |
||||||
|
return fav.id !== id; |
||||||
|
}); |
||||||
|
this.popup.populate(this._createItems()); |
||||||
|
Dec.Utils.handlerCollect(id, false, BI.emptyFn); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
BI.shortcut("demo.favorite", Widget); |
||||||
|
}()); |
@ -0,0 +1,70 @@ |
|||||||
|
/** |
||||||
|
*@desc 自定义的header |
||||||
|
*@author dailer |
||||||
|
*@date 2018/12/25 |
||||||
|
*/ |
||||||
|
!(function () { |
||||||
|
var Widget = BI.inherit(BI.Widget, { |
||||||
|
|
||||||
|
props: { |
||||||
|
baseCls: "demo-header" |
||||||
|
}, |
||||||
|
|
||||||
|
render: function () { |
||||||
|
return { |
||||||
|
type: "bi.left_right_vertical_adapt", |
||||||
|
items: { |
||||||
|
left: [ |
||||||
|
{ |
||||||
|
el: { |
||||||
|
type: "bi.icon_button", |
||||||
|
cls: "directory-font demo-sidebar-trigger", |
||||||
|
width: 80, |
||||||
|
height: 35 |
||||||
|
} |
||||||
|
}, { |
||||||
|
el: { |
||||||
|
type: "bi.text_button", |
||||||
|
textAlign: "left", |
||||||
|
cls: "demo-title-text", |
||||||
|
text: "ngx-admin", |
||||||
|
handler: function () { |
||||||
|
BI.Services.getService("dec.service.tabs").openTab(-1); |
||||||
|
Dec.inactiveOthers(-1); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
], |
||||||
|
right: [ |
||||||
|
{ |
||||||
|
el: { |
||||||
|
type: "bi.icon_button", |
||||||
|
cls: "platform-search-font demo-search-button", |
||||||
|
width: 35, |
||||||
|
height: 30, |
||||||
|
handler: function () { |
||||||
|
$("#wrapper").addClass("active"); |
||||||
|
} |
||||||
|
} |
||||||
|
}, { |
||||||
|
el: { |
||||||
|
type: "demo.favorite", |
||||||
|
width: 35 |
||||||
|
} |
||||||
|
}, { |
||||||
|
el: { |
||||||
|
type: "dec.header.message" |
||||||
|
} |
||||||
|
}, { |
||||||
|
el: { |
||||||
|
type: "dec.account" |
||||||
|
} |
||||||
|
} |
||||||
|
] |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
BI.shortcut("demo.header", Widget); |
||||||
|
}()); |
@ -0,0 +1,17 @@ |
|||||||
|
.demo-header { |
||||||
|
background: #494299; |
||||||
|
|
||||||
|
.demo-sidebar-trigger .b-font { |
||||||
|
color: #FFFFFF; |
||||||
|
font-size: 30px; |
||||||
|
} |
||||||
|
|
||||||
|
.demo-search-button .b-font, .favorite-font .b-font { |
||||||
|
color: #a1a1e5; |
||||||
|
} |
||||||
|
|
||||||
|
.demo-title-text { |
||||||
|
color: #FFFFFF; |
||||||
|
font-size: 24px; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,13 @@ |
|||||||
|
.demo-background { |
||||||
|
background: #3d3780; |
||||||
|
} |
||||||
|
|
||||||
|
.dec-workbench-tabs { |
||||||
|
border-radius: 8px; |
||||||
|
overflow: hidden; |
||||||
|
} |
||||||
|
|
||||||
|
#wrapper.active { |
||||||
|
transform: perspective(.5em) rotateX(25deg); |
||||||
|
transform-origin: bottom; |
||||||
|
} |
@ -0,0 +1,56 @@ |
|||||||
|
/** |
||||||
|
*@desc 自定义的header |
||||||
|
*@author dailer |
||||||
|
*@date 2018/12/25 |
||||||
|
*/ |
||||||
|
!(function () { |
||||||
|
var Widget = BI.inherit(BI.Widget, { |
||||||
|
|
||||||
|
props: { |
||||||
|
baseCls: "" |
||||||
|
}, |
||||||
|
|
||||||
|
render: function () { |
||||||
|
return { |
||||||
|
type: "bi.left_right_vertical_adapt", |
||||||
|
items: { |
||||||
|
left: [ |
||||||
|
{ |
||||||
|
el: { |
||||||
|
type: "bi.icon_button", |
||||||
|
width: 30, |
||||||
|
height: 30 |
||||||
|
} |
||||||
|
}, { |
||||||
|
el: { |
||||||
|
type: "bi.label", |
||||||
|
textAlign: "left", |
||||||
|
cls: "title-text", |
||||||
|
text: "ngx-admin" |
||||||
|
} |
||||||
|
} |
||||||
|
], |
||||||
|
right: [ |
||||||
|
{ |
||||||
|
el: { |
||||||
|
type: "bi.icon_button", |
||||||
|
width: 30, |
||||||
|
height: 30 |
||||||
|
} |
||||||
|
}, { |
||||||
|
el: { |
||||||
|
type: "dec.header.message" |
||||||
|
} |
||||||
|
}, { |
||||||
|
el: { |
||||||
|
type: "dec.account" |
||||||
|
} |
||||||
|
} |
||||||
|
] |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
BI.shortcut("demo.head11er", Widget); |
||||||
|
}()); |
@ -0,0 +1,87 @@ |
|||||||
|
!(function () { |
||||||
|
var Node = BI.inherit(BI.BasicButton, { |
||||||
|
|
||||||
|
props: { |
||||||
|
baseCls: "demo-sidebar-expander", |
||||||
|
items: [], |
||||||
|
open: false |
||||||
|
}, |
||||||
|
|
||||||
|
render: function () { |
||||||
|
|
||||||
|
var self = this, o = this.options; |
||||||
|
|
||||||
|
|
||||||
|
var trigger = { |
||||||
|
type: "demo.sidebar.node", |
||||||
|
text: o.text, |
||||||
|
height: 42, |
||||||
|
open: o.open, |
||||||
|
iconCls: o.nodeIcon, |
||||||
|
listeners: [ |
||||||
|
{ |
||||||
|
eventName: "EVENT_EXPAND", |
||||||
|
action: function () { |
||||||
|
self.showView(); |
||||||
|
} |
||||||
|
}, { |
||||||
|
eventName: "EVENT_COLLAPSE", |
||||||
|
action: function () { |
||||||
|
self.popuop.setVisible(false); |
||||||
|
} |
||||||
|
} |
||||||
|
] |
||||||
|
}; |
||||||
|
|
||||||
|
var items = BI.createItems(o.items, { |
||||||
|
type: "demo.sidebar.item", |
||||||
|
lgap: 30, |
||||||
|
height: 36 |
||||||
|
}); |
||||||
|
return { |
||||||
|
type: "bi.vertical", |
||||||
|
items: [ |
||||||
|
{ |
||||||
|
el: trigger |
||||||
|
}, { |
||||||
|
el: { |
||||||
|
type: "bi.button_group", |
||||||
|
cls: "demo-sidebar-expander-popup", |
||||||
|
layouts: [ |
||||||
|
{ |
||||||
|
type: "bi.vertical" |
||||||
|
} |
||||||
|
], |
||||||
|
ref: function (_ref) { |
||||||
|
self.popuop = _ref; |
||||||
|
}, |
||||||
|
invisible: !o.open, |
||||||
|
items: items |
||||||
|
} |
||||||
|
} |
||||||
|
] |
||||||
|
|
||||||
|
}; |
||||||
|
}, |
||||||
|
|
||||||
|
showView: function () { |
||||||
|
var self = this, o = this.options; |
||||||
|
if (BI.isEmptyArray(o.items)) { |
||||||
|
Dec.Utils.getWorkbenchSubDirectoryById(o.id, function (res) { |
||||||
|
o.items = BI.map(res.data, function (index, item) { |
||||||
|
return BI.extend({ |
||||||
|
type: "demo.sidebar.item", |
||||||
|
lgap: 30 |
||||||
|
}, item); |
||||||
|
}); |
||||||
|
self.popuop.populate(o.items); |
||||||
|
self.popuop.setVisible(true); |
||||||
|
}); |
||||||
|
} else { |
||||||
|
self.popuop.setVisible(true); |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
BI.shortcut("demo.sidebar.expander", Node); |
||||||
|
}()); |
@ -0,0 +1,81 @@ |
|||||||
|
!(function () { |
||||||
|
var itemStorage = {}; |
||||||
|
|
||||||
|
Dec.inactiveOthers = function (id) { |
||||||
|
BI.each(itemStorage, function (key, widget) { |
||||||
|
widget.options.id !== id && widget.setSelected(false); |
||||||
|
}); |
||||||
|
}; |
||||||
|
|
||||||
|
var Node = BI.inherit(BI.BasicButton, { |
||||||
|
|
||||||
|
props: { |
||||||
|
baseCls: "demo-sidebar-item", |
||||||
|
id: "", |
||||||
|
pId: "", |
||||||
|
open: false, |
||||||
|
height: 35, |
||||||
|
iconCls: "dir-panel-folder-font" |
||||||
|
}, |
||||||
|
|
||||||
|
mounted: function () { |
||||||
|
itemStorage[this.options.id] = this; |
||||||
|
}, |
||||||
|
|
||||||
|
render: function () { |
||||||
|
|
||||||
|
var self = this, o = this.options; |
||||||
|
|
||||||
|
|
||||||
|
var text = { |
||||||
|
type: "bi.label", |
||||||
|
height: o.height, |
||||||
|
textAlign: "left", |
||||||
|
text: o.text, |
||||||
|
title: o.text |
||||||
|
}; |
||||||
|
|
||||||
|
var items = []; |
||||||
|
|
||||||
|
items.push({ |
||||||
|
el: text, |
||||||
|
height: o.height |
||||||
|
}); |
||||||
|
return { |
||||||
|
type: "bi.vertical_adapt", |
||||||
|
lgap: o.lgap, |
||||||
|
items: [ |
||||||
|
{ |
||||||
|
type: "bi.label", |
||||||
|
textAlign: "left", |
||||||
|
text: o.text, |
||||||
|
title: o.text |
||||||
|
} |
||||||
|
] |
||||||
|
}; |
||||||
|
}, |
||||||
|
|
||||||
|
isOnce: function () { |
||||||
|
return true; |
||||||
|
}, |
||||||
|
|
||||||
|
getValue: function () { |
||||||
|
return this.options.id; |
||||||
|
}, |
||||||
|
|
||||||
|
doClick: function () { |
||||||
|
var self = this; |
||||||
|
Dec.inactiveOthers(this.options.id); |
||||||
|
var module = BI.find(BI.Constants.getConstant("dec.constant.management.navigation"), function (index, item) { |
||||||
|
return item.value === self.options.id; |
||||||
|
}); |
||||||
|
if (module) { |
||||||
|
BI.Services.getService("dec.service.tabs").addItem(module); |
||||||
|
} else { |
||||||
|
BI.Services.getService("dec.service.tabs").addItem(BI.deepClone(this.options)); |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
BI.shortcut("demo.sidebar.item", Node); |
||||||
|
}()); |
@ -0,0 +1,85 @@ |
|||||||
|
/** |
||||||
|
*@desc 自定义的sidebar |
||||||
|
*@author dailer |
||||||
|
*@date 2018/12/25 |
||||||
|
*/ |
||||||
|
!(function () { |
||||||
|
var Widget = BI.inherit(BI.Widget, { |
||||||
|
|
||||||
|
props: { |
||||||
|
baseCls: "demo-sidebar" |
||||||
|
}, |
||||||
|
|
||||||
|
/** |
||||||
|
* 初始化目录根节点和管理系统节点 |
||||||
|
*/ |
||||||
|
beforeInit: function (render) { |
||||||
|
var self = this; |
||||||
|
this._initManagementModules(BI.emptyFn); |
||||||
|
this._initEntries(render); |
||||||
|
}, |
||||||
|
|
||||||
|
render: function () { |
||||||
|
var items = []; |
||||||
|
items.push({ |
||||||
|
el: { |
||||||
|
type: "demo.sidebar.item", |
||||||
|
cardType: "dec.dashboard", |
||||||
|
text: "仪表板", |
||||||
|
lgap: 10 |
||||||
|
} |
||||||
|
}); |
||||||
|
items.push({ |
||||||
|
el: { |
||||||
|
type: "bi.label", |
||||||
|
textAlign: "left", |
||||||
|
lgap: 10, |
||||||
|
height: 46, |
||||||
|
text: "目录" |
||||||
|
} |
||||||
|
}); |
||||||
|
items = BI.concat(items, this.rootEntries); |
||||||
|
items.push({ |
||||||
|
type: "demo.sidebar.expander", |
||||||
|
text: "管理系统", |
||||||
|
open: true, |
||||||
|
items: this.managementModules |
||||||
|
}); |
||||||
|
return { |
||||||
|
type: "bi.absolute", |
||||||
|
items: [ |
||||||
|
{ |
||||||
|
el: { |
||||||
|
type: "bi.vertical", |
||||||
|
items: items |
||||||
|
}, |
||||||
|
top: 10, left: 0, right: 0, bottom: 0 |
||||||
|
} |
||||||
|
] |
||||||
|
|
||||||
|
}; |
||||||
|
}, |
||||||
|
|
||||||
|
_initEntries: function (cb) { |
||||||
|
var self = this; |
||||||
|
Dec.Utils.getWorkbenchSubDirectoryById(DecCst.DIRECTORY_TREE_ROOT_ID, function (res) { |
||||||
|
self.rootEntries = BI.map(res.data, function (index, item) { |
||||||
|
return BI.extend({ |
||||||
|
type: "demo.sidebar.expander", |
||||||
|
items: item.children |
||||||
|
}, item); |
||||||
|
}); |
||||||
|
cb(); |
||||||
|
}); |
||||||
|
}, |
||||||
|
|
||||||
|
_initManagementModules: function (cb) { |
||||||
|
this.managementModules = BI.filter(BI.Constants.getConstant("dec.constant.management.navigation"), function (index, item) { |
||||||
|
return item.id !== "decision-management-maintenance"; |
||||||
|
}); |
||||||
|
cb(); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
BI.shortcut("demo.sidebar", Widget); |
||||||
|
}()); |
@ -0,0 +1,28 @@ |
|||||||
|
.demo-sidebar { |
||||||
|
background: #494299; |
||||||
|
color: #a1a1e5; |
||||||
|
font-size: 14px; |
||||||
|
border-radius: 10px; |
||||||
|
|
||||||
|
.platform-node-icon { |
||||||
|
.b-font { |
||||||
|
font-size: 35px; |
||||||
|
color: #a1a1e5; |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
.demo-sidebar-item { |
||||||
|
&.active { |
||||||
|
background-color: rgba(0, 255, 170, .25); |
||||||
|
color: #fff; |
||||||
|
border: 2px solid #00f9a6; |
||||||
|
border-radius: 8px; |
||||||
|
-webkit-box-shadow: 0 2px 12px 0 rgba(0, 255, 170, .25); |
||||||
|
box-shadow: 0 2px 12px 0 rgba(0, 255, 170, .25); |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
.demo-sidebar-expander-popup { |
||||||
|
background: #3d3780; |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,110 @@ |
|||||||
|
!(function () { |
||||||
|
var Node = BI.inherit(BI.NodeButton, { |
||||||
|
|
||||||
|
props: { |
||||||
|
baseCls: "demo-sidebar-node", |
||||||
|
id: "", |
||||||
|
pId: "", |
||||||
|
open: false, |
||||||
|
height: 42, |
||||||
|
iconCls: "dir-panel-folder-font" |
||||||
|
}, |
||||||
|
|
||||||
|
render: function () { |
||||||
|
|
||||||
|
var self = this, o = this.options; |
||||||
|
|
||||||
|
var arrow = { |
||||||
|
type: "bi.center_adapt", |
||||||
|
cls: "platform-node-arrow", |
||||||
|
items: [ |
||||||
|
{ |
||||||
|
el: { |
||||||
|
type: "bi.icon_change_button", |
||||||
|
ref: function (_ref) { |
||||||
|
self.arrow = _ref; |
||||||
|
}, |
||||||
|
iconCls: o.open ? "triangle-expand-font" : "triangle-collapse-font", |
||||||
|
height: 16, |
||||||
|
width: 16 |
||||||
|
} |
||||||
|
} |
||||||
|
] |
||||||
|
}; |
||||||
|
|
||||||
|
var icon = { |
||||||
|
type: "bi.center_adapt", |
||||||
|
height: o.height, |
||||||
|
cls: "platform-node-icon " + o.iconCls, |
||||||
|
items: [ |
||||||
|
{ |
||||||
|
type: "bi.icon", |
||||||
|
height: o.height, |
||||||
|
width: o.height |
||||||
|
} |
||||||
|
] |
||||||
|
}; |
||||||
|
|
||||||
|
var text = { |
||||||
|
type: "bi.htape", |
||||||
|
height: o.height, |
||||||
|
items: [ |
||||||
|
{ |
||||||
|
el: { |
||||||
|
type: "bi.label", |
||||||
|
height: o.height, |
||||||
|
textAlign: "left", |
||||||
|
text: o.text |
||||||
|
}, |
||||||
|
lgap: 5 |
||||||
|
} |
||||||
|
] |
||||||
|
}; |
||||||
|
|
||||||
|
var items = []; |
||||||
|
items.push({ |
||||||
|
type: "bi.layout", |
||||||
|
width: 10, |
||||||
|
height: o.height |
||||||
|
}); |
||||||
|
|
||||||
|
items.push({ |
||||||
|
el: icon, |
||||||
|
height: o.height, |
||||||
|
width: o.height |
||||||
|
}); |
||||||
|
|
||||||
|
items.push({ |
||||||
|
el: text, |
||||||
|
height: o.height |
||||||
|
}); |
||||||
|
items.push({ |
||||||
|
el: arrow, |
||||||
|
height: o.height, |
||||||
|
width: 16, |
||||||
|
rgap: 10 |
||||||
|
}); |
||||||
|
|
||||||
|
return { |
||||||
|
type: "bi.htape", |
||||||
|
items: items |
||||||
|
}; |
||||||
|
}, |
||||||
|
|
||||||
|
isOnce: function () { |
||||||
|
return false; |
||||||
|
}, |
||||||
|
|
||||||
|
getValue: function () { |
||||||
|
return this.options.id; |
||||||
|
}, |
||||||
|
|
||||||
|
setOpened: function (v) { |
||||||
|
Node.superclass.setOpened.apply(this, arguments); |
||||||
|
this.arrow.setIcon(v ? "triangle-expand-font" : "triangle-collapse-font"); |
||||||
|
this.fireEvent(v ? "EVENT_EXPAND" : "EVENT_COLLAPSE"); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
BI.shortcut("demo.sidebar.node", Node); |
||||||
|
}()); |
@ -0,0 +1,50 @@ |
|||||||
|
/* fine-decision-webui 19-01-03 12:02:26 */ |
||||||
|
.demo-background { |
||||||
|
background: #3d3780; |
||||||
|
} |
||||||
|
.dec-workbench-tabs { |
||||||
|
border-radius: 8px; |
||||||
|
overflow: hidden; |
||||||
|
} |
||||||
|
#wrapper.active { |
||||||
|
transform: perspective(0.5em) rotateX(25deg); |
||||||
|
transform-origin: bottom; |
||||||
|
} |
||||||
|
|
||||||
|
.demo-header { |
||||||
|
background: #494299; |
||||||
|
} |
||||||
|
.demo-header .demo-sidebar-trigger .b-font { |
||||||
|
color: #FFFFFF; |
||||||
|
font-size: 30px; |
||||||
|
} |
||||||
|
.demo-header .demo-search-button .b-font, |
||||||
|
.demo-header .favorite-font .b-font { |
||||||
|
color: #a1a1e5; |
||||||
|
} |
||||||
|
.demo-header .demo-title-text { |
||||||
|
color: #FFFFFF; |
||||||
|
font-size: 24px; |
||||||
|
} |
||||||
|
|
||||||
|
.demo-sidebar { |
||||||
|
background: #494299; |
||||||
|
color: #a1a1e5; |
||||||
|
font-size: 14px; |
||||||
|
border-radius: 10px; |
||||||
|
} |
||||||
|
.demo-sidebar .platform-node-icon .b-font { |
||||||
|
font-size: 35px; |
||||||
|
color: #a1a1e5; |
||||||
|
} |
||||||
|
.demo-sidebar .demo-sidebar-item.active { |
||||||
|
background-color: rgba(0, 255, 170, 0.25); |
||||||
|
color: #fff; |
||||||
|
border: 2px solid #00f9a6; |
||||||
|
border-radius: 8px; |
||||||
|
-webkit-box-shadow: 0 2px 12px 0 rgba(0, 255, 170, 0.25); |
||||||
|
box-shadow: 0 2px 12px 0 rgba(0, 255, 170, 0.25); |
||||||
|
} |
||||||
|
.demo-sidebar .demo-sidebar-expander-popup { |
||||||
|
background: #3d3780; |
||||||
|
} |
@ -0,0 +1,628 @@ |
|||||||
|
/** |
||||||
|
*@desc 自定义的header |
||||||
|
*@author dailer |
||||||
|
*@date 2018/12/25 |
||||||
|
*/ |
||||||
|
!(function () { |
||||||
|
BI.config("dec.header", function (config) { |
||||||
|
config.type = "demo.header"; |
||||||
|
return config; |
||||||
|
}); |
||||||
|
|
||||||
|
BI.config("dec.provider.layout", function (provider) { |
||||||
|
provider.setConfig({ |
||||||
|
type: "bi.absolute", |
||||||
|
cls: "demo-background", |
||||||
|
items: [ |
||||||
|
{ |
||||||
|
el: { |
||||||
|
type: "bi.absolute", |
||||||
|
items: [ |
||||||
|
{ |
||||||
|
el: { |
||||||
|
type: "dec.workbench.tabs", |
||||||
|
cls: "bi-background", |
||||||
|
showTabBar: false |
||||||
|
}, |
||||||
|
top: 0, bottom: 20, right: 20, |
||||||
|
left: 260 |
||||||
|
}, { |
||||||
|
el: { |
||||||
|
type: "demo.sidebar", |
||||||
|
width: 240 |
||||||
|
}, |
||||||
|
top: 0, bottom: 0, |
||||||
|
left: 0 |
||||||
|
} |
||||||
|
] |
||||||
|
}, |
||||||
|
top: 70, left: 0, right: 0, bottom: 0 |
||||||
|
}, { |
||||||
|
el: { |
||||||
|
type: "dec.header" |
||||||
|
}, |
||||||
|
height: 50, |
||||||
|
top: 0, left: 0, right: 0 |
||||||
|
} |
||||||
|
] |
||||||
|
}); |
||||||
|
return provider; |
||||||
|
}); |
||||||
|
}()); |
||||||
|
/** |
||||||
|
*@desc 自定义的header |
||||||
|
*@author dailer |
||||||
|
*@date 2018/12/25 |
||||||
|
*/ |
||||||
|
!(function () { |
||||||
|
var Widget = BI.inherit(BI.Widget, { |
||||||
|
|
||||||
|
props: { |
||||||
|
baseCls: "" |
||||||
|
}, |
||||||
|
|
||||||
|
render: function () { |
||||||
|
return { |
||||||
|
type: "bi.left_right_vertical_adapt", |
||||||
|
items: { |
||||||
|
left: [ |
||||||
|
{ |
||||||
|
el: { |
||||||
|
type: "bi.icon_button", |
||||||
|
width: 30, |
||||||
|
height: 30 |
||||||
|
} |
||||||
|
}, { |
||||||
|
el: { |
||||||
|
type: "bi.label", |
||||||
|
textAlign: "left", |
||||||
|
cls: "title-text", |
||||||
|
text: "ngx-admin" |
||||||
|
} |
||||||
|
} |
||||||
|
], |
||||||
|
right: [ |
||||||
|
{ |
||||||
|
el: { |
||||||
|
type: "bi.icon_button", |
||||||
|
width: 30, |
||||||
|
height: 30 |
||||||
|
} |
||||||
|
}, { |
||||||
|
el: { |
||||||
|
type: "dec.header.message" |
||||||
|
} |
||||||
|
}, { |
||||||
|
el: { |
||||||
|
type: "dec.account" |
||||||
|
} |
||||||
|
} |
||||||
|
] |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
BI.shortcut("demo.head11er", Widget); |
||||||
|
}()); |
||||||
|
/** |
||||||
|
*@desc 自定义的header |
||||||
|
*@author dailer |
||||||
|
*@date 2018/12/25 |
||||||
|
*/ |
||||||
|
!(function () { |
||||||
|
var Widget = BI.inherit(BI.Widget, { |
||||||
|
|
||||||
|
props: { |
||||||
|
baseCls: "demo-favorite" |
||||||
|
}, |
||||||
|
|
||||||
|
beforeInit: function (render) { |
||||||
|
var self = this; |
||||||
|
Dec.Utils.getFavoritesList(function (res) { |
||||||
|
self.items = res.data; |
||||||
|
render(); |
||||||
|
}); |
||||||
|
}, |
||||||
|
|
||||||
|
render: function () { |
||||||
|
var self = this; |
||||||
|
|
||||||
|
var trigger = { |
||||||
|
type: "bi.icon_button", |
||||||
|
cls: "favorite-font", |
||||||
|
handler: function () { |
||||||
|
|
||||||
|
} |
||||||
|
}; |
||||||
|
|
||||||
|
var popup = { |
||||||
|
type: "bi.button_group", |
||||||
|
layouts: [ |
||||||
|
{ |
||||||
|
type: "bi.vertical", |
||||||
|
vgap: 5 |
||||||
|
} |
||||||
|
], |
||||||
|
ref: function (_ref) { |
||||||
|
self.popup = _ref; |
||||||
|
}, |
||||||
|
items: this._createItems() |
||||||
|
}; |
||||||
|
|
||||||
|
return { |
||||||
|
type: "bi.combo", |
||||||
|
trigger: "click-hover", |
||||||
|
el: trigger, |
||||||
|
popup: { |
||||||
|
el: popup, |
||||||
|
cls: "demo-background", |
||||||
|
minWidth: 200 |
||||||
|
} |
||||||
|
}; |
||||||
|
}, |
||||||
|
|
||||||
|
_createItems: function () { |
||||||
|
var self = this; |
||||||
|
return BI.map(this.items, function (index, item) { |
||||||
|
return BI.extend(item, { |
||||||
|
type: "dec.workbench.panel.favorite.item", |
||||||
|
closeable: true, |
||||||
|
onClose: function () { |
||||||
|
self._unFavorite(item.id); |
||||||
|
}, |
||||||
|
handler: function () { |
||||||
|
self._openFavorite(item); |
||||||
|
} |
||||||
|
}); |
||||||
|
}); |
||||||
|
}, |
||||||
|
|
||||||
|
_openFavorite: function (item) { |
||||||
|
BI.Services.getService("dec.service.tabs").addItem(item); |
||||||
|
}, |
||||||
|
|
||||||
|
_unFavorite: function (id) { |
||||||
|
this.items = BI.filter(this.items, function (index, fav) { |
||||||
|
return fav.id !== id; |
||||||
|
}); |
||||||
|
this.popup.populate(this._createItems()); |
||||||
|
Dec.Utils.handlerCollect(id, false, BI.emptyFn); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
BI.shortcut("demo.favorite", Widget); |
||||||
|
}()); |
||||||
|
/** |
||||||
|
*@desc 自定义的header |
||||||
|
*@author dailer |
||||||
|
*@date 2018/12/25 |
||||||
|
*/ |
||||||
|
!(function () { |
||||||
|
var Widget = BI.inherit(BI.Widget, { |
||||||
|
|
||||||
|
props: { |
||||||
|
baseCls: "demo-header" |
||||||
|
}, |
||||||
|
|
||||||
|
render: function () { |
||||||
|
return { |
||||||
|
type: "bi.left_right_vertical_adapt", |
||||||
|
items: { |
||||||
|
left: [ |
||||||
|
{ |
||||||
|
el: { |
||||||
|
type: "bi.icon_button", |
||||||
|
cls: "directory-font demo-sidebar-trigger", |
||||||
|
width: 80, |
||||||
|
height: 35 |
||||||
|
} |
||||||
|
}, { |
||||||
|
el: { |
||||||
|
type: "bi.text_button", |
||||||
|
textAlign: "left", |
||||||
|
cls: "demo-title-text", |
||||||
|
text: "ngx-admin", |
||||||
|
handler: function () { |
||||||
|
BI.Services.getService("dec.service.tabs").openTab(-1); |
||||||
|
Dec.inactiveOthers(-1); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
], |
||||||
|
right: [ |
||||||
|
{ |
||||||
|
el: { |
||||||
|
type: "bi.icon_button", |
||||||
|
cls: "platform-search-font demo-search-button", |
||||||
|
width: 35, |
||||||
|
height: 30, |
||||||
|
handler: function () { |
||||||
|
$("#wrapper").addClass("active"); |
||||||
|
} |
||||||
|
} |
||||||
|
}, { |
||||||
|
el: { |
||||||
|
type: "demo.favorite", |
||||||
|
width: 35 |
||||||
|
} |
||||||
|
}, { |
||||||
|
el: { |
||||||
|
type: "dec.header.message" |
||||||
|
} |
||||||
|
}, { |
||||||
|
el: { |
||||||
|
type: "dec.account" |
||||||
|
} |
||||||
|
} |
||||||
|
] |
||||||
|
} |
||||||
|
}; |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
BI.shortcut("demo.header", Widget); |
||||||
|
}()); |
||||||
|
!(function () { |
||||||
|
var Node = BI.inherit(BI.BasicButton, { |
||||||
|
|
||||||
|
props: { |
||||||
|
baseCls: "demo-sidebar-expander", |
||||||
|
items: [], |
||||||
|
open: false |
||||||
|
}, |
||||||
|
|
||||||
|
render: function () { |
||||||
|
|
||||||
|
var self = this, o = this.options; |
||||||
|
|
||||||
|
|
||||||
|
var trigger = { |
||||||
|
type: "demo.sidebar.node", |
||||||
|
text: o.text, |
||||||
|
height: 42, |
||||||
|
open: o.open, |
||||||
|
iconCls: o.nodeIcon, |
||||||
|
listeners: [ |
||||||
|
{ |
||||||
|
eventName: "EVENT_EXPAND", |
||||||
|
action: function () { |
||||||
|
self.showView(); |
||||||
|
} |
||||||
|
}, { |
||||||
|
eventName: "EVENT_COLLAPSE", |
||||||
|
action: function () { |
||||||
|
self.popuop.setVisible(false); |
||||||
|
} |
||||||
|
} |
||||||
|
] |
||||||
|
}; |
||||||
|
|
||||||
|
var items = BI.createItems(o.items, { |
||||||
|
type: "demo.sidebar.item", |
||||||
|
lgap: 30, |
||||||
|
height: 36 |
||||||
|
}); |
||||||
|
return { |
||||||
|
type: "bi.vertical", |
||||||
|
items: [ |
||||||
|
{ |
||||||
|
el: trigger |
||||||
|
}, { |
||||||
|
el: { |
||||||
|
type: "bi.button_group", |
||||||
|
cls: "demo-sidebar-expander-popup", |
||||||
|
layouts: [ |
||||||
|
{ |
||||||
|
type: "bi.vertical" |
||||||
|
} |
||||||
|
], |
||||||
|
ref: function (_ref) { |
||||||
|
self.popuop = _ref; |
||||||
|
}, |
||||||
|
invisible: !o.open, |
||||||
|
items: items |
||||||
|
} |
||||||
|
} |
||||||
|
] |
||||||
|
|
||||||
|
}; |
||||||
|
}, |
||||||
|
|
||||||
|
showView: function () { |
||||||
|
var self = this, o = this.options; |
||||||
|
if (BI.isEmptyArray(o.items)) { |
||||||
|
Dec.Utils.getWorkbenchSubDirectoryById(o.id, function (res) { |
||||||
|
o.items = BI.map(res.data, function (index, item) { |
||||||
|
return BI.extend({ |
||||||
|
type: "demo.sidebar.item", |
||||||
|
lgap: 30 |
||||||
|
}, item); |
||||||
|
}); |
||||||
|
self.popuop.populate(o.items); |
||||||
|
self.popuop.setVisible(true); |
||||||
|
}); |
||||||
|
} else { |
||||||
|
self.popuop.setVisible(true); |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
BI.shortcut("demo.sidebar.expander", Node); |
||||||
|
}()); |
||||||
|
!(function () { |
||||||
|
var itemStorage = {}; |
||||||
|
|
||||||
|
Dec.inactiveOthers = function (id) { |
||||||
|
BI.each(itemStorage, function (key, widget) { |
||||||
|
widget.options.id !== id && widget.setSelected(false); |
||||||
|
}); |
||||||
|
}; |
||||||
|
|
||||||
|
var Node = BI.inherit(BI.BasicButton, { |
||||||
|
|
||||||
|
props: { |
||||||
|
baseCls: "demo-sidebar-item", |
||||||
|
id: "", |
||||||
|
pId: "", |
||||||
|
open: false, |
||||||
|
height: 35, |
||||||
|
iconCls: "dir-panel-folder-font" |
||||||
|
}, |
||||||
|
|
||||||
|
mounted: function () { |
||||||
|
itemStorage[this.options.id] = this; |
||||||
|
}, |
||||||
|
|
||||||
|
render: function () { |
||||||
|
|
||||||
|
var self = this, o = this.options; |
||||||
|
|
||||||
|
|
||||||
|
var text = { |
||||||
|
type: "bi.label", |
||||||
|
height: o.height, |
||||||
|
textAlign: "left", |
||||||
|
text: o.text, |
||||||
|
title: o.text |
||||||
|
}; |
||||||
|
|
||||||
|
var items = []; |
||||||
|
|
||||||
|
items.push({ |
||||||
|
el: text, |
||||||
|
height: o.height |
||||||
|
}); |
||||||
|
return { |
||||||
|
type: "bi.vertical_adapt", |
||||||
|
lgap: o.lgap, |
||||||
|
items: [ |
||||||
|
{ |
||||||
|
type: "bi.label", |
||||||
|
textAlign: "left", |
||||||
|
text: o.text, |
||||||
|
title: o.text |
||||||
|
} |
||||||
|
] |
||||||
|
}; |
||||||
|
}, |
||||||
|
|
||||||
|
isOnce: function () { |
||||||
|
return true; |
||||||
|
}, |
||||||
|
|
||||||
|
getValue: function () { |
||||||
|
return this.options.id; |
||||||
|
}, |
||||||
|
|
||||||
|
doClick: function () { |
||||||
|
var self = this; |
||||||
|
Dec.inactiveOthers(this.options.id); |
||||||
|
var module = BI.find(BI.Constants.getConstant("dec.constant.management.navigation"), function (index, item) { |
||||||
|
return item.value === self.options.id; |
||||||
|
}); |
||||||
|
if (module) { |
||||||
|
BI.Services.getService("dec.service.tabs").addItem(module); |
||||||
|
} else { |
||||||
|
BI.Services.getService("dec.service.tabs").addItem(BI.deepClone(this.options)); |
||||||
|
} |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
BI.shortcut("demo.sidebar.item", Node); |
||||||
|
}()); |
||||||
|
/** |
||||||
|
*@desc 自定义的sidebar |
||||||
|
*@author dailer |
||||||
|
*@date 2018/12/25 |
||||||
|
*/ |
||||||
|
!(function () { |
||||||
|
var Widget = BI.inherit(BI.Widget, { |
||||||
|
|
||||||
|
props: { |
||||||
|
baseCls: "demo-sidebar" |
||||||
|
}, |
||||||
|
|
||||||
|
/** |
||||||
|
* 初始化目录根节点和管理系统节点 |
||||||
|
*/ |
||||||
|
beforeInit: function (render) { |
||||||
|
var self = this; |
||||||
|
this._initManagementModules(BI.emptyFn); |
||||||
|
this._initEntries(render); |
||||||
|
}, |
||||||
|
|
||||||
|
render: function () { |
||||||
|
var items = []; |
||||||
|
items.push({ |
||||||
|
el: { |
||||||
|
type: "demo.sidebar.item", |
||||||
|
cardType: "dec.dashboard", |
||||||
|
text: "仪表板", |
||||||
|
lgap: 10 |
||||||
|
} |
||||||
|
}); |
||||||
|
items.push({ |
||||||
|
el: { |
||||||
|
type: "bi.label", |
||||||
|
textAlign: "left", |
||||||
|
lgap: 10, |
||||||
|
height: 46, |
||||||
|
text: "目录" |
||||||
|
} |
||||||
|
}); |
||||||
|
items = BI.concat(items, this.rootEntries); |
||||||
|
items.push({ |
||||||
|
type: "demo.sidebar.expander", |
||||||
|
text: "管理系统", |
||||||
|
open: true, |
||||||
|
items: this.managementModules |
||||||
|
}); |
||||||
|
return { |
||||||
|
type: "bi.absolute", |
||||||
|
items: [ |
||||||
|
{ |
||||||
|
el: { |
||||||
|
type: "bi.vertical", |
||||||
|
items: items |
||||||
|
}, |
||||||
|
top: 10, left: 0, right: 0, bottom: 0 |
||||||
|
} |
||||||
|
] |
||||||
|
|
||||||
|
}; |
||||||
|
}, |
||||||
|
|
||||||
|
_initEntries: function (cb) { |
||||||
|
var self = this; |
||||||
|
Dec.Utils.getWorkbenchSubDirectoryById(DecCst.DIRECTORY_TREE_ROOT_ID, function (res) { |
||||||
|
self.rootEntries = BI.map(res.data, function (index, item) { |
||||||
|
return BI.extend({ |
||||||
|
type: "demo.sidebar.expander", |
||||||
|
items: item.children |
||||||
|
}, item); |
||||||
|
}); |
||||||
|
cb(); |
||||||
|
}); |
||||||
|
}, |
||||||
|
|
||||||
|
_initManagementModules: function (cb) { |
||||||
|
this.managementModules = BI.filter(BI.Constants.getConstant("dec.constant.management.navigation"), function (index, item) { |
||||||
|
return item.id !== "decision-management-maintenance"; |
||||||
|
}); |
||||||
|
cb(); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
BI.shortcut("demo.sidebar", Widget); |
||||||
|
}()); |
||||||
|
!(function () { |
||||||
|
var Node = BI.inherit(BI.NodeButton, { |
||||||
|
|
||||||
|
props: { |
||||||
|
baseCls: "demo-sidebar-node", |
||||||
|
id: "", |
||||||
|
pId: "", |
||||||
|
open: false, |
||||||
|
height: 42, |
||||||
|
iconCls: "dir-panel-folder-font" |
||||||
|
}, |
||||||
|
|
||||||
|
render: function () { |
||||||
|
|
||||||
|
var self = this, o = this.options; |
||||||
|
|
||||||
|
var arrow = { |
||||||
|
type: "bi.center_adapt", |
||||||
|
cls: "platform-node-arrow", |
||||||
|
items: [ |
||||||
|
{ |
||||||
|
el: { |
||||||
|
type: "bi.icon_change_button", |
||||||
|
ref: function (_ref) { |
||||||
|
self.arrow = _ref; |
||||||
|
}, |
||||||
|
iconCls: o.open ? "triangle-expand-font" : "triangle-collapse-font", |
||||||
|
height: 16, |
||||||
|
width: 16 |
||||||
|
} |
||||||
|
} |
||||||
|
] |
||||||
|
}; |
||||||
|
|
||||||
|
var icon = { |
||||||
|
type: "bi.center_adapt", |
||||||
|
height: o.height, |
||||||
|
cls: "platform-node-icon " + o.iconCls, |
||||||
|
items: [ |
||||||
|
{ |
||||||
|
type: "bi.icon", |
||||||
|
height: o.height, |
||||||
|
width: o.height |
||||||
|
} |
||||||
|
] |
||||||
|
}; |
||||||
|
|
||||||
|
var text = { |
||||||
|
type: "bi.htape", |
||||||
|
height: o.height, |
||||||
|
items: [ |
||||||
|
{ |
||||||
|
el: { |
||||||
|
type: "bi.label", |
||||||
|
height: o.height, |
||||||
|
textAlign: "left", |
||||||
|
text: o.text |
||||||
|
}, |
||||||
|
lgap: 5 |
||||||
|
} |
||||||
|
] |
||||||
|
}; |
||||||
|
|
||||||
|
var items = []; |
||||||
|
items.push({ |
||||||
|
type: "bi.layout", |
||||||
|
width: 10, |
||||||
|
height: o.height |
||||||
|
}); |
||||||
|
|
||||||
|
items.push({ |
||||||
|
el: icon, |
||||||
|
height: o.height, |
||||||
|
width: o.height |
||||||
|
}); |
||||||
|
|
||||||
|
items.push({ |
||||||
|
el: text, |
||||||
|
height: o.height |
||||||
|
}); |
||||||
|
items.push({ |
||||||
|
el: arrow, |
||||||
|
height: o.height, |
||||||
|
width: 16, |
||||||
|
rgap: 10 |
||||||
|
}); |
||||||
|
|
||||||
|
return { |
||||||
|
type: "bi.htape", |
||||||
|
items: items |
||||||
|
}; |
||||||
|
}, |
||||||
|
|
||||||
|
isOnce: function () { |
||||||
|
return false; |
||||||
|
}, |
||||||
|
|
||||||
|
getValue: function () { |
||||||
|
return this.options.id; |
||||||
|
}, |
||||||
|
|
||||||
|
setOpened: function (v) { |
||||||
|
Node.superclass.setOpened.apply(this, arguments); |
||||||
|
this.arrow.setIcon(v ? "triangle-expand-font" : "triangle-collapse-font"); |
||||||
|
this.fireEvent(v ? "EVENT_EXPAND" : "EVENT_COLLAPSE"); |
||||||
|
} |
||||||
|
}); |
||||||
|
|
||||||
|
BI.shortcut("demo.sidebar.node", Node); |
||||||
|
}()); |
@ -1,97 +0,0 @@ |
|||||||
!(function () { |
|
||||||
var Nav = BI.inherit(BI.Widget, { |
|
||||||
|
|
||||||
props: { |
|
||||||
baseCls: "dec-management-nav dec-popover", |
|
||||||
pinedPane: false |
|
||||||
}, |
|
||||||
|
|
||||||
_store: function () { |
|
||||||
return BI.Models.getModel("dec.model.modules"); |
|
||||||
}, |
|
||||||
|
|
||||||
watch: { |
|
||||||
selectedManageNav: function (v) { |
|
||||||
this.tree.setValue(v); |
|
||||||
}, |
|
||||||
items: function () { |
|
||||||
this.populate(this.model.items); |
|
||||||
} |
|
||||||
}, |
|
||||||
|
|
||||||
beforeInit: function (render) { |
|
||||||
this.store.initData(render); |
|
||||||
}, |
|
||||||
|
|
||||||
render: function () { |
|
||||||
var self = this, o = this.options; |
|
||||||
return { |
|
||||||
type: "bi.vertical", |
|
||||||
hgap: 10, |
|
||||||
items: [ |
|
||||||
{ |
|
||||||
type: "bi.custom_tree", |
|
||||||
cls: "dec-text", |
|
||||||
ref: function (_ref) { |
|
||||||
self.tree = _ref; |
|
||||||
}, |
|
||||||
el: { |
|
||||||
type: "bi.loader", |
|
||||||
next: false, |
|
||||||
el: { |
|
||||||
type: "bi.button_tree", |
|
||||||
chooseType: 0, |
|
||||||
layouts: [{ |
|
||||||
type: "bi.vertical", |
|
||||||
vgap: 5 |
|
||||||
}] |
|
||||||
} |
|
||||||
}, |
|
||||||
listeners: [{ |
|
||||||
eventName: "EVENT_CHANGE", |
|
||||||
action: function () { |
|
||||||
self.store.openTab(this.getValue()[0]); |
|
||||||
} |
|
||||||
}], |
|
||||||
itemsCreator: function (op, callback) { |
|
||||||
if (!op.node) { |
|
||||||
self.store.initRootNodes(function (items) { |
|
||||||
callback(items); |
|
||||||
}); |
|
||||||
} else { |
|
||||||
self.store.getSubItemsByPId(op.node.id, op.node.layer + 1, function (items) { |
|
||||||
callback(items); |
|
||||||
}); |
|
||||||
} |
|
||||||
}, |
|
||||||
items: this._formatItems(this.model.items, 0) |
|
||||||
} |
|
||||||
] |
|
||||||
}; |
|
||||||
}, |
|
||||||
|
|
||||||
// 解析层级结构的树数据.即带有children字段的
|
|
||||||
_formatItems: function (nodes, layer) { |
|
||||||
var self = this; |
|
||||||
BI.each(nodes, function (i, node) { |
|
||||||
var extend = {layer: layer}; |
|
||||||
if (node.isParent === true || BI.isNotEmptyArray(node.children)) { |
|
||||||
extend.type = "dec.nav.node"; |
|
||||||
BI.defaults(node, extend); |
|
||||||
self._formatItems(node.children, layer + 1); |
|
||||||
} else { |
|
||||||
extend.type = "dec.nav.item"; |
|
||||||
BI.defaults(node, extend); |
|
||||||
} |
|
||||||
}); |
|
||||||
return nodes; |
|
||||||
}, |
|
||||||
|
|
||||||
populate: function (nodes) { |
|
||||||
nodes = this._formatItems(nodes, 0); |
|
||||||
this.tree.populate(nodes); |
|
||||||
} |
|
||||||
}); |
|
||||||
Nav.EVENT_VALUE_CHANGE = "EVENT_VALUE_CHANGE"; |
|
||||||
BI.shortcut("my.theme.directory", Nav); |
|
||||||
}()); |
|
@ -1,141 +0,0 @@ |
|||||||
(function () { |
|
||||||
var Model = BI.inherit(Fix.Model, { |
|
||||||
_init: function () { |
|
||||||
this.platform = Dec.globleModel; |
|
||||||
}, |
|
||||||
|
|
||||||
state: function () { |
|
||||||
return { |
|
||||||
modules: [], |
|
||||||
reports: [] |
|
||||||
}; |
|
||||||
}, |
|
||||||
|
|
||||||
context: ["isPin"], |
|
||||||
|
|
||||||
computed: { |
|
||||||
selectedManageNav: function () { |
|
||||||
return this.platform.selectedManageNav; |
|
||||||
}, |
|
||||||
items: function () { |
|
||||||
var self = this; |
|
||||||
var constant = BI.Constants.getConstant("dec.constant.management.navigation"); |
|
||||||
var results = []; |
|
||||||
|
|
||||||
results = BI.concat(results, this.model.reports); |
|
||||||
|
|
||||||
results.push({ |
|
||||||
id: "decision-management-root", |
|
||||||
value: "decision-management-root", |
|
||||||
isParent: true, |
|
||||||
open: true, |
|
||||||
cls: "setting-font", |
|
||||||
text: BI.i18nText("Dec-Authority_PlatformModule") |
|
||||||
}); |
|
||||||
|
|
||||||
BI.each(constant, function (index, item) { |
|
||||||
var match = BI.find(self.model.modules, function (index, i) { |
|
||||||
return item.id === i.id; |
|
||||||
}); |
|
||||||
if (match) { |
|
||||||
results.push(BI.extend({}, match, item)); |
|
||||||
} |
|
||||||
}); |
|
||||||
|
|
||||||
|
|
||||||
BI.each(results, function (index, item) { |
|
||||||
if (item.value === self.platform.selectedManageNav && (item.pId === "decision-management-maintenance")) { |
|
||||||
BI.some(results, function (index, i) { |
|
||||||
if (i.id === "decision-management-maintenance") { |
|
||||||
i.open = true; |
|
||||||
return true; |
|
||||||
} |
|
||||||
}); |
|
||||||
} |
|
||||||
if (item.value === self.model.selectedManageNav) { |
|
||||||
item.selected = true; |
|
||||||
} |
|
||||||
if (!item.pId) { |
|
||||||
item.pId = "management"; |
|
||||||
} |
|
||||||
}); |
|
||||||
BI.each(constant, function (index, item) { |
|
||||||
if (item.dev) { |
|
||||||
results.push(BI.extend({}, item)); |
|
||||||
} |
|
||||||
}); |
|
||||||
return BI.Tree.transformToTreeFormat(results); |
|
||||||
} |
|
||||||
}, |
|
||||||
actions: { |
|
||||||
initData: function (callback) { |
|
||||||
this.initDecisionModules(); |
|
||||||
this.initReports(callback); |
|
||||||
}, |
|
||||||
|
|
||||||
initDecisionModules: function () { |
|
||||||
var self = this; |
|
||||||
Dec.Plugin.getManagementModules(function (modules) { |
|
||||||
self.model.modules = modules; |
|
||||||
}); |
|
||||||
}, |
|
||||||
|
|
||||||
initReports: function (callback) { |
|
||||||
var self = this; |
|
||||||
Dec.Utils.getWorkbenchSubDirectoryById(DecCst.DIRECTORY_TREE_ROOT_ID, function (res) { |
|
||||||
self.model.reports = self._formatReportItems(res.data); |
|
||||||
callback(); |
|
||||||
}); |
|
||||||
}, |
|
||||||
|
|
||||||
getSubItemsByPId: function (pId, layer, callback) { |
|
||||||
var self = this; |
|
||||||
Dec.Plugin.getEntriesByPid(pId, function (res) { |
|
||||||
BI.some(self.model.reports, function (index, item) { |
|
||||||
if (item.id === pId) { |
|
||||||
item.open = true; |
|
||||||
return true; |
|
||||||
} |
|
||||||
}); |
|
||||||
self.model.reports = self.model.reports.concat(self._formatReportItems(res.data)); |
|
||||||
}); |
|
||||||
}, |
|
||||||
|
|
||||||
openTab: function (tab) { |
|
||||||
var module = BI.find(BI.Constants.getConstant("dec.constant.management.navigation"), function (index, item) { |
|
||||||
return item.value === tab; |
|
||||||
}); |
|
||||||
var report = BI.find(this.model.reports, function (index, item) { |
|
||||||
return item.value === tab; |
|
||||||
}); |
|
||||||
if (module) { |
|
||||||
// Dec.Plugin.tabPane.addItem(card.text, card.value, card.cardType);
|
|
||||||
BI.Services.getService("dec.service.tabs").addItem(module); |
|
||||||
} else { |
|
||||||
BI.Services.getService("dec.service.tabs").addItem(report); |
|
||||||
// this._openReports(tab);
|
|
||||||
} |
|
||||||
} |
|
||||||
}, |
|
||||||
|
|
||||||
_formatReportItems: function (nodes) { |
|
||||||
var self = this; |
|
||||||
var iconClsMap = BI.Constants.getConstant("dec.constant.look.icons.map"); |
|
||||||
var temps = BI.deepClone(nodes); |
|
||||||
BI.each(temps, function (i, node) { |
|
||||||
var extend = { |
|
||||||
value: node.id |
|
||||||
}; |
|
||||||
var cls = iconClsMap[node.nodeIcon]; |
|
||||||
if (cls) { |
|
||||||
extend.iconCls = cls; |
|
||||||
} else { |
|
||||||
extend.iconCls = node.isParent ? "dir-panel-folder-font" : "dir-panel-template-font"; |
|
||||||
} |
|
||||||
BI.defaults(node, extend); |
|
||||||
}); |
|
||||||
return temps; |
|
||||||
} |
|
||||||
}); |
|
||||||
BI.model("dec.model.modules", Model); |
|
||||||
}()); |
|
@ -1,290 +0,0 @@ |
|||||||
/*! fine-decision-webui 2018-10-14 15:29:23 */ |
|
||||||
!(function () { |
|
||||||
|
|
||||||
BI.config("dec.constant.config", function (config) { |
|
||||||
config.config4Frame.west.width = 240; |
|
||||||
config.config4EntryPane.pinable = false; |
|
||||||
return config; |
|
||||||
}); |
|
||||||
|
|
||||||
|
|
||||||
BI.config("dec.provider.layout", function (provider) { |
|
||||||
provider.setConfig({ |
|
||||||
type: "bi.absolute", |
|
||||||
items: [ |
|
||||||
{ |
|
||||||
el: { |
|
||||||
type: "bi.absolute", |
|
||||||
items: [ |
|
||||||
{ |
|
||||||
el: { |
|
||||||
type: "dec.workbench.tabs" |
|
||||||
}, |
|
||||||
top: 0, bottom: 0, right: 0, |
|
||||||
left: 240 |
|
||||||
}, { |
|
||||||
el: { |
|
||||||
type: "dec.workbench.panel", |
|
||||||
width: 240 |
|
||||||
}, |
|
||||||
top: 0, bottom: 0, |
|
||||||
left: 0 |
|
||||||
} |
|
||||||
] |
|
||||||
}, |
|
||||||
top: 40, left: 0, right: 0, bottom: 0 |
|
||||||
}, { |
|
||||||
el: { |
|
||||||
type: "dec.header" |
|
||||||
}, |
|
||||||
height: 40, |
|
||||||
top: 0, left: 0, right: 0 |
|
||||||
} |
|
||||||
] |
|
||||||
}); |
|
||||||
return provider; |
|
||||||
}); |
|
||||||
|
|
||||||
BI.config("dec.workbench.panel", function (config) { |
|
||||||
config.type = "my.theme.directory"; |
|
||||||
return config; |
|
||||||
}); |
|
||||||
}()); |
|
||||||
!(function () { |
|
||||||
var Nav = BI.inherit(BI.Widget, { |
|
||||||
|
|
||||||
props: { |
|
||||||
baseCls: "dec-management-nav dec-popover", |
|
||||||
pinedPane: false |
|
||||||
}, |
|
||||||
|
|
||||||
_store: function () { |
|
||||||
return BI.Models.getModel("dec.model.modules"); |
|
||||||
}, |
|
||||||
|
|
||||||
watch: { |
|
||||||
selectedManageNav: function (v) { |
|
||||||
this.tree.setValue(v); |
|
||||||
}, |
|
||||||
items: function () { |
|
||||||
this.populate(this.model.items); |
|
||||||
} |
|
||||||
}, |
|
||||||
|
|
||||||
beforeInit: function (render) { |
|
||||||
this.store.initData(render); |
|
||||||
}, |
|
||||||
|
|
||||||
render: function () { |
|
||||||
var self = this, o = this.options; |
|
||||||
return { |
|
||||||
type: "bi.vertical", |
|
||||||
hgap: 10, |
|
||||||
items: [ |
|
||||||
{ |
|
||||||
type: "bi.custom_tree", |
|
||||||
cls: "dec-text", |
|
||||||
ref: function (_ref) { |
|
||||||
self.tree = _ref; |
|
||||||
}, |
|
||||||
el: { |
|
||||||
type: "bi.loader", |
|
||||||
next: false, |
|
||||||
el: { |
|
||||||
type: "bi.button_tree", |
|
||||||
chooseType: 0, |
|
||||||
layouts: [{ |
|
||||||
type: "bi.vertical", |
|
||||||
vgap: 5 |
|
||||||
}] |
|
||||||
} |
|
||||||
}, |
|
||||||
listeners: [{ |
|
||||||
eventName: "EVENT_CHANGE", |
|
||||||
action: function () { |
|
||||||
self.store.openTab(this.getValue()[0]); |
|
||||||
} |
|
||||||
}], |
|
||||||
itemsCreator: function (op, callback) { |
|
||||||
if (!op.node) { |
|
||||||
self.store.initRootNodes(function (items) { |
|
||||||
callback(items); |
|
||||||
}); |
|
||||||
} else { |
|
||||||
self.store.getSubItemsByPId(op.node.id, op.node.layer + 1, function (items) { |
|
||||||
callback(items); |
|
||||||
}); |
|
||||||
} |
|
||||||
}, |
|
||||||
items: this._formatItems(this.model.items, 0) |
|
||||||
} |
|
||||||
] |
|
||||||
}; |
|
||||||
}, |
|
||||||
|
|
||||||
// 解析层级结构的树数据.即带有children字段的
|
|
||||||
_formatItems: function (nodes, layer) { |
|
||||||
var self = this; |
|
||||||
BI.each(nodes, function (i, node) { |
|
||||||
var extend = {layer: layer}; |
|
||||||
if (node.isParent === true || BI.isNotEmptyArray(node.children)) { |
|
||||||
extend.type = "dec.nav.node"; |
|
||||||
BI.defaults(node, extend); |
|
||||||
self._formatItems(node.children, layer + 1); |
|
||||||
} else { |
|
||||||
extend.type = "dec.nav.item"; |
|
||||||
BI.defaults(node, extend); |
|
||||||
} |
|
||||||
}); |
|
||||||
return nodes; |
|
||||||
}, |
|
||||||
|
|
||||||
populate: function (nodes) { |
|
||||||
nodes = this._formatItems(nodes, 0); |
|
||||||
this.tree.populate(nodes); |
|
||||||
} |
|
||||||
}); |
|
||||||
Nav.EVENT_VALUE_CHANGE = "EVENT_VALUE_CHANGE"; |
|
||||||
BI.shortcut("my.theme.directory", Nav); |
|
||||||
}()); |
|
||||||
(function () { |
|
||||||
var Model = BI.inherit(Fix.Model, { |
|
||||||
_init: function () { |
|
||||||
this.platform = Dec.globleModel; |
|
||||||
}, |
|
||||||
|
|
||||||
state: function () { |
|
||||||
return { |
|
||||||
modules: [], |
|
||||||
reports: [] |
|
||||||
}; |
|
||||||
}, |
|
||||||
|
|
||||||
context: ["isPin"], |
|
||||||
|
|
||||||
computed: { |
|
||||||
selectedManageNav: function () { |
|
||||||
return this.platform.selectedManageNav; |
|
||||||
}, |
|
||||||
items: function () { |
|
||||||
var self = this; |
|
||||||
var constant = BI.Constants.getConstant("dec.constant.management.navigation"); |
|
||||||
var results = []; |
|
||||||
|
|
||||||
results = BI.concat(results, this.model.reports); |
|
||||||
|
|
||||||
results.push({ |
|
||||||
id: "decision-management-root", |
|
||||||
value: "decision-management-root", |
|
||||||
isParent: true, |
|
||||||
open: true, |
|
||||||
cls: "setting-font", |
|
||||||
text: BI.i18nText("Dec-Authority_PlatformModule") |
|
||||||
}); |
|
||||||
|
|
||||||
BI.each(constant, function (index, item) { |
|
||||||
var match = BI.find(self.model.modules, function (index, i) { |
|
||||||
return item.id === i.id; |
|
||||||
}); |
|
||||||
if (match) { |
|
||||||
results.push(BI.extend({}, match, item)); |
|
||||||
} |
|
||||||
}); |
|
||||||
|
|
||||||
|
|
||||||
BI.each(results, function (index, item) { |
|
||||||
if (item.value === self.platform.selectedManageNav && (item.pId === "decision-management-maintenance")) { |
|
||||||
BI.some(results, function (index, i) { |
|
||||||
if (i.id === "decision-management-maintenance") { |
|
||||||
i.open = true; |
|
||||||
return true; |
|
||||||
} |
|
||||||
}); |
|
||||||
} |
|
||||||
if (item.value === self.model.selectedManageNav) { |
|
||||||
item.selected = true; |
|
||||||
} |
|
||||||
if (!item.pId) { |
|
||||||
item.pId = "management"; |
|
||||||
} |
|
||||||
}); |
|
||||||
BI.each(constant, function (index, item) { |
|
||||||
if (item.dev) { |
|
||||||
results.push(BI.extend({}, item)); |
|
||||||
} |
|
||||||
}); |
|
||||||
return BI.Tree.transformToTreeFormat(results); |
|
||||||
} |
|
||||||
}, |
|
||||||
actions: { |
|
||||||
initData: function (callback) { |
|
||||||
this.initDecisionModules(); |
|
||||||
this.initReports(callback); |
|
||||||
}, |
|
||||||
|
|
||||||
initDecisionModules: function () { |
|
||||||
var self = this; |
|
||||||
Dec.Plugin.getManagementModules(function (modules) { |
|
||||||
self.model.modules = modules; |
|
||||||
}); |
|
||||||
}, |
|
||||||
|
|
||||||
initReports: function (callback) { |
|
||||||
var self = this; |
|
||||||
Dec.Utils.getWorkbenchSubDirectoryById(DecCst.DIRECTORY_TREE_ROOT_ID, function (res) { |
|
||||||
self.model.reports = self._formatReportItems(res.data); |
|
||||||
callback(); |
|
||||||
}); |
|
||||||
}, |
|
||||||
|
|
||||||
getSubItemsByPId: function (pId, layer, callback) { |
|
||||||
var self = this; |
|
||||||
Dec.Plugin.getEntriesByPid(pId, function (res) { |
|
||||||
BI.some(self.model.reports, function (index, item) { |
|
||||||
if (item.id === pId) { |
|
||||||
item.open = true; |
|
||||||
return true; |
|
||||||
} |
|
||||||
}); |
|
||||||
self.model.reports = self.model.reports.concat(self._formatReportItems(res.data)); |
|
||||||
}); |
|
||||||
}, |
|
||||||
|
|
||||||
openTab: function (tab) { |
|
||||||
var module = BI.find(BI.Constants.getConstant("dec.constant.management.navigation"), function (index, item) { |
|
||||||
return item.value === tab; |
|
||||||
}); |
|
||||||
var report = BI.find(this.model.reports, function (index, item) { |
|
||||||
return item.value === tab; |
|
||||||
}); |
|
||||||
if (module) { |
|
||||||
// Dec.Plugin.tabPane.addItem(card.text, card.value, card.cardType);
|
|
||||||
BI.Services.getService("dec.service.tabs").addItem(module); |
|
||||||
} else { |
|
||||||
BI.Services.getService("dec.service.tabs").addItem(report); |
|
||||||
// this._openReports(tab);
|
|
||||||
} |
|
||||||
} |
|
||||||
}, |
|
||||||
|
|
||||||
_formatReportItems: function (nodes) { |
|
||||||
var self = this; |
|
||||||
var iconClsMap = BI.Constants.getConstant("dec.constant.look.icons.map"); |
|
||||||
var temps = BI.deepClone(nodes); |
|
||||||
BI.each(temps, function (i, node) { |
|
||||||
var extend = { |
|
||||||
value: node.id |
|
||||||
}; |
|
||||||
var cls = iconClsMap[node.nodeIcon]; |
|
||||||
if (cls) { |
|
||||||
extend.iconCls = cls; |
|
||||||
} else { |
|
||||||
extend.iconCls = node.isParent ? "dir-panel-folder-font" : "dir-panel-template-font"; |
|
||||||
} |
|
||||||
BI.defaults(node, extend); |
|
||||||
}); |
|
||||||
return temps; |
|
||||||
} |
|
||||||
}); |
|
||||||
BI.model("dec.model.modules", Model); |
|
||||||
}()); |
|
Loading…
Reference in new issue