tsx:add fragment support
This commit is contained in:
23
doric-web/dist/index.js
vendored
23
doric-web/dist/index.js
vendored
@@ -3638,8 +3638,9 @@ exports.Display = void 0;
|
||||
Display[Display["NONE"] = 1] = "NONE";
|
||||
})(exports.Display || (exports.Display = {}));
|
||||
|
||||
const jsx = {
|
||||
createElement: function (constructor, config, ...children) {
|
||||
exports.jsx = void 0;
|
||||
(function (jsx) {
|
||||
function createElement(constructor, config, ...children) {
|
||||
const e = new constructor();
|
||||
e.layoutConfig = layoutConfig().fit();
|
||||
if (config) {
|
||||
@@ -3647,15 +3648,26 @@ const jsx = {
|
||||
}
|
||||
if (children && children.length > 0) {
|
||||
if (e instanceof Group) {
|
||||
children.forEach((child) => e.addChild(child));
|
||||
children.forEach((child) => {
|
||||
if (child instanceof Fragment) {
|
||||
child.children.forEach(c => e.addChild(c));
|
||||
}
|
||||
else {
|
||||
e.addChild(child);
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
throw new Error(`Can only add child to group view, do not support ${constructor.name}`);
|
||||
}
|
||||
}
|
||||
return e;
|
||||
},
|
||||
};
|
||||
}
|
||||
jsx.createElement = createElement;
|
||||
class Fragment extends Group {
|
||||
}
|
||||
jsx.Fragment = Fragment;
|
||||
})(exports.jsx || (exports.jsx = {}));
|
||||
|
||||
var __decorate$4 = (undefined && undefined.__decorate) || function (decorators, target, key, desc) {
|
||||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
||||
@@ -4738,7 +4750,6 @@ exports.hlayout = hlayout;
|
||||
exports.image = image;
|
||||
exports.input = input;
|
||||
exports.internalScheme = internalScheme;
|
||||
exports.jsx = jsx;
|
||||
exports.keyboard = keyboard;
|
||||
exports.layoutConfig = layoutConfig;
|
||||
exports.list = list;
|
||||
|
2
doric-web/dist/index.js.map
vendored
2
doric-web/dist/index.js.map
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user