mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix(core): type collisions with namespace (#8809)
This commit is contained in:
@@ -1,8 +1,8 @@
|
||||
import { ButtonBase } from './button-common';
|
||||
import { PseudoClassHandler } from '../core/view';
|
||||
import { paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, Length, zIndexProperty, minWidthProperty, minHeightProperty } from '../styling/style-properties';
|
||||
import { paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, Length, zIndexProperty, minWidthProperty, minHeightProperty, LengthType } from '../styling/style-properties';
|
||||
import { textAlignmentProperty } from '../text-base';
|
||||
import { TextAlignment } from '../enums';
|
||||
import { Enums } from '../enums';
|
||||
import { profile } from '../../profiling';
|
||||
import { TouchGestureEventData, GestureTypes, TouchAction } from '../gestures';
|
||||
import { Device } from '../../platform';
|
||||
@@ -114,43 +114,43 @@ export class Button extends ButtonBase {
|
||||
}
|
||||
}
|
||||
|
||||
[minWidthProperty.getDefault](): Length {
|
||||
[minWidthProperty.getDefault](): LengthType {
|
||||
const dips = org.nativescript.widgets.ViewHelper.getMinWidth(this.nativeViewProtected);
|
||||
|
||||
return { value: dips, unit: 'px' };
|
||||
}
|
||||
|
||||
[minHeightProperty.getDefault](): Length {
|
||||
[minHeightProperty.getDefault](): LengthType {
|
||||
const dips = org.nativescript.widgets.ViewHelper.getMinHeight(this.nativeViewProtected);
|
||||
|
||||
return { value: dips, unit: 'px' };
|
||||
}
|
||||
|
||||
[paddingTopProperty.getDefault](): Length {
|
||||
[paddingTopProperty.getDefault](): LengthType {
|
||||
return { value: this._defaultPaddingTop, unit: 'px' };
|
||||
}
|
||||
[paddingTopProperty.setNative](value: Length) {
|
||||
[paddingTopProperty.setNative](value: LengthType) {
|
||||
org.nativescript.widgets.ViewHelper.setPaddingTop(this.nativeViewProtected, Length.toDevicePixels(value, 0) + Length.toDevicePixels(this.style.borderTopWidth, 0));
|
||||
}
|
||||
|
||||
[paddingRightProperty.getDefault](): Length {
|
||||
[paddingRightProperty.getDefault](): LengthType {
|
||||
return { value: this._defaultPaddingRight, unit: 'px' };
|
||||
}
|
||||
[paddingRightProperty.setNative](value: Length) {
|
||||
[paddingRightProperty.setNative](value: LengthType) {
|
||||
org.nativescript.widgets.ViewHelper.setPaddingRight(this.nativeViewProtected, Length.toDevicePixels(value, 0) + Length.toDevicePixels(this.style.borderRightWidth, 0));
|
||||
}
|
||||
|
||||
[paddingBottomProperty.getDefault](): Length {
|
||||
[paddingBottomProperty.getDefault](): LengthType {
|
||||
return { value: this._defaultPaddingBottom, unit: 'px' };
|
||||
}
|
||||
[paddingBottomProperty.setNative](value: Length) {
|
||||
[paddingBottomProperty.setNative](value: LengthType) {
|
||||
org.nativescript.widgets.ViewHelper.setPaddingBottom(this.nativeViewProtected, Length.toDevicePixels(value, 0) + Length.toDevicePixels(this.style.borderBottomWidth, 0));
|
||||
}
|
||||
|
||||
[paddingLeftProperty.getDefault](): Length {
|
||||
[paddingLeftProperty.getDefault](): LengthType {
|
||||
return { value: this._defaultPaddingLeft, unit: 'px' };
|
||||
}
|
||||
[paddingLeftProperty.setNative](value: Length) {
|
||||
[paddingLeftProperty.setNative](value: LengthType) {
|
||||
org.nativescript.widgets.ViewHelper.setPaddingLeft(this.nativeViewProtected, Length.toDevicePixels(value, 0) + Length.toDevicePixels(this.style.borderLeftWidth, 0));
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ export class Button extends ButtonBase {
|
||||
org.nativescript.widgets.ViewHelper.setZIndex(this.nativeViewProtected, value);
|
||||
}
|
||||
|
||||
[textAlignmentProperty.setNative](value: TextAlignment) {
|
||||
[textAlignmentProperty.setNative](value: Enums.TextAlignmentType) {
|
||||
// Button initial value is center.
|
||||
const newValue = value === 'initial' ? 'center' : value;
|
||||
super[textAlignmentProperty.setNative](newValue);
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
import { ControlStateChangeListener } from '../core/control-state-change';
|
||||
import { ButtonBase } from './button-common';
|
||||
import { View, PseudoClassHandler } from '../core/view';
|
||||
import { borderTopWidthProperty, borderRightWidthProperty, borderBottomWidthProperty, borderLeftWidthProperty, paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, Length, zIndexProperty, minWidthProperty, minHeightProperty } from '../styling/style-properties';
|
||||
import { textAlignmentProperty, whiteSpaceProperty, WhiteSpace } from '../text-base';
|
||||
import { TextAlignment } from '../enums';
|
||||
import { profile } from '../../profiling';
|
||||
import { TouchGestureEventData, GestureTypes, TouchAction } from '../gestures';
|
||||
import { Device } from '../../platform';
|
||||
import { borderTopWidthProperty, borderRightWidthProperty, borderBottomWidthProperty, borderLeftWidthProperty, paddingLeftProperty, paddingTopProperty, paddingRightProperty, paddingBottomProperty, LengthType } from '../styling/style-properties';
|
||||
import { textAlignmentProperty, whiteSpaceProperty } from '../text-base';
|
||||
import { layout } from '../../utils';
|
||||
import { Enums } from '../enums';
|
||||
|
||||
export * from './button-common';
|
||||
|
||||
@@ -59,13 +56,13 @@ export class Button extends ButtonBase {
|
||||
}
|
||||
}
|
||||
|
||||
[borderTopWidthProperty.getDefault](): Length {
|
||||
[borderTopWidthProperty.getDefault](): LengthType {
|
||||
return {
|
||||
value: this.nativeViewProtected.contentEdgeInsets.top,
|
||||
unit: 'px',
|
||||
};
|
||||
}
|
||||
[borderTopWidthProperty.setNative](value: Length) {
|
||||
[borderTopWidthProperty.setNative](value: LengthType) {
|
||||
const inset = this.nativeViewProtected.contentEdgeInsets;
|
||||
const top = layout.toDeviceIndependentPixels(this.effectivePaddingTop + this.effectiveBorderTopWidth);
|
||||
this.nativeViewProtected.contentEdgeInsets = {
|
||||
@@ -76,13 +73,13 @@ export class Button extends ButtonBase {
|
||||
};
|
||||
}
|
||||
|
||||
[borderRightWidthProperty.getDefault](): Length {
|
||||
[borderRightWidthProperty.getDefault](): LengthType {
|
||||
return {
|
||||
value: this.nativeViewProtected.contentEdgeInsets.right,
|
||||
unit: 'px',
|
||||
};
|
||||
}
|
||||
[borderRightWidthProperty.setNative](value: Length) {
|
||||
[borderRightWidthProperty.setNative](value: LengthType) {
|
||||
const inset = this.nativeViewProtected.contentEdgeInsets;
|
||||
const right = layout.toDeviceIndependentPixels(this.effectivePaddingRight + this.effectiveBorderRightWidth);
|
||||
this.nativeViewProtected.contentEdgeInsets = {
|
||||
@@ -93,13 +90,13 @@ export class Button extends ButtonBase {
|
||||
};
|
||||
}
|
||||
|
||||
[borderBottomWidthProperty.getDefault](): Length {
|
||||
[borderBottomWidthProperty.getDefault](): LengthType {
|
||||
return {
|
||||
value: this.nativeViewProtected.contentEdgeInsets.bottom,
|
||||
unit: 'px',
|
||||
};
|
||||
}
|
||||
[borderBottomWidthProperty.setNative](value: Length) {
|
||||
[borderBottomWidthProperty.setNative](value: LengthType) {
|
||||
const inset = this.nativeViewProtected.contentEdgeInsets;
|
||||
const bottom = layout.toDeviceIndependentPixels(this.effectivePaddingBottom + this.effectiveBorderBottomWidth);
|
||||
this.nativeViewProtected.contentEdgeInsets = {
|
||||
@@ -110,13 +107,13 @@ export class Button extends ButtonBase {
|
||||
};
|
||||
}
|
||||
|
||||
[borderLeftWidthProperty.getDefault](): Length {
|
||||
[borderLeftWidthProperty.getDefault](): LengthType {
|
||||
return {
|
||||
value: this.nativeViewProtected.contentEdgeInsets.left,
|
||||
unit: 'px',
|
||||
};
|
||||
}
|
||||
[borderLeftWidthProperty.setNative](value: Length) {
|
||||
[borderLeftWidthProperty.setNative](value: LengthType) {
|
||||
const inset = this.nativeViewProtected.contentEdgeInsets;
|
||||
const left = layout.toDeviceIndependentPixels(this.effectivePaddingLeft + this.effectiveBorderLeftWidth);
|
||||
this.nativeViewProtected.contentEdgeInsets = {
|
||||
@@ -127,13 +124,13 @@ export class Button extends ButtonBase {
|
||||
};
|
||||
}
|
||||
|
||||
[paddingTopProperty.getDefault](): Length {
|
||||
[paddingTopProperty.getDefault](): LengthType {
|
||||
return {
|
||||
value: this.nativeViewProtected.contentEdgeInsets.top,
|
||||
unit: 'px',
|
||||
};
|
||||
}
|
||||
[paddingTopProperty.setNative](value: Length) {
|
||||
[paddingTopProperty.setNative](value: LengthType) {
|
||||
const inset = this.nativeViewProtected.contentEdgeInsets;
|
||||
const top = layout.toDeviceIndependentPixels(this.effectivePaddingTop + this.effectiveBorderTopWidth);
|
||||
this.nativeViewProtected.contentEdgeInsets = {
|
||||
@@ -144,13 +141,13 @@ export class Button extends ButtonBase {
|
||||
};
|
||||
}
|
||||
|
||||
[paddingRightProperty.getDefault](): Length {
|
||||
[paddingRightProperty.getDefault](): LengthType {
|
||||
return {
|
||||
value: this.nativeViewProtected.contentEdgeInsets.right,
|
||||
unit: 'px',
|
||||
};
|
||||
}
|
||||
[paddingRightProperty.setNative](value: Length) {
|
||||
[paddingRightProperty.setNative](value: LengthType) {
|
||||
const inset = this.nativeViewProtected.contentEdgeInsets;
|
||||
const right = layout.toDeviceIndependentPixels(this.effectivePaddingRight + this.effectiveBorderRightWidth);
|
||||
this.nativeViewProtected.contentEdgeInsets = {
|
||||
@@ -161,13 +158,13 @@ export class Button extends ButtonBase {
|
||||
};
|
||||
}
|
||||
|
||||
[paddingBottomProperty.getDefault](): Length {
|
||||
[paddingBottomProperty.getDefault](): LengthType {
|
||||
return {
|
||||
value: this.nativeViewProtected.contentEdgeInsets.bottom,
|
||||
unit: 'px',
|
||||
};
|
||||
}
|
||||
[paddingBottomProperty.setNative](value: Length) {
|
||||
[paddingBottomProperty.setNative](value: LengthType) {
|
||||
const inset = this.nativeViewProtected.contentEdgeInsets;
|
||||
const bottom = layout.toDeviceIndependentPixels(this.effectivePaddingBottom + this.effectiveBorderBottomWidth);
|
||||
this.nativeViewProtected.contentEdgeInsets = {
|
||||
@@ -178,13 +175,13 @@ export class Button extends ButtonBase {
|
||||
};
|
||||
}
|
||||
|
||||
[paddingLeftProperty.getDefault](): Length {
|
||||
[paddingLeftProperty.getDefault](): LengthType {
|
||||
return {
|
||||
value: this.nativeViewProtected.contentEdgeInsets.left,
|
||||
unit: 'px',
|
||||
};
|
||||
}
|
||||
[paddingLeftProperty.setNative](value: Length) {
|
||||
[paddingLeftProperty.setNative](value: LengthType) {
|
||||
const inset = this.nativeViewProtected.contentEdgeInsets;
|
||||
const left = layout.toDeviceIndependentPixels(this.effectivePaddingLeft + this.effectiveBorderLeftWidth);
|
||||
this.nativeViewProtected.contentEdgeInsets = {
|
||||
@@ -195,7 +192,7 @@ export class Button extends ButtonBase {
|
||||
};
|
||||
}
|
||||
|
||||
[textAlignmentProperty.setNative](value: TextAlignment) {
|
||||
[textAlignmentProperty.setNative](value: Enums.TextAlignmentType) {
|
||||
switch (value) {
|
||||
case 'left':
|
||||
this.nativeViewProtected.titleLabel.textAlignment = NSTextAlignment.Left;
|
||||
@@ -213,7 +210,7 @@ export class Button extends ButtonBase {
|
||||
}
|
||||
}
|
||||
|
||||
[whiteSpaceProperty.setNative](value: WhiteSpace) {
|
||||
[whiteSpaceProperty.setNative](value: Enums.WhiteSpaceType) {
|
||||
const nativeView = this.nativeViewProtected.titleLabel;
|
||||
switch (value) {
|
||||
case 'normal':
|
||||
|
||||
Reference in New Issue
Block a user