Browse Source

KERNEL-14067 feat:checkbox的es6化

es6
crawford.zhou 2 years ago
parent
commit
36d186f4c0
  1. 26
      src/case/checkbox/check.arrownode.js
  2. 24
      src/case/checkbox/check.checkingmarknode.js
  3. 37
      src/case/checkbox/check.first.treenode.js
  4. 35
      src/case/checkbox/check.last.treenode.js
  5. 37
      src/case/checkbox/check.mid.treenode.js
  6. 37
      src/case/checkbox/check.treenode.js

26
src/case/checkbox/check.arrownode.js

@ -2,24 +2,28 @@
* Created by roy on 15/10/16. * Created by roy on 15/10/16.
* 右与下箭头切换的树节点 * 右与下箭头切换的树节点
*/ */
BI.ArrowTreeGroupNodeCheckbox = BI.inherit(BI.IconButton, { import { shortcut } from "@/core";
import { IconButton } from "@/base";
props: function (conf) { @shortcut()
export class ArrowTreeGroupNodeCheckbox extends IconButton {
static xtype = "bi.arrow_group_node_checkbox";
props(conf) {
return { return {
extraCls: "bi-arrow-group-node-checkbox " + (conf.collapseIcon || "expander-right-font"), extraCls: `bi-arrow-group-node-checkbox ${conf.collapseIcon || "expander-right-font"}`,
expandIcon: "expander-down-font", expandIcon: "expander-down-font",
collapseIcon: "expander-right-font" collapseIcon: "expander-right-font",
}; };
}, }
setSelected: function (v) { setSelected(v) {
var o = this.options; const o = this.options;
BI.ArrowTreeGroupNodeCheckbox.superclass.setSelected.apply(this, arguments); super.setSelected(...arguments);
if(v) { if (v) {
this.element.removeClass(o.collapseIcon).addClass(o.expandIcon); this.element.removeClass(o.collapseIcon).addClass(o.expandIcon);
} else { } else {
this.element.removeClass(o.expandIcon).addClass(o.collapseIcon); this.element.removeClass(o.expandIcon).addClass(o.collapseIcon);
} }
} }
}); }
BI.shortcut("bi.arrow_group_node_checkbox", BI.ArrowTreeGroupNodeCheckbox);

24
src/case/checkbox/check.checkingmarknode.js

@ -3,19 +3,23 @@
* @class BI.CheckingMarkNode * @class BI.CheckingMarkNode
* @extends BI.IconButton * @extends BI.IconButton
*/ */
BI.CheckingMarkNode = BI.inherit(BI.IconButton, { import { extend, shortcut } from "@/core";
_defaultConfig: function () { import { IconButton } from "@/base";
return BI.extend( BI.CheckingMarkNode.superclass._defaultConfig.apply(this, arguments), {
});
},
setSelected: function (v) { @shortcut()
BI.CheckingMarkNode.superclass.setSelected.apply(this, arguments); export class CheckingMarkNode extends IconButton {
if(v === true) { static xtype = "bi.checking_mark_node";
_defaultConfig() {
return extend(super._defaultConfig(...arguments), {});
}
setSelected(v) {
super.setSelected(...arguments);
if (v === true) {
this.element.addClass("check-mark-font"); this.element.addClass("check-mark-font");
} else { } else {
this.element.removeClass("check-mark-font"); this.element.removeClass("check-mark-font");
} }
} }
}); }
BI.shortcut("bi.checking_mark_node", BI.CheckingMarkNode);

37
src/case/checkbox/check.first.treenode.js

@ -3,31 +3,36 @@
* @class BI.FirstTreeNodeCheckbox * @class BI.FirstTreeNodeCheckbox
* @extends BI.IconButton * @extends BI.IconButton
*/ */
BI.FirstTreeNodeCheckbox = BI.inherit(BI.IconButton, { import { extend, shortcut } from "@/core";
_defaultConfig: function () { import { IconButton } from "@/base";
return BI.extend( BI.FirstTreeNodeCheckbox.superclass._defaultConfig.apply(this, arguments), {
@shortcut()
export class FirstTreeNodeCheckbox extends IconButton {
static xtype = "bi.first_tree_node_checkbox";
_defaultConfig() {
return extend(super._defaultConfig(...arguments), {
extraCls: BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "tree-solid-collapse-icon-type2" : "tree-collapse-icon-type2", extraCls: BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "tree-solid-collapse-icon-type2" : "tree-collapse-icon-type2",
iconWidth: 24, iconWidth: 24,
iconHeight: 24 iconHeight: 24,
}); });
}, }
getLineCls: function () { getLineCls() {
switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) { switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) {
case "solid": case "solid":
return "tree-solid-expand-icon-type2"; return "tree-solid-expand-icon-type2";
default: default:
return "tree-expand-icon-type2"; return "tree-expand-icon-type2";
} }
}, }
setSelected: function (v) { setSelected(v) {
BI.FirstTreeNodeCheckbox.superclass.setSelected.apply(this, arguments); super.setSelected(...arguments);
if(v === true) { if (v === true) {
this.element.addClass(this.getLineCls()); this.element.addClass(this.getLineCls());
} else { } else {
this.element.removeClass(this.getLineCls()); this.element.removeClass(this.getLineCls());
} }
} }
}); }
BI.shortcut("bi.first_tree_node_checkbox", BI.FirstTreeNodeCheckbox);

35
src/case/checkbox/check.last.treenode.js

