Browse Source
Merge in VISUAL/fineui from ~ZHENFEI.LI/fineui:es6 to es6 * commit '7ae79f12e34d873a2f4c058cf2fe3d880c8eb2a0': KERNEL-14001 refactor: plguin、system等es6
Zhenfei.Li-李振飞
2 years ago
8 changed files with 330 additions and 298 deletions
@ -1,9 +1,21 @@ |
|||||||
|
// export * from "../../typescript/core/decorator/decorator.ts";
|
||||||
|
|
||||||
|
import { shortcut as biShortcut, provider as biProvider } from "./5.inject"; |
||||||
|
|
||||||
/** |
/** |
||||||
* 注册widget |
* 注册widget |
||||||
*/ |
*/ |
||||||
import { shortcut as biShortcut } from "./5.inject"; |
|
||||||
export function shortcut() { |
export function shortcut() { |
||||||
return function decorator(Target) { |
return function decorator(Target) { |
||||||
biShortcut(Target.xtype, Target); |
biShortcut(Target.xtype, Target); |
||||||
}; |
}; |
||||||
} |
} |
||||||
|
|
||||||
|
/** |
||||||
|
* 注册provider |
||||||
|
*/ |
||||||
|
export function provider() { |
||||||
|
return function decorator(Target) { |
||||||
|
biProvider(Target.xtype, Target); |
||||||
|
}; |
||||||
|
} |
||||||
|
@ -1,58 +1,59 @@ |
|||||||
BI.Fragment = function () { |
import { isNotNull, isArray, isFunction, isKey, extend } from "./2.base"; |
||||||
}; |
|
||||||
|
|
||||||
BI.h = function (type, props, children) { |
export function Fragment () {} |
||||||
if (children != null) { |
|
||||||
if (!BI.isArray(children)) { |
export function h (type, props, children) { |
||||||
|
if (isNotNull(children)) { |
||||||
|
if (!isArray(children)) { |
||||||
children = [children]; |
children = [children]; |
||||||
} |
} |
||||||
} else { |
} else { |
||||||
children = []; |
children = []; |
||||||
} |
} |
||||||
if (arguments.length > 3) { |
if (arguments.length > 3) { |
||||||
for (var i = 3; i < arguments.length; i++) { |
for (let i = 3; i < arguments.length; i++) { |
||||||
if (BI.isArray(arguments[i])) { |
if (isArray(arguments[i])) { |
||||||
children = children.concat(arguments[i]); |
children = children.concat(arguments[i]); |
||||||
} else { |
} else { |
||||||
children.push(arguments[i]); |
children.push(arguments[i]); |
||||||
} |
} |
||||||
} |
} |
||||||
} |
} |
||||||
if (type === BI.Fragment) { |
if (type === Fragment) { |
||||||
return children; |
return children; |
||||||
} |
} |
||||||
if (BI.isFunction(type)) { |
if (isFunction(type)) { |
||||||
type = type.xtype || type; |
type = type.xtype || type; |
||||||
} |
} |
||||||
if (type === "el") { |
if (type === "el") { |
||||||
return BI.extend({ |
return extend({ |
||||||
el: children[0] |
el: children[0], |
||||||
}, props); |
}, props); |
||||||
} |
} |
||||||
if (type === "left") { |
if (type === "left") { |
||||||
return BI.extend({ |
return extend({ |
||||||
left: children |
left: children, |
||||||
}, props); |
}, props); |
||||||
} |
} |
||||||
if (type === "right") { |
if (type === "right") { |
||||||
return BI.extend({ |
return extend({ |
||||||
right: children |
right: children, |
||||||
}, props); |
}, props); |
||||||
} |
} |
||||||
if (children.length === 1) { |
if (children.length === 1) { |
||||||
if (BI.isKey(children[0])) { |
if (isKey(children[0])) { |
||||||
return BI.extend({ |
return extend({ |
||||||
type: type |
type, |
||||||
}, { text: children[0] }, props); |
}, { text: children[0] }, props); |
||||||
} |
} |
||||||
if (BI.isFunction(children[0])) { |
if (isFunction(children[0])) { |
||||||
return BI.extend({ |
return extend({ |
||||||
type: type |
type, |
||||||
}, { items: children[0] }, props); |
}, { items: children[0] }, props); |
||||||
} |
} |
||||||
} |
} |
||||||
|
|
||||||
return BI.extend({ |
return extend({ |
||||||
type: type |
type, |
||||||
}, children.length > 0 ? { items: children } : {}, props); |
}, children.length > 0 ? { items: children } : {}, props); |
||||||
}; |
} |
||||||
|
Loading…
Reference in new issue