Do not overwrite layoutconfig if it already had one

This commit is contained in:
pengfei.zhou 2022-08-04 14:12:59 +08:00 committed by osborn
parent d886458832
commit ea6e079b4f
5 changed files with 9 additions and 5 deletions

View File

@ -3028,6 +3028,7 @@ exports.jsx = void 0;
function createElement(constructor, config) { function createElement(constructor, config) {
var arguments$1 = arguments; var arguments$1 = arguments;
var _a;
var children = []; var children = [];
for (var _i = 2; _i < arguments.length; _i++) { for (var _i = 2; _i < arguments.length; _i++) {
children[_i - 2] = arguments$1[_i]; children[_i - 2] = arguments$1[_i];
@ -3037,7 +3038,7 @@ exports.jsx = void 0;
if (e instanceof Fragment) { if (e instanceof Fragment) {
return children; return children;
} }
e.layoutConfig = layoutConfig().fit(); e.layoutConfig = (_a = e.layoutConfig) !== null && _a !== void 0 ? _a : layoutConfig().fit();
if (config) { if (config) {
e.apply(config); e.apply(config);
} }

View File

@ -2301,12 +2301,13 @@ exports.Display = void 0;
exports.jsx = void 0; exports.jsx = void 0;
(function (jsx) { (function (jsx) {
function createElement(constructor, config, ...children) { function createElement(constructor, config, ...children) {
var _a;
if (!!constructor.isViewClass) { if (!!constructor.isViewClass) {
const e = new constructor(); const e = new constructor();
if (e instanceof Fragment) { if (e instanceof Fragment) {
return children; return children;
} }
e.layoutConfig = layoutConfig().fit(); e.layoutConfig = (_a = e.layoutConfig) !== null && _a !== void 0 ? _a : layoutConfig().fit();
if (config) { if (config) {
e.apply(config); e.apply(config);
} }

View File

@ -3831,12 +3831,13 @@ exports.Display = void 0;
exports.jsx = void 0; exports.jsx = void 0;
(function (jsx) { (function (jsx) {
function createElement(constructor, config, ...children) { function createElement(constructor, config, ...children) {
var _a;
if (!!constructor.isViewClass) { if (!!constructor.isViewClass) {
const e = new constructor(); const e = new constructor();
if (e instanceof Fragment) { if (e instanceof Fragment) {
return children; return children;
} }
e.layoutConfig = layoutConfig().fit(); e.layoutConfig = (_a = e.layoutConfig) !== null && _a !== void 0 ? _a : layoutConfig().fit();
if (config) { if (config) {
e.apply(config); e.apply(config);
} }

View File

@ -3,12 +3,13 @@ import { layoutConfig } from "./layoutconfig";
export var jsx; export var jsx;
(function (jsx) { (function (jsx) {
function createElement(constructor, config, ...children) { function createElement(constructor, config, ...children) {
var _a;
if (!!constructor.isViewClass) { if (!!constructor.isViewClass) {
const e = new constructor(); const e = new constructor();
if (e instanceof Fragment) { if (e instanceof Fragment) {
return children; return children;
} }
e.layoutConfig = layoutConfig().fit(); e.layoutConfig = (_a = e.layoutConfig) !== null && _a !== void 0 ? _a : layoutConfig().fit();
if (config) { if (config) {
e.apply(config); e.apply(config);
} }

View File

@ -13,7 +13,7 @@ export namespace jsx {
if (e instanceof Fragment) { if (e instanceof Fragment) {
return children return children
} }
e.layoutConfig = layoutConfig().fit() e.layoutConfig = e.layoutConfig ?? layoutConfig().fit()
if (config) { if (config) {
e.apply(config) e.apply(config)
} }