mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-17 04:41:36 +08:00
Fix tslint errors
This commit is contained in:
@ -20,7 +20,6 @@ export class Border extends ContentView implements BorderDefinition {
|
|||||||
let height = layout.getMeasureSpecSize(heightMeasureSpec);
|
let height = layout.getMeasureSpecSize(heightMeasureSpec);
|
||||||
let heightMode = layout.getMeasureSpecMode(heightMeasureSpec);
|
let heightMode = layout.getMeasureSpecMode(heightMeasureSpec);
|
||||||
|
|
||||||
let style = this.style;
|
|
||||||
let horizontalBorderLength = this.effectiveBorderLeftWidth + this.effectiveBorderRightWidth;
|
let horizontalBorderLength = this.effectiveBorderLeftWidth + this.effectiveBorderRightWidth;
|
||||||
let verticalBorderLength = this.effectiveBorderTopWidth + this.effectiveBorderBottomWidth;
|
let verticalBorderLength = this.effectiveBorderTopWidth + this.effectiveBorderBottomWidth;
|
||||||
|
|
||||||
@ -35,7 +34,6 @@ export class Border extends ContentView implements BorderDefinition {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public onLayout(left: number, top: number, right: number, bottom: number): void {
|
public onLayout(left: number, top: number, right: number, bottom: number): void {
|
||||||
let style = this.style;
|
|
||||||
let horizontalBorderLength = this.effectiveBorderLeftWidth + this.effectiveBorderRightWidth;
|
let horizontalBorderLength = this.effectiveBorderLeftWidth + this.effectiveBorderRightWidth;
|
||||||
let verticalBorderLength = this.effectiveBorderTopWidth + this.effectiveBorderBottomWidth;
|
let verticalBorderLength = this.effectiveBorderTopWidth + this.effectiveBorderBottomWidth;
|
||||||
|
|
||||||
|
@ -69,7 +69,6 @@ export class Button extends ButtonBase {
|
|||||||
}
|
}
|
||||||
set [borderTopWidthProperty.native](value: Length) {
|
set [borderTopWidthProperty.native](value: Length) {
|
||||||
let inset = this.nativeView.contentEdgeInsets;
|
let inset = this.nativeView.contentEdgeInsets;
|
||||||
let style = this.style;
|
|
||||||
let top = this.effectivePaddingTop + this.effectiveBorderTopWidth;
|
let top = this.effectivePaddingTop + this.effectiveBorderTopWidth;
|
||||||
this.nativeView.contentEdgeInsets = { top: top, left: inset.left, bottom: inset.bottom, right: inset.right };
|
this.nativeView.contentEdgeInsets = { top: top, left: inset.left, bottom: inset.bottom, right: inset.right };
|
||||||
}
|
}
|
||||||
@ -82,7 +81,6 @@ export class Button extends ButtonBase {
|
|||||||
}
|
}
|
||||||
set [borderRightWidthProperty.native](value: Length) {
|
set [borderRightWidthProperty.native](value: Length) {
|
||||||
let inset = this.nativeView.contentEdgeInsets;
|
let inset = this.nativeView.contentEdgeInsets;
|
||||||
let style = this.style;
|
|
||||||
let right = this.effectivePaddingRight + this.effectiveBorderRightWidth;
|
let right = this.effectivePaddingRight + this.effectiveBorderRightWidth;
|
||||||
this.nativeView.contentEdgeInsets = { top: inset.top, left: inset.left, bottom: inset.bottom, right: right };
|
this.nativeView.contentEdgeInsets = { top: inset.top, left: inset.left, bottom: inset.bottom, right: right };
|
||||||
}
|
}
|
||||||
@ -95,7 +93,6 @@ export class Button extends ButtonBase {
|
|||||||
}
|
}
|
||||||
set [borderBottomWidthProperty.native](value: Length) {
|
set [borderBottomWidthProperty.native](value: Length) {
|
||||||
let inset = this.nativeView.contentEdgeInsets;
|
let inset = this.nativeView.contentEdgeInsets;
|
||||||
let style = this.style;
|
|
||||||
let bottom = this.effectivePaddingBottom + this.effectiveBorderBottomWidth;
|
let bottom = this.effectivePaddingBottom + this.effectiveBorderBottomWidth;
|
||||||
this.nativeView.contentEdgeInsets = { top: inset.top, left: inset.left, bottom: bottom, right: inset.right };
|
this.nativeView.contentEdgeInsets = { top: inset.top, left: inset.left, bottom: bottom, right: inset.right };
|
||||||
}
|
}
|
||||||
@ -108,7 +105,6 @@ export class Button extends ButtonBase {
|
|||||||
}
|
}
|
||||||
set [borderLeftWidthProperty.native](value: Length) {
|
set [borderLeftWidthProperty.native](value: Length) {
|
||||||
let inset = this.nativeView.contentEdgeInsets;
|
let inset = this.nativeView.contentEdgeInsets;
|
||||||
let style = this.style;
|
|
||||||
let left = this.effectivePaddingLeft + this.effectiveBorderLeftWidth;
|
let left = this.effectivePaddingLeft + this.effectiveBorderLeftWidth;
|
||||||
this.nativeView.contentEdgeInsets = { top: inset.top, left: left, bottom: inset.bottom, right: inset.right };
|
this.nativeView.contentEdgeInsets = { top: inset.top, left: left, bottom: inset.bottom, right: inset.right };
|
||||||
}
|
}
|
||||||
@ -121,7 +117,6 @@ export class Button extends ButtonBase {
|
|||||||
}
|
}
|
||||||
set [paddingTopProperty.native](value: Length) {
|
set [paddingTopProperty.native](value: Length) {
|
||||||
let inset = this.nativeView.contentEdgeInsets;
|
let inset = this.nativeView.contentEdgeInsets;
|
||||||
let style = this.style;
|
|
||||||
let top = this.effectivePaddingTop + this.effectiveBorderTopWidth;
|
let top = this.effectivePaddingTop + this.effectiveBorderTopWidth;
|
||||||
this.nativeView.contentEdgeInsets = { top: top, left: inset.left, bottom: inset.bottom, right: inset.right };
|
this.nativeView.contentEdgeInsets = { top: top, left: inset.left, bottom: inset.bottom, right: inset.right };
|
||||||
}
|
}
|
||||||
@ -134,7 +129,6 @@ export class Button extends ButtonBase {
|
|||||||
}
|
}
|
||||||
set [paddingRightProperty.native](value: Length) {
|
set [paddingRightProperty.native](value: Length) {
|
||||||
let inset = this.nativeView.contentEdgeInsets;
|
let inset = this.nativeView.contentEdgeInsets;
|
||||||
let style = this.style;
|
|
||||||
let right = this.effectivePaddingRight + this.effectiveBorderRightWidth;
|
let right = this.effectivePaddingRight + this.effectiveBorderRightWidth;
|
||||||
this.nativeView.contentEdgeInsets = { top: inset.top, left: inset.left, bottom: inset.bottom, right: right };
|
this.nativeView.contentEdgeInsets = { top: inset.top, left: inset.left, bottom: inset.bottom, right: right };
|
||||||
}
|
}
|
||||||
@ -147,7 +141,6 @@ export class Button extends ButtonBase {
|
|||||||
}
|
}
|
||||||
set [paddingBottomProperty.native](value: Length) {
|
set [paddingBottomProperty.native](value: Length) {
|
||||||
let inset = this.nativeView.contentEdgeInsets;
|
let inset = this.nativeView.contentEdgeInsets;
|
||||||
let style = this.style;
|
|
||||||
let bottom = this.effectivePaddingBottom + this.effectiveBorderBottomWidth;
|
let bottom = this.effectivePaddingBottom + this.effectiveBorderBottomWidth;
|
||||||
this.nativeView.contentEdgeInsets = { top: inset.top, left: inset.left, bottom: bottom, right: inset.right };
|
this.nativeView.contentEdgeInsets = { top: inset.top, left: inset.left, bottom: bottom, right: inset.right };
|
||||||
}
|
}
|
||||||
@ -160,7 +153,6 @@ export class Button extends ButtonBase {
|
|||||||
}
|
}
|
||||||
set [paddingLeftProperty.native](value: Length) {
|
set [paddingLeftProperty.native](value: Length) {
|
||||||
let inset = this.nativeView.contentEdgeInsets;
|
let inset = this.nativeView.contentEdgeInsets;
|
||||||
let style = this.style;
|
|
||||||
let left = this.effectivePaddingLeft + this.effectiveBorderLeftWidth;
|
let left = this.effectivePaddingLeft + this.effectiveBorderLeftWidth;
|
||||||
this.nativeView.contentEdgeInsets = { top: inset.top, left: left, bottom: inset.bottom, right: inset.right };
|
this.nativeView.contentEdgeInsets = { top: inset.top, left: left, bottom: inset.bottom, right: inset.right };
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,6 @@ export class ContentView extends CustomLayoutView implements ContentViewDefiniti
|
|||||||
let height = layout.getMeasureSpecSize(heightMeasureSpec);
|
let height = layout.getMeasureSpecSize(heightMeasureSpec);
|
||||||
let heightMode = layout.getMeasureSpecMode(heightMeasureSpec);
|
let heightMode = layout.getMeasureSpecMode(heightMeasureSpec);
|
||||||
|
|
||||||
let style = this.style;
|
|
||||||
let measureWidth = Math.max(result.measuredWidth, this.effectiveMinWidth);
|
let measureWidth = Math.max(result.measuredWidth, this.effectiveMinWidth);
|
||||||
let measureHeight = Math.max(result.measuredHeight, this.effectiveMinHeight);
|
let measureHeight = Math.max(result.measuredHeight, this.effectiveMinHeight);
|
||||||
|
|
||||||
|
@ -154,8 +154,6 @@ export class GridLayout extends GridLayoutBase {
|
|||||||
public onLayout(left: number, top: number, right: number, bottom: number): void {
|
public onLayout(left: number, top: number, right: number, bottom: number): void {
|
||||||
super.onLayout(left, top, right, bottom);
|
super.onLayout(left, top, right, bottom);
|
||||||
|
|
||||||
const style = this.style;
|
|
||||||
|
|
||||||
let paddingLeft = this.effectiveBorderLeftWidth + this.effectivePaddingLeft;
|
let paddingLeft = this.effectiveBorderLeftWidth + this.effectivePaddingLeft;
|
||||||
let paddingTop = this.effectiveBorderTopWidth + this.effectivePaddingTop;
|
let paddingTop = this.effectiveBorderTopWidth + this.effectivePaddingTop;
|
||||||
|
|
||||||
|
@ -25,7 +25,32 @@ export class CssState {
|
|||||||
resetStyleProperties(this.view.style);
|
resetStyleProperties(this.view.style);
|
||||||
|
|
||||||
let matchingSelectors = this.match.selectors.filter(sel => sel.dynamic ? sel.match(this.view) : true);
|
let matchingSelectors = this.match.selectors.filter(sel => sel.dynamic ? sel.match(this.view) : true);
|
||||||
matchingSelectors.forEach(s => applyDescriptors(this.view, s.ruleset));
|
matchingSelectors.forEach(s => this.applyDescriptors(this.view, s.ruleset));
|
||||||
|
}
|
||||||
|
|
||||||
|
private applyDescriptors(view: ViewBase, ruleset: RuleSet): void {
|
||||||
|
let style = view.style;
|
||||||
|
ruleset.declarations.forEach(d => {
|
||||||
|
let name = `css-${d.property}`;
|
||||||
|
if (name in style) {
|
||||||
|
style[name] = d.value;
|
||||||
|
} else {
|
||||||
|
view[name] = d.value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
let ruleAnimations: KeyframeAnimationInfo[] = ruleset[animationsSymbol];
|
||||||
|
if (ruleAnimations && view.isLoaded && view.nativeView !== undefined) {
|
||||||
|
for (let animationInfo of ruleAnimations) {
|
||||||
|
let animation = KeyframeAnimation.keyframeAnimationFromInfo(animationInfo);
|
||||||
|
if (animation) {
|
||||||
|
view._registerAnimation(animation);
|
||||||
|
animation.play(view)
|
||||||
|
.then(() => { view._unregisterAnimation(animation); })
|
||||||
|
.catch((e) => { view._unregisterAnimation(animation); });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -249,58 +274,6 @@ function isKeyframe(node: Node): node is Keyframes {
|
|||||||
return node.type === "keyframes";
|
return node.type === "keyframes";
|
||||||
}
|
}
|
||||||
|
|
||||||
function applyDescriptors(view: ViewBase, ruleset: RuleSet): void {
|
|
||||||
let style = view.style;
|
|
||||||
ruleset.declarations.forEach(d => {
|
|
||||||
let name = `css-${d.property}`;
|
|
||||||
if (name in style) {
|
|
||||||
style[name] = d.value;
|
|
||||||
} else {
|
|
||||||
view[name] = d.value;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// let modifier = observable.ValueSource.Css;
|
|
||||||
// ruleset.declarations.forEach(d => withStyleProperty(d.property, d.value, (property, value) => {
|
|
||||||
// if (types.isString(property)) {
|
|
||||||
// const propertyName = <string>property;
|
|
||||||
// let attrHandled = false;
|
|
||||||
// let specialSetter = getSpecialPropertySetter(propertyName);
|
|
||||||
|
|
||||||
// if (!attrHandled && specialSetter) {
|
|
||||||
// specialSetter(view, value);
|
|
||||||
// attrHandled = true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (!attrHandled && propertyName in view) {
|
|
||||||
// view[propertyName] = convertString(value);
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// const resolvedProperty = <StyleProperty>property;
|
|
||||||
// try {
|
|
||||||
// view.style._setValue(resolvedProperty, value, modifier);
|
|
||||||
// } catch (ex) {
|
|
||||||
// if (traceEnabled) {
|
|
||||||
// traceWrite("Error setting property: " + resolvedProperty.name + " view: " + view + " value: " + value + " " + ex, traceCategories.Style, trace.messageType.error);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }));
|
|
||||||
|
|
||||||
let ruleAnimations: KeyframeAnimationInfo[] = ruleset[animationsSymbol];
|
|
||||||
if (ruleAnimations && view.isLoaded && view.nativeView !== undefined) {
|
|
||||||
for (let animationInfo of ruleAnimations) {
|
|
||||||
let animation = KeyframeAnimation.keyframeAnimationFromInfo(animationInfo);
|
|
||||||
if (animation) {
|
|
||||||
view._registerAnimation(animation);
|
|
||||||
animation.play(view)
|
|
||||||
.then(() => { view._unregisterAnimation(animation); })
|
|
||||||
.catch((e) => { view._unregisterAnimation(animation); });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function applyInlineStyle(view: ViewBase, declarations: Declaration[]): void {
|
function applyInlineStyle(view: ViewBase, declarations: Declaration[]): void {
|
||||||
let style = view.style;
|
let style = view.style;
|
||||||
declarations.forEach(d => {
|
declarations.forEach(d => {
|
||||||
|
@ -11,6 +11,7 @@ export class TextBase extends TextBaseCommon {
|
|||||||
|
|
||||||
//Text
|
//Text
|
||||||
get [textProperty.native](): string {
|
get [textProperty.native](): string {
|
||||||
|
console.log("Set textProperty.native...");
|
||||||
let nativeView = this.nativeView;
|
let nativeView = this.nativeView;
|
||||||
if (nativeView instanceof UIButton) {
|
if (nativeView instanceof UIButton) {
|
||||||
return nativeView.titleForState(UIControlState.Normal);
|
return nativeView.titleForState(UIControlState.Normal);
|
||||||
|
Reference in New Issue
Block a user