Browse Source

先实现功能.待补全样式

master
dailer 5 years ago
parent
commit
278a981adb
  1. 4
      README.md
  2. 6
      build.xml
  3. 11
      plugin.xml
  4. 6
      pom.xml
  5. BIN
      screenshots/theme.gif
  6. BIN
      screenshots/theme.png
  7. 14
      src/main/java/com/fr/plugin/theme/ngx/NgxComponent.java
  8. 14
      src/main/java/com/fr/plugin/theme/ngx/NgxTheme.java
  9. 0
      src/main/resources/com/fr/plugin/theme/ngx/web/demo.png
  10. 36
      src/main/resources/com/fr/plugin/theme/ngx/web/js/config.js
  11. 88
      src/main/resources/com/fr/plugin/theme/ngx/web/js/header/favorite.js
  12. 70
      src/main/resources/com/fr/plugin/theme/ngx/web/js/header/header.js
  13. 17
      src/main/resources/com/fr/plugin/theme/ngx/web/js/header/header.less
  14. 13
      src/main/resources/com/fr/plugin/theme/ngx/web/js/index.less
  15. 56
      src/main/resources/com/fr/plugin/theme/ngx/web/js/main.js
  16. 87
      src/main/resources/com/fr/plugin/theme/ngx/web/js/sidebar/sidebar.expander.js
  17. 81
      src/main/resources/com/fr/plugin/theme/ngx/web/js/sidebar/sidebar.item.js
  18. 85
      src/main/resources/com/fr/plugin/theme/ngx/web/js/sidebar/sidebar.js
  19. 28
      src/main/resources/com/fr/plugin/theme/ngx/web/js/sidebar/sidebar.less
  20. 110
      src/main/resources/com/fr/plugin/theme/ngx/web/js/sidebar/sidebar.node.js
  21. 50
      src/main/resources/com/fr/plugin/theme/ngx/web/style.css
  22. 628
      src/main/resources/com/fr/plugin/theme/ngx/web/theme.js
  23. 97
      src/main/resources/com/fr/plugin/theme/original/web/js/modules.js
  24. 141
      src/main/resources/com/fr/plugin/theme/original/web/js/modules.model.js
  25. 0
      src/main/resources/com/fr/plugin/theme/original/web/style.css
  26. 290
      src/main/resources/com/fr/plugin/theme/original/web/theme.js

4
README.md

@ -1,5 +1,5 @@
# demo-theme-original
# demo-theme-ngx
主题插件示例效果图
![style](screenshots/theme.png)
![style](screenshots/theme.gif)

6
build.xml

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project basedir="." default="jar" name="plugin">
<!-- JDK路径,根据自己机器上实际位置修改-->
<property name="jdk.home" value="/Library/Java/JavaVirtualMachines/jdk1.8/Contents/Home"/>
<property name="jdk.home" value="C:\Program Files\Java\jdk1.8.0_192"/>
<property name="libs" value="${basedir}/lib"/>
<property name="publicLibs" value=""/>
<property name="reportLibs" value="${basedir}/../webroot/WEB-INF/lib"/>
<property name="reportLibs" value="${basedir}/lib"/>
<property name="destLoc" value="."/>
<property name="classes" value="classes"/>
<xmlproperty file="${basedir}/plugin.xml"/>
@ -14,7 +14,7 @@
<!-- 插件版本-->
<property name="plugin-version" value="${current-version}"/>
<!-- 插件名字-->
<property name="plugin-name" value="theme-original"/>
<property name="plugin-name" value="theme-ngx"/>
<property name="plugin-jar" value="fr-plugin-${plugin-name}-${plugin-version}.jar"/>
<target name="prepare">

11
plugin.xml

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?><plugin>
<id>com.fr.plugin.decision.theme.original</id>
<name><![CDATA[复古主题]]></name>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<plugin>
<id>com.fr.plugin.decision.theme.ngx</id>
<name><![CDATA[仿ngx-admin]]></name>
<active>no</active>
<version>1.0</version>
<env-version>10.0</env-version>
@ -12,7 +13,7 @@
]]></change-notes>
<extra-decision>
<ThemeVariousProvider class="com.fr.plugin.theme.original.OriginalTheme"/>
<ThemeVariousProvider class="com.fr.plugin.theme.ngx.NgxTheme"/>
</extra-decision>
<function-recorder class="com.fr.plugin.theme.original.OriginalTheme"/>
<function-recorder class="com.fr.plugin.theme.ngx.NgxTheme"/>
</plugin>

6
pom.xml

@ -10,9 +10,11 @@
<version>10.0</version>
</parent>
<packaging>jar</packaging>
<artifactId>demo-theme-original</artifactId>
<artifactId>demo-theme-ngx</artifactId>
<build>
<!---如果要更改调试插件,改这里的配置就可以了-->
<outputDirectory>${project.basedir}/../webroot/WEB-INF/plugins/plugin-com.fr.plugin.decision.theme.original-1.0/classes</outputDirectory>
<outputDirectory>
${project.basedir}/../webroot/WEB-INF/plugins/plugin-com.fr.plugin.decision.theme.ngx-1.0/classes
</outputDirectory>
</build>
</project>

BIN
screenshots/theme.gif

Binary file not shown.

After

Width:  |  Height:  |  Size: 929 KiB

BIN
screenshots/theme.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 242 KiB

14
src/main/java/com/fr/plugin/theme/original/OriginalComponent.java → src/main/java/com/fr/plugin/theme/ngx/NgxComponent.java

