Layout add minWidth minHeight maxWidth maxHeight

This commit is contained in:
pengfei.zhou
2020-04-11 12:20:43 +08:00
committed by osborn
parent 4e537eed47
commit 80811a3bf6
15 changed files with 228 additions and 112 deletions

View File

@@ -705,6 +705,22 @@ var LayoutConfigImpl = /** @class */ (function () {
this.weight = w;
return this;
};
LayoutConfigImpl.prototype.configMaxWidth = function (v) {
this.maxWidth = v;
return this;
};
LayoutConfigImpl.prototype.configMaxHeight = function (v) {
this.maxHeight = v;
return this;
};
LayoutConfigImpl.prototype.configMinWidth = function (v) {
this.minWidth = v;
return this;
};
LayoutConfigImpl.prototype.configMinHeight = function (v) {
this.minHeight = v;
return this;
};
LayoutConfigImpl.prototype.toModel = function () {
return {
widthSpec: this.widthSpec,

View File

@@ -570,6 +570,22 @@ class LayoutConfigImpl {
this.weight = w;
return this;
}
configMaxWidth(v) {
this.maxWidth = v;
return this;
}
configMaxHeight(v) {
this.maxHeight = v;
return this;
}
configMinWidth(v) {
this.minWidth = v;
return this;
}
configMinHeight(v) {
this.minHeight = v;
return this;
}
toModel() {
return {
widthSpec: this.widthSpec,

View File

@@ -2029,6 +2029,22 @@ class LayoutConfigImpl {
this.weight = w;
return this;
}
configMaxWidth(v) {
this.maxWidth = v;
return this;
}
configMaxHeight(v) {
this.maxHeight = v;
return this;
}
configMinWidth(v) {
this.minWidth = v;
return this;
}
configMinHeight(v) {
this.minHeight = v;
return this;
}
toModel() {
return {
widthSpec: this.widthSpec,

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

@@ -1197,6 +1197,10 @@ declare module 'doric/lib/src/util/layoutconfig' {
};
alignment?: Gravity;
weight?: number;
maxWidth?: number;
maxHeight?: number;
minWidth?: number;
minHeight?: number;
}
export class LayoutConfigImpl implements LayoutConfig, Modeling {
widthSpec?: LayoutSpec;
@@ -1209,6 +1213,10 @@ declare module 'doric/lib/src/util/layoutconfig' {
};
alignment?: Gravity;
weight?: number;
maxWidth?: number;
maxHeight?: number;
minWidth?: number;
minHeight?: number;
fit(): this;
most(): this;
just(): this;
@@ -1222,6 +1230,10 @@ declare module 'doric/lib/src/util/layoutconfig' {
}): this;
configAlignment(a: Gravity): this;
configWeight(w: number): this;
configMaxWidth(v: number): this;
configMaxHeight(v: number): this;
configMinWidth(v: number): this;
configMinHeight(v: number): this;
toModel(): {
widthSpec: LayoutSpec | undefined;
heightSpec: LayoutSpec | undefined;

View File

@@ -25,6 +25,10 @@ export interface LayoutConfig {
};
alignment?: Gravity;
weight?: number;
maxWidth?: number;
maxHeight?: number;
minWidth?: number;
minHeight?: number;
}
export declare class LayoutConfigImpl implements LayoutConfig, Modeling {
widthSpec?: LayoutSpec;
@@ -37,6 +41,10 @@ export declare class LayoutConfigImpl implements LayoutConfig, Modeling {
};
alignment?: Gravity;
weight?: number;
maxWidth?: number;
maxHeight?: number;
minWidth?: number;
minHeight?: number;
fit(): this;
most(): this;
just(): this;
@@ -50,6 +58,10 @@ export declare class LayoutConfigImpl implements LayoutConfig, Modeling {
}): this;
configAlignment(a: Gravity): this;
configWeight(w: number): this;
configMaxWidth(v: number): this;
configMaxHeight(v: number): this;
configMinWidth(v: number): this;
configMinHeight(v: number): this;
toModel(): {
widthSpec: LayoutSpec | undefined;
heightSpec: LayoutSpec | undefined;

View File

@@ -49,6 +49,22 @@ export class LayoutConfigImpl {
this.weight = w;
return this;
}
configMaxWidth(v) {
this.maxWidth = v;
return this;
}
configMaxHeight(v) {
this.maxHeight = v;
return this;
}
configMinWidth(v) {
this.minWidth = v;
return this;
}
configMinHeight(v) {
this.minHeight = v;
return this;
}
toModel() {
return {
widthSpec: this.widthSpec,

View File

@@ -43,6 +43,12 @@ export interface LayoutConfig {
alignment?: Gravity
//Only affective in VLayout or HLayout
weight?: number
maxWidth?: number
maxHeight?: number
minWidth?: number
minHeight?: number
}
export class LayoutConfigImpl implements LayoutConfig, Modeling {
@@ -58,6 +64,12 @@ export class LayoutConfigImpl implements LayoutConfig, Modeling {
//Only affective in VLayout or HLayout
weight?: number
maxWidth?: number
maxHeight?: number
minWidth?: number
minHeight?: number
fit() {
this.widthSpec = LayoutSpec.FIT
this.heightSpec = LayoutSpec.FIT
@@ -106,6 +118,26 @@ export class LayoutConfigImpl implements LayoutConfig, Modeling {
return this
}
configMaxWidth(v: number) {
this.maxWidth = v
return this
}
configMaxHeight(v: number) {
this.maxHeight = v
return this
}
configMinWidth(v: number) {
this.minWidth = v
return this
}
configMinHeight(v: number) {
this.minHeight = v
return this
}
toModel() {
return {
widthSpec: this.widthSpec,