diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..87537f1 --- /dev/null +++ b/build.xml @@ -0,0 +1,118 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/plugin.xml b/plugin.xml new file mode 100644 index 0000000..bb7d28f --- /dev/null +++ b/plugin.xml @@ -0,0 +1,18 @@ + + com.fr.plugin.decision.theme.original + + no + 1.0 + 10.0 + 2018-10-10 + dailer + + + + + + + + \ No newline at end of file diff --git a/src/com/fr/plugin/decision/theme/original/OriginalComponent.java b/src/com/fr/plugin/decision/theme/original/OriginalComponent.java new file mode 100644 index 0000000..2dd7c45 --- /dev/null +++ b/src/com/fr/plugin/decision/theme/original/OriginalComponent.java @@ -0,0 +1,38 @@ +package com.fr.plugin.decision.theme.original; + +import com.fr.decision.config.AppearanceConfig; +import com.fr.web.struct.Component; +import com.fr.web.struct.category.ScriptPath; +import com.fr.web.struct.category.StylePath; +import com.fr.web.struct.Filter; + +/** + * Created by Zed on 2018/10/12. + */ +public class OriginalComponent extends Component { + + public static final OriginalComponent KEY = new OriginalComponent(); + + private OriginalComponent() { + + } + + @Override + public ScriptPath script() { + return ScriptPath.build("/com/fr/plugin/decision/theme/original/web/theme.js"); + } + + @Override + public StylePath style() { + return StylePath.build("/com/fr/plugin/decision/theme/original/web/style.css"); + } + + @Override + public Filter filter() { + return new Filter() { + public boolean accept() { + return "com.fr.plugin.decision.theme.original".equals(AppearanceConfig.getInstance().getThemeId()); + } + }; + } +} \ No newline at end of file diff --git a/src/com/fr/plugin/decision/theme/original/OriginalTheme.java b/src/com/fr/plugin/decision/theme/original/OriginalTheme.java new file mode 100644 index 0000000..1d791b1 --- /dev/null +++ b/src/com/fr/plugin/decision/theme/original/OriginalTheme.java @@ -0,0 +1,42 @@ +package com.fr.plugin.decision.theme.original; + +import com.fr.decision.fun.impl.AbstractThemeVariousProvider; +import com.fr.decision.web.MainComponent; +import com.fr.plugin.transform.ExecuteFunctionRecord; +import com.fr.plugin.transform.FunctionRecorder; +import com.fr.web.struct.Atom; + +/** + * Created by dailer on 18/10/10. + */ +@FunctionRecorder(localeKey = "OriginalTheme") +public class OriginalTheme extends AbstractThemeVariousProvider { + + + @Override + public Atom attach() { + return MainComponent.KEY; + } + + @Override + public Atom client() { + return OriginalComponent.KEY; + } + + @Override + @ExecuteFunctionRecord + public String name() { + return "OriginalTheme"; + } + + @Override + public String text() { + return "复古"; + } + + @Override + public String coverPath() { + return ""; + } + +} \ No newline at end of file diff --git a/src/com/fr/plugin/decision/theme/original/web/js/config.js b/src/com/fr/plugin/decision/theme/original/web/js/config.js new file mode 100644 index 0000000..5a5bd41 --- /dev/null +++ b/src/com/fr/plugin/decision/theme/original/web/js/config.js @@ -0,0 +1,69 @@ +!(function () { + + BI.module("my.theme", { + version: 1.0, + components: ["dec.menu"], + constants: ["dec.constant.config"], + services: ["dec.service.tabs"], + models: [""] + }); + + + BI.config("dec.constant.config", function (config) { + config.theme.config4Frame.west.width = 240; + config.theme.config4EntryPane.pinable = false; + return config; + }); + + + Dec.injection.injectLayoutStrategy({ + layout: function (config, header, footer, menu, body) { + return { + type: "bi.absolute", + items: [ + { + el: { + type: "bi.absolute", + items: [ + { + el: body, + top: 0, bottom: 0, right: 0, + left: config.west.invisible ? 0 : config.west.width + }, { + el: menu, + top: 0, bottom: 0, + left: 0 + } + ] + }, + top: 40, left: 0, right: 0, bottom: 0 + }, { + el: header, + height: 40, + top: 0, left: 0, right: 0 + } + ] + }; + } + }); + + Dec.injection.injectMenu({ + widget: function (config) { + return { + type: "dec.workbench.panel", + width: 240 + }; + } + }); + Dec.injection.injectBody({ + widget: function () { + return { + type: "dec.workbench.tabs" + }; + } + }); + + BI.config("dec.workbench.directory", function (ob) { + return BI.extend(ob, {type: "dec.theme.modules"}); + }); +}()); diff --git a/src/com/fr/plugin/decision/theme/original/web/js/modules.js b/src/com/fr/plugin/decision/theme/original/web/js/modules.js new file mode 100644 index 0000000..1229139 --- /dev/null +++ b/src/com/fr/plugin/decision/theme/original/web/js/modules.js @@ -0,0 +1,97 @@ +!(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("dec.theme.modules", Nav); +}()); diff --git a/src/com/fr/plugin/decision/theme/original/web/js/modules.model.js b/src/com/fr/plugin/decision/theme/original/web/js/modules.model.js new file mode 100644 index 0000000..024767e --- /dev/null +++ b/src/com/fr/plugin/decision/theme/original/web/js/modules.model.js @@ -0,0 +1,141 @@ +(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); +}()); \ No newline at end of file diff --git a/src/com/fr/plugin/decision/theme/original/web/style.css b/src/com/fr/plugin/decision/theme/original/web/style.css new file mode 100644 index 0000000..e69de29 diff --git a/src/com/fr/plugin/decision/theme/original/web/theme.js b/src/com/fr/plugin/decision/theme/original/web/theme.js new file mode 100644 index 0000000..b2afdf3 --- /dev/null +++ b/src/com/fr/plugin/decision/theme/original/web/theme.js @@ -0,0 +1,299 @@ +/*! fine-decision-webui 2018-10-14 15:29:23 */ +!(function () { + + BI.config("dec.constant.config", function (config) { + config.theme.config4Frame.west.width = 240; + config.theme.config4EntryPane.pinable = false; + return config; + }); + + + Dec.injection.injectLayoutStrategy({ + layout: function (config, header, footer, menu, body) { + return { + type: "bi.absolute", + items: [ + { + el: { + type: "bi.absolute", + items: [ + { + el: body, + top: 0, bottom: 0, right: 0, + left: config.west.invisible ? 0 : config.west.width + }, { + el: menu, + top: 0, bottom: 0, + left: 0 + } + ] + }, + top: 40, left: 0, right: 0, bottom: 0 + }, { + el: header, + height: 40, + top: 0, left: 0, right: 0 + } + ] + }; + } + }); + + Dec.injection.injectMenu({ + widget: function (config) { + return { + type: "dec.workbench.panel", + width: 240 + }; + } + }); + Dec.injection.injectBody({ + widget: function () { + return { + type: "dec.workbench.tabs" + }; + } + }); + + BI.Plugin.registerWidget("dec.workbench.directory", function (ob) { + return BI.extend(ob, {type: "dec.theme.modules"}); + }); +}()); +!(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("dec.theme.modules", 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); +}()); \ No newline at end of file