JSX: Functional component support innerElement

This commit is contained in:
pengfei.zhou 2022-07-20 20:51:26 +08:00 committed by osborn
parent e7332f1db1
commit 654b63f3c6
7 changed files with 37 additions and 62 deletions

View File

@ -3056,20 +3056,16 @@ exports.jsx = void 0;
}
else {
var f = constructor;
var e = Reflect.apply(f, undefined, [config]);
if (e instanceof Fragment) {
return children;
}
var args = config !== null && config !== void 0 ? config : {};
if (children && children.length > 0) {
if (children.length === 1) {
children = children[0];
}
if (Reflect.has(e, "innerElement")) {
Reflect.set(e, "innerElement", children, e);
}
else {
throw new Error("Do not support add child for " + e.viewType());
}
args.innerElement = children;
}
var e = Reflect.apply(f, undefined, [args]);
if (e instanceof Fragment) {
return children;
}
return e;
}

View File

@ -2325,20 +2325,16 @@ exports.jsx = void 0;
}
else {
const f = constructor;
const e = Reflect.apply(f, undefined, [config]);
if (e instanceof Fragment) {
return children;
}
const args = config !== null && config !== void 0 ? config : {};
if (children && children.length > 0) {
if (children.length === 1) {
children = children[0];
}
if (Reflect.has(e, "innerElement")) {
Reflect.set(e, "innerElement", children, e);
}
else {
throw new Error(`Do not support add child for ${e.viewType()}`);
}
args.innerElement = children;
}
const e = Reflect.apply(f, undefined, [args]);
if (e instanceof Fragment) {
return children;
}
return e;
}

View File

@ -3855,20 +3855,16 @@ exports.jsx = void 0;
}
else {
const f = constructor;
const e = Reflect.apply(f, undefined, [config]);
if (e instanceof Fragment) {
return children;
}
const args = config !== null && config !== void 0 ? config : {};
if (children && children.length > 0) {
if (children.length === 1) {
children = children[0];
}
if (Reflect.has(e, "innerElement")) {
Reflect.set(e, "innerElement", children, e);
}
else {
throw new Error(`Do not support add child for ${e.viewType()}`);
}
args.innerElement = children;
}
const e = Reflect.apply(f, undefined, [args]);
if (e instanceof Fragment) {
return children;
}
return e;
}

View File

@ -27,20 +27,16 @@ export var jsx;
}
else {
const f = constructor;
const e = Reflect.apply(f, undefined, [config]);
if (e instanceof Fragment) {
return children;
}
const args = config !== null && config !== void 0 ? config : {};
if (children && children.length > 0) {
if (children.length === 1) {
children = children[0];
}
if (Reflect.has(e, "innerElement")) {
Reflect.set(e, "innerElement", children, e);
}
else {
throw new Error(`Do not support add child for ${e.viewType()}`);
}
args.innerElement = children;
}
const e = Reflect.apply(f, undefined, [args]);
if (e instanceof Fragment) {
return children;
}
return e;
}

View File

@ -32,21 +32,16 @@ export namespace jsx {
return e;
} else {
const f = constructor as Function
const e = Reflect.apply(f, undefined, [config])
if (e instanceof Fragment) {
return children
}
const args = config ?? {}
if (children && children.length > 0) {
if (children.length === 1) {
children = children[0]
}
if (Reflect.has(e, "innerElement")) {
Reflect.set(e, "innerElement", children, e)
} else {
throw new Error(
`Do not support add child for ${e.viewType()}`
);
}
(args as any).innerElement = children
}
const e = Reflect.apply(f, undefined, [args])
if (e instanceof Fragment) {
return children
}
return e
}

View File

@ -3929,20 +3929,16 @@ exports.jsx = void 0;
}
else {
const f = constructor;
const e = Reflect.apply(f, undefined, [config]);
if (e instanceof Fragment) {
return children;
}
const args = config !== null && config !== void 0 ? config : {};
if (children && children.length > 0) {
if (children.length === 1) {
children = children[0];
}
if (Reflect.has(e, "innerElement")) {
Reflect.set(e, "innerElement", children, e);
}
else {
throw new Error(`Do not support add child for ${e.viewType()}`);
}
args.innerElement = children;
}
const e = Reflect.apply(f, undefined, [args]);
if (e instanceof Fragment) {
return children;
}
return e;
}

File diff suppressed because one or more lines are too long