fix: layout() cannot effect configMaxWidth or configMinWidth

This commit is contained in:
pengfei.zhou 2022-03-22 17:04:59 +08:00 committed by osborn
parent a19c327743
commit 809bc5ef0e
10 changed files with 1715 additions and 3105 deletions

View File

@ -68,7 +68,7 @@ var Mutable = /** @class */ (function () {
*/ */
var __uniqueId__ = 0; var __uniqueId__ = 0;
function uniqueId(prefix) { function uniqueId(prefix) {
return "__".concat(prefix, "_").concat(__uniqueId__++, "__"); return "__" + prefix + "_" + __uniqueId__++ + "__";
} }
function toString(message) { function toString(message) {
@ -177,11 +177,11 @@ var __values$5 = (undefined && undefined.__values) || function(o) {
function Property(target, propKey) { function Property(target, propKey) {
Object.defineProperty(target, propKey, { Object.defineProperty(target, propKey, {
get: function () { get: function () {
return Reflect.get(this, "__prop__".concat(propKey), this); return Reflect.get(this, "__prop__" + propKey, this);
}, },
set: function (v) { set: function (v) {
var oldV = Reflect.get(this, "__prop__".concat(propKey), this); var oldV = Reflect.get(this, "__prop__" + propKey, this);
Reflect.set(this, "__prop__".concat(propKey), v, this); Reflect.set(this, "__prop__" + propKey, v, this);
if (oldV !== v) { if (oldV !== v) {
Reflect.apply(this.onPropertyChanged, this, [propKey, oldV, v]); Reflect.apply(this.onPropertyChanged, this, [propKey, oldV, v]);
} }
@ -191,11 +191,11 @@ function Property(target, propKey) {
function InconsistProperty(target, propKey) { function InconsistProperty(target, propKey) {
Object.defineProperty(target, propKey, { Object.defineProperty(target, propKey, {
get: function () { get: function () {
return Reflect.get(this, "__prop__".concat(propKey), this); return Reflect.get(this, "__prop__" + propKey, this);
}, },
set: function (v) { set: function (v) {
var oldV = Reflect.get(this, "__prop__".concat(propKey), this); var oldV = Reflect.get(this, "__prop__" + propKey, this);
Reflect.set(this, "__prop__".concat(propKey), v, this); Reflect.set(this, "__prop__" + propKey, v, this);
Reflect.apply(this.onPropertyChanged, this, [propKey, oldV, v]); Reflect.apply(this.onPropertyChanged, this, [propKey, oldV, v]);
}, },
}); });
@ -373,7 +373,7 @@ var View = /** @class */ (function () {
return Reflect.apply(f, this, argumentsList); return Reflect.apply(f, this, argumentsList);
} }
else { else {
loge("Cannot find callback:".concat(id, " for ").concat(JSON.stringify(this.toModel()))); loge("Cannot find callback:" + id + " for " + JSON.stringify(this.toModel()));
} }
}; };
View.prototype.toModel = function () { View.prototype.toModel = function () {
@ -714,7 +714,7 @@ var Group = /** @class */ (function (_super) {
this.addChild(e); this.addChild(e);
} }
else { else {
loge("Not allowed to add ".concat(typeof e)); loge("Not allowed to add " + typeof e);
} }
}; };
Object.defineProperty(Group.prototype, "innerElement", { Object.defineProperty(Group.prototype, "innerElement", {
@ -902,6 +902,10 @@ var LayoutConfigImpl = /** @class */ (function () {
margin: this.margin, margin: this.margin,
alignment: this.alignment ? this.alignment.toModel() : undefined, alignment: this.alignment ? this.alignment.toModel() : undefined,
weight: this.weight, weight: this.weight,
minWidth: this.minWidth,
maxWidth: this.maxWidth,
minHeight: this.minHeight,
maxHeight: this.maxHeight
}; };
}; };
return LayoutConfigImpl; return LayoutConfigImpl;
@ -1225,7 +1229,7 @@ var Panel = /** @class */ (function () {
var v = this.retrospectView(viewIds); var v = this.retrospectView(viewIds);
if (v === undefined) { if (v === undefined) {
loge("Cannot find view for ".concat(viewIds)); loge("Cannot find view for " + viewIds);
} }
else { else {
var argumentsList = [callbackId]; var argumentsList = [callbackId];
@ -1427,7 +1431,7 @@ var Color = /** @class */ (function () {
} }
Color.parse = function (str) { Color.parse = function (str) {
if (!str.startsWith("#")) { if (!str.startsWith("#")) {
throw new Error("Parse color error with ".concat(str)); throw new Error("Parse color error with " + str);
} }
var val = parseInt(str.substr(1), 16); var val = parseInt(str.substr(1), 16);
if (str.length === 7) { if (str.length === 7) {
@ -1437,7 +1441,7 @@ var Color = /** @class */ (function () {
return new Color(val); return new Color(val);
} }
else { else {
throw new Error("Parse color error with ".concat(str)); throw new Error("Parse color error with " + str);
} }
}; };
Color.safeParse = function (str, defVal) { Color.safeParse = function (str, defVal) {
@ -2240,7 +2244,7 @@ var MainBundleResource = /** @class */ (function (_super) {
var BundleResource = /** @class */ (function (_super) { var BundleResource = /** @class */ (function (_super) {
__extends$f(BundleResource, _super); __extends$f(BundleResource, _super);
function BundleResource(bundleName, fileName) { function BundleResource(bundleName, fileName) {
return _super.call(this, "bundle", "".concat(bundleName, "://").concat(fileName)) || this; return _super.call(this, "bundle", bundleName + "://" + fileName) || this;
} }
return BundleResource; return BundleResource;
}(iOSResource)); }(iOSResource));
@ -2523,7 +2527,7 @@ var List = /** @class */ (function (_super) {
List.prototype.getItem = function (itemIdx) { List.prototype.getItem = function (itemIdx) {
var view = this.renderItem(itemIdx); var view = this.renderItem(itemIdx);
view.superview = this; view.superview = this;
this.cachedViews.set("".concat(itemIdx), view); this.cachedViews.set("" + itemIdx, view);
return view; return view;
}; };
List.prototype.renderBunchedItems = function (start, length) { List.prototype.renderBunchedItems = function (start, length) {
@ -2657,7 +2661,7 @@ var Slider = /** @class */ (function (_super) {
Slider.prototype.getItem = function (itemIdx) { Slider.prototype.getItem = function (itemIdx) {
var view = this.renderPage(itemIdx); var view = this.renderPage(itemIdx);
view.superview = this; view.superview = this;
this.cachedViews.set("".concat(itemIdx), view); this.cachedViews.set("" + itemIdx, view);
return view; return view;
}; };
Slider.prototype.renderBunchedItems = function (start, length) { Slider.prototype.renderBunchedItems = function (start, length) {
@ -3021,7 +3025,7 @@ exports.jsx = void 0;
Reflect.set(e, "innerElement", children, e); Reflect.set(e, "innerElement", children, e);
} }
else { else {
throw new Error("Do not support ".concat(constructor.name, " for ").concat(children)); throw new Error("Do not support " + constructor.name + " for " + children);
} }
} }
return e; return e;
@ -3139,7 +3143,7 @@ var FlowLayout = /** @class */ (function (_super) {
FlowLayout.prototype.getItem = function (itemIdx) { FlowLayout.prototype.getItem = function (itemIdx) {
var view = this.renderItem(itemIdx); var view = this.renderItem(itemIdx);
view.superview = this; view.superview = this;
this.cachedViews.set("".concat(itemIdx), view); this.cachedViews.set("" + itemIdx, view);
return view; return view;
}; };
FlowLayout.prototype.renderBunchedItems = function (start, length) { FlowLayout.prototype.renderBunchedItems = function (start, length) {
@ -3820,7 +3824,7 @@ function navbar(context) {
} }
function internalScheme(context, panelClass) { function internalScheme(context, panelClass) {
return "_internal_://export?class=".concat(encodeURIComponent(panelClass.name), "&context=").concat(context.id); return "_internal_://export?class=" + encodeURIComponent(panelClass.name) + "&context=" + context.id;
} }
function navigator(context) { function navigator(context) {
var moduleName = "navigator"; var moduleName = "navigator";
@ -3860,9 +3864,9 @@ function transformRequest(request) {
if (request.params !== undefined) { if (request.params !== undefined) {
var queryStrings = []; var queryStrings = [];
for (var key in request.params) { for (var key in request.params) {
queryStrings.push("".concat(key, "=").concat(encodeURIComponent(request.params[key]))); queryStrings.push(key + "=" + encodeURIComponent(request.params[key]));
} }
request.url = "".concat(request.url).concat(url.indexOf('?') >= 0 ? '&' : '?').concat(queryStrings.join('&')); request.url = "" + request.url + (url.indexOf('?') >= 0 ? '&' : '?') + queryStrings.join('&');
} }
if (typeof request.data === 'object') { if (typeof request.data === 'object') {
request.data = JSON.stringify(request.data); request.data = JSON.stringify(request.data);
@ -4138,7 +4142,7 @@ function animate(context) {
} }
else { else {
return function (args) { return function (args) {
return Promise.reject("Cannot find panel in Context:".concat(context.id)); return Promise.reject("Cannot find panel in Context:" + context.id);
}; };
} }
} }

View File

@ -754,6 +754,10 @@ class LayoutConfigImpl {
margin: this.margin, margin: this.margin,
alignment: this.alignment ? this.alignment.toModel() : undefined, alignment: this.alignment ? this.alignment.toModel() : undefined,
weight: this.weight, weight: this.weight,
minWidth: this.minWidth,
maxWidth: this.maxWidth,
minHeight: this.minHeight,
maxHeight: this.maxHeight
}; };
} }
} }

File diff suppressed because it is too large Load Diff

View File

@ -2282,6 +2282,10 @@ class LayoutConfigImpl {
margin: this.margin, margin: this.margin,
alignment: this.alignment ? this.alignment.toModel() : undefined, alignment: this.alignment ? this.alignment.toModel() : undefined,
weight: this.weight, weight: this.weight,
minWidth: this.minWidth,
maxWidth: this.maxWidth,
minHeight: this.minHeight,
maxHeight: this.maxHeight
}; };
} }
} }

4
doric-js/index.d.ts vendored
View File

@ -1553,6 +1553,10 @@ declare module 'doric/lib/src/util/layoutconfig' {
} | undefined; } | undefined;
alignment: number | undefined; alignment: number | undefined;
weight: number | undefined; weight: number | undefined;
minWidth: number | undefined;
maxWidth: number | undefined;
minHeight: number | undefined;
maxHeight: number | undefined;
}; };
} }
export function layoutConfig(): LayoutConfigImpl; export function layoutConfig(): LayoutConfigImpl;

View File

@ -79,6 +79,10 @@ export declare class LayoutConfigImpl implements LayoutConfig, Modeling {
} | undefined; } | undefined;
alignment: number | undefined; alignment: number | undefined;
weight: number | undefined; weight: number | undefined;
minWidth: number | undefined;
maxWidth: number | undefined;
minHeight: number | undefined;
maxHeight: number | undefined;
}; };
} }
export declare function layoutConfig(): LayoutConfigImpl; export declare function layoutConfig(): LayoutConfigImpl;

View File

@ -96,6 +96,10 @@ export class LayoutConfigImpl {
margin: this.margin, margin: this.margin,
alignment: this.alignment ? this.alignment.toModel() : undefined, alignment: this.alignment ? this.alignment.toModel() : undefined,
weight: this.weight, weight: this.weight,
minWidth: this.minWidth,
maxWidth: this.maxWidth,
minHeight: this.minHeight,
maxHeight: this.maxHeight
}; };
} }
} }

View File

@ -175,6 +175,10 @@ export class LayoutConfigImpl implements LayoutConfig, Modeling {
margin: this.margin, margin: this.margin,
alignment: this.alignment ? this.alignment.toModel() : undefined, alignment: this.alignment ? this.alignment.toModel() : undefined,
weight: this.weight, weight: this.weight,
minWidth: this.minWidth,
maxWidth: this.maxWidth,
minHeight: this.minHeight,
maxHeight: this.maxHeight
} }
} }
} }

View File

@ -2356,6 +2356,10 @@ class LayoutConfigImpl {
margin: this.margin, margin: this.margin,
alignment: this.alignment ? this.alignment.toModel() : undefined, alignment: this.alignment ? this.alignment.toModel() : undefined,
weight: this.weight, weight: this.weight,
minWidth: this.minWidth,
maxWidth: this.maxWidth,
minHeight: this.minHeight,
maxHeight: this.maxHeight
}; };
} }
} }

File diff suppressed because one or more lines are too long