diff --git a/src/base/1.pane.js b/src/base/1.pane.js index 3f07c307f..31176dbd5 100644 --- a/src/base/1.pane.js +++ b/src/base/1.pane.js @@ -1,5 +1,5 @@ -import { Label, Text } from "./single"; import { + AbsoluteCenterLayout, CenterAdaptLayout, HorizontalAdaptLayout, VerticalLayout, @@ -12,7 +12,8 @@ import { createWidget, Providers } from "@/core"; -import { Layers } from "@/base"; +import { Label, Text } from "./single"; +import { Layers } from "@/base/0.base"; /** * 当没有元素时有提示信息的view @@ -43,7 +44,7 @@ export class Pane extends Widget { _assertTip() { if (!this._tipText) { createWidget({ - type: "bi.absolute_center_adapt", + type: AbsoluteCenterLayout.xtype, element: this, items: [ { diff --git a/src/base/layer/layer.drawer.js b/src/base/layer/layer.drawer.js index 395bd9a6c..0b1fdf81f 100644 --- a/src/base/layer/layer.drawer.js +++ b/src/base/layer/layer.drawer.js @@ -1,4 +1,14 @@ -import { HTapeLayout, AbsoluteLayout, Layout, VerticalLayout, Widget, shortcut, isPlainObject, extend } from "@/core"; +import { + VTapeLayout, + HTapeLayout, + AbsoluteLayout, + Layout, + VerticalLayout, + Widget, + shortcut, + isPlainObject, + extend +} from "@/core"; import { Label, IconButton } from "../single"; /** @@ -128,7 +138,7 @@ export class Drawer extends Widget { return extend( { - type: "bi.vtape", + type: VTapeLayout.xtype, items, }, this._getSuitableSize() diff --git a/src/base/layer/layer.popover.js b/src/base/layer/layer.popover.js index 4b766acff..7b4c56a54 100644 --- a/src/base/layer/layer.popover.js +++ b/src/base/layer/layer.popover.js @@ -1,4 +1,6 @@ import { + VTapeLayout, + RightVerticalAdaptLayout, HTapeLayout, AbsoluteLayout, VerticalLayout, @@ -202,7 +204,7 @@ export class Popover extends Widget { scrolly: false, } : { - type: "bi.vtape", + type: VTapeLayout.xtype, height: this._getSuitableHeight(size.height), } ); @@ -302,7 +304,7 @@ export class BarPopover extends Popover { const { footer, warningTitle } = this.options; footer || (this.options.footer = { - type: "bi.right_vertical_adapt", + type: RightVerticalAdaptLayout.xtype, lgap: 10, items: [ { diff --git a/src/base/single/0.single.js b/src/base/single/0.single.js index 34ee4ca98..6d2408b4f 100644 --- a/src/base/single/0.single.js +++ b/src/base/single/0.single.js @@ -1,5 +1,5 @@ import { Widget, shortcut, Actions, extend, isKey, isNotNull, isFunction, isPlainObject, isNull, delay } from "@/core"; -import { Tooltips } from "@/base"; +import { Tooltips } from "@/base/0.base"; /** * guy diff --git a/src/base/single/button/button.basic.js b/src/base/single/button/button.basic.js index fe952f2ac..1962bccc8 100644 --- a/src/base/single/button/button.basic.js +++ b/src/base/single/button/button.basic.js @@ -12,6 +12,7 @@ import { } from "@/core"; import { BubbleCombo } from "@/case/combo/bubblecombo/combo.bubble"; import { Single } from "../0.single"; +import { BubblePopupView } from "@/case/combo/bubblecombo/popup.bubble"; /** * guy @@ -56,8 +57,8 @@ export class BasicButton extends Single { const opts = this.options; opts.selected = isFunction(opts.selected) ? this.__watch(opts.selected, (context, newValue) => { - this.setSelected(newValue); - }) + this.setSelected(newValue); + }) : opts.selected; super._init(arguments); @@ -105,7 +106,7 @@ export class BasicButton extends Single { right: 0, top: 0, bottom: 0, - }, + } ], }); } @@ -117,7 +118,7 @@ export class BasicButton extends Single { this.$mask.invisible(); } }); - this.element.on(`mouseenter.${this.getName()}`, (e) => { + this.element.on(`mouseenter.${this.getName()}`, e => { if (this.element.__isMouseInBounds__(e)) { if (this.isEnabled() && !this._hover && (o.isShadowShowingOnSelected || !this.isSelected())) { assertMask(); @@ -125,7 +126,7 @@ export class BasicButton extends Single { } } }); - this.element.on(`mousemove.${this.getName()}`, (e) => { + this.element.on(`mousemove.${this.getName()}`, e => { if (!this.element.__isMouseInBounds__(e)) { if (this.isEnabled() && !this._hover) { assertMask(); @@ -158,7 +159,7 @@ export class BasicButton extends Single { return bubble; }; - const clk = (e) => { + const clk = e => { ev(e); if (!this.isEnabled() || !this.isValid()) { return; @@ -179,7 +180,7 @@ export class BasicButton extends Single { trigger: "", // bubble的提示不需要一直存在在界面上 destroyWhenHide: true, - ref: (_ref) => { + ref: _ref => { this.combo = _ref; }, el: { @@ -187,9 +188,9 @@ export class BasicButton extends Single { height: "100%", }, popup: { - type: "bi.text_bubble_bar_popup_view", + type: BubblePopupView.xtype, text: getBubble(), - ref: (_ref) => { + ref: _ref => { popup = _ref; }, listeners: [ @@ -202,7 +203,7 @@ export class BasicButton extends Single { onClick.apply(this, args); } }, - }, + } ], }, listeners: [ @@ -211,14 +212,14 @@ export class BasicButton extends Single { action() { popup.populate(getBubble()); }, - }, + } ], }, left: 0, right: 0, bottom: 0, top: 0, - }, + } ], }); } @@ -234,117 +235,117 @@ export class BasicButton extends Single { }; const triggerArr = (o.trigger || "").split(","); - triggerArr.forEach((trigger) => { + triggerArr.forEach(trigger => { let mouseDown = false; let selected = false; let interval; switch (trigger) { - case "mouseup": - hand.mousedown(() => { - mouseDown = true; - }); - hand.mouseup((e) => { - if (mouseDown === true) { - clk(e); - } - mouseDown = false; - ev(e); - }); - break; - case "mousedown": - // let mouseDown = false; - hand.mousedown((e) => { + case "mouseup": + hand.mousedown(() => { + mouseDown = true; + }); + hand.mouseup(e => { + if (mouseDown === true) { + clk(e); + } + mouseDown = false; + ev(e); + }); + break; + case "mousedown": + // let mouseDown = false; + hand.mousedown(e => { + // if (e.button === 0) { + Widget._renderEngine.createElement(document).bind(`mouseup.${this.getName()}`, e => { // if (e.button === 0) { - Widget._renderEngine.createElement(document).bind(`mouseup.${this.getName()}`, (e) => { - // if (e.button === 0) { - if ( - BI.DOM.isExist(this) && + if ( + BI.DOM.isExist(this) && !hand.__isMouseInBounds__(e) && mouseDown === true && !selected - ) { - // self.setSelected(!self.isSelected()); - this._trigger(); - } - mouseDown = false; - Widget._renderEngine.createElement(document).unbind(`mouseup.${this.getName()}`); - // } - }); - if (mouseDown === true) { - return; - } - if (this.isSelected()) { - selected = true; - } else { - clk(e); + ) { + // self.setSelected(!self.isSelected()); + this._trigger(); } - mouseDown = true; - ev(e); + mouseDown = false; + Widget._renderEngine.createElement(document).unbind(`mouseup.${this.getName()}`); // } }); - hand.mouseup((e) => { - // if (e.button === 0) { - if (BI.DOM.isExist(this) && mouseDown === true && selected === true) { - clk(e); - } + if (mouseDown === true) { + return; + } + if (this.isSelected()) { + selected = true; + } else { + clk(e); + } + mouseDown = true; + ev(e); + // } + }); + hand.mouseup(e => { + // if (e.button === 0) { + if (BI.DOM.isExist(this) && mouseDown === true && selected === true) { + clk(e); + } + mouseDown = false; + selected = false; + Widget._renderEngine.createElement(document).unbind(`mouseup.${this.getName()}`); + // } + }); + break; + case "dblclick": + hand.dblclick(clk); + break; + case "lclick": + hand.mousedown(e => { + Widget._renderEngine.createElement(document).bind(`mouseup.${this.getName()}`, () => { + interval && clearInterval(interval); + interval = null; mouseDown = false; - selected = false; Widget._renderEngine.createElement(document).unbind(`mouseup.${this.getName()}`); - // } }); - break; - case "dblclick": - hand.dblclick(clk); - break; - case "lclick": - hand.mousedown((e) => { - Widget._renderEngine.createElement(document).bind(`mouseup.${this.getName()}`, () => { - interval && clearInterval(interval); - interval = null; - mouseDown = false; - Widget._renderEngine.createElement(document).unbind(`mouseup.${this.getName()}`); - }); - if (mouseDown === true) { - return; - } - if (!this.isEnabled() || !this.isValid()) { - return; - } - if (this.isOnce() && this.isSelected()) { - return; - } - interval = setInterval(() => { - clk(e); - }, 180); - mouseDown = true; + if (mouseDown === true) { + return; + } + if (!this.isEnabled() || !this.isValid()) { + return; + } + if (this.isOnce() && this.isSelected()) { + return; + } + interval = setInterval(() => { + clk(e); + }, 180); + mouseDown = true; + ev(e); + }); + break; + default: + if (o.stopEvent || o.stopPropagation) { + hand.mousedown(e => { ev(e); }); - break; - default: - if (o.stopEvent || o.stopPropagation) { - hand.mousedown((e) => { - ev(e); - }); - } - hand.click(clk); - // enter键等同于点击 - o.attributes && + } + hand.click(clk); + // enter键等同于点击 + o.attributes && o.attributes.zIndex >= 0 && - hand.keyup((e) => { + hand.keyup(e => { if (e.keyCode === BI.KeyCode.ENTER) { clk(e); } }); - break; + break; } }); // 之后的300ms点击无效 const onClick = o.debounce ? BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, { - leading: true, - trailing: false, - }) + leading: true, + trailing: false, + }) : this._doClick; function ev(e) { @@ -366,8 +367,8 @@ export class BasicButton extends Single { this.isForceSelected() ? this.setSelected(true) : this.isForceNotSelected() - ? this.setSelected(false) - : this.setSelected(!this.isSelected()); + ? this.setSelected(false) + : this.setSelected(!this.isSelected()); } if (this.isValid()) { const v = this.getValue(); diff --git a/src/base/single/editor/editor.js b/src/base/single/editor/editor.js index 7aba92760..85174dfd6 100644 --- a/src/base/single/editor/editor.js +++ b/src/base/single/editor/editor.js @@ -13,7 +13,7 @@ import { } from "@/core"; import { Label } from "../label"; import { Single } from "../0.single"; -import { Bubbles } from "@/base"; +import { Bubbles } from "@/base/0.base"; /** * Created by GUY on 2015/4/15. diff --git a/src/base/single/editor/editor.textarea.js b/src/base/single/editor/editor.textarea.js index cdfa0966a..50c9b404f 100644 --- a/src/base/single/editor/editor.textarea.js +++ b/src/base/single/editor/editor.textarea.js @@ -16,7 +16,7 @@ import { } from "@/core"; import { Label } from "../label"; import { Single } from "../0.single"; -import { Bubbles } from "@/base"; +import { Bubbles } from "@/base/0.base"; /** * diff --git a/src/case/combo/bubblecombo/popup.bubble.js b/src/case/combo/bubblecombo/popup.bubble.js index 0f7782160..aceb1729d 100644 --- a/src/case/combo/bubblecombo/popup.bubble.js +++ b/src/case/combo/bubblecombo/popup.bubble.js @@ -4,8 +4,8 @@ import { Label } from "@/base/single/label/label"; @shortcut() export class BubblePopupView extends PopupView { - static xtype = "bi.bubble_popup_view"; - + static xtype = "bi.text_bubble_bar_popup_view"; + static EVENT_CLICK_TOOLBAR_BUTTON = "EVENT_CLICK_TOOLBAR_BUTTON"; static EVENT_CHANGE = "EVENT_CLICK_TOOLBAR_BUTTON";