Browse Source

Merge remote-tracking branch 'origin/master' into KERNEL-11169

# Conflicts:
#	package.json
es6
iapyang 2 years ago
parent
commit
ffeb2877c4
  1. 700
      demo/js/base/button/demo.button.js
  2. 5
      package.json
  3. 12
      src/base/combination/group.button.js
  4. 16
      src/base/combination/group.virtual.js
  5. 16
      src/base/list/listview.js
  6. 13
      src/base/list/virtualgrouplist.js
  7. 9
      src/base/list/virtuallist.js
  8. 32
      src/base/single/button/buttons/button.js
  9. 6
      src/core/3.ob.js
  10. 2
      src/core/4.widget.js
  11. 18
      src/core/5.inject.js
  12. 21
      src/less/base/tree/ztree.less
  13. 2
      typescript/base/combination/group.button.ts
  14. 6
      typescript/base/combination/group.virtual.ts
  15. 4
      typescript/base/list/listview.ts
  16. 11
      typescript/base/list/virtualgrouplist.ts
  17. 11
      typescript/base/list/virtuallist.ts
  18. 65
      typescript/index.ts

700
demo/js/base/button/demo.button.js

@ -4,416 +4,310 @@ Demo.Button = BI.inherit(BI.Widget, {
}, },
render: function () { render: function () {
var items = [{ var items = [{
el: { type: "bi.button",
type: "bi.button", text: "一般按钮",
text: "一般按钮", level: "common",
level: "common", height: 30
height: 30 }, {
} type: "bi.button",
}, { text: "表示成功状态按钮",
el: { level: "success",
type: "bi.button", height: 30
text: "表示成功状态按钮", }, {
level: "success", type: "bi.button",
height: 30 text: "表示警告状态的按钮",
} level: "warning",
}, { height: 30
el: { }, {
type: "bi.button", type: "bi.button",
text: "表示警告状态的按钮", text: "表示错误状态的按钮",
level: "warning", level: "error",
height: 30 height: 30
} }, {
}, { type: "bi.button",
el: { text: "表示忽略状态的按钮",
type: "bi.button", level: "ignore",
text: "表示错误状态的按钮", height: 30
level: "error", }, {
height: 30 type: "bi.button",
} text: "普通灰化按钮",
}, { disabled: true,
el: { level: "success",
type: "bi.button", height: 30
text: "表示忽略状态的按钮", }, {
level: "ignore", type: "bi.button",
height: 30 text: "忽略状态灰化按钮",
} disabled: true,
}, { level: "ignore",
el: { height: 30
type: "bi.button", }, {
text: "普通灰化按钮", type: "bi.button",
disabled: true, text: "带图标的按钮",
level: "success", // level: 'ignore',
height: 30 iconCls: "close-font",
} height: 30
}, { }, {
el: { type: "bi.button",
type: "bi.button", text: "一般按钮",
text: "忽略状态灰化按钮", block: true,
disabled: true, level: "common",
level: "ignore", height: 30
height: 30 }, {
} type: "bi.button",
}, { text: "表示成功状态按钮",
el: { block: true,
type: "bi.button", level: "success",
text: "带图标的按钮", height: 30
// level: 'ignore', }, {
iconCls: "close-font", type: "bi.button",
height: 30 text: "表示警告状态的按钮",
} block: true,
}, { level: "warning",
el: { height: 30
type: "bi.button", }, {
text: "一般按钮", type: "bi.button",
block: true, text: "表示忽略状态的按钮",
level: "common", block: true,
height: 30 level: "ignore",
} height: 30
}, { }, {
el: { type: "bi.button",
type: "bi.button", text: "普通灰化按钮",
text: "表示成功状态按钮", block: true,
block: true, disabled: true,
level: "success", level: "success",
height: 30 height: 30
} }, {
}, { type: "bi.button",
el: { text: "忽略状态灰化按钮",
type: "bi.button", block: true,
text: "表示警告状态的按钮", disabled: true,
block: true, level: "ignore",
level: "warning", height: 30
height: 30 }, {
} type: "bi.button",
}, { text: "带图标的按钮",
el: { block: true,
type: "bi.button", // level: 'ignore',
text: "表示忽略状态的按钮", iconCls: "close-font",
block: true, height: 30
level: "ignore", }, {
height: 30 type: "bi.button",
} text: "一般按钮",
}, { clear: true,
el: { level: "common",
type: "bi.button", height: 30
text: "普通灰化按钮", }, {
block: true, type: "bi.button",
disabled: true, text: "表示成功状态按钮",
level: "success", clear: true,
height: 30 level: "success",
} height: 30
}, { }, {
el: { type: "bi.button",
type: "bi.button", text: "表示警告状态的按钮",
text: "忽略状态灰化按钮", clear: true,
block: true, level: "warning",
disabled: true, height: 30
level: "ignore", }, {
height: 30 type: "bi.button",
} text: "表示忽略状态的按钮",
}, { clear: true,
el: { level: "ignore",
type: "bi.button", height: 30
text: "带图标的按钮", }, {
block: true, type: "bi.button",
// level: 'ignore', text: "普通灰化按钮",
iconCls: "close-font", clear: true,
height: 30 disabled: true,
} level: "success",
}, { height: 30
el: { }, {
type: "bi.button", type: "bi.button",
text: "一般按钮", text: "忽略状态灰化按钮",
clear: true, clear: true,
level: "common", disabled: true,
height: 30 level: "ignore",
} height: 30
}, { }, {
el: { type: "bi.button",
type: "bi.button", text: "带图标的按钮",
text: "表示成功状态按钮", clear: true,
clear: true, // level: 'ignore',
level: "success", iconCls: "close-font",
height: 30 height: 30
} }, {
}, { type: "bi.text_button",
el: { text: "文字按钮",
type: "bi.button", height: 30
text: "表示警告状态的按钮", }, {
clear: true, type: "bi.button",
level: "warning", text: "幽灵按钮(common)",
height: 30 ghost: true,
} height: 30
}, { }, {
el: { type: "bi.button",
type: "bi.button", iconCls: "plus-font",
text: "表示忽略状态的按钮", text: "幽灵按钮(common)",
clear: true, ghost: true,
level: "ignore", height: 30
height: 30 }, {
} type: "bi.button",
}, { iconCls: "plus-font",
el: { text: "幽灵按钮(common)",
type: "bi.button", ghost: true,
text: "普通灰化按钮", level: "warning",
clear: true, height: 30
disabled: true, }, {
level: "success", type: "bi.button",
height: 30 iconCls: "plus-font",
} text: "幽灵按钮(common)",
}, { ghost: true,
el: { level: "error",
type: "bi.button", height: 30
text: "忽略状态灰化按钮", }, {
clear: true, type: "bi.button",
disabled: true, iconCls: "plus-font",
level: "ignore", text: "幽灵按钮(common)",
height: 30 ghost: true,
} level: "success",
}, { height: 30
el: { }, {
type: "bi.button", type: "bi.button",
text: "带图标的按钮", text: "幽灵按钮(common)灰化",
clear: true, disabled: true,
// level: 'ignore', ghost: true,
iconCls: "close-font", height: 30
height: 30 }, {
} type: "bi.button",
}, { text: "弹出bubble",
el: { bubble: function () {
type: "bi.text_button", return BI.parseInt(Math.random() * 100) % 10 + "提示"
text: "文字按钮", },
height: 30 handler: function () {
} BI.Msg.toast("1111");
}, { },
el: { height: 30
type: "bi.button", }, {
text: "幽灵按钮(common)", type: "bi.button",
ghost: true, text: "图标在上面的按钮,而且可以自动撑开高度",
height: 30 iconCls: "close-font",
} iconGap: 24,
}, { iconPosition: "top"
el: {
type: "bi.button",
iconCls: "plus-font",
text: "幽灵按钮(common)",
ghost: true,
height: 30
}
}, {
el: {
type: "bi.button",
iconCls: "plus-font",
text: "幽灵按钮(common)",
ghost: true,
level: "warning",
height: 30
}
}, {
el: {
type: "bi.button",
iconCls: "plus-font",
text: "幽灵按钮(common)",
ghost: true,
level: "error",
height: 30
}
}, {
el: {
type: "bi.button",
iconCls: "plus-font",
text: "幽灵按钮(common)",
ghost: true,
level: "success",
height: 30
}
}, {
el: {
type: "bi.button",
text: "幽灵按钮(common)灰化",
disabled: true,
ghost: true,
height: 30
}
}, {
el: {
type: "bi.button",
text: "弹出bubble",
bubble: function () {
return BI.parseInt(Math.random() * 100) % 10 + "提示"
},
handler: function () {
BI.Msg.toast("1111");
},
height: 30
}
}, {
el: {
type: "bi.button",
text: "图标在上面的按钮,而且可以自动撑开高度",
iconCls: "close-font",
iconGap: 24,
iconPosition: "top"
}
},{ },{
el: { type: "bi.button",
type: "bi.button", text: "自动撑开高度",
text: "自动撑开高度", iconCls: "close-font",
iconCls: "close-font", textHeight: 32,
textHeight: 32, iconGap: 24,
iconGap: 24, vgap: 16,
vgap: 16, hgap: 100,
hgap: 100, iconPosition: "top"
iconPosition: "top" }, {
} type: "bi.button",
}, { text: "图标在下面的按钮",
el: { iconCls: "close-font",
type: "bi.button", iconPosition: "bottom"
text: "图标在下面的按钮", }, {
iconCls: "close-font", type: "bi.button",
iconPosition: "bottom" text: "图标在左边的按钮",
} iconCls: "close-font",
}, { iconPosition: "left"
el: { }, {
type: "bi.button", type: "bi.button",
text: "图标在左边的按钮", text: "图标在右边的按钮",
iconCls: "close-font", iconCls: "close-font",
iconPosition: "left" iconPosition: "right"
} }, {
}, { type: "bi.button",
el: { text: "浅色的一般按钮",
type: "bi.button", iconCls: "plus-font",
text: "图标在右边的按钮", light: true
iconCls: "close-font", }, {
iconPosition: "right" type: "bi.button",
} text: "浅色的成功按钮",
}, { level: "success",
el: { iconCls: "plus-font",
type: "bi.button", light: true
text: "浅色的一般按钮", }, {
iconCls: "plus-font", type: "bi.button",
light: true text: "浅色的警告按钮",
} level: "warning",
}, { iconCls: "plus-font",
el: { light: true
type: "bi.button", }, {
text: "浅色的成功按钮", type: "bi.button",
level: "success", iconCls: "plus-font",
iconCls: "plus-font", text: "浅色的失败按钮",
light: true level: "error",
} cls: "hover-mask",
}, { light: true
el: { }, {
type: "bi.button", type: "bi.button",
text: "浅色的警告按钮", iconCls: "plus-font",
level: "warning", text: "朴素的按钮",
iconCls: "plus-font", level: "common",
light: true plain: true
} }, {
}, { type: "bi.button",
el: { iconCls: "plus-font",
type: "bi.button", text: "朴素的按钮",
iconCls: "plus-font", level: "success",
text: "浅色的失败按钮", plain: true
level: "error", }, {
cls: "hover-mask", type: "bi.button",
light: true iconCls: "plus-font",
} text: "朴素的按钮",
}, { level: "error",
el: { plain: true
type: "bi.button", }, {
iconCls: "plus-font", type: "bi.button",
text: "朴素的按钮", iconCls: "plus-font",
level: "common", text: "朴素的按钮",
plain: true level: "warning",
} plain: true
}, { }, {
el: { type: "bi.button",
type: "bi.button", iconCls: "plus-font",
iconCls: "plus-font", text: "朴素的按钮",
text: "朴素的按钮", level: "ignore",
level: "success", plain: true
plain: true }, {
} type: "bi.button",
}, { iconCls: "plus-font",
el: { plain: true,
type: "bi.button", level: "error",
iconCls: "plus-font", }, {
text: "朴素的按钮", type: "bi.button",
level: "error", iconCls: "plus-font",
plain: true text: "朴素的按钮",
} plain: true,
}, { disabled: true
el: { }, {
type: "bi.button", type: "bi.button",
iconCls: "plus-font", iconCls: "plus-font",
text: "朴素的按钮", text: "点我,更改图标",
level: "warning", handler() {
plain: true this.i = this.i === undefined ? 0 : ++this.i;
} const arr = ["text-background-font", "check-mark-ha-font", "close-font", "search-font", "date-change-h-font"];
}, { if(this.i >= arr.length) {
el: { this.i = 0;
type: "bi.button", }
iconCls: "plus-font", this.setIcon(arr[this.i]);
text: "朴素的按钮", },
level: "ignore", height: 24
plain: true
}
}, {
el: {
type: "bi.button",
iconCls: "plus-font",
text: "朴素的按钮",
level: "ignore",
plain: true,
disabled: true
}
}, {
el: {
type: "bi.button",
iconCls: "plus-font",
text: "朴素的按钮",
level: "error",
plain: true,
disabled: true
}
}, {
el: {
type: "bi.button",
iconCls: "plus-font",
text: "朴素的按钮",
level: "common",
plain: true,
disabled: true
}
}, {
el: {
type: "bi.button",
iconCls: "plus-font",
text: "点我,更改图标",
handler() {
this.i = this.i === undefined ? 0 : ++this.i;
const arr = ["text-background-font", "check-mark-ha-font", "close-font", "search-font", "date-change-h-font"];
if(this.i >= arr.length) {
this.i = 0;
}
this.setIcon(arr[this.i]);
},
height: 24
}
}]; }];
// BI.each(items, function (i, item) {
// item.el.handler = function () {
// BI.Msg.alert("按钮", this.options.text);
// };
// });
return { return {
type: "bi.left", type: "bi.left",
scrolly: true, scrolly: true,
vgap: 100, vgap: 100,
hgap: 20, hgap: 20,
items: items items: BI.map(items, function (index, value) {
return {
el: value
}
})
}; };
} }
}); });

5
package.json

@ -1,6 +1,6 @@
{ {
"name": "fineui", "name": "fineui",
"version": "2.0.20220630111602", "version": "2.0.20220705215329",
"description": "fineui", "description": "fineui",
"main": "dist/fineui_without_conflict.min.js", "main": "dist/fineui_without_conflict.min.js",
"types": "dist/lib/index.d.ts", "types": "dist/lib/index.d.ts",
@ -84,6 +84,5 @@
"registry": "https://registry.npmjs.org" "registry": "https://registry.npmjs.org"
}, },
"author": "fanruan", "author": "fanruan",
"license": "MIT", "license": "MIT"
"dependencies": {}
} }

12
src/base/combination/group.button.js

@ -197,7 +197,7 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
items = this._packageItems(items, this._packageBtns(this.buttons)); items = this._packageItems(items, this._packageBtns(this.buttons));
} }
this.layouts = BI.createWidget(BI.extend({element: this}, this._packageLayout(items))); this.layouts = BI.createWidget(BI.extend({ element: this }, this._packageLayout(items)));
}, },
setNotSelectedValue: function (v) { setNotSelectedValue: function (v) {
@ -331,6 +331,16 @@ BI.ButtonGroup = BI.inherit(BI.Widget, {
return node; return node;
}, },
/**
* 滚动到指定的节点
*/
scrollToValue: function (value, scrollIntoViewOptions) {
var node = this.getNodeByValue(value);
if (node) {
node.element[0].scrollIntoView(scrollIntoViewOptions);
}
},
empty: function () { empty: function () {
BI.ButtonGroup.superclass.empty.apply(this, arguments); BI.ButtonGroup.superclass.empty.apply(this, arguments);
this.options.items = []; this.options.items = [];

16
src/base/combination/group.virtual.js

@ -96,6 +96,20 @@ BI.VirtualGroup = BI.inherit(BI.Widget, {
return v; return v;
}, },
getNodeByValue: function (value) {
return this.buttonMap[value];
},
/**
* 滚动到指定的节点
*/
scrollToValue: function (value, scrollIntoViewOptions) {
var node = this.getNodeByValue(value);
if (node) {
node.element[0].scrollIntoView(scrollIntoViewOptions);
}
},
getValue: function () { getValue: function () {
var v = []; var v = [];
BI.each(this.buttonMap, function (i, item) { BI.each(this.buttonMap, function (i, item) {
@ -113,7 +127,7 @@ BI.VirtualGroup = BI.inherit(BI.Widget, {
this.options.items = items; this.options.items = items;
items = this._packageBtns(items); items = this._packageBtns(items);
if (!this.layouts) { if (!this.layouts) {
this.layouts = BI.createWidget(BI.extend({element: this}, this._packageLayout(items))); this.layouts = BI.createWidget(BI.extend({ element: this }, this._packageLayout(items)));
} else { } else {
this.layouts.populate(items, { this.layouts.populate(items, {
context: this context: this

16
src/base/list/listview.js

@ -1,5 +1,5 @@
/** /**
* 表示当前对象 * 边滚动边加载的列表控件
* *
* Created by GUY on 2017/5/23. * Created by GUY on 2017/5/23.
* @class BI.ListView * @class BI.ListView
@ -33,8 +33,8 @@ BI.ListView = BI.inherit(BI.Widget, {
items: [BI.extend({ items: [BI.extend({
type: "bi.vertical", type: "bi.vertical",
scrolly: false, scrolly: false,
ref: function () { ref: function (_ref) {
self.container = this; self.container = _ref;
} }
}, o.el)], }, o.el)],
element: this element: this
@ -69,8 +69,8 @@ BI.ListView = BI.inherit(BI.Widget, {
var self = this, o = this.options; var self = this, o = this.options;
var height = this.element.height(); var height = this.element.height();
var minContentHeight = o.scrollTop + height + o.overscanHeight; var minContentHeight = o.scrollTop + height + o.overscanHeight;
var index = (this.cache[this.renderedIndex] && (this.cache[this.renderedIndex].index + o.blockSize)) || 0, var index = (this.cache[this.renderedIndex] && (this.cache[this.renderedIndex].index + o.blockSize)) || 0;
cnt = this.renderedIndex + 1; var cnt = this.renderedIndex + 1;
var lastHeight; var lastHeight;
var getElementHeight = function () { var getElementHeight = function () {
return self.container.element.height(); return self.container.element.height();
@ -112,6 +112,12 @@ BI.ListView = BI.inherit(BI.Widget, {
this.cache = {}; this.cache = {};
}, },
scrollTo: function (scrollTop) {
this.options.scrollTop = scrollTop;
this._calculateBlocksToRender();
this.element.scrollTop(scrollTop);
},
populate: function (items) { populate: function (items) {
if (items && this.options.items !== items) { if (items && this.options.items !== items) {
this.restore(); this.restore();

13
src/base/list/virtualgrouplist.js

@ -62,7 +62,7 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
}) : o.items; }) : o.items;
this._populate(); this._populate();
this.ticking = false; this.ticking = false;
this.element.scroll(function() { this.element.scroll(function () {
o.scrollTop = self.element.scrollTop(); o.scrollTop = self.element.scrollTop();
if (!self.ticking) { if (!self.ticking) {
requestAnimationFrame(function () { requestAnimationFrame(function () {
@ -123,7 +123,7 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
} }
this.bottomBlank.setHeight(this.tree.sumTo(this.renderedIndex) - this.tree.sumTo(Math.min(end, this.renderedIndex))); this.bottomBlank.setHeight(this.tree.sumTo(this.renderedIndex) - this.tree.sumTo(Math.min(end, this.renderedIndex)));
this.container.populate(items.map(function (item, i) { this.container.populate(items.map(function (item, i) {
return o.itemFormatter(item, (start < 0 ? 0 : start) * o.blockSize + i) return o.itemFormatter(item, (start < 0 ? 0 : start) * o.blockSize + i);
})); }));
} else { } else {
for (var i = (start < 0 ? 0 : start); i <= end; i++) { for (var i = (start < 0 ? 0 : start); i <= end; i++) {
@ -134,7 +134,7 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
} }
this.container.element.height(o.rowHeight * o.items.length - topHeight); this.container.element.height(o.rowHeight * o.items.length - topHeight);
this.container.populate(items.map(function (item, i) { this.container.populate(items.map(function (item, i) {
return o.itemFormatter(item, (start < 0 ? 0 : start) * o.blockSize + i) return o.itemFormatter(item, (start < 0 ? 0 : start) * o.blockSize + i);
})); }));
} }
}, },
@ -162,6 +162,13 @@ BI.VirtualGroupList = BI.inherit(BI.Widget, {
this.bottomBlank.setHeight(0); this.bottomBlank.setHeight(0);
}, },
// 暂时只支持固定行高的场景
scrollTo: function (scrollTop) {
this.options.scrollTop = scrollTop;
this._calculateBlocksToRender();
this.element.scrollTop(scrollTop);
},
restore: function () { restore: function () {
this.options.scrollTop = 0; this.options.scrollTop = 0;
this._restore(); this._restore();

9
src/base/list/virtuallist.js

@ -46,7 +46,6 @@ BI.VirtualList = BI.inherit(BI.Widget, {
self.bottomBlank = this; self.bottomBlank = this;
} }
}], }],
element: this
}; };
}, },
@ -78,7 +77,7 @@ BI.VirtualList = BI.inherit(BI.Widget, {
while ((lastHeight = getElementHeight()) < minContentHeight && index < o.items.length) { while ((lastHeight = getElementHeight()) < minContentHeight && index < o.items.length) {
var items = o.items.slice(index, index + o.blockSize); var items = o.items.slice(index, index + o.blockSize);
this.container.addItems(items.map(function (item, i) { this.container.addItems(items.map(function (item, i) {
return o.itemFormatter(item, index + i) return o.itemFormatter(item, index + i);
}), this); }), this);
var addedHeight = getElementHeight() - lastHeight; var addedHeight = getElementHeight() - lastHeight;
this.tree.set(cnt, addedHeight); this.tree.set(cnt, addedHeight);
@ -177,6 +176,12 @@ BI.VirtualList = BI.inherit(BI.Widget, {
this.container.attr("items", []); this.container.attr("items", []);
}, },
scrollTo: function (scrollTop) {
this.options.scrollTop = scrollTop;
this._calculateBlocksToRender();
this.element.scrollTop(scrollTop);
},
restore: function () { restore: function () {
this.renderedIndex = -1; this.renderedIndex = -1;
this._clearChildren(); this._clearChildren();

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

@ -30,12 +30,14 @@
adaptiveHeight += (tGap + bGap); adaptiveHeight += (tGap + bGap);
} }
var clearMinWidth = props.block === true || props.clear === true || props.plain;
return BI.extend(conf, { return BI.extend(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
}, },
minWidth: (props.block === true || props.clear === true) ? 0 : 80, minWidth: clearMinWidth ? 0 : 80,
height: isVertical(props.iconPosition) ? adaptiveHeight : 24, height: isVertical(props.iconPosition) ? adaptiveHeight : 24,
shadow: props.clear !== true, shadow: props.clear !== true,
isShadowShowingOnSelected: true, isShadowShowingOnSelected: true,
@ -64,7 +66,7 @@
}, },
render: function () { render: function () {
var o = this.options; var o = this.options, self = this;
// 由于button默认情况下有个边框,所以要主动算行高 // 由于button默认情况下有个边框,所以要主动算行高
var lineHeight, textHeight = o.textHeight; var lineHeight, textHeight = o.textHeight;
@ -148,24 +150,14 @@
value: o.value value: o.value
}); });
} }
if (o.block === true) { var classArr = ["block", "clear", "ghost", "plain", "loading", "light"];
this.element.addClass("block"); // 如果 options 对应的属性为 true 则给元素添加 class
} BI.each(classArr, function (_, clz) {
if (o.clear === true) { if (BI.get(o, clz) === true) {
this.element.addClass("clear"); self.element.addClass(clz);
} }
if (o.ghost === true) { });
this.element.addClass("ghost");
}
if (o.plain === true) {
this.element.addClass("plain");
}
if (o.loading === true) {
this.element.addClass("loading");
}
if (o.light === true) {
this.element.addClass("light");
}
if (o.minWidth > 0) { if (o.minWidth > 0) {
this.element.css({"min-width": o.minWidth / BI.pixRatio + BI.pixUnit}); this.element.css({"min-width": o.minWidth / BI.pixRatio + BI.pixUnit});
} }

6
src/core/3.ob.js

@ -1,5 +1,5 @@
!(function () { !(function () {
function extend () { function extend() {
var target = arguments[0] || {}, length = arguments.length, i = 1, options, name, src, copy; var target = arguments[0] || {}, length = arguments.length, i = 1, options, name, src, copy;
for (; i < length; i++) { for (; i < length; i++) {
// Only deal with non-null/undefined values // Only deal with non-null/undefined values
@ -90,11 +90,11 @@
//释放当前对象 //释放当前对象
_purgeRef: function () { _purgeRef: function () {
if (this.options.__ref) { if (this.options.__ref) {
this.options.__ref.call(null); this.options.__ref.call(null, null);
this.options.__ref = null; this.options.__ref = null;
} }
if (this.options.ref) { if (this.options.ref) {
this.options.ref.call(null); this.options.ref.call(null, null);
this.options.ref = null; this.options.ref = null;
} }
}, },

2
src/core/4.widget.js

@ -738,6 +738,8 @@
callLifeHook(this, "destroyed"); callLifeHook(this, "destroyed");
this.destroyed = null; this.destroyed = null;
this._isDestroyed = true; this._isDestroyed = true;
// this._purgeRef(); // 清除ref的时机还是要仔细考虑一下
}, },
_unMount: function () { _unMount: function () {

18
src/core/5.inject.js

@ -32,7 +32,7 @@
} }
moduleInjection[xtype] = cls; moduleInjection[xtype] = cls;
} }
return function () { return function () {
return BI.Modules.getModule(xtype); return BI.Modules.getModule(xtype);
}; };
@ -45,7 +45,7 @@
} else { } else {
constantInjection[xtype] = cls; constantInjection[xtype] = cls;
} }
return function () { return function () {
return BI.Constants.getConstant(xtype); return BI.Constants.getConstant(xtype);
}; };
@ -58,7 +58,7 @@
} else { } else {
modelInjection[xtype] = cls; modelInjection[xtype] = cls;
} }
return function (config) { return function (config) {
return BI.Models.getModel(xtype, config); return BI.Models.getModel(xtype, config);
}; };
@ -71,7 +71,7 @@
} else { } else {
storeInjection[xtype] = cls; storeInjection[xtype] = cls;
} }
return function (config) { return function (config) {
return BI.Stores.getStore(xtype, config); return BI.Stores.getStore(xtype, config);
}; };
@ -81,10 +81,10 @@
BI.service = BI.service || function (xtype, cls) { BI.service = BI.service || function (xtype, cls) {
if (serviceInjection[xtype] != null) { if (serviceInjection[xtype] != null) {
_global.console && console.error("service: [" + xtype + "] 已经注册过了"); _global.console && console.error("service: [" + xtype + "] 已经注册过了");
} else {
serviceInjection[xtype] = cls;
} }
serviceInjection[xtype] = cls;
return function (config) { return function (config) {
return BI.Services.getService(xtype, config); return BI.Services.getService(xtype, config);
}; };
@ -97,7 +97,7 @@
} else { } else {
providerInjection[xtype] = cls; providerInjection[xtype] = cls;
} }
return function (config) { return function (config) {
return BI.Providers.getProvider(xtype, config); return BI.Providers.getProvider(xtype, config);
}; };
@ -402,8 +402,6 @@
BI.shortcut = BI.component = BI.shortcut || function (xtype, cls) { BI.shortcut = BI.component = BI.shortcut || function (xtype, cls) {
if (kv[xtype] != null) { if (kv[xtype] != null) {
_global.console && console.error("组件: [" + xtype + "] 已经注册过了"); _global.console && console.error("组件: [" + xtype + "] 已经注册过了");
return;
} }
if (cls) { if (cls) {
cls["xtype"] = xtype; cls["xtype"] = xtype;

21
src/less/base/tree/ztree.less

@ -17,7 +17,7 @@
line-height: 14px; line-height: 14px;
text-align: left; text-align: left;
white-space: pre; white-space: pre;
outline: 0 outline: 0;
} }
.ztree li ul { .ztree li ul {
@ -73,7 +73,7 @@
padding: 0 3px 0 0; padding: 0 3px 0 0;
margin: 0; margin: 0;
cursor: pointer; cursor: pointer;
height: 23px; height: 24px;
background-color: transparent; background-color: transparent;
text-decoration: none; text-decoration: none;
vertical-align: top; vertical-align: top;
@ -94,7 +94,7 @@
} }
.ztree.solid li a { .ztree.solid li a {
height: 31px; height: 32px;
} }
.ztree li a.curSelectedNode { .ztree li a.curSelectedNode {
@ -148,6 +148,21 @@
line-height: 32px; line-height: 32px;
} }
.ztree li span.icon {
display: inline-block;
vertical-align: top;
text-align: center;
width: 24px;
height: 24px;
line-height: 24px;
}
.ztree li span.icon {
width: 32px;
height: 32px;
line-height: 32px;
}
.ztree li span.button { .ztree li span.button {
line-height: 0; line-height: 0;
margin: 0; margin: 0;

2
typescript/base/combination/group.button.ts

@ -40,4 +40,6 @@ export declare class ButtonGroup extends Widget {
getNodeByValue(value: any): any; getNodeByValue(value: any): any;
getValue<T>(): T[]; getValue<T>(): T[];
scrollToValue(value: any, scrollIntoViewOptions?: boolean | Obj): void;
} }

6
typescript/base/combination/group.virtual.ts

@ -3,7 +3,7 @@ import { Widget } from '../../core/widget';
export declare class VirtualGroup extends Widget { export declare class VirtualGroup extends Widget {
static xtype: string; static xtype: string;
static EVENT_CHANGE: string; static EVENT_CHANGE: string;
addItems<T>(items: T[]): void; addItems<T>(items: T[]): void;
prependItems<T>(items: T[]): void; prependItems<T>(items: T[]): void;
@ -13,4 +13,6 @@ export declare class VirtualGroup extends Widget {
getValue<T>(): T[]; getValue<T>(): T[];
populate(items?: any, ...args: any[]): void populate(items?: any, ...args: any[]): void
}
scrollToValue(value: any, scrollIntoViewOptions?: boolean | Obj): void;
}

4
typescript/base/list/listview.ts

@ -1,4 +1,4 @@
import { Widget } from '../../core/widget'; import { Widget } from "../../core/widget";
export declare class ListView extends Widget { export declare class ListView extends Widget {
static xtype: string; static xtype: string;
@ -6,4 +6,6 @@ export declare class ListView extends Widget {
restore(): void; restore(): void;
populate<T>(items: T[]): void; populate<T>(items: T[]): void;
scrollTo(scrollTop: number): void;
} }

11
typescript/base/list/virtualgrouplist.ts

@ -0,0 +1,11 @@
import { Widget } from "../../core/widget";
export declare class VirtualGroupList extends Widget {
static xtype: string;
restore(): void;
populate<T>(items: T[]): void;
scrollTo(scrollTop: number): void;
}

11
typescript/base/list/virtuallist.ts

@ -0,0 +1,11 @@
import { Widget } from "../../core/widget";
export declare class VirtualList extends Widget {
static xtype: string;
restore(): void;
populate<T>(items: T[]): void;
scrollTo(scrollTop: number): void;
}

65
typescript/index.ts

@ -20,12 +20,12 @@ import { IconChangeButton } from "./case/button/icon/icon.change";
import { MultiSelectItem } from "./case/button/item.multiselect"; import { MultiSelectItem } from "./case/button/item.multiselect";
import { BubbleCombo } from "./case/combo/bubblecombo/combo.bubble"; import { BubbleCombo } from "./case/combo/bubblecombo/combo.bubble";
import { TextValueCombo } from "./case/combo/combo.textvalue"; import { TextValueCombo } from "./case/combo/combo.textvalue";
import { SmallTextValueCombo } from './case/combo/combo.textvaluesmall'; import { SmallTextValueCombo } from "./case/combo/combo.textvaluesmall";
import { SearchTextValueCombo } from "./case/combo/searchtextvaluecombo/combo.searchtextvalue"; import { SearchTextValueCombo } from "./case/combo/searchtextvaluecombo/combo.searchtextvalue";
import { SignEditor } from "./case/editor/editor.sign"; import { SignEditor } from "./case/editor/editor.sign";
import { StateEditor } from './case/editor/editor.state'; import { StateEditor } from "./case/editor/editor.state";
import { AllValueMultiTextValueCombo } from "./component/allvaluemultitextvaluecombo/allvalue.multitextvalue.combo"; import { AllValueMultiTextValueCombo } from "./component/allvaluemultitextvaluecombo/allvalue.multitextvalue.combo";
import { Form } from './component/form/form'; import { Form } from "./component/form/form";
import { AbstractTreeValueChooser } from "./component/treevaluechooser/abstract.treevaluechooser"; import { AbstractTreeValueChooser } from "./component/treevaluechooser/abstract.treevaluechooser";
import { AbstractListTreeValueChooser } from "./component/treevaluechooser/abstract.treevaluechooser.list"; import { AbstractListTreeValueChooser } from "./component/treevaluechooser/abstract.treevaluechooser.list";
import { Action, ActionFactory } from "./core/action/action"; import { Action, ActionFactory } from "./core/action/action";
@ -53,7 +53,10 @@ import { DownListCombo } from "./widget/downlist/combo.downlist";
import { DownListPopup } from "./widget/downlist/popup.downlist"; import { DownListPopup } from "./widget/downlist/popup.downlist";
import { Icon } from "./base/single/icon/icon"; import { Icon } from "./base/single/icon/icon";
import { LeftVerticalAdaptLayout } from "./core/wrapper/layout/adapt/adapt.leftvertical"; import { LeftVerticalAdaptLayout } from "./core/wrapper/layout/adapt/adapt.leftvertical";
import { LeftRightVerticalAdaptLayout, RightVerticalAdaptLayout } from "./core/wrapper/layout/adapt/adapt.leftrightvertical"; import {
LeftRightVerticalAdaptLayout,
RightVerticalAdaptLayout,
} from "./core/wrapper/layout/adapt/adapt.leftrightvertical";
import { IconTextIconItem } from "./base/single/button/listitem/icontexticonitem"; import { IconTextIconItem } from "./base/single/button/listitem/icontexticonitem";
import { HorizontalAutoLayout } from "./core/wrapper/layout/adapt/auto.horizontal"; import { HorizontalAutoLayout } from "./core/wrapper/layout/adapt/auto.horizontal";
import { InlineVerticalAdaptLayout } from "./core/wrapper/layout/adapt/inline.vertical"; import { InlineVerticalAdaptLayout } from "./core/wrapper/layout/adapt/inline.vertical";
@ -82,14 +85,14 @@ import { MultiSelectCombo } from "./widget/multiselect/multiselect.combo";
import { SearchEditor } from "./widget/editor/editor.search"; import { SearchEditor } from "./widget/editor/editor.search";
import { MultiLayerSingleLevelTree } from "./widget/multilayersingletree/multilayersingletree.leveltree"; import { MultiLayerSingleLevelTree } from "./widget/multilayersingletree/multilayersingletree.leveltree";
import { SimpleColorChooser } from "./case/colorchooser/colorchooser.simple"; import { SimpleColorChooser } from "./case/colorchooser/colorchooser.simple";
import { ColorChooser } from './case/colorchooser/colorchooser'; import { ColorChooser } from "./case/colorchooser/colorchooser";
import { A } from "./base/a/a"; import { A } from "./base/a/a";
import { Html } from "./base/single/html/html"; import { Html } from "./base/single/html/html";
import { Switcher } from "./base/combination/switcher"; import { Switcher } from "./base/combination/switcher";
import { Expander } from './base/combination/expander'; import { Expander } from "./base/combination/expander";
import { Loader } from "./base/combination/loader"; import { Loader } from "./base/combination/loader";
import { ListPane } from "./case/layer/pane.list"; import { ListPane } from "./case/layer/pane.list";
import { MultiPopupView } from './case/layer/layer.multipopup'; import { MultiPopupView } from "./case/layer/layer.multipopup";
import { MultiSelectBar } from "./case/toolbar/toolbar.multiselect"; import { MultiSelectBar } from "./case/toolbar/toolbar.multiselect";
import { SelectList } from "./case/list/list.select"; import { SelectList } from "./case/list/list.select";
import { AbstractAllValueChooser } from "./component/allvaluechooser/abstract.allvaluechooser"; import { AbstractAllValueChooser } from "./component/allvaluechooser/abstract.allvaluechooser";
@ -130,7 +133,7 @@ import { TextValueDownListCombo } from "./widget/textvaluedownlistcombo/combo.te
import { Switch } from "./case/button/switch"; import { Switch } from "./case/button/switch";
import { HorizontalLayout } from "./core/wrapper/layout/layout.horizontal"; import { HorizontalLayout } from "./core/wrapper/layout/layout.horizontal";
import { ShelterEditor } from "./case/editor/editor.shelter"; import { ShelterEditor } from "./case/editor/editor.shelter";
import { TextTrigger } from './case/trigger/trigger.text'; import { TextTrigger } from "./case/trigger/trigger.text";
import { SelectTextTrigger } from "./case/trigger/trigger.text.select"; import { SelectTextTrigger } from "./case/trigger/trigger.text.select";
import { DateInterval } from "./widget/timeinterval/dateinterval"; import { DateInterval } from "./widget/timeinterval/dateinterval";
import { DynamicDatePane } from "./widget/datepane/datepane"; import { DynamicDatePane } from "./widget/datepane/datepane";
@ -151,43 +154,45 @@ import { Segment } from "./case/segment/segment";
import { LinearSegment } from "./case/linersegment/linear.segment"; import { LinearSegment } from "./case/linersegment/linear.segment";
import { Img } from "./base/single/img/img"; import { Img } from "./base/single/img/img";
import { EditorIconCheckCombo } from "./case/combo/editoriconcheckcombo/combo.editiconcheck"; import { EditorIconCheckCombo } from "./case/combo/editoriconcheckcombo/combo.editiconcheck";
import { IconTextValueCombo } from './case/combo/icontextvaluecombo/combo.icontextvalue'; import { IconTextValueCombo } from "./case/combo/icontextvaluecombo/combo.icontextvalue";
import { ListView } from './base/list/listview'; import { ListView } from "./base/list/listview";
import { FloatCenterLayout } from './core/wrapper/layout/middle/middle.float.center'; import { VirtualList } from "./base/list/virtuallist";
import { _msg } from './base/foundation/message'; import { VirtualGroupList } from "./base/list/virtualgrouplist";
import { _web } from './core/platform/web'; import { FloatCenterLayout } from "./core/wrapper/layout/middle/middle.float.center";
import { DynamicYearMonthPopup } from './widget/yearmonth/popup.yearmonth'; import { _msg } from "./base/foundation/message";
import { _utils } from './core/utils'; import { _web } from "./core/platform/web";
import { DynamicYearMonthPopup } from "./widget/yearmonth/popup.yearmonth";
import { _utils } from "./core/utils";
import { Controller } from "./core/controller/controller"; import { Controller } from "./core/controller/controller";
import { LayerController } from "./core/controller/controller.layer"; import { LayerController } from "./core/controller/controller.layer";
import { DateCalendarPopup } from "./widget/date/calendar/popup.calendar.date"; import { DateCalendarPopup } from "./widget/date/calendar/popup.calendar.date";
import { Tree, Node } from "./core/utils/tree"; import { Tree, Node } from "./core/utils/tree";
import { TextNode } from "./base/single/button/node/textnode"; import { TextNode } from "./base/single/button/node/textnode";
import { TextValueCheckComboPopup } from "./case/combo/textvaluecheckcombo/popup.textvaluecheck"; import { TextValueCheckComboPopup } from "./case/combo/textvaluecheckcombo/popup.textvaluecheck";
import { ImageButton } from './base/single/button/buttons/button.image'; import { ImageButton } from "./base/single/button/buttons/button.image";
import { History, Router } from "./router/router"; import { History, Router } from "./router/router";
import { DateTimeCombo } from './widget/datetime/datetime.combo'; import { DateTimeCombo } from "./widget/datetime/datetime.combo";
import { FloatHorizontalLayout } from "./core/wrapper/layout/adapt/float.horizontal"; import { FloatHorizontalLayout } from "./core/wrapper/layout/adapt/float.horizontal";
import { AdaptiveLayout } from "./core/wrapper/layout/layout.adaptive"; import { AdaptiveLayout } from "./core/wrapper/layout/layout.adaptive";
import { HexColorChooserPopup } from './case/colorchooser/colorchooser.popup.hex'; import { HexColorChooserPopup } from "./case/colorchooser/colorchooser.popup.hex";
import { BlankIconTextItem } from './base/single/button/listitem/blankicontextitem'; import { BlankIconTextItem } from "./base/single/button/listitem/blankicontextitem";
import { Broadcasts, Layers } from "./base/base"; import { Broadcasts, Layers } from "./base/base";
import { BroadcastController } from "./core/controller/controller.broadcast"; import { BroadcastController } from "./core/controller/controller.broadcast";
import { Pager } from "./base/pager/pager"; import { Pager } from "./base/pager/pager";
import { TimeInterval } from './widget/timeinterval/timeinterval'; import { TimeInterval } from "./widget/timeinterval/timeinterval";
import { DynamicDateTimePane } from './widget/datetimepane/datetimepane'; import { DynamicDateTimePane } from "./widget/datetimepane/datetimepane";
import { SingleSelectInsertList } from './widget/singleselect/singleselectlist.insert'; import { SingleSelectInsertList } from "./widget/singleselect/singleselectlist.insert";
import { MultiSelectTree } from './widget/multiselecttree/multiselecttree'; import { MultiSelectTree } from "./widget/multiselecttree/multiselecttree";
import { HtmlLabel } from "./base/single/label/html.label"; import { HtmlLabel } from "./base/single/label/html.label";
import { TreeValueChooserPane } from './component/treevaluechooser/pane.treevaluechooser'; import { TreeValueChooserPane } from "./component/treevaluechooser/pane.treevaluechooser";
import { TdLayout } from './core/wrapper/layout/layout.td'; import { TdLayout } from "./core/wrapper/layout/layout.td";
import { MultiLayerSelectLevelTree } from './widget/multilayerselecttree/multilayerselecttree.leveltree'; import { MultiLayerSelectLevelTree } from "./widget/multilayerselecttree/multilayerselecttree.leveltree";
import { SelectTreeExpander } from './widget/selecttree/selecttree.expander'; import { SelectTreeExpander } from "./widget/selecttree/selecttree.expander";
import { DownListGroupItem } from "./widget/downlist/item.downlistgroup"; import { DownListGroupItem } from "./widget/downlist/item.downlistgroup";
import { VerticalStickyLayout } from "./core/wrapper/layout/sticky/sticky.vertical"; import { VerticalStickyLayout } from "./core/wrapper/layout/sticky/sticky.vertical";
import { HorizontalStickyLayout } from "./core/wrapper/layout/sticky/sticky.horizontal"; import { HorizontalStickyLayout } from "./core/wrapper/layout/sticky/sticky.horizontal";
import { TableLayout } from "./core/wrapper/layout/layout.table"; import { TableLayout } from "./core/wrapper/layout/layout.table";
import './shims-tsx'; import "./shims-tsx";
import { Workers } from "./core/worker/workers"; import { Workers } from "./core/worker/workers";
@ -356,6 +361,8 @@ export interface BI extends _func, _i18n, _base, _inject, _var, _web, _utils {
EditorIconCheckCombo: typeof EditorIconCheckCombo; EditorIconCheckCombo: typeof EditorIconCheckCombo;
IconTextValueCombo: typeof IconTextValueCombo; IconTextValueCombo: typeof IconTextValueCombo;
ListView: typeof ListView; ListView: typeof ListView;
VirtualList: typeof VirtualList;
VirtualGroupList: typeof VirtualGroupList;
FloatCenterLayout: typeof FloatCenterLayout; FloatCenterLayout: typeof FloatCenterLayout;
Msg: _msg; Msg: _msg;
DynamicYearMonthPopup: typeof DynamicYearMonthPopup; DynamicYearMonthPopup: typeof DynamicYearMonthPopup;
@ -550,6 +557,8 @@ export {
EditorIconCheckCombo, EditorIconCheckCombo,
IconTextValueCombo, IconTextValueCombo,
ListView, ListView,
VirtualList,
VirtualGroupList,
FloatCenterLayout, FloatCenterLayout,
DynamicYearMonthPopup, DynamicYearMonthPopup,
DateCalendarPopup, DateCalendarPopup,

Loading…
Cancel
Save