Browse Source

KERNEL-14022 refact: 按钮干掉 apply

es6
Treecat 2 years ago
parent
commit
c5ea536fd7
  1. 4
      src/base/single/button/button.basic.js
  2. 4
      src/base/single/button/button.node.js
  3. 5
      src/base/single/button/buttons/button.icon.js
  4. 6
      src/base/single/button/buttons/button.image.js
  5. 8
      src/base/single/button/buttons/button.js
  6. 14
      src/base/single/button/buttons/button.text.js
  7. 8
      src/base/single/button/listitem/blankiconicontextitem.js
  8. 2
      src/base/single/button/listitem/blankicontexticonitem.js
  9. 2
      src/base/single/button/listitem/blankicontextitem.js
  10. 2
      src/base/single/button/listitem/icontexticonitem.js
  11. 4
      src/base/single/button/listitem/icontextitem.js
  12. 6
      src/base/single/button/listitem/texticonitem.js
  13. 8
      src/base/single/button/listitem/textitem.js
  14. 2
      src/base/single/button/node/icontexticonnode.js
  15. 4
      src/base/single/button/node/icontextnode.js
  16. 2
      src/base/single/button/node/texticonnode.js
  17. 6
      src/base/single/button/node/textnode.js
  18. 6
      src/case/button/icon/icon.change.js
  19. 2
      src/case/button/icon/icon.trigger.js
  20. 2
      src/case/button/icon/iconhalf/icon.half.js
  21. 6
      src/case/button/item.multiselect.js
  22. 6
      src/case/button/item.singleselect.icontext.js
  23. 6
      src/case/button/item.singleselect.js
  24. 8
      src/case/button/item.singleselect.radio.js
  25. 6
      src/case/button/node/node.arrow.js
  26. 4
      src/case/button/node/node.first.plus.js
  27. 8
      src/case/button/node/node.icon.arrow.js
  28. 8
      src/case/button/node/node.last.plus.js
  29. 6
      src/case/button/node/node.mid.plus.js
  30. 14
      src/case/button/node/node.multilayer.icon.arrow.js
  31. 4
      src/case/button/node/node.plus.js
  32. 4
      src/case/button/node/siwtcher.tree.node.js
  33. 8
      src/case/button/node/treenode.js
  34. 6
      src/case/button/switch.js
  35. 4
      src/case/button/treeitem/item.first.treeleaf.js
  36. 6
      src/case/button/treeitem/item.icon.treeleaf.js
  37. 4
      src/case/button/treeitem/item.last.treeleaf.js
  38. 2
      src/case/button/treeitem/item.mid.treeleaf.js
  39. 12
      src/case/button/treeitem/item.multilayer.icon.treeleaf.js
  40. 2
      src/case/button/treeitem/item.treetextleaf.js

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

@ -439,7 +439,7 @@ export class BasicButton extends Single {
} }
_setEnable(enable) { _setEnable(enable) {
super._setEnable.apply(this, arguments); super._setEnable(...arguments);
if (enable === true) { if (enable === true) {
this.element.removeClass("base-disabled disabled"); this.element.removeClass("base-disabled disabled");
} else if (enable === false) { } else if (enable === false) {
@ -454,7 +454,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(...arguments);
} }
} }

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

@ -27,11 +27,11 @@ export class NodeButton extends BasicButton {
if (this.isOpened()) { if (this.isOpened()) {
this.setOpened(this.isOpened()); this.setOpened(this.isOpened());
} }
super._initRef.apply(this, arguments); super._initRef(...arguments);
} }
doClick() { doClick() {
super.doClick.apply(this, arguments); super.doClick(...arguments);
this.setOpened(!this.isOpened()); this.setOpened(!this.isOpened());
} }

5
src/base/single/button/buttons/button.icon.js