@ -1,4 +1,4 @@
package com.fr.plugin.theme.original;
package com.fr.plugin.theme.ngx;
import com.fr.decision.config.AppearanceConfig;
import com.fr.web.struct.Component;
@ -9,29 +9,29 @@ import com.fr.web.struct.Filter;
/**
* Created by Zed on 2018/10/12.
*/
public class OriginalComponent extends Component {
public class NgxComponent extends Component {
public static final OriginalComponent KEY = new OriginalComponent();
public static final NgxComponent KEY = new NgxComponent();
private OriginalComponent() {
private NgxComponent() {
}
@Override
public ScriptPath script() {
return ScriptPath.build("com/fr/plugin/theme/original/web/theme.js");
return ScriptPath.build("com/fr/plugin/theme/ngx/web/theme.js");
}
@Override
public StylePath style() {
return StylePath.build("com/fr/plugin/theme/original/web/style.css");
return StylePath.build("com/fr/plugin/theme/ngx/web/style.css");
}
@Override
public Filter filter() {
return new Filter() {
public boolean accept() {
return "com.fr.plugin.decision.theme.original".equals(AppearanceConfig.getInstance().getThemeId());
return "com.fr.plugin.decision.theme.ngx".equals(AppearanceConfig.getInstance().getThemeId());
}
};
}

14
src/main/java/com/fr/plugin/theme/original/OriginalTheme.java → src/main/java/com/fr/plugin/theme/ngx/NgxTheme.java

@ -1,4 +1,4 @@
package com.fr.plugin.theme.original;
package com.fr.plugin.theme.ngx;
import com.fr.decision.fun.impl.AbstractThemeVariousProvider;
import com.fr.decision.web.MainComponent;
@ -11,7 +11,7 @@ import com.fr.web.struct.Atom;
* Created by dailer on 18/10/10.
*/
@EnableMetrics
public class OriginalTheme extends AbstractThemeVariousProvider {
public class NgxTheme extends AbstractThemeVariousProvider {
@Override
@ -20,24 +20,24 @@ public class OriginalTheme extends AbstractThemeVariousProvider {
}
@Override
@Focus(id = "com.fr.plugin.theme.original", text = "demo主题", source = Original.PLUGIN)
@Focus(id = "com.fr.plugin.theme.ngx", text = "仿ngx-admin主题", source = Original.PLUGIN)
public Atom client() {
return OriginalComponent.KEY;
return NgxComponent.KEY;
}
@Override
public String name() {
return "OriginalTheme";
return "NgxTheme";
}
@Override
public String text() {
return "复古";
return "仿ngx-admin";
}
@Override
public String coverPath() {
return "com/fr/plugin/theme/original/web/demo.png";
return "com/fr/plugin/theme/ngx/web/demo.png";
}
}

0
src/main/resources/com/fr/plugin/theme/original/web/demo.png → src/main/resources/com/fr/plugin/theme/ngx/web/demo.png

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

36
src/main/resources/com/fr/plugin/theme/original/web/js/config.js → src/main/resources/com/fr/plugin/theme/ngx/web/js/config.js

@ -1,17 +1,18 @@
/**
*@desc 自定义的header
*@author dailer
*@date 2018/12/25
*/
!(function () {
BI.config("dec.constant.config", function (config) {
config.config4Frame.west.width = 240;
config.config4EntryPane.pinable = false;
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: {
@ -19,13 +20,15 @@
items: [
{
el: {
type: "dec.workbench.tabs"
type: "dec.workbench.tabs",
cls: "bi-background",
showTabBar: false
},
top: 0, bottom: 0, right: 0,
left: 240
top: 0, bottom: 20, right: 20,
left: 260
}, {
el: {
type: "dec.workbench.panel",
type: "demo.sidebar",
width: 240
},
top: 0, bottom: 0,
@ -33,21 +36,16 @@
}
]
},
top: 40, left: 0, right: 0, bottom: 0
top: 70, left: 0, right: 0, bottom: 0
}, {
el: {
type: "dec.header"
},
height: 40,
height: 50,
top: 0, left: 0, right: 0
}
]
});
return provider;
});
BI.config("dec.workbench.panel", function (config) {
config.type = "my.theme.directory";
return config;
});
}());
}());

88
src/main/resources/com/fr/plugin/theme/ngx/web/js/header/favorite.js

@ -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);
}());

70
src/main/resources/com/fr/plugin/theme/ngx/web/js/header/header.js

@ -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);
}());

17
src/main/resources/com/fr/plugin/theme/ngx/web/js/header/header.less

@ -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;
}
}

13
src/main/resources/com/fr/plugin/theme/ngx/web/js/index.less

@ -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;
}

56
src/main/resources/com/fr/plugin/theme/ngx/web/js/main.js

@ -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);
}());

87
src/main/resources/com/fr/plugin/theme/ngx/web/js/sidebar/sidebar.expander.js

@ -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);
}());

81
src/main/resources/com/fr/plugin/theme/ngx/web/js/sidebar/sidebar.item.js

@ -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);
}());

85
src/main/resources/com/fr/plugin/theme/ngx/web/js/sidebar/sidebar.js

@ -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);
}());

28
src/main/resources/com/fr/plugin/theme/ngx/web/js/sidebar/sidebar.less

@ -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;
}
}

110
src/main/resources/com/fr/plugin/theme/ngx/web/js/sidebar/sidebar.node.js

@ -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);
}());

50
src/main/resources/com/fr/plugin/theme/ngx/web/style.css

@ -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;
}

628
src/main/resources/com/fr/plugin/theme/ngx/web/theme.js

@ -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);
}());

97
src/main/resources/com/fr/plugin/theme/original/web/js/modules.js

@ -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);
}());

141
src/main/resources/com/fr/plugin/theme/original/web/js/modules.model.js

@ -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);
}());

0
src/main/resources/com/fr/plugin/theme/original/web/style.css

290
src/main/resources/com/fr/plugin/theme/original/web/theme.js

@ -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…
Cancel
Save