From d06e722e3c16d74b8edfd8605b175516b54a8e54 Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 23 Mar 2017 11:58:51 +0800 Subject: [PATCH] add --- demo/config.js | 2 +- demo/js/base/demo.bubble.js | 26 +- demo/js/case/demo.calendar.js | 84 ++ demo/js/config/base.js | 181 +-- demo/js/config/case.js | 5 +- demo/js/config/core.js | 184 +++ demo/js/config/layout.js | 76 - .../core/abstract/combination/demo.combo.js | 11 + demo/js/core/abstract/demo.button_group.js | 24 + demo/js/core/abstract/demo.button_map.js | 26 + demo/js/core/abstract/demo.button_tree.js | 26 + demo/js/{ => core}/layout/demo.absolute.js | 0 demo/js/{ => core}/layout/demo.border.js | 0 demo/js/{ => core}/layout/demo.center.js | 0 .../js/{ => core}/layout/demo.center_adapt.js | 0 .../js/{ => core}/layout/demo.float_center.js | 0 demo/js/{ => core}/layout/demo.flow.js | 0 demo/js/{ => core}/layout/demo.grid.js | 0 demo/js/{ => core}/layout/demo.horizontal.js | 0 .../layout/demo.horizontal_adapt.js | 0 .../{ => core}/layout/demo.horizontal_auto.js | 0 .../layout/demo.horizontal_float.js | 0 demo/js/{ => core}/layout/demo.htape.js | 0 demo/js/{ => core}/layout/demo.inline.js | 0 .../layout/demo.left_right_vertical_adapt.js | 0 demo/js/{ => core}/layout/demo.table.js | 0 demo/js/{ => core}/layout/demo.td.js | 0 demo/js/{ => core}/layout/demo.vertical.js | 0 .../{ => core}/layout/demo.vertical_adapt.js | 0 demo/js/{ => core}/layout/demo.vtape.js | 0 demo/version.js | 4 + dist/base.js | 315 +---- dist/case.js | 1227 ++++++++++++++++- dist/core.js | 44 +- dist/widget.js | 1175 ---------------- src/base/combination/group.button.js | 6 +- src/base/combination/map.button.js | 2 +- src/base/reqloading/loading.request.js | 192 --- src/base/timeouttoast/widget.timeouttoast.js | 117 -- .../combo.editoriconcheck.js | 0 .../combo/formulacombo/combo.formula.js | 2 +- .../combo/formulacombo/popup.formulacombo.js | 0 .../formulacombo/trigger.formulacombo.js | 0 .../combo/iconcombo/combo.icon.js | 0 .../combo/iconcombo/popup.iconcombo.js | 0 .../combo/iconcombo/trigger.iconcombo.js | 0 .../combo/staticcombo/combo.static.js | 0 .../combo.textvaluecheck.js | 0 .../combo.textvaluechecksmall.js | 0 .../popup.textvaluecheck.js | 0 .../combo/textvaluecombo/combo.textvalue.js | 0 .../textvaluecombo/combo.textvaluesmall.js | 0 .../combo/textvaluecombo/popup.textvalue.js | 0 .../combo.textvaluedownlist.js | 0 .../trigger.textvaluedownlist.js | 0 src/core/controller/controller.bubbles.js | 44 +- 56 files changed, 1683 insertions(+), 2090 deletions(-) create mode 100644 demo/js/case/demo.calendar.js create mode 100644 demo/js/config/core.js delete mode 100644 demo/js/config/layout.js create mode 100644 demo/js/core/abstract/combination/demo.combo.js create mode 100644 demo/js/core/abstract/demo.button_group.js create mode 100644 demo/js/core/abstract/demo.button_map.js create mode 100644 demo/js/core/abstract/demo.button_tree.js rename demo/js/{ => core}/layout/demo.absolute.js (100%) rename demo/js/{ => core}/layout/demo.border.js (100%) rename demo/js/{ => core}/layout/demo.center.js (100%) rename demo/js/{ => core}/layout/demo.center_adapt.js (100%) rename demo/js/{ => core}/layout/demo.float_center.js (100%) rename demo/js/{ => core}/layout/demo.flow.js (100%) rename demo/js/{ => core}/layout/demo.grid.js (100%) rename demo/js/{ => core}/layout/demo.horizontal.js (100%) rename demo/js/{ => core}/layout/demo.horizontal_adapt.js (100%) rename demo/js/{ => core}/layout/demo.horizontal_auto.js (100%) rename demo/js/{ => core}/layout/demo.horizontal_float.js (100%) rename demo/js/{ => core}/layout/demo.htape.js (100%) rename demo/js/{ => core}/layout/demo.inline.js (100%) rename demo/js/{ => core}/layout/demo.left_right_vertical_adapt.js (100%) rename demo/js/{ => core}/layout/demo.table.js (100%) rename demo/js/{ => core}/layout/demo.td.js (100%) rename demo/js/{ => core}/layout/demo.vertical.js (100%) rename demo/js/{ => core}/layout/demo.vertical_adapt.js (100%) rename demo/js/{ => core}/layout/demo.vtape.js (100%) delete mode 100644 src/base/reqloading/loading.request.js delete mode 100644 src/base/timeouttoast/widget.timeouttoast.js rename src/{widget/base => case}/combo/editoriconcheckcombo/combo.editoriconcheck.js (100%) rename src/{widget/base => case}/combo/formulacombo/combo.formula.js (96%) rename src/{widget/base => case}/combo/formulacombo/popup.formulacombo.js (100%) rename src/{widget/base => case}/combo/formulacombo/trigger.formulacombo.js (100%) rename src/{widget/base => case}/combo/iconcombo/combo.icon.js (100%) rename src/{widget/base => case}/combo/iconcombo/popup.iconcombo.js (100%) rename src/{widget/base => case}/combo/iconcombo/trigger.iconcombo.js (100%) rename src/{widget/base => case}/combo/staticcombo/combo.static.js (100%) rename src/{widget/base => case}/combo/textvaluecheckcombo/combo.textvaluecheck.js (100%) rename src/{widget/base => case}/combo/textvaluecheckcombo/combo.textvaluechecksmall.js (100%) rename src/{widget/base => case}/combo/textvaluecheckcombo/popup.textvaluecheck.js (100%) rename src/{widget/base => case}/combo/textvaluecombo/combo.textvalue.js (100%) rename src/{widget/base => case}/combo/textvaluecombo/combo.textvaluesmall.js (100%) rename src/{widget/base => case}/combo/textvaluecombo/popup.textvalue.js (100%) rename src/{widget/base => case}/combo/textvaluedownlistcombo/combo.textvaluedownlist.js (100%) rename src/{widget/base => case}/combo/textvaluedownlistcombo/trigger.textvaluedownlist.js (100%) diff --git a/demo/config.js b/demo/config.js index abd87a41e5..d57d6dc5e6 100644 --- a/demo/config.js +++ b/demo/config.js @@ -1 +1 @@ -Demo.CONFIG = Demo.LAYOUT_CONFIG.concat(Demo.BASE_CONFIG).concat(Demo.CASE_CONFIG).concat(Demo.WIDGET_CONFIG).concat(Demo.COMPONENT_CONFIG); \ No newline at end of file +Demo.CONFIG = Demo.CORE_CONFIG.concat(Demo.BASE_CONFIG).concat(Demo.CASE_CONFIG).concat(Demo.WIDGET_CONFIG).concat(Demo.COMPONENT_CONFIG); \ No newline at end of file diff --git a/demo/js/base/demo.bubble.js b/demo/js/base/demo.bubble.js index 9eeb4963ec..c9b53ca9d8 100644 --- a/demo/js/base/demo.bubble.js +++ b/demo/js/base/demo.bubble.js @@ -3,22 +3,29 @@ Demo.Bubble = BI.inherit(BI.Widget, { baseCls: "demo-bubble" }, render: function () { + var btns = []; var items = [ { el: { + ref: function (_ref) { + btns.push(_ref); + }, type: 'bi.button', text: 'bubble测试', - height : 30, - handler: function(){ + height: 30, + handler: function () { BI.Bubbles.show("singleBubble1", "bubble测试", this); } } }, { el: { + ref: function (_ref) { + btns.push(_ref); + }, type: 'bi.button', text: 'bubble测试(居中显示)', - height : 30, - handler: function(){ + height: 30, + handler: function () { BI.Bubbles.show("singleBubble2", "bubble测试", this, { offsetStyle: "center" }); @@ -26,10 +33,13 @@ Demo.Bubble = BI.inherit(BI.Widget, { } }, { el: { + ref: function (_ref) { + btns.push(_ref); + }, type: 'bi.button', text: 'bubble测试(右边显示)', - height : 30, - handler: function(){ + height: 30, + handler: function () { BI.Bubbles.show("singleBubble3", "bubble测试", this, { offsetStyle: "right" }); @@ -39,8 +49,8 @@ Demo.Bubble = BI.inherit(BI.Widget, { ]; return { type: "bi.left", - vgap : 200, - hgap : 20, + vgap: 200, + hgap: 20, items: items } } diff --git a/demo/js/case/demo.calendar.js b/demo/js/case/demo.calendar.js new file mode 100644 index 0000000000..f1b7288bf0 --- /dev/null +++ b/demo/js/case/demo.calendar.js @@ -0,0 +1,84 @@ +Demo.Func = BI.inherit(BI.Widget, { + props: { + baseCls: "demo-func" + }, + _createNav: function(v){ + var m = this.MONTH, y = this.YEAR; + m += v; + while(m < 0){ + y--; + m += 12; + } + while(m > 11){ + y++; + m -= 12; + } + var calendar = BI.createWidget({ + type: "bi.calendar", + logic: { + dynamic: false + }, + year: y, + month: m, + day: this.DAY + }) + calendar.setValue(this.selectedTime); + return calendar; + }, + + _stringfyTimeObject: function(timeOb){ + return timeOb.year + "-" + (timeOb.month + 1) + "-" + timeOb.day; + }, + + render: function () { + var self = this, d = new Date(); + this.YEAR = d.getFullYear(); + this.MONTH = d.getMonth(); + this.DAY = d.getDate(); + + this.selectedTime = { + year: this.YEAR, + month: this.MONTH, + day: this.DAY + }; + + var tip = BI.createWidget({ + type: "bi.label" + }); + + var nav = BI.createWidget({ + type: "bi.navigation", + element: this, + tab: { + height: 30, + items: [{ + once: false, + text: "后退", + value: -1, + cls: "mvc-button layout-bg3" + },tip, { + once: false, + text: "前进", + value: 1, + cls: "mvc-button layout-bg4" + }] + }, + cardCreator: BI.bind(this._createNav, this), + + afterCardCreated: function(){ + + }, + + afterCardShow: function(){ + this.setValue(self.selectedTime); + } + }) + + nav.on(BI.Navigation.EVENT_CHANGE, function(){ + self.selectedTime = nav.getValue(); + tip.setText(self._stringfyTimeObject(self.selectedTime)); + }); + tip.setText(this._stringfyTimeObject(this.selectedTime)); + } +}); +$.shortcut("demo.calendar", Demo.Func); \ No newline at end of file diff --git a/demo/js/config/base.js b/demo/js/config/base.js index 29549d7971..1f8b1aa9d5 100644 --- a/demo/js/config/base.js +++ b/demo/js/config/base.js @@ -1,7 +1,6 @@ Demo.BASE_CONFIG = [{ id: 2, text: "基础控件", - open: true, }, { pId: 2, text: "bi.label", @@ -66,134 +65,52 @@ Demo.BASE_CONFIG = [{ pId: 202, text: "bi.formula_editor", value: "demo.formula_editor" -}, - - { - pId: 2, - id: 5, - text: "组合控件" - }, { - pId: 2, - id: 8, - text: "树控件" - }, { - pId: 2, - id: 7, - text: "按钮" - }, { - pId: 2, - id: 9, - text: "listitem" - }, { - pId: 2, - text: "bi.canvas", - value: "demo.canvas" - }, { - pId: 2, - text: "bi.collection", - value: "demo.collection" - }, { - pId: 2, - text: "bi.farbtastic", - value: "demo.farbtastic" - }, { - pId: 2, - text: "bi.message", - value: "demo.message" - }, { - pId: 2, - text: "bi.grid_view", - value: "demo.grid_view" - }, { - pId: 2, - id: 6, - text: "弹出层" - }, { - pId: 2, - text: "bi.pager", - value: "demo.pager" - }, { - pId: 2, - text: "bi.svg", - value: "demo.svg" - }, { - pId: 2, - text: "bi.table", - value: "demo.table" - }, { - pId: 5, - text: "bi.combo", - value: "demo.combo" - }, { - pId: 5, - text: "bi.expander", - value: "demo.expander" - }, { - pId: 5, - text: "bi.group_button", - value: "demo.group_button" - }, { - pId: 5, - text: "bi.group_combo", - value: "demo.group_combo" - }, { - pId: 5, - text: "bi.loader", - value: "demo.loader" - }, { - pId: 5, - text: "bi.navigation", - value: "demo.navigation" - }, { - pId: 5, - text: "bi.searcher", - value: "demo.searcher" - }, { - pId: 5, - text: "bi.switcher", - value: "demo.switcher" - }, { - pId: 5, - text: "bi.tab", - value: "demo.tab" - }, { - pId: 5, - text: "bi.tree_button", - value: "demo.tree_button" - }, { - pId: 6, - text: "bi.layer_float_box", - value: "demo.layer_float_box" - }, { - pId: 6, - text: "bi.layer_popup", - value: "demo.layer_popup" - }, { - pId: 6, - text: "bi.layer_scroll", - value: "demo.layer_scroll" - }, { - pId: 6, - text: "bi.layer_searcher", - value: "demo.layer_searcher" - }, { - pId: 8, - text: "bi.treeview", - value: "demo.treeview" - }, { - pId: 8, - text: "bi.synctree", - value: "demo.synctree" - }, { - pId: 8, - text: "bi.parttree", - value: "demo.parttree" - }, { - pId: 8, - text: "bi.customtree", - value: "demo.customtree" - }, { - pId: 9, - text: "bi.list_items", - value: "demo.list_items" - },]; \ No newline at end of file +}, { + pId: 2, + id: 203, + text: "树控件" +}, { + pId: 203, + text: "bi.treeview", + value: "demo.treeview" +}, { + pId: 203, + text: "bi.synctree", + value: "demo.synctree" +}, { + pId: 203, + text: "bi.parttree", + value: "demo.parttree" +}, { + pId: 2, + id: 204, + text: "表格" +}, { + pId: 204, + text: "bi.table_view", + value: "demo.table_view" +}, { + pId: 204, + text: "bi.table_grid", + value: "demo.table_grid" +}, { + pId: 204, + text: "bi.table_collection", + value: "demo.table_collection" +}, { + pId: 2, + text: "bi.canvas", + value: "demo.canvas" +}, { + pId: 2, + text: "bi.farbtastic", + value: "demo.farbtastic" +}, { + pId: 2, + text: "bi.pager", + value: "demo.pager" +}, { + pId: 2, + text: "bi.svg", + value: "demo.svg" +}]; \ No newline at end of file diff --git a/demo/js/config/case.js b/demo/js/config/case.js index 9dd8c9da8a..da57182c42 100644 --- a/demo/js/config/case.js +++ b/demo/js/config/case.js @@ -1,7 +1,10 @@ Demo.CASE_CONFIG = [{ id: 3, - text: "实例控件" + text: "实例控件", + open: true, }, { + +},{ pId: 3, text: "bi.calendar", value: "demo.calendar" diff --git a/demo/js/config/core.js b/demo/js/config/core.js new file mode 100644 index 0000000000..ab185ddde1 --- /dev/null +++ b/demo/js/config/core.js @@ -0,0 +1,184 @@ +Demo.CORE_CONFIG = [{ + id: 1, + text: "核心控件", +}, { + id: 101, + pId: 1, + text: "布局" +}, { + pId: 101, + text: "bi.center_adapt", + value: "demo.center_adapt" +}, { + pId: 101, + text: "bi.vertical_adapt", + value: "demo.vertical_adapt" +}, { + pId: 101, + text: "bi.horizontal_adapt", + value: "demo.horizontal_adapt" +}, { + pId: 101, + text: "bi.horizontal_auto", + value: "demo.horizontal_auto" +}, { + pId: 101, + text: "bi.horizontal_float", + value: "demo.horizontal_float" +}, { + pId: 101, + text: "bi.left_right_vertical_adapt", + value: "demo.left_right_vertical_adapt" +}, { + pId: 101, + text: "bi.center", + value: "demo.center_layout" +}, { + pId: 101, + text: "bi.float_center", + value: "demo.float_center" +}, { + pId: 101, + text: "bi.vertical", + value: "demo.vertical" +}, { + pId: 101, + text: "bi.horizontal", + value: "demo.horizontal" +}, { + pId: 101, + text: "bi.border", + value: "demo.border" +}, { + pId: 101, + text: "bi.left, bi.right", + value: "demo.flow" +}, { + pId: 101, + text: "bi.inline", + value: "demo.inline" +}, { + pId: 101, + text: "bi.htape", + value: "demo.htape" +}, { + pId: 101, + text: "bi.vtape", + value: "demo.vtape" +}, { + pId: 101, + text: "bi.grid", + value: "demo.grid" +}, { + pId: 101, + text: "bi.table", + value: "demo.table_layout" +}, { + pId: 101, + text: "bi.td", + value: "demo.td" +}, { + pId: 1, + id: 102, + text: "抽象控件" +}, { + pId: 102, + text: "bi.button_group", + value: "demo.button_group" +}, { + pId: 102, + text: "bi.button_tree", + value: "demo.button_tree" +}, { + pId: 102, + text: "bi.button_map", + value: "demo.button_map" +}, { + pId: 102, + id: 10201, + text: "组合控件" +}, { + pId: 10201, + text: "bi.combo", + value: "demo.combo" +}, { + pId: 10201, + text: "bi.expander", + value: "demo.expander" +}, { + pId: 10201, + text: "bi.group_combo", + value: "demo.group_combo" +}, { + pId: 10201, + text: "bi.loader", + value: "demo.loader" +}, { + pId: 10201, + text: "bi.navigation", + value: "demo.navigation" +}, { + pId: 10201, + text: "bi.searcher", + value: "demo.searcher" +}, { + pId: 10201, + text: "bi.switcher", + value: "demo.switcher" +}, { + pId: 10201, + text: "bi.tab", + value: "demo.tab" +}, { + pId: 102, + id: 10202, + text: "弹出层" +}, { + pId: 10202, + text: "bi.layer_float_box", + value: "demo.layer_float_box" +}, { + pId: 10202, + text: "bi.layer_popup", + value: "demo.layer_popup" +}, { + pId: 10202, + text: "bi.layer_scroll", + value: "demo.layer_scroll" +}, { + pId: 10202, + text: "bi.layer_searcher", + value: "demo.layer_searcher" +}, { + pId: 102, + text: "bi.customtree", + value: "demo.customtree" +}, { + pId: 102, + text: "bi.grid_view", + value: "demo.grid_view" +}, { + pId: 102, + text: "bi.collection", + value: "demo.collection" +}, { + pId: 1, + text: "widget", + value: "demo.widget" +}, { + pId: 1, + text: "single", + value: "demo.single" +}, { + pId: 1, + text: "BasicButton", + value: "demo.basic_button" +}, { + pId: 1, + text: "NodeButton", + value: "demo.node_button" +}, { + pId: 1, + text: "pane", + value: "demo.pane" +}]; \ No newline at end of file diff --git a/demo/js/config/layout.js b/demo/js/config/layout.js deleted file mode 100644 index 2fb8d3a25e..0000000000 --- a/demo/js/config/layout.js +++ /dev/null @@ -1,76 +0,0 @@ -Demo.LAYOUT_CONFIG = [{ - id: 1, - text: "布局" -}, { - pId: 1, - text: "bi.center_adapt", - value: "demo.center_adapt" -}, { - pId: 1, - text: "bi.vertical_adapt", - value: "demo.vertical_adapt" -}, { - pId: 1, - text: "bi.horizontal_adapt", - value: "demo.horizontal_adapt" -}, { - pId: 1, - text: "bi.horizontal_auto", - value: "demo.horizontal_auto" -}, { - pId: 1, - text: "bi.horizontal_float", - value: "demo.horizontal_float" -}, { - pId: 1, - text: "bi.left_right_vertical_adapt", - value: "demo.left_right_vertical_adapt" -}, { - pId: 1, - text: "bi.center", - value: "demo.center_layout" -}, { - pId: 1, - text: "bi.float_center", - value: "demo.float_center" -}, { - pId: 1, - text: "bi.vertical", - value: "demo.vertical" -}, { - pId: 1, - text: "bi.horizontal", - value: "demo.horizontal" -}, { - pId: 1, - text: "bi.border", - value: "demo.border" -}, { - pId: 1, - text: "bi.left, bi.right", - value: "demo.flow" -}, { - pId: 1, - text: "bi.inline", - value: "demo.inline" -}, { - pId: 1, - text: "bi.htape", - value: "demo.htape" -}, { - pId: 1, - text: "bi.vtape", - value: "demo.vtape" -}, { - pId: 1, - text: "bi.grid", - value: "demo.grid" -}, { - pId: 1, - text: "bi.table", - value: "demo.table_layout" -}, { - pId: 1, - text: "bi.td", - value: "demo.td" -}]; \ No newline at end of file diff --git a/demo/js/core/abstract/combination/demo.combo.js b/demo/js/core/abstract/combination/demo.combo.js new file mode 100644 index 0000000000..50f4c48df4 --- /dev/null +++ b/demo/js/core/abstract/combination/demo.combo.js @@ -0,0 +1,11 @@ +Demo.Func = BI.inherit(BI.Widget, { + props: { + baseCls: "demo-func" + }, + render: function () { + return { + type: "bi.layout", + } + } +}); +$.shortcut("demo.combo", Demo.Func); \ No newline at end of file diff --git a/demo/js/core/abstract/demo.button_group.js b/demo/js/core/abstract/demo.button_group.js new file mode 100644 index 0000000000..5f3c04b7d0 --- /dev/null +++ b/demo/js/core/abstract/demo.button_group.js @@ -0,0 +1,24 @@ +Demo.Func = BI.inherit(BI.Widget, { + props: { + baseCls: "demo-func" + }, + render: function () { + return { + type: "bi.button_group", + chooseType: BI.ButtonGroup.CHOOSE_TYPE_NONE, + layouts: [{ + type: "bi.vertical" + }, { + type: "bi.center_adapt", + }], + items: [{ + type: "bi.label", + text: "button_group是一类具有相同属性或相似属性的抽象, 本案例实现的是布局的嵌套(vertical布局下内嵌center_adapt布局)" + }, { + type: "bi.button", + text: "1" + }] + } + } +}); +$.shortcut("demo.button_group", Demo.Func); \ No newline at end of file diff --git a/demo/js/core/abstract/demo.button_map.js b/demo/js/core/abstract/demo.button_map.js new file mode 100644 index 0000000000..f3e76f2f5b --- /dev/null +++ b/demo/js/core/abstract/demo.button_map.js @@ -0,0 +1,26 @@ +Demo.Func = BI.inherit(BI.Widget, { + props: { + baseCls: "demo-func" + }, + render: function () { + return { + type: "bi.button_map", + chooseType: BI.ButtonGroup.CHOOSE_TYPE_MULTI, + layouts: [{ + type: "bi.vertical" + }, { + type: "bi.center_adapt", + }], + items: [{ + type: "bi.label", + text: "0", + value: 0 + }, { + type: "bi.button", + text: "1", + value: 1 + }] + } + } +}); +$.shortcut("demo.button_map", Demo.Func); \ No newline at end of file diff --git a/demo/js/core/abstract/demo.button_tree.js b/demo/js/core/abstract/demo.button_tree.js new file mode 100644 index 0000000000..0a45c36944 --- /dev/null +++ b/demo/js/core/abstract/demo.button_tree.js @@ -0,0 +1,26 @@ +Demo.Func = BI.inherit(BI.Widget, { + props: { + baseCls: "demo-func" + }, + render: function () { + return { + type: "bi.button_tree", + chooseType: BI.ButtonGroup.CHOOSE_TYPE_MULTI, + layouts: [{ + type: "bi.vertical" + }, { + type: "bi.center_adapt", + }], + items: [{ + type: "bi.label", + text: "0", + value: 0 + }, { + type: "bi.button", + text: "1", + value: 1 + }] + } + } +}); +$.shortcut("demo.button_tree", Demo.Func); \ No newline at end of file diff --git a/demo/js/layout/demo.absolute.js b/demo/js/core/layout/demo.absolute.js similarity index 100% rename from demo/js/layout/demo.absolute.js rename to demo/js/core/layout/demo.absolute.js diff --git a/demo/js/layout/demo.border.js b/demo/js/core/layout/demo.border.js similarity index 100% rename from demo/js/layout/demo.border.js rename to demo/js/core/layout/demo.border.js diff --git a/demo/js/layout/demo.center.js b/demo/js/core/layout/demo.center.js similarity index 100% rename from demo/js/layout/demo.center.js rename to demo/js/core/layout/demo.center.js diff --git a/demo/js/layout/demo.center_adapt.js b/demo/js/core/layout/demo.center_adapt.js similarity index 100% rename from demo/js/layout/demo.center_adapt.js rename to demo/js/core/layout/demo.center_adapt.js diff --git a/demo/js/layout/demo.float_center.js b/demo/js/core/layout/demo.float_center.js similarity index 100% rename from demo/js/layout/demo.float_center.js rename to demo/js/core/layout/demo.float_center.js diff --git a/demo/js/layout/demo.flow.js b/demo/js/core/layout/demo.flow.js similarity index 100% rename from demo/js/layout/demo.flow.js rename to demo/js/core/layout/demo.flow.js diff --git a/demo/js/layout/demo.grid.js b/demo/js/core/layout/demo.grid.js similarity index 100% rename from demo/js/layout/demo.grid.js rename to demo/js/core/layout/demo.grid.js diff --git a/demo/js/layout/demo.horizontal.js b/demo/js/core/layout/demo.horizontal.js similarity index 100% rename from demo/js/layout/demo.horizontal.js rename to demo/js/core/layout/demo.horizontal.js diff --git a/demo/js/layout/demo.horizontal_adapt.js b/demo/js/core/layout/demo.horizontal_adapt.js similarity index 100% rename from demo/js/layout/demo.horizontal_adapt.js rename to demo/js/core/layout/demo.horizontal_adapt.js diff --git a/demo/js/layout/demo.horizontal_auto.js b/demo/js/core/layout/demo.horizontal_auto.js similarity index 100% rename from demo/js/layout/demo.horizontal_auto.js rename to demo/js/core/layout/demo.horizontal_auto.js diff --git a/demo/js/layout/demo.horizontal_float.js b/demo/js/core/layout/demo.horizontal_float.js similarity index 100% rename from demo/js/layout/demo.horizontal_float.js rename to demo/js/core/layout/demo.horizontal_float.js diff --git a/demo/js/layout/demo.htape.js b/demo/js/core/layout/demo.htape.js similarity index 100% rename from demo/js/layout/demo.htape.js rename to demo/js/core/layout/demo.htape.js diff --git a/demo/js/layout/demo.inline.js b/demo/js/core/layout/demo.inline.js similarity index 100% rename from demo/js/layout/demo.inline.js rename to demo/js/core/layout/demo.inline.js diff --git a/demo/js/layout/demo.left_right_vertical_adapt.js b/demo/js/core/layout/demo.left_right_vertical_adapt.js similarity index 100% rename from demo/js/layout/demo.left_right_vertical_adapt.js rename to demo/js/core/layout/demo.left_right_vertical_adapt.js diff --git a/demo/js/layout/demo.table.js b/demo/js/core/layout/demo.table.js similarity index 100% rename from demo/js/layout/demo.table.js rename to demo/js/core/layout/demo.table.js diff --git a/demo/js/layout/demo.td.js b/demo/js/core/layout/demo.td.js similarity index 100% rename from demo/js/layout/demo.td.js rename to demo/js/core/layout/demo.td.js diff --git a/demo/js/layout/demo.vertical.js b/demo/js/core/layout/demo.vertical.js similarity index 100% rename from demo/js/layout/demo.vertical.js rename to demo/js/core/layout/demo.vertical.js diff --git a/demo/js/layout/demo.vertical_adapt.js b/demo/js/core/layout/demo.vertical_adapt.js similarity index 100% rename from demo/js/layout/demo.vertical_adapt.js rename to demo/js/core/layout/demo.vertical_adapt.js diff --git a/demo/js/layout/demo.vtape.js b/demo/js/core/layout/demo.vtape.js similarity index 100% rename from demo/js/layout/demo.vtape.js rename to demo/js/core/layout/demo.vtape.js diff --git a/demo/version.js b/demo/version.js index ecaa4de939..51c96d1785 100644 --- a/demo/version.js +++ b/demo/version.js @@ -1,3 +1,7 @@ Demo = { version: 1.0 +}; + +BI.i18n = { + "BI-Basic_OK": "确定" }; \ No newline at end of file diff --git a/dist/base.js b/dist/base.js index 34df2245ef..86be7335ea 100644 --- a/dist/base.js +++ b/dist/base.js @@ -20660,11 +20660,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, { return BI.extend(BI.ButtonGroup.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-button-group", behaviors: {}, - items: [ - { - el: {type: "bi.text_button", text: "", value: ""} - } - ], + items: [], chooseType: BI.Selection.Single, layouts: [{ type: "bi.center", @@ -21169,7 +21165,7 @@ BI.ButtonMap = BI.inherit(BI.ButtonTree, { var buttons = BI.createWidgets(BI.createItems(items, {type: "bi.text_button", once: o.chooseType === 0})); var keys = BI.map(items, function (i, item) { item = BI.stripEL(item); - if (!(item.id || item.value)) { + if (!(BI.isKey(item.id) || BI.isKey(item.value))) { throw new Error("item必须包含id或value属性"); } return item.id || item.value; @@ -26712,197 +26708,6 @@ BI.Pager = BI.inherit(BI.Widget, { BI.Pager.EVENT_CHANGE = "EVENT_CHANGE"; BI.Pager.EVENT_AFTER_POPULATE = "EVENT_AFTER_POPULATE"; $.shortcut("bi.pager", BI.Pager);/** - * Created by Young's on 2016/8/17. - * 加载面板,一般只用于 requestAsync 中 - */ -BI.RequstLoading = BI.inherit(BI.Widget, { - _defaultConfig: function () { - return BI.extend(BI.RequstLoading.superclass._defaultConfig.apply(this, arguments), {}); - }, - - _init: function () { - BI.RequstLoading.superclass._init.apply(this, arguments); - var self = this, o = this.options; - var mask = BI.Maskers.create(BI.RequstLoading.MASK_ID); - this.callback = o.callback; - this.paneTab = BI.createWidget({ - type: "bi.tab", - cardCreator: BI.bind(this._cardCreator, this), - defaultShowIndex: BI.RequstLoading.ERROR, - width: 400, - height: 300 - }); - var tempIcon = BI.createWidget({ - type: "bi.icon_button", - cls: "data-link-test-fail-icon", - width: 0, - height: 0 - }); - BI.createWidget({ - type: "bi.absolute", - element: $('body'), - items: [{ - el: tempIcon, - bottom: 0 - }] - }); - - BI.createWidget({ - type: "bi.absolute", - element: mask, - cls: "bi-request-loading", - items: [{ - el: { - type: "bi.layout", - cls: "mask-pane" - }, - top: 0, - left: 0, - bottom: 0, - right: 0 - }, { - el: { - type: "bi.center_adapt", - items: [this.paneTab] - }, - top: 0, - left: 0, - right: 0, - bottom: 0 - }] - }); - }, - - _cardCreator: function (v) { - var self = this; - var cancel = BI.createWidget({ - type: "bi.button", - text: BI.i18nText("BI-Basic_Cancel"), - title: BI.i18nText("BI-Basic_Cancel"), - level: "ignore", - height: 28, - width: 90, - handler: function () { - BI.Maskers.hide(BI.RequstLoading.MASK_ID); - } - }); - var retry = BI.createWidget({ - type: "bi.button", - text: BI.i18nText("BI-Basic_Retry"), - title: BI.i18nText("BI-Basic_Retry"), - level: "common", - height: 28, - width: 90, - handler: function () { - self.paneTab.setSelect(BI.RequstLoading.LOADING); - self.callback(); - } - }); - switch (v) { - case BI.RequstLoading.LOADING: - return BI.createWidget({ - type: "bi.vertical", - items: [{ - type: "bi.center_adapt", - cls: "loading-bar-icon", - items: [{ - type: "bi.icon", - width: 208, - height: 15 - }] - }, { - type: "bi.label", - cls: "loading-comment", - text: BI.i18nText("BI-Basic_Loading"), - height: 30 - }], - width: 208, - height: 200, - vgap: 10 - }); - case BI.RequstLoading.LOADING_TIMEOUT: - return BI.createWidget({ - type: "bi.vertical", - items: [{ - type: "bi.center_adapt", - cls: "loading-bar-icon", - items: [{ - type: "bi.icon", - width: 208, - height: 15 - }] - }, { - type: "bi.label", - cls: "loading-comment", - text: BI.i18nText("BI-Basic_Loading"), - height: 30 - }, { - type: "bi.label", - text: BI.i18nText("BI-Request_Time_Out_Toast_Tip"), - cls: "load-timeout-warning" - }, { - type: "bi.left_right_vertical_adapt", - items: { - left: [cancel], - right: [retry] - }, - height: 30, - llgap: 100, - rrgap: 100 - }], - vgap: 10 - }); - case BI.RequstLoading.ERROR: - return BI.createWidget({ - type: "bi.vertical", - items: [{ - type: "bi.center_adapt", - cls: "data-link-test-fail-icon", - items: [{ - type: "bi.icon", - width: 126, - height: 126 - }] - }, { - type: "bi.label", - text: BI.i18nText("BI-Connection_Lost"), - cls: "load-fail-comment" - }, { - type: "bi.left_right_vertical_adapt", - items: { - left: [cancel], - right: [retry] - }, - height: 30, - llgap: 100, - rrgap: 100 - }], - vgap: 20 - }); - } - }, - - showLoading: function () { - BI.Maskers.show(BI.RequstLoading.MASK_ID); - this.paneTab.setSelect(BI.RequstLoading.LOADING); - }, - - showError: function () { - BI.Maskers.show(BI.RequstLoading.MASK_ID); - this.paneTab.setSelect(BI.RequstLoading.ERROR); - }, - - setCallback: function (callback) { - this.callback = callback; - } -}); -BI.extend(BI.RequstLoading, { - MASK_ID: "___request__loading___", - LOADING: 1, - LOADING_TIMEOUT: 2, - ERROR: 3 -}); -$.shortcut("bi.request_loading", BI.RequstLoading);/** * 超链接 * * Created by GUY on 2015/9/9. @@ -35707,122 +35512,6 @@ BI.ResizableTable = BI.inherit(BI.Widget, { }); $.shortcut("bi.resizable_table", BI.ResizableTable);/** - * 组件请求数据超时提示 - * Created by Young's on 2017/2/4. - */ -BI.TimeoutToast = BI.inherit(BI.Tip, { - _defaultConfig: function () { - return BI.extend(BI.TimeoutToast.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-timeout-toast" - }); - }, - - _init: function () { - BI.TimeoutToast.superclass._init.apply(this, arguments); - var self = this; - this.requests = []; - this.toast = BI.createWidget({ - type: "bi.vertical_adapt", - element: this, - items: [{ - type: "bi.label", - text: BI.i18nText("BI-Request_Time_Out_Toast_Tip") - }, { - type: "bi.text_button", - cls: "cancel-button", - width: 60, - height: 22, - text: BI.i18nText("BI-Basic_Cancel"), - title: BI.i18nText("BI-Basic_Cancel"), - handler: function () { - self.cancelAllRequests(); - } - }, { - type: "bi.text_button", - cls: "retry-button", - width: 60, - height: 22, - text: BI.i18nText("BI-Basic_Retry"), - title: BI.i18nText("BI-Basic_Retry"), - handler: function () { - self.toast.element.slideUp(500); - self._retryAll(); - } - }, { - type: "bi.icon_button", - cls: "close-font", - width: 20, - height: 20, - title: BI.i18nText("BI-Basic_Close"), - handler: function () { - self.toast.element.slideUp(500); - } - }], - width: 520, - height: 30, - hgap: 2 - }); - - BI.createWidget({ - type: "bi.absolute", - element: $("body"), - items: [{ - el: this.toast, - left: "50%", - top: 0 - }] - }); - this.toast.element.css({"margin-left": -1 * this.toast.element.outerWidth() / 2}); - this.toast.setVisible(false); - }, - - _retryAll: function () { - var self = this; - var clonedRequests = BI.deepClone(this.requests); - this.requests = []; - BI.each(clonedRequests, function (i, options) { - BI.isFunction(self.callback) && self.callback(options); - }); - }, - - cancelAllRequests: function () { - this.toast.element.slideUp(500); - BI.each(this.requests, function (i, reqArgs) { - if (BI.isNotNull(reqArgs) && BI.isFunction(reqArgs.complete)) { - reqArgs.complete(); - } - }); - this.requests = []; - }, - - setCallback: function (callback) { - this.callback = callback; - }, - - addReq: function (options) { - var self = this; - if (this.requests.length === 0) { - setTimeout(function () { - if (self.requests.contains(options)) { - self.toast.element.slideDown(500); - } - }, 5 * 60 * 1000); //5 min - } - this.requests.push(options); - }, - - removeReq: function (options) { - BI.remove(this.requests, options); - if (this.requests.length === 0) { - this.toast.element.slideUp(500); - } - }, - - hasReq: function (options) { - return this.requests.contains(options); - } -}); -$.shortcut("bi.timeout_toast", BI.TimeoutToast);/** * * 自定义树 * diff --git a/dist/case.js b/dist/case.js index 136ae3762a..df57f74def 100644 --- a/dist/case.js +++ b/dist/case.js @@ -2891,49 +2891,1224 @@ BI.BubbleCombo.EVENT_AFTER_POPUPVIEW = "EVENT_AFTER_POPUPVIEW"; BI.BubbleCombo.EVENT_BEFORE_HIDEVIEW = "EVENT_BEFORE_HIDEVIEW"; BI.BubbleCombo.EVENT_AFTER_HIDEVIEW = "EVENT_AFTER_HIDEVIEW"; $.shortcut("bi.bubble_combo", BI.BubbleCombo);/** + * Created by Young's on 2016/4/28. + */ +BI.EditorIconCheckCombo = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.EditorIconCheckCombo.superclass._defaultConfig.apply(this, arguments), { + baseClass: "bi-check-editor-combo", + width: 100, + height: 30, + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, + validationChecker: BI.emptyFn, + quitChecker: BI.emptyFn, + allowBlank: true, + watermark: "", + errorText: "" + }) + }, + + _init: function () { + BI.EditorIconCheckCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.trigger = BI.createWidget({ + type: "bi.editor_trigger", + items: o.items, + height: o.height, + validationChecker: o.validationChecker, + quitChecker: o.quitChecker, + allowBlank: o.allowBlank, + watermark: o.watermark, + errorText: o.errorText + }); + this.trigger.on(BI.EditorTrigger.EVENT_CHANGE, function () { + self.popup.setValue(this.getValue()); + self.fireEvent(BI.EditorIconCheckCombo.EVENT_CHANGE); + }); + this.popup = BI.createWidget({ + type: "bi.text_value_check_combo_popup", + chooseType: o.chooseType, + items: o.items + }); + this.popup.on(BI.TextValueCheckComboPopup.EVENT_CHANGE, function () { + self.setValue(self.popup.getValue()); + self.editorIconCheckCombo.hideView(); + self.fireEvent(BI.EditorIconCheckCombo.EVENT_CHANGE); + }); + this.popup.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.editorIconCheckCombo = BI.createWidget({ + type: "bi.combo", + element: this, + adjustLength: 2, + el: this.trigger, + popup: { + el: this.popup, + maxHeight: 300 + } + }); + }, + + setValue: function (v) { + this.editorIconCheckCombo.setValue(v); + }, + + setEnable: function (v) { + BI.EditorIconCheckCombo.superclass.setEnable.apply(this, arguments); + this.editorIconCheckCombo.setEnable(v); + }, + + getValue: function () { + return this.trigger.getValue(); + }, + + populate: function (items) { + this.options.items = items; + this.editorIconCheckCombo.populate(items); + } +}); +BI.EditorIconCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; +$.shortcut("bi.editor_icon_check_combo", BI.EditorIconCheckCombo);/** + * Created by GUY on 2016/4/25. + * + * @class BI.FormulaCombo + * @extend BI.Widget + */ +BI.FormulaCombo = BI.inherit(BI.Widget, { + + _constant: { + POPUP_HEIGHT: 450, + POPUP_WIDTH: 600, + POPUP_V_GAP: 10, + POPUP_H_GAP: 10, + ADJUST_LENGTH: 2, + HEIGHT_MAX: 10000, + MAX_HEIGHT: 500, + MAX_WIDTH: 600, + COMBO_TRIGGER_WIDTH: 300 + }, + + _defaultConfig: function () { + return BI.extend(BI.FormulaCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-formula-combo", + height: 30, + items: [] + }) + }, + + _init: function () { + BI.FormulaCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.formula_ids = []; + this.input = BI.createWidget({ + type: "bi.formula_combo_trigger", + height: o.height, + items: o.items + }); + this.formulaPopup = BI.createWidget({ + type: "bi.formula_combo_popup", + fieldItems: o.items + }); + + this.formulaInputCombo = BI.createWidget({ + type: "bi.combo", + element: this, + isNeedAdjustHeight: true, + isNeedAdjustWidth: false, + adjustLength: this._constant.ADJUST_LENGTH, + el: this.input, + popup: { + el: { + type: "bi.absolute", + height: this._constant.HEIGHT_MAX, + width: this._constant.POPUP_WIDTH, + items: [{ + el: this.formulaPopup, + top: this._constant.POPUP_V_GAP, + left: this._constant.POPUP_H_GAP, + right: this._constant.POPUP_V_GAP, + bottom: 0 + }] + }, + stopPropagation: false, + maxHeight: this._constant.MAX_HEIGHT, + width: this._constant.MAX_WIDTH + } + }); + this.formulaInputCombo.on(BI.Combo.EVENT_AFTER_POPUPVIEW, function () { + self.formulaPopup.setValue(self.input.getValue()); + }); + this.formulaPopup.on(BI.FormulaComboPopup.EVENT_CHANGE, function () { + self.setValue(self.formulaPopup.getValue()); + self.formulaInputCombo.hideView(); + self.fireEvent(BI.FormulaCombo.EVENT_CHANGE); + }); + this.formulaPopup.on(BI.FormulaComboPopup.EVENT_VALUE_CANCEL, function () { + self.formulaInputCombo.hideView(); + }); + }, + + setValue: function (v) { + if (this.formulaInputCombo.isViewVisible()) { + this.formulaInputCombo.hideView(); + } + this.input.setValue(v); + this.input.setText(BI.Func.getFormulaStringFromFormulaValue(v)); + this.formulaPopup.setValue(this.input.getValue()); + }, + + getFormulaTargetIds: function() { + return this.formulaPopup.getFormulaTargetIds(); + }, + + getValue: function () { + return this.input.getValue(); + } +}); +BI.FormulaCombo.EVENT_CHANGE = "EVENT_CHANGE"; +$.shortcut("bi.formula_combo", BI.FormulaCombo);/** + * Created by GUY on 2016/4/25. + * + * @class BI.FormulaComboPopup + * @extend BI.Widget + */ +BI.FormulaComboPopup = BI.inherit(BI.Widget, { + + _constant: { + BUTTON_HEIGHT: 30, + SOUTH_HEIGHT: 60, + SOUTH_H_GAP: 10 + }, + + _defaultConfig: function () { + return BI.extend(BI.FormulaComboPopup.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-formula-pane-popup" + }) + }, + + _init: function () { + BI.FormulaComboPopup.superclass._init.apply(this, arguments); + this.populate(); + }, + + populate: function () { + var self = this, fieldItems = this.options.fieldItems; + this.formula = BI.createWidget({ + type: "bi.formula_insert" + }); + this.formula.populate(fieldItems); + var confirmButton = BI.createWidget({ + type: "bi.button", + level: "common", + height: this._constant.BUTTON_HEIGHT, + text: BI.i18nText("BI-Basic_OK") + }); + var cancelButton = BI.createWidget({ + type: "bi.button", + level: "ignore", + height: this._constant.BUTTON_HEIGHT, + text: BI.i18nText("BI-Basic_Cancel") + }); + + this.formula.on(BI.FormulaInsert.EVENT_CHANGE, function () { + confirmButton.setEnable(self.formula.checkValidation()); + }); + confirmButton.on(BI.Button.EVENT_CHANGE, function () { + self.fireEvent(BI.FormulaComboPopup.EVENT_CHANGE); + }); + cancelButton.on(BI.Button.EVENT_CHANGE, function () { + self.setValue(self.oldValue); + self.fireEvent(BI.FormulaComboPopup.EVENT_VALUE_CANCEL); + }); + + BI.createWidget({ + type: "bi.vtape", + element: this, + items: [{ + el: this.formula, + height: "fill" + }, { + el: { + type: "bi.right_vertical_adapt", + height: this._constant.SOUTH_HEIGHT, + items: [cancelButton, confirmButton], + hgap: this._constant.SOUTH_H_GAP + }, + height: this._constant.SOUTH_HEIGHT + }] + }) + }, + + getFormulaTargetIds: function(){ + return this.formula.getUsedFields(); + }, + + getValue: function () { + return this.formula.getValue(); + }, + + setValue: function (v) { + this.oldValue = v; + this.formula.setValue(v); + } +}); +BI.FormulaComboPopup.EVENT_CHANGE = "EVENT_CHANGE"; +BI.FormulaComboPopup.EVENT_VALUE_CANCEL = "EVENT_VALUE_CANCEL"; +$.shortcut("bi.formula_combo_popup", BI.FormulaComboPopup);/** + * Created by GUY on 2016/4/25. + * + * @class BI.FormulaComboTrigger + * @extend BI.Widget + */ +BI.FormulaComboTrigger = BI.inherit(BI.Widget, { + + _defaultConfig: function () { + return BI.extend(BI.FormulaComboTrigger.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-formula-combo-trigger", + height: 30, + items: [] + }) + }, + + _init: function () { + BI.FormulaComboTrigger.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.label = BI.createWidget({ + type: "bi.label", + element: this, + textAlign: "left", + textHeight: this.options.height, + lgap: 10 + }); + }, + + _getTextFromFormulaValue: function (formulaValue) { + var self = this; + var formulaString = ""; + var regx = /\$[\{][^\}]*[\}]|\w*\w|\$\{[^\$\(\)\+\-\*\/)\$,]*\w\}|\$\{[^\$\(\)\+\-\*\/]*\w\}|\$\{[^\$\(\)\+\-\*\/]*[\u4e00-\u9fa5]\}|\w|(.)/g; + var result = formulaValue.match(regx); + BI.each(result, function (i, item) { + var fieldRegx = /\$[\{][^\}]*[\}]/; + var str = item.match(fieldRegx); + if (BI.isNotEmptyArray(str)) { + var id = str[0].substring(2, item.length - 1); + var item = BI.find(self.options.items, function (i, item) { + return id === item.value; + }); + formulaString = formulaString + item.text; + } else { + formulaString = formulaString + item; + } + }); + return formulaString; + }, + + getValue: function () { + return this.options.value; + }, + + setValue: function (v) { + this.options.value = v; + this.label.setText(this._getTextFromFormulaValue(v)); + } +}); +$.shortcut("bi.formula_combo_trigger", BI.FormulaComboTrigger);/** + * Created by GUY on 2016/2/2. + * + * @class BI.IconCombo + * @extend BI.Widget + */ +BI.IconCombo = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.IconCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-icon-combo", + width: 24, + height: 24, + iconClass: "", + el: {}, + popup: {}, + minWidth: 100, + maxWidth: 'auto', + maxHeight: 300, + direction: "bottom", + adjustLength: 3,//调整的距离 + adjustXOffset: 0, + adjustYOffset: 0, + offsetStyle: "left", + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE + }) + }, + + _init: function () { + BI.IconCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.trigger = BI.createWidget(o.el, { + type: "bi.icon_combo_trigger", + iconClass: o.iconClass, + title: o.title, + items: o.items, + width: o.width, + height: o.height, + iconWidth: o.iconWidth, + iconHeight: o.iconHeight + }); + this.popup = BI.createWidget(o.popup, { + type: "bi.icon_combo_popup", + chooseType: o.chooseType, + items: o.items + }); + this.popup.on(BI.IconComboPopup.EVENT_CHANGE, function () { + self.setValue(self.popup.getValue()); + self.iconCombo.hideView(); + self.fireEvent(BI.IconCombo.EVENT_CHANGE); + }); + this.popup.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.iconCombo = BI.createWidget({ + type: "bi.combo", + element: this, + direction: o.direction, + adjustLength: o.adjustLength, + adjustXOffset: o.adjustXOffset, + adjustYOffset: o.adjustYOffset, + offsetStyle: o.offsetStyle, + el: this.trigger, + popup: { + el: this.popup, + maxWidth: o.maxWidth, + maxHeight: o.maxHeight, + minWidth: o.minWidth + } + }); + }, + + showView: function () { + this.iconCombo.showView(); + }, + + hideView: function () { + this.iconCombo.hideView(); + }, + + setValue: function (v) { + this.iconCombo.setValue(v); + }, + + setEnable: function (v) { + BI.IconCombo.superclass.setEnable.apply(this, arguments); + this.iconCombo.setEnable(v); + }, + + getValue: function () { + return this.iconCombo.getValue(); + }, + + populate: function (items) { + this.options.items = items; + this.iconCombo.populate(items); + } +}); +BI.IconCombo.EVENT_CHANGE = "EVENT_CHANGE"; +$.shortcut("bi.icon_combo", BI.IconCombo);/** + * Created by GUY on 2016/2/2. + * + * @class BI.IconComboPopup + * @extend BI.Pane + */ +BI.IconComboPopup = BI.inherit(BI.Pane, { + _defaultConfig: function () { + return BI.extend(BI.IconComboPopup.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi.icon-combo-popup", + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE + }); + }, + + _init: function () { + BI.IconComboPopup.superclass._init.apply(this, arguments); + var o = this.options, self = this; + this.popup = BI.createWidget({ + type: "bi.button_group", + items: BI.createItems(o.items, { + type: "bi.single_select_icon_text_item", + height: 30 + }), + chooseType: o.chooseType, + layouts: [{ + type: "bi.vertical" + }] + }); + + this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + if (type === BI.Events.CLICK) { + self.fireEvent(BI.IconComboPopup.EVENT_CHANGE, val, obj); + } + }); + + BI.createWidget({ + type: "bi.vertical", + element: this, + items: [this.popup] + }); + }, + + populate: function (items) { + BI.IconComboPopup.superclass.populate.apply(this, arguments); + items = BI.createItems(items, { + type: "bi.single_select_icon_text_item", + height: 30 + }); + this.popup.populate(items); + }, + + getValue: function () { + return this.popup.getValue(); + }, + + setValue: function (v) { + this.popup.setValue(v); + } + +}); +BI.IconComboPopup.EVENT_CHANGE = "EVENT_CHANGE"; +$.shortcut("bi.icon_combo_popup", BI.IconComboPopup);/** + * Created by GUY on 2016/2/2. + * + * @class BI.IconComboTrigger + * @extend BI.Widget + */ +BI.IconComboTrigger = BI.inherit(BI.Trigger, { + _defaultConfig: function () { + return BI.extend(BI.IconComboTrigger.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-icon-combo-trigger", + el: {}, + items: [], + iconClass: "", + width: 25, + height: 25, + isShowDown: true + }); + }, + + _init: function () { + BI.IconComboTrigger.superclass._init.apply(this, arguments); + var o = this.options, self = this; + this.button = BI.createWidget(o.el, { + type: "bi.icon_change_button", + cls: "icon-combo-trigger-icon " + o.iconClass, + disableSelected: true, + width: o.width, + height: o.height, + iconWidth: o.iconWidth, + iconHeight: o.iconHeight + }); + this.down = BI.createWidget({ + type: "bi.icon_button", + disableSelected: true, + cls: "icon-combo-down-icon trigger-triangle-font", + width: 12, + height: 8 + }); + this.down.setVisible(o.isShowDown); + BI.createWidget({ + type: "bi.absolute", + element: this, + items: [{ + el: this.button, + left: 0, + right: 0, + top: 0, + bottom: 0 + }, { + el: this.down, + right: 0, + bottom: 0 + }] + }); + if (BI.isKey(o.value)) { + this.setValue(o.value); + } + }, + + populate: function (items) { + var o = this.options; + this.options.items = items || []; + this.button.setIcon(o.iconClass); + this.button.setSelected(false); + this.down.setSelected(false); + }, + + setValue: function (v) { + BI.IconComboTrigger.superclass.setValue.apply(this, arguments); + var o = this.options; + var iconClass = ""; + v = BI.isArray(v) ? v[0] : v; + if (BI.any(this.options.items, function (i, item) { + if (v === item.value) { + iconClass = item.iconClass; + return true; + } + })) { + this.button.setIcon(iconClass); + this.button.setSelected(true); + this.down.setSelected(true); + } else { + this.button.setIcon(o.iconClass); + this.button.setSelected(false); + this.down.setSelected(false); + } + } +}); +BI.IconComboTrigger.EVENT_CHANGE = "EVENT_CHANGE"; +$.shortcut("bi.icon_combo_trigger", BI.IconComboTrigger);/** * Created by GUY on 2017/2/8. * * @class BI.BubblePopupBarView * @extends BI.BubblePopupView */ -BI.BubblePopupBarView = BI.inherit(BI.BubblePopupView, { +BI.BubblePopupBarView = BI.inherit(BI.BubblePopupView, { + _defaultConfig: function () { + return BI.extend(BI.BubblePopupBarView.superclass._defaultConfig.apply(this, arguments), { + extraCls: "bi-bubble-bar-popup-view", + buttons: [{value: BI.i18nText(BI.i18nText("BI-Basic_Sure"))}, {value: BI.i18nText("BI-Basic_Cancel"), level: "ignore"}] + }) + }, + _init: function () { + BI.BubblePopupBarView.superclass._init.apply(this, arguments); + }, + _createToolBar: function () { + var o = this.options, self = this; + + var items = []; + BI.each(o.buttons.reverse(), function (i, buttonOpt) { + if(BI.isWidget(buttonOpt)){ + items.push(buttonOpt); + }else{ + items.push(BI.extend({ + type: 'bi.button', + height: 30, + handler: function (v) { + self.fireEvent(BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, v); + } + }, buttonOpt)) + } + }); + return BI.createWidget({ + type: 'bi.right_vertical_adapt', + height: 40, + hgap: 10, + bgap: 10, + items: items + }); + } +}); +BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON = "EVENT_CLICK_TOOLBAR_BUTTON"; +$.shortcut("bi.bubble_bar_popup_view", BI.BubblePopupBarView);/** + * 单选combo + * + * @class BI.StaticCombo + * @extend BI.Widget + */ +BI.StaticCombo = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.StaticCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-static-combo", + height: 30, + text: "", + el: {}, + items: [], + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE + }) + }, + + _init: function () { + BI.StaticCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.trigger = BI.createWidget(o.el, { + type: "bi.text_icon_item", + cls: "bi-select-text-trigger pull-down-font", + text: o.text, + readonly: true, + textLgap: 5, + height: o.height - 2 + }); + this.popup = BI.createWidget({ + type: "bi.text_value_combo_popup", + textAlign: o.textAlign, + chooseType: o.chooseType, + items: o.items + }); + this.popup.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.popup.on(BI.TextValueComboPopup.EVENT_CHANGE, function () { + self.combo.hideView(); + self.fireEvent(BI.StaticCombo.EVENT_CHANGE, arguments); + }); + this.combo = BI.createWidget({ + type: "bi.combo", + element: this, + adjustLength: 2, + el: this.trigger, + popup: { + el: this.popup + } + }); + }, + + populate: function (items) { + this.combo.populate(items); + }, + + setValue: function (v) { + this.combo.setValue(v); + }, + + getValue: function () { + return this.combo.getValue(); + } +}); +BI.StaticCombo.EVENT_CHANGE = "EVENT_CHANGE"; +$.shortcut("bi.static_combo", BI.StaticCombo);/** + * @class BI.TextValueCheckCombo + * @extend BI.Widget + * combo : text + icon, popup : check + text + */ +BI.TextValueCheckCombo = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.TextValueCheckCombo.superclass._defaultConfig.apply(this, arguments), { + baseClass: "bi-text-value-check-combo", + width: 100, + height: 30, + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, + text: "" + }) + }, + + _init: function () { + BI.TextValueCheckCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.trigger = BI.createWidget({ + type: "bi.select_text_trigger", + items: o.items, + height: o.height, + text: o.text + }); + this.popup = BI.createWidget({ + type: "bi.text_value_check_combo_popup", + chooseType: o.chooseType, + items: o.items + }); + this.popup.on(BI.TextValueCheckComboPopup.EVENT_CHANGE, function () { + self.setValue(self.popup.getValue()); + self.textIconCheckCombo.hideView(); + self.fireEvent(BI.TextValueCheckCombo.EVENT_CHANGE); + }); + this.popup.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.textIconCheckCombo = BI.createWidget({ + type: "bi.combo", + element: this, + adjustLength: 2, + el: this.trigger, + popup: { + el: this.popup, + maxHeight: 300 + } + }); + }, + + setTitle: function (title) { + this.trigger.setTitle(title); + }, + + setValue: function (v) { + this.textIconCheckCombo.setValue(v); + }, + + setEnable: function (v) { + BI.TextValueCheckCombo.superclass.setEnable.apply(this, arguments); + this.textIconCheckCombo.setEnable(v); + }, + + setWarningTitle: function (title) { + this.trigger.setWarningTitle(title); + }, + + getValue: function () { + return this.textIconCheckCombo.getValue(); + }, + + populate: function (items) { + this.options.items = items; + this.textIconCheckCombo.populate(items); + } +}); +BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; +$.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);/** + * @class BI.SmallTextValueCheckCombo + * @extend BI.Widget + * combo : text + icon, popup : check + text + */ +BI.SmallTextValueCheckCombo = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.SmallTextValueCheckCombo.superclass._defaultConfig.apply(this, arguments), { + width: 100, + height: 24, + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, + text: "" + }) + }, + + _init: function () { + BI.SmallTextValueCheckCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.trigger = BI.createWidget({ + type: "bi.small_select_text_trigger", + items: o.items, + height: o.height, + text: o.text + }); + this.popup = BI.createWidget({ + type: "bi.text_value_check_combo_popup", + chooseType: o.chooseType, + items: o.items + }); + this.popup.on(BI.TextValueCheckComboPopup.EVENT_CHANGE, function () { + self.setValue(self.popup.getValue()); + self.SmallTextIconCheckCombo.hideView(); + self.fireEvent(BI.SmallTextValueCheckCombo.EVENT_CHANGE); + }); + this.popup.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.SmallTextIconCheckCombo = BI.createWidget({ + type: "bi.combo", + element: this, + adjustLength: 2, + el: this.trigger, + popup: { + el: this.popup, + maxHeight: 300 + } + }); + }, + + setValue: function (v) { + this.SmallTextIconCheckCombo.setValue(v); + }, + + setEnable: function (v) { + BI.SmallTextValueCheckCombo.superclass.setEnable.apply(this, arguments); + this.SmallTextIconCheckCombo.setEnable(v); + }, + + getValue: function () { + return this.SmallTextIconCheckCombo.getValue(); + }, + + populate: function (items) { + this.options.items = items; + this.SmallTextIconCheckCombo.populate(items); + } +}); +BI.SmallTextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; +$.shortcut("bi.small_text_value_check_combo", BI.SmallTextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, { + _defaultConfig: function () { + return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-text-icon-popup", + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE + }); + }, + + _init: function () { + BI.TextValueCheckComboPopup.superclass._init.apply(this, arguments); + var o = this.options, self = this; + this.popup = BI.createWidget({ + type: "bi.button_group", + items: this._formatItems(o.items), + chooseType: o.chooseType, + layouts: [{ + type: "bi.vertical" + }] + }); + + this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + if (type === BI.Events.CLICK) { + self.fireEvent(BI.TextValueCheckComboPopup.EVENT_CHANGE, val, obj); + } + }); + + BI.createWidget({ + type: "bi.vertical", + element: this, + items: [this.popup] + }); + }, + + _formatItems: function (items) { + return BI.map(items, function (i, item) { + return BI.extend({ + type: "bi.icon_text_item", + cls: "item-check-font bi-list-item", + height: 30 + }, item); + }); + }, + + populate: function (items) { + BI.TextValueCheckComboPopup.superclass.populate.apply(this, arguments); + this.popup.populate(this._formatItems(items)); + }, + + getValue: function () { + return this.popup.getValue(); + }, + + setValue: function (v) { + this.popup.setValue(v); + } + +}); +BI.TextValueCheckComboPopup.EVENT_CHANGE = "EVENT_CHANGE"; +$.shortcut("bi.text_value_check_combo_popup", BI.TextValueCheckComboPopup);/** + * @class BI.TextValueCombo + * @extend BI.Widget + * combo : text + icon, popup : text + * 参见场景dashboard布局方式选择 + */ +BI.TextValueCombo = BI.inherit(BI.Widget, { _defaultConfig: function () { - return BI.extend(BI.BubblePopupBarView.superclass._defaultConfig.apply(this, arguments), { - extraCls: "bi-bubble-bar-popup-view", - buttons: [{value: BI.i18nText(BI.i18nText("BI-Basic_Sure"))}, {value: BI.i18nText("BI-Basic_Cancel"), level: "ignore"}] + return BI.extend(BI.TextValueCombo.superclass._defaultConfig.apply(this, arguments), { + baseClass: "bi-text-value-combo", + height: 30, + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, + text: "", + el: {} }) }, + _init: function () { - BI.BubblePopupBarView.superclass._init.apply(this, arguments); + BI.TextValueCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.trigger = BI.createWidget(o.el, { + type: "bi.select_text_trigger", + items: o.items, + height: o.height, + text: o.text + }); + this.popup = BI.createWidget({ + type: "bi.text_value_combo_popup", + chooseType: o.chooseType, + items: o.items + }); + this.popup.on(BI.TextValueComboPopup.EVENT_CHANGE, function () { + self.setValue(self.popup.getValue()); + self.textIconCombo.hideView(); + self.fireEvent(BI.TextValueCombo.EVENT_CHANGE, arguments); + }); + this.popup.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.textIconCombo = BI.createWidget({ + type: "bi.combo", + element: this, + adjustLength: 2, + el: this.trigger, + popup: { + el: this.popup, + maxHeight: 300 + } + }); }, - _createToolBar: function () { + + setValue: function (v) { + this.textIconCombo.setValue(v); + }, + + setEnable: function (v) { + BI.TextValueCombo.superclass.setEnable.apply(this, arguments); + this.textIconCombo.setEnable(v); + }, + + getValue: function () { + return this.textIconCombo.getValue(); + }, + + populate: function (items) { + this.options.items = items; + this.textIconCombo.populate(items); + } +}); +BI.TextValueCombo.EVENT_CHANGE = "EVENT_CHANGE"; +$.shortcut("bi.text_value_combo", BI.TextValueCombo);/** + * @class BI.SmallTextValueCombo + * @extend BI.Widget + * combo : text + icon, popup : text + * 参见场景dashboard布局方式选择 + */ +BI.SmallTextValueCombo = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.SmallTextValueCombo.superclass._defaultConfig.apply(this, arguments), { + width: 100, + height: 24, + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, + el: {}, + text: "" + }) + }, + + _init: function () { + BI.SmallTextValueCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + this.trigger = BI.createWidget(o.el, { + type: "bi.small_select_text_trigger", + items: o.items, + height: o.height, + text: o.text + }); + this.popup = BI.createWidget({ + type: "bi.text_value_combo_popup", + chooseType: o.chooseType, + items: o.items + }); + this.popup.on(BI.TextValueComboPopup.EVENT_CHANGE, function () { + self.setValue(self.popup.getValue()); + self.SmallTextValueCombo.hideView(); + self.fireEvent(BI.SmallTextValueCombo.EVENT_CHANGE); + }); + this.popup.on(BI.Controller.EVENT_CHANGE, function () { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + }); + this.SmallTextValueCombo = BI.createWidget({ + type: "bi.combo", + element: this, + adjustLength: 2, + el: this.trigger, + popup: { + el: this.popup, + maxHeight: 300 + } + }); + }, + + setValue: function (v) { + this.SmallTextValueCombo.setValue(v); + }, + + setEnable: function (v) { + BI.SmallTextValueCombo.superclass.setEnable.apply(this, arguments); + this.SmallTextValueCombo.setEnable(v); + }, + + getValue: function () { + return this.SmallTextValueCombo.getValue(); + }, + + populate: function (items) { + this.options.items = items; + this.SmallTextValueCombo.populate(items); + } +}); +BI.SmallTextValueCombo.EVENT_CHANGE = "EVENT_CHANGE"; +$.shortcut("bi.small_text_value_combo", BI.SmallTextValueCombo);BI.TextValueComboPopup = BI.inherit(BI.Pane, { + _defaultConfig: function () { + return BI.extend(BI.TextValueComboPopup.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-text-icon-popup", + chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE + }); + }, + + _init: function () { + BI.TextValueComboPopup.superclass._init.apply(this, arguments); var o = this.options, self = this; + this.popup = BI.createWidget({ + type: "bi.button_group", + items: BI.createItems(o.items, { + type: "bi.single_select_item", + textAlign: o.textAlign, + height: 30 + }), + chooseType: o.chooseType, + layouts: [{ + type: "bi.vertical" + }] + }); - var items = []; - BI.each(o.buttons.reverse(), function (i, buttonOpt) { - if(BI.isWidget(buttonOpt)){ - items.push(buttonOpt); - }else{ - items.push(BI.extend({ - type: 'bi.button', - height: 30, - handler: function (v) { - self.fireEvent(BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON, v); - } - }, buttonOpt)) + this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) { + self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); + if (type === BI.Events.CLICK) { + self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val, obj); } }); - return BI.createWidget({ - type: 'bi.right_vertical_adapt', - height: 40, - hgap: 10, - bgap: 10, - items: items + + BI.createWidget({ + type: "bi.vertical", + element: this, + items: [this.popup] + }); + }, + + populate: function (items) { + BI.TextValueComboPopup.superclass.populate.apply(this, arguments); + items = BI.createItems(items, { + type: "bi.single_select_item", + height: 30 }); + this.popup.populate(items); + }, + + getValue: function () { + return this.popup.getValue(); + }, + + setValue: function (v) { + this.popup.setValue(v); } + }); -BI.BubblePopupBarView.EVENT_CLICK_TOOLBAR_BUTTON = "EVENT_CLICK_TOOLBAR_BUTTON"; -$.shortcut("bi.bubble_bar_popup_view", BI.BubblePopupBarView);/** +BI.TextValueComboPopup.EVENT_CHANGE = "EVENT_CHANGE"; +$.shortcut("bi.text_value_combo_popup", BI.TextValueComboPopup);/** + * @class BI.TextValueDownListCombo + * @extend BI.Widget + */ +BI.TextValueDownListCombo = BI.inherit(BI.Widget, { + _defaultConfig: function () { + return BI.extend(BI.TextValueDownListCombo.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-text-value-down-list-combo", + height: 30, + text: "" + }) + }, + + _init: function () { + BI.TextValueDownListCombo.superclass._init.apply(this, arguments); + var self = this, o = this.options; + + this._createValueMap(); + + this.trigger = BI.createWidget({ + type: "bi.down_list_select_text_trigger", + height: o.height, + items: o.items + }); + + this.combo = BI.createWidget({ + type: "bi.down_list_combo", + element: this, + chooseType: BI.Selection.Single, + adjustLength: 2, + height: o.height, + el: this.trigger, + items: BI.deepClone(o.items) + }); + + this.combo.on(BI.DownListCombo.EVENT_CHANGE, function () { + self.setValue(self.combo.getValue()[0].value); + self.fireEvent(BI.TextValueDownListCombo.EVENT_CHANGE); + }); + + this.combo.on(BI.DownListCombo.EVENT_SON_VALUE_CHANGE, function () { + self.setValue(self.combo.getValue()[0].childValue); + self.fireEvent(BI.TextValueDownListCombo.EVENT_CHANGE); + }); + }, + + _createValueMap: function () { + var self = this; + this.valueMap = {}; + BI.each(BI.flatten(this.options.items), function (idx, item) { + if (BI.has(item, "el")) { + BI.each(item.children, function (id, it) { + self.valueMap[it.value] = {value: item.el.value, childValue: it.value} + }); + } else { + self.valueMap[item.value] = {value: item.value}; + } + }); + }, + + setValue: function (v) { + v = this.valueMap[v]; + this.combo.setValue([v]); + this.trigger.setValue(v.childValue || v.value); + }, + + setEnable: function (v) { + BI.TextValueDownListCombo.superclass.setEnable.apply(this, arguments); + this.combo.setEnable(v); + }, + + getValue: function () { + var v = this.combo.getValue()[0]; + return [v.childValue || v.value]; + }, + + populate: function (items) { + this.options.items = BI.flatten(items); + this.combo.populate(items); + this._createValueMap(); + } +}); +BI.TextValueDownListCombo.EVENT_CHANGE = "EVENT_CHANGE"; +$.shortcut("bi.text_value_down_list_combo", BI.TextValueDownListCombo);/** + * 选择字段trigger, downlist专用 + * 显示形式为 父亲值(儿子值) + * + * @class BI.DownListSelectTextTrigger + * @extends BI.Trigger + */ +BI.DownListSelectTextTrigger = BI.inherit(BI.Trigger, { + + _defaultConfig: function () { + return BI.extend(BI.DownListSelectTextTrigger.superclass._defaultConfig.apply(this, arguments), { + baseCls: "bi-down-list-select-text-trigger", + height: 24, + text: "" + }); + }, + + _init: function () { + BI.DownListSelectTextTrigger.superclass._init.apply(this, arguments); + var o = this.options; + this.trigger = BI.createWidget({ + type: "bi.select_text_trigger", + element: this, + height: o.height, + items: this._formatItemArray(o.items), + text: o.text + }); + }, + + _formatItemArray: function(){ + var sourceArray = BI.flatten(BI.deepClone(this.options.items)); + var targetArray = []; + BI.each(sourceArray, function(idx, item){ + if(BI.has(item, "el")){ + BI.each(item.children, function(id, it){ + it.text = item.el.text + "(" + it.text + ")"; + }); + targetArray = BI.concat(targetArray, item.children); + }else{ + targetArray.push(item); + } + }); + return targetArray; + }, + + setValue: function (vals) { + this.trigger.setValue(vals); + }, + + populate: function (items) { + this.trigger.populate(this._formatItemArray(items)); + } +}); +$.shortcut("bi.down_list_select_text_trigger", BI.DownListSelectTextTrigger);/** * guy * 记录内容的输入框 * @class BI.RecordEditor diff --git a/dist/core.js b/dist/core.js index 45fcafe631..768b96f72a 100644 --- a/dist/core.js +++ b/dist/core.js @@ -20404,16 +20404,7 @@ BI.BubblesController = BI.inherit(BI.Controller, { }); }, - hide: function (name, callback) { - if (!this.has(name)) { - return this; - } - this.get(name).element.hide(0, callback); - this.get(name).invisible(); - return this; - }, - - _getOffsetLeft: function(name, context, offsetStyle){ + _getOffsetLeft: function (name, context, offsetStyle) { var left = 0; if ("center" === offsetStyle) { left = context.element.offset().left + (context.element.bounds().width - this.get(name).element.bounds().width) / 2; @@ -20432,7 +20423,7 @@ BI.BubblesController = BI.inherit(BI.Controller, { return context.element.offset().left; }, - _getOffsetTop: function(name, context, offsetStyle){ + _getOffsetTop: function (name, context, offsetStyle) { var top = 0; if ("center" === offsetStyle) { top = context.element.offset().top + (context.element.bounds().height - this.get(name).element.bounds().height) / 2; @@ -20450,25 +20441,25 @@ BI.BubblesController = BI.inherit(BI.Controller, { return context.element.offset().top; }, - _getLeftPosition: function(name, context, offsetStyle){ + _getLeftPosition: function (name, context, offsetStyle) { var position = $.getLeftPosition(context, this.get(name)); position.top = this._getOffsetTop(name, context, offsetStyle); return position; }, - _getBottomPosition: function(name, context, offsetStyle){ + _getBottomPosition: function (name, context, offsetStyle) { var position = $.getBottomPosition(context, this.get(name)); position.left = this._getOffsetLeft(name, context, offsetStyle); return position; }, - _getTopPosition: function(name, context, offsetStyle){ + _getTopPosition: function (name, context, offsetStyle) { var position = $.getTopPosition(context, this.get(name)); position.left = this._getOffsetLeft(name, context, offsetStyle); return position; }, - _getRightPosition: function(name, context, offsetStyle){ + _getRightPosition: function (name, context, offsetStyle) { var position = $.getRightPosition(context, this.get(name)); position.top = this._getOffsetTop(name, context, offsetStyle); return position; @@ -20498,8 +20489,8 @@ BI.BubblesController = BI.inherit(BI.Controller, { items: [{ el: this.storeBubbles[name]["top"] }] - }) - this.set(name, this.storeBubbles[name]["top"]) + }); + this.set(name, this.storeBubbles[name]["top"]); var position = this._getTopPosition(name, context, offsetStyle); this.get(name).element.css({left: position.left, top: position.top}); this.get(name).invisible(); @@ -20513,7 +20504,7 @@ BI.BubblesController = BI.inherit(BI.Controller, { items: [{ el: this.storeBubbles[name]["left"] }] - }) + }); this.set(name, this.storeBubbles[name]["left"]); var position = this._getLeftPosition(name, context, offsetStyle); this.get(name).element.css({left: position.left, top: position.top}); @@ -20528,8 +20519,8 @@ BI.BubblesController = BI.inherit(BI.Controller, { items: [{ el: this.storeBubbles[name]["right"] }] - }) - this.set(name, this.storeBubbles[name]["right"]) + }); + this.set(name, this.storeBubbles[name]["right"]); var position = this._getRightPosition(name, context, offsetStyle); this.get(name).element.css({left: position.left, top: position.top}); this.get(name).invisible(); @@ -20556,6 +20547,14 @@ BI.BubblesController = BI.inherit(BI.Controller, { return this; }, + hide: function (name) { + if (!this.has(name)) { + return this; + } + this.get(name).invisible(); + return this; + }, + add: function (name, bubble) { if (this.has(name)) { return this; @@ -20580,7 +20579,10 @@ BI.BubblesController = BI.inherit(BI.Controller, { if (!this.has(name)) { return this; } - this.bubblesManager[name].destroy(); + BI.each(this.storeBubbles[name], function (dir, bubble) { + bubble.destroy(); + }); + delete this.storeBubbles[name]; delete this.bubblesManager[name]; return this; } diff --git a/dist/widget.js b/dist/widget.js index 37ea159069..c81b18d84a 100644 --- a/dist/widget.js +++ b/dist/widget.js @@ -3828,1181 +3828,6 @@ BI.extend(BI.Arrangement, { } }); $.shortcut('bi.arrangement', BI.Arrangement);/** - * Created by Young's on 2016/4/28. - */ -BI.EditorIconCheckCombo = BI.inherit(BI.Widget, { - _defaultConfig: function () { - return BI.extend(BI.EditorIconCheckCombo.superclass._defaultConfig.apply(this, arguments), { - baseClass: "bi-check-editor-combo", - width: 100, - height: 30, - chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, - validationChecker: BI.emptyFn, - quitChecker: BI.emptyFn, - allowBlank: true, - watermark: "", - errorText: "" - }) - }, - - _init: function () { - BI.EditorIconCheckCombo.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.trigger = BI.createWidget({ - type: "bi.editor_trigger", - items: o.items, - height: o.height, - validationChecker: o.validationChecker, - quitChecker: o.quitChecker, - allowBlank: o.allowBlank, - watermark: o.watermark, - errorText: o.errorText - }); - this.trigger.on(BI.EditorTrigger.EVENT_CHANGE, function () { - self.popup.setValue(this.getValue()); - self.fireEvent(BI.EditorIconCheckCombo.EVENT_CHANGE); - }); - this.popup = BI.createWidget({ - type: "bi.text_value_check_combo_popup", - chooseType: o.chooseType, - items: o.items - }); - this.popup.on(BI.TextValueCheckComboPopup.EVENT_CHANGE, function () { - self.setValue(self.popup.getValue()); - self.editorIconCheckCombo.hideView(); - self.fireEvent(BI.EditorIconCheckCombo.EVENT_CHANGE); - }); - this.popup.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); - this.editorIconCheckCombo = BI.createWidget({ - type: "bi.combo", - element: this, - adjustLength: 2, - el: this.trigger, - popup: { - el: this.popup, - maxHeight: 300 - } - }); - }, - - setValue: function (v) { - this.editorIconCheckCombo.setValue(v); - }, - - setEnable: function (v) { - BI.EditorIconCheckCombo.superclass.setEnable.apply(this, arguments); - this.editorIconCheckCombo.setEnable(v); - }, - - getValue: function () { - return this.trigger.getValue(); - }, - - populate: function (items) { - this.options.items = items; - this.editorIconCheckCombo.populate(items); - } -}); -BI.EditorIconCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; -$.shortcut("bi.editor_icon_check_combo", BI.EditorIconCheckCombo);/** - * Created by GUY on 2016/4/25. - * - * @class BI.FormulaCombo - * @extend BI.Widget - */ -BI.FormulaCombo = BI.inherit(BI.Widget, { - - _constant: { - POPUP_HEIGHT: 450, - POPUP_WIDTH: 600, - POPUP_V_GAP: 10, - POPUP_H_GAP: 10, - ADJUST_LENGTH: 2, - HEIGHT_MAX: 10000, - MAX_HEIGHT: 500, - MAX_WIDTH: 600, - COMBO_TRIGGER_WIDTH: 300 - }, - - _defaultConfig: function () { - return BI.extend(BI.FormulaCombo.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-formula-combo", - height: 30, - items: [] - }) - }, - - _init: function () { - BI.FormulaCombo.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.formula_ids = []; - this.input = BI.createWidget({ - type: "bi.formula_combo_trigger", - height: o.height, - items: o.items - }); - this.formulaPopup = BI.createWidget({ - type: "bi.formula_combo_popup", - fieldItems: o.items - }); - - this.formulaInputCombo = BI.createWidget({ - type: "bi.combo", - element: this, - isNeedAdjustHeight: true, - isNeedAdjustWidth: false, - adjustLength: this._constant.CONDITION_TYPE_COMBO_ADJUST, - el: this.input, - popup: { - el: { - type: "bi.absolute", - height: this._constant.HEIGHT_MAX, - width: this._constant.POPUP_WIDTH, - items: [{ - el: this.formulaPopup, - top: this._constant.POPUP_V_GAP, - left: this._constant.POPUP_H_GAP, - right: this._constant.POPUP_V_GAP, - bottom: 0 - }] - }, - stopPropagation: false, - maxHeight: this._constant.MAX_HEIGHT, - width: this._constant.MAX_WIDTH - } - }); - this.formulaInputCombo.on(BI.Combo.EVENT_AFTER_POPUPVIEW, function () { - self.formulaPopup.setValue(self.input.getValue()); - }); - this.formulaPopup.on(BI.FormulaComboPopup.EVENT_CHANGE, function () { - self.setValue(self.formulaPopup.getValue()); - self.formulaInputCombo.hideView(); - self.fireEvent(BI.FormulaCombo.EVENT_CHANGE); - }); - this.formulaPopup.on(BI.FormulaComboPopup.EVENT_VALUE_CANCEL, function () { - self.formulaInputCombo.hideView(); - }); - }, - - setValue: function (v) { - if (this.formulaInputCombo.isViewVisible()) { - this.formulaInputCombo.hideView(); - } - this.input.setValue(v); - this.input.setText(BI.Func.getFormulaStringFromFormulaValue(v)); - this.formulaPopup.setValue(this.input.getValue()); - }, - - getFormulaTargetIds: function() { - return this.formulaPopup.getFormulaTargetIds(); - }, - - getValue: function () { - return this.input.getValue(); - } -}); -BI.FormulaCombo.EVENT_CHANGE = "EVENT_CHANGE"; -$.shortcut("bi.formula_combo", BI.FormulaCombo);/** - * Created by GUY on 2016/4/25. - * - * @class BI.FormulaComboPopup - * @extend BI.Widget - */ -BI.FormulaComboPopup = BI.inherit(BI.Widget, { - - _constant: { - BUTTON_HEIGHT: 30, - SOUTH_HEIGHT: 60, - SOUTH_H_GAP: 10 - }, - - _defaultConfig: function () { - return BI.extend(BI.FormulaComboPopup.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-formula-pane-popup" - }) - }, - - _init: function () { - BI.FormulaComboPopup.superclass._init.apply(this, arguments); - this.populate(); - }, - - populate: function () { - var self = this, fieldItems = this.options.fieldItems; - this.formula = BI.createWidget({ - type: "bi.formula_insert" - }); - this.formula.populate(fieldItems); - var confirmButton = BI.createWidget({ - type: "bi.button", - level: "common", - height: this._constant.BUTTON_HEIGHT, - text: BI.i18nText("BI-Basic_OK") - }); - var cancelButton = BI.createWidget({ - type: "bi.button", - level: "ignore", - height: this._constant.BUTTON_HEIGHT, - text: BI.i18nText("BI-Basic_Cancel") - }); - - this.formula.on(BI.FormulaInsert.EVENT_CHANGE, function () { - confirmButton.setEnable(self.formula.checkValidation()); - }); - confirmButton.on(BI.Button.EVENT_CHANGE, function () { - self.fireEvent(BI.FormulaComboPopup.EVENT_CHANGE); - }); - cancelButton.on(BI.Button.EVENT_CHANGE, function () { - self.setValue(self.oldValue); - self.fireEvent(BI.FormulaComboPopup.EVENT_VALUE_CANCEL); - }); - - BI.createWidget({ - type: "bi.vtape", - element: this, - items: [{ - el: this.formula, - height: "fill" - }, { - el: { - type: "bi.right_vertical_adapt", - height: this._constant.SOUTH_HEIGHT, - items: [cancelButton, confirmButton], - hgap: this._constant.SOUTH_H_GAP - }, - height: this._constant.SOUTH_HEIGHT - }] - }) - }, - - getFormulaTargetIds: function(){ - return this.formula.getUsedFields(); - }, - - getValue: function () { - return this.formula.getValue(); - }, - - setValue: function (v) { - this.oldValue = v; - this.formula.setValue(v); - } -}); -BI.FormulaComboPopup.EVENT_CHANGE = "EVENT_CHANGE"; -BI.FormulaComboPopup.EVENT_VALUE_CANCEL = "EVENT_VALUE_CANCEL"; -$.shortcut("bi.formula_combo_popup", BI.FormulaComboPopup);/** - * Created by GUY on 2016/4/25. - * - * @class BI.FormulaComboTrigger - * @extend BI.Widget - */ -BI.FormulaComboTrigger = BI.inherit(BI.Widget, { - - _defaultConfig: function () { - return BI.extend(BI.FormulaComboTrigger.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-formula-combo-trigger", - height: 30, - items: [] - }) - }, - - _init: function () { - BI.FormulaComboTrigger.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.label = BI.createWidget({ - type: "bi.label", - element: this, - textAlign: "left", - textHeight: this.options.height, - lgap: 10 - }); - }, - - _getTextFromFormulaValue: function (formulaValue) { - var self = this; - var formulaString = ""; - var regx = /\$[\{][^\}]*[\}]|\w*\w|\$\{[^\$\(\)\+\-\*\/)\$,]*\w\}|\$\{[^\$\(\)\+\-\*\/]*\w\}|\$\{[^\$\(\)\+\-\*\/]*[\u4e00-\u9fa5]\}|\w|(.)/g; - var result = formulaValue.match(regx); - BI.each(result, function (i, item) { - var fieldRegx = /\$[\{][^\}]*[\}]/; - var str = item.match(fieldRegx); - if (BI.isNotEmptyArray(str)) { - var id = str[0].substring(2, item.length - 1); - var item = BI.find(self.options.items, function (i, item) { - return id === item.value; - }); - formulaString = formulaString + item.text; - } else { - formulaString = formulaString + item; - } - }); - return formulaString; - }, - - getValue: function () { - return this.options.value; - }, - - setValue: function (v) { - this.options.value = v; - this.label.setText(this._getTextFromFormulaValue(v)); - } -}); -$.shortcut("bi.formula_combo_trigger", BI.FormulaComboTrigger);/** - * Created by GUY on 2016/2/2. - * - * @class BI.IconCombo - * @extend BI.Widget - */ -BI.IconCombo = BI.inherit(BI.Widget, { - _defaultConfig: function () { - return BI.extend(BI.IconCombo.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-icon-combo", - width: 24, - height: 24, - iconClass: "", - el: {}, - popup: {}, - minWidth: 100, - maxWidth: 'auto', - maxHeight: 300, - direction: "bottom", - adjustLength: 3,//调整的距离 - adjustXOffset: 0, - adjustYOffset: 0, - offsetStyle: "left", - chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE - }) - }, - - _init: function () { - BI.IconCombo.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.trigger = BI.createWidget(o.el, { - type: "bi.icon_combo_trigger", - iconClass: o.iconClass, - title: o.title, - items: o.items, - width: o.width, - height: o.height, - iconWidth: o.iconWidth, - iconHeight: o.iconHeight - }); - this.popup = BI.createWidget(o.popup, { - type: "bi.icon_combo_popup", - chooseType: o.chooseType, - items: o.items - }); - this.popup.on(BI.IconComboPopup.EVENT_CHANGE, function () { - self.setValue(self.popup.getValue()); - self.iconCombo.hideView(); - self.fireEvent(BI.IconCombo.EVENT_CHANGE); - }); - this.popup.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); - this.iconCombo = BI.createWidget({ - type: "bi.combo", - element: this, - direction: o.direction, - adjustLength: o.adjustLength, - adjustXOffset: o.adjustXOffset, - adjustYOffset: o.adjustYOffset, - offsetStyle: o.offsetStyle, - el: this.trigger, - popup: { - el: this.popup, - maxWidth: o.maxWidth, - maxHeight: o.maxHeight, - minWidth: o.minWidth - } - }); - }, - - showView: function () { - this.iconCombo.showView(); - }, - - hideView: function () { - this.iconCombo.hideView(); - }, - - setValue: function (v) { - this.iconCombo.setValue(v); - }, - - setEnable: function (v) { - BI.IconCombo.superclass.setEnable.apply(this, arguments); - this.iconCombo.setEnable(v); - }, - - getValue: function () { - return this.iconCombo.getValue(); - }, - - populate: function (items) { - this.options.items = items; - this.iconCombo.populate(items); - } -}); -BI.IconCombo.EVENT_CHANGE = "EVENT_CHANGE"; -$.shortcut("bi.icon_combo", BI.IconCombo);/** - * Created by GUY on 2016/2/2. - * - * @class BI.IconComboPopup - * @extend BI.Pane - */ -BI.IconComboPopup = BI.inherit(BI.Pane, { - _defaultConfig: function () { - return BI.extend(BI.IconComboPopup.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi.icon-combo-popup", - chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE - }); - }, - - _init: function () { - BI.IconComboPopup.superclass._init.apply(this, arguments); - var o = this.options, self = this; - this.popup = BI.createWidget({ - type: "bi.button_group", - items: BI.createItems(o.items, { - type: "bi.single_select_icon_text_item", - height: 30 - }), - chooseType: o.chooseType, - layouts: [{ - type: "bi.vertical" - }] - }); - - this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - if (type === BI.Events.CLICK) { - self.fireEvent(BI.IconComboPopup.EVENT_CHANGE, val, obj); - } - }); - - BI.createWidget({ - type: "bi.vertical", - element: this, - items: [this.popup] - }); - }, - - populate: function (items) { - BI.IconComboPopup.superclass.populate.apply(this, arguments); - items = BI.createItems(items, { - type: "bi.single_select_icon_text_item", - height: 30 - }); - this.popup.populate(items); - }, - - getValue: function () { - return this.popup.getValue(); - }, - - setValue: function (v) { - this.popup.setValue(v); - } - -}); -BI.IconComboPopup.EVENT_CHANGE = "EVENT_CHANGE"; -$.shortcut("bi.icon_combo_popup", BI.IconComboPopup);/** - * Created by GUY on 2016/2/2. - * - * @class BI.IconComboTrigger - * @extend BI.Widget - */ -BI.IconComboTrigger = BI.inherit(BI.Trigger, { - _defaultConfig: function () { - return BI.extend(BI.IconComboTrigger.superclass._defaultConfig.apply(this, arguments), { - extraCls: "bi-icon-combo-trigger", - el: {}, - items: [], - iconClass: "", - width: 25, - height: 25, - isShowDown: true - }); - }, - - _init: function () { - BI.IconComboTrigger.superclass._init.apply(this, arguments); - var o = this.options, self = this; - this.button = BI.createWidget(o.el, { - type: "bi.icon_change_button", - cls: "icon-combo-trigger-icon " + o.iconClass, - disableSelected: true, - width: o.width, - height: o.height, - iconWidth: o.iconWidth, - iconHeight: o.iconHeight - }); - this.down = BI.createWidget({ - type: "bi.icon_button", - disableSelected: true, - cls: "icon-combo-down-icon trigger-triangle-font", - width: 12, - height: 8 - }); - this.down.setVisible(o.isShowDown); - BI.createWidget({ - type: "bi.absolute", - element: this, - items: [{ - el: this.button, - left: 0, - right: 0, - top: 0, - bottom: 0 - }, { - el: this.down, - right: 0, - bottom: 0 - }] - }); - if (BI.isKey(o.value)) { - this.setValue(o.value); - } - }, - - populate: function (items) { - var o = this.options; - this.options.items = items || []; - this.button.setIcon(o.iconClass); - this.button.setSelected(false); - this.down.setSelected(false); - }, - - setValue: function (v) { - BI.IconComboTrigger.superclass.setValue.apply(this, arguments); - var o = this.options; - var iconClass = ""; - v = BI.isArray(v) ? v[0] : v; - if (BI.any(this.options.items, function (i, item) { - if (v === item.value) { - iconClass = item.iconClass; - return true; - } - })) { - this.button.setIcon(iconClass); - this.button.setSelected(true); - this.down.setSelected(true); - } else { - this.button.setIcon(o.iconClass); - this.button.setSelected(false); - this.down.setSelected(false); - } - } -}); -BI.IconComboTrigger.EVENT_CHANGE = "EVENT_CHANGE"; -$.shortcut("bi.icon_combo_trigger", BI.IconComboTrigger);/** - * 单选combo - * - * @class BI.StaticCombo - * @extend BI.Widget - */ -BI.StaticCombo = BI.inherit(BI.Widget, { - _defaultConfig: function () { - return BI.extend(BI.StaticCombo.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-static-combo", - height: 30, - text: "", - el: {}, - items: [], - chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE - }) - }, - - _init: function () { - BI.StaticCombo.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.trigger = BI.createWidget(o.el, { - type: "bi.text_icon_item", - cls: "bi-select-text-trigger pull-down-font", - text: o.text, - readonly: true, - textLgap: 5, - height: o.height - 2 - }); - this.popup = BI.createWidget({ - type: "bi.text_value_combo_popup", - textAlign: o.textAlign, - chooseType: o.chooseType, - items: o.items - }); - this.popup.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); - this.popup.on(BI.TextValueComboPopup.EVENT_CHANGE, function () { - self.combo.hideView(); - self.fireEvent(BI.StaticCombo.EVENT_CHANGE, arguments); - }); - this.combo = BI.createWidget({ - type: "bi.combo", - element: this, - adjustLength: 2, - el: this.trigger, - popup: { - el: this.popup - } - }); - }, - - populate: function (items) { - this.combo.populate(items); - }, - - setValue: function (v) { - this.combo.setValue(v); - }, - - getValue: function () { - return this.combo.getValue(); - } -}); -BI.StaticCombo.EVENT_CHANGE = "EVENT_CHANGE"; -$.shortcut("bi.static_combo", BI.StaticCombo);/** - * @class BI.TextValueCheckCombo - * @extend BI.Widget - * combo : text + icon, popup : check + text - */ -BI.TextValueCheckCombo = BI.inherit(BI.Widget, { - _defaultConfig: function () { - return BI.extend(BI.TextValueCheckCombo.superclass._defaultConfig.apply(this, arguments), { - baseClass: "bi-text-value-check-combo", - width: 100, - height: 30, - chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, - text: "" - }) - }, - - _init: function () { - BI.TextValueCheckCombo.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.trigger = BI.createWidget({ - type: "bi.select_text_trigger", - items: o.items, - height: o.height, - text: o.text - }); - this.popup = BI.createWidget({ - type: "bi.text_value_check_combo_popup", - chooseType: o.chooseType, - items: o.items - }); - this.popup.on(BI.TextValueCheckComboPopup.EVENT_CHANGE, function () { - self.setValue(self.popup.getValue()); - self.textIconCheckCombo.hideView(); - self.fireEvent(BI.TextValueCheckCombo.EVENT_CHANGE); - }); - this.popup.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); - this.textIconCheckCombo = BI.createWidget({ - type: "bi.combo", - element: this, - adjustLength: 2, - el: this.trigger, - popup: { - el: this.popup, - maxHeight: 300 - } - }); - }, - - setTitle: function (title) { - this.trigger.setTitle(title); - }, - - setValue: function (v) { - this.textIconCheckCombo.setValue(v); - }, - - setEnable: function (v) { - BI.TextValueCheckCombo.superclass.setEnable.apply(this, arguments); - this.textIconCheckCombo.setEnable(v); - }, - - setWarningTitle: function (title) { - this.trigger.setWarningTitle(title); - }, - - getValue: function () { - return this.textIconCheckCombo.getValue(); - }, - - populate: function (items) { - this.options.items = items; - this.textIconCheckCombo.populate(items); - } -}); -BI.TextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; -$.shortcut("bi.text_value_check_combo", BI.TextValueCheckCombo);/** - * @class BI.SmallTextValueCheckCombo - * @extend BI.Widget - * combo : text + icon, popup : check + text - */ -BI.SmallTextValueCheckCombo = BI.inherit(BI.Widget, { - _defaultConfig: function () { - return BI.extend(BI.SmallTextValueCheckCombo.superclass._defaultConfig.apply(this, arguments), { - width: 100, - height: 24, - chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, - text: "" - }) - }, - - _init: function () { - BI.SmallTextValueCheckCombo.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.trigger = BI.createWidget({ - type: "bi.small_select_text_trigger", - items: o.items, - height: o.height, - text: o.text - }); - this.popup = BI.createWidget({ - type: "bi.text_value_check_combo_popup", - chooseType: o.chooseType, - items: o.items - }); - this.popup.on(BI.TextValueCheckComboPopup.EVENT_CHANGE, function () { - self.setValue(self.popup.getValue()); - self.SmallTextIconCheckCombo.hideView(); - self.fireEvent(BI.SmallTextValueCheckCombo.EVENT_CHANGE); - }); - this.popup.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); - this.SmallTextIconCheckCombo = BI.createWidget({ - type: "bi.combo", - element: this, - adjustLength: 2, - el: this.trigger, - popup: { - el: this.popup, - maxHeight: 300 - } - }); - }, - - setValue: function (v) { - this.SmallTextIconCheckCombo.setValue(v); - }, - - setEnable: function (v) { - BI.SmallTextValueCheckCombo.superclass.setEnable.apply(this, arguments); - this.SmallTextIconCheckCombo.setEnable(v); - }, - - getValue: function () { - return this.SmallTextIconCheckCombo.getValue(); - }, - - populate: function (items) { - this.options.items = items; - this.SmallTextIconCheckCombo.populate(items); - } -}); -BI.SmallTextValueCheckCombo.EVENT_CHANGE = "EVENT_CHANGE"; -$.shortcut("bi.small_text_value_check_combo", BI.SmallTextValueCheckCombo);BI.TextValueCheckComboPopup = BI.inherit(BI.Pane, { - _defaultConfig: function () { - return BI.extend(BI.TextValueCheckComboPopup.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-text-icon-popup", - chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE - }); - }, - - _init: function () { - BI.TextValueCheckComboPopup.superclass._init.apply(this, arguments); - var o = this.options, self = this; - this.popup = BI.createWidget({ - type: "bi.button_group", - items: this._formatItems(o.items), - chooseType: o.chooseType, - layouts: [{ - type: "bi.vertical" - }] - }); - - this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - if (type === BI.Events.CLICK) { - self.fireEvent(BI.TextValueCheckComboPopup.EVENT_CHANGE, val, obj); - } - }); - - BI.createWidget({ - type: "bi.vertical", - element: this, - items: [this.popup] - }); - }, - - _formatItems: function (items) { - return BI.map(items, function (i, item) { - return BI.extend({ - type: "bi.icon_text_item", - cls: "item-check-font bi-list-item", - height: 30 - }, item); - }); - }, - - populate: function (items) { - BI.TextValueCheckComboPopup.superclass.populate.apply(this, arguments); - this.popup.populate(this._formatItems(items)); - }, - - getValue: function () { - return this.popup.getValue(); - }, - - setValue: function (v) { - this.popup.setValue(v); - } - -}); -BI.TextValueCheckComboPopup.EVENT_CHANGE = "EVENT_CHANGE"; -$.shortcut("bi.text_value_check_combo_popup", BI.TextValueCheckComboPopup);/** - * @class BI.TextValueCombo - * @extend BI.Widget - * combo : text + icon, popup : text - * 参见场景dashboard布局方式选择 - */ -BI.TextValueCombo = BI.inherit(BI.Widget, { - _defaultConfig: function () { - return BI.extend(BI.TextValueCombo.superclass._defaultConfig.apply(this, arguments), { - baseClass: "bi-text-value-combo", - height: 30, - chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, - text: "", - el: {} - }) - }, - - _init: function () { - BI.TextValueCombo.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.trigger = BI.createWidget(o.el, { - type: "bi.select_text_trigger", - items: o.items, - height: o.height, - text: o.text - }); - this.popup = BI.createWidget({ - type: "bi.text_value_combo_popup", - chooseType: o.chooseType, - items: o.items - }); - this.popup.on(BI.TextValueComboPopup.EVENT_CHANGE, function () { - self.setValue(self.popup.getValue()); - self.textIconCombo.hideView(); - self.fireEvent(BI.TextValueCombo.EVENT_CHANGE, arguments); - }); - this.popup.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); - this.textIconCombo = BI.createWidget({ - type: "bi.combo", - element: this, - adjustLength: 2, - el: this.trigger, - popup: { - el: this.popup, - maxHeight: 300 - } - }); - }, - - setValue: function (v) { - this.textIconCombo.setValue(v); - }, - - setEnable: function (v) { - BI.TextValueCombo.superclass.setEnable.apply(this, arguments); - this.textIconCombo.setEnable(v); - }, - - getValue: function () { - return this.textIconCombo.getValue(); - }, - - populate: function (items) { - this.options.items = items; - this.textIconCombo.populate(items); - } -}); -BI.TextValueCombo.EVENT_CHANGE = "EVENT_CHANGE"; -$.shortcut("bi.text_value_combo", BI.TextValueCombo);/** - * @class BI.SmallTextValueCombo - * @extend BI.Widget - * combo : text + icon, popup : text - * 参见场景dashboard布局方式选择 - */ -BI.SmallTextValueCombo = BI.inherit(BI.Widget, { - _defaultConfig: function () { - return BI.extend(BI.SmallTextValueCombo.superclass._defaultConfig.apply(this, arguments), { - width: 100, - height: 24, - chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE, - el: {}, - text: "" - }) - }, - - _init: function () { - BI.SmallTextValueCombo.superclass._init.apply(this, arguments); - var self = this, o = this.options; - this.trigger = BI.createWidget(o.el, { - type: "bi.small_select_text_trigger", - items: o.items, - height: o.height, - text: o.text - }); - this.popup = BI.createWidget({ - type: "bi.text_value_combo_popup", - chooseType: o.chooseType, - items: o.items - }); - this.popup.on(BI.TextValueComboPopup.EVENT_CHANGE, function () { - self.setValue(self.popup.getValue()); - self.SmallTextValueCombo.hideView(); - self.fireEvent(BI.SmallTextValueCombo.EVENT_CHANGE); - }); - this.popup.on(BI.Controller.EVENT_CHANGE, function () { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - }); - this.SmallTextValueCombo = BI.createWidget({ - type: "bi.combo", - element: this, - adjustLength: 2, - el: this.trigger, - popup: { - el: this.popup, - maxHeight: 300 - } - }); - }, - - setValue: function (v) { - this.SmallTextValueCombo.setValue(v); - }, - - setEnable: function (v) { - BI.SmallTextValueCombo.superclass.setEnable.apply(this, arguments); - this.SmallTextValueCombo.setEnable(v); - }, - - getValue: function () { - return this.SmallTextValueCombo.getValue(); - }, - - populate: function (items) { - this.options.items = items; - this.SmallTextValueCombo.populate(items); - } -}); -BI.SmallTextValueCombo.EVENT_CHANGE = "EVENT_CHANGE"; -$.shortcut("bi.small_text_value_combo", BI.SmallTextValueCombo);BI.TextValueComboPopup = BI.inherit(BI.Pane, { - _defaultConfig: function () { - return BI.extend(BI.TextValueComboPopup.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-text-icon-popup", - chooseType: BI.ButtonGroup.CHOOSE_TYPE_SINGLE - }); - }, - - _init: function () { - BI.TextValueComboPopup.superclass._init.apply(this, arguments); - var o = this.options, self = this; - this.popup = BI.createWidget({ - type: "bi.button_group", - items: BI.createItems(o.items, { - type: "bi.single_select_item", - textAlign: o.textAlign, - height: 30 - }), - chooseType: o.chooseType, - layouts: [{ - type: "bi.vertical" - }] - }); - - this.popup.on(BI.Controller.EVENT_CHANGE, function (type, val, obj) { - self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); - if (type === BI.Events.CLICK) { - self.fireEvent(BI.TextValueComboPopup.EVENT_CHANGE, val, obj); - } - }); - - BI.createWidget({ - type: "bi.vertical", - element: this, - items: [this.popup] - }); - }, - - populate: function (items) { - BI.TextValueComboPopup.superclass.populate.apply(this, arguments); - items = BI.createItems(items, { - type: "bi.single_select_item", - height: 30 - }); - this.popup.populate(items); - }, - - getValue: function () { - return this.popup.getValue(); - }, - - setValue: function (v) { - this.popup.setValue(v); - } - -}); -BI.TextValueComboPopup.EVENT_CHANGE = "EVENT_CHANGE"; -$.shortcut("bi.text_value_combo_popup", BI.TextValueComboPopup);/** - * @class BI.TextValueDownListCombo - * @extend BI.Widget - */ -BI.TextValueDownListCombo = BI.inherit(BI.Widget, { - _defaultConfig: function () { - return BI.extend(BI.TextValueDownListCombo.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-text-value-down-list-combo", - height: 30, - text: "" - }) - }, - - _init: function () { - BI.TextValueDownListCombo.superclass._init.apply(this, arguments); - var self = this, o = this.options; - - this._createValueMap(); - - this.trigger = BI.createWidget({ - type: "bi.down_list_select_text_trigger", - height: o.height, - items: o.items - }); - - this.combo = BI.createWidget({ - type: "bi.down_list_combo", - element: this, - chooseType: BI.Selection.Single, - adjustLength: 2, - height: o.height, - el: this.trigger, - items: BI.deepClone(o.items) - }); - - this.combo.on(BI.DownListCombo.EVENT_CHANGE, function () { - self.setValue(self.combo.getValue()[0].value); - self.fireEvent(BI.TextValueDownListCombo.EVENT_CHANGE); - }); - - this.combo.on(BI.DownListCombo.EVENT_SON_VALUE_CHANGE, function () { - self.setValue(self.combo.getValue()[0].childValue); - self.fireEvent(BI.TextValueDownListCombo.EVENT_CHANGE); - }); - }, - - _createValueMap: function () { - var self = this; - this.valueMap = {}; - BI.each(BI.flatten(this.options.items), function (idx, item) { - if (BI.has(item, "el")) { - BI.each(item.children, function (id, it) { - self.valueMap[it.value] = {value: item.el.value, childValue: it.value} - }); - } else { - self.valueMap[item.value] = {value: item.value}; - } - }); - }, - - setValue: function (v) { - v = this.valueMap[v]; - this.combo.setValue([v]); - this.trigger.setValue(v.childValue || v.value); - }, - - setEnable: function (v) { - BI.TextValueDownListCombo.superclass.setEnable.apply(this, arguments); - this.combo.setEnable(v); - }, - - getValue: function () { - var v = this.combo.getValue()[0]; - return [v.childValue || v.value]; - }, - - populate: function (items) { - this.options.items = BI.flatten(items); - this.combo.populate(items); - this._createValueMap(); - } -}); -BI.TextValueDownListCombo.EVENT_CHANGE = "EVENT_CHANGE"; -$.shortcut("bi.text_value_down_list_combo", BI.TextValueDownListCombo);/** - * 选择字段trigger, downlist专用 - * 显示形式为 父亲值(儿子值) - * - * @class BI.DownListSelectTextTrigger - * @extends BI.Trigger - */ -BI.DownListSelectTextTrigger = BI.inherit(BI.Trigger, { - - _defaultConfig: function () { - return BI.extend(BI.DownListSelectTextTrigger.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-down-list-select-text-trigger", - height: 24, - text: "" - }); - }, - - _init: function () { - BI.DownListSelectTextTrigger.superclass._init.apply(this, arguments); - var o = this.options; - this.trigger = BI.createWidget({ - type: "bi.select_text_trigger", - element: this, - height: o.height, - items: this._formatItemArray(o.items), - text: o.text - }); - }, - - _formatItemArray: function(){ - var sourceArray = BI.flatten(BI.deepClone(this.options.items)); - var targetArray = []; - BI.each(sourceArray, function(idx, item){ - if(BI.has(item, "el")){ - BI.each(item.children, function(id, it){ - it.text = item.el.text + "(" + it.text + ")"; - }); - targetArray = BI.concat(targetArray, item.children); - }else{ - targetArray.push(item); - } - }); - return targetArray; - }, - - setValue: function (vals) { - this.trigger.setValue(vals); - }, - - populate: function (items) { - this.trigger.populate(this._formatItemArray(items)); - } -}); -$.shortcut("bi.down_list_select_text_trigger", BI.DownListSelectTextTrigger);/** * 根据内容自适应长度的输入框 * @class BI.AdaptiveEditor * @extends BI.Single diff --git a/src/base/combination/group.button.js b/src/base/combination/group.button.js index b6ef3be0be..abe2310bc5 100644 --- a/src/base/combination/group.button.js +++ b/src/base/combination/group.button.js @@ -9,11 +9,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, { return BI.extend(BI.ButtonGroup.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-button-group", behaviors: {}, - items: [ - { - el: {type: "bi.text_button", text: "", value: ""} - } - ], + items: [], chooseType: BI.Selection.Single, layouts: [{ type: "bi.center", diff --git a/src/base/combination/map.button.js b/src/base/combination/map.button.js index 8184e70083..365f6bc15d 100644 --- a/src/base/combination/map.button.js +++ b/src/base/combination/map.button.js @@ -22,7 +22,7 @@ BI.ButtonMap = BI.inherit(BI.ButtonTree, { var buttons = BI.createWidgets(BI.createItems(items, {type: "bi.text_button", once: o.chooseType === 0})); var keys = BI.map(items, function (i, item) { item = BI.stripEL(item); - if (!(item.id || item.value)) { + if (!(BI.isKey(item.id) || BI.isKey(item.value))) { throw new Error("item必须包含id或value属性"); } return item.id || item.value; diff --git a/src/base/reqloading/loading.request.js b/src/base/reqloading/loading.request.js deleted file mode 100644 index c54d5578f4..0000000000 --- a/src/base/reqloading/loading.request.js +++ /dev/null @@ -1,192 +0,0 @@ -/** - * Created by Young's on 2016/8/17. - * 加载面板,一般只用于 requestAsync 中 - */ -BI.RequstLoading = BI.inherit(BI.Widget, { - _defaultConfig: function () { - return BI.extend(BI.RequstLoading.superclass._defaultConfig.apply(this, arguments), {}); - }, - - _init: function () { - BI.RequstLoading.superclass._init.apply(this, arguments); - var self = this, o = this.options; - var mask = BI.Maskers.create(BI.RequstLoading.MASK_ID); - this.callback = o.callback; - this.paneTab = BI.createWidget({ - type: "bi.tab", - cardCreator: BI.bind(this._cardCreator, this), - defaultShowIndex: BI.RequstLoading.ERROR, - width: 400, - height: 300 - }); - var tempIcon = BI.createWidget({ - type: "bi.icon_button", - cls: "data-link-test-fail-icon", - width: 0, - height: 0 - }); - BI.createWidget({ - type: "bi.absolute", - element: $('body'), - items: [{ - el: tempIcon, - bottom: 0 - }] - }); - - BI.createWidget({ - type: "bi.absolute", - element: mask, - cls: "bi-request-loading", - items: [{ - el: { - type: "bi.layout", - cls: "mask-pane" - }, - top: 0, - left: 0, - bottom: 0, - right: 0 - }, { - el: { - type: "bi.center_adapt", - items: [this.paneTab] - }, - top: 0, - left: 0, - right: 0, - bottom: 0 - }] - }); - }, - - _cardCreator: function (v) { - var self = this; - var cancel = BI.createWidget({ - type: "bi.button", - text: BI.i18nText("BI-Basic_Cancel"), - title: BI.i18nText("BI-Basic_Cancel"), - level: "ignore", - height: 28, - width: 90, - handler: function () { - BI.Maskers.hide(BI.RequstLoading.MASK_ID); - } - }); - var retry = BI.createWidget({ - type: "bi.button", - text: BI.i18nText("BI-Basic_Retry"), - title: BI.i18nText("BI-Basic_Retry"), - level: "common", - height: 28, - width: 90, - handler: function () { - self.paneTab.setSelect(BI.RequstLoading.LOADING); - self.callback(); - } - }); - switch (v) { - case BI.RequstLoading.LOADING: - return BI.createWidget({ - type: "bi.vertical", - items: [{ - type: "bi.center_adapt", - cls: "loading-bar-icon", - items: [{ - type: "bi.icon", - width: 208, - height: 15 - }] - }, { - type: "bi.label", - cls: "loading-comment", - text: BI.i18nText("BI-Basic_Loading"), - height: 30 - }], - width: 208, - height: 200, - vgap: 10 - }); - case BI.RequstLoading.LOADING_TIMEOUT: - return BI.createWidget({ - type: "bi.vertical", - items: [{ - type: "bi.center_adapt", - cls: "loading-bar-icon", - items: [{ - type: "bi.icon", - width: 208, - height: 15 - }] - }, { - type: "bi.label", - cls: "loading-comment", - text: BI.i18nText("BI-Basic_Loading"), - height: 30 - }, { - type: "bi.label", - text: BI.i18nText("BI-Request_Time_Out_Toast_Tip"), - cls: "load-timeout-warning" - }, { - type: "bi.left_right_vertical_adapt", - items: { - left: [cancel], - right: [retry] - }, - height: 30, - llgap: 100, - rrgap: 100 - }], - vgap: 10 - }); - case BI.RequstLoading.ERROR: - return BI.createWidget({ - type: "bi.vertical", - items: [{ - type: "bi.center_adapt", - cls: "data-link-test-fail-icon", - items: [{ - type: "bi.icon", - width: 126, - height: 126 - }] - }, { - type: "bi.label", - text: BI.i18nText("BI-Connection_Lost"), - cls: "load-fail-comment" - }, { - type: "bi.left_right_vertical_adapt", - items: { - left: [cancel], - right: [retry] - }, - height: 30, - llgap: 100, - rrgap: 100 - }], - vgap: 20 - }); - } - }, - - showLoading: function () { - BI.Maskers.show(BI.RequstLoading.MASK_ID); - this.paneTab.setSelect(BI.RequstLoading.LOADING); - }, - - showError: function () { - BI.Maskers.show(BI.RequstLoading.MASK_ID); - this.paneTab.setSelect(BI.RequstLoading.ERROR); - }, - - setCallback: function (callback) { - this.callback = callback; - } -}); -BI.extend(BI.RequstLoading, { - MASK_ID: "___request__loading___", - LOADING: 1, - LOADING_TIMEOUT: 2, - ERROR: 3 -}); -$.shortcut("bi.request_loading", BI.RequstLoading); \ No newline at end of file diff --git a/src/base/timeouttoast/widget.timeouttoast.js b/src/base/timeouttoast/widget.timeouttoast.js deleted file mode 100644 index b9ebf121be..0000000000 --- a/src/base/timeouttoast/widget.timeouttoast.js +++ /dev/null @@ -1,117 +0,0 @@ -/** - * 组件请求数据超时提示 - * Created by Young's on 2017/2/4. - */ -BI.TimeoutToast = BI.inherit(BI.Tip, { - _defaultConfig: function () { - return BI.extend(BI.TimeoutToast.superclass._defaultConfig.apply(this, arguments), { - baseCls: "bi-timeout-toast" - }); - }, - - _init: function () { - BI.TimeoutToast.superclass._init.apply(this, arguments); - var self = this; - this.requests = []; - this.toast = BI.createWidget({ - type: "bi.vertical_adapt", - element: this, - items: [{ - type: "bi.label", - text: BI.i18nText("BI-Request_Time_Out_Toast_Tip") - }, { - type: "bi.text_button", - cls: "cancel-button", - width: 60, - height: 22, - text: BI.i18nText("BI-Basic_Cancel"), - title: BI.i18nText("BI-Basic_Cancel"), - handler: function () { - self.cancelAllRequests(); - } - }, { - type: "bi.text_button", - cls: "retry-button", - width: 60, - height: 22, - text: BI.i18nText("BI-Basic_Retry"), - title: BI.i18nText("BI-Basic_Retry"), - handler: function () { - self.toast.element.slideUp(500); - self._retryAll(); - } - }, { - type: "bi.icon_button", - cls: "close-font", - width: 20, - height: 20, - title: BI.i18nText("BI-Basic_Close"), - handler: function () { - self.toast.element.slideUp(500); - } - }], - width: 520, - height: 30, - hgap: 2 - }); - - BI.createWidget({ - type: "bi.absolute", - element: $("body"), - items: [{ - el: this.toast, - left: "50%", - top: 0 - }] - }); - this.toast.element.css({"margin-left": -1 * this.toast.element.outerWidth() / 2}); - this.toast.setVisible(false); - }, - - _retryAll: function () { - var self = this; - var clonedRequests = BI.deepClone(this.requests); - this.requests = []; - BI.each(clonedRequests, function (i, options) { - BI.isFunction(self.callback) && self.callback(options); - }); - }, - - cancelAllRequests: function () { - this.toast.element.slideUp(500); - BI.each(this.requests, function (i, reqArgs) { - if (BI.isNotNull(reqArgs) && BI.isFunction(reqArgs.complete)) { - reqArgs.complete(); - } - }); - this.requests = []; - }, - - setCallback: function (callback) { - this.callback = callback; - }, - - addReq: function (options) { - var self = this; - if (this.requests.length === 0) { - setTimeout(function () { - if (self.requests.contains(options)) { - self.toast.element.slideDown(500); - } - }, 5 * 60 * 1000); //5 min - } - this.requests.push(options); - }, - - removeReq: function (options) { - BI.remove(this.requests, options); - if (this.requests.length === 0) { - this.toast.element.slideUp(500); - } - }, - - hasReq: function (options) { - return this.requests.contains(options); - } -}); -$.shortcut("bi.timeout_toast", BI.TimeoutToast); \ No newline at end of file diff --git a/src/widget/base/combo/editoriconcheckcombo/combo.editoriconcheck.js b/src/case/combo/editoriconcheckcombo/combo.editoriconcheck.js similarity index 100% rename from src/widget/base/combo/editoriconcheckcombo/combo.editoriconcheck.js rename to src/case/combo/editoriconcheckcombo/combo.editoriconcheck.js diff --git a/src/widget/base/combo/formulacombo/combo.formula.js b/src/case/combo/formulacombo/combo.formula.js similarity index 96% rename from src/widget/base/combo/formulacombo/combo.formula.js rename to src/case/combo/formulacombo/combo.formula.js index f5c7c9e834..665935784e 100644 --- a/src/widget/base/combo/formulacombo/combo.formula.js +++ b/src/case/combo/formulacombo/combo.formula.js @@ -45,7 +45,7 @@ BI.FormulaCombo = BI.inherit(BI.Widget, { element: this, isNeedAdjustHeight: true, isNeedAdjustWidth: false, - adjustLength: this._constant.CONDITION_TYPE_COMBO_ADJUST, + adjustLength: this._constant.ADJUST_LENGTH, el: this.input, popup: { el: { diff --git a/src/widget/base/combo/formulacombo/popup.formulacombo.js b/src/case/combo/formulacombo/popup.formulacombo.js similarity index 100% rename from src/widget/base/combo/formulacombo/popup.formulacombo.js rename to src/case/combo/formulacombo/popup.formulacombo.js diff --git a/src/widget/base/combo/formulacombo/trigger.formulacombo.js b/src/case/combo/formulacombo/trigger.formulacombo.js similarity index 100% rename from src/widget/base/combo/formulacombo/trigger.formulacombo.js rename to src/case/combo/formulacombo/trigger.formulacombo.js diff --git a/src/widget/base/combo/iconcombo/combo.icon.js b/src/case/combo/iconcombo/combo.icon.js similarity index 100% rename from src/widget/base/combo/iconcombo/combo.icon.js rename to src/case/combo/iconcombo/combo.icon.js diff --git a/src/widget/base/combo/iconcombo/popup.iconcombo.js b/src/case/combo/iconcombo/popup.iconcombo.js similarity index 100% rename from src/widget/base/combo/iconcombo/popup.iconcombo.js rename to src/case/combo/iconcombo/popup.iconcombo.js diff --git a/src/widget/base/combo/iconcombo/trigger.iconcombo.js b/src/case/combo/iconcombo/trigger.iconcombo.js similarity index 100% rename from src/widget/base/combo/iconcombo/trigger.iconcombo.js rename to src/case/combo/iconcombo/trigger.iconcombo.js diff --git a/src/widget/base/combo/staticcombo/combo.static.js b/src/case/combo/staticcombo/combo.static.js similarity index 100% rename from src/widget/base/combo/staticcombo/combo.static.js rename to src/case/combo/staticcombo/combo.static.js diff --git a/src/widget/base/combo/textvaluecheckcombo/combo.textvaluecheck.js b/src/case/combo/textvaluecheckcombo/combo.textvaluecheck.js similarity index 100% rename from src/widget/base/combo/textvaluecheckcombo/combo.textvaluecheck.js rename to src/case/combo/textvaluecheckcombo/combo.textvaluecheck.js diff --git a/src/widget/base/combo/textvaluecheckcombo/combo.textvaluechecksmall.js b/src/case/combo/textvaluecheckcombo/combo.textvaluechecksmall.js similarity index 100% rename from src/widget/base/combo/textvaluecheckcombo/combo.textvaluechecksmall.js rename to src/case/combo/textvaluecheckcombo/combo.textvaluechecksmall.js diff --git a/src/widget/base/combo/textvaluecheckcombo/popup.textvaluecheck.js b/src/case/combo/textvaluecheckcombo/popup.textvaluecheck.js similarity index 100% rename from src/widget/base/combo/textvaluecheckcombo/popup.textvaluecheck.js rename to src/case/combo/textvaluecheckcombo/popup.textvaluecheck.js diff --git a/src/widget/base/combo/textvaluecombo/combo.textvalue.js b/src/case/combo/textvaluecombo/combo.textvalue.js similarity index 100% rename from src/widget/base/combo/textvaluecombo/combo.textvalue.js rename to src/case/combo/textvaluecombo/combo.textvalue.js diff --git a/src/widget/base/combo/textvaluecombo/combo.textvaluesmall.js b/src/case/combo/textvaluecombo/combo.textvaluesmall.js similarity index 100% rename from src/widget/base/combo/textvaluecombo/combo.textvaluesmall.js rename to src/case/combo/textvaluecombo/combo.textvaluesmall.js diff --git a/src/widget/base/combo/textvaluecombo/popup.textvalue.js b/src/case/combo/textvaluecombo/popup.textvalue.js similarity index 100% rename from src/widget/base/combo/textvaluecombo/popup.textvalue.js rename to src/case/combo/textvaluecombo/popup.textvalue.js diff --git a/src/widget/base/combo/textvaluedownlistcombo/combo.textvaluedownlist.js b/src/case/combo/textvaluedownlistcombo/combo.textvaluedownlist.js similarity index 100% rename from src/widget/base/combo/textvaluedownlistcombo/combo.textvaluedownlist.js rename to src/case/combo/textvaluedownlistcombo/combo.textvaluedownlist.js diff --git a/src/widget/base/combo/textvaluedownlistcombo/trigger.textvaluedownlist.js b/src/case/combo/textvaluedownlistcombo/trigger.textvaluedownlist.js similarity index 100% rename from src/widget/base/combo/textvaluedownlistcombo/trigger.textvaluedownlist.js rename to src/case/combo/textvaluedownlistcombo/trigger.textvaluedownlist.js diff --git a/src/core/controller/controller.bubbles.js b/src/core/controller/controller.bubbles.js index e002ccd495..63cf3607cd 100644 --- a/src/core/controller/controller.bubbles.js +++ b/src/core/controller/controller.bubbles.js @@ -29,16 +29,7 @@ BI.BubblesController = BI.inherit(BI.Controller, { }); }, - hide: function (name, callback) { - if (!this.has(name)) { - return this; - } - this.get(name).element.hide(0, callback); - this.get(name).invisible(); - return this; - }, - - _getOffsetLeft: function(name, context, offsetStyle){ + _getOffsetLeft: function (name, context, offsetStyle) { var left = 0; if ("center" === offsetStyle) { left = context.element.offset().left + (context.element.bounds().width - this.get(name).element.bounds().width) / 2; @@ -57,7 +48,7 @@ BI.BubblesController = BI.inherit(BI.Controller, { return context.element.offset().left; }, - _getOffsetTop: function(name, context, offsetStyle){ + _getOffsetTop: function (name, context, offsetStyle) { var top = 0; if ("center" === offsetStyle) { top = context.element.offset().top + (context.element.bounds().height - this.get(name).element.bounds().height) / 2; @@ -75,25 +66,25 @@ BI.BubblesController = BI.inherit(BI.Controller, { return context.element.offset().top; }, - _getLeftPosition: function(name, context, offsetStyle){ + _getLeftPosition: function (name, context, offsetStyle) { var position = $.getLeftPosition(context, this.get(name)); position.top = this._getOffsetTop(name, context, offsetStyle); return position; }, - _getBottomPosition: function(name, context, offsetStyle){ + _getBottomPosition: function (name, context, offsetStyle) { var position = $.getBottomPosition(context, this.get(name)); position.left = this._getOffsetLeft(name, context, offsetStyle); return position; }, - _getTopPosition: function(name, context, offsetStyle){ + _getTopPosition: function (name, context, offsetStyle) { var position = $.getTopPosition(context, this.get(name)); position.left = this._getOffsetLeft(name, context, offsetStyle); return position; }, - _getRightPosition: function(name, context, offsetStyle){ + _getRightPosition: function (name, context, offsetStyle) { var position = $.getRightPosition(context, this.get(name)); position.top = this._getOffsetTop(name, context, offsetStyle); return position; @@ -123,8 +114,8 @@ BI.BubblesController = BI.inherit(BI.Controller, { items: [{ el: this.storeBubbles[name]["top"] }] - }) - this.set(name, this.storeBubbles[name]["top"]) + }); + this.set(name, this.storeBubbles[name]["top"]); var position = this._getTopPosition(name, context, offsetStyle); this.get(name).element.css({left: position.left, top: position.top}); this.get(name).invisible(); @@ -138,7 +129,7 @@ BI.BubblesController = BI.inherit(BI.Controller, { items: [{ el: this.storeBubbles[name]["left"] }] - }) + }); this.set(name, this.storeBubbles[name]["left"]); var position = this._getLeftPosition(name, context, offsetStyle); this.get(name).element.css({left: position.left, top: position.top}); @@ -153,8 +144,8 @@ BI.BubblesController = BI.inherit(BI.Controller, { items: [{ el: this.storeBubbles[name]["right"] }] - }) - this.set(name, this.storeBubbles[name]["right"]) + }); + this.set(name, this.storeBubbles[name]["right"]); var position = this._getRightPosition(name, context, offsetStyle); this.get(name).element.css({left: position.left, top: position.top}); this.get(name).invisible(); @@ -181,6 +172,14 @@ BI.BubblesController = BI.inherit(BI.Controller, { return this; }, + hide: function (name) { + if (!this.has(name)) { + return this; + } + this.get(name).invisible(); + return this; + }, + add: function (name, bubble) { if (this.has(name)) { return this; @@ -205,7 +204,10 @@ BI.BubblesController = BI.inherit(BI.Controller, { if (!this.has(name)) { return this; } - this.bubblesManager[name].destroy(); + BI.each(this.storeBubbles[name], function (dir, bubble) { + bubble.destroy(); + }); + delete this.storeBubbles[name]; delete this.bubblesManager[name]; return this; }