From 522413fbbca58eceaaef9d61b13f8e9ca2cd71ef Mon Sep 17 00:00:00 2001 From: guy Date: Thu, 8 Mar 2018 15:25:35 +0800 Subject: [PATCH] update --- demo/js/core/popup/demo.popover.js | 40 +-- dist/base.js | 192 ++++++++------- dist/bundle.js | 273 +++++++++------------ dist/case.js | 49 ---- dist/core.js | 32 +-- dist/demo.js | 40 +-- dist/fineui.js | 273 +++++++++------------ src/base/layer/layer.floatbox.js | 192 ++++++++------- src/case/floatbox/floatboxsection.bar.js | 50 ---- src/core/adapter/adapter.floatsection.js | 26 -- src/core/controller/controller.floatbox.js | 5 +- 11 files changed, 455 insertions(+), 717 deletions(-) delete mode 100644 src/case/floatbox/floatboxsection.bar.js delete mode 100644 src/core/adapter/adapter.floatsection.js diff --git a/demo/js/core/popup/demo.popover.js b/demo/js/core/popup/demo.popover.js index b968a3f88..56f693e43 100644 --- a/demo/js/core/popup/demo.popover.js +++ b/demo/js/core/popup/demo.popover.js @@ -14,43 +14,15 @@ Demo.Func = BI.inherit(BI.Widget, { height: 80, handler: function() { BI.Popovers.remove(id); - BI.Popovers.create(id, new Demo.ExamplePopoverSection()).open(id); + BI.Popovers.create(id, { + body: { + type: "bi.label", + text: "这个是body" + } + }).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/dist/base.js b/dist/base.js index 209bc3cfd..f72ab56fb 100644 --- a/dist/base.js +++ b/dist/base.js @@ -15311,17 +15311,14 @@ BI.FloatBox = BI.inherit(BI.Widget, { return BI.extend(BI.FloatBox.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-float-box bi-card", width: 600, - height: 500 + height: 500, + header: null, + body: null, + footer: null }); }, - _init: function () { - BI.FloatBox.superclass._init.apply(this, arguments); + render: function () { var self = this, o = this.options; - this.showAction = new BI.ShowAction({ - tar: this - }); - this._center = BI.createWidget(); - this._north = BI.createWidget(); this.element.draggable && this.element.draggable({ handle: ".bi-message-title", drag: function (e, ui) { @@ -15342,102 +15339,91 @@ BI.FloatBox = BI.inherit(BI.Widget, { BI.Resizers._resize(); } }); - this._south = BI.createWidget(); - BI.createWidget({ - type: "bi.border", - element: this, - items: { - north: { - el: { - type: "bi.border", - cls: "bi-message-title bi-background", - items: { - center: { - el: { - type: "bi.absolute", - items: [{ - el: this._north, - left: 10, - top: 0, - right: 0, - bottom: 0 - }] + var items = { + north: { + el: { + type: "bi.border", + cls: "bi-message-title bi-background", + items: { + center: { + el: { + type: "bi.absolute", + items: [{ + el: BI.createWidget(o.header), + left: 10, + top: 0, + right: 0, + bottom: 0 + }] + } + }, + east: { + el: { + type: "bi.icon_button", + cls: "bi-message-close close-font", + height: 36, + handler: function () { + self.close(); } }, - east: { - el: { - type: "bi.icon_button", - cls: "bi-message-close close-font", - height: 36, - handler: function () { - self.currentSectionProvider.close(); - } - }, - width: 60 - } + width: 60 } - }, - height: 36 - }, - center: { - el: { - type: "bi.absolute", - items: [{ - el: this._center, - left: 20, - top: 20, - right: 20, - bottom: 0 - }] } }, - south: { - el: { - type: "bi.absolute", - items: [{ - el: this._south, - left: 20, - top: 0, - right: 20, - bottom: 0 - }] - }, - height: 44 + height: 36 + }, + center: { + el: { + type: "bi.absolute", + items: [{ + el: BI.createWidget(o.body), + left: 20, + top: 20, + right: 20, + bottom: 0 + }] } } - }); - }, - - populate: function (sectionProvider) { - var self = this; - if (this.currentSectionProvider && this.currentSectionProvider !== sectionProvider) { - this.currentSectionProvider.destroy(); + }; + if (o.footer) { + items.south = { + el: { + type: "bi.absolute", + items: [{ + el: BI.createWidget(o.footer), + left: 20, + top: 0, + right: 20, + bottom: 0 + }] + }, + height: 44 + }; } - this.currentSectionProvider = sectionProvider; - sectionProvider.rebuildNorth(this._north); - sectionProvider.rebuildCenter(this._center); - sectionProvider.rebuildSouth(this._south); - sectionProvider.on(BI.PopoverSection.EVENT_CLOSE, function () { - self.close(); + + BI.createWidget({ + type: "bi.border", + element: this, + items: items }); }, show: function () { - this.showAction.actionPerformed(); + }, hide: function () { - this.showAction.actionBack(); + }, open: function () { this.show(); - this.fireEvent(BI.FloatBox.EVENT_FLOAT_BOX_OPEN); + this.fireEvent(BI.FloatBox.EVENT_OPEN); }, close: function () { this.hide(); - this.fireEvent(BI.FloatBox.EVENT_FLOAT_BOX_CLOSED); + this.fireEvent(BI.FloatBox.EVENT_CLOSE); }, setZindex: function (zindex) { @@ -15445,14 +15431,52 @@ BI.FloatBox = BI.inherit(BI.Widget, { }, destroyed: function () { - this.currentSectionProvider && this.currentSectionProvider.destroy(); } }); BI.shortcut("bi.float_box", BI.FloatBox); -BI.FloatBox.EVENT_FLOAT_BOX_CLOSED = "EVENT_FLOAT_BOX_CLOSED"; -BI.FloatBox.EVENT_FLOAT_BOX_OPEN = "EVENT_FLOAT_BOX_CLOSED"; +BI.BarFloatBox = BI.inherit(BI.FloatBox, { + _defaultConfig: function () { + return BI.extend(BI.FloatBox.superclass._defaultConfig.apply(this, arguments), { + btns: [BI.i18nText(BI.i18nText("BI-Basic_Sure")), BI.i18nText(BI.i18nText("BI-Basic_Cancel"))] + }); + }, + + beforeCreate: function () { + var self = this, o = this.options; + o.footer || (o.footer = { + type: "bi.right_vertical_adapt", + lgap: 10, + items: [{ + type: "bi.button", + text: this.options.btns[1], + value: 1, + level: "ignore", + handler: function (v) { + self.fireEvent(BI.FloatBox.EVENT_CANCEL, v); + self.close(v); + } + }, { + type: "bi.button", + text: this.options.btns[0], + warningTitle: o.warningTitle, + value: 0, + handler: function (v) { + self.fireEvent(BI.FloatBox.EVENT_CONFIRM, v); + self.close(v); + } + }] + }); + } +}); + +BI.shortcut("bi.bar_float_box", BI.BarFloatBox); + +BI.FloatBox.EVENT_CLOSE = "EVENT_CLOSE"; +BI.FloatBox.EVENT_OPEN = "EVENT_OPEN"; +BI.FloatBox.EVENT_CANCEL = "EVENT_CANCEL"; +BI.FloatBox.EVENT_CONFIRM = "EVENT_CONFIRM"; /** * 下拉框弹出层, zIndex在1000w * @class BI.PopupView diff --git a/dist/bundle.js b/dist/bundle.js index 65961b44b..99e8e46eb 100644 --- a/dist/bundle.js +++ b/dist/bundle.js @@ -25313,32 +25313,7 @@ BI.ShowAction = BI.inherit(BI.Action, { tar.setVisible(false); callback && callback(); } -});/** - * 弹出层 - * @class BI.PopoverSection - * @extends BI.Widget - * @abstract - */ -BI.PopoverSection = BI.inherit(BI.Widget, { - _init: function () { - BI.PopoverSection.superclass._init.apply(this, arguments); - }, - - rebuildNorth: function (north) { - return true; - }, - rebuildCenter: function (center) {}, - rebuildSouth: function (south) { - return false; - }, - close: function () { - this.fireEvent(BI.PopoverSection.EVENT_CLOSE); - }, - end: function () { - - } -}); -BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";(function () { +});(function () { if (!window.BI) { window.BI = {}; } @@ -26515,14 +26490,13 @@ BI.FloatBoxController = BI.inherit(BI.Controller, { return BI.isNotNull(this.floatManager[name]); }, - create: function (name, section, options, context) { + create: function (name, options, context) { if (this._check(name)) { return this; } var floatbox = BI.createWidget({ type: "bi.float_box" }, options, context); - floatbox.populate(section); this.add(name, floatbox, options, context); return this; }, @@ -26549,7 +26523,7 @@ BI.FloatBoxController = BI.inherit(BI.Controller, { }); this.floatManager[name] = floatbox; (function (key) { - floatbox.on(BI.FloatBox.EVENT_FLOAT_BOX_CLOSED, function () { + floatbox.on(BI.FloatBox.EVENT_CLOSE, function () { self.close(key); }); })(name); @@ -49081,17 +49055,14 @@ BI.FloatBox = BI.inherit(BI.Widget, { return BI.extend(BI.FloatBox.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-float-box bi-card", width: 600, - height: 500 + height: 500, + header: null, + body: null, + footer: null }); }, - _init: function () { - BI.FloatBox.superclass._init.apply(this, arguments); + render: function () { var self = this, o = this.options; - this.showAction = new BI.ShowAction({ - tar: this - }); - this._center = BI.createWidget(); - this._north = BI.createWidget(); this.element.draggable && this.element.draggable({ handle: ".bi-message-title", drag: function (e, ui) { @@ -49112,102 +49083,91 @@ BI.FloatBox = BI.inherit(BI.Widget, { BI.Resizers._resize(); } }); - this._south = BI.createWidget(); - BI.createWidget({ - type: "bi.border", - element: this, - items: { - north: { - el: { - type: "bi.border", - cls: "bi-message-title bi-background", - items: { - center: { - el: { - type: "bi.absolute", - items: [{ - el: this._north, - left: 10, - top: 0, - right: 0, - bottom: 0 - }] + var items = { + north: { + el: { + type: "bi.border", + cls: "bi-message-title bi-background", + items: { + center: { + el: { + type: "bi.absolute", + items: [{ + el: BI.createWidget(o.header), + left: 10, + top: 0, + right: 0, + bottom: 0 + }] + } + }, + east: { + el: { + type: "bi.icon_button", + cls: "bi-message-close close-font", + height: 36, + handler: function () { + self.close(); } }, - east: { - el: { - type: "bi.icon_button", - cls: "bi-message-close close-font", - height: 36, - handler: function () { - self.currentSectionProvider.close(); - } - }, - width: 60 - } + width: 60 } - }, - height: 36 - }, - center: { - el: { - type: "bi.absolute", - items: [{ - el: this._center, - left: 20, - top: 20, - right: 20, - bottom: 0 - }] } }, - south: { - el: { - type: "bi.absolute", - items: [{ - el: this._south, - left: 20, - top: 0, - right: 20, - bottom: 0 - }] - }, - height: 44 + height: 36 + }, + center: { + el: { + type: "bi.absolute", + items: [{ + el: BI.createWidget(o.body), + left: 20, + top: 20, + right: 20, + bottom: 0 + }] } } - }); - }, - - populate: function (sectionProvider) { - var self = this; - if (this.currentSectionProvider && this.currentSectionProvider !== sectionProvider) { - this.currentSectionProvider.destroy(); + }; + if (o.footer) { + items.south = { + el: { + type: "bi.absolute", + items: [{ + el: BI.createWidget(o.footer), + left: 20, + top: 0, + right: 20, + bottom: 0 + }] + }, + height: 44 + }; } - this.currentSectionProvider = sectionProvider; - sectionProvider.rebuildNorth(this._north); - sectionProvider.rebuildCenter(this._center); - sectionProvider.rebuildSouth(this._south); - sectionProvider.on(BI.PopoverSection.EVENT_CLOSE, function () { - self.close(); + + BI.createWidget({ + type: "bi.border", + element: this, + items: items }); }, show: function () { - this.showAction.actionPerformed(); + }, hide: function () { - this.showAction.actionBack(); + }, open: function () { this.show(); - this.fireEvent(BI.FloatBox.EVENT_FLOAT_BOX_OPEN); + this.fireEvent(BI.FloatBox.EVENT_OPEN); }, close: function () { this.hide(); - this.fireEvent(BI.FloatBox.EVENT_FLOAT_BOX_CLOSED); + this.fireEvent(BI.FloatBox.EVENT_CLOSE); }, setZindex: function (zindex) { @@ -49215,14 +49175,52 @@ BI.FloatBox = BI.inherit(BI.Widget, { }, destroyed: function () { - this.currentSectionProvider && this.currentSectionProvider.destroy(); } }); BI.shortcut("bi.float_box", BI.FloatBox); -BI.FloatBox.EVENT_FLOAT_BOX_CLOSED = "EVENT_FLOAT_BOX_CLOSED"; -BI.FloatBox.EVENT_FLOAT_BOX_OPEN = "EVENT_FLOAT_BOX_CLOSED"; +BI.BarFloatBox = BI.inherit(BI.FloatBox, { + _defaultConfig: function () { + return BI.extend(BI.FloatBox.superclass._defaultConfig.apply(this, arguments), { + btns: [BI.i18nText(BI.i18nText("BI-Basic_Sure")), BI.i18nText(BI.i18nText("BI-Basic_Cancel"))] + }); + }, + + beforeCreate: function () { + var self = this, o = this.options; + o.footer || (o.footer = { + type: "bi.right_vertical_adapt", + lgap: 10, + items: [{ + type: "bi.button", + text: this.options.btns[1], + value: 1, + level: "ignore", + handler: function (v) { + self.fireEvent(BI.FloatBox.EVENT_CANCEL, v); + self.close(v); + } + }, { + type: "bi.button", + text: this.options.btns[0], + warningTitle: o.warningTitle, + value: 0, + handler: function (v) { + self.fireEvent(BI.FloatBox.EVENT_CONFIRM, v); + self.close(v); + } + }] + }); + } +}); + +BI.shortcut("bi.bar_float_box", BI.BarFloatBox); + +BI.FloatBox.EVENT_CLOSE = "EVENT_CLOSE"; +BI.FloatBox.EVENT_OPEN = "EVENT_OPEN"; +BI.FloatBox.EVENT_CANCEL = "EVENT_CANCEL"; +BI.FloatBox.EVENT_CONFIRM = "EVENT_CONFIRM"; /** * 下拉框弹出层, zIndex在1000w * @class BI.PopupView @@ -78378,55 +78376,6 @@ BI.SimpleStateEditor.EVENT_SPACE = "EVENT_SPACE"; BI.SimpleStateEditor.EVENT_EMPTY = "EVENT_EMPTY"; BI.shortcut("bi.simple_state_editor", BI.SimpleStateEditor);/** - * 有确定取消按钮的弹出层 - * @class BI.BarPopoverSection - * @extends BI.PopoverSection - * @abstract - */ -BI.BarPopoverSection = BI.inherit(BI.PopoverSection, { - _defaultConfig: function () { - return BI.extend(BI.BarPopoverSection.superclass._defaultConfig.apply(this, arguments), { - btns: [BI.i18nText(BI.i18nText("BI-Basic_Sure")), BI.i18nText(BI.i18nText("BI-Basic_Cancel"))] - }); - }, - - _init: function () { - BI.BarPopoverSection.superclass._init.apply(this, arguments); - }, - - rebuildSouth: function (south) { - var self = this, o = this.options; - this.sure = BI.createWidget({ - type: "bi.button", - text: this.options.btns[0], - warningTitle: o.warningTitle, - value: 0, - handler: function (v) { - self.end(); - self.close(v); - } - }); - this.cancel = BI.createWidget({ - type: "bi.button", - text: this.options.btns[1], - 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] - }); - }, - - setConfirmButtonEnable: function (v) { - this.sure.setEnable(!!v); - } -});/** * 下拉框弹出层的多选版本,toolbar带有若干按钮, zIndex在1000w * @class BI.MultiPopupView * @extends BI.Widget diff --git a/dist/case.js b/dist/case.js index 0e2386761..2de571467 100644 --- a/dist/case.js +++ b/dist/case.js @@ -8001,55 +8001,6 @@ BI.SimpleStateEditor.EVENT_SPACE = "EVENT_SPACE"; BI.SimpleStateEditor.EVENT_EMPTY = "EVENT_EMPTY"; BI.shortcut("bi.simple_state_editor", BI.SimpleStateEditor);/** - * 有确定取消按钮的弹出层 - * @class BI.BarPopoverSection - * @extends BI.PopoverSection - * @abstract - */ -BI.BarPopoverSection = BI.inherit(BI.PopoverSection, { - _defaultConfig: function () { - return BI.extend(BI.BarPopoverSection.superclass._defaultConfig.apply(this, arguments), { - btns: [BI.i18nText(BI.i18nText("BI-Basic_Sure")), BI.i18nText(BI.i18nText("BI-Basic_Cancel"))] - }); - }, - - _init: function () { - BI.BarPopoverSection.superclass._init.apply(this, arguments); - }, - - rebuildSouth: function (south) { - var self = this, o = this.options; - this.sure = BI.createWidget({ - type: "bi.button", - text: this.options.btns[0], - warningTitle: o.warningTitle, - value: 0, - handler: function (v) { - self.end(); - self.close(v); - } - }); - this.cancel = BI.createWidget({ - type: "bi.button", - text: this.options.btns[1], - 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] - }); - }, - - setConfirmButtonEnable: function (v) { - this.sure.setEnable(!!v); - } -});/** * 下拉框弹出层的多选版本,toolbar带有若干按钮, zIndex在1000w * @class BI.MultiPopupView * @extends BI.Widget diff --git a/dist/core.js b/dist/core.js index 1d87f88ed..a27a0207b 100644 --- a/dist/core.js +++ b/dist/core.js @@ -25313,32 +25313,7 @@ BI.ShowAction = BI.inherit(BI.Action, { tar.setVisible(false); callback && callback(); } -});/** - * 弹出层 - * @class BI.PopoverSection - * @extends BI.Widget - * @abstract - */ -BI.PopoverSection = BI.inherit(BI.Widget, { - _init: function () { - BI.PopoverSection.superclass._init.apply(this, arguments); - }, - - rebuildNorth: function (north) { - return true; - }, - rebuildCenter: function (center) {}, - rebuildSouth: function (south) { - return false; - }, - close: function () { - this.fireEvent(BI.PopoverSection.EVENT_CLOSE); - }, - end: function () { - - } -}); -BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";(function () { +});(function () { if (!window.BI) { window.BI = {}; } @@ -26515,14 +26490,13 @@ BI.FloatBoxController = BI.inherit(BI.Controller, { return BI.isNotNull(this.floatManager[name]); }, - create: function (name, section, options, context) { + create: function (name, options, context) { if (this._check(name)) { return this; } var floatbox = BI.createWidget({ type: "bi.float_box" }, options, context); - floatbox.populate(section); this.add(name, floatbox, options, context); return this; }, @@ -26549,7 +26523,7 @@ BI.FloatBoxController = BI.inherit(BI.Controller, { }); this.floatManager[name] = floatbox; (function (key) { - floatbox.on(BI.FloatBox.EVENT_FLOAT_BOX_CLOSED, function () { + floatbox.on(BI.FloatBox.EVENT_CLOSE, function () { self.close(key); }); })(name); diff --git a/dist/demo.js b/dist/demo.js index 548a2ee17..663a9f88f 100644 --- a/dist/demo.js +++ b/dist/demo.js @@ -8474,45 +8474,17 @@ Demo.Func = BI.inherit(BI.Widget, { height: 80, handler: function() { BI.Popovers.remove(id); - BI.Popovers.create(id, new Demo.ExamplePopoverSection()).open(id); + BI.Popovers.create(id, { + body: { + type: "bi.label", + text: "这个是body" + } + }).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. */ diff --git a/dist/fineui.js b/dist/fineui.js index 93edb799f..4b4d09da7 100644 --- a/dist/fineui.js +++ b/dist/fineui.js @@ -25556,32 +25556,7 @@ BI.ShowAction = BI.inherit(BI.Action, { tar.setVisible(false); callback && callback(); } -});/** - * 弹出层 - * @class BI.PopoverSection - * @extends BI.Widget - * @abstract - */ -BI.PopoverSection = BI.inherit(BI.Widget, { - _init: function () { - BI.PopoverSection.superclass._init.apply(this, arguments); - }, - - rebuildNorth: function (north) { - return true; - }, - rebuildCenter: function (center) {}, - rebuildSouth: function (south) { - return false; - }, - close: function () { - this.fireEvent(BI.PopoverSection.EVENT_CLOSE); - }, - end: function () { - - } -}); -BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE";(function () { +});(function () { if (!window.BI) { window.BI = {}; } @@ -26758,14 +26733,13 @@ BI.FloatBoxController = BI.inherit(BI.Controller, { return BI.isNotNull(this.floatManager[name]); }, - create: function (name, section, options, context) { + create: function (name, options, context) { if (this._check(name)) { return this; } var floatbox = BI.createWidget({ type: "bi.float_box" }, options, context); - floatbox.populate(section); this.add(name, floatbox, options, context); return this; }, @@ -26792,7 +26766,7 @@ BI.FloatBoxController = BI.inherit(BI.Controller, { }); this.floatManager[name] = floatbox; (function (key) { - floatbox.on(BI.FloatBox.EVENT_FLOAT_BOX_CLOSED, function () { + floatbox.on(BI.FloatBox.EVENT_CLOSE, function () { self.close(key); }); })(name); @@ -50887,17 +50861,14 @@ BI.FloatBox = BI.inherit(BI.Widget, { return BI.extend(BI.FloatBox.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-float-box bi-card", width: 600, - height: 500 + height: 500, + header: null, + body: null, + footer: null }); }, - _init: function () { - BI.FloatBox.superclass._init.apply(this, arguments); + render: function () { var self = this, o = this.options; - this.showAction = new BI.ShowAction({ - tar: this - }); - this._center = BI.createWidget(); - this._north = BI.createWidget(); this.element.draggable && this.element.draggable({ handle: ".bi-message-title", drag: function (e, ui) { @@ -50918,102 +50889,91 @@ BI.FloatBox = BI.inherit(BI.Widget, { BI.Resizers._resize(); } }); - this._south = BI.createWidget(); - BI.createWidget({ - type: "bi.border", - element: this, - items: { - north: { - el: { - type: "bi.border", - cls: "bi-message-title bi-background", - items: { - center: { - el: { - type: "bi.absolute", - items: [{ - el: this._north, - left: 10, - top: 0, - right: 0, - bottom: 0 - }] + var items = { + north: { + el: { + type: "bi.border", + cls: "bi-message-title bi-background", + items: { + center: { + el: { + type: "bi.absolute", + items: [{ + el: BI.createWidget(o.header), + left: 10, + top: 0, + right: 0, + bottom: 0 + }] + } + }, + east: { + el: { + type: "bi.icon_button", + cls: "bi-message-close close-font", + height: 36, + handler: function () { + self.close(); } }, - east: { - el: { - type: "bi.icon_button", - cls: "bi-message-close close-font", - height: 36, - handler: function () { - self.currentSectionProvider.close(); - } - }, - width: 60 - } + width: 60 } - }, - height: 36 - }, - center: { - el: { - type: "bi.absolute", - items: [{ - el: this._center, - left: 20, - top: 20, - right: 20, - bottom: 0 - }] } }, - south: { - el: { - type: "bi.absolute", - items: [{ - el: this._south, - left: 20, - top: 0, - right: 20, - bottom: 0 - }] - }, - height: 44 + height: 36 + }, + center: { + el: { + type: "bi.absolute", + items: [{ + el: BI.createWidget(o.body), + left: 20, + top: 20, + right: 20, + bottom: 0 + }] } } - }); - }, - - populate: function (sectionProvider) { - var self = this; - if (this.currentSectionProvider && this.currentSectionProvider !== sectionProvider) { - this.currentSectionProvider.destroy(); + }; + if (o.footer) { + items.south = { + el: { + type: "bi.absolute", + items: [{ + el: BI.createWidget(o.footer), + left: 20, + top: 0, + right: 20, + bottom: 0 + }] + }, + height: 44 + }; } - this.currentSectionProvider = sectionProvider; - sectionProvider.rebuildNorth(this._north); - sectionProvider.rebuildCenter(this._center); - sectionProvider.rebuildSouth(this._south); - sectionProvider.on(BI.PopoverSection.EVENT_CLOSE, function () { - self.close(); + + BI.createWidget({ + type: "bi.border", + element: this, + items: items }); }, show: function () { - this.showAction.actionPerformed(); + }, hide: function () { - this.showAction.actionBack(); + }, open: function () { this.show(); - this.fireEvent(BI.FloatBox.EVENT_FLOAT_BOX_OPEN); + this.fireEvent(BI.FloatBox.EVENT_OPEN); }, close: function () { this.hide(); - this.fireEvent(BI.FloatBox.EVENT_FLOAT_BOX_CLOSED); + this.fireEvent(BI.FloatBox.EVENT_CLOSE); }, setZindex: function (zindex) { @@ -51021,14 +50981,52 @@ BI.FloatBox = BI.inherit(BI.Widget, { }, destroyed: function () { - this.currentSectionProvider && this.currentSectionProvider.destroy(); } }); BI.shortcut("bi.float_box", BI.FloatBox); -BI.FloatBox.EVENT_FLOAT_BOX_CLOSED = "EVENT_FLOAT_BOX_CLOSED"; -BI.FloatBox.EVENT_FLOAT_BOX_OPEN = "EVENT_FLOAT_BOX_CLOSED"; +BI.BarFloatBox = BI.inherit(BI.FloatBox, { + _defaultConfig: function () { + return BI.extend(BI.FloatBox.superclass._defaultConfig.apply(this, arguments), { + btns: [BI.i18nText(BI.i18nText("BI-Basic_Sure")), BI.i18nText(BI.i18nText("BI-Basic_Cancel"))] + }); + }, + + beforeCreate: function () { + var self = this, o = this.options; + o.footer || (o.footer = { + type: "bi.right_vertical_adapt", + lgap: 10, + items: [{ + type: "bi.button", + text: this.options.btns[1], + value: 1, + level: "ignore", + handler: function (v) { + self.fireEvent(BI.FloatBox.EVENT_CANCEL, v); + self.close(v); + } + }, { + type: "bi.button", + text: this.options.btns[0], + warningTitle: o.warningTitle, + value: 0, + handler: function (v) { + self.fireEvent(BI.FloatBox.EVENT_CONFIRM, v); + self.close(v); + } + }] + }); + } +}); + +BI.shortcut("bi.bar_float_box", BI.BarFloatBox); + +BI.FloatBox.EVENT_CLOSE = "EVENT_CLOSE"; +BI.FloatBox.EVENT_OPEN = "EVENT_OPEN"; +BI.FloatBox.EVENT_CANCEL = "EVENT_CANCEL"; +BI.FloatBox.EVENT_CONFIRM = "EVENT_CONFIRM"; /** * 下拉框弹出层, zIndex在1000w * @class BI.PopupView @@ -80184,55 +80182,6 @@ BI.SimpleStateEditor.EVENT_SPACE = "EVENT_SPACE"; BI.SimpleStateEditor.EVENT_EMPTY = "EVENT_EMPTY"; BI.shortcut("bi.simple_state_editor", BI.SimpleStateEditor);/** - * 有确定取消按钮的弹出层 - * @class BI.BarPopoverSection - * @extends BI.PopoverSection - * @abstract - */ -BI.BarPopoverSection = BI.inherit(BI.PopoverSection, { - _defaultConfig: function () { - return BI.extend(BI.BarPopoverSection.superclass._defaultConfig.apply(this, arguments), { - btns: [BI.i18nText(BI.i18nText("BI-Basic_Sure")), BI.i18nText(BI.i18nText("BI-Basic_Cancel"))] - }); - }, - - _init: function () { - BI.BarPopoverSection.superclass._init.apply(this, arguments); - }, - - rebuildSouth: function (south) { - var self = this, o = this.options; - this.sure = BI.createWidget({ - type: "bi.button", - text: this.options.btns[0], - warningTitle: o.warningTitle, - value: 0, - handler: function (v) { - self.end(); - self.close(v); - } - }); - this.cancel = BI.createWidget({ - type: "bi.button", - text: this.options.btns[1], - 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] - }); - }, - - setConfirmButtonEnable: function (v) { - this.sure.setEnable(!!v); - } -});/** * 下拉框弹出层的多选版本,toolbar带有若干按钮, zIndex在1000w * @class BI.MultiPopupView * @extends BI.Widget diff --git a/src/base/layer/layer.floatbox.js b/src/base/layer/layer.floatbox.js index a4ee9a921..1de9c4198 100644 --- a/src/base/layer/layer.floatbox.js +++ b/src/base/layer/layer.floatbox.js @@ -8,17 +8,14 @@ BI.FloatBox = BI.inherit(BI.Widget, { return BI.extend(BI.FloatBox.superclass._defaultConfig.apply(this, arguments), { baseCls: "bi-float-box bi-card", width: 600, - height: 500 + height: 500, + header: null, + body: null, + footer: null }); }, - _init: function () { - BI.FloatBox.superclass._init.apply(this, arguments); + render: function () { var self = this, o = this.options; - this.showAction = new BI.ShowAction({ - tar: this - }); - this._center = BI.createWidget(); - this._north = BI.createWidget(); this.element.draggable && this.element.draggable({ handle: ".bi-message-title", drag: function (e, ui) { @@ -39,102 +36,91 @@ BI.FloatBox = BI.inherit(BI.Widget, { BI.Resizers._resize(); } }); - this._south = BI.createWidget(); - BI.createWidget({ - type: "bi.border", - element: this, - items: { - north: { - el: { - type: "bi.border", - cls: "bi-message-title bi-background", - items: { - center: { - el: { - type: "bi.absolute", - items: [{ - el: this._north, - left: 10, - top: 0, - right: 0, - bottom: 0 - }] + var items = { + north: { + el: { + type: "bi.border", + cls: "bi-message-title bi-background", + items: { + center: { + el: { + type: "bi.absolute", + items: [{ + el: BI.createWidget(o.header), + left: 10, + top: 0, + right: 0, + bottom: 0 + }] + } + }, + east: { + el: { + type: "bi.icon_button", + cls: "bi-message-close close-font", + height: 36, + handler: function () { + self.close(); } }, - east: { - el: { - type: "bi.icon_button", - cls: "bi-message-close close-font", - height: 36, - handler: function () { - self.currentSectionProvider.close(); - } - }, - width: 60 - } + width: 60 } - }, - height: 36 - }, - center: { - el: { - type: "bi.absolute", - items: [{ - el: this._center, - left: 20, - top: 20, - right: 20, - bottom: 0 - }] } }, - south: { - el: { - type: "bi.absolute", - items: [{ - el: this._south, - left: 20, - top: 0, - right: 20, - bottom: 0 - }] - }, - height: 44 + height: 36 + }, + center: { + el: { + type: "bi.absolute", + items: [{ + el: BI.createWidget(o.body), + left: 20, + top: 20, + right: 20, + bottom: 0 + }] } } - }); - }, - - populate: function (sectionProvider) { - var self = this; - if (this.currentSectionProvider && this.currentSectionProvider !== sectionProvider) { - this.currentSectionProvider.destroy(); + }; + if (o.footer) { + items.south = { + el: { + type: "bi.absolute", + items: [{ + el: BI.createWidget(o.footer), + left: 20, + top: 0, + right: 20, + bottom: 0 + }] + }, + height: 44 + }; } - this.currentSectionProvider = sectionProvider; - sectionProvider.rebuildNorth(this._north); - sectionProvider.rebuildCenter(this._center); - sectionProvider.rebuildSouth(this._south); - sectionProvider.on(BI.PopoverSection.EVENT_CLOSE, function () { - self.close(); + + BI.createWidget({ + type: "bi.border", + element: this, + items: items }); }, show: function () { - this.showAction.actionPerformed(); + }, hide: function () { - this.showAction.actionBack(); + }, open: function () { this.show(); - this.fireEvent(BI.FloatBox.EVENT_FLOAT_BOX_OPEN); + this.fireEvent(BI.FloatBox.EVENT_OPEN); }, close: function () { this.hide(); - this.fireEvent(BI.FloatBox.EVENT_FLOAT_BOX_CLOSED); + this.fireEvent(BI.FloatBox.EVENT_CLOSE); }, setZindex: function (zindex) { @@ -142,11 +128,49 @@ BI.FloatBox = BI.inherit(BI.Widget, { }, destroyed: function () { - this.currentSectionProvider && this.currentSectionProvider.destroy(); } }); BI.shortcut("bi.float_box", BI.FloatBox); -BI.FloatBox.EVENT_FLOAT_BOX_CLOSED = "EVENT_FLOAT_BOX_CLOSED"; -BI.FloatBox.EVENT_FLOAT_BOX_OPEN = "EVENT_FLOAT_BOX_CLOSED"; +BI.BarFloatBox = BI.inherit(BI.FloatBox, { + _defaultConfig: function () { + return BI.extend(BI.FloatBox.superclass._defaultConfig.apply(this, arguments), { + btns: [BI.i18nText(BI.i18nText("BI-Basic_Sure")), BI.i18nText(BI.i18nText("BI-Basic_Cancel"))] + }); + }, + + beforeCreate: function () { + var self = this, o = this.options; + o.footer || (o.footer = { + type: "bi.right_vertical_adapt", + lgap: 10, + items: [{ + type: "bi.button", + text: this.options.btns[1], + value: 1, + level: "ignore", + handler: function (v) { + self.fireEvent(BI.FloatBox.EVENT_CANCEL, v); + self.close(v); + } + }, { + type: "bi.button", + text: this.options.btns[0], + warningTitle: o.warningTitle, + value: 0, + handler: function (v) { + self.fireEvent(BI.FloatBox.EVENT_CONFIRM, v); + self.close(v); + } + }] + }); + } +}); + +BI.shortcut("bi.bar_float_box", BI.BarFloatBox); + +BI.FloatBox.EVENT_CLOSE = "EVENT_CLOSE"; +BI.FloatBox.EVENT_OPEN = "EVENT_OPEN"; +BI.FloatBox.EVENT_CANCEL = "EVENT_CANCEL"; +BI.FloatBox.EVENT_CONFIRM = "EVENT_CONFIRM"; diff --git a/src/case/floatbox/floatboxsection.bar.js b/src/case/floatbox/floatboxsection.bar.js deleted file mode 100644 index 251205eae..000000000 --- a/src/case/floatbox/floatboxsection.bar.js +++ /dev/null @@ -1,50 +0,0 @@ -/** - * 有确定取消按钮的弹出层 - * @class BI.BarPopoverSection - * @extends BI.PopoverSection - * @abstract - */ -BI.BarPopoverSection = BI.inherit(BI.PopoverSection, { - _defaultConfig: function () { - return BI.extend(BI.BarPopoverSection.superclass._defaultConfig.apply(this, arguments), { - btns: [BI.i18nText(BI.i18nText("BI-Basic_Sure")), BI.i18nText(BI.i18nText("BI-Basic_Cancel"))] - }); - }, - - _init: function () { - BI.BarPopoverSection.superclass._init.apply(this, arguments); - }, - - rebuildSouth: function (south) { - var self = this, o = this.options; - this.sure = BI.createWidget({ - type: "bi.button", - text: this.options.btns[0], - warningTitle: o.warningTitle, - value: 0, - handler: function (v) { - self.end(); - self.close(v); - } - }); - this.cancel = BI.createWidget({ - type: "bi.button", - text: this.options.btns[1], - 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] - }); - }, - - setConfirmButtonEnable: function (v) { - this.sure.setEnable(!!v); - } -}); \ No newline at end of file diff --git a/src/core/adapter/adapter.floatsection.js b/src/core/adapter/adapter.floatsection.js deleted file mode 100644 index e8dd8ce52..000000000 --- a/src/core/adapter/adapter.floatsection.js +++ /dev/null @@ -1,26 +0,0 @@ -/** - * 弹出层 - * @class BI.PopoverSection - * @extends BI.Widget - * @abstract - */ -BI.PopoverSection = BI.inherit(BI.Widget, { - _init: function () { - BI.PopoverSection.superclass._init.apply(this, arguments); - }, - - rebuildNorth: function (north) { - return true; - }, - rebuildCenter: function (center) {}, - rebuildSouth: function (south) { - return false; - }, - close: function () { - this.fireEvent(BI.PopoverSection.EVENT_CLOSE); - }, - end: function () { - - } -}); -BI.PopoverSection.EVENT_CLOSE = "EVENT_CLOSE"; \ No newline at end of file diff --git a/src/core/controller/controller.floatbox.js b/src/core/controller/controller.floatbox.js index 42095f669..33f7fde68 100644 --- a/src/core/controller/controller.floatbox.js +++ b/src/core/controller/controller.floatbox.js @@ -27,14 +27,13 @@ BI.FloatBoxController = BI.inherit(BI.Controller, { return BI.isNotNull(this.floatManager[name]); }, - create: function (name, section, options, context) { + create: function (name, options, context) { if (this._check(name)) { return this; } var floatbox = BI.createWidget({ type: "bi.float_box" }, options, context); - floatbox.populate(section); this.add(name, floatbox, options, context); return this; }, @@ -61,7 +60,7 @@ BI.FloatBoxController = BI.inherit(BI.Controller, { }); this.floatManager[name] = floatbox; (function (key) { - floatbox.on(BI.FloatBox.EVENT_FLOAT_BOX_CLOSED, function () { + floatbox.on(BI.FloatBox.EVENT_CLOSE, function () { self.close(key); }); })(name);