feat:enhance layoutConfig
This commit is contained in:
parent
7ee30d1cd3
commit
57643c5990
@ -19,45 +19,7 @@ class ComponentDemo extends Panel {
|
|||||||
imageBase64: logo,
|
imageBase64: logo,
|
||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
richTitleView().applyChild({
|
|
||||||
title: {
|
|
||||||
text: "Title"
|
|
||||||
},
|
|
||||||
subTitle: {
|
|
||||||
text: "Subtitle"
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
richTitleView().applyChild({
|
|
||||||
icon: {
|
|
||||||
imageBase64: logo,
|
|
||||||
},
|
|
||||||
subTitle: {
|
|
||||||
text: "Subtitle"
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
richTitleView().applyChild({
|
|
||||||
icon: {
|
|
||||||
imageBase64: logo,
|
|
||||||
},
|
|
||||||
title: {
|
|
||||||
text: "Title"
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
richTitleView().applyChild({
|
|
||||||
title: {
|
|
||||||
text: "Just title"
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
richTitleView().applyChild({
|
|
||||||
subTitle: {
|
|
||||||
text: "Just subtitle"
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
richTitleView().applyChild({
|
|
||||||
icon: {
|
|
||||||
imageBase64: logo,
|
|
||||||
},
|
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
{
|
{
|
||||||
layoutConfig: {
|
layoutConfig: {
|
||||||
|
14
doric-demo/src/components/PreferenceView.ts
Normal file
14
doric-demo/src/components/PreferenceView.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { hlayout, HLayout, layoutConfig, ViewComponent } from "doric";
|
||||||
|
|
||||||
|
@ViewComponent
|
||||||
|
export class PreferenceView extends HLayout {
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super()
|
||||||
|
hlayout(
|
||||||
|
[],
|
||||||
|
{
|
||||||
|
layoutConfig: layoutConfig(),
|
||||||
|
}).in(this)
|
||||||
|
}
|
||||||
|
}
|
@ -733,16 +733,40 @@ var LayoutConfigImpl = /** @class */ (function () {
|
|||||||
this.heightSpec = exports.LayoutSpec.FIT;
|
this.heightSpec = exports.LayoutSpec.FIT;
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
LayoutConfigImpl.prototype.fitWidth = function () {
|
||||||
|
this.widthSpec = exports.LayoutSpec.FIT;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
LayoutConfigImpl.prototype.fitHeight = function () {
|
||||||
|
this.heightSpec = exports.LayoutSpec.FIT;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
LayoutConfigImpl.prototype.most = function () {
|
LayoutConfigImpl.prototype.most = function () {
|
||||||
this.widthSpec = exports.LayoutSpec.MOST;
|
this.widthSpec = exports.LayoutSpec.MOST;
|
||||||
this.heightSpec = exports.LayoutSpec.MOST;
|
this.heightSpec = exports.LayoutSpec.MOST;
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
LayoutConfigImpl.prototype.mostWidth = function () {
|
||||||
|
this.widthSpec = exports.LayoutSpec.MOST;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
LayoutConfigImpl.prototype.mostHeight = function () {
|
||||||
|
this.widthSpec = exports.LayoutSpec.MOST;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
LayoutConfigImpl.prototype.just = function () {
|
LayoutConfigImpl.prototype.just = function () {
|
||||||
this.widthSpec = exports.LayoutSpec.JUST;
|
this.widthSpec = exports.LayoutSpec.JUST;
|
||||||
this.heightSpec = exports.LayoutSpec.JUST;
|
this.heightSpec = exports.LayoutSpec.JUST;
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
LayoutConfigImpl.prototype.justWidth = function () {
|
||||||
|
this.widthSpec = exports.LayoutSpec.JUST;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
LayoutConfigImpl.prototype.justHeight = function () {
|
||||||
|
this.heightSpec = exports.LayoutSpec.JUST;
|
||||||
|
return this;
|
||||||
|
};
|
||||||
LayoutConfigImpl.prototype.configWidth = function (w) {
|
LayoutConfigImpl.prototype.configWidth = function (w) {
|
||||||
this.widthSpec = w;
|
this.widthSpec = w;
|
||||||
return this;
|
return this;
|
||||||
|
@ -619,16 +619,40 @@ class LayoutConfigImpl {
|
|||||||
this.heightSpec = exports.LayoutSpec.FIT;
|
this.heightSpec = exports.LayoutSpec.FIT;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
fitWidth() {
|
||||||
|
this.widthSpec = exports.LayoutSpec.FIT;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
fitHeight() {
|
||||||
|
this.heightSpec = exports.LayoutSpec.FIT;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
most() {
|
most() {
|
||||||
this.widthSpec = exports.LayoutSpec.MOST;
|
this.widthSpec = exports.LayoutSpec.MOST;
|
||||||
this.heightSpec = exports.LayoutSpec.MOST;
|
this.heightSpec = exports.LayoutSpec.MOST;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
mostWidth() {
|
||||||
|
this.widthSpec = exports.LayoutSpec.MOST;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
mostHeight() {
|
||||||
|
this.widthSpec = exports.LayoutSpec.MOST;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
just() {
|
just() {
|
||||||
this.widthSpec = exports.LayoutSpec.JUST;
|
this.widthSpec = exports.LayoutSpec.JUST;
|
||||||
this.heightSpec = exports.LayoutSpec.JUST;
|
this.heightSpec = exports.LayoutSpec.JUST;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
justWidth() {
|
||||||
|
this.widthSpec = exports.LayoutSpec.JUST;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
justHeight() {
|
||||||
|
this.heightSpec = exports.LayoutSpec.JUST;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
configWidth(w) {
|
configWidth(w) {
|
||||||
this.widthSpec = w;
|
this.widthSpec = w;
|
||||||
return this;
|
return this;
|
||||||
|
@ -2140,16 +2140,40 @@ class LayoutConfigImpl {
|
|||||||
this.heightSpec = exports.LayoutSpec.FIT;
|
this.heightSpec = exports.LayoutSpec.FIT;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
fitWidth() {
|
||||||
|
this.widthSpec = exports.LayoutSpec.FIT;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
fitHeight() {
|
||||||
|
this.heightSpec = exports.LayoutSpec.FIT;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
most() {
|
most() {
|
||||||
this.widthSpec = exports.LayoutSpec.MOST;
|
this.widthSpec = exports.LayoutSpec.MOST;
|
||||||
this.heightSpec = exports.LayoutSpec.MOST;
|
this.heightSpec = exports.LayoutSpec.MOST;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
mostWidth() {
|
||||||
|
this.widthSpec = exports.LayoutSpec.MOST;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
mostHeight() {
|
||||||
|
this.widthSpec = exports.LayoutSpec.MOST;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
just() {
|
just() {
|
||||||
this.widthSpec = exports.LayoutSpec.JUST;
|
this.widthSpec = exports.LayoutSpec.JUST;
|
||||||
this.heightSpec = exports.LayoutSpec.JUST;
|
this.heightSpec = exports.LayoutSpec.JUST;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
justWidth() {
|
||||||
|
this.widthSpec = exports.LayoutSpec.JUST;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
justHeight() {
|
||||||
|
this.heightSpec = exports.LayoutSpec.JUST;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
configWidth(w) {
|
configWidth(w) {
|
||||||
this.widthSpec = w;
|
this.widthSpec = w;
|
||||||
return this;
|
return this;
|
||||||
|
6
doric-js/index.d.ts
vendored
6
doric-js/index.d.ts
vendored
@ -1167,8 +1167,14 @@ declare module 'doric/lib/src/util/layoutconfig' {
|
|||||||
minWidth?: number;
|
minWidth?: number;
|
||||||
minHeight?: number;
|
minHeight?: number;
|
||||||
fit(): this;
|
fit(): this;
|
||||||
|
fitWidth(): this;
|
||||||
|
fitHeight(): this;
|
||||||
most(): this;
|
most(): this;
|
||||||
|
mostWidth(): this;
|
||||||
|
mostHeight(): this;
|
||||||
just(): this;
|
just(): this;
|
||||||
|
justWidth(): this;
|
||||||
|
justHeight(): this;
|
||||||
configWidth(w: LayoutSpec): this;
|
configWidth(w: LayoutSpec): this;
|
||||||
configHeight(h: LayoutSpec): this;
|
configHeight(h: LayoutSpec): this;
|
||||||
configMargin(m: {
|
configMargin(m: {
|
||||||
|
6
doric-js/lib/src/util/layoutconfig.d.ts
vendored
6
doric-js/lib/src/util/layoutconfig.d.ts
vendored
@ -46,8 +46,14 @@ export declare class LayoutConfigImpl implements LayoutConfig, Modeling {
|
|||||||
minWidth?: number;
|
minWidth?: number;
|
||||||
minHeight?: number;
|
minHeight?: number;
|
||||||
fit(): this;
|
fit(): this;
|
||||||
|
fitWidth(): this;
|
||||||
|
fitHeight(): this;
|
||||||
most(): this;
|
most(): this;
|
||||||
|
mostWidth(): this;
|
||||||
|
mostHeight(): this;
|
||||||
just(): this;
|
just(): this;
|
||||||
|
justWidth(): this;
|
||||||
|
justHeight(): this;
|
||||||
configWidth(w: LayoutSpec): this;
|
configWidth(w: LayoutSpec): this;
|
||||||
configHeight(h: LayoutSpec): this;
|
configHeight(h: LayoutSpec): this;
|
||||||
configMargin(m: {
|
configMargin(m: {
|
||||||
|
@ -19,16 +19,40 @@ export class LayoutConfigImpl {
|
|||||||
this.heightSpec = LayoutSpec.FIT;
|
this.heightSpec = LayoutSpec.FIT;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
fitWidth() {
|
||||||
|
this.widthSpec = LayoutSpec.FIT;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
fitHeight() {
|
||||||
|
this.heightSpec = LayoutSpec.FIT;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
most() {
|
most() {
|
||||||
this.widthSpec = LayoutSpec.MOST;
|
this.widthSpec = LayoutSpec.MOST;
|
||||||
this.heightSpec = LayoutSpec.MOST;
|
this.heightSpec = LayoutSpec.MOST;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
mostWidth() {
|
||||||
|
this.widthSpec = LayoutSpec.MOST;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
mostHeight() {
|
||||||
|
this.widthSpec = LayoutSpec.MOST;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
just() {
|
just() {
|
||||||
this.widthSpec = LayoutSpec.JUST;
|
this.widthSpec = LayoutSpec.JUST;
|
||||||
this.heightSpec = LayoutSpec.JUST;
|
this.heightSpec = LayoutSpec.JUST;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
justWidth() {
|
||||||
|
this.widthSpec = LayoutSpec.JUST;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
justHeight() {
|
||||||
|
this.heightSpec = LayoutSpec.JUST;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
configWidth(w) {
|
configWidth(w) {
|
||||||
this.widthSpec = w;
|
this.widthSpec = w;
|
||||||
return this;
|
return this;
|
||||||
|
@ -76,18 +76,48 @@ export class LayoutConfigImpl implements LayoutConfig, Modeling {
|
|||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fitWidth() {
|
||||||
|
this.widthSpec = LayoutSpec.FIT
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
fitHeight() {
|
||||||
|
this.heightSpec = LayoutSpec.FIT
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
most() {
|
most() {
|
||||||
this.widthSpec = LayoutSpec.MOST
|
this.widthSpec = LayoutSpec.MOST
|
||||||
this.heightSpec = LayoutSpec.MOST
|
this.heightSpec = LayoutSpec.MOST
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mostWidth() {
|
||||||
|
this.widthSpec = LayoutSpec.MOST
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
mostHeight() {
|
||||||
|
this.widthSpec = LayoutSpec.MOST
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
just() {
|
just() {
|
||||||
this.widthSpec = LayoutSpec.JUST
|
this.widthSpec = LayoutSpec.JUST
|
||||||
this.heightSpec = LayoutSpec.JUST
|
this.heightSpec = LayoutSpec.JUST
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
justWidth() {
|
||||||
|
this.widthSpec = LayoutSpec.JUST
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
|
justHeight() {
|
||||||
|
this.heightSpec = LayoutSpec.JUST
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
|
||||||
configWidth(w: LayoutSpec) {
|
configWidth(w: LayoutSpec) {
|
||||||
this.widthSpec = w
|
this.widthSpec = w
|
||||||
return this
|
return this
|
||||||
|
24
doric-web/dist/index.js
vendored
24
doric-web/dist/index.js
vendored
@ -2194,16 +2194,40 @@ class LayoutConfigImpl {
|
|||||||
this.heightSpec = exports.LayoutSpec.FIT;
|
this.heightSpec = exports.LayoutSpec.FIT;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
fitWidth() {
|
||||||
|
this.widthSpec = exports.LayoutSpec.FIT;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
fitHeight() {
|
||||||
|
this.heightSpec = exports.LayoutSpec.FIT;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
most() {
|
most() {
|
||||||
this.widthSpec = exports.LayoutSpec.MOST;
|
this.widthSpec = exports.LayoutSpec.MOST;
|
||||||
this.heightSpec = exports.LayoutSpec.MOST;
|
this.heightSpec = exports.LayoutSpec.MOST;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
mostWidth() {
|
||||||
|
this.widthSpec = exports.LayoutSpec.MOST;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
mostHeight() {
|
||||||
|
this.widthSpec = exports.LayoutSpec.MOST;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
just() {
|
just() {
|
||||||
this.widthSpec = exports.LayoutSpec.JUST;
|
this.widthSpec = exports.LayoutSpec.JUST;
|
||||||
this.heightSpec = exports.LayoutSpec.JUST;
|
this.heightSpec = exports.LayoutSpec.JUST;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
justWidth() {
|
||||||
|
this.widthSpec = exports.LayoutSpec.JUST;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
justHeight() {
|
||||||
|
this.heightSpec = exports.LayoutSpec.JUST;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
configWidth(w) {
|
configWidth(w) {
|
||||||
this.widthSpec = w;
|
this.widthSpec = w;
|
||||||
return this;
|
return this;
|
||||||
|
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