feat:web support size constraints
This commit is contained in:
parent
e1c7d57cbb
commit
880afa050a
49
doric-web/dist/index.js
vendored
49
doric-web/dist/index.js
vendored
@ -6255,7 +6255,11 @@ var doric_web = (function (exports, axios, sandbox) {
|
|||||||
right: 0,
|
right: 0,
|
||||||
top: 0,
|
top: 0,
|
||||||
bottom: 0
|
bottom: 0
|
||||||
}
|
},
|
||||||
|
maxWidth: -1,
|
||||||
|
maxHeight: -1,
|
||||||
|
minWidth: -1,
|
||||||
|
minHeight: -1
|
||||||
};
|
};
|
||||||
this.padding = {
|
this.padding = {
|
||||||
left: 0,
|
left: 0,
|
||||||
@ -6337,6 +6341,32 @@ var doric_web = (function (exports, axios, sandbox) {
|
|||||||
}
|
}
|
||||||
this.applyCSSStyle({ width });
|
this.applyCSSStyle({ width });
|
||||||
}
|
}
|
||||||
|
configSizeConstraints() {
|
||||||
|
if (this.layoutConfig.maxWidth && this.layoutConfig.maxWidth !== -1) {
|
||||||
|
this.applyCSSStyle({ maxWidth: toPixelString(this.layoutConfig.maxWidth) });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.view.style.removeProperty('max-width');
|
||||||
|
}
|
||||||
|
if (this.layoutConfig.maxHeight && this.layoutConfig.maxHeight !== -1) {
|
||||||
|
this.applyCSSStyle({ maxHeight: toPixelString(this.layoutConfig.maxHeight) });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.view.style.removeProperty('max-height');
|
||||||
|
}
|
||||||
|
if (this.layoutConfig.minWidth && this.layoutConfig.minWidth !== -1) {
|
||||||
|
this.applyCSSStyle({ minWidth: toPixelString(this.layoutConfig.minWidth) });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.view.style.removeProperty('min-width');
|
||||||
|
}
|
||||||
|
if (this.layoutConfig.minHeight && this.layoutConfig.minHeight !== -1) {
|
||||||
|
this.applyCSSStyle({ minHeight: toPixelString(this.layoutConfig.minHeight) });
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.view.style.removeProperty('min-height');
|
||||||
|
}
|
||||||
|
}
|
||||||
configHeight() {
|
configHeight() {
|
||||||
let height;
|
let height;
|
||||||
switch (this.layoutConfig.heightSpec) {
|
switch (this.layoutConfig.heightSpec) {
|
||||||
@ -6381,6 +6411,7 @@ var doric_web = (function (exports, axios, sandbox) {
|
|||||||
this.configPadding();
|
this.configPadding();
|
||||||
this.configWidth();
|
this.configWidth();
|
||||||
this.configHeight();
|
this.configHeight();
|
||||||
|
this.configSizeConstraints();
|
||||||
}
|
}
|
||||||
blendProps(v, propName, prop) {
|
blendProps(v, propName, prop) {
|
||||||
switch (propName) {
|
switch (propName) {
|
||||||
@ -7237,6 +7268,22 @@ var doric_web = (function (exports, axios, sandbox) {
|
|||||||
case "maxLines":
|
case "maxLines":
|
||||||
this.maxLines = prop;
|
this.maxLines = prop;
|
||||||
break;
|
break;
|
||||||
|
case "maxWidth":
|
||||||
|
if (prop) {
|
||||||
|
this.layoutConfig.maxWidth = prop;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.layoutConfig.maxWidth = -1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "maxHeight":
|
||||||
|
if (prop) {
|
||||||
|
this.layoutConfig.maxHeight = prop;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.layoutConfig.maxHeight = -1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
super.blendProps(v, propName, prop);
|
super.blendProps(v, propName, prop);
|
||||||
break;
|
break;
|
||||||
|
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
@ -69,6 +69,20 @@ export class DoricTextNode extends DoricViewNode {
|
|||||||
case "maxLines":
|
case "maxLines":
|
||||||
this.maxLines = prop as number
|
this.maxLines = prop as number
|
||||||
break
|
break
|
||||||
|
case "maxWidth":
|
||||||
|
if (prop) {
|
||||||
|
this.layoutConfig.maxWidth = prop
|
||||||
|
} else {
|
||||||
|
this.layoutConfig.maxWidth = -1
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case "maxHeight":
|
||||||
|
if (prop) {
|
||||||
|
this.layoutConfig.maxHeight = prop
|
||||||
|
} else {
|
||||||
|
this.layoutConfig.maxHeight = -1
|
||||||
|
}
|
||||||
|
break
|
||||||
default:
|
default:
|
||||||
super.blendProps(v, propName, prop)
|
super.blendProps(v, propName, prop)
|
||||||
break
|
break
|
||||||
|
@ -64,8 +64,13 @@ export abstract class DoricViewNode {
|
|||||||
right: 0,
|
right: 0,
|
||||||
top: 0,
|
top: 0,
|
||||||
bottom: 0
|
bottom: 0
|
||||||
|
},
|
||||||
|
maxWidth: -1,
|
||||||
|
maxHeight: -1,
|
||||||
|
minWidth: -1,
|
||||||
|
minHeight: -1
|
||||||
}
|
}
|
||||||
}
|
|
||||||
padding = {
|
padding = {
|
||||||
left: 0,
|
left: 0,
|
||||||
right: 0,
|
right: 0,
|
||||||
@ -186,6 +191,29 @@ export abstract class DoricViewNode {
|
|||||||
this.applyCSSStyle({ width })
|
this.applyCSSStyle({ width })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
configSizeConstraints() {
|
||||||
|
if (this.layoutConfig.maxWidth && this.layoutConfig.maxWidth !== -1) {
|
||||||
|
this.applyCSSStyle({ maxWidth: toPixelString(this.layoutConfig.maxWidth) })
|
||||||
|
} else {
|
||||||
|
this.view.style.removeProperty('max-width')
|
||||||
|
}
|
||||||
|
if (this.layoutConfig.maxHeight && this.layoutConfig.maxHeight !== -1) {
|
||||||
|
this.applyCSSStyle({ maxHeight: toPixelString(this.layoutConfig.maxHeight) })
|
||||||
|
} else {
|
||||||
|
this.view.style.removeProperty('max-height')
|
||||||
|
}
|
||||||
|
if (this.layoutConfig.minWidth && this.layoutConfig.minWidth !== -1) {
|
||||||
|
this.applyCSSStyle({ minWidth: toPixelString(this.layoutConfig.minWidth) })
|
||||||
|
} else {
|
||||||
|
this.view.style.removeProperty('min-width')
|
||||||
|
}
|
||||||
|
if (this.layoutConfig.minHeight && this.layoutConfig.minHeight !== -1) {
|
||||||
|
this.applyCSSStyle({ minHeight: toPixelString(this.layoutConfig.minHeight) })
|
||||||
|
} else {
|
||||||
|
this.view.style.removeProperty('min-height')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
configHeight() {
|
configHeight() {
|
||||||
let height
|
let height
|
||||||
switch (this.layoutConfig.heightSpec) {
|
switch (this.layoutConfig.heightSpec) {
|
||||||
@ -235,6 +263,7 @@ export abstract class DoricViewNode {
|
|||||||
this.configPadding()
|
this.configPadding()
|
||||||
this.configWidth()
|
this.configWidth()
|
||||||
this.configHeight()
|
this.configHeight()
|
||||||
|
this.configSizeConstraints()
|
||||||
}
|
}
|
||||||
|
|
||||||
blendProps(v: HTMLElement, propName: string, prop: any) {
|
blendProps(v: HTMLElement, propName: string, prop: any) {
|
||||||
|
Reference in New Issue
Block a user