@ -3,31 +3,36 @@
* @class BI.LastTreeNodeCheckbox * @class BI.LastTreeNodeCheckbox
* @extends BI.IconButton * @extends BI.IconButton
*/ */
BI.LastTreeNodeCheckbox = BI.inherit(BI.IconButton, { import { extend, shortcut } from "@/core";
_defaultConfig: function () { import { IconButton } from "@/base";
return BI.extend(BI.LastTreeNodeCheckbox.superclass._defaultConfig.apply(this, arguments), {
@shortcut()
export class LastTreeNodeCheckbox extends IconButton {
static xtype = "bi.last_tree_node_checkbox";
_defaultConfig() {
return extend(super._defaultConfig(...arguments), {
extraCls: BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "tree-solid-collapse-icon-type4" : "tree-collapse-icon-type4", extraCls: BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "tree-solid-collapse-icon-type4" : "tree-collapse-icon-type4",
iconWidth: 24, iconWidth: 24,
iconHeight: 24 iconHeight: 24,
}); });
}, }
getLineCls: function () { getLineCls() {
switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) { switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) {
case "solid": case "solid":
return "tree-solid-expand-icon-type4"; return "tree-solid-expand-icon-type4";
default: default:
return "tree-expand-icon-type4"; return "tree-expand-icon-type4";
} }
}, }
setSelected: function (v) { setSelected(v) {
BI.LastTreeNodeCheckbox.superclass.setSelected.apply(this, arguments); super.setSelected(...arguments);
if (v === true) { if (v === true) {
this.element.addClass(this.getLineCls()); this.element.addClass(this.getLineCls());
} else { } else {
this.element.removeClass(this.getLineCls()); this.element.removeClass(this.getLineCls());
} }
} }
}); }
BI.shortcut("bi.last_tree_node_checkbox", BI.LastTreeNodeCheckbox);

37
src/case/checkbox/check.mid.treenode.js

@ -3,31 +3,36 @@
* @class BI.MidTreeNodeCheckbox * @class BI.MidTreeNodeCheckbox
* @extends BI.IconButton * @extends BI.IconButton
*/ */
BI.MidTreeNodeCheckbox = BI.inherit(BI.IconButton, { import { extend, shortcut } from "@/core";
_defaultConfig: function () { import { IconButton } from "@/base";
return BI.extend( BI.MidTreeNodeCheckbox.superclass._defaultConfig.apply(this, arguments), {
@shortcut()
export class MidTreeNodeCheckbox extends IconButton {
static xtype = "bi.mid_tree_node_checkbox";
_defaultConfig() {
return extend(super._defaultConfig(...arguments), {
extraCls: BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "tree-solid-collapse-icon-type3" : "tree-collapse-icon-type3", extraCls: BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "tree-solid-collapse-icon-type3" : "tree-collapse-icon-type3",
iconWidth: 24, iconWidth: 24,
iconHeight: 24 iconHeight: 24,
}); });
}, }
getLineCls: function () { getLineCls() {
switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) { switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) {
case "solid": case "solid":
return "tree-solid-expand-icon-type3"; return "tree-solid-expand-icon-type3";
default: default:
return "tree-expand-icon-type3"; return "tree-expand-icon-type3";
} }
}, }
setSelected: function (v) { setSelected(v) {
BI.MidTreeNodeCheckbox.superclass.setSelected.apply(this, arguments); super.setSelected(...arguments);
if(v === true) { if (v === true) {
this.element.addClass(this.getLineCls()); this.element.addClass(this.getLineCls());
} else { } else {
this.element.removeClass(this.getLineCls()); this.element.removeClass(this.getLineCls());
} }
} }
}); }
BI.shortcut("bi.mid_tree_node_checkbox", BI.MidTreeNodeCheckbox);

37
src/case/checkbox/check.treenode.js

@ -3,31 +3,36 @@
* @class BI.TreeNodeCheckbox * @class BI.TreeNodeCheckbox
* @extends BI.IconButton * @extends BI.IconButton
*/ */
BI.TreeNodeCheckbox = BI.inherit(BI.IconButton, { import { extend, shortcut } from "@/core";
_defaultConfig: function () { import { IconButton } from "@/base";
return BI.extend( BI.TreeNodeCheckbox.superclass._defaultConfig.apply(this, arguments), {
@shortcut()
export class TreeNodeCheckbox extends IconButton {
static xtype = "bi.tree_node_checkbox";
_defaultConfig() {
return extend(super._defaultConfig(...arguments), {
extraCls: BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "tree-solid-collapse-icon-type1" : "tree-collapse-icon-type1", extraCls: BI.STYLE_CONSTANTS.LINK_LINE_TYPE === "solid" ? "tree-solid-collapse-icon-type1" : "tree-collapse-icon-type1",
iconWidth: 24, iconWidth: 24,
iconHeight: 24 iconHeight: 24,
}); });
}, }
getLineCls: function () { getLineCls() {
switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) { switch (BI.STYLE_CONSTANTS.LINK_LINE_TYPE) {
case "solid": case "solid":
return "tree-solid-expand-icon-type1"; return "tree-solid-expand-icon-type1";
default: default:
return "tree-expand-icon-type1"; return "tree-expand-icon-type1";
} }
}, }
setSelected: function (v) { setSelected(v) {
BI.TreeNodeCheckbox.superclass.setSelected.apply(this, arguments); super.setSelected(...arguments);
if(v) { if (v) {
this.element.addClass(this.getLineCls()); this.element.addClass(this.getLineCls());
} else { } else {
this.element.removeClass(this.getLineCls()); this.element.removeClass(this.getLineCls());
} }
} }
}); }
BI.shortcut("bi.tree_node_checkbox", BI.TreeNodeCheckbox);

Loading…
Cancel
Save