From 103b10584503381a1678dfaa72ec1e9f8ffd19db Mon Sep 17 00:00:00 2001 From: windy <1374721899@qq.com> Date: Wed, 13 Dec 2017 09:43:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0popover,=20searcherview?= =?UTF-8?q?=E5=92=8Cpopup=5Fview=E7=9A=84demo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- demo/js/config/core.js | 4 +- demo/js/core/popup/demo.popover.js | 56 +++++++++ demo/js/core/popup/demo.popup_view.js | 42 +++++++ demo/js/core/popup/demo.searcher_view.js | 45 +++++++ dist/demo.js | 146 ++++++++++++++++++++++- 5 files changed, 288 insertions(+), 5 deletions(-) create mode 100644 demo/js/core/popup/demo.popover.js create mode 100644 demo/js/core/popup/demo.popup_view.js create mode 100644 demo/js/core/popup/demo.searcher_view.js diff --git a/demo/js/config/core.js b/demo/js/config/core.js index 5237a2ab5..9cbfe34ec 100644 --- a/demo/js/config/core.js +++ b/demo/js/config/core.js @@ -162,8 +162,8 @@ Demo.CORE_CONFIG = [{ text: "弹出层" }, { pId: 10202, - text: "bi.float_box", - value: "demo.float_box" + text: "bi.popover", + value: "demo.popover" }, { pId: 10202, text: "bi.popup_view", diff --git a/demo/js/core/popup/demo.popover.js b/demo/js/core/popup/demo.popover.js new file mode 100644 index 000000000..b968a3f88 --- /dev/null +++ b/demo/js/core/popup/demo.popover.js @@ -0,0 +1,56 @@ +/** + * Created by Windy on 2017/12/13. + */ +Demo.Func = BI.inherit(BI.Widget, { + props: { + baseCls: "demo-func" + }, + render: function () { + var id = BI.UUID(); + return { + type: "bi.text_button", + text: "点击弹出Popover", + width: 200, + height: 80, + handler: function() { + BI.Popovers.remove(id); + BI.Popovers.create(id, new Demo.ExamplePopoverSection()).open(id); + } + }; + } +}); + +Demo.ExamplePopoverSection = BI.inherit(BI.PopoverSection, { + + rebuildSouth: function (south) { + var self = this, o = this.options; + this.sure = BI.createWidget({ + type: 'bi.button', + text: "确定", + warningTitle: o.warningTitle, + height: 30, + value: 0, + handler: function (v) { + self.end(); + self.close(v); + } + }); + this.cancel = BI.createWidget({ + type: 'bi.button', + text: "取消", + height: 30, + value: 1, + level: 'ignore', + handler: function (v) { + self.close(v); + } + }); + BI.createWidget({ + type: 'bi.right_vertical_adapt', + element: south, + lgap: 10, + items: [this.cancel, this.sure] + }); + } +}); +BI.shortcut("demo.popover", Demo.Func); \ No newline at end of file diff --git a/demo/js/core/popup/demo.popup_view.js b/demo/js/core/popup/demo.popup_view.js new file mode 100644 index 000000000..b7c6bfad1 --- /dev/null +++ b/demo/js/core/popup/demo.popup_view.js @@ -0,0 +1,42 @@ +/** + * Created by Windy on 2017/12/13. + */ +Demo.Func = BI.inherit(BI.Widget, { + props: { + baseCls: "demo-func" + }, + + render: function () { + var self = this; + return { + type: "bi.absolute", + items: [{ + el: { + type: "bi.combo", + width: 200, + height: 30, + el: { + type: "bi.text_button", + text: "点击", + cls: "bi-border", + height: 30 + }, + popup: { + type: "bi.popup_view", + el: { + type: "bi.button_group", + layouts: [{ + type: "bi.vertical" + }], + items: BI.createItems(BI.deepClone(Demo.CONSTANTS.ITEMS), { + type: "bi.multi_select_item", + height: 25 + }) + } + } + } + }] + }; + } +}); +BI.shortcut("demo.popup_view", Demo.Func); \ No newline at end of file diff --git a/demo/js/core/popup/demo.searcher_view.js b/demo/js/core/popup/demo.searcher_view.js new file mode 100644 index 000000000..8cb1eff7b --- /dev/null +++ b/demo/js/core/popup/demo.searcher_view.js @@ -0,0 +1,45 @@ +/** + * Created by Windy on 2017/12/13. + */ +Demo.Func = BI.inherit(BI.Widget, { + props: { + baseCls: "demo-func" + }, + + render: function () { + var self = this; + return { + type: "bi.absolute", + items: [{ + el: { + type: "bi.searcher_view", + ref: function () { + self.searcherView = this; + } + }, + left: 100, + top: 20, + width: 230 + }] + }; + }, + + mounted: function () { + this.searcherView.populate(BI.createItems([{ + text: 2012 + }, { + text: 2013 + }, { + text: 2014 + }, { + text: 2015 + }], { + type: "bi.label", + textHeight: 24, + height: 24 + }), [{ + text: 2 + }], "2"); + } +}); +BI.shortcut("demo.searcher_view", Demo.Func); \ No newline at end of file diff --git a/dist/demo.js b/dist/demo.js index 28a2547a3..92b6c975a 100644 --- a/dist/demo.js +++ b/dist/demo.js @@ -5142,8 +5142,8 @@ Demo.COMPONENT_CONFIG = [{ text: "弹出层" }, { pId: 10202, - text: "bi.float_box", - value: "demo.float_box" + text: "bi.popover", + value: "demo.popover" }, { pId: 10202, text: "bi.popup_view", @@ -8140,7 +8140,147 @@ Demo.VtapeLayout = BI.inherit(BI.Widget, { }; } }); -BI.shortcut("demo.vtape", Demo.VtapeLayout);Demo.Face = BI.inherit(BI.Widget, { +BI.shortcut("demo.vtape", Demo.VtapeLayout);/** + * Created by Windy on 2017/12/13. + */ +Demo.Func = BI.inherit(BI.Widget, { + props: { + baseCls: "demo-func" + }, + render: function () { + var id = BI.UUID(); + return { + type: "bi.text_button", + text: "点击弹出Popover", + width: 200, + height: 80, + handler: function() { + BI.Popovers.remove(id); + BI.Popovers.create(id, new Demo.ExamplePopoverSection()).open(id); + } + }; + } +}); + +Demo.ExamplePopoverSection = BI.inherit(BI.PopoverSection, { + + rebuildSouth: function (south) { + var self = this, o = this.options; + this.sure = BI.createWidget({ + type: 'bi.button', + text: "确定", + warningTitle: o.warningTitle, + height: 30, + value: 0, + handler: function (v) { + self.end(); + self.close(v); + } + }); + this.cancel = BI.createWidget({ + type: 'bi.button', + text: "取消", + height: 30, + value: 1, + level: 'ignore', + handler: function (v) { + self.close(v); + } + }); + BI.createWidget({ + type: 'bi.right_vertical_adapt', + element: south, + lgap: 10, + items: [this.cancel, this.sure] + }); + } +}); +BI.shortcut("demo.popover", Demo.Func);/** + * Created by Windy on 2017/12/13. + */ +Demo.Func = BI.inherit(BI.Widget, { + props: { + baseCls: "demo-func" + }, + + render: function () { + var self = this; + return { + type: "bi.absolute", + items: [{ + el: { + type: "bi.combo", + width: 200, + height: 30, + el: { + type: "bi.text_button", + text: "点击", + cls: "bi-border", + height: 30 + }, + popup: { + type: "bi.popup_view", + el: { + type: "bi.button_group", + layouts: [{ + type: "bi.vertical" + }], + items: BI.createItems(BI.deepClone(Demo.CONSTANTS.ITEMS), { + type: "bi.multi_select_item", + height: 25 + }) + } + } + } + }] + }; + } +}); +BI.shortcut("demo.popup_view", Demo.Func);/** + * Created by Windy on 2017/12/13. + */ +Demo.Func = BI.inherit(BI.Widget, { + props: { + baseCls: "demo-func" + }, + + render: function () { + var self = this; + return { + type: "bi.absolute", + items: [{ + el: { + type: "bi.searcher_view", + ref: function () { + self.searcherView = this; + } + }, + left: 100, + top: 20, + width: 230 + }] + }; + }, + + mounted: function () { + this.searcherView.populate(BI.createItems([{ + text: 2012 + }, { + text: 2013 + }, { + text: 2014 + }, { + text: 2015 + }], { + type: "bi.label", + textHeight: 24, + height: 24 + }), [{ + text: 2 + }], "2"); + } +}); +BI.shortcut("demo.searcher_view", Demo.Func);Demo.Face = BI.inherit(BI.Widget, { props: { baseCls: "demo-face" },