Browse Source

case/button文件夹 es6

es6
Treecat 2 years ago
parent
commit
a18cd23e1c
  1. 77
      src/base/single/button/button.basic.js
  2. 7
      src/base/single/button/button.node.js
  3. 3
      src/base/single/button/buttons/button.image.js
  4. 25
      src/base/single/button/buttons/button.js
  5. 11
      src/base/single/button/buttons/button.text.js
  6. 23
      src/base/single/button/listitem/blankiconicontextitem.js
  7. 21
      src/base/single/button/listitem/blankicontexticonitem.js
  8. 21
      src/base/single/button/listitem/blankicontextitem.js
  9. 21
      src/base/single/button/listitem/icontexticonitem.js
  10. 21
      src/base/single/button/listitem/icontextitem.js
  11. 21
      src/base/single/button/listitem/texticonitem.js
  12. 19
      src/base/single/button/listitem/textitem.js
  13. 17
      src/base/single/button/node/icontexticonnode.js
  14. 17
      src/base/single/button/node/icontextnode.js
  15. 17
      src/base/single/button/node/texticonnode.js
  16. 15
      src/base/single/button/node/textnode.js
  17. 66
      src/case/button/icon/icon.change.js
  18. 27
      src/case/button/icon/icon.trigger.js
  19. 23
      src/case/button/icon/iconhalf/icon.half.image.js
  20. 36
      src/case/button/icon/iconhalf/icon.half.js
  21. 29
      src/case/button/index.js
  22. 64
      src/case/button/item.multiselect.js
  23. 60
      src/case/button/item.singleselect.icontext.js
  24. 65
      src/case/button/item.singleselect.js
  25. 69
      src/case/button/item.singleselect.radio.js
  26. 71
      src/case/button/node/node.arrow.js
  27. 82
      src/case/button/node/node.first.plus.js
  28. 99
      src/case/button/node/node.icon.arrow.js
  29. 93
      src/case/button/node/node.last.plus.js
  30. 85
      src/case/button/node/node.mid.plus.js
  31. 88
      src/case/button/node/node.multilayer.icon.arrow.js
  32. 79
      src/case/button/node/node.plus.js
  33. 45
      src/case/button/node/siwtcher.tree.node.js
  34. 77
      src/case/button/node/treenode.js
  35. 85
      src/case/button/switch.js
  36. 92
      src/case/button/treeitem/item.first.treeleaf.js
  37. 86
      src/case/button/treeitem/item.icon.treeleaf.js
  38. 94
      src/case/button/treeitem/item.last.treeleaf.js
  39. 94
      src/case/button/treeitem/item.mid.treeleaf.js
  40. 92
      src/case/button/treeitem/item.multilayer.icon.treeleaf.js
  41. 78
      src/case/button/treeitem/item.root.treeleaf.js
  42. 68
      src/case/button/treeitem/item.treetextleaf.js
  43. 62
      src/case/button/treeitem/treeitem.js
  44. 7
      src/case/index.js

77
src/base/single/button/button.basic.js

@ -1,5 +1,5 @@
import { Single } from "../0.single" import { Single } from "../0.single";
import { emptyFn, shortcut, extend, isFunction, createWidget, Widget, isObject, Controller } from "../../../core" import { emptyFn, shortcut, extend, isFunction, createWidget, Widget, isObject, Controller } from "../../../core";
/** /**
* guy * guy
@ -10,7 +10,6 @@ import { emptyFn, shortcut, extend, isFunction, createWidget, Widget, isObject,
*/ */
@shortcut() @shortcut()
export class BasicButton extends Single { export class BasicButton extends Single {
static xtype = "bi.basic_button"; static xtype = "bi.basic_button";
static EVENT_CHANGE = "BasicButton.EVENT_CHANGE"; static EVENT_CHANGE = "BasicButton.EVENT_CHANGE";
@ -19,7 +18,7 @@ export class BasicButton extends Single {
const conf = super._defaultConfig(arguments); const conf = super._defaultConfig(arguments);
return extend(conf, { return extend(conf, {
_baseCls: (conf._baseCls || "") + " bi-basic-button" + (conf.invalid ? "" : " cursor-pointer") + ((BI.isIE() && BI.getIEVersion() < 10) ? " hack" : ""), _baseCls: `${conf._baseCls || ""} bi-basic-button${conf.invalid ? "" : " cursor-pointer"}${(BI.isIE() && BI.getIEVersion() < 10) ? " hack" : ""}`,
// el: {} // 可以通过el来创建button元素 // el: {} // 可以通过el来创建button元素
value: "", value: "",
stopEvent: false, stopEvent: false,
@ -35,7 +34,7 @@ export class BasicButton extends Single {
trigger: null, trigger: null,
handler: emptyFn, handler: emptyFn,
bubble: null, bubble: null,
debounce: true debounce: true,
}); });
} }
@ -50,7 +49,7 @@ export class BasicButton extends Single {
this._createShadow(); this._createShadow();
} }
if (opts.level) { if (opts.level) {
this.element.addClass("button-" + opts.level); this.element.addClass(`button-${opts.level}`);
} }
} }
@ -92,7 +91,7 @@ export class BasicButton extends Single {
}], }],
}); });
} }
} };
this.element.mouseup(() => { this.element.mouseup(() => {
if (!this._hover && !o.isShadowShowingOnSelected) { if (!this._hover && !o.isShadowShowingOnSelected) {
@ -100,7 +99,7 @@ export class BasicButton extends Single {
this.$mask.invisible(); this.$mask.invisible();
} }
}); });
this.element.on("mouseenter." + this.getName(), (e) => { this.element.on(`mouseenter.${this.getName()}`, e => {
if (this.element.__isMouseInBounds__(e)) { if (this.element.__isMouseInBounds__(e)) {
if (this.isEnabled() && !this._hover && (o.isShadowShowingOnSelected || !this.isSelected())) { if (this.isEnabled() && !this._hover && (o.isShadowShowingOnSelected || !this.isSelected())) {
assertMask(); assertMask();
@ -108,7 +107,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.element.__isMouseInBounds__(e)) {
if (this.isEnabled() && !this._hover) { if (this.isEnabled() && !this._hover) {
assertMask(); assertMask();
@ -116,7 +115,7 @@ export class BasicButton extends Single {
} }
} }
}); });
this.element.on("mouseleave." + this.getName(), () => { this.element.on(`mouseleave.${this.getName()}`, () => {
if (this.isEnabled() && !this._hover) { if (this.isEnabled() && !this._hover) {
assertMask(); assertMask();
this.$mask.invisible(); this.$mask.invisible();
@ -139,9 +138,9 @@ export class BasicButton extends Single {
} }
return bubble; return bubble;
} };
const clk = (e) => { const clk = e => {
ev(e); ev(e);
if (!this.isEnabled() || !this.isValid()) { if (!this.isEnabled() || !this.isValid()) {
return; return;
@ -161,7 +160,7 @@ export class BasicButton extends Single {
trigger: "", trigger: "",
// bubble的提示不需要一直存在在界面上 // bubble的提示不需要一直存在在界面上
destroyWhenHide: true, destroyWhenHide: true,
ref: (_ref) => { ref: _ref => {
this.combo = _ref; this.combo = _ref;
}, },
el: { el: {
@ -171,7 +170,7 @@ export class BasicButton extends Single {
popup: { popup: {
type: "bi.text_bubble_bar_popup_view", type: "bi.text_bubble_bar_popup_view",
text: getBubble(), text: getBubble(),
ref: (_ref) => { ref: _ref => {
popup = _ref; popup = _ref;
}, },
listeners: [{ listeners: [{
@ -187,7 +186,7 @@ export class BasicButton extends Single {
}, },
listeners: [{ listeners: [{
eventName: BI.BubbleCombo.EVENT_BEFORE_POPUPVIEW, eventName: BI.BubbleCombo.EVENT_BEFORE_POPUPVIEW,
action: function () { action () {
popup.populate(getBubble()); popup.populate(getBubble());
}, },
}], }],
@ -208,19 +207,21 @@ export class BasicButton extends Single {
return; return;
} }
onClick.apply(this, arguments); onClick.apply(this, arguments);
} };
const triggerArr = (o.trigger || "").split(","); const triggerArr = (o.trigger || "").split(",");
triggerArr.forEach((trigger) => { triggerArr.forEach(trigger => {
let mouseDown = false; let mouseDown = false;
let selected = false;
let interval;
switch (trigger) { switch (trigger) {
case "mouseup": case "mouseup":
hand.mousedown(function () { hand.mousedown(() => {
mouseDown = true; mouseDown = true;
}); });
hand.mouseup(function (e) { hand.mouseup(e => {
if (mouseDown === true) { if (mouseDown === true) {
clk(e); clk(e);
} }
@ -230,17 +231,16 @@ export class BasicButton extends Single {
break; break;
case "mousedown": case "mousedown":
// let mouseDown = false; // let mouseDown = false;
let selected = false; hand.mousedown(e => {
hand.mousedown((e) => {
// if (e.button === 0) { // if (e.button === 0) {
Widget._renderEngine.createElement(document).bind("mouseup." + this.getName(), (e) => { Widget._renderEngine.createElement(document).bind(`mouseup.${this.getName()}`, e => {
// if (e.button === 0) { // if (e.button === 0) {
if (BI.DOM.isExist(this) && !hand.__isMouseInBounds__(e) && mouseDown === true && !selected) { if (BI.DOM.isExist(this) && !hand.__isMouseInBounds__(e) && mouseDown === true && !selected) {
// self.setSelected(!self.isSelected()); // self.setSelected(!self.isSelected());
this._trigger(); this._trigger();
} }
mouseDown = false; mouseDown = false;
Widget._renderEngine.createElement(document).unbind("mouseup." + this.getName()); Widget._renderEngine.createElement(document).unbind(`mouseup.${this.getName()}`);
// } // }
}); });
if (mouseDown === true) { if (mouseDown === true) {
@ -255,14 +255,14 @@ export class BasicButton extends Single {
ev(e); ev(e);
// } // }
}); });
hand.mouseup((e) => { hand.mouseup(e => {
// if (e.button === 0) { // if (e.button === 0) {
if (BI.DOM.isExist(this) && mouseDown === true && selected === true) { if (BI.DOM.isExist(this) && mouseDown === true && selected === true) {
clk(e); clk(e);
} }
mouseDown = false; mouseDown = false;
selected = false; selected = false;
Widget._renderEngine.createElement(document).unbind("mouseup." + this.getName()); Widget._renderEngine.createElement(document).unbind(`mouseup.${this.getName()}`);
// } // }
}); });
break; break;
@ -270,13 +270,12 @@ export class BasicButton extends Single {
hand.dblclick(clk); hand.dblclick(clk);
break; break;
case "lclick": case "lclick":
let interval; hand.mousedown(e => {
hand.mousedown((e) => { Widget._renderEngine.createElement(document).bind(`mouseup.${this.getName()}`, () => {
Widget._renderEngine.createElement(document).bind("mouseup." + this.getName(), () => {
interval && clearInterval(interval); interval && clearInterval(interval);
interval = null; interval = null;
mouseDown = false; mouseDown = false;
Widget._renderEngine.createElement(document).unbind("mouseup." + this.getName()); Widget._renderEngine.createElement(document).unbind(`mouseup.${this.getName()}`);
}); });
if (mouseDown === true) { if (mouseDown === true) {
return; return;
@ -287,8 +286,8 @@ export class BasicButton extends Single {
if (this.isOnce() && this.isSelected()) { if (this.isOnce() && this.isSelected()) {
return; return;
} }
interval = setInterval(function () { interval = setInterval(() => {
clk(e) clk(e);
}, 180); }, 180);
mouseDown = true; mouseDown = true;
ev(e); ev(e);
@ -296,13 +295,13 @@ export class BasicButton extends Single {
break; break;
default: default:
if (o.stopEvent || o.stopPropagation) { if (o.stopEvent || o.stopPropagation) {
hand.mousedown(function (e) { hand.mousedown(e => {
ev(e); ev(e);
}); });
} }
hand.click(clk); hand.click(clk);
// enter键等同于点击 // enter键等同于点击
o.attributes && o.attributes.zIndex >= 0 && hand.keyup(function (e) { o.attributes && o.attributes.zIndex >= 0 && hand.keyup(e => {
if (e.keyCode === BI.KeyCode.ENTER) { if (e.keyCode === BI.KeyCode.ENTER) {
clk(e); clk(e);
} }
@ -312,9 +311,9 @@ export class BasicButton extends Single {
}); });
// 之后的300ms点击无效 // 之后的300ms点击无效
let onClick = o.debounce ? BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, { const onClick = o.debounce ? BI.debounce(this._doClick, BI.EVENT_RESPONSE_TIME, {
"leading": true, leading: true,
"trailing": false, trailing: false,
}) : this._doClick; }) : this._doClick;
function ev(e) { function ev(e) {
@ -325,10 +324,6 @@ export class BasicButton extends Single {
e.stopPropagation(); e.stopPropagation();
} }
} }
} }
_trigger(e) { _trigger(e) {
@ -458,7 +453,7 @@ export class BasicButton extends Single {
} }
empty() { empty() {
Widget._renderEngine.createElement(document).unbind("mouseup." + this.getName()); Widget._renderEngine.createElement(document).unbind(`mouseup.${this.getName()}`);
super.empty.apply(this, arguments); super.empty.apply(this, arguments);
} }
} }

7
src/base/single/button/button.node.js

@ -1,5 +1,5 @@
import { BasicButton } from "./button.basic" import { BasicButton } from "./button.basic";
import { shortcut, extend, Controller } from "../../../core" import { shortcut, extend, Controller } from "../../../core";
/** /**
* 表示一个可以展开的节点, 不仅有选中状态而且有展开状态 * 表示一个可以展开的节点, 不仅有选中状态而且有展开状态
@ -11,14 +11,13 @@ import { shortcut, extend, Controller } from "../../../core"
*/ */
@shortcut() @shortcut()
export class NodeButton extends BasicButton { export class NodeButton extends BasicButton {
static xtype = "bi.node_button"; static xtype = "bi.node_button";
_defaultConfig() { _defaultConfig() {
const conf = super._defaultConfig(arguments); const conf = super._defaultConfig(arguments);
return extend(conf, { return extend(conf, {
_baseCls: (conf._baseCls || "") + " bi-node", _baseCls: `${conf._baseCls || ""} bi-node`,
open: false, open: false,
once: false, once: false,
}); });

3
src/base/single/button/buttons/button.image.js

@ -11,7 +11,6 @@ import { shortcut, extend, isNumber, createWidget } from "../../../../core";
*/ */
@shortcut() @shortcut()
export class ImageButton extends BasicButton { export class ImageButton extends BasicButton {
static EVENT_CHANGE = "EVENT_CHANGE"; static EVENT_CHANGE = "EVENT_CHANGE";
static xtype = "bi.image_button"; static xtype = "bi.image_button";
@ -19,7 +18,7 @@ export class ImageButton extends BasicButton {
const conf = super._defaultConfig(arguments); const conf = super._defaultConfig(arguments);
return extend(conf, { return extend(conf, {
baseCls: (conf.baseCls || "") + " bi-image-button", baseCls: `${conf.baseCls || ""} bi-image-button`,
src: "", src: "",
iconWidth: "100%", iconWidth: "100%",
iconHeight: "100%", iconHeight: "100%",

25
src/base/single/button/buttons/button.js

@ -17,7 +17,6 @@ const loadingCls = "button-loading-font anim-rotate";
*/ */
@shortcut() @shortcut()
export class Button extends BasicButton { export class Button extends BasicButton {
_const = { _const = {
iconWidth: 18, iconWidth: 18,
} }
@ -33,16 +32,16 @@ export class Button extends BasicButton {
// 图标高度和文字高度默认相等 // 图标高度和文字高度默认相等
adaptiveHeight += (props.textHeight || 16) * 2; adaptiveHeight += (props.textHeight || 16) * 2;
adaptiveHeight += props.iconGap || 0; adaptiveHeight += props.iconGap || 0;
let tGap = props.tgap || props.vgap || 2; const tGap = props.tgap || props.vgap || 2;
let bGap = props.bgap || props.vgap || 2; const bGap = props.bgap || props.vgap || 2;
adaptiveHeight += (tGap + bGap); adaptiveHeight += (tGap + bGap);
} }
let clearMinWidth = props.block === true || props.clear === true || props.plain; const clearMinWidth = props.block === true || props.clear === true || props.plain;
return { return {
...conf, ...conf,
baseCls: (conf.baseCls || "") + " bi-button" + ((BI.isIE() && BI.isIE9Below()) ? " hack" : ""), baseCls: `${conf.baseCls || ""} bi-button${(BI.isIE() && BI.isIE9Below()) ? " hack" : ""}`,
attributes: { attributes: {
tabIndex: 1, tabIndex: 1,
}, },
@ -72,7 +71,7 @@ export class Button extends BasicButton {
icon: "", icon: "",
iconGap: 0, iconGap: 0,
iconPosition: "left", iconPosition: "left",
} };
} }
render() { render() {
@ -83,7 +82,7 @@ export class Button extends BasicButton {
type: "bi.center_adapt", type: "bi.center_adapt",
horizontalAlign: o.textAlign, horizontalAlign: o.textAlign,
element: this, element: this,
ref: (ref) => { ref: ref => {
this.containerRef = ref; this.containerRef = ref;
}, },
hgap: o.hgap, hgap: o.hgap,
@ -97,7 +96,7 @@ export class Button extends BasicButton {
if (BI.get(o, clz) === true) { if (BI.get(o, clz) === true) {
this.element.addClass(clz); this.element.addClass(clz);
} }
}) });
if (o.minWidth > 0) { if (o.minWidth > 0) {
this.element.css({ "min-width": BI.pixFormat(o.minWidth) }); this.element.css({ "min-width": BI.pixFormat(o.minWidth) });
@ -139,7 +138,7 @@ export class Button extends BasicButton {
text: o.text, text: o.text,
whiteSpace: o.whiteSpace, whiteSpace: o.whiteSpace,
textAlign: o.textAlign, textAlign: o.textAlign,
textWidth: textWidth, textWidth,
textHeight: BI.toPix(textHeight, hasBorder ? 2 : 0), textHeight: BI.toPix(textHeight, hasBorder ? 2 : 0),
height: BI.toPix(lineHeight, hasBorder ? 2 : 0), height: BI.toPix(lineHeight, hasBorder ? 2 : 0),
value: o.value, value: o.value,
@ -258,19 +257,19 @@ export class Button extends BasicButton {
} }
doRedMark() { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
} }
unRedMark() { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
} }
doHighLight() { doHighLight() {
this.text.doHighLight.apply(this.text, arguments); this.text.doHighLight(...arguments);
} }
unHighLight() { unHighLight() {
this.text.unHighLight.apply(this.text, arguments); this.text.unHighLight(...arguments);
} }
} }

11
src/base/single/button/buttons/button.text.js

@ -10,7 +10,6 @@ import { shortcut, extend, createWidget } from "../../../../core";
*/ */
@shortcut() @shortcut()
export class TextButton extends BasicButton { export class TextButton extends BasicButton {
static xtype = "bi.text_button"; static xtype = "bi.text_button";
static EVENT_CHANGE = "EVENT_CHANGE"; static EVENT_CHANGE = "EVENT_CHANGE";
@ -18,7 +17,7 @@ export class TextButton extends BasicButton {
const conf = super._defaultConfig(arguments); const conf = super._defaultConfig(arguments);
return extend(conf, { return extend(conf, {
baseCls: (conf.baseCls || "") + " bi-text-button", baseCls: `${conf.baseCls || ""} bi-text-button`,
textAlign: "center", textAlign: "center",
whiteSpace: "nowrap", whiteSpace: "nowrap",
textWidth: null, textWidth: null,
@ -61,19 +60,19 @@ export class TextButton extends BasicButton {
} }
doRedMark() { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
} }
unRedMark() { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
} }
doHighLight() { doHighLight() {
this.text.doHighLight.apply(this.text, arguments); this.text.doHighLight(...arguments);
} }
unHighLight() { unHighLight() {
this.text.unHighLight.apply(this.text, arguments); this.text.unHighLight(...arguments);
} }
setText(text) { setText(text) {

23
src/base/single/button/listitem/blankiconicontextitem.js

@ -1,5 +1,5 @@
import { BasicButton } from "../button.basic" import { BasicButton } from "../button.basic";
import { emptyFn, shortcut } from "../../../../core" import { shortcut } from "../../../../core";
/** /**
* 带有一个占位 * 带有一个占位
@ -10,15 +10,14 @@ import { emptyFn, shortcut } from "../../../../core"
*/ */
@shortcut() @shortcut()
export class BlankIconIconTextItem extends BasicButton { export class BlankIconIconTextItem extends BasicButton {
static EVENT_CHANGE = "EVENT_CHANGE"; static EVENT_CHANGE = "EVENT_CHANGE";
static xtype = "bi.blank_icon_icon_text_item"; static xtype = "bi.blank_icon_icon_text_item";
_defaultConfig() { _defaultConfig() {
var conf = super._defaultConfig(arguments); const conf = super._defaultConfig(arguments);
return BI.extend(conf, { return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-blank-icon-icon-text-item", baseCls: `${conf.baseCls || ""} bi-blank-icon-icon-text-item`,
iconCls1: "", iconCls1: "",
iconCls2: "", iconCls2: "",
blankWidth: 0, blankWidth: 0,
@ -57,7 +56,7 @@ export class BlankIconIconTextItem extends BasicButton {
}, { }, {
el: { el: {
type: "bi.label", type: "bi.label",
ref: (_ref) => { ref: _ref => {
this.text = _ref; this.text = _ref;
}, },
textAlign: "left", textAlign: "left",
@ -89,7 +88,7 @@ export class BlankIconIconTextItem extends BasicButton {
setValue() { setValue() {
if (!this.isReadOnly()) { if (!this.isReadOnly()) {
this.text.setValue.apply(this.text, arguments); this.text.setValue(...arguments);
} }
} }
@ -98,7 +97,7 @@ export class BlankIconIconTextItem extends BasicButton {
} }
setText() { setText() {
this.text.setText.apply(this.text, arguments); this.text.setText(...arguments);
} }
getText() { getText() {
@ -106,18 +105,18 @@ export class BlankIconIconTextItem extends BasicButton {
} }
doRedMark() { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
} }
unRedMark() { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
} }
doHighLight() { doHighLight() {
this.text.doHighLight.apply(this.text, arguments); this.text.doHighLight(...arguments);
} }
unHighLight() { unHighLight() {
this.text.unHighLight.apply(this.text, arguments); this.text.unHighLight(...arguments);
} }
} }

21
src/base/single/button/listitem/blankicontexticonitem.js

@ -1,5 +1,5 @@
import { BasicButton } from "../button.basic" import { BasicButton } from "../button.basic";
import { emptyFn, shortcut, extend } from "../../../../core" import { shortcut, extend } from "../../../../core";
/** /**
* guy * guy
@ -11,7 +11,6 @@ import { emptyFn, shortcut, extend } from "../../../../core"
*/ */
@shortcut() @shortcut()
export class BlankIconTextIconItem extends BasicButton { export class BlankIconTextIconItem extends BasicButton {
static xtype = "bi.blank_icon_text_icon_item"; static xtype = "bi.blank_icon_text_icon_item";
static EVENT_CHANGE = "EVENT_CHANGE"; static EVENT_CHANGE = "EVENT_CHANGE";
@ -19,7 +18,7 @@ export class BlankIconTextIconItem extends BasicButton {
const conf = super._defaultConfig(arguments); const conf = super._defaultConfig(arguments);
return extend(conf, { return extend(conf, {
baseCls: (conf.baseCls || "") + " bi-blank-icon-text-icon-item", baseCls: `${conf.baseCls || ""} bi-blank-icon-text-icon-item`,
iconCls1: "", iconCls1: "",
iconCls2: "", iconCls2: "",
blankWidth: 0, blankWidth: 0,
@ -51,7 +50,7 @@ export class BlankIconTextIconItem extends BasicButton {
}, { }, {
el: { el: {
type: "bi.label", type: "bi.label",
ref: (_ref) => { ref: _ref => {
this.text = _ref; this.text = _ref;
}, },
textAlign: "left", textAlign: "left",
@ -83,24 +82,24 @@ export class BlankIconTextIconItem extends BasicButton {
} }
doRedMark() { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
} }
unRedMark() { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
} }
doHighLight() { doHighLight() {
this.text.doHighLight.apply(this.text, arguments); this.text.doHighLight(...arguments);
} }
unHighLight() { unHighLight() {
this.text.unHighLight.apply(this.text, arguments); this.text.unHighLight(...arguments);
} }
setValue() { setValue() {
if (!this.isReadOnly()) { if (!this.isReadOnly()) {
this.text.setValue.apply(this.text, arguments); this.text.setValue(...arguments);
} }
} }
@ -109,7 +108,7 @@ export class BlankIconTextIconItem extends BasicButton {
} }
setText() { setText() {
this.text.setText.apply(this.text, arguments); this.text.setText(...arguments);
} }
getText() { getText() {

21
src/base/single/button/listitem/blankicontextitem.js

@ -1,5 +1,5 @@
import { BasicButton } from "../button.basic" import { BasicButton } from "../button.basic";
import { extend, shortcut } from "../../../../core" import { extend, shortcut } from "../../../../core";
/** /**
* 带有一个占位 * 带有一个占位
@ -10,7 +10,6 @@ import { extend, shortcut } from "../../../../core"
*/ */
@shortcut() @shortcut()
export class BlankIconTextItem extends BasicButton { export class BlankIconTextItem extends BasicButton {
static xtype = "bi.blank_icon_text_item"; static xtype = "bi.blank_icon_text_item";
static EVENT_CHANGE = "EVENT_CHANGE"; static EVENT_CHANGE = "EVENT_CHANGE";
@ -18,7 +17,7 @@ export class BlankIconTextItem extends BasicButton {
const conf = super._defaultConfig(arguments); const conf = super._defaultConfig(arguments);
return extend(conf, { return extend(conf, {
baseCls: (conf.baseCls || "") + " bi-blank-icon-text-item", baseCls: `${conf.baseCls || ""} bi-blank-icon-text-item`,
blankWidth: 0, blankWidth: 0,
iconHeight: null, iconHeight: null,
iconWidth: null, iconWidth: null,
@ -49,7 +48,7 @@ export class BlankIconTextItem extends BasicButton {
}, { }, {
el: { el: {
type: "bi.label", type: "bi.label",
ref: (_ref) => { ref: _ref => {
this.text = _ref; this.text = _ref;
}, },
cls: "list-item-text", cls: "list-item-text",
@ -76,7 +75,7 @@ export class BlankIconTextItem extends BasicButton {
setValue() { setValue() {
if (!this.isReadOnly()) { if (!this.isReadOnly()) {
this.text.setValue.apply(this.text, arguments); this.text.setValue(...arguments);
} }
} }
@ -85,7 +84,7 @@ export class BlankIconTextItem extends BasicButton {
} }
setText() { setText() {
this.text.setText.apply(this.text, arguments); this.text.setText(...arguments);
} }
getText() { getText() {
@ -93,18 +92,18 @@ export class BlankIconTextItem extends BasicButton {
} }
doRedMark() { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
} }
unRedMark() { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
} }
doHighLight() { doHighLight() {
this.text.doHighLight.apply(this.text, arguments); this.text.doHighLight(...arguments);
} }
unHighLight() { unHighLight() {
this.text.unHighLight.apply(this.text, arguments); this.text.unHighLight(...arguments);
} }
} }

21
src/base/single/button/listitem/icontexticonitem.js

@ -1,5 +1,5 @@
import { BasicButton } from "../button.basic" import { BasicButton } from "../button.basic";
import { extend, shortcut } from "../../../../core" import { extend, shortcut } from "../../../../core";
/** /**
* guy * guy
@ -12,7 +12,6 @@ import { extend, shortcut } from "../../../../core"
@shortcut() @shortcut()
export class IconTextIconItem extends BasicButton { export class IconTextIconItem extends BasicButton {
static EVENT_CHANGE = "EVENT_CHANGE"; static EVENT_CHANGE = "EVENT_CHANGE";
static xtype = "bi.icon_text_icon_item"; static xtype = "bi.icon_text_icon_item";
@ -20,7 +19,7 @@ export class IconTextIconItem extends BasicButton {
const conf = super._defaultConfig(arguments); const conf = super._defaultConfig(arguments);
return extend(conf, { return extend(conf, {
baseCls: (conf.baseCls || "") + " bi-icon-text-icon-item", baseCls: `${conf.baseCls || ""} bi-icon-text-icon-item`,
iconCls1: "", iconCls1: "",
iconCls2: "", iconCls2: "",
iconHeight: null, iconHeight: null,
@ -48,7 +47,7 @@ export class IconTextIconItem extends BasicButton {
}, { }, {
el: { el: {
type: "bi.label", type: "bi.label",
ref: (_ref) => { ref: _ref => {
this.text = _ref; this.text = _ref;
}, },
textAlign: "left", textAlign: "left",
@ -80,24 +79,24 @@ export class IconTextIconItem extends BasicButton {
} }
doRedMark() { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
} }
unRedMark() { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
} }
doHighLight() { doHighLight() {
this.text.doHighLight.apply(this.text, arguments); this.text.doHighLight(...arguments);
} }
unHighLight() { unHighLight() {
this.text.unHighLight.apply(this.text, arguments); this.text.unHighLight(...arguments);
} }
setValue() { setValue() {
if (!this.isReadOnly()) { if (!this.isReadOnly()) {
this.text.setValue.apply(this.text, arguments); this.text.setValue(...arguments);
} }
} }
@ -106,7 +105,7 @@ export class IconTextIconItem extends BasicButton {
} }
setText() { setText() {
this.text.setText.apply(this.text, arguments); this.text.setText(...arguments);
} }
getText() { getText() {

21
src/base/single/button/listitem/icontextitem.js

@ -1,5 +1,5 @@
import { BasicButton } from "../button.basic" import { BasicButton } from "../button.basic";
import { extend, shortcut } from "../../../../core" import { extend, shortcut } from "../../../../core";
/** /**
* guy * guy
@ -10,7 +10,6 @@ import { extend, shortcut } from "../../../../core"
*/ */
@shortcut() @shortcut()
export class IconTextItem extends BasicButton { export class IconTextItem extends BasicButton {
static EVENT_CHANGE = "EVENT_CHANGE"; static EVENT_CHANGE = "EVENT_CHANGE";
static xtype = "bi.icon_text_item"; static xtype = "bi.icon_text_item";
@ -18,7 +17,7 @@ export class IconTextItem extends BasicButton {
const conf = super._defaultConfig(arguments); const conf = super._defaultConfig(arguments);
return extend(conf, { return extend(conf, {
baseCls: (conf.baseCls || "") + " bi-icon-text-item", baseCls: `${conf.baseCls || ""} bi-icon-text-item`,
direction: BI.Direction.Left, direction: BI.Direction.Left,
iconWrapperWidth: null, iconWrapperWidth: null,
iconHeight: null, iconHeight: null,
@ -47,7 +46,7 @@ export class IconTextItem extends BasicButton {
}, { }, {
el: { el: {
type: "bi.label", type: "bi.label",
ref: (_ref) => { ref: _ref => {
this.text = _ref; this.text = _ref;
}, },
cls: "list-item-text", cls: "list-item-text",
@ -74,7 +73,7 @@ export class IconTextItem extends BasicButton {
setValue() { setValue() {
if (!this.isReadOnly()) { if (!this.isReadOnly()) {
this.text.setValue.apply(this.text, arguments); this.text.setValue(...arguments);
} }
} }
@ -83,7 +82,7 @@ export class IconTextItem extends BasicButton {
} }
setText() { setText() {
this.text.setText.apply(this.text, arguments); this.text.setText(...arguments);
} }
getText() { getText() {
@ -91,18 +90,18 @@ export class IconTextItem extends BasicButton {
} }
doRedMark() { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
} }
unRedMark() { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
} }
doHighLight() { doHighLight() {
this.text.doHighLight.apply(this.text, arguments); this.text.doHighLight(...arguments);
} }
unHighLight() { unHighLight() {
this.text.unHighLight.apply(this.text, arguments); this.text.unHighLight(...arguments);
} }
} }

21
src/base/single/button/listitem/texticonitem.js

@ -1,5 +1,5 @@
import { BasicButton } from "../button.basic" import { BasicButton } from "../button.basic";
import { extend, shortcut } from "../../../../core" import { extend, shortcut } from "../../../../core";
/** /**
* *
@ -11,7 +11,6 @@ import { extend, shortcut } from "../../../../core"
*/ */
@shortcut() @shortcut()
export class TextIconItem extends BasicButton { export class TextIconItem extends BasicButton {
static xtype = "bi.text_icon_item"; static xtype = "bi.text_icon_item";
static EVENT_CHANGE = "EVENT_CHANGE" static EVENT_CHANGE = "EVENT_CHANGE"
@ -19,7 +18,7 @@ export class TextIconItem extends BasicButton {
const conf = super._defaultConfig(arguments); const conf = super._defaultConfig(arguments);
return extend(conf, { return extend(conf, {
baseCls: (conf.baseCls || "") + " bi-text-icon-item", baseCls: `${conf.baseCls || ""} bi-text-icon-item`,
iconWrapperWidth: null, iconWrapperWidth: null,
iconHeight: null, iconHeight: null,
iconWidth: null, iconWidth: null,
@ -40,7 +39,7 @@ export class TextIconItem extends BasicButton {
items: [{ items: [{
el: { el: {
type: "bi.label", type: "bi.label",
ref: function (_ref) { ref (_ref) {
self.text = _ref; self.text = _ref;
}, },
cls: "list-item-text", cls: "list-item-text",
@ -74,7 +73,7 @@ export class TextIconItem extends BasicButton {
setValue() { setValue() {
if (!this.isReadOnly()) { if (!this.isReadOnly()) {
this.text.setValue.apply(this.text, arguments); this.text.setValue(...arguments);
} }
} }
@ -83,7 +82,7 @@ export class TextIconItem extends BasicButton {
} }
setText() { setText() {
this.text.setText.apply(this.text, arguments); this.text.setText(...arguments);
} }
getText() { getText() {
@ -91,18 +90,18 @@ export class TextIconItem extends BasicButton {
} }
doRedMark() { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
} }
unRedMark() { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
} }
doHighLight() { doHighLight() {
this.text.doHighLight.apply(this.text, arguments); this.text.doHighLight(...arguments);
} }
unHighLight() { unHighLight() {
this.text.unHighLight.apply(this.text, arguments); this.text.unHighLight(...arguments);
} }
} }

19
src/base/single/button/listitem/textitem.js

@ -1,5 +1,5 @@
import { BasicButton } from "../button.basic" import { BasicButton } from "../button.basic";
import { extend, shortcut } from "../../../../core" import { extend, shortcut } from "../../../../core";
/** /**
* guy * guy
@ -11,7 +11,6 @@ import { extend, shortcut } from "../../../../core"
*/ */
@shortcut @shortcut
export class TextItem extends BasicButton { export class TextItem extends BasicButton {
static xtype = "bi.text_item"; static xtype = "bi.text_item";
static EVENT_CHANGE = "EVENT_CHANGE"; static EVENT_CHANGE = "EVENT_CHANGE";
@ -19,7 +18,7 @@ export class TextItem extends BasicButton {
const conf = super._defaultConfig(arguments); const conf = super._defaultConfig(arguments);
return extend(conf, { return extend(conf, {
baseCls: (conf.baseCls || "") + " bi-text-item", baseCls: `${conf.baseCls || ""} bi-text-item`,
textAlign: "left", textAlign: "left",
whiteSpace: "nowrap", whiteSpace: "nowrap",
textHgap: 0, textHgap: 0,
@ -57,24 +56,24 @@ export class TextItem extends BasicButton {
} }
doRedMark() { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
} }
unRedMark() { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
} }
doHighLight() { doHighLight() {
this.text.doHighLight.apply(this.text, arguments); this.text.doHighLight(...arguments);
} }
unHighLight() { unHighLight() {
this.text.unHighLight.apply(this.text, arguments); this.text.unHighLight(...arguments);
} }
setValue() { setValue() {
if (!this.isReadOnly()) { if (!this.isReadOnly()) {
this.text.setValue.apply(this.text, arguments); this.text.setValue(...arguments);
} }
} }
@ -83,7 +82,7 @@ export class TextItem extends BasicButton {
} }
setText() { setText() {
this.text.setText.apply(this.text, arguments); this.text.setText(...arguments);
} }
getText() { getText() {

17
src/base/single/button/node/icontexticonnode.js

@ -1,5 +1,5 @@
import { NodeButton } from "../button.node" import { NodeButton } from "../button.node";
import { extend, shortcut } from "../../../../core" import { extend, shortcut } from "../../../../core";
/** /**
* guy * guy
@ -9,7 +9,6 @@ import { extend, shortcut } from "../../../../core"
*/ */
@shortcut() @shortcut()
export class IconTextIconNode extends NodeButton { export class IconTextIconNode extends NodeButton {
static xtype = "bi.icon_text_icon_node"; static xtype = "bi.icon_text_icon_node";
static EVENT_CHANGE = "EVENT_CHANGE"; static EVENT_CHANGE = "EVENT_CHANGE";
@ -17,7 +16,7 @@ export class IconTextIconNode extends NodeButton {
const conf = super._defaultConfig(arguments); const conf = super._defaultConfig(arguments);
return extend(conf, { return extend(conf, {
baseCls: (conf.baseCls || "") + " bi-icon-text-icon-node", baseCls: `${conf.baseCls || ""} bi-icon-text-icon-node`,
iconCls1: "close-ha-font", iconCls1: "close-ha-font",
iconCls2: "close-ha-font", iconCls2: "close-ha-font",
iconHeight: null, iconHeight: null,
@ -45,7 +44,7 @@ export class IconTextIconNode extends NodeButton {
}, { }, {
el: { el: {
type: "bi.label", type: "bi.label",
ref: (_ref) => { ref: _ref => {
this.text = _ref; this.text = _ref;
}, },
textAlign: "left", textAlign: "left",
@ -77,16 +76,16 @@ export class IconTextIconNode extends NodeButton {
} }
doRedMark() { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
} }
unRedMark() { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
} }
setValue() { setValue() {
if (!this.isReadOnly()) { if (!this.isReadOnly()) {
this.text.setValue.apply(this.text, arguments); this.text.setValue(...arguments);
} }
} }
@ -95,7 +94,7 @@ export class IconTextIconNode extends NodeButton {
} }
setText() { setText() {
this.text.setText.apply(this.text, arguments); this.text.setText(...arguments);
} }
getText() { getText() {

17
src/base/single/button/node/icontextnode.js

@ -1,5 +1,5 @@
import { NodeButton } from "../button.node" import { NodeButton } from "../button.node";
import { extend, shortcut } from "../../../../core" import { extend, shortcut } from "../../../../core";
/** /**
* guy * guy
@ -9,7 +9,6 @@ import { extend, shortcut } from "../../../../core"
*/ */
@shortcut() @shortcut()
export class IconTextNode extends NodeButton { export class IconTextNode extends NodeButton {
static EVENT_CHANGE = "EVENT_CHANGE"; static EVENT_CHANGE = "EVENT_CHANGE";
static xtype = "bi.icon_text_node"; static xtype = "bi.icon_text_node";
@ -17,7 +16,7 @@ export class IconTextNode extends NodeButton {
const conf = super._defaultConfig(arguments); const conf = super._defaultConfig(arguments);
return extend(conf, { return extend(conf, {
baseCls: (conf.baseCls || "") + " bi-icon-text-node", baseCls: `${conf.baseCls || ""} bi-icon-text-node`,
cls: "close-ha-font", cls: "close-ha-font",
iconHeight: null, iconHeight: null,
iconWidth: null, iconWidth: null,
@ -44,7 +43,7 @@ export class IconTextNode extends NodeButton {
}, { }, {
el: { el: {
type: "bi.label", type: "bi.label",
ref: (_ref) => { ref: _ref => {
this.text = _ref; this.text = _ref;
}, },
cls: "list-item-text", cls: "list-item-text",
@ -71,7 +70,7 @@ export class IconTextNode extends NodeButton {
setValue() { setValue() {
if (!this.isReadOnly()) { if (!this.isReadOnly()) {
this.text.setValue.apply(this.text, arguments); this.text.setValue(...arguments);
} }
} }
@ -80,7 +79,7 @@ export class IconTextNode extends NodeButton {
} }
setText() { setText() {
this.text.setText.apply(this.text, arguments); this.text.setText(...arguments);
} }
getText() { getText() {
@ -88,11 +87,11 @@ export class IconTextNode extends NodeButton {
} }
doRedMark() { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
} }
unRedMark() { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
} }
} }

17
src/base/single/button/node/texticonnode.js

@ -1,5 +1,5 @@
import { NodeButton } from "../button.node" import { NodeButton } from "../button.node";
import { extend, shortcut } from "../../../../core" import { extend, shortcut } from "../../../../core";
/** /**
* Created by GUY on 2015/9/9. * Created by GUY on 2015/9/9.
@ -8,7 +8,6 @@ import { extend, shortcut } from "../../../../core"
*/ */
@shortcut() @shortcut()
export default class TextIconNode extends NodeButton { export default class TextIconNode extends NodeButton {
static EVENT_CHANGE = "EVENT_CHANGE"; static EVENT_CHANGE = "EVENT_CHANGE";
static xtype = "bi.text_icon_node"; static xtype = "bi.text_icon_node";
@ -16,7 +15,7 @@ export default class TextIconNode extends NodeButton {
const conf = super._defaultConfig(arguments); const conf = super._defaultConfig(arguments);
return extend(conf, { return extend(conf, {
baseCls: (conf.baseCls || "") + " bi-text-icon-node", baseCls: `${conf.baseCls || ""} bi-text-icon-node`,
cls: "close-ha-font", cls: "close-ha-font",
iconHeight: null, iconHeight: null,
iconWidth: null, iconWidth: null,
@ -36,7 +35,7 @@ export default class TextIconNode extends NodeButton {
items: [{ items: [{
el: { el: {
type: "bi.label", type: "bi.label",
ref: (_ref) => { ref: _ref => {
this.text = _ref; this.text = _ref;
}, },
cls: "list-item-text", cls: "list-item-text",
@ -70,7 +69,7 @@ export default class TextIconNode extends NodeButton {
setValue() { setValue() {
if (!this.isReadOnly()) { if (!this.isReadOnly()) {
this.text.setValue.apply(this.text, arguments); this.text.setValue(...arguments);
} }
} }
@ -79,7 +78,7 @@ export default class TextIconNode extends NodeButton {
} }
setText() { setText() {
this.text.setText.apply(this.text, arguments); this.text.setText(...arguments);
} }
getText() { getText() {
@ -87,10 +86,10 @@ export default class TextIconNode extends NodeButton {
} }
doRedMark() { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
} }
unRedMark() { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
} }
} }

15
src/base/single/button/node/textnode.js

@ -1,5 +1,5 @@
import { NodeButton } from "../button.node" import { NodeButton } from "../button.node";
import { extend, shortcut } from "../../../../core" import { extend, shortcut } from "../../../../core";
/** /**
* guy * guy
@ -10,7 +10,6 @@ import { extend, shortcut } from "../../../../core"
*/ */
@shortcut() @shortcut()
export class TextNode extends NodeButton { export class TextNode extends NodeButton {
static xtype = "bi.text_node" static xtype = "bi.text_node"
static EVENT_CHANGE = "EVENT_CHANGE" static EVENT_CHANGE = "EVENT_CHANGE"
@ -20,7 +19,7 @@ export class TextNode extends NodeButton {
const conf = super._defaultConfig(arguments); const conf = super._defaultConfig(arguments);
return extend(conf, { return extend(conf, {
baseCls: (conf.baseCls || "") + " bi-text-node", baseCls: `${conf.baseCls || ""} bi-text-node`,
textAlign: "left", textAlign: "left",
whiteSpace: "nowrap", whiteSpace: "nowrap",
textHgap: 0, textHgap: 0,
@ -58,16 +57,16 @@ export class TextNode extends NodeButton {
} }
doRedMark() { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
} }
unRedMark() { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
} }
setValue() { setValue() {
if (!this.isReadOnly()) { if (!this.isReadOnly()) {
this.text.setValue.apply(this.text, arguments); this.text.setValue(...arguments);
} }
} }
@ -76,7 +75,7 @@ export class TextNode extends NodeButton {
} }
setText() { setText() {
this.text.setText.apply(this.text, arguments); this.text.setText(...arguments);
} }
getText() { getText() {

66
src/case/button/icon/icon.change.js

@ -1,15 +1,25 @@
import { Single } from "../../../base/single/0.single";
import { IconButton } from "../../../base/single/button/buttons/button.icon";
import { shortcut, extend, emptyFn, isFunction, createWidget, Controller } from "../../../core";
/** /**
* 可以改变图标的button * 可以改变图标的button
* *
* Created by GUY on 2016/2/2. * Created by GUY on 2016/2/2.
* *
* @class BI.IconChangeButton * @class IconChangeButton
* @extends BI.Single * @extends Single
*/ */
BI.IconChangeButton = BI.inherit(BI.Single, { @shortcut()
_defaultConfig: function () { export class IconChangeButton extends Single {
var conf = BI.IconChangeButton.superclass._defaultConfig.apply(this, arguments); static xtype = "bi.icon_change_button";
return BI.extend(conf, { static EVENT_CHANGE = "EVENT_CHANGE";
_defaultConfig() {
const conf = super._defaultConfig(arguments);
return extend(conf, {
baseCls: "bi-icon-change-button", baseCls: "bi-icon-change-button",
iconCls: "", iconCls: "",
iconWidth: null, iconWidth: null,
@ -26,17 +36,17 @@ BI.IconChangeButton = BI.inherit(BI.Single, {
shadow: false, shadow: false,
isShadowShowingOnSelected: false, // 选中状态下是否显示阴影 isShadowShowingOnSelected: false, // 选中状态下是否显示阴影
trigger: null, trigger: null,
handler: BI.emptyFn handler: emptyFn,
}); });
}, }
_init: function () { _init() {
var self = this, o = this.options; const o = this.options;
o.iconCls = BI.isFunction(o.iconCls) ? this.__watch(o.iconCls, function (context, newValue) { o.iconCls = isFunction(o.iconCls) ? this.__watch(o.iconCls, (context, newValue) => {
self.setIcon(newValue); this.setIcon(newValue);
}) : o.iconCls; }) : o.iconCls;
BI.IconChangeButton.superclass._init.apply(this, arguments); super._init.apply(this, arguments);
this.button = BI.createWidget({ this.button = createWidget({
type: "bi.icon_button", type: "bi.icon_button",
element: this, element: this,
cls: o.iconCls, cls: o.iconCls,
@ -55,32 +65,30 @@ BI.IconChangeButton = BI.inherit(BI.Single, {
shadow: o.shadow, shadow: o.shadow,
isShadowShowingOnSelected: o.isShadowShowingOnSelected, isShadowShowingOnSelected: o.isShadowShowingOnSelected,
trigger: o.trigger, trigger: o.trigger,
handler: o.handler handler: o.handler,
}); });
this.button.on(BI.Controller.EVENT_CHANGE, function () { this.button.on(Controller.EVENT_CHANGE, (...args) => {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); this.fireEvent(Controller.EVENT_CHANGE, args);
}); });
this.button.on(BI.IconButton.EVENT_CHANGE, function () { this.button.on(IconButton.EVENT_CHANGE, (...args) => {
self.fireEvent(BI.IconChangeButton.EVENT_CHANGE, arguments); this.fireEvent(IconChangeButton.EVENT_CHANGE, args);
}); });
}, }
isSelected: function () { isSelected() {
return this.button.isSelected(); return this.button.isSelected();
}, }
setSelected: function (b) { setSelected(b) {
this.button.setSelected(b); this.button.setSelected(b);
}, }
setIcon: function (cls) { setIcon(cls) {
var o = this.options; const o = this.options;
if (o.iconCls !== cls) { if (o.iconCls !== cls) {
this.element.removeClass(o.iconCls).addClass(cls); this.element.removeClass(o.iconCls).addClass(cls);
o.iconCls = cls; o.iconCls = cls;
} }
} }
}); }
BI.IconChangeButton.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.icon_change_button", BI.IconChangeButton);

27
src/case/button/icon/icon.trigger.js

@ -1,19 +1,24 @@
import { IconButton } from "../../../base/single/button/buttons/button.icon";
import { shortcut, extend } from "../../../core";
/** /**
* 统一的trigger图标按钮 * 统一的trigger图标按钮
* *
* Created by GUY on 2015/9/16. * Created by GUY on 2015/9/16.
* @class BI.TriggerIconButton * @class TriggerIconButton
* @extends BI.IconButton * @extends IconButton
*/ */
BI.TriggerIconButton = BI.inherit(BI.IconButton, { @shortcut()
export class TriggerIconButton extends IconButton {
static xtype = "bi.trigger_icon_button";
EVENT_CHANGE = IconButton.EVENT_CHANGE;
_defaultConfig() {
const conf = super._defaultConfig(arguments);
_defaultConfig: function () { return extend(conf, {
var conf = BI.TriggerIconButton.superclass._defaultConfig.apply(this, arguments); baseCls: `${conf.baseCls || ""} bi-trigger-icon-button overflow-hidden`,
return BI.extend(conf, { extraCls: "pull-down-font",
baseCls: (conf.baseCls || "") + " bi-trigger-icon-button overflow-hidden",
extraCls: "pull-down-font"
}); });
} }
}); }
BI.TriggerIconButton.EVENT_CHANGE = BI.IconButton.EVENT_CHANGE;
BI.shortcut("bi.trigger_icon_button", BI.TriggerIconButton);

23
src/case/button/icon/iconhalf/icon.half.image.js

@ -1,21 +1,28 @@
import { IconButton } from "../../../../base/single/button/buttons/button.icon";
import { shortcut, extend } from "../../../../core";
/** /**
* guy * guy
* @extends BI.Single * @extends BI.Single
* @type {*|void|Object} * @type {*|void|Object}
*/ */
BI.HalfIconButton = BI.inherit(BI.IconButton, { @shortcut()
_defaultConfig: function () { export class HalfIconButton extends IconButton {
var conf = BI.HalfIconButton.superclass._defaultConfig.apply(this, arguments); static xtype = "bi.half_icon_button";
return BI.extend(conf, { static EVENT_CHANGE = IconButton.EVENT_CHANGE
_defaultConfig() {
const conf = super._defaultConfig(arguments);
return extend(conf, {
extraCls: "bi-half-icon-button check-half-select-icon", extraCls: "bi-half-icon-button check-half-select-icon",
height: 16, height: 16,
width: 16, width: 16,
iconWidth: 16, iconWidth: 16,
iconHeight: 16, iconHeight: 16,
selected: false selected: false,
}); });
} }
}); }
BI.HalfIconButton.EVENT_CHANGE = BI.IconButton.EVENT_CHANGE;
BI.shortcut("bi.half_icon_button", BI.HalfIconButton);

36
src/case/button/icon/iconhalf/icon.half.js

@ -1,22 +1,31 @@
import { BasicButton } from "../../../../base/single/button/button.basic";
import { shortcut, extend } from "../../../../core";
/** /**
* guy * guy
* @extends BI.Single * @extends BI.Single
* @type {*|void|Object} * @type {*|void|Object}
*/ */
BI.HalfButton = BI.inherit(BI.BasicButton, { @shortcut()
_defaultConfig: function () { export class HalfButton extends BasicButton {
var conf = BI.HalfIconButton.superclass._defaultConfig.apply(this, arguments); static xtype = "bi.half_button";
return BI.extend(conf, { static EVENT_CHANGE = "EVENT_CHANGE";
_defaultConfig() {
const conf = super._defaultConfig(arguments);
return extend(conf, {
selected: false, selected: false,
width: 14, width: 14,
height: 14, height: 14,
iconWidth: 14, iconWidth: 14,
iconHeight: 14, iconHeight: 14,
}); });
}, }
render() {
const o = this.options;
render: function () {
var o = this.options;
return { return {
type: "bi.center_adapt", type: "bi.center_adapt",
items: [{ items: [{
@ -26,15 +35,12 @@ BI.HalfButton = BI.inherit(BI.BasicButton, {
height: o.iconHeight, height: o.iconHeight,
}], }],
}; };
}, }
doClick: function () { doClick() {
BI.HalfButton.superclass.doClick.apply(this, arguments); super.doClick.apply(this, arguments);
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(BI.HalfButton.EVENT_CHANGE); this.fireEvent(HalfButton.EVENT_CHANGE);
} }
} }
}); }
BI.HalfButton.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.half_button", BI.HalfButton);

29
src/case/button/index.js

@ -0,0 +1,29 @@
export { MultiSelectItem } from "./item.multiselect";
export { SingleSelectIconTextItem } from "./item.singleselect.icontext";
export { SingleSelectItem } from "./item.singleselect";
export { SingleSelectRadioItem } from "./item.singleselect.radio";
export { Switch } from "./switch";
export { IconChangeButton } from "./icon/icon.change";
export { TriggerIconButton } from "./icon/icon.trigger";
export { HalfIconButton } from "./icon/iconhalf/icon.half.image";
export { HalfButton } from "./icon/iconhalf/icon.half";
export { ArrowNode } from "./node/node.arrow";
export { FirstPlusGroupNode } from "./node/node.first.plus";
export { IconArrowNode } from "./node/node.icon.arrow";
export { LastPlusGroupNode } from "./node/node.last.plus";
export { MidPlusGroupNode } from "./node/node.mid.plus";
export { MultiLayerIconArrowNode } from "./node/node.multilayer.icon.arrow";
export { PlusGroupNode } from "./node/node.plus";
export { TreeNodeSwitcher } from "./node/siwtcher.tree.node";
export { BasicTreeNode } from "./node/treenode";
export { FirstTreeLeafItem } from "./treeitem/item.first.treeleaf";
export { IconTreeLeafItem } from "./treeitem/item.icon.treeleaf";
export { LastTreeLeafItem } from "./treeitem/item.last.treeleaf";
export { MidTreeLeafItem } from "./treeitem/item.mid.treeleaf";
export { MultiLayerIconTreeLeafItem } from "./treeitem/item.multilayer.icon.treeleaf";
export { RootTreeLeafItem } from "./treeitem/item.root.treeleaf";
export { TreeTextLeafItem } from "./treeitem/item.treetextleaf";
export { BasicTreeItem } from "./treeitem/treeitem";

64
src/case/button/item.multiselect.js

@ -1,36 +1,45 @@
import { BasicButton } from "../../base/single/button/button.basic";
import { shortcut, extend, createWidget } from "../../core";
/** /**
* guy * guy
* 复选框item * 复选框item
* @type {*|void|Object} * @type {*|void|Object}
*/ */
BI.MultiSelectItem = BI.inherit(BI.BasicButton, { @shortcut()
_defaultConfig: function () { export class MultiSelectItem extends BasicButton {
return BI.extend(BI.MultiSelectItem.superclass._defaultConfig.apply(this, arguments), { static xtype = "bi.multi_select_item";
static EVENT_CHANGE = "EVENT_CHANGE";
_defaultConfig() {
return extend(super._defaultConfig(arguments), {
extraCls: "bi-multi-select-item", extraCls: "bi-multi-select-item",
attributes: { attributes: {
tabIndex: 1 tabIndex: 1,
}, },
height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
iconWrapperWidth: 26, iconWrapperWidth: 26,
}); });
}, }
render: function () { render() {
var self = this, o = this.options; const o = this.options;
this.checkbox = BI.createWidget({ this.checkbox = createWidget({
type: "bi.checkbox" type: "bi.checkbox",
}); });
return { return {
type: "bi.vertical_adapt", type: "bi.vertical_adapt",
columnSize: [o.iconWrapperWidth || o.height, "fill"], columnSize: [o.iconWrapperWidth || o.height, "fill"],
items: [{ items: [{
type: "bi.center_adapt", type: "bi.center_adapt",
items: [this.checkbox] items: [this.checkbox],
}, { }, {
el: { el: {
type: "bi.label", type: "bi.label",
ref: function (_ref) { ref: _ref => {
self.text = _ref; this.text = _ref;
}, },
cls: "list-item-text", cls: "list-item-text",
textAlign: "left", textAlign: "left",
@ -44,11 +53,11 @@ BI.MultiSelectItem = BI.inherit(BI.BasicButton, {
text: o.text, text: o.text,
keyword: o.keyword, keyword: o.keyword,
value: o.value, value: o.value,
py: o.py py: o.py,
}
}]
};
}, },
}],
};
}
// _setEnable: function (enable) { // _setEnable: function (enable) {
// BI.MultiSelectItem.superclass._setEnable.apply(this, arguments); // BI.MultiSelectItem.superclass._setEnable.apply(this, arguments);
@ -59,25 +68,24 @@ BI.MultiSelectItem = BI.inherit(BI.BasicButton, {
// } // }
// }, // },
doRedMark: function () { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
}, }
unRedMark: function () { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
}, }
doClick: function () { doClick() {
BI.MultiSelectItem.superclass.doClick.apply(this, arguments); BI.MultiSelectItem.superclass.doClick.apply(this, arguments);
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(BI.MultiSelectItem.EVENT_CHANGE, this.getValue(), this); this.fireEvent(BI.MultiSelectItem.EVENT_CHANGE, this.getValue(), this);
} }
}, }
setSelected: function (v) { setSelected(v) {
BI.MultiSelectItem.superclass.setSelected.apply(this, arguments); BI.MultiSelectItem.superclass.setSelected.apply(this, arguments);
this.checkbox.setSelected(v); this.checkbox.setSelected(v);
} }
}); }
BI.MultiSelectItem.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.multi_select_item", BI.MultiSelectItem);

60
src/case/button/item.singleselect.icontext.js

@ -1,24 +1,30 @@
import { Single } from "../../base/single/0.single";
import { shortcut, extend, createWidget, Controller } from "../../core";
/** /**
* Created by GUY on 2016/2/2. * Created by GUY on 2016/2/2.
* *
* @class BI.SingleSelectIconTextItem * @class BI.SingleSelectIconTextItem
* @extends BI.BasicButton * @extends BI.BasicButton
*/ */
BI.SingleSelectIconTextItem = BI.inherit(BI.Single, { @shortcut()
_defaultConfig: function () { export class SingleSelectIconTextItem extends Single {
return BI.extend(BI.SingleSelectIconTextItem.superclass._defaultConfig.apply(this, arguments), { static xtype = "bi.single_select_icon_text_item";
_defaultConfig() {
return extend(super._defaultConfig(arguments), {
extraCls: "bi-single-select-icon-text-item bi-list-item-active", extraCls: "bi-single-select-icon-text-item bi-list-item-active",
attributes: { attributes: {
tabIndex: 1 tabIndex: 1,
}, },
iconCls: "", iconCls: "",
height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
}); });
}, }
render: function () { render() {
var self = this, o = this.options; const o = this.options;
this.text = BI.createWidget({ this.text = createWidget({
type: "bi.icon_text_item", type: "bi.icon_text_item",
element: this, element: this,
cls: o.iconCls, cls: o.iconCls,
@ -35,37 +41,37 @@ BI.SingleSelectIconTextItem = BI.inherit(BI.Single, {
text: o.text, text: o.text,
keyword: o.keyword, keyword: o.keyword,
value: o.value, value: o.value,
py: o.py py: o.py,
}); });
this.text.on(BI.Controller.EVENT_CHANGE, function () { this.text.on(Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(Controller.EVENT_CHANGE, arguments);
}); });
}, }
_setEnable: function (enable) { _setEnable(enable) {
BI.SingleSelectIconTextItem.superclass._setEnable.apply(this, arguments); super._setEnable.apply(this, arguments);
if (enable === true) { if (enable === true) {
this.element.attr("tabIndex", 1); this.element.attr("tabIndex", 1);
} else if (enable === false) { } else if (enable === false) {
this.element.removeAttr("tabIndex"); this.element.removeAttr("tabIndex");
} }
}, }
isSelected: function () { isSelected() {
return this.text.isSelected(); return this.text.isSelected();
}, }
setSelected: function (b) { setSelected(b) {
this.text.setSelected(b); this.text.setSelected(b);
}, }
doRedMark: function () { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
}, }
unRedMark: function () { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
} }
}); }
BI.shortcut("bi.single_select_icon_text_item", BI.SingleSelectIconTextItem);

65
src/case/button/item.singleselect.js

@ -1,19 +1,26 @@
BI.SingleSelectItem = BI.inherit(BI.BasicButton, { import { BasicButton } from "../../base/single/button/button.basic";
_defaultConfig: function () { import { shortcut, extend, createWidget } from "../../core";
return BI.extend(BI.SingleSelectItem.superclass._defaultConfig.apply(this, arguments), {
@shortcut()
export class SingleSelectItem extends BasicButton {
static xtype = "bi.single_select_item";
static EVENT_CHANGE = "EVENT_CHANGE";
_defaultConfig() {
return extend(super._defaultConfig(arguments), {
extraCls: "bi-single-select-item bi-list-item-active", extraCls: "bi-single-select-item bi-list-item-active",
attributes: { attributes: {
tabIndex: 1 tabIndex: 1,
}, },
textHgap: 10, textHgap: 10,
height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
textAlign: "left" textAlign: "left",
}); });
}, }
render: function () { render() {
var self = this, o = this.options; const o = this.options;
this.text = BI.createWidget({ this.text = createWidget({
type: "bi.label", type: "bi.label",
element: this, element: this,
textAlign: o.textAlign, textAlign: o.textAlign,
@ -27,38 +34,38 @@ BI.SingleSelectItem = BI.inherit(BI.BasicButton, {
text: o.text, text: o.text,
keyword: o.keyword, keyword: o.keyword,
value: o.value, value: o.value,
py: o.py py: o.py,
}); });
}, }
_setEnable: function (enable) { _setEnable(enable) {
BI.SingleSelectItem.superclass._setEnable.apply(this, arguments); super._setEnable.apply(this, arguments);
if (enable === true) { if (enable === true) {
this.element.attr("tabIndex", 1); this.element.attr("tabIndex", 1);
} else if (enable === false) { } else if (enable === false) {
this.element.removeAttr("tabIndex"); this.element.removeAttr("tabIndex");
} }
}, }
doRedMark: function () { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
}, }
unRedMark: function () { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
}, }
doClick: function () { doClick() {
BI.SingleSelectItem.superclass.doClick.apply(this, arguments); super.doClick.apply(this, arguments);
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(BI.SingleSelectItem.EVENT_CHANGE, this.isSelected(), this); this.fireEvent(SingleSelectItem.EVENT_CHANGE, this.isSelected(), this);
}
} }
},
setSelected: function (v) { setSelected(v) {
BI.SingleSelectItem.superclass.setSelected.apply(this, arguments); super.setSelected.apply(this, arguments);
} }
}); }
BI.SingleSelectItem.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.single_select_item", BI.SingleSelectItem);

69
src/case/button/item.singleselect.radio.js

@ -1,23 +1,31 @@
import { BasicButton } from "../../base/single/button/button.basic";
import { shortcut, extend } from "../../core";
/** /**
* guy * guy
* 单选框item * 单选框item
* @type {*|void|Object} * @type {*|void|Object}
*/ */
BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, { @shortcut()
_defaultConfig: function () { export class SingleSelectRadioItem extends BasicButton {
return BI.extend(BI.SingleSelectRadioItem.superclass._defaultConfig.apply(this, arguments), { static xtype = "bi.single_select_radio_item";
static EVENT_CHANGE = "EVENT_CHANGE";
_defaultConfig() {
return extend(super._defaultConfig(arguments), {
extraCls: "bi-single-select-radio-item", extraCls: "bi-single-select-radio-item",
attributes: { attributes: {
tabIndex: 1 tabIndex: 1,
}, },
height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, height: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
iconWrapperWidth: 16, iconWrapperWidth: 16,
textHgap: 10, textHgap: 10,
}); });
}, }
render() {
const o = this.options;
render: function () {
var self = this, o = this.options;
return { return {
type: "bi.vertical_adapt", type: "bi.vertical_adapt",
columnSize: [o.iconWrapperWidth || o.height, "fill"], columnSize: [o.iconWrapperWidth || o.height, "fill"],
@ -25,15 +33,15 @@ BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, {
type: "bi.center_adapt", type: "bi.center_adapt",
items: [{ items: [{
type: "bi.radio", type: "bi.radio",
ref: function (_ref) { ref: _ref => {
self.radio = _ref; this.radio = _ref;
}, },
}] }],
}, { }, {
el: { el: {
type: "bi.label", type: "bi.label",
ref: function (_ref) { ref: _ref => {
self.text = _ref; this.text = _ref;
}, },
cls: "list-item-text", cls: "list-item-text",
textAlign: "left", textAlign: "left",
@ -47,42 +55,39 @@ BI.SingleSelectRadioItem = BI.inherit(BI.BasicButton, {
text: o.text, text: o.text,
keyword: o.keyword, keyword: o.keyword,
value: o.value, value: o.value,
py: o.py py: o.py,
}
}]
};
}, },
}],
};
}
_setEnable: function (enable) { _setEnable(enable) {
BI.SingleSelectRadioItem.superclass._setEnable.apply(this, arguments); super._setEnable.apply(this, arguments);
if (enable === true) { if (enable === true) {
this.element.attr("tabIndex", 1); this.element.attr("tabIndex", 1);
} else if (enable === false) { } else if (enable === false) {
this.element.removeAttr("tabIndex"); this.element.removeAttr("tabIndex");
} }
}, }
doRedMark: function () { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
}, }
unRedMark: function () { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
}, }
doClick: function () { doClick() {
BI.SingleSelectRadioItem.superclass.doClick.apply(this, arguments); BI.SingleSelectRadioItem.superclass.doClick.apply(this, arguments);
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(BI.SingleSelectRadioItem.EVENT_CHANGE, this.isSelected(), this); this.fireEvent(BI.SingleSelectRadioItem.EVENT_CHANGE, this.isSelected(), this);
} }
}, }
setSelected: function (v) { setSelected(v) {
BI.SingleSelectRadioItem.superclass.setSelected.apply(this, arguments); BI.SingleSelectRadioItem.superclass.setSelected.apply(this, arguments);
this.radio.setSelected(v); this.radio.setSelected(v);
} }
}); }
BI.SingleSelectRadioItem.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.single_select_radio_item", BI.SingleSelectRadioItem);

71
src/case/button/node/node.arrow.js

@ -1,34 +1,42 @@
import { NodeButton } from "../../../base/single/button/button.node";
import { shortcut, extend, createWidget } from "../../../core";
/** /**
* Created by roy on 15/10/16. * Created by roy on 15/10/16.
*/ */
BI.ArrowNode = BI.inherit(BI.NodeButton, { @shortcut()
_defaultConfig: function () { export class ArrowNode extends NodeButton {
var conf = BI.ArrowNode.superclass._defaultConfig.apply(this, arguments); static xtype = "bi.arrow_group_node";
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-arrow-group-node bi-list-item", _defaultConfig() {
const conf = super._defaultConfig(arguments);
return extend(conf, {
baseCls: `${conf.baseCls || ""} bi-arrow-group-node bi-list-item`,
id: "", id: "",
pId: "", pId: "",
open: false, open: false,
height: 24, height: 24,
iconWrapperWidth: 16 iconWrapperWidth: 16,
}); });
}, }
render: function () { render() {
var self = this, o = this.options; const o = this.options;
this.checkbox = BI.createWidget({ this.checkbox = createWidget({
type: "bi.arrow_group_node_checkbox", type: "bi.arrow_group_node_checkbox",
expandIcon: o.expandIcon, expandIcon: o.expandIcon,
collapseIcon: o.collapseIcon, collapseIcon: o.collapseIcon,
}); });
return { return {
type: "bi.vertical_adapt", type: "bi.vertical_adapt",
columnSize: [o.iconWrapperWidth || o.height, "fill"], columnSize: [o.iconWrapperWidth || o.height, "fill"],
items: [this.checkbox, { items: [this.checkbox, {
el: { el: {
type: "bi.label", type: "bi.label",
ref: function (_ref) { ref: _ref => {
self.text = _ref; this.text = _ref;
}, },
textAlign: "left", textAlign: "left",
whiteSpace: "nowrap", whiteSpace: "nowrap",
@ -41,34 +49,33 @@ BI.ArrowNode = BI.inherit(BI.NodeButton, {
text: o.text, text: o.text,
value: o.value, value: o.value,
py: o.py, py: o.py,
keyword: o.keyword keyword: o.keyword,
}
}]
};
}, },
}],
};
}
doRedMark: function () { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
}, }
unRedMark: function () { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
}, }
doClick: function () { doClick() {
BI.ArrowNode.superclass.doClick.apply(this, arguments); super.doClick.apply(this, arguments);
this.checkbox.setSelected(this.isOpened()); this.checkbox.setSelected(this.isOpened());
}, }
setText: function (text) { setText(text) {
BI.ArrowNode.superclass.setText.apply(this, arguments); super.setText.apply(this, arguments);
this.text.setText(text); this.text.setText(text);
}, }
setOpened: function (v) { setOpened(v) {
BI.ArrowNode.superclass.setOpened.apply(this, arguments); super.setOpened.apply(this, arguments);
this.checkbox.setSelected(v); this.checkbox.setSelected(v);
} }
}); }
BI.shortcut("bi.arrow_group_node", BI.ArrowNode);

82
src/case/button/node/node.first.plus.js

@ -1,33 +1,42 @@
import { NodeButton } from "../../../base/single/button/button.node";
import { shortcut, extend, createWidget, Controller } from "../../../core";
/** /**
* 加号表示的组节点 * 加号表示的组节点
* Created by GUY on 2015/9/6. * Created by GUY on 2015/9/6.
* @class BI.FirstPlusGroupNode * @class FirstPlusGroupNode
* @extends BI.NodeButton * @extends NodeButton
*/ */
BI.FirstPlusGroupNode = BI.inherit(BI.NodeButton, { @shortcut()
_defaultConfig: function () { export class FirstPlusGroupNode extends NodeButton {
var conf = BI.FirstPlusGroupNode.superclass._defaultConfig.apply(this, arguments); static xtype = "bi.first_plus_group_node";
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-first-plus-group-node bi-list-item", _defaultConfig() {
const conf = super._defaultConfig(arguments);
return extend(conf, {
baseCls: `${conf.baseCls || ""} bi-first-plus-group-node bi-list-item`,
logic: { logic: {
dynamic: false dynamic: false,
}, },
id: "", id: "",
pId: "", pId: "",
open: false, open: false,
height: 24 height: 24,
}); });
}, }
_init: function () {
BI.FirstPlusGroupNode.superclass._init.apply(this, arguments); _init() {
var self = this, o = this.options; super._init.apply(this, arguments);
this.checkbox = BI.createWidget({ const o = this.options;
this.checkbox = createWidget({
type: "bi.first_tree_node_checkbox", type: "bi.first_tree_node_checkbox",
stopPropagation: true, stopPropagation: true,
iconHeight: o.height, iconHeight: o.height,
iconWidth: o.height iconWidth: o.height,
}); });
this.text = BI.createWidget({ this.text = createWidget({
type: "bi.label", type: "bi.label",
textAlign: "left", textAlign: "left",
whiteSpace: "nowrap", whiteSpace: "nowrap",
@ -37,9 +46,9 @@ BI.FirstPlusGroupNode = BI.inherit(BI.NodeButton, {
text: o.text, text: o.text,
value: o.value, value: o.value,
py: o.py, py: o.py,
keyword: o.keyword keyword: o.keyword,
}); });
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { this.checkbox.on(Controller.EVENT_CHANGE, function (type) {
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
if (this.isSelected()) { if (this.isSelected()) {
self.triggerExpand(); self.triggerExpand();
@ -48,37 +57,36 @@ BI.FirstPlusGroupNode = BI.inherit(BI.NodeButton, {
} }
} }
}); });
var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); const type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left);
var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { const items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, {
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
el: this.checkbox el: this.checkbox,
}, this.text); }, this.text);
BI.createWidget(BI.extend({ BI.createWidget(BI.extend({
element: this element: this,
}, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { }, BI.LogicFactory.createLogic(type, BI.extend(o.logic, {
items: items items,
})))); }))));
}, }
doRedMark: function () { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
}, }
unRedMark: function () { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
}, }
doClick: function () { doClick() {
BI.FirstPlusGroupNode.superclass.doClick.apply(this, arguments); super.doClick.apply(this, arguments);
this.checkbox.setSelected(this.isSelected()); this.checkbox.setSelected(this.isSelected());
}, }
setOpened: function (v) { setOpened(v) {
BI.FirstPlusGroupNode.superclass.setOpened.apply(this, arguments); super.setOpened.apply(this, arguments);
if (BI.isNotNull(this.checkbox)) { if (BI.isNotNull(this.checkbox)) {
this.checkbox.setSelected(v); this.checkbox.setSelected(v);
} }
} }
}); }
BI.shortcut("bi.first_plus_group_node", BI.FirstPlusGroupNode);

99
src/case/button/node/node.icon.arrow.js

@ -1,18 +1,24 @@
import { NodeButton } from "../../../base/single/button/button.node";
import { shortcut, extend, createWidget, Controller } from "../../../core";
/** /**
* Created by User on 2016/3/31. * Created by User on 2016/3/31.
*/ *
/**
* > + icon + 文本 * > + icon + 文本
* @class BI.IconArrowNode * @class IconArrowNode
* @extends BI.NodeButton * @extends NodeButton
*/ */
BI.IconArrowNode = BI.inherit(BI.NodeButton, { @shortcut()
_defaultConfig: function () { export class IconArrowNode extends NodeButton {
var conf = BI.IconArrowNode.superclass._defaultConfig.apply(this, arguments); static xtype = "bi.icon_arrow_node";
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-icon-arrow-node bi-list-item", _defaultConfig() {
const conf = super._defaultConfig(arguments);
return extend(conf, {
baseCls: `${conf.baseCls || ""} bi-icon-arrow-node bi-list-item`,
logic: { logic: {
dynamic: false dynamic: false,
}, },
id: "", id: "",
pId: "", pId: "",
@ -21,29 +27,30 @@ BI.IconArrowNode = BI.inherit(BI.NodeButton, {
iconHeight: 12, iconHeight: 12,
iconWidth: 12, iconWidth: 12,
iconCls: "", iconCls: "",
iconWrapperWidth: 16 iconWrapperWidth: 16,
}); });
}, }
_init: function () {
BI.IconArrowNode.superclass._init.apply(this, arguments); _init() {
var self = this, o = this.options; super._init.apply(this, arguments);
this.checkbox = BI.createWidget({ const o = this.options;
this.checkbox = createWidget({
type: "bi.arrow_group_node_checkbox", type: "bi.arrow_group_node_checkbox",
expandIcon: o.expandIcon, expandIcon: o.expandIcon,
collapseIcon: o.collapseIcon, collapseIcon: o.collapseIcon,
width: 24, width: 24,
stopPropagation: true stopPropagation: true,
}); });
var icon = BI.createWidget({ const icon = createWidget({
type: "bi.icon_label", type: "bi.icon_label",
width: 24, width: 24,
cls: o.iconCls, cls: o.iconCls,
iconWidth: o.iconWidth, iconWidth: o.iconWidth,
iconHeight: o.iconHeight iconHeight: o.iconHeight,
}); });
this.text = BI.createWidget({ createWidget({
type: "bi.label", type: "bi.label",
textAlign: "left", textAlign: "left",
whiteSpace: "nowrap", whiteSpace: "nowrap",
@ -53,52 +60,50 @@ BI.IconArrowNode = BI.inherit(BI.NodeButton, {
text: o.text, text: o.text,
value: o.value, value: o.value,
py: o.py, py: o.py,
keyword: o.keyword keyword: o.keyword,
}); });
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { this.checkbox.on(Controller.EVENT_CHANGE, type => {
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
if (this.isSelected()) { if (this.checkbox.isSelected()) {
self.triggerExpand(); this.triggerExpand();
} else { } else {
self.triggerCollapse(); this.triggerCollapse();
} }
} }
}); });
var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); const type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left);
var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { const items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, {
width: o.iconWrapperWidth, width: o.iconWrapperWidth,
el: this.checkbox el: this.checkbox,
}, { }, {
width: 16, width: 16,
el: icon el: icon,
}, this.text); }, this.text);
BI.createWidget(BI.extend({ createWidget(extend({
element: this element: this,
}, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { }, BI.LogicFactory.createLogic(type, extend(o.logic, {
items: items, items,
rgap: 5 rgap: 5,
})))); }))));
}, }
doRedMark: function () { doRedMark () {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
}, }
unRedMark: function () { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
}, }
doClick: function () { doClick() {
BI.IconArrowNode.superclass.doClick.apply(this, arguments); BI.IconArrowNode.superclass.doClick.apply(this, arguments);
this.checkbox.setSelected(this.isSelected()); this.checkbox.setSelected(this.isSelected());
}, }
setOpened: function (v) { setOpened(v) {
BI.IconArrowNode.superclass.setOpened.apply(this, arguments); BI.IconArrowNode.superclass.setOpened.apply(this, arguments);
if (BI.isNotNull(this.checkbox)) { if (BI.isNotNull(this.checkbox)) {
this.checkbox.setSelected(v); this.checkbox.setSelected(v);
} }
} }
}); }
BI.shortcut("bi.icon_arrow_node", BI.IconArrowNode);

93
src/case/button/node/node.last.plus.js

@ -1,33 +1,40 @@
import { NodeButton } from "../../../base/single/button/button.node";
import { shortcut, extend, createWidget, isNotNull } from "../../../core";
/** /**
* 加号表示的组节点 * 加号表示的组节点
* Created by GUY on 2015/9/6. * Created by GUY on 2015/9/6.
* @class BI.LastPlusGroupNode * @class LastPlusGroupNode
* @extends BI.NodeButton * @extends NodeButton
*/ */
BI.LastPlusGroupNode = BI.inherit(BI.NodeButton, { @shortcut()
_defaultConfig: function () { export class LastPlusGroupNode extends NodeButton {
var conf = BI.LastPlusGroupNode.superclass._defaultConfig.apply(this, arguments); static xtype = "bi.last_plus_group_node";
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-last-plus-group-node bi-list-item", _defaultConfig() {
const conf = super._defaultConfig(arguments);
return extend(conf, {
baseCls: `${conf.baseCls || ""} bi-last-plus-group-node bi-list-item`,
logic: { logic: {
dynamic: false dynamic: false,
}, },
id: "", id: "",
pId: "", pId: "",
open: false, open: false,
height: 24 height: 24,
}); });
}, }
_init: function () { _init() {
BI.LastPlusGroupNode.superclass._init.apply(this, arguments); BI.LastPlusGroupNode.superclass._init.apply(this, arguments);
var self = this, o = this.options; const o = this.options;
this.checkbox = BI.createWidget({ this.checkbox = createWidget({
type: "bi.last_tree_node_checkbox", type: "bi.last_tree_node_checkbox",
stopPropagation: true, stopPropagation: true,
iconHeight: o.height, iconHeight: o.height,
iconWidth: o.height iconWidth: o.height,
}); });
this.text = BI.createWidget({ this.text = createWidget({
type: "bi.label", type: "bi.label",
textAlign: "left", textAlign: "left",
whiteSpace: "nowrap", whiteSpace: "nowrap",
@ -37,48 +44,46 @@ BI.LastPlusGroupNode = BI.inherit(BI.NodeButton, {
text: o.text, text: o.text,
value: o.value, value: o.value,
py: o.py, py: o.py,
keyword: o.keyword keyword: o.keyword,
}); });
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { this.checkbox.on(BI.Controller.EVENT_CHANGE, type => {
if(type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
if (this.isSelected()) { if (this.checkbox.isSelected()) {
self.triggerExpand(); this.triggerExpand();
} else { } else {
self.triggerCollapse(); this.triggerCollapse();
} }
} }
}); });
var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); const type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left);
var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { const items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, {
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
el: this.checkbox el: this.checkbox,
}, this.text); }, this.text);
BI.createWidget(BI.extend({ createWidget(extend({
element: this element: this,
}, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { }, BI.LogicFactory.createLogic(type, extend(o.logic, {
items: items items,
})))); }))));
}, }
doRedMark: function () { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
}, }
unRedMark: function () { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
}, }
doClick: function () { doClick() {
BI.LastPlusGroupNode.superclass.doClick.apply(this, arguments); super.doClick.apply(this, arguments);
this.checkbox.setSelected(this.isSelected()); this.checkbox.setSelected(this.isSelected());
}, }
setOpened: function (v) { setOpened(v) {
BI.LastPlusGroupNode.superclass.setOpened.apply(this, arguments); super.setOpened.apply(this, arguments);
if (BI.isNotNull(this.checkbox)) { if (isNotNull(this.checkbox)) {
this.checkbox.setSelected(v); this.checkbox.setSelected(v);
} }
} }
}); }
BI.shortcut("bi.last_plus_group_node", BI.LastPlusGroupNode);

85
src/case/button/node/node.mid.plus.js

@ -1,33 +1,41 @@
import { NodeButton } from "../../../base/single/button/button.node";
import { shortcut, extend, createWidget, Controller } from "../../../core";
/** /**
* 加号表示的组节点 * 加号表示的组节点
* Created by GUY on 2015/9/6. * Created by GUY on 2015/9/6.
* @class BI.MidPlusGroupNode * @class BI.MidPlusGroupNode
* @extends BI.NodeButton * @extends BI.NodeButton
*/ */
BI.MidPlusGroupNode = BI.inherit(BI.NodeButton, { @shortcut
_defaultConfig: function () { export class MidPlusGroupNode extends NodeButton {
var conf = BI.MidPlusGroupNode.superclass._defaultConfig.apply(this, arguments); static xtype = "bi.mid_plus_group_node";
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-mid-plus-group-node bi-list-item", _defaultConfig() {
const conf = super._defaultConfig(arguments);
return extend(conf, {
baseCls: `${conf.baseCls || ""} bi-mid-plus-group-node bi-list-item`,
logic: { logic: {
dynamic: false dynamic: false,
}, },
id: "", id: "",
pId: "", pId: "",
open: false, open: false,
height: 24 height: 24,
}); });
}, }
_init: function () {
BI.MidPlusGroupNode.superclass._init.apply(this, arguments); _init() {
var self = this, o = this.options; super._init.apply(this, arguments);
this.checkbox = BI.createWidget({ const o = this.options;
this.checkbox = createWidget({
type: "bi.mid_tree_node_checkbox", type: "bi.mid_tree_node_checkbox",
stopPropagation: true, stopPropagation: true,
iconHeight: o.height, iconHeight: o.height,
iconWidth: o.height iconWidth: o.height,
}); });
this.text = BI.createWidget({ this.text = createWidget({
type: "bi.label", type: "bi.label",
textAlign: "left", textAlign: "left",
whiteSpace: "nowrap", whiteSpace: "nowrap",
@ -37,48 +45,47 @@ BI.MidPlusGroupNode = BI.inherit(BI.NodeButton, {
text: o.text, text: o.text,
value: o.value, value: o.value,
py: o.py, py: o.py,
keyword: o.keyword keyword: o.keyword,
}); });
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { this.checkbox.on(Controller.EVENT_CHANGE, type => {
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
if (this.isSelected()) { if (this.checkbox.isSelected()) {
self.triggerExpand(); this.triggerExpand();
} else { } else {
self.triggerCollapse(); this.triggerCollapse();
} }
} }
}); });
var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); const type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left);
var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { const items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, {
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
el: this.checkbox el: this.checkbox,
}, this.text); }, this.text);
BI.createWidget(BI.extend({ createWidget(extend({
element: this element: this,
}, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { }, BI.LogicFactory.createLogic(type, extend(o.logic, {
items: items items,
})))); }))));
}, }
doRedMark: function () { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
}, }
unRedMark: function () { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
}, }
doClick: function () { doClick() {
BI.MidPlusGroupNode.superclass.doClick.apply(this, arguments); super.doClick.apply(this, arguments);
this.checkbox.setSelected(this.isSelected()); this.checkbox.setSelected(this.isSelected());
}, }
setOpened: function (v) { setOpened(v) {
BI.MidPlusGroupNode.superclass.setOpened.apply(this, arguments); BI.MidPlusGroupNode.superclass.setOpened.apply(this, arguments);
if (BI.isNotNull(this.checkbox)) { if (BI.isNotNull(this.checkbox)) {
this.checkbox.setSelected(v); this.checkbox.setSelected(v);
} }
} }
}); }
BI.shortcut("bi.mid_plus_group_node", BI.MidPlusGroupNode);

88
src/case/button/node/node.multilayer.icon.arrow.js

@ -1,7 +1,14 @@
BI.MultiLayerIconArrowNode = BI.inherit(BI.NodeButton, { import { NodeButton } from "../../../base/single/button/button.node";
_defaultConfig: function () { import { shortcut, extend, createWidget, Controller, count } from "../../../core";
var conf = BI.MultiLayerIconArrowNode.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { @shortcut()
export class MultiLayerIconArrowNode extends NodeButton {
static xtype = "bi.multilayer_icon_arrow_node";
_defaultConfig() {
const conf = super._defaultConfig(arguments);
return extend(conf, {
extraCls: "bi-multilayer-icon-arrow-node bi-list-item", extraCls: "bi-multilayer-icon-arrow-node bi-list-item",
layer: 0, // 第几层级 layer: 0, // 第几层级
id: "", id: "",
@ -10,13 +17,14 @@ BI.MultiLayerIconArrowNode = BI.inherit(BI.NodeButton, {
height: 24, height: 24,
iconHeight: 16, iconHeight: 16,
iconWidth: 16, iconWidth: 16,
iconCls: "" iconCls: "",
}); });
}, }
_init: function () {
BI.MultiLayerIconArrowNode.superclass._init.apply(this, arguments); _init() {
var self = this, o = this.options; super._init.apply(this, arguments);
this.node = BI.createWidget({ const o = this.options;
this.node = createWidget({
type: "bi.icon_arrow_node", type: "bi.icon_arrow_node",
iconCls: o.iconCls, iconCls: o.iconCls,
cls: "bi-list-item-none", cls: "bi-list-item-none",
@ -30,60 +38,58 @@ BI.MultiLayerIconArrowNode = BI.inherit(BI.NodeButton, {
text: o.text, text: o.text,
value: o.value, value: o.value,
py: o.py, py: o.py,
keyword: o.keyword keyword: o.keyword,
}); });
this.node.on(BI.Controller.EVENT_CHANGE, function (type) { this.node.on(Controller.EVENT_CHANGE, (...args) => {
self.setSelected(self.isSelected()); this.setSelected(this.isSelected());
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); this.fireEvent(Controller.EVENT_CHANGE, args);
}); });
var items = []; const items = [];
BI.count(0, o.layer, function () { count(0, o.layer, () => {
items.push({ items.push({
type: "bi.layout", type: "bi.layout",
width: 15, width: 15,
height: o.height height: o.height,
}); });
}); });
items.push(this.node); items.push(this.node);
BI.createWidget({ createWidget({
type: "bi.horizontal_adapt", type: "bi.horizontal_adapt",
element: this, element: this,
columnSize: BI.makeArray(o.layer, 15), columnSize: BI.makeArray(o.layer, 15),
items: items items,
}); });
}, }
isOnce: function () { isOnce() {
return true; return true;
}, }
doRedMark: function () { doRedMark() {
this.node.doRedMark.apply(this.node, arguments); this.node.doRedMark(...arguments);
}, }
unRedMark: function () { unRedMark() {
this.node.unRedMark.apply(this.node, arguments); this.node.unRedMark(...arguments);
}, }
isSelected: function () { isSelected() {
return this.node.isSelected(); return this.node.isSelected();
}, }
setSelected: function (b) { setSelected(b) {
BI.MultiLayerIconArrowNode.superclass.setSelected.apply(this, arguments); super.setSelected.apply(this, arguments);
this.node.setSelected(b); this.node.setSelected(b);
}, }
doClick: function () { doClick() {
BI.NodeButton.superclass.doClick.apply(this, arguments); super.doClick.apply(this, arguments);
this.node.setSelected(this.isSelected()); this.node.setSelected(this.isSelected());
}, }
setOpened: function (v) { setOpened(v) {
BI.MultiLayerIconArrowNode.superclass.setOpened.apply(this, arguments); super.setOpened.apply(this, arguments);
this.node.setOpened(v); this.node.setOpened(v);
} }
}); }
BI.shortcut("bi.multilayer_icon_arrow_node", BI.MultiLayerIconArrowNode);

79
src/case/button/node/node.plus.js

@ -1,42 +1,51 @@
import { NodeButton } from "../../../base/single/button/button.node";
import { shortcut, extend, createWidget, Controller } from "../../../core";
/** /**
* 加号表示的组节点 * 加号表示的组节点
* Created by GUY on 2015/9/6. * Created by GUY on 2015/9/6.
* @class BI.PlusGroupNode * @class PlusGroupNode
* @extends BI.NodeButton * @extends NodeButton
*/ */
BI.PlusGroupNode = BI.inherit(BI.NodeButton, { @shortcut()
_defaultConfig: function () { export class PlusGroupNode extends NodeButton {
var conf = BI.PlusGroupNode.superclass._defaultConfig.apply(this, arguments); static xtype = "bi.plus_group_node";
return BI.extend(conf, {
baseCls: (conf.baseCls || "") + " bi-plus-group-node bi-list-item", _defaultConfig() {
const conf = super._defaultConfig(arguments);
return extend(conf, {
baseCls: `${conf.baseCls || ""} bi-plus-group-node bi-list-item`,
id: "", id: "",
pId: "", pId: "",
open: false, open: false,
height: 24 height: 24,
}); });
}, }
render: function () { render() {
var self = this, o = this.options; const o = this.options;
this.checkbox = BI.createWidget({ this.checkbox = createWidget({
type: "bi.tree_node_checkbox", type: "bi.tree_node_checkbox",
iconHeight: o.height, iconHeight: o.height,
iconWidth: o.iconWrapperWidth || o.height iconWidth: o.iconWrapperWidth || o.height,
}); });
this.checkbox.on(BI.Controller.EVENT_CHANGE, function (type) { this.checkbox.on(Controller.EVENT_CHANGE, (...args) => {
const [type] = args;
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
self.setSelected(self.isSelected()); this.setSelected(this.isSelected());
} }
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); this.fireEvent(Controller.EVENT_CHANGE, args);
}); });
return { return {
type: "bi.vertical_adapt", type: "bi.vertical_adapt",
columnSize: [o.iconWrapperWidth || o.height, "fill"], columnSize: [o.iconWrapperWidth || o.height, "fill"],
items: [this.checkbox, { items: [this.checkbox, {
el: { el: {
type: "bi.label", type: "bi.label",
ref: function (_ref) { ref: _ref => {
self.text = _ref; this.text = _ref;
}, },
textAlign: "left", textAlign: "left",
whiteSpace: "nowrap", whiteSpace: "nowrap",
@ -49,31 +58,29 @@ BI.PlusGroupNode = BI.inherit(BI.NodeButton, {
text: o.text, text: o.text,
value: o.value, value: o.value,
keyword: o.keyword, keyword: o.keyword,
py: o.py py: o.py,
}
}]
};
}, },
}],
};
}
doRedMark: function () { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
}, }
unRedMark: function () { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
}, }
doClick: function () { doClick() {
BI.PlusGroupNode.superclass.doClick.apply(this, arguments); super.doClick.apply(this, arguments);
this.checkbox.setSelected(this.isSelected()); this.checkbox.setSelected(this.isSelected());
}, }
setOpened: function (v) { setOpened(v) {
BI.PlusGroupNode.superclass.setOpened.apply(this, arguments); super.setOpened.apply(this, arguments);
if (this.checkbox) { if (this.checkbox) {
this.checkbox.setSelected(v); this.checkbox.setSelected(v);
} }
} }
}); }
BI.shortcut("bi.plus_group_node", BI.PlusGroupNode);

45
src/case/button/node/siwtcher.tree.node.js

@ -1,17 +1,23 @@
BI.TreeNodeSwitcher = BI.inherit(BI.NodeButton, { import { NodeButton } from "../../../base/single/button/button.node";
_defaultConfig: function () { import { shortcut, extend } from "../../../core";
return BI.extend(BI.TreeNodeSwitcher.superclass._defaultConfig.apply(this, arguments), {
@shortcut()
export class TreeNodeSwitcher extends NodeButton {
static xtype = "bi.tree_node_switcher";
static EVENT_CHANGE = "EVENT_CHANGE";
_defaultConfig() {
return extend(super._defaultConfig(arguments), {
baseCls: "bi-tree-node-switcher", baseCls: "bi-tree-node-switcher",
iconWidth: 24, iconWidth: 24,
iconHeight: 24, iconHeight: 24,
isFirstNode: false, isFirstNode: false,
isLastNode: false, isLastNode: false,
layer: 0 layer: 0,
}); });
}, }
render: function () {
render() {
const [collapse, expand] = this.getIconCls(); const [collapse, expand] = this.getIconCls();
return { return {
@ -20,10 +26,10 @@ BI.TreeNodeSwitcher = BI.inherit(BI.NodeButton, {
iconHeight: this.options.iconHeight, iconHeight: this.options.iconHeight,
cls: this.options.open ? expand : collapse, cls: this.options.open ? expand : collapse,
}; };
}, }
getIconCls: function () { getIconCls() {
var options = this.options; const options = this.options;
if (options.layer === 0 && options.isFirstNode && options.isLastNode) { if (options.layer === 0 && options.isFirstNode && options.isLastNode) {
// 只有一层,并且是第一个节点,并且是最后一个节点 // 只有一层,并且是第一个节点,并且是最后一个节点
return BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? ["tree-solid-collapse-icon-type1", "tree-solid-expand-icon-type1"] : ["tree-collapse-icon-type1", "tree-expand-icon-type1"]; return BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? ["tree-solid-collapse-icon-type1", "tree-solid-expand-icon-type1"] : ["tree-collapse-icon-type1", "tree-expand-icon-type1"];
@ -37,23 +43,20 @@ BI.TreeNodeSwitcher = BI.inherit(BI.NodeButton, {
// 其他情况 // 其他情况
return BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? ["tree-solid-collapse-icon-type1", "tree-solid-expand-icon-type1"] : ["tree-collapse-icon-type3", "tree-expand-icon-type3"]; return BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? ["tree-solid-collapse-icon-type1", "tree-solid-expand-icon-type1"] : ["tree-collapse-icon-type3", "tree-expand-icon-type3"];
} }
}, }
setOpened: function (b) { setOpened(b) {
BI.TreeNodeSwitcher.superclass.setOpened.apply(this, arguments); super.setOpened.apply(this, arguments);
const [collapse, expand] = this.getIconCls(); const [collapse, expand] = this.getIconCls();
if (b) { if (b) {
this.element.addClass(expand).removeClass(collapse); this.element.addClass(expand).removeClass(collapse);
} else { } else {
this.element.addClass(collapse).removeClass(expand); this.element.addClass(collapse).removeClass(expand);
} }
},
doClick: function () {
BI.TreeNodeSwitcher.superclass.doClick.apply(this, arguments);
this.fireEvent(BI.TreeNodeSwitcher.EVENT_CHANGE, this);
} }
});
BI.TreeNodeSwitcher.EVENT_CHANGE = "EVENT_CHANGE"; doClick() {
BI.shortcut("bi.tree_node_switcher", BI.TreeNodeSwitcher); super.doClick.apply(this, arguments);
this.fireEvent(TreeNodeSwitcher.EVENT_CHANGE, this);
}
}

77
src/case/button/node/treenode.js

@ -1,8 +1,15 @@
BI.BasicTreeNode = BI.inherit(BI.NodeButton, { import { NodeButton } from "../../../base/single/button/button.node";
_defaultConfig: function (props) { import { shortcut, extend } from "../../../core";
var conf = BI.BasicTreeNode.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { @shortcut()
baseCls: (conf.baseCls || "") + " bi-tree-node " + (props.selectable ? "bi-list-item-active" : "bi-list-item"), export class BasicTreeNode extends NodeButton {
static xtype = "bi.tree_node";
_defaultConfig(props) {
const conf = super._defaultConfig.apply(this, arguments);
return extend(conf, {
baseCls: `${conf.baseCls || ""} bi-tree-node ${props.selectable ? "bi-list-item-active" : "bi-list-item"}`,
id: "", id: "",
pId: "", pId: "",
open: false, open: false,
@ -14,15 +21,15 @@ BI.BasicTreeNode = BI.inherit(BI.NodeButton, {
selectable: true, selectable: true,
disabled: false, // disabled不会影响展开收起功能 disabled: false, // disabled不会影响展开收起功能
}); });
}, }
render: function () { render() {
var self = this, o = this.options; const o = this.options;
const checkbox = { const checkbox = {
type: "bi.tree_node_switcher", type: "bi.tree_node_switcher",
__ref: function (_ref) { __ref: _ref => {
self.switcher = _ref; this.switcher = _ref;
}, },
iconHeight: o.height, iconHeight: o.height,
iconWidth: o.iconWrapperWidth || o.height, iconWidth: o.iconWrapperWidth || o.height,
@ -32,7 +39,7 @@ BI.BasicTreeNode = BI.inherit(BI.NodeButton, {
layer: o.layer, layer: o.layer,
...o.switcherIcon, ...o.switcherIcon,
stopPropagation: o.selectable, stopPropagation: o.selectable,
mounted: function () { mounted () {
this.setEnable(true); this.setEnable(true);
}, },
listeners: [ listeners: [
@ -42,9 +49,9 @@ BI.BasicTreeNode = BI.inherit(BI.NodeButton, {
if (!this.isEnabled() || o.selectable) { if (!this.isEnabled() || o.selectable) {
this.isOpened() ? this.triggerCollapse() : this.triggerExpand(); this.isOpened() ? this.triggerCollapse() : this.triggerExpand();
} }
},
} }
} ],
]
}; };
return { return {
@ -57,8 +64,8 @@ BI.BasicTreeNode = BI.inherit(BI.NodeButton, {
}, { }, {
el: { el: {
type: "bi.label", type: "bi.label",
ref: function (_ref) { ref: _ref => {
self.text = _ref; this.text = _ref;
}, },
textAlign: "left", textAlign: "left",
whiteSpace: "nowrap", whiteSpace: "nowrap",
@ -71,36 +78,36 @@ BI.BasicTreeNode = BI.inherit(BI.NodeButton, {
text: o.text, text: o.text,
value: o.value, value: o.value,
keyword: o.keyword, keyword: o.keyword,
py: o.py py: o.py,
} },
} }
] ],
}; };
}, }
doRedMark: function () { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
}, }
unRedMark: function () { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
}, }
doClick: function () { doClick() {
if (this.options.selectable) { if (this.options.selectable) {
return; return;
} }
BI.BasicTreeNode.superclass.doClick.apply(this, arguments); super.doClick.apply(this, arguments);
}, }
setOpened: function (v) { setOpened(v) {
BI.BasicTreeNode.superclass.setOpened.apply(this, arguments); super.setOpened.apply(this, arguments);
this.switcher.setOpened(v); this.switcher.setOpened(v);
}, }
setValue: function () { setValue() {
BI.BasicTreeNode.superclass.setValue.apply(this, arguments); super.setValue.apply(this, arguments);
} }
}); }
BI.shortcut("bi.tree_node", BI.BasicTreeNode);

85
src/case/button/switch.js

@ -1,84 +1,95 @@
/** /**
* Created by Windy on 2018/2/1. * Created by Windy on 2018/2/1.
*/ */
BI.Switch = BI.inherit(BI.BasicButton, {
constants: { import { BasicButton } from "../../base/single/button/button.basic";
CIRCLE_SIZE: 12 import { shortcut } from "../../core";
},
@shortcut()
export class Switch extends BasicButton {
static xtype = "bi.switch";
static EVENT_CHANGE = "EVENT_CHANGE";
props: { constants = {
CIRCLE_SIZE: 12,
};
props = {
extraCls: "bi-switch", extraCls: "bi-switch",
attributes: { attributes: {
tabIndex: 1 tabIndex: 1,
}, },
height: 20, height: 20,
width: 44, width: 44,
showTip: false showTip: false,
}, };
render() {
const o = this.options,
c = this.constants;
const tgap = (o.height - c.CIRCLE_SIZE) / 2;
render: function () {
var self = this, o = this.options, c = this.constants;
var tgap = (o.height - c.CIRCLE_SIZE) / 2;
return { return {
type: "bi.absolute", type: "bi.absolute",
ref: function () { ref: _ref => {
self.layout = this; this.layout = _ref;
}, },
items: [{ items: [
{
el: { el: {
type: "bi.text_button", type: "bi.text_button",
cls: "circle-button" cls: "circle-button",
}, },
width: 12, width: 12,
height: 12, height: 12,
top: tgap, top: tgap,
left: o.selected ? 28 : 4 left: o.selected ? 28 : 4,
}, { },
{
type: "bi.label", type: "bi.label",
text: BI.i18nText("BI-Basic_Simple_Open"), text: BI.i18nText("BI-Basic_Simple_Open"),
cls: "content-tip", cls: "content-tip",
left: 8, left: 8,
top: tgap - 2, top: tgap - 2,
invisible: !(o.showTip && o.selected), invisible: !(o.showTip && o.selected),
ref: function (ref) { ref: _ref => {
self.openTip = ref; this.openTip = _ref;
} },
}, { },
{
type: "bi.label", type: "bi.label",
text: BI.i18nText("BI-Basic_Simple_Close"), text: BI.i18nText("BI-Basic_Simple_Close"),
cls: "content-tip", cls: "content-tip",
right: 8, right: 8,
top: tgap - 2, top: tgap - 2,
invisible: !(o.showTip && !o.selected), invisible: !(o.showTip && !o.selected),
ref: function (ref) { ref: _ref => {
self.closeTip = ref; this.closeTip = _ref;
},
} }
}] ],
}; };
}, }
_setEnable: function (enable) { _setEnable(enable) {
BI.Switch.superclass._setEnable.apply(this, arguments); super._setEnable.apply(this, arguments);
if (enable === true) { if (enable === true) {
this.element.attr("tabIndex", 1); this.element.attr("tabIndex", 1);
} else if (enable === false) { } else if (enable === false) {
this.element.removeAttr("tabIndex"); this.element.removeAttr("tabIndex");
} }
}, }
setSelected: function (v) { setSelected(v) {
BI.Switch.superclass.setSelected.apply(this, arguments); super.setSelected.apply(this, arguments);
this.layout.attr("items")[0].left = v ? 28 : 4; this.layout.attr("items")[0].left = v ? 28 : 4;
this.layout.resize(); this.layout.resize();
this.options.showTip && this.openTip.setVisible(v); this.options.showTip && this.openTip.setVisible(v);
this.options.showTip && this.closeTip.setVisible(!v); this.options.showTip && this.closeTip.setVisible(!v);
}, }
doClick: function () { doClick() {
BI.Switch.superclass.doClick.apply(this, arguments); super.doClick.apply(this, arguments);
this.fireEvent(BI.Switch.EVENT_CHANGE, this.isSelected()); this.fireEvent(Switch.EVENT_CHANGE, this.isSelected());
} }
}); }
BI.Switch.EVENT_CHANGE = "EVENT_CHANGE";
BI.shortcut("bi.switch", BI.Switch);

92
src/case/button/treeitem/item.first.treeleaf.js

@ -1,20 +1,27 @@
BI.FirstTreeLeafItem = BI.inherit(BI.BasicButton, { import { BasicButton } from "../../../base/single/button/button.basic";
_defaultConfig: function () { import { shortcut, extend, createWidget } from "../../../core";
return BI.extend(BI.FirstTreeLeafItem.superclass._defaultConfig.apply(this, arguments), {
@shortcut()
export class FirstTreeLeafItem extends BasicButton {
static xtype = "bi.first_tree_leaf_item";
_defaultConfig() {
return extend(super._defaultConfig(arguments), {
extraCls: "bi-first-tree-leaf-item bi-list-item-active", extraCls: "bi-first-tree-leaf-item bi-list-item-active",
logic: { logic: {
dynamic: false dynamic: false,
}, },
id: "", id: "",
pId: "", pId: "",
layer: 0, layer: 0,
height: 24 height: 24,
}); });
}, }
_init: function () {
BI.FirstTreeLeafItem.superclass._init.apply(this, arguments); _init() {
var o = this.options; super._init.apply(this, arguments);
this.text = BI.createWidget({ const o = this.options;
this.text = createWidget({
type: "bi.label", type: "bi.label",
textAlign: "left", textAlign: "left",
whiteSpace: "nowrap", whiteSpace: "nowrap",
@ -24,76 +31,75 @@ BI.FirstTreeLeafItem = BI.inherit(BI.BasicButton, {
text: o.text, text: o.text,
value: o.value, value: o.value,
py: o.py, py: o.py,
keyword: o.keyword keyword: o.keyword,
}); });
var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); const type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left);
var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, ((o.layer === 0) ? "" : { const items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, ((o.layer === 0) ? "" : {
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2, width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2,
el: { el: {
type: "bi.layout", type: "bi.layout",
cls: (o.pNode && o.pNode.isLastNode) ? "" : this._getBaseLineCls(), cls: (o.pNode && o.pNode.isLastNode) ? "" : this._getBaseLineCls(),
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2, width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2,
height: o.height height: o.height,
} },
}), { }), {
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
el: { el: {
type: "bi.layout", type: "bi.layout",
cls: this._getFirstLineCls(), cls: this._getFirstLineCls(),
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
height: o.height height: o.height,
} },
}, { }, {
el: this.text el: this.text,
}); });
BI.createWidget(BI.extend({ createWidget(extend({
element: this element: this,
}, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { }, BI.LogicFactory.createLogic(type, BI.extend(o.logic, {
items: items items,
})))); }))));
}, }
_getBaseLineCls: function () { _getBaseLineCls() {
switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) { switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) {
case "solid": case "solid":
return "base-solid-line-conn-background"; return "base-solid-line-conn-background";
default: default:
return "base-line-conn-background"; return "base-line-conn-background";
} }
}, }
_getFirstLineCls: function () { _getFirstLineCls() {
switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) { switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) {
case "solid": case "solid":
return "first-solid-line-conn-background"; return "first-solid-line-conn-background";
default: default:
return "first-line-conn-background"; return "first-line-conn-background";
} }
}, }
doRedMark: function () { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
}, }
unRedMark: function () { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
}, }
doHighLight: function () { doHighLight() {
this.text.doHighLight.apply(this.text, arguments); this.text.doHighLight(...arguments);
}, }
unHighLight: function () { unHighLight() {
this.text.unHighLight.apply(this.text, arguments); this.text.unHighLight(...arguments);
}, }
getId: function () { getId() {
return this.options.id; return this.options.id;
}, }
getPId: function () { getPId() {
return this.options.pId; return this.options.pId;
} }
}); }
BI.shortcut("bi.first_tree_leaf_item", BI.FirstTreeLeafItem);

86
src/case/button/treeitem/item.icon.treeleaf.js

@ -1,33 +1,39 @@
BI.IconTreeLeafItem = BI.inherit(BI.BasicButton, { import { BasicButton } from "../../../base/single/button/button.basic";
_defaultConfig: function () { import { shortcut, extend, createWidget } from "../../../core";
return BI.extend(BI.IconTreeLeafItem.superclass._defaultConfig.apply(this, arguments), {
@shortcut()
export class IconTreeLeafItem extends BasicButton {
static xtype = "bi.icon_tree_leaf_item";
_defaultConfig() {
return extend(super._defaultConfig(arguments), {
extraCls: "bi-icon-tree-leaf-item bi-list-item-active", extraCls: "bi-icon-tree-leaf-item bi-list-item-active",
logic: { logic: {
dynamic: false dynamic: false,
}, },
height: 24, height: 24,
iconWidth: 16, iconWidth: 16,
iconHeight: 16, iconHeight: 16,
iconCls: "" iconCls: "",
}); });
}, }
_init: function () { _init() {
BI.IconTreeLeafItem.superclass._init.apply(this, arguments); super._init.apply(this, arguments);
var self = this, o = this.options; const o = this.options;
var icon = BI.createWidget({ const icon = createWidget({
type: "bi.center_adapt", type: "bi.center_adapt",
width: 24, width: 24,
cls: o.iconCls, cls: o.iconCls,
items: [{ items: [{
type: "bi.icon", type: "bi.icon",
width: o.iconWidth, width: o.iconWidth,
height: o.iconHeight height: o.iconHeight,
}] }],
}); });
this.text = BI.createWidget({ this.text = createWidget({
type: "bi.label", type: "bi.label",
textAlign: "left", textAlign: "left",
whiteSpace: "nowrap", whiteSpace: "nowrap",
@ -37,46 +43,44 @@ BI.IconTreeLeafItem = BI.inherit(BI.BasicButton, {
text: o.text, text: o.text,
value: o.value, value: o.value,
py: o.py, py: o.py,
keyword: o.keyword keyword: o.keyword,
}); });
var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); const type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left);
var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { const items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, {
width: 16, width: 16,
el: icon el: icon,
}, { }, {
el: this.text el: this.text,
}); });
BI.createWidget(BI.extend({ createWidget(BI.extend({
element: this element: this,
}, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { }, BI.LogicFactory.createLogic(type, BI.extend(o.logic, {
items: items, items,
hgap: 5 hgap: 5,
})))); }))));
}, }
doRedMark: function () { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
}, }
unRedMark: function () { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
}, }
doHighLight: function () { doHighLight() {
this.text.doHighLight.apply(this.text, arguments); this.text.doHighLight(...arguments);
}, }
unHighLight: function () { unHighLight() {
this.text.unHighLight.apply(this.text, arguments); this.text.unHighLight(...arguments);
}, }
getId: function () { getId() {
return this.options.id; return this.options.id;
}, }
getPId: function () { getPId() {
return this.options.pId; return this.options.pId;
} }
}); }
BI.shortcut("bi.icon_tree_leaf_item", BI.IconTreeLeafItem);

94
src/case/button/treeitem/item.last.treeleaf.js

@ -1,20 +1,27 @@
BI.LastTreeLeafItem = BI.inherit(BI.BasicButton, { import { BasicButton } from "../../../base/single/button/button.basic";
_defaultConfig: function () { import { shortcut, extend, createWidget } from "../../../core";
return BI.extend(BI.LastTreeLeafItem.superclass._defaultConfig.apply(this, arguments), {
@shortcut()
export class LastTreeLeafItem extends BasicButton {
static xtype = "bi.last_tree_leaf_item";
_defaultConfig() {
return extend(super._defaultConfig(arguments), {
extraCls: "bi-last-tree-leaf-item bi-list-item-active", extraCls: "bi-last-tree-leaf-item bi-list-item-active",
logic: { logic: {
dynamic: false dynamic: false,
}, },
id: "", id: "",
pId: "", pId: "",
layer: 0, layer: 0,
height: 24 height: 24,
}); });
}, }
_init: function () {
BI.LastTreeLeafItem.superclass._init.apply(this, arguments); _init() {
var o = this.options; super._init.apply(this, arguments);
this.text = BI.createWidget({ const o = this.options;
this.text = createWidget({
type: "bi.label", type: "bi.label",
textAlign: "left", textAlign: "left",
whiteSpace: "nowrap", whiteSpace: "nowrap",
@ -24,76 +31,75 @@ BI.LastTreeLeafItem = BI.inherit(BI.BasicButton, {
text: o.text, text: o.text,
value: o.value, value: o.value,
py: o.py, py: o.py,
keyword: o.keyword keyword: o.keyword,
}); });
var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); const type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left);
var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, ((o.layer === 0) ? "" : { const items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, ((o.layer === 0) ? "" : {
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2, width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2,
el: { el: {
type: "bi.layout", type: "bi.layout",
cls: (o.pNode && o.pNode.isLastNode) ? "" : this._getBaseLineCls(), cls: (o.pNode && o.pNode.isLastNode) ? "" : this._getBaseLineCls(),
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2, width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2,
height: o.height height: o.height,
} },
}), { }), {
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
el: { el: {
type: "bi.layout", type: "bi.layout",
cls: this._getLastLineCls(), cls: this._getLastLineCls(),
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
height: o.height height: o.height,
} },
}, { }, {
el: this.text el: this.text,
}); });
BI.createWidget(BI.extend({ createWidget(BI.extend({
element: this element: this,
}, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { }, BI.LogicFactory.createLogic(type, extend(o.logic, {
items: items items,
})))); }))));
}, }
_getBaseLineCls: function () { _getBaseLineCls() {
switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) { switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) {
case "solid": case "solid":
return "base-solid-line-conn-background"; return "base-solid-line-conn-background";
default: default:
return "base-line-conn-background"; return "base-line-conn-background";
} }
}, }
_getLastLineCls: function () { _getLastLineCls() {
switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) { switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) {
case "solid": case "solid":
return "last-solid-line-conn-background"; return "last-solid-line-conn-background";
default: default:
return "last-line-conn-background"; return "last-line-conn-background";
} }
}, }
doRedMark: function () { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
}, }
unRedMark: function () { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
}, }
doHighLight: function () { doHighLight() {
this.text.doHighLight.apply(this.text, arguments); this.text.doHighLight(...arguments);
}, }
unHighLight: function () { unHighLight() {
this.text.unHighLight.apply(this.text, arguments); this.text.unHighLight(...arguments);
}, }
getId: function () { getId() {
return this.options.id; return this.options.id;
}, }
getPId: function () { getPId() {
return this.options.pId; return this.options.pId;
} }
}); }
BI.shortcut("bi.last_tree_leaf_item", BI.LastTreeLeafItem);

94
src/case/button/treeitem/item.mid.treeleaf.js

@ -1,20 +1,27 @@
BI.MidTreeLeafItem = BI.inherit(BI.BasicButton, { import { BasicButton } from "../../../base/single/button/button.basic";
_defaultConfig: function () { import { shortcut, extend, createWidget } from "../../../core";
return BI.extend(BI.MidTreeLeafItem.superclass._defaultConfig.apply(this, arguments), {
@shortcut()
export class MidTreeLeafItem extends BasicButton {
static xtype = "bi.mid_tree_leaf_item";
_defaultConfig() {
return extend(super._defaultConfig(arguments), {
extraCls: "bi-mid-tree-leaf-item bi-list-item-active", extraCls: "bi-mid-tree-leaf-item bi-list-item-active",
logic: { logic: {
dynamic: false dynamic: false,
}, },
id: "", id: "",
pId: "", pId: "",
layer: 0, layer: 0,
height: 24 height: 24,
}); });
}, }
_init: function () {
BI.MidTreeLeafItem.superclass._init.apply(this, arguments); _init() {
var o = this.options; super._init.apply(this, arguments);
this.text = BI.createWidget({ const o = this.options;
this.text = createWidget({
type: "bi.label", type: "bi.label",
textAlign: "left", textAlign: "left",
whiteSpace: "nowrap", whiteSpace: "nowrap",
@ -24,76 +31,75 @@ BI.MidTreeLeafItem = BI.inherit(BI.BasicButton, {
text: o.text, text: o.text,
value: o.value, value: o.value,
py: o.py, py: o.py,
keyword: o.keyword keyword: o.keyword,
}); });
var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); const type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left);
var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, ((o.layer === 0) ? "" : { const items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, ((o.layer === 0) ? "" : {
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2, width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2,
el: { el: {
type: "bi.layout", type: "bi.layout",
cls: (o.pNode && o.pNode.isLastNode) ? "" : this._getBaseLineCls(), cls: (o.pNode && o.pNode.isLastNode) ? "" : this._getBaseLineCls(),
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2, width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT / 2,
height: o.height height: o.height,
} },
}), { }), {
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
el: { el: {
type: "bi.layout", type: "bi.layout",
cls: this._getMidLineCls(), cls: this._getMidLineCls(),
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
height: o.height height: o.height,
} },
}, { }, {
el: this.text el: this.text,
}); });
BI.createWidget(BI.extend({ createWidget(extend({
element: this element: this,
}, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { }, BI.LogicFactory.createLogic(type, extend(o.logic, {
items: items items,
})))); }))));
}, }
_getBaseLineCls: function () { _getBaseLineCls() {
switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) { switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) {
case "solid": case "solid":
return "base-solid-line-conn-background"; return "base-solid-line-conn-background";
default: default:
return "base-line-conn-background"; return "base-line-conn-background";
} }
}, }
_getMidLineCls: function () { _getMidLineCls() {
switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) { switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) {
case "solid": case "solid":
return "mid-solid-line-conn-background"; return "mid-solid-line-conn-background";
default: default:
return "mid-line-conn-background"; return "mid-line-conn-background";
} }
}, }
doRedMark: function () { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
}, }
unRedMark: function () { unRedMark () {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
}, }
doHighLight: function () { doHighLight() {
this.text.doHighLight.apply(this.text, arguments); this.text.doHighLight(...arguments);
}, }
unHighLight: function () { unHighLight() {
this.text.unHighLight.apply(this.text, arguments); this.text.unHighLight(...arguments);
}, }
getId: function () { getId() {
return this.options.id; return this.options.id;
}, }
getPId: function () { getPId() {
return this.options.pId; return this.options.pId;
} }
}); }
BI.shortcut("bi.mid_tree_leaf_item", BI.MidTreeLeafItem);

92
src/case/button/treeitem/item.multilayer.icon.treeleaf.js

@ -1,22 +1,29 @@
import { BasicButton } from "../../../base/single/button/button.basic";
import { shortcut, extend, createWidget, Controller, makeArray } from "../../../core";
/** /**
* @class BI.MultiLayerIconTreeLeafItem * @class BI.MultiLayerIconTreeLeafItem
* @extends BI.BasicButton * @extends BI.BasicButton
*/ */
BI.MultiLayerIconTreeLeafItem = BI.inherit(BI.BasicButton, { @shortcut()
_defaultConfig: function () { export class MultiLayerIconTreeLeafItem extends BasicButton {
return BI.extend(BI.MultiLayerIconTreeLeafItem.superclass._defaultConfig.apply(this, arguments), { static xtype = "bi.multilayer_icon_tree_leaf_item";
_defaultConfig() {
return extend(super._defaultConfig(arguments), {
extraCls: "bi-multilayer-icon-tree-leaf-item bi-list-item-active", extraCls: "bi-multilayer-icon-tree-leaf-item bi-list-item-active",
layer: 0, layer: 0,
height: 24, height: 24,
iconCls: "", iconCls: "",
iconHeight: 16, iconHeight: 16,
iconWidth: 16 iconWidth: 16,
}); });
}, }
_init: function () {
BI.MultiLayerIconTreeLeafItem.superclass._init.apply(this, arguments); _init() {
var self = this, o = this.options; super._init.apply(this, arguments);
this.item = BI.createWidget({ const o = this.options;
this.item = createWidget({
type: "bi.icon_tree_leaf_item", type: "bi.icon_tree_leaf_item",
cls: "bi-list-item-none", cls: "bi-list-item-none",
iconCls: o.iconCls, iconCls: o.iconCls,
@ -30,69 +37,70 @@ BI.MultiLayerIconTreeLeafItem = BI.inherit(BI.BasicButton, {
py: o.py, py: o.py,
keyword: o.keyword, keyword: o.keyword,
iconWidth: o.iconWidth, iconWidth: o.iconWidth,
iconHeight: o.iconHeight iconHeight: o.iconHeight,
}); });
this.item.on(BI.Controller.EVENT_CHANGE, function (type) { this.item.on(Controller.EVENT_CHANGE, (...args) => {
const [type] = args;
if (type === BI.Events.CLICK) {// 本身实现click功能 if (type === BI.Events.CLICK) {// 本身实现click功能
return; return;
} }
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); this.fireEvent(Controller.EVENT_CHANGE, args);
}); });
var items = []; const items = [];
BI.count(0, o.layer, function () { BI.count(0, o.layer, () => {
items.push({ items.push({
type: "bi.layout", type: "bi.layout",
width: 15, width: 15,
height: o.height height: o.height,
}); });
}); });
items.push(this.item); items.push(this.item);
BI.createWidget({ createWidget({
type: "bi.horizontal_adapt", type: "bi.horizontal_adapt",
element: this, element: this,
columnSize: BI.makeArray(o.layer, 15), columnSize: makeArray(o.layer, 15),
items: items items,
}); });
}, }
doRedMark: function () { doRedMark () {
this.item.doRedMark.apply(this.item, arguments); this.item.doRedMark(...arguments);
}, }
unRedMark: function () { unRedMark () {
this.item.unRedMark.apply(this.item, arguments); this.item.unRedMark(...arguments);
}, }
doHighLight: function () { doHighLight() {
this.item.doHighLight.apply(this.item, arguments); this.item.doHighLight(...arguments);
}, }
unHighLight: function () { unHighLight () {
this.item.unHighLight.apply(this.item, arguments); this.item.unHighLight(...arguments);
}, }
getId: function () { getId () {
return this.options.id; return this.options.id;
}, }
getPId: function () { getPId () {
return this.options.pId; return this.options.pId;
}, }
doClick: function () { doClick () {
BI.MultiLayerIconTreeLeafItem.superclass.doClick.apply(this, arguments); BI.MultiLayerIconTreeLeafItem.superclass.doClick.apply(this, arguments);
this.item.setSelected(this.isSelected()); this.item.setSelected(this.isSelected());
}, }
setSelected: function (v) { setSelected(v) {
BI.MultiLayerIconTreeLeafItem.superclass.setSelected.apply(this, arguments); BI.MultiLayerIconTreeLeafItem.superclass.setSelected.apply(this, arguments);
this.item.setSelected(v); this.item.setSelected(v);
}, }
getValue: function () { getValue() {
return this.options.value; return this.options.value;
} }
}); }
BI.shortcut("bi.multilayer_icon_tree_leaf_item", BI.MultiLayerIconTreeLeafItem);

78
src/case/button/treeitem/item.root.treeleaf.js

@ -1,22 +1,27 @@
BI.RootTreeLeafItem = BI.inherit(BI.BasicButton, { import { BasicButton } from "../../../base/single/button/button.basic";
props: { import { shortcut, extend } from "../../../core";
@shortcut()
export class RootTreeLeafItem extends BasicButton {
static xtype = "bi.root_tree_leaf_item";
props = {
baseCls: "bi-root-tree-leaf-item bi-list-item-active", baseCls: "bi-root-tree-leaf-item bi-list-item-active",
logic: { logic: {
dynamic: false dynamic: false,
}, },
id: "", id: "",
pId: "", pId: "",
layer: 0, layer: 0,
height: 24 height: 24,
}, }
render: function () { render() {
var self = this; const o = this.options;
var o = this.options; const text = {
var text = {
type: "bi.label", type: "bi.label",
ref: function (_ref) { ref: _ref => {
self.text = _ref; this.text = _ref;
}, },
textAlign: "left", textAlign: "left",
whiteSpace: "nowrap", whiteSpace: "nowrap",
@ -26,49 +31,48 @@ BI.RootTreeLeafItem = BI.inherit(BI.BasicButton, {
text: o.text, text: o.text,
value: o.value, value: o.value,
py: o.py, py: o.py,
keyword: o.keyword keyword: o.keyword,
}; };
var type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left); const type = BI.LogicFactory.createLogicTypeByDirection(BI.Direction.Left);
var items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, { const items = BI.LogicFactory.createLogicItemsByDirection(BI.Direction.Left, {
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
el: { el: {
type: "bi.layout", type: "bi.layout",
width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT, width: BI.SIZE_CONSANTS.LIST_ITEM_HEIGHT,
height: o.height height: o.height,
} },
}, { }, {
el: text el: text,
}); });
return BI.LogicFactory.createLogic(type, BI.extend(o.logic, { return BI.LogicFactory.createLogic(type, extend(o.logic, {
items: items items,
})); }));
}, }
doRedMark: function () { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
}, }
unRedMark: function () { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
}, }
doHighLight: function () { doHighLight() {
this.text.doHighLight.apply(this.text, arguments); this.text.doHighLight(...arguments);
}, }
unHighLight: function () { unHighLight() {
this.text.unHighLight.apply(this.text, arguments); this.text.unHighLight(...arguments);
}, }
getId: function () { getId() {
return this.options.id; return this.options.id;
}, }
getPId: function () { getPId() {
return this.options.pId; return this.options.pId;
} }
}); }
BI.shortcut("bi.root_tree_leaf_item", BI.RootTreeLeafItem);

68
src/case/button/treeitem/item.treetextleaf.js

@ -1,25 +1,32 @@
import { BasicButton } from "../../../base/single/button/button.basic";
import { shortcut, extend, createWidget } from "../../../core";
/** /**
* 树叶子节点 * 树叶子节点
* Created by GUY on 2015/9/6. * Created by GUY on 2015/9/6.
* @class BI.TreeTextLeafItem * @class BI.TreeTextLeafItem
* @extends BI.BasicButton * @extends BI.BasicButton
*/ */
BI.TreeTextLeafItem = BI.inherit(BI.BasicButton, { @shortcut()
_defaultConfig: function () { export class TreeTextLeafItem extends BasicButton {
return BI.extend(BI.TreeTextLeafItem.superclass._defaultConfig.apply(this, arguments), { static xtype = "bi.tree_text_leaf_item";
_defaultConfig() {
return extend(super._defaultConfig.apply(this, arguments), {
extraCls: "bi-tree-text-leaf-item bi-list-item-active", extraCls: "bi-tree-text-leaf-item bi-list-item-active",
id: "", id: "",
pId: "", pId: "",
height: 24, height: 24,
hgap: 0, hgap: 0,
lgap: 0, lgap: 0,
rgap: 0 rgap: 0,
}); });
}, }
_init: function () {
BI.TreeTextLeafItem.superclass._init.apply(this, arguments); _init() {
var self = this, o = this.options; super._init.apply(this, arguments);
this.text = BI.createWidget({ const o = this.options;
this.text = createWidget({
type: "bi.label", type: "bi.label",
textAlign: "left", textAlign: "left",
whiteSpace: "nowrap", whiteSpace: "nowrap",
@ -31,40 +38,39 @@ BI.TreeTextLeafItem = BI.inherit(BI.BasicButton, {
text: o.text, text: o.text,
value: o.value, value: o.value,
py: o.py, py: o.py,
keyword: o.keyword keyword: o.keyword,
}); });
BI.createWidget({ createWidget({
type: "bi.htape", type: "bi.htape",
element: this, element: this,
items: [{ items: [{
el: this.text el: this.text,
}] }],
}); });
}, }
doRedMark: function () { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
}, }
unRedMark: function () { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
}, }
doHighLight: function () { doHighLight() {
this.text.doHighLight.apply(this.text, arguments); this.text.doHighLight(...arguments);
}, }
unHighLight: function () { unHighLight() {
this.text.unHighLight.apply(this.text, arguments); this.text.unHighLight(...arguments);
}, }
getId: function () { getId() {
return this.options.id; return this.options.id;
}, }
getPId: function () { getPId() {
return this.options.pId; return this.options.pId;
} }
}); }
BI.shortcut("bi.tree_text_leaf_item", BI.TreeTextLeafItem);

62
src/case/button/treeitem/treeitem.js

@ -1,8 +1,15 @@
BI.BasicTreeItem = BI.inherit(BI.NodeButton, { import { NodeButton } from "../../../base/single/button/button.node";
_defaultConfig: function () { import { shortcut, extend } from "../../../core";
var conf = BI.BasicTreeItem.superclass._defaultConfig.apply(this, arguments);
return BI.extend(conf, { @shortcut()
baseCls: (conf.baseCls || "") + " bi-tree-item bi-list-item-active", export class BasicTreeItem extends NodeButton {
static xtype = "bi.tree_item";
_defaultConfig() {
const conf = super._defaultConfig(arguments);
return extend(conf, {
baseCls: `${conf.baseCls || ""} bi-tree-item bi-list-item-active`,
id: "", id: "",
pId: "", pId: "",
height: 24, height: 24,
@ -10,10 +17,10 @@ BI.BasicTreeItem = BI.inherit(BI.NodeButton, {
isFirstNode: false, isFirstNode: false,
isLastNode: false, isLastNode: false,
}); });
}, }
render: function () { render() {
var self = this, o = this.options; const o = this.options;
return { return {
type: "bi.vertical_adapt", type: "bi.vertical_adapt",
@ -31,8 +38,8 @@ BI.BasicTreeItem = BI.inherit(BI.NodeButton, {
{ {
el: { el: {
type: "bi.label", type: "bi.label",
ref: function (_ref) { ref: _ref => {
self.text = _ref; this.text = _ref;
}, },
textAlign: "left", textAlign: "left",
whiteSpace: "nowrap", whiteSpace: "nowrap",
@ -45,15 +52,15 @@ BI.BasicTreeItem = BI.inherit(BI.NodeButton, {
text: o.text, text: o.text,
value: o.value, value: o.value,
keyword: o.keyword, keyword: o.keyword,
py: o.py py: o.py,
}, },
} }
] ],
}; };
}, }
getLineCls: function () { getLineCls() {
var options = this.options; const options = this.options;
if (options.layer === 0 && options.isFirstNode && options.isLastNode) { if (options.layer === 0 && options.isFirstNode && options.isLastNode) {
return ""; return "";
} else if (options.layer === 0 && options.isFirstNode) { } else if (options.layer === 0 && options.isFirstNode) {
@ -63,24 +70,21 @@ BI.BasicTreeItem = BI.inherit(BI.NodeButton, {
} else { } else {
return BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "tree-mid-solid-line-conn-background" : "mid-line-conn-background"; return BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "tree-mid-solid-line-conn-background" : "mid-line-conn-background";
} }
}, }
doRedMark: function () { doRedMark() {
this.text.doRedMark.apply(this.text, arguments); this.text.doRedMark(...arguments);
}, }
unRedMark: function () { unRedMark() {
this.text.unRedMark.apply(this.text, arguments); this.text.unRedMark(...arguments);
}, }
getId: function () { getId() {
return this.options.id; return this.options.id;
}, }
getPId: function () { getPId() {
return this.options.pId; return this.options.pId;
} }
}
});
BI.shortcut("bi.tree_item", BI.BasicTreeItem);

7
src/case/index.js

@ -0,0 +1,7 @@
import * as button from "./button";
Object.assign(BI, {
...button,
});
export * from "./button";
Loading…
Cancel
Save