@ -8,7 +8,6 @@ import { shortcut, extend, isNumber, createWidget, isNull } from "../../../../co
*/ */
@shortcut() @shortcut()
export class IconButton extends BasicButton { export class IconButton extends BasicButton {
static EVENT_CHANGE = "EVENT_CHANGE"; static EVENT_CHANGE = "EVENT_CHANGE";
static xtype = "bi.icon_button"; static xtype = "bi.icon_button";
@ -16,7 +15,7 @@ export class IconButton extends BasicButton {
const conf = super._defaultConfig(arguments); const conf = super._defaultConfig(arguments);
return extend(conf, { return extend(conf, {
_baseCls: (conf._baseCls || "") + " bi-icon-button horizon-center", _baseCls: `${conf._baseCls || ""} bi-icon-button horizon-center`,
hgap: 0, hgap: 0,
vgap: 0, vgap: 0,
tgap: 0, tgap: 0,
@ -68,7 +67,7 @@ export class IconButton extends BasicButton {
} }
doClick() { doClick() {
super.doClick.apply(this, arguments); super.doClick(...arguments);
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(IconButton.EVENT_CHANGE, this); this.fireEvent(IconButton.EVENT_CHANGE, this);
} }

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

@ -50,12 +50,12 @@ export class ImageButton extends BasicButton {
} }
setWidth(w) { setWidth(w) {
super.setWidth.apply(this, arguments); super.setWidth(...arguments);
this.options.width = w; this.options.width = w;
} }
setHeight(h) { setHeight(h) {
super.setHeight.apply(this, arguments); super.setHeight(...arguments);
this.options.height = h; this.options.height = h;
} }
@ -85,7 +85,7 @@ export class ImageButton extends BasicButton {
} }
doClick() { doClick() {
super.doClick.apply(this, arguments); super.doClick(...arguments);
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(ImageButton.EVENT_CHANGE, this); this.fireEvent(ImageButton.EVENT_CHANGE, this);
} }

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

@ -188,14 +188,14 @@ export class Button extends BasicButton {
} }
doClick() { doClick() {
super.doClick.apply(this, arguments); super.doClick(...arguments);
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(Button.EVENT_CHANGE, this); this.fireEvent(Button.EVENT_CHANGE, this);
} }
} }
_setEnable(enable) { _setEnable(enable) {
super._setEnable.apply(this, arguments); super._setEnable(...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) {
@ -236,12 +236,12 @@ export class Button extends BasicButton {
} }
setText(text) { setText(text) {
super.setText.apply(this, arguments); super.setText(...arguments);
this.text.setText(text); this.text.setText(text);
} }
setValue(text) { setValue(text) {
super.setValue.apply(this, arguments); super.setValue(...arguments);
if (!this.isReadOnly()) { if (!this.isReadOnly()) {
this.text.setValue(text); this.text.setValue(text);
} }

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

@ -1,5 +1,5 @@
import { BasicButton } from "../button.basic"; import { BasicButton } from "../button.basic";
import { shortcut, extend, createWidget } from "../../../../core"; import { shortcut, extend, createWidget, isArray } from "../../../../core";
/** /**
* guy * guy
@ -53,9 +53,9 @@ export class TextButton extends BasicButton {
} }
doClick() { doClick() {
super.doClick.apply(this, arguments); super.doClick(...arguments);
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(BI.TextButton.EVENT_CHANGE, this.getValue(), this); this.fireEvent(TextButton.EVENT_CHANGE, this.getValue(), this);
} }
} }
@ -76,8 +76,8 @@ export class TextButton extends BasicButton {
} }
setText(text) { setText(text) {
super.setText.apply(this, arguments); super.setText(...arguments);
text = BI.isArray(text) ? text.join(",") : text; text = isArray(text) ? text.join(",") : text;
this.text.setText(text); this.text.setText(text);
} }
@ -86,9 +86,9 @@ export class TextButton extends BasicButton {
} }
setValue(text) { setValue(text) {
super.setValue.apply(this, arguments); super.setValue(...arguments);
if (!this.isReadOnly()) { if (!this.isReadOnly()) {
text = BI.isArray(text) ? text.join(",") : text; text = isArray(text) ? text.join(",") : text;
this.text.setValue(text); this.text.setValue(text);
} }
} }

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

@ -1,5 +1,5 @@
import { BasicButton } from "../button.basic"; import { BasicButton } from "../button.basic";
import { shortcut } from "../../../../core"; import { shortcut, extend } from "../../../../core";
/** /**
* 带有一个占位 * 带有一个占位
@ -16,7 +16,7 @@ export class BlankIconIconTextItem extends BasicButton {
_defaultConfig() { _defaultConfig() {
const conf = super._defaultConfig(arguments); const conf = super._defaultConfig(arguments);
return BI.extend(conf, { return extend(conf, {
baseCls: `${conf.baseCls || ""} bi-blank-icon-icon-text-item`, baseCls: `${conf.baseCls || ""} bi-blank-icon-icon-text-item`,
iconCls1: "", iconCls1: "",
iconCls2: "", iconCls2: "",
@ -74,14 +74,14 @@ export class BlankIconIconTextItem extends BasicButton {
} }
doClick() { doClick() {
super.doClick.apply(this, arguments); super.doClick(...arguments);
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(BlankIconIconTextItem.EVENT_CHANGE, this.getValue(), this); this.fireEvent(BlankIconIconTextItem.EVENT_CHANGE, this.getValue(), this);
} }
} }
setSelected(b) { setSelected(b) {
super.setSelected.apply(this, arguments); super.setSelected(...arguments);
this.icon1.setSelected(b); this.icon1.setSelected(b);
this.icon2.setSelected(b); this.icon2.setSelected(b);
} }

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

@ -75,7 +75,7 @@ export class BlankIconTextIconItem extends BasicButton {
} }
doClick() { doClick() {
super.doClick.apply(this, arguments); super.doClick(...arguments);
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(BI.BlankIconTextIconItem.EVENT_CHANGE, this.getValue(), this); this.fireEvent(BI.BlankIconTextIconItem.EVENT_CHANGE, this.getValue(), this);
} }

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

@ -67,7 +67,7 @@ export class BlankIconTextItem extends BasicButton {
} }
doClick() { doClick() {
super.doClick.apply(this, arguments); super.doClick(...arguments);
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(BlankIconTextItem.EVENT_CHANGE, this.getValue(), this); this.fireEvent(BlankIconTextItem.EVENT_CHANGE, this.getValue(), this);
} }

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

@ -72,7 +72,7 @@ export class IconTextIconItem extends BasicButton {
} }
doClick() { doClick() {
super.doClick.apply(this, arguments); super.doClick(...arguments);
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(IconTextIconItem.EVENT_CHANGE, this.getValue(), this); this.fireEvent(IconTextIconItem.EVENT_CHANGE, this.getValue(), this);
} }

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

@ -65,9 +65,9 @@ export class IconTextItem extends BasicButton {
} }
doClick() { doClick() {
super.doClick.apply(this, arguments); super.doClick(...arguments);
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(BI.IconTextItem.EVENT_CHANGE, this.getValue(), this); this.fireEvent(IconTextItem.EVENT_CHANGE, this.getValue(), this);
} }
} }

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

@ -39,8 +39,8 @@ export class TextIconItem extends BasicButton {
items: [{ items: [{
el: { el: {
type: "bi.label", type: "bi.label",
ref (_ref) { ref: _ref => {
self.text = _ref; this.text = _ref;
}, },
cls: "list-item-text", cls: "list-item-text",
textAlign: "left", textAlign: "left",
@ -65,7 +65,7 @@ export class TextIconItem extends BasicButton {
} }
doClick() { doClick() {
super.doClick.apply(this, arguments); super.doClick(...arguments);
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(TextIconItem.EVENT_CHANGE, this.getValue(), this); this.fireEvent(TextIconItem.EVENT_CHANGE, this.getValue(), this);
} }

8
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, createWidget } from "../../../../core";
/** /**
* guy * guy
@ -30,7 +30,7 @@ export class TextItem extends BasicButton {
render() { render() {
const 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,
@ -49,9 +49,9 @@ export class TextItem extends BasicButton {
} }
doClick() { doClick() {
super.doClick.apply(this, arguments); super.doClick(...arguments);
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(BI.TextItem.EVENT_CHANGE, this.getValue(), this); this.fireEvent(TextItem.EVENT_CHANGE, this.getValue(), this);
} }
} }

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

@ -69,7 +69,7 @@ export class IconTextIconNode extends NodeButton {
} }
doClick() { doClick() {
super.doClick.apply(this, arguments); super.doClick(...arguments);
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(IconTextIconNode.EVENT_CHANGE, this.getValue(), this); this.fireEvent(IconTextIconNode.EVENT_CHANGE, this.getValue(), this);
} }

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

@ -62,9 +62,9 @@ export class IconTextNode extends NodeButton {
} }
doClick() { doClick() {
super.doClick.apply(this, arguments); super.doClick(...arguments);
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(BI.IconTextNode.EVENT_CHANGE, this.getValue(), this); this.fireEvent(IconTextNode.EVENT_CHANGE, this.getValue(), this);
} }
} }

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

@ -61,7 +61,7 @@ export default class TextIconNode extends NodeButton {
} }
doClick() { doClick() {
super.doClick.apply(this, arguments); super.doClick(...arguments);
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(TextIconNode.EVENT_CHANGE, this.getValue(), this); this.fireEvent(TextIconNode.EVENT_CHANGE, this.getValue(), this);
} }

6
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, createWidget } from "../../../../core";
/** /**
* guy * guy
@ -31,7 +31,7 @@ export class TextNode extends NodeButton {
render() { render() {
const 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,
@ -50,7 +50,7 @@ export class TextNode extends NodeButton {
} }
doClick() { doClick() {
super.doClick.apply(this, arguments); super.doClick(...arguments);
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(TextNode.EVENT_CHANGE, this.getValue(), this); this.fireEvent(TextNode.EVENT_CHANGE, this.getValue(), this);
} }

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

@ -45,7 +45,7 @@ export class IconChangeButton extends Single {
o.iconCls = isFunction(o.iconCls) ? this.__watch(o.iconCls, (context, newValue) => { o.iconCls = isFunction(o.iconCls) ? this.__watch(o.iconCls, (context, newValue) => {
this.setIcon(newValue); this.setIcon(newValue);
}) : o.iconCls; }) : o.iconCls;
super._init.apply(this, arguments); super._init(...arguments);
this.button = createWidget({ this.button = createWidget({
type: "bi.icon_button", type: "bi.icon_button",
element: this, element: this,
@ -69,10 +69,10 @@ export class IconChangeButton extends Single {
}); });
this.button.on(Controller.EVENT_CHANGE, (...args) => { this.button.on(Controller.EVENT_CHANGE, (...args) => {
this.fireEvent(Controller.EVENT_CHANGE, args); this.fireEvent(Controller.EVENT_CHANGE, ...args);
}); });
this.button.on(IconButton.EVENT_CHANGE, (...args) => { this.button.on(IconButton.EVENT_CHANGE, (...args) => {
this.fireEvent(IconChangeButton.EVENT_CHANGE, args); this.fireEvent(IconChangeButton.EVENT_CHANGE, ...args);
}); });
} }

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

@ -11,7 +11,7 @@ import { shortcut, extend } from "../../../core";
@shortcut() @shortcut()
export class TriggerIconButton extends IconButton { export class TriggerIconButton extends IconButton {
static xtype = "bi.trigger_icon_button"; static xtype = "bi.trigger_icon_button";
EVENT_CHANGE = IconButton.EVENT_CHANGE; static EVENT_CHANGE = IconButton.EVENT_CHANGE;
_defaultConfig() { _defaultConfig() {
const conf = super._defaultConfig(arguments); const conf = super._defaultConfig(arguments);

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

@ -38,7 +38,7 @@ export class HalfButton extends BasicButton {
} }
doClick() { doClick() {
super.doClick.apply(this, arguments); super.doClick(...arguments);
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(HalfButton.EVENT_CHANGE); this.fireEvent(HalfButton.EVENT_CHANGE);
} }

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

@ -77,14 +77,14 @@ export class MultiSelectItem extends BasicButton {
} }
doClick() { doClick() {
BI.MultiSelectItem.superclass.doClick.apply(this, arguments); super.doClick(...arguments);
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(BI.MultiSelectItem.EVENT_CHANGE, this.getValue(), this); this.fireEvent(MultiSelectItem.EVENT_CHANGE, this.getValue(), this);
} }
} }
setSelected(v) { setSelected(v) {
BI.MultiSelectItem.superclass.setSelected.apply(this, arguments); super.setSelected(...arguments);
this.checkbox.setSelected(v); this.checkbox.setSelected(v);
} }
} }

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

@ -43,13 +43,13 @@ export class SingleSelectIconTextItem extends Single {
value: o.value, value: o.value,
py: o.py, py: o.py,
}); });
this.text.on(Controller.EVENT_CHANGE, function () { this.text.on(Controller.EVENT_CHANGE, (...args) => {
self.fireEvent(Controller.EVENT_CHANGE, arguments); this.fireEvent(Controller.EVENT_CHANGE, ...args);
}); });
} }
_setEnable(enable) { _setEnable(enable) {
super._setEnable.apply(this, arguments); super._setEnable(...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) {

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

@ -39,7 +39,7 @@ export class SingleSelectItem extends BasicButton {
} }
_setEnable(enable) { _setEnable(enable) {
super._setEnable.apply(this, arguments); super._setEnable(...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) {
@ -56,14 +56,14 @@ export class SingleSelectItem extends BasicButton {
} }
doClick() { doClick() {
super.doClick.apply(this, arguments); super.doClick(...arguments);
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(SingleSelectItem.EVENT_CHANGE, this.isSelected(), this); this.fireEvent(SingleSelectItem.EVENT_CHANGE, this.isSelected(), this);
} }
} }
setSelected(v) { setSelected(v) {
super.setSelected.apply(this, arguments); super.setSelected(...arguments);
} }
} }

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

@ -62,7 +62,7 @@ export class SingleSelectRadioItem extends BasicButton {
} }
_setEnable(enable) { _setEnable(enable) {
super._setEnable.apply(this, arguments); super._setEnable(...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) {
@ -79,14 +79,14 @@ export class SingleSelectRadioItem extends BasicButton {
} }
doClick() { doClick() {
BI.SingleSelectRadioItem.superclass.doClick.apply(this, arguments); super.doClick(...arguments);
if (this.isValid()) { if (this.isValid()) {
this.fireEvent(BI.SingleSelectRadioItem.EVENT_CHANGE, this.isSelected(), this); this.fireEvent(SingleSelectRadioItem.EVENT_CHANGE, this.isSelected(), this);
} }
} }
setSelected(v) { setSelected(v) {
BI.SingleSelectRadioItem.superclass.setSelected.apply(this, arguments); super.setSelected(...arguments);
this.radio.setSelected(v); this.radio.setSelected(v);
} }
} }

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

@ -64,17 +64,17 @@ export class ArrowNode extends NodeButton {
} }
doClick() { doClick() {
super.doClick.apply(this, arguments); super.doClick(...arguments);
this.checkbox.setSelected(this.isOpened()); this.checkbox.setSelected(this.isOpened());
} }
setText(text) { setText(text) {
super.setText.apply(this, arguments); super.setText(...arguments);
this.text.setText(text); this.text.setText(text);
} }
setOpened(v) { setOpened(v) {
super.setOpened.apply(this, arguments); super.setOpened(...arguments);
this.checkbox.setSelected(v); this.checkbox.setSelected(v);
} }
} }

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

@ -78,12 +78,12 @@ export class FirstPlusGroupNode extends NodeButton {
} }
doClick() { doClick() {
super.doClick.apply(this, arguments); super.doClick(...arguments);
this.checkbox.setSelected(this.isSelected()); this.checkbox.setSelected(this.isSelected());
} }
setOpened(v) { setOpened(v) {
super.setOpened.apply(this, arguments); super.setOpened(...arguments);
if (BI.isNotNull(this.checkbox)) { if (BI.isNotNull(this.checkbox)) {
this.checkbox.setSelected(v); this.checkbox.setSelected(v);
} }

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

@ -1,5 +1,5 @@
import { NodeButton } from "../../../base/single/button/button.node"; import { NodeButton } from "../../../base/single/button/button.node";
import { shortcut, extend, createWidget, Controller } from "../../../core"; import { shortcut, extend, createWidget, Controller, isNotNull } from "../../../core";
/** /**
* Created by User on 2016/3/31. * Created by User on 2016/3/31.
@ -96,13 +96,13 @@ export class IconArrowNode extends NodeButton {
} }
doClick() { doClick() {
BI.IconArrowNode.superclass.doClick.apply(this, arguments); super.doClick(...arguments);
this.checkbox.setSelected(this.isSelected()); this.checkbox.setSelected(this.isSelected());
} }
setOpened(v) { setOpened(v) {
BI.IconArrowNode.superclass.setOpened.apply(this, arguments); super.setOpened(...arguments);
if (BI.isNotNull(this.checkbox)) { if (isNotNull(this.checkbox)) {
this.checkbox.setSelected(v); this.checkbox.setSelected(v);
} }
} }

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

@ -1,5 +1,5 @@
import { NodeButton } from "../../../base/single/button/button.node"; import { NodeButton } from "../../../base/single/button/button.node";
import { shortcut, extend, createWidget, isNotNull } from "../../../core"; import { shortcut, extend, createWidget, isNotNull, Controller } from "../../../core";
/** /**
* 加号表示的组节点 * 加号表示的组节点
@ -46,7 +46,7 @@ export class LastPlusGroupNode extends NodeButton {
py: o.py, py: o.py,
keyword: o.keyword, keyword: o.keyword,
}); });
this.checkbox.on(BI.Controller.EVENT_CHANGE, type => { this.checkbox.on(Controller.EVENT_CHANGE, type => {
if (type === BI.Events.CLICK) { if (type === BI.Events.CLICK) {
if (this.checkbox.isSelected()) { if (this.checkbox.isSelected()) {
this.triggerExpand(); this.triggerExpand();
@ -76,12 +76,12 @@ export class LastPlusGroupNode extends NodeButton {
} }
doClick() { doClick() {
super.doClick.apply(this, arguments); super.doClick(...arguments);
this.checkbox.setSelected(this.isSelected()); this.checkbox.setSelected(this.isSelected());
} }
setOpened(v) { setOpened(v) {
super.setOpened.apply(this, arguments); super.setOpened(...arguments);
if (isNotNull(this.checkbox)) { if (isNotNull(this.checkbox)) {
this.checkbox.setSelected(v); this.checkbox.setSelected(v);
} }

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

@ -27,7 +27,7 @@ export class MidPlusGroupNode extends NodeButton {
} }
_init() { _init() {
super._init.apply(this, arguments); super._init(...arguments);
const o = this.options; const o = this.options;
this.checkbox = createWidget({ this.checkbox = createWidget({
type: "bi.mid_tree_node_checkbox", type: "bi.mid_tree_node_checkbox",
@ -77,12 +77,12 @@ export class MidPlusGroupNode extends NodeButton {
} }
doClick() { doClick() {
super.doClick.apply(this, arguments); super.doClick(...arguments);
this.checkbox.setSelected(this.isSelected()); this.checkbox.setSelected(this.isSelected());
} }
setOpened(v) { setOpened(v) {
BI.MidPlusGroupNode.superclass.setOpened.apply(this, arguments); super.setOpened(...arguments);
if (BI.isNotNull(this.checkbox)) { if (BI.isNotNull(this.checkbox)) {
this.checkbox.setSelected(v); this.checkbox.setSelected(v);
} }

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

@ -1,5 +1,5 @@
import { NodeButton } from "../../../base/single/button/button.node"; import { NodeButton } from "../../../base/single/button/button.node";
import { shortcut, extend, createWidget, Controller, count } from "../../../core"; import { shortcut, extend, createWidget, Controller, count, makeArray } from "../../../core";
@shortcut() @shortcut()
export class MultiLayerIconArrowNode extends NodeButton { export class MultiLayerIconArrowNode extends NodeButton {
@ -22,7 +22,7 @@ export class MultiLayerIconArrowNode extends NodeButton {
} }
_init() { _init() {
super._init.apply(this, arguments); super._init(...arguments);
const o = this.options; const o = this.options;
this.node = createWidget({ this.node = createWidget({
type: "bi.icon_arrow_node", type: "bi.icon_arrow_node",
@ -42,7 +42,7 @@ export class MultiLayerIconArrowNode extends NodeButton {
}); });
this.node.on(Controller.EVENT_CHANGE, (...args) => { this.node.on(Controller.EVENT_CHANGE, (...args) => {
this.setSelected(this.isSelected()); this.setSelected(this.isSelected());
this.fireEvent(Controller.EVENT_CHANGE, args); this.fireEvent(Controller.EVENT_CHANGE, ...args);
}); });
const items = []; const items = [];
@ -57,7 +57,7 @@ export class MultiLayerIconArrowNode extends NodeButton {
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,
}); });
} }
@ -79,17 +79,17 @@ export class MultiLayerIconArrowNode extends NodeButton {
} }
setSelected(b) { setSelected(b) {
super.setSelected.apply(this, arguments); super.setSelected(...arguments);
this.node.setSelected(b); this.node.setSelected(b);
} }
doClick() { doClick() {
super.doClick.apply(this, arguments); super.doClick(...arguments);
this.node.setSelected(this.isSelected()); this.node.setSelected(this.isSelected());
} }
setOpened(v) { setOpened(v) {
super.setOpened.apply(this, arguments); super.setOpened(...arguments);
this.node.setOpened(v); this.node.setOpened(v);
} }
} }

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

@ -73,12 +73,12 @@ export class PlusGroupNode extends NodeButton {
} }
doClick() { doClick() {
super.doClick.apply(this, arguments); super.doClick(...arguments);
this.checkbox.setSelected(this.isSelected()); this.checkbox.setSelected(this.isSelected());
} }
setOpened(v) { setOpened(v) {
super.setOpened.apply(this, arguments); super.setOpened(...arguments);
if (this.checkbox) { if (this.checkbox) {
this.checkbox.setSelected(v); this.checkbox.setSelected(v);
} }

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

@ -46,7 +46,7 @@ export class TreeNodeSwitcher extends NodeButton {
} }
setOpened(b) { setOpened(b) {
super.setOpened.apply(this, arguments); super.setOpened(...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);
@ -56,7 +56,7 @@ export class TreeNodeSwitcher extends NodeButton {
} }
doClick() { doClick() {
super.doClick.apply(this, arguments); super.doClick(...arguments);
this.fireEvent(TreeNodeSwitcher.EVENT_CHANGE, this); this.fireEvent(TreeNodeSwitcher.EVENT_CHANGE, this);
} }
} }

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

@ -28,7 +28,7 @@ export class BasicTreeNode extends NodeButton {
const checkbox = { const checkbox = {
type: "bi.tree_node_switcher", type: "bi.tree_node_switcher",
__ref: _ref => { ref: _ref => {
this.switcher = _ref; this.switcher = _ref;
}, },
iconHeight: o.height, iconHeight: o.height,
@ -97,16 +97,16 @@ export class BasicTreeNode extends NodeButton {
if (this.options.selectable) { if (this.options.selectable) {
return; return;
} }
super.doClick.apply(this, arguments); super.doClick(...arguments);
} }
setOpened(v) { setOpened(v) {
super.setOpened.apply(this, arguments); super.setOpened(...arguments);
this.switcher.setOpened(v); this.switcher.setOpened(v);
} }
setValue() { setValue() {
super.setValue.apply(this, arguments); super.setValue(...arguments);
} }
} }

6
src/case/button/switch.js

@ -72,7 +72,7 @@ export class Switch extends BasicButton {
} }
_setEnable(enable) { _setEnable(enable) {
super._setEnable.apply(this, arguments); super._setEnable(...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) {
@ -81,7 +81,7 @@ export class Switch extends BasicButton {
} }
setSelected(v) { setSelected(v) {
super.setSelected.apply(this, arguments); super.setSelected(...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);
@ -89,7 +89,7 @@ export class Switch extends BasicButton {
} }
doClick() { doClick() {
super.doClick.apply(this, arguments); super.doClick(...arguments);
this.fireEvent(Switch.EVENT_CHANGE, this.isSelected()); this.fireEvent(Switch.EVENT_CHANGE, this.isSelected());
} }
} }

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

@ -19,7 +19,7 @@ export class FirstTreeLeafItem extends BasicButton {
} }
_init() { _init() {
super._init.apply(this, arguments); super._init(...arguments);
const o = this.options; const o = this.options;
this.text = createWidget({ this.text = createWidget({
type: "bi.label", type: "bi.label",
@ -55,7 +55,7 @@ export class FirstTreeLeafItem extends BasicButton {
}); });
createWidget(extend({ createWidget(extend({
element: this, element: this,
}, BI.LogicFactory.createLogic(type, BI.extend(o.logic, { }, BI.LogicFactory.createLogic(type, extend(o.logic, {
items, items,
})))); }))));
} }

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

@ -19,7 +19,7 @@ export class IconTreeLeafItem extends BasicButton {
} }
_init() { _init() {
super._init.apply(this, arguments); super._init(...arguments);
const o = this.options; const o = this.options;
const icon = createWidget({ const icon = createWidget({
@ -52,9 +52,9 @@ export class IconTreeLeafItem extends BasicButton {
}, { }, {
el: this.text, el: this.text,
}); });
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,
hgap: 5, hgap: 5,
})))); }))));

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

@ -19,7 +19,7 @@ export class LastTreeLeafItem extends BasicButton {
} }
_init() { _init() {
super._init.apply(this, arguments); super._init(...arguments);
const o = this.options; const o = this.options;
this.text = createWidget({ this.text = createWidget({
type: "bi.label", type: "bi.label",
@ -53,7 +53,7 @@ export class LastTreeLeafItem extends BasicButton {
}, { }, {
el: this.text, el: this.text,
}); });
createWidget(BI.extend({ createWidget(extend({
element: this, element: this,
}, BI.LogicFactory.createLogic(type, extend(o.logic, { }, BI.LogicFactory.createLogic(type, extend(o.logic, {
items, items,

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

@ -19,7 +19,7 @@ export class MidTreeLeafItem extends BasicButton {
} }
_init() { _init() {
super._init.apply(this, arguments); super._init(...arguments);
const o = this.options; const o = this.options;
this.text = createWidget({ this.text = createWidget({
type: "bi.label", type: "bi.label",

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

@ -1,5 +1,5 @@
import { BasicButton } from "../../../base/single/button/button.basic"; import { BasicButton } from "../../../base/single/button/button.basic";
import { shortcut, extend, createWidget, Controller, makeArray } from "../../../core"; import { shortcut, extend, createWidget, Controller, makeArray, count } from "../../../core";
/** /**
* @class BI.MultiLayerIconTreeLeafItem * @class BI.MultiLayerIconTreeLeafItem
@ -21,7 +21,7 @@ export class MultiLayerIconTreeLeafItem extends BasicButton {
} }
_init() { _init() {
super._init.apply(this, arguments); super._init(...arguments);
const o = this.options; const o = this.options;
this.item = createWidget({ this.item = createWidget({
type: "bi.icon_tree_leaf_item", type: "bi.icon_tree_leaf_item",
@ -44,11 +44,11 @@ export class MultiLayerIconTreeLeafItem extends BasicButton {
if (type === BI.Events.CLICK) {// 本身实现click功能 if (type === BI.Events.CLICK) {// 本身实现click功能
return; return;
} }
this.fireEvent(Controller.EVENT_CHANGE, args); this.fireEvent(Controller.EVENT_CHANGE, ...args);
}); });
const items = []; const items = [];
BI.count(0, o.layer, () => { count(0, o.layer, () => {
items.push({ items.push({
type: "bi.layout", type: "bi.layout",
width: 15, width: 15,
@ -89,12 +89,12 @@ export class MultiLayerIconTreeLeafItem extends BasicButton {
} }
doClick () { doClick () {
BI.MultiLayerIconTreeLeafItem.superclass.doClick.apply(this, arguments); super.doClick(...arguments);
this.item.setSelected(this.isSelected()); this.item.setSelected(this.isSelected());
} }
setSelected(v) { setSelected(v) {
BI.MultiLayerIconTreeLeafItem.superclass.setSelected.apply(this, arguments); super.setSelected(...arguments);
this.item.setSelected(v); this.item.setSelected(v);
} }

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

@ -24,7 +24,7 @@ export class TreeTextLeafItem extends BasicButton {
} }
_init() { _init() {
super._init.apply(this, arguments); super._init(...arguments);
const o = this.options; const o = this.options;
this.text = createWidget({ this.text = createWidget({
type: "bi.label", type: "bi.label",

Loading…
Cancel
Save