Browse Source

Merge pull request #40809 in DEC/fineui from master to feature/x

* commit '1bd3acbc4c38787866ca3b02760be13969c0aa50':
  JSY-17842 fix: 解决LIST_ITEM_HEIGHT对线的影响
  无JIRA 整理去掉无用代码
  DESIGN-4160 feat: 复选树节点,某一个节点支持灰化,复选框也灰化,并且前边的展开收起是正常的
es6
superman 3 years ago
parent
commit
34d295fb44
  1. 114
      dist/fix/fix.js
  2. 4
      src/case/tree/treeexpander/tree.expander.popup.js
  3. 6
      src/case/ztree/0.treeview.js
  4. 9
      src/case/ztree/1.asynctree.js
  5. 44
      src/less/base/tree/tree.expander.less

114
dist/fix/fix.js vendored

@ -11,47 +11,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
return typeof Ctor === 'function' && /native code/.test(Ctor.toString()); return typeof Ctor === 'function' && /native code/.test(Ctor.toString());
} }
var rhashcode = /\d\.\d{4}/;
//生成UUID http://stackoverflow.com/questions/105034/how-to-create-a-guid-uuid-in-javascript
function makeHashCode(prefix) {
/* istanbul ignore next*/
prefix = prefix || 'bi';
/* istanbul ignore next*/
return String(Math.random() + Math.random()).replace(rhashcode, prefix);
}
var hasProto = '__proto__' in {}; var hasProto = '__proto__' in {};
var isIE = function isIE() {
if (typeof navigator === "undefined") {
return false;
}
return (/(msie|trident)/i.test(navigator.userAgent.toLowerCase())
);
};
var getIEVersion = function getIEVersion() {
var version = 0;
if (typeof navigator === "undefined") {
return false;
}
var agent = navigator.userAgent.toLowerCase();
var v1 = agent.match(/(?:msie\s([\w.]+))/);
var v2 = agent.match(/(?:trident.*rv:([\w.]+))/);
if (v1 && v2 && v1[1] && v2[1]) {
version = Math.max(v1[1] * 1, v2[1] * 1);
} else if (v1 && v1[1]) {
version = v1[1] * 1;
} else if (v2 && v2[1]) {
version = v2[1] * 1;
} else {
version = 0;
}
return version;
};
var isIE9Below = isIE() && getIEVersion() < 9;
var _toString = Object.prototype.toString; var _toString = Object.prototype.toString;
function isPlainObject(obj) { function isPlainObject(obj) {
@ -266,7 +227,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
var createViewModel = Object.defineProperties; var createViewModel = Object.defineProperties;
var defineProperty = void 0; var defineProperty = void 0;
var timeBucket = new Date() - 0;
/* istanbul ignore if*/ /* istanbul ignore if*/
if (!canHideProperty) { if (!canHideProperty) {
if ('__defineGetter__' in {}) { if ('__defineGetter__' in {}) {
@ -291,76 +251,6 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
return obj; return obj;
}; };
} }
/* istanbul ignore if*/
if (isIE9Below) {
var VBClassPool = {};
window.execScript([// jshint ignore:line
'Function parseVB(code)', '\tExecuteGlobal(code)', 'End Function' //转换一段文本为VB代码
].join('\n'), 'VBScript');
var VBMediator = function VBMediator(instance, accessors, name, value) {
// jshint ignore:line
var accessor = accessors[name];
if (arguments.length === 4) {
accessor.set.call(instance, value);
} else {
return accessor.get.call(instance);
}
};
createViewModel = function createViewModel(name, accessors, properties) {
// jshint ignore:line
var buffer = [];
buffer.push('\tPrivate [$vbsetter]', '\tPublic [$accessors]', '\tPublic Default Function [$vbthis](ac' + timeBucket + ', s' + timeBucket + ')', '\t\tSet [$accessors] = ac' + timeBucket + ': set [$vbsetter] = s' + timeBucket, '\t\tSet [$vbthis] = Me', //链式调用
'\tEnd Function');
//添加普通属性,因为VBScript对象不能像JS那样随意增删属性,必须在这里预先定义好
var uniq = {
$vbthis: true,
$vbsetter: true,
$accessors: true
};
for (name in $$skipArray) {
if (!uniq[name]) {
buffer.push('\tPublic [' + name + ']');
uniq[name] = true;
}
}
//添加访问器属性
for (name in accessors) {
if (uniq[name]) {
continue;
}
uniq[name] = true;
buffer.push(
//由于不知对方会传入什么,因此set, let都用上
'\tPublic Property Let [' + name + '](val' + timeBucket + ')', //setter
'\t\tCall [$vbsetter](Me, [$accessors], "' + name + '", val' + timeBucket + ')', '\tEnd Property', '\tPublic Property Set [' + name + '](val' + timeBucket + ')', //setter
'\t\tCall [$vbsetter](Me, [$accessors], "' + name + '", val' + timeBucket + ')', '\tEnd Property', '\tPublic Property Get [' + name + ']', //getter
'\tOn Error Resume Next', //必须优先使用set语句,否则它会误将数组当字符串返回
'\t\tSet[' + name + '] = [$vbsetter](Me, [$accessors],"' + name + '")', '\tIf Err.Number <> 0 Then', '\t\t[' + name + '] = [$vbsetter](Me, [$accessors],"' + name + '")', '\tEnd If', '\tOn Error Goto 0', '\tEnd Property');
}
for (name in properties) {
if (!uniq[name]) {
uniq[name] = true;
buffer.push('\tPublic [' + name + ']');
}
}
buffer.push('\tPublic [hasOwnProperty]');
buffer.push('End Class');
var body = buffer.join('\r\n');
var className = VBClassPool[body];
if (!className) {
className = makeHashCode('VBClass');
window.parseVB('Class ' + className + body);
window.parseVB(['Function ' + className + 'Factory(acc, vbm)', //创建实例并传入两个关键的参数
'\tDim o', '\tSet o = (New ' + className + ')(acc, vbm)', '\tSet ' + className + 'Factory = o', 'End Function'].join('\r\n'));
VBClassPool[body] = className;
}
var ret = window[className + 'Factory'](accessors, VBMediator); //得到其产品
return ret; //得到其产品
};
}
} }
var createViewModel$1 = createViewModel; var createViewModel$1 = createViewModel;
@ -700,12 +590,8 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons
} else { } else {
this.model = this.walk(value); this.model = this.walk(value);
} }
if (isIE9Below) {
this.model['__ob__'] = this;
} else {
def(this.model, "__ob__", this); def(this.model, "__ob__", this);
} }
}
Observer.prototype.walk = function walk(obj) { Observer.prototype.walk = function walk(obj) {
return defineReactive(obj, this); return defineReactive(obj, this);

4
src/case/tree/treeexpander/tree.expander.popup.js

@ -22,8 +22,8 @@
this.popupView.on(BI.Controller.EVENT_CHANGE, function () { this.popupView.on(BI.Controller.EVENT_CHANGE, function () {
self.fireEvent(BI.Controller.EVENT_CHANGE, arguments); self.fireEvent(BI.Controller.EVENT_CHANGE, arguments);
}); });
this.popupView.element.css("margin-left", -offset * o.layer); this.popupView.element.css("margin-left", -offset * (o.layer + 1));
this.element.css("margin-left", offset * o.layer); this.element.css("margin-left", offset * (o.layer + 1));
return { return {
type: "bi.vertical", type: "bi.vertical",

6
src/case/ztree/0.treeview.js

@ -225,16 +225,10 @@ BI.TreeView = BI.inherit(BI.Pane, {
} }
function onExpand(event, treeId, treeNode) { function onExpand(event, treeId, treeNode) {
if (treeNode.disabled) {
return false;
}
treeNode.halfCheck = false; treeNode.halfCheck = false;
} }
function onCollapse(event, treeId, treeNode) { function onCollapse(event, treeId, treeNode) {
if (treeNode.disabled) {
return false;
}
} }
return setting; return setting;

9
src/case/ztree/1.asynctree.js

@ -104,9 +104,6 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
} }
function beforeExpand(treeId, treeNode) { function beforeExpand(treeId, treeNode) {
if (treeNode.disabled) {
return false;
}
self._beforeExpandNode(treeId, treeNode); self._beforeExpandNode(treeId, treeNode);
} }
@ -118,16 +115,10 @@ BI.AsyncTree = BI.inherit(BI.TreeView, {
} }
function onExpand(event, treeId, treeNode) { function onExpand(event, treeId, treeNode) {
if (treeNode.disabled) {
return false;
}
treeNode.halfCheck = false; treeNode.halfCheck = false;
} }
function onCollapse(event, treeId, treeNode) { function onCollapse(event, treeId, treeNode) {
if (treeNode.disabled) {
return false;
}
treeNode.halfCheck = false; treeNode.halfCheck = false;
} }

44
src/less/base/tree/tree.expander.less

@ -1,28 +1,42 @@
@import "../../index.less"; @import "../../index.less";
@import "../../image.less";
@import "../../lib/icon.less"; @import "../../lib/icon.less";
.bi-tree-expander-popup.line:before {
.bi-tree-expander-popup.line {
&:before {
border-left: 1px dashed @border-color-dark-gray-line;
position: absolute; position: absolute;
content: ""; content: "";
height: 100%; height: 100%;
width: 24px; left: -1px;
.imagePath(@icon-tree-vertical-line-1, 0, 0, repeat-y);
} }
.bi-tree-expander-popup.line.solid:before { &.solid:before {
.imagePath(@icon-tree-solid-vertical-line-1, 0, 0, repeat-y); border-left: 1px solid @border-color-dark-gray-line;
width: 24px; position: absolute;
left: 8px; content: "";
height: 100%;
left: -1px;
}
} }
.bi-theme-dark { .bi-theme-dark {
.bi-tree-expander-popup.line:before { .bi-tree-expander-popup.line {
width: 24px;
.imagePath(@icon-tree-vertical-line-1-theme-dark, 0, 0, repeat-y); &:before {
border-left: 1px dashed @border-color-dark-gray-line-theme-dark;
position: absolute;
content: "";
height: 100%;
left: -1px;
}
&.solid:before {
border-left: 1px solid @border-color-dark-gray-line-theme-dark;
position: absolute;
content: "";
height: 100%;
left: -1px;
} }
.bi-tree-expander-popup.line.solid:before {
.imagePath(@icon-tree-solid-vertical-line-1-theme-dark, 0, 0, repeat-y);
width: 24px;
left: 8px;
} }
} }

Loading…
Cancel
